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