diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f94e3b..b6718fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ if(MSVC) set(COMPILE_DEFINITIONS /O2 /fp:fast) set(COMPILE_OPTIONS ) else() - set(COMPILE_OPTIONS -Ofast -Wall -Wno-unknown-pragmas) + set(COMPILE_OPTIONS -Ofast -Wall -Wextra -Wzero-as-null-pointer-constant -Wno-unknown-pragmas) endif() ##################### diff --git a/include/BPMDetect.h b/include/BPMDetect.h index 8ece784..763266f 100644 --- a/include/BPMDetect.h +++ b/include/BPMDetect.h @@ -196,7 +196,7 @@ namespace soundtouch /// - "values" receive array of beat detection strengths /// - max_num indicates max.size of "pos" and "values" array. /// - /// You can query a suitable array sized by calling this with NULL in "pos" & "values". + /// You can query a suitable array sized by calling this with nullptr in "pos" & "values". /// /// \return number of beats in the arrays. int getBeats(float *pos, float *strength, int max_num); diff --git a/include/FIFOSamplePipe.h b/include/FIFOSamplePipe.h index 663c5c6..2ce5178 100644 --- a/include/FIFOSamplePipe.h +++ b/include/FIFOSamplePipe.h @@ -144,8 +144,8 @@ protected: /// Sets output pipe. void setOutPipe(FIFOSamplePipe *pOutput) { - assert(output == NULL); - assert(pOutput != NULL); + assert(output == nullptr); + assert(pOutput != nullptr); output = pOutput; } @@ -153,7 +153,7 @@ protected: /// 'setOutPipe' function. FIFOProcessor() { - output = NULL; + output = nullptr; } /// Constructor. Configures output pipe. diff --git a/source/Android-lib/jni/soundtouch-jni.cpp b/source/Android-lib/jni/soundtouch-jni.cpp index 83cb446..01fdab0 100644 --- a/source/Android-lib/jni/soundtouch-jni.cpp +++ b/source/Android-lib/jni/soundtouch-jni.cpp @@ -46,7 +46,7 @@ static void _setErrmsg(const char *msg) #include extern pthread_key_t gomp_tls_key; -static void * _p_gomp_tls = NULL; +static void * _p_gomp_tls = nullptr; /// Function to initialize threading for OpenMP. /// @@ -54,7 +54,7 @@ static void * _p_gomp_tls = NULL; /// called from the Android App main thread because in the main thread the gomp_tls storage is /// properly set, however, Android does not properly initialize gomp_tls storage for other threads. /// Thus if OpenMP routines are invoked from some other thread than the main thread, -/// the OpenMP routine will crash the application due to NULL pointer access on uninitialized storage. +/// the OpenMP routine will crash the application due to nullptr access on uninitialized storage. /// /// This workaround stores the gomp_tls storage from main thread, and copies to other threads. /// In order this to work, the Application main thread needws to call at least "getVersionString" @@ -63,7 +63,7 @@ static int _init_threading(bool warn) { void *ptr = pthread_getspecific(gomp_tls_key); LOGV("JNI thread-specific TLS storage %ld", (long)ptr); - if (ptr == NULL) + if (ptr == nullptr) { LOGV("JNI set missing TLS storage to %ld", (long)_p_gomp_tls); pthread_setspecific(gomp_tls_key, _p_gomp_tls); @@ -74,7 +74,7 @@ static int _init_threading(bool warn) _p_gomp_tls = ptr; } // Where critical, show warning if storage still not properly initialized - if ((warn) && (_p_gomp_tls == NULL)) + if ((warn) && (_p_gomp_tls == nullptr)) { _setErrmsg("Error - OpenMP threading not properly initialized: Call SoundTouch.getVersionString() from the App main thread!"); return -1; diff --git a/source/SoundStretch/RunParameters.cpp b/source/SoundStretch/RunParameters.cpp index 1960a35..54b3b62 100644 --- a/source/SoundStretch/RunParameters.cpp +++ b/source/SoundStretch/RunParameters.cpp @@ -115,8 +115,8 @@ RunParameters::RunParameters(const int nParams, const char * const paramStr[]) ST_THROW_RT_ERROR(msg.c_str()); } - inFileName = NULL; - outFileName = NULL; + inFileName = nullptr; + outFileName = nullptr; tempoDelta = 0; pitchDelta = 0; rateDelta = 0; @@ -133,7 +133,7 @@ RunParameters::RunParameters(const int nParams, const char * const paramStr[]) if (outFileName[0] == '-') { // no outputfile name was given but parameters - outFileName = NULL; + outFileName = nullptr; nFirstParam = 2; } else diff --git a/source/SoundStretch/WavFile.cpp b/source/SoundStretch/WavFile.cpp index 539edd2..459e2ed 100644 --- a/source/SoundStretch/WavFile.cpp +++ b/source/SoundStretch/WavFile.cpp @@ -123,7 +123,7 @@ static const char dataStr[] = "data"; } // dummy helper-function - static inline void _swap16Buffer(short *pData, int numBytes) + static inline void _swap16Buffer(short *, int) { // do nothing } @@ -138,7 +138,7 @@ static const char dataStr[] = "data"; WavFileBase::WavFileBase() { - convBuff = NULL; + convBuff = nullptr; convBuffSize = 0; } @@ -173,7 +173,7 @@ WavInFile::WavInFile(const char *fileName) { // Try to open the file for reading fptr = fopen(fileName, "rb"); - if (fptr == NULL) + if (fptr == nullptr) { // didn't succeed string msg = "Error : Unable to open file \""; @@ -234,7 +234,7 @@ void WavInFile::init() WavInFile::~WavInFile() { if (fptr) fclose(fptr); - fptr = NULL; + fptr = nullptr; } @@ -707,7 +707,7 @@ WavOutFile::WavOutFile(const char *fileName, int sampleRate, int bits, int chann { bytesWritten = 0; fptr = fopen(fileName, "wb"); - if (fptr == NULL) + if (fptr == nullptr) { string msg = "Error : Unable to open file \""; msg += fileName; @@ -725,7 +725,7 @@ WavOutFile::WavOutFile(FILE *file, int sampleRate, int bits, int channels) { bytesWritten = 0; fptr = file; - if (fptr == NULL) + if (fptr == nullptr) { string msg = "Error : Unable to access output file stream."; ST_THROW_RT_ERROR(msg.c_str()); @@ -740,7 +740,7 @@ WavOutFile::~WavOutFile() { finishHeader(); if (fptr) fclose(fptr); - fptr = NULL; + fptr = nullptr; } diff --git a/source/SoundStretch/WavFile.h b/source/SoundStretch/WavFile.h index b0f4d96..61a174e 100644 --- a/source/SoundStretch/WavFile.h +++ b/source/SoundStretch/WavFile.h @@ -118,9 +118,6 @@ private: /// File pointer. FILE *fptr; - /// Position within the audio stream - long position; - /// Counter of how many bytes of sample data have been read from the file. long dataRead; diff --git a/source/SoundStretch/main.cpp b/source/SoundStretch/main.cpp index 1742731..1651ce7 100644 --- a/source/SoundStretch/main.cpp +++ b/source/SoundStretch/main.cpp @@ -103,7 +103,7 @@ static void openFiles(WavInFile **inFile, WavOutFile **outFile, const RunParamet } else { - *outFile = NULL; + *outFile = nullptr; } } @@ -172,7 +172,7 @@ static void process(SoundTouch *pSoundTouch, WavInFile *inFile, WavOutFile *outF int buffSizeSamples; SAMPLETYPE sampleBuffer[BUFF_SIZE]; - if ((inFile == NULL) || (outFile == NULL)) return; // nothing to do. + if ((inFile == nullptr) || (outFile == nullptr)) return; // nothing to do. nChannels = (int)inFile->getNumChannels(); assert(nChannels > 0); diff --git a/source/SoundTouch/AAFilter.cpp b/source/SoundTouch/AAFilter.cpp index 76a3da6..89c54cc 100644 --- a/source/SoundTouch/AAFilter.cpp +++ b/source/SoundTouch/AAFilter.cpp @@ -54,7 +54,7 @@ using namespace soundtouch; static void _DEBUG_SAVE_AAFIR_COEFFS(SAMPLETYPE *coeffs, int len) { FILE *fptr = fopen("aa_filter_coeffs.txt", "wt"); - if (fptr == NULL) return; + if (fptr == nullptr) return; for (int i = 0; i < len; i ++) { diff --git a/source/SoundTouch/BPMDetect.cpp b/source/SoundTouch/BPMDetect.cpp index 920e968..4c11a2e 100644 --- a/source/SoundTouch/BPMDetect.cpp +++ b/source/SoundTouch/BPMDetect.cpp @@ -554,13 +554,13 @@ float BPMDetect::getBpm() /// - "values" receive array of beat detection strengths /// - max_num indicates max.size of "pos" and "values" array. /// -/// You can query a suitable array sized by calling this with NULL in "pos" & "values". +/// You can query a suitable array sized by calling this with nullptr in "pos" & "values". /// /// \return number of beats in the arrays. int BPMDetect::getBeats(float *pos, float *values, int max_num) { int num = (int)beats.size(); - if ((!pos) || (!values)) return num; // pos or values NULL, return just size + if ((!pos) || (!values)) return num; // pos or values nullptr, return just size for (int i = 0; (i < num) && (i < max_num); i++) { diff --git a/source/SoundTouch/FIFOSampleBuffer.cpp b/source/SoundTouch/FIFOSampleBuffer.cpp index 15d1fc7..420e0d7 100644 --- a/source/SoundTouch/FIFOSampleBuffer.cpp +++ b/source/SoundTouch/FIFOSampleBuffer.cpp @@ -50,8 +50,8 @@ FIFOSampleBuffer::FIFOSampleBuffer(int numChannels) { assert(numChannels > 0); sizeInBytes = 0; // reasonable initial value - buffer = NULL; - bufferUnaligned = NULL; + buffer = nullptr; + bufferUnaligned = nullptr; samplesInBuffer = 0; bufferPos = 0; channels = (uint)numChannels; @@ -63,8 +63,8 @@ FIFOSampleBuffer::FIFOSampleBuffer(int numChannels) FIFOSampleBuffer::~FIFOSampleBuffer() { delete[] bufferUnaligned; - bufferUnaligned = NULL; - buffer = NULL; + bufferUnaligned = nullptr; + buffer = nullptr; } @@ -166,7 +166,7 @@ void FIFOSampleBuffer::ensureCapacity(uint capacityRequirement) sizeInBytes = (capacityRequirement * channels * sizeof(SAMPLETYPE) + 4095) & (uint)-4096; assert(sizeInBytes % 2 == 0); tempUnaligned = new SAMPLETYPE[sizeInBytes / sizeof(SAMPLETYPE) + 16 / sizeof(SAMPLETYPE)]; - if (tempUnaligned == NULL) + if (tempUnaligned == nullptr) { ST_THROW_RT_ERROR("Couldn't allocate memory!\n"); } diff --git a/source/SoundTouch/FIRFilter.cpp b/source/SoundTouch/FIRFilter.cpp index 478b3b6..473ca07 100644 --- a/source/SoundTouch/FIRFilter.cpp +++ b/source/SoundTouch/FIRFilter.cpp @@ -59,8 +59,8 @@ FIRFilter::FIRFilter() resultDivider = 0; length = 0; lengthDiv8 = 0; - filterCoeffs = NULL; - filterCoeffsStereo = NULL; + filterCoeffs = nullptr; + filterCoeffsStereo = nullptr; } @@ -78,7 +78,7 @@ uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, ui // hint compiler autovectorization that loop length is divisible by 8 uint ilength = length & -8; - assert((length != 0) && (length == ilength) && (src != NULL) && (dest != NULL) && (filterCoeffs != NULL)); + assert((length != 0) && (length == ilength) && (src != nullptr) && (dest != nullptr) && (filterCoeffs != nullptr)); assert(numSamples > ilength); end = 2 * (numSamples - ilength); @@ -152,9 +152,9 @@ uint FIRFilter::evaluateFilterMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, uin int j, end; assert(length != 0); - assert(src != NULL); - assert(dest != NULL); - assert(filterCoeffs != NULL); + assert(src != nullptr); + assert(dest != nullptr); + assert(filterCoeffs != nullptr); assert(numChannels < 16); // hint compiler autovectorization that loop length is divisible by 8 @@ -273,7 +273,7 @@ uint FIRFilter::evaluate(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSample // Operator 'new' is overloaded so that it automatically creates a suitable instance // depending on if we've a MMX-capable CPU available or not. -void * FIRFilter::operator new(size_t s) +void * FIRFilter::operator new(size_t) { // Notice! don't use "new FIRFilter" directly, use "newInstance" to create a new instance instead! ST_THROW_RT_ERROR("Error in FIRFilter::new: Don't use 'new FIRFilter', use 'newInstance' member instead!"); diff --git a/source/SoundTouch/InterpolateCubic.h b/source/SoundTouch/InterpolateCubic.h index 251c23f..64faf64 100644 --- a/source/SoundTouch/InterpolateCubic.h +++ b/source/SoundTouch/InterpolateCubic.h @@ -58,7 +58,7 @@ public: virtual void resetRegisters() override; - int getLatency() const + virtual int getLatency() const override { return 1; } diff --git a/source/SoundTouch/InterpolateLinear.h b/source/SoundTouch/InterpolateLinear.h index 6104fae..8034d76 100644 --- a/source/SoundTouch/InterpolateLinear.h +++ b/source/SoundTouch/InterpolateLinear.h @@ -61,7 +61,7 @@ public: virtual void resetRegisters() override; - int getLatency() const + virtual int getLatency() const override { return 0; } diff --git a/source/SoundTouch/InterpolateShannon.cpp b/source/SoundTouch/InterpolateShannon.cpp index 1d69a2e..8d97613 100644 --- a/source/SoundTouch/InterpolateShannon.cpp +++ b/source/SoundTouch/InterpolateShannon.cpp @@ -171,9 +171,9 @@ int InterpolateShannon::transposeStereo(SAMPLETYPE *pdest, /// Transpose stereo audio. Returns number of produced output samples, and /// updates "srcSamples" to amount of consumed source samples -int InterpolateShannon::transposeMulti(SAMPLETYPE *pdest, - const SAMPLETYPE *psrc, - int &srcSamples) +int InterpolateShannon::transposeMulti(SAMPLETYPE *, + const SAMPLETYPE *, + int &) { // not implemented assert(false); diff --git a/source/SoundTouch/InterpolateShannon.h b/source/SoundTouch/InterpolateShannon.h index 75876e1..e0c6fa5 100644 --- a/source/SoundTouch/InterpolateShannon.h +++ b/source/SoundTouch/InterpolateShannon.h @@ -63,7 +63,7 @@ public: void resetRegisters() override; - int getLatency() const + virtual int getLatency() const override { return 3; } diff --git a/source/SoundTouch/RateTransposer.cpp b/source/SoundTouch/RateTransposer.cpp index 1663b60..a48ea86 100644 --- a/source/SoundTouch/RateTransposer.cpp +++ b/source/SoundTouch/RateTransposer.cpp @@ -307,7 +307,7 @@ TransposerBase *TransposerBase::newInstance() default: assert(false); - return NULL; + return nullptr; } #endif } diff --git a/source/SoundTouch/SoundTouch.cpp b/source/SoundTouch/SoundTouch.cpp index 1618884..cb161f0 100644 --- a/source/SoundTouch/SoundTouch.cpp +++ b/source/SoundTouch/SoundTouch.cpp @@ -413,15 +413,15 @@ int SoundTouch::getSetting(int settingId) const return (uint)pTDStretch->isQuickSeekEnabled(); case SETTING_SEQUENCE_MS: - pTDStretch->getParameters(NULL, &temp, NULL, NULL); + pTDStretch->getParameters(nullptr, &temp, nullptr, nullptr); return temp; case SETTING_SEEKWINDOW_MS: - pTDStretch->getParameters(NULL, NULL, &temp, NULL); + pTDStretch->getParameters(nullptr, nullptr, &temp, nullptr); return temp; case SETTING_OVERLAP_MS: - pTDStretch->getParameters(NULL, NULL, NULL, &temp); + pTDStretch->getParameters(nullptr, nullptr, nullptr, &temp); return temp; case SETTING_NOMINAL_INPUT_SEQUENCE : diff --git a/source/SoundTouch/TDStretch.cpp b/source/SoundTouch/TDStretch.cpp index 243f7cc..157f0e4 100644 --- a/source/SoundTouch/TDStretch.cpp +++ b/source/SoundTouch/TDStretch.cpp @@ -54,25 +54,6 @@ using namespace soundtouch; #define max(x, y) (((x) > (y)) ? (x) : (y)) -/***************************************************************************** - * - * Constant definitions - * - *****************************************************************************/ - -// Table for the hierarchical mixing position seeking algorithm -const short _scanOffsets[5][24]={ - { 124, 186, 248, 310, 372, 434, 496, 558, 620, 682, 744, 806, - 868, 930, 992, 1054, 1116, 1178, 1240, 1302, 1364, 1426, 1488, 0}, - {-100, -75, -50, -25, 25, 50, 75, 100, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { -20, -15, -10, -5, 5, 10, 15, 20, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { -4, -3, -2, -1, 1, 2, 3, 4, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - { 121, 114, 97, 114, 98, 105, 108, 32, 104, 99, 117, 111, - 116, 100, 110, 117, 111, 115, 0, 0, 0, 0, 0, 0}}; - /***************************************************************************** * * Implementation of the class 'TDStretch' @@ -85,8 +66,8 @@ TDStretch::TDStretch() : FIFOProcessor(&outputBuffer) bQuickSeek = false; channels = 2; - pMidBuffer = NULL; - pMidBufferUnaligned = NULL; + pMidBuffer = nullptr; + pMidBufferUnaligned = nullptr; overlapLength = 0; bAutoSeqSetting = true; @@ -162,7 +143,7 @@ void TDStretch::setParameters(int aSampleRate, int aSequenceMS, /// Get routine control parameters, see setParameters() function. -/// Any of the parameters to this function can be NULL, in such case corresponding parameter +/// Any of the parameters to this function can be nullptr, in such case corresponding parameter /// value isn't returned. void TDStretch::getParameters(int *pSampleRate, int *pSequenceMs, int *pSeekWindowMs, int *pOverlapMs) const { @@ -759,7 +740,7 @@ void TDStretch::acceptNewOverlapLength(int newOverlapLength) // Operator 'new' is overloaded so that it automatically creates a suitable instance // depending on if we've a MMX/SSE/etc-capable CPU available or not. -void * TDStretch::operator new(size_t s) +void * TDStretch::operator new(size_t) { // Notice! don't use "new TDStretch" directly, use "newInstance" to create a new instance instead! ST_THROW_RT_ERROR("Error in TDStretch::new: Don't use 'new TDStretch' directly, use 'newInstance' member instead!"); diff --git a/source/SoundTouch/TDStretch.h b/source/SoundTouch/TDStretch.h index 71c0853..6fddc23 100644 --- a/source/SoundTouch/TDStretch.h +++ b/source/SoundTouch/TDStretch.h @@ -217,7 +217,7 @@ public: ); /// Get routine control parameters, see setParameters() function. - /// Any of the parameters to this function can be NULL, in such case corresponding parameter + /// Any of the parameters to this function can be nullptr, in such case corresponding parameter /// value isn't returned. void getParameters(int *pSampleRate, int *pSequenceMs, int *pSeekWindowMs, int *pOverlapMs) const; diff --git a/source/SoundTouch/mmx_optimized.cpp b/source/SoundTouch/mmx_optimized.cpp index 741ba4f..0a2949c 100644 --- a/source/SoundTouch/mmx_optimized.cpp +++ b/source/SoundTouch/mmx_optimized.cpp @@ -294,8 +294,8 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const FIRFilterMMX::FIRFilterMMX() : FIRFilter() { - filterCoeffsAlign = NULL; - filterCoeffsUnalign = NULL; + filterCoeffsAlign = nullptr; + filterCoeffsUnalign = nullptr; } diff --git a/source/SoundTouch/sse_optimized.cpp b/source/SoundTouch/sse_optimized.cpp index c17f443..ebcc441 100644 --- a/source/SoundTouch/sse_optimized.cpp +++ b/source/SoundTouch/sse_optimized.cpp @@ -195,16 +195,16 @@ double TDStretchSSE::calcCrossCorrAccumulate(const float *pV1, const float *pV2, FIRFilterSSE::FIRFilterSSE() : FIRFilter() { - filterCoeffsAlign = NULL; - filterCoeffsUnalign = NULL; + filterCoeffsAlign = nullptr; + filterCoeffsUnalign = nullptr; } FIRFilterSSE::~FIRFilterSSE() { delete[] filterCoeffsUnalign; - filterCoeffsAlign = NULL; - filterCoeffsUnalign = NULL; + filterCoeffsAlign = nullptr; + filterCoeffsUnalign = nullptr; } @@ -245,10 +245,10 @@ uint FIRFilterSSE::evaluateFilterStereo(float *dest, const float *source, uint n if (count < 2) return 0; - assert(source != NULL); - assert(dest != NULL); + assert(source != nullptr); + assert(dest != nullptr); assert((length % 8) == 0); - assert(filterCoeffsAlign != NULL); + assert(filterCoeffsAlign != nullptr); assert(((ulongptr)filterCoeffsAlign) % 16 == 0); // filter is evaluated for two stereo samples with each iteration, thus use of 'j += 2' diff --git a/source/SoundTouchDLL/LazarusTest/SoundTouchDLL.pas b/source/SoundTouchDLL/LazarusTest/SoundTouchDLL.pas index 5e117aa..853dc28 100644 --- a/source/SoundTouchDLL/LazarusTest/SoundTouchDLL.pas +++ b/source/SoundTouchDLL/LazarusTest/SoundTouchDLL.pas @@ -137,7 +137,7 @@ type /// Receive ready samples from the processing pipeline. /// - /// if called with outBuffer=NULL, just reduces amount of ready samples within the pipeline. + /// if called with outBuffer=nullptr, just reduces amount of ready samples within the pipeline. TSoundTouchReceiveSamples = function (Handle: TSoundTouchHandle; OutBuffer: PSingle; //< Buffer where to copy output samples. MaxSamples: Integer //< How many samples to receive at max. diff --git a/source/SoundTouchDLL/SoundTouchDLL.cpp b/source/SoundTouchDLL/SoundTouchDLL.cpp index 3f78cca..28ebfba 100644 --- a/source/SoundTouchDLL/SoundTouchDLL.cpp +++ b/source/SoundTouchDLL/SoundTouchDLL.cpp @@ -90,10 +90,10 @@ SOUNDTOUCHDLL_API HANDLE __cdecl soundtouch_createInstance() { tmp->dwMagic = STMAGIC; tmp->pst = new SoundTouch(); - if (tmp->pst == NULL) + if (tmp->pst == nullptr) { delete tmp; - tmp = NULL; + tmp = nullptr; } } return (HANDLE)tmp; @@ -107,7 +107,7 @@ SOUNDTOUCHDLL_API void __cdecl soundtouch_destroyInstance(HANDLE h) sth->dwMagic = 0; if (sth->pst) delete sth->pst; - sth->pst = NULL; + sth->pst = nullptr; delete sth; } @@ -375,7 +375,7 @@ SOUNDTOUCHDLL_API uint __cdecl soundtouch_numUnprocessedSamples(HANDLE h) /// Receive ready samples from the processing pipeline. /// -/// if called with outBuffer=NULL, just reduces amount of ready samples within the pipeline. +/// if called with outBuffer=nullptr, just reduces amount of ready samples within the pipeline. SOUNDTOUCHDLL_API uint __cdecl soundtouch_receiveSamples(HANDLE h, SAMPLETYPE *outBuffer, ///< Buffer where to copy output samples. unsigned int maxSamples ///< How many samples to receive at max. @@ -406,7 +406,7 @@ SOUNDTOUCHDLL_API uint __cdecl soundtouch_receiveSamples_i16(HANDLE h, if (sth->dwMagic != STMAGIC) return 0; uint outTotal = 0; - if (outBuffer == NULL) + if (outBuffer == nullptr) { // only reduce sample count, not receive samples return sth->pst->receiveSamples(maxSamples); @@ -480,12 +480,12 @@ SOUNDTOUCHDLL_API HANDLE __cdecl bpm_createInstance(int numChannels, int sampleR } catch (const std::exception&) { - tmp->pbpm = NULL; + tmp->pbpm = nullptr; } - if (tmp->pbpm == NULL) + if (tmp->pbpm == nullptr) { delete tmp; - tmp = NULL; + tmp = nullptr; } } return (HANDLE)tmp; @@ -499,7 +499,7 @@ SOUNDTOUCHDLL_API void __cdecl bpm_destroyInstance(HANDLE h) sth->dwMagic = 0; if (sth->pbpm) delete sth->pbpm; - sth->pbpm = NULL; + sth->pbpm = nullptr; delete sth; }