mirror of
https://github.com/azahar-emu/soundtouch
synced 2025-11-08 16:10:10 +01:00
Replaced custom 'BOOL' type with C++ 'bool'
This commit is contained in:
parent
f68f8e9e09
commit
e23bd6d093
@ -60,20 +60,6 @@ typedef unsigned long ulong;
|
|||||||
#include "soundtouch_config.h"
|
#include "soundtouch_config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WINDEF_
|
|
||||||
// if these aren't defined already by Windows headers, define now
|
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
typedef signed char BOOL;
|
|
||||||
#else
|
|
||||||
typedef int BOOL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FALSE 0
|
|
||||||
#define TRUE 1
|
|
||||||
|
|
||||||
#endif // _WINDEF_
|
|
||||||
|
|
||||||
|
|
||||||
namespace soundtouch
|
namespace soundtouch
|
||||||
{
|
{
|
||||||
|
|||||||
@ -160,7 +160,7 @@ private:
|
|||||||
float virtualPitch;
|
float virtualPitch;
|
||||||
|
|
||||||
/// Flag: Has sample rate been set?
|
/// Flag: Has sample rate been set?
|
||||||
BOOL bSrateSet;
|
bool bSrateSet;
|
||||||
|
|
||||||
/// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and
|
/// Calculates effective rate & tempo valuescfrom 'virtualRate', 'virtualTempo' and
|
||||||
/// 'virtualPitch' parameters.
|
/// 'virtualPitch' parameters.
|
||||||
@ -247,8 +247,8 @@ public:
|
|||||||
/// Changes a setting controlling the processing system behaviour. See the
|
/// Changes a setting controlling the processing system behaviour. See the
|
||||||
/// 'SETTING_...' defines for available setting ID's.
|
/// 'SETTING_...' defines for available setting ID's.
|
||||||
///
|
///
|
||||||
/// \return 'TRUE' if the setting was succesfully changed
|
/// \return 'true' if the setting was succesfully changed
|
||||||
BOOL setSetting(int settingId, ///< Setting ID number. see SETTING_... defines.
|
bool setSetting(int settingId, ///< Setting ID number. see SETTING_... defines.
|
||||||
int value ///< New setting value.
|
int value ///< New setting value.
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -130,8 +130,8 @@ RunParameters::RunParameters(const int nParams, const char * const paramStr[])
|
|||||||
quick = 0;
|
quick = 0;
|
||||||
noAntiAlias = 0;
|
noAntiAlias = 0;
|
||||||
goalBPM = 0;
|
goalBPM = 0;
|
||||||
speech = FALSE;
|
speech = false;
|
||||||
detectBPM = FALSE;
|
detectBPM = false;
|
||||||
|
|
||||||
// Get input & output file names
|
// Get input & output file names
|
||||||
inFileName = (char*)paramStr[1];
|
inFileName = (char*)paramStr[1];
|
||||||
@ -262,7 +262,7 @@ void RunParameters::parseSwitchParam(const string &str)
|
|||||||
|
|
||||||
case 'b' :
|
case 'b' :
|
||||||
// switch '-bpm=xx'
|
// switch '-bpm=xx'
|
||||||
detectBPM = TRUE;
|
detectBPM = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
goalBPM = parseSwitchValue(str);
|
goalBPM = parseSwitchValue(str);
|
||||||
@ -291,7 +291,7 @@ void RunParameters::parseSwitchParam(const string &str)
|
|||||||
|
|
||||||
case 's' :
|
case 's' :
|
||||||
// switch '-speech'
|
// switch '-speech'
|
||||||
speech = TRUE;
|
speech = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -63,8 +63,8 @@ public:
|
|||||||
int quick;
|
int quick;
|
||||||
int noAntiAlias;
|
int noAntiAlias;
|
||||||
float goalBPM;
|
float goalBPM;
|
||||||
BOOL detectBPM;
|
bool detectBPM;
|
||||||
BOOL speech;
|
bool speech;
|
||||||
|
|
||||||
RunParameters(const int nParams, const char * const paramStr[]);
|
RunParameters(const int nParams, const char * const paramStr[]);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -299,7 +299,7 @@ int main(const int nParams, const char * const paramStr[])
|
|||||||
// Open input & output files
|
// Open input & output files
|
||||||
openFiles(&inFile, &outFile, params);
|
openFiles(&inFile, &outFile, params);
|
||||||
|
|
||||||
if (params->detectBPM == TRUE)
|
if (params->detectBPM == true)
|
||||||
{
|
{
|
||||||
// detect sound BPM (and adjust processing parameters
|
// detect sound BPM (and adjust processing parameters
|
||||||
// accordingly if necessary)
|
// accordingly if necessary)
|
||||||
|
|||||||
@ -180,6 +180,6 @@ int InterpolateShannon::transposeMulti(SAMPLETYPE *pdest,
|
|||||||
int &srcSamples)
|
int &srcSamples)
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
assert(FALSE);
|
assert(false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,7 +57,7 @@ TransposerBase::ALGORITHM TransposerBase::algorithm = TransposerBase::CUBIC;
|
|||||||
// Constructor
|
// Constructor
|
||||||
RateTransposer::RateTransposer() : FIFOProcessor(&outputBuffer)
|
RateTransposer::RateTransposer() : FIFOProcessor(&outputBuffer)
|
||||||
{
|
{
|
||||||
bUseAAFilter = TRUE;
|
bUseAAFilter = true;
|
||||||
|
|
||||||
// Instantiates the anti-alias filter
|
// Instantiates the anti-alias filter
|
||||||
pAAFilter = new AAFilter(64);
|
pAAFilter = new AAFilter(64);
|
||||||
@ -75,14 +75,14 @@ RateTransposer::~RateTransposer()
|
|||||||
|
|
||||||
|
|
||||||
/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
|
/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
|
||||||
void RateTransposer::enableAAFilter(BOOL newMode)
|
void RateTransposer::enableAAFilter(bool newMode)
|
||||||
{
|
{
|
||||||
bUseAAFilter = newMode;
|
bUseAAFilter = newMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Returns nonzero if anti-alias filter is enabled.
|
/// Returns nonzero if anti-alias filter is enabled.
|
||||||
BOOL RateTransposer::isAAFilterEnabled() const
|
bool RateTransposer::isAAFilterEnabled() const
|
||||||
{
|
{
|
||||||
return bUseAAFilter;
|
return bUseAAFilter;
|
||||||
}
|
}
|
||||||
@ -139,7 +139,7 @@ void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples)
|
|||||||
|
|
||||||
// If anti-alias filter is turned off, simply transpose without applying
|
// If anti-alias filter is turned off, simply transpose without applying
|
||||||
// the filter
|
// the filter
|
||||||
if (bUseAAFilter == FALSE)
|
if (bUseAAFilter == false)
|
||||||
{
|
{
|
||||||
count = pTransposer->transpose(outputBuffer, inputBuffer);
|
count = pTransposer->transpose(outputBuffer, inputBuffer);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -118,7 +118,7 @@ protected:
|
|||||||
/// Output sample buffer
|
/// Output sample buffer
|
||||||
FIFOSampleBuffer outputBuffer;
|
FIFOSampleBuffer outputBuffer;
|
||||||
|
|
||||||
BOOL bUseAAFilter;
|
bool bUseAAFilter;
|
||||||
|
|
||||||
|
|
||||||
/// Transposes sample rate by applying anti-alias filter to prevent folding.
|
/// Transposes sample rate by applying anti-alias filter to prevent folding.
|
||||||
@ -151,10 +151,10 @@ public:
|
|||||||
AAFilter *getAAFilter();
|
AAFilter *getAAFilter();
|
||||||
|
|
||||||
/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
|
/// Enables/disables the anti-alias filter. Zero to disable, nonzero to enable
|
||||||
void enableAAFilter(BOOL newMode);
|
void enableAAFilter(bool newMode);
|
||||||
|
|
||||||
/// Returns nonzero if anti-alias filter is enabled.
|
/// Returns nonzero if anti-alias filter is enabled.
|
||||||
BOOL isAAFilterEnabled() const;
|
bool isAAFilterEnabled() const;
|
||||||
|
|
||||||
/// Sets new target rate. Normal rate = 1.0, smaller values represent slower
|
/// Sets new target rate. Normal rate = 1.0, smaller values represent slower
|
||||||
/// rate, larger faster rates.
|
/// rate, larger faster rates.
|
||||||
|
|||||||
@ -111,7 +111,7 @@ SoundTouch::SoundTouch()
|
|||||||
calcEffectiveRateAndTempo();
|
calcEffectiveRateAndTempo();
|
||||||
|
|
||||||
channels = 0;
|
channels = 0;
|
||||||
bSrateSet = FALSE;
|
bSrateSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ void SoundTouch::calcEffectiveRateAndTempo()
|
|||||||
// Sets sample rate.
|
// Sets sample rate.
|
||||||
void SoundTouch::setSampleRate(uint srate)
|
void SoundTouch::setSampleRate(uint srate)
|
||||||
{
|
{
|
||||||
bSrateSet = TRUE;
|
bSrateSet = true;
|
||||||
// set sample rate, leave other tempo changer parameters as they are.
|
// set sample rate, leave other tempo changer parameters as they are.
|
||||||
pTDStretch->setParameters((int)srate);
|
pTDStretch->setParameters((int)srate);
|
||||||
}
|
}
|
||||||
@ -293,7 +293,7 @@ void SoundTouch::setSampleRate(uint srate)
|
|||||||
// the input of the object.
|
// the input of the object.
|
||||||
void SoundTouch::putSamples(const SAMPLETYPE *samples, uint nSamples)
|
void SoundTouch::putSamples(const SAMPLETYPE *samples, uint nSamples)
|
||||||
{
|
{
|
||||||
if (bSrateSet == FALSE)
|
if (bSrateSet == false)
|
||||||
{
|
{
|
||||||
ST_THROW_RT_ERROR("SoundTouch : Sample rate not defined");
|
ST_THROW_RT_ERROR("SoundTouch : Sample rate not defined");
|
||||||
}
|
}
|
||||||
@ -388,7 +388,7 @@ void SoundTouch::flush()
|
|||||||
|
|
||||||
// Changes a setting controlling the processing system behaviour. See the
|
// Changes a setting controlling the processing system behaviour. See the
|
||||||
// 'SETTING_...' defines for available setting ID's.
|
// 'SETTING_...' defines for available setting ID's.
|
||||||
BOOL SoundTouch::setSetting(int settingId, int value)
|
bool SoundTouch::setSetting(int settingId, int value)
|
||||||
{
|
{
|
||||||
int sampleRate, sequenceMs, seekWindowMs, overlapMs;
|
int sampleRate, sequenceMs, seekWindowMs, overlapMs;
|
||||||
|
|
||||||
@ -399,36 +399,36 @@ BOOL SoundTouch::setSetting(int settingId, int value)
|
|||||||
{
|
{
|
||||||
case SETTING_USE_AA_FILTER :
|
case SETTING_USE_AA_FILTER :
|
||||||
// enables / disabless anti-alias filter
|
// enables / disabless anti-alias filter
|
||||||
pRateTransposer->enableAAFilter((value != 0) ? TRUE : FALSE);
|
pRateTransposer->enableAAFilter((value != 0) ? true : false);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case SETTING_AA_FILTER_LENGTH :
|
case SETTING_AA_FILTER_LENGTH :
|
||||||
// sets anti-alias filter length
|
// sets anti-alias filter length
|
||||||
pRateTransposer->getAAFilter()->setLength(value);
|
pRateTransposer->getAAFilter()->setLength(value);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case SETTING_USE_QUICKSEEK :
|
case SETTING_USE_QUICKSEEK :
|
||||||
// enables / disables tempo routine quick seeking algorithm
|
// enables / disables tempo routine quick seeking algorithm
|
||||||
pTDStretch->enableQuickSeek((value != 0) ? TRUE : FALSE);
|
pTDStretch->enableQuickSeek((value != 0) ? true : false);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case SETTING_SEQUENCE_MS:
|
case SETTING_SEQUENCE_MS:
|
||||||
// change time-stretch sequence duration parameter
|
// change time-stretch sequence duration parameter
|
||||||
pTDStretch->setParameters(sampleRate, value, seekWindowMs, overlapMs);
|
pTDStretch->setParameters(sampleRate, value, seekWindowMs, overlapMs);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case SETTING_SEEKWINDOW_MS:
|
case SETTING_SEEKWINDOW_MS:
|
||||||
// change time-stretch seek window length parameter
|
// change time-stretch seek window length parameter
|
||||||
pTDStretch->setParameters(sampleRate, sequenceMs, value, overlapMs);
|
pTDStretch->setParameters(sampleRate, sequenceMs, value, overlapMs);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
case SETTING_OVERLAP_MS:
|
case SETTING_OVERLAP_MS:
|
||||||
// change time-stretch overlap length parameter
|
// change time-stretch overlap length parameter
|
||||||
pTDStretch->setParameters(sampleRate, sequenceMs, seekWindowMs, value);
|
pTDStretch->setParameters(sampleRate, sequenceMs, seekWindowMs, value);
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -84,15 +84,15 @@ static const short _scanOffsets[5][24]={
|
|||||||
|
|
||||||
TDStretch::TDStretch() : FIFOProcessor(&outputBuffer)
|
TDStretch::TDStretch() : FIFOProcessor(&outputBuffer)
|
||||||
{
|
{
|
||||||
bQuickSeek = FALSE;
|
bQuickSeek = false;
|
||||||
channels = 2;
|
channels = 2;
|
||||||
|
|
||||||
pMidBuffer = NULL;
|
pMidBuffer = NULL;
|
||||||
pMidBufferUnaligned = NULL;
|
pMidBufferUnaligned = NULL;
|
||||||
overlapLength = 0;
|
overlapLength = 0;
|
||||||
|
|
||||||
bAutoSeqSetting = TRUE;
|
bAutoSeqSetting = true;
|
||||||
bAutoSeekSetting = TRUE;
|
bAutoSeekSetting = true;
|
||||||
|
|
||||||
// outDebt = 0;
|
// outDebt = 0;
|
||||||
skipFract = 0;
|
skipFract = 0;
|
||||||
@ -132,23 +132,23 @@ void TDStretch::setParameters(int aSampleRate, int aSequenceMS,
|
|||||||
if (aSequenceMS > 0)
|
if (aSequenceMS > 0)
|
||||||
{
|
{
|
||||||
this->sequenceMs = aSequenceMS;
|
this->sequenceMs = aSequenceMS;
|
||||||
bAutoSeqSetting = FALSE;
|
bAutoSeqSetting = false;
|
||||||
}
|
}
|
||||||
else if (aSequenceMS == 0)
|
else if (aSequenceMS == 0)
|
||||||
{
|
{
|
||||||
// if zero, use automatic setting
|
// if zero, use automatic setting
|
||||||
bAutoSeqSetting = TRUE;
|
bAutoSeqSetting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSeekWindowMS > 0)
|
if (aSeekWindowMS > 0)
|
||||||
{
|
{
|
||||||
this->seekWindowMs = aSeekWindowMS;
|
this->seekWindowMs = aSeekWindowMS;
|
||||||
bAutoSeekSetting = FALSE;
|
bAutoSeekSetting = false;
|
||||||
}
|
}
|
||||||
else if (aSeekWindowMS == 0)
|
else if (aSeekWindowMS == 0)
|
||||||
{
|
{
|
||||||
// if zero, use automatic setting
|
// if zero, use automatic setting
|
||||||
bAutoSeekSetting = TRUE;
|
bAutoSeekSetting = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
calcSeqParameters();
|
calcSeqParameters();
|
||||||
@ -231,14 +231,14 @@ void TDStretch::clear()
|
|||||||
|
|
||||||
// Enables/disables the quick position seeking algorithm. Zero to disable, nonzero
|
// Enables/disables the quick position seeking algorithm. Zero to disable, nonzero
|
||||||
// to enable
|
// to enable
|
||||||
void TDStretch::enableQuickSeek(BOOL enable)
|
void TDStretch::enableQuickSeek(bool enable)
|
||||||
{
|
{
|
||||||
bQuickSeek = enable;
|
bQuickSeek = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns nonzero if the quick seeking algorithm is enabled.
|
// Returns nonzero if the quick seeking algorithm is enabled.
|
||||||
BOOL TDStretch::isQuickSeekEnabled() const
|
bool TDStretch::isQuickSeekEnabled() const
|
||||||
{
|
{
|
||||||
return bQuickSeek;
|
return bQuickSeek;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -125,14 +125,14 @@ protected:
|
|||||||
float skipFract;
|
float skipFract;
|
||||||
FIFOSampleBuffer outputBuffer;
|
FIFOSampleBuffer outputBuffer;
|
||||||
FIFOSampleBuffer inputBuffer;
|
FIFOSampleBuffer inputBuffer;
|
||||||
BOOL bQuickSeek;
|
bool bQuickSeek;
|
||||||
|
|
||||||
int sampleRate;
|
int sampleRate;
|
||||||
int sequenceMs;
|
int sequenceMs;
|
||||||
int seekWindowMs;
|
int seekWindowMs;
|
||||||
int overlapMs;
|
int overlapMs;
|
||||||
BOOL bAutoSeqSetting;
|
bool bAutoSeqSetting;
|
||||||
BOOL bAutoSeekSetting;
|
bool bAutoSeekSetting;
|
||||||
|
|
||||||
void acceptNewOverlapLength(int newOverlapLength);
|
void acceptNewOverlapLength(int newOverlapLength);
|
||||||
|
|
||||||
@ -195,10 +195,10 @@ public:
|
|||||||
|
|
||||||
/// Enables/disables the quick position seeking algorithm. Zero to disable,
|
/// Enables/disables the quick position seeking algorithm. Zero to disable,
|
||||||
/// nonzero to enable
|
/// nonzero to enable
|
||||||
void enableQuickSeek(BOOL enable);
|
void enableQuickSeek(bool enable);
|
||||||
|
|
||||||
/// Returns nonzero if the quick seeking algorithm is enabled.
|
/// Returns nonzero if the quick seeking algorithm is enabled.
|
||||||
BOOL isQuickSeekEnabled() const;
|
bool isQuickSeekEnabled() const;
|
||||||
|
|
||||||
/// Sets routine control parameters. These control are certain time constants
|
/// Sets routine control parameters. These control are certain time constants
|
||||||
/// defining how the sound is stretched to the desired duration.
|
/// defining how the sound is stretched to the desired duration.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user