2016-05-17 03:04:11 +12:00
|
|
|
#pragma once
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
#ifndef TSOP_INCLUDED
|
|
|
|
#define TSOP_INCLUDED
|
|
|
|
|
|
|
|
#include "tsound.h"
|
|
|
|
|
|
|
|
#undef DVAPI
|
|
|
|
#undef DVVAR
|
|
|
|
#ifdef TSOUND_EXPORTS
|
|
|
|
#define DVAPI DV_EXPORT_API
|
|
|
|
#define DVVAR DV_EXPORT_VAR
|
|
|
|
#else
|
|
|
|
#define DVAPI DV_IMPORT_API
|
|
|
|
#define DVVAR DV_IMPORT_VAR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//===================================================================
|
|
|
|
|
2016-06-29 18:17:12 +12:00
|
|
|
class DVAPI TSopException final : public TException {
|
2016-06-15 18:43:10 +12:00
|
|
|
TString m_message;
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
public:
|
2016-06-15 18:43:10 +12:00
|
|
|
TSopException(const TString &s) : m_message(s) {}
|
|
|
|
~TSopException() {}
|
2016-03-19 06:57:51 +13:00
|
|
|
|
2016-06-19 20:06:29 +12:00
|
|
|
TString getMessage() const override { return m_message; };
|
2016-03-19 06:57:51 +13:00
|
|
|
};
|
|
|
|
|
|
|
|
//===================================================================
|
|
|
|
//! \include sop_ex.cpp
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
namespace TSop {
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Convert the soundtrack src to the format of the soundtrack dst
|
|
|
|
*/
|
|
|
|
DVAPI void convert(TSoundTrackP &dst, const TSoundTrackP &src);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Convert the soundtrack src to the format specified in dstFormat
|
|
|
|
and return the new soundtrack
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP convert(const TSoundTrackP &src,
|
|
|
|
const TSoundTrackFormat &dstFormat);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
2016-06-15 18:43:10 +12:00
|
|
|
Resampls the soundtrack src at the specified sampleRate and
|
2016-03-19 06:57:51 +13:00
|
|
|
returns the obtained soundtrack
|
|
|
|
*/
|
|
|
|
DVAPI TSoundTrackP resample(TSoundTrackP src, TINT32 sampleRate);
|
|
|
|
|
|
|
|
/*!
|
2016-06-15 18:43:10 +12:00
|
|
|
Reverbs the soundtrack src with the specified feature and
|
2016-03-19 06:57:51 +13:00
|
|
|
returns the obtained soundtrack
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP reverb(TSoundTrackP src, double delayTime,
|
|
|
|
double decayFactor, double extendTime);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
2016-06-15 18:43:10 +12:00
|
|
|
Gates the soundtrack src with the specified feature and
|
2016-03-19 06:57:51 +13:00
|
|
|
returns the obtained soundtrack
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP gate(TSoundTrackP src, double threshold, double holdTime,
|
|
|
|
double releaseTime);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Does the echo effect to the soundtrack src with the specified feature
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI void echo(TSoundTrackP &dst, const TSoundTrackP &src, double delayTime,
|
|
|
|
double decayFactor, double extendTime);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
2021-07-09 00:12:10 +12:00
|
|
|
Stretches the soundtrack src with the specified feature and
|
2016-03-19 06:57:51 +13:00
|
|
|
returns the obtained soundtrack
|
|
|
|
*/
|
2021-07-09 00:12:10 +12:00
|
|
|
DVAPI TSoundTrackP timeStretch(TSoundTrackP src, double ratio);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Do the mixing between the two soundtrack a1 and a2 must be inside [0.0,1.0]
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP mix(const TSoundTrackP &st1, const TSoundTrackP &st2,
|
|
|
|
double a1, double a2);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Inserts l blank samples starting from the sample s0 of the soundtrack.
|
|
|
|
*/
|
|
|
|
DVAPI TSoundTrackP insertBlank(TSoundTrackP src, TINT32 s0, TINT32 l);
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
/*!
|
2016-03-19 06:57:51 +13:00
|
|
|
Inserts a blank portion of duration l into the soundtrack, starting from t0.
|
|
|
|
t0 and l are expressed in seconds.
|
|
|
|
*/
|
|
|
|
DVAPI TSoundTrackP insertBlank(TSoundTrackP src, double t0, double l);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Removes from the soundtrack the samples in the range [s0, s1].
|
|
|
|
Returns a soundtrack that contains just the samples that have been removed
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP remove(TSoundTrackP src, TINT32 s0, TINT32 s1,
|
|
|
|
TSoundTrackP &paste);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
2016-06-15 18:43:10 +12:00
|
|
|
Remove the portion of soundtrack in the range [t0, t1].
|
2016-03-19 06:57:51 +13:00
|
|
|
t0 and t1 are expressed in seconds.
|
|
|
|
Returns a soundtrack that contains just the portion that has been removed.
|
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP remove(TSoundTrackP src, double t0, double t1,
|
|
|
|
TSoundTrackP &paste);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns a soundtrack that has just the riseFactor of sample of src.
|
|
|
|
The samples of the output soundTrack come from the "zero" sample to
|
|
|
|
the value of the first sample of src
|
|
|
|
*/
|
|
|
|
DVAPI TSoundTrackP fadeIn(const TSoundTrackP src, double riseFactor);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns a soundtrack that has just the decayFactor of sample of src.
|
|
|
|
The samples of the output soundTrack come from the value of the last sample
|
2016-06-15 18:43:10 +12:00
|
|
|
of src to the "zero" sample
|
2016-03-19 06:57:51 +13:00
|
|
|
*/
|
|
|
|
DVAPI TSoundTrackP fadeOut(const TSoundTrackP src, double decayFactor);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns a soundtrack that has just the crossFactor of sample of src2.
|
|
|
|
The samples of the output soundTrack come from the value of the last sample
|
2016-06-15 18:43:10 +12:00
|
|
|
of src1 to the value of the first sample of src2
|
2016-03-19 06:57:51 +13:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP crossFade(const TSoundTrackP src1, const TSoundTrackP src2,
|
|
|
|
double crossFactor);
|
2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Returns a soundtrack that has the sampleCount of src2.
|
|
|
|
But the first crossFactor of samples come from the value of the last sample
|
2016-06-15 18:43:10 +12:00
|
|
|
of src1 to the value of the crossFactor-th sample of src2
|
2016-03-19 06:57:51 +13:00
|
|
|
*/
|
2016-06-15 18:43:10 +12:00
|
|
|
DVAPI TSoundTrackP crossFade(double crossFactor, const TSoundTrackP src1,
|
|
|
|
const TSoundTrackP src2);
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|