3rdparty/soundtouch: Bump to v2.3.3

This commit is contained in:
JordanTheToaster 2024-08-06 03:23:12 +01:00 committed by lightningterror
parent 30e7de7555
commit ebc3923b35
32 changed files with 954 additions and 915 deletions

View File

@ -15,8 +15,8 @@
<body class="normal">
<hr>
<h1>SoundTouch audio processing library v2.3.1</h1>
<p class="normal">SoundTouch library Copyright &copy; Olli Parviainen 2001-2021</p>
<h1>SoundTouch audio processing library v2.3.3</h1>
<p class="normal">SoundTouch library Copyright &copy; Olli Parviainen 2001-2024</p>
<hr>
<h2>1. Introduction </h2>
<p>SoundTouch is an open-source audio processing library that allows
@ -35,7 +35,7 @@
<p>Author email: oparviai 'at' iki.fi </p>
<p>SoundTouch WWW page: <a href="http://soundtouch.surina.net">http://soundtouch.surina.net</a></p>
<p>SoundTouch git repository: <a
href="https://gitlab.com/soundtouch/soundtouch.git">https://gitlab.com/soundtouch/soundtouch.git</a></p>
href="https://codeberg.org/soundtouch/soundtouch.git">https://codeberg.org/soundtouch/soundtouch.git</a></p>
<hr>
<h2>2. Compiling SoundTouch</h2>
<p>Before compiling, notice that you can choose the sample data format if it's
@ -131,10 +131,12 @@
</table>
<b>Compiling portable Shared Library / DLL version</b>
<p> The GNU autotools compilation does not automatically create a shared-library version of
SoundTouch (.so or .dll) that features position-independent code and C-language
api that are more suitable for cross-language development than C++ libraries.</p>
<p> Use script "make-gnu-dll-sh" to build a portable dynamic library version if such is desired.</p>
<p> The GNU autotools compilation automatically builds an additional dynamic-link version
of SoundTouch library that features position-independent code and "C"-style API that is
more suitable for calling the SoundTouch routines from other programming languages.</p>
<p>This dynamic-link library is built under source/SoundTouchDLL directory, whose
subdirectories also comtain simple example apps that use the dynamic-link library.
</p>
<h4><b>2.2.2 Compiling with cmake</b></h4>
<p>'cmake' build scripts are provided as an alternative to the autotools toolchain.</p>
@ -145,6 +147,9 @@
cmake .
make -j
make install</pre>
<p>To list available build options:</p>
<pre>
cmake -LH</pre>
<p>To compile the additional portable Shared Library / DLL version with the native C-language API:</p>
<pre>
cmake . -DSOUNDTOUCH_DLL=ON
@ -448,7 +453,7 @@
<h2><a name="SoundStretch"></a>4. SoundStretch audio processing utility
</h2>
<p>SoundStretch audio processing utility<br>
Copyright (c) Olli Parviainen 2002-2015</p>
Copyright (c) Olli Parviainen 2002-2024</p>
<p>SoundStretch is a simple command-line application that can change
tempo, pitch and playback rates of WAV sound files. This program is
intended primarily to demonstrate how the "SoundTouch" library can be
@ -603,6 +608,18 @@
<hr>
<h2>5. Change History</h2>
<h3>5.1. SoundTouch library Change History </h3>
<p><b>2.3.3:</b></p>
<ul class="current">
<li>Fixing compiler warnings, maintenance fixes to make/build files for various systems
</li>
</ul>
<p><b>2.3.2:</b></p>
<ul>
<li>Improve autotools makefiles to build the `SoundTouchDLL` dynamic-link link library with
C-style API. This library variation is easier to import and use from other programming
languages than the default C++ library.
</li>
</ul>
<p><b>2.3.1:</b></p>
<ul>
<li>Adjusted cmake build settings and header files that cmake installs</li>
@ -865,11 +882,14 @@
<li> Initial release</li>
</ul>
<h3>5.2. SoundStretch application Change History </h3>
<p><b>2.3.3:</b></p>
<ul class="current_soundstretch">
<li>Added support for Asian / non-latin filenames in Windows. Gnu platform has supported them already earlier.</li>
</ul>
<p><b>1.9:</b></p>
<ul>
<li>Added support for WAV file 'fact' information chunk.</li>
</ul>
<p><b>1.7.0:</b></p>
<ul>
<li>Bugfixes in Wavfile: exception string formatting, avoid getLengthMs() integer
@ -966,6 +986,7 @@
<li> Michael Pruett</li>
<li> Rajeev Puran</li>
<li> RJ Ryan</li>
<li> Serge Sans Paille</li>
<li> John Sheehy</li>
<li> Tim Shuttleworth</li>
<li> Albert Sirvent</li>

View File

@ -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);

View File

@ -88,11 +88,11 @@ public:
void moveSamples(FIFOSamplePipe &other ///< Other pipe instance where from the receive the data.
)
{
int oNumSamples = other.numSamples();
const uint oNumSamples = other.numSamples();
putSamples(other.ptrBegin(), oNumSamples);
other.receiveSamples(oNumSamples);
};
}
/// Output samples from beginning of the sample buffer. Copies requested samples to
/// output buffer and removes them from the sample buffer. If there are less than
@ -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.

View File

@ -72,10 +72,10 @@ namespace soundtouch
{
/// Soundtouch library version string
#define SOUNDTOUCH_VERSION "2.3.1"
#define SOUNDTOUCH_VERSION "2.3.3"
/// SoundTouch library version id
#define SOUNDTOUCH_VERSION_ID (20301)
#define SOUNDTOUCH_VERSION_ID (20303)
//
// Available setting IDs for the 'setSetting' & 'get_setting' functions:

View File

@ -0,0 +1,52 @@
////////////////////////////////////////////////////////////////////////////////
///
/// Char type for SoundStretch
///
/// Author : Copyright (c) Olli Parviainen
/// Author e-mail : oparviai 'at' iki.fi
/// SoundTouch WWW: http://www.surina.net/soundtouch
///
////////////////////////////////////////////////////////////////////////////////
//
// License :
//
// SoundTouch audio processing library
// Copyright (c) Olli Parviainen
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////
#ifndef SS_CHARTYPE_H
#define SS_CHARTYPE_H
#include <string>
namespace soundstretch
{
#if _WIN32
// wide-char types for supporting non-latin file paths in Windows
using CHARTYPE = wchar_t;
using STRING = std::wstring;
#define STRING_CONST(x) (L"" x)
#else
// gnu platform can natively support UTF-8 paths using "char*" set
using CHARTYPE = char;
using STRING = std::string;
#define STRING_CONST(x) (x)
#endif
}
#endif //SS_CHARTYPE_H

View File

@ -42,14 +42,23 @@
#include <string>
#include <sstream>
#include <cstring>
#include <assert.h>
#include <limits.h>
#include <cassert>
#include <climits>
#include "WavFile.h"
#include "STTypes.h"
using namespace std;
namespace soundstretch
{
#if _WIN32
#define FOPEN(name, mode) _wfopen(name, STRING_CONST(mode))
#else
#define FOPEN(name, mode) fopen(name, mode)
#endif
static const char riffStr[] = "RIFF";
static const char waveStr[] = "WAVE";
static const char fmtStr[] = "fmt ";
@ -123,7 +132,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 +147,7 @@ static const char dataStr[] = "data";
WavFileBase::WavFileBase()
{
convBuff = NULL;
convBuff = nullptr;
convBuffSize = 0;
}
@ -169,17 +178,13 @@ void *WavFileBase::getConvBuffer(int sizeBytes)
// Class WavInFile
//
WavInFile::WavInFile(const char *fileName)
WavInFile::WavInFile(const STRING& fileName)
{
// Try to open the file for reading
fptr = fopen(fileName, "rb");
if (fptr == NULL)
fptr = FOPEN(fileName.c_str(), "rb");
if (fptr == nullptr)
{
// didn't succeed
string msg = "Error : Unable to open file \"";
msg += fileName;
msg += "\" for reading.";
ST_THROW_RT_ERROR(msg.c_str());
ST_THROW_RT_ERROR("Error : Unable to open file for reading.");
}
init();
@ -192,9 +197,7 @@ WavInFile::WavInFile(FILE *file)
fptr = file;
if (!file)
{
// didn't succeed
string msg = "Error : Unable to access input stream for reading";
ST_THROW_RT_ERROR(msg.c_str());
ST_THROW_RT_ERROR("Error : Unable to access input stream for reading");
}
init();
@ -213,7 +216,6 @@ void WavInFile::init()
hdrsOk = readWavHeaders();
if (hdrsOk != 0)
{
// Something didn't match in the wav file headers
ST_THROW_RT_ERROR("Input file is corrupt or not a WAV file");
}
@ -223,7 +225,6 @@ void WavInFile::init()
(header.format.byte_per_sample < 1) || (header.format.byte_per_sample > 320) ||
(header.format.bits_per_sample < 8) || (header.format.bits_per_sample > 32))
{
// Something didn't match in the wav file headers
ST_THROW_RT_ERROR("Error: Illegal wav file header format parameters.");
}
@ -234,7 +235,7 @@ void WavInFile::init()
WavInFile::~WavInFile()
{
if (fptr) fclose(fptr);
fptr = NULL;
fptr = nullptr;
}
@ -450,7 +451,7 @@ int WavInFile::read(float *buffer, int maxElems)
int WavInFile::eof() const
{
// return true if all data has been read or file eof has reached
return (dataRead == header.data.data_len || feof(fptr));
return ((uint)dataRead == header.data.data_len || feof(fptr));
}
@ -703,17 +704,13 @@ uint WavInFile::getElapsedMS() const
// Class WavOutFile
//
WavOutFile::WavOutFile(const char *fileName, int sampleRate, int bits, int channels)
WavOutFile::WavOutFile(const STRING& fileName, int sampleRate, int bits, int channels)
{
bytesWritten = 0;
fptr = fopen(fileName, "wb");
if (fptr == NULL)
fptr = FOPEN(fileName.c_str(), "wb");
if (fptr == nullptr)
{
string msg = "Error : Unable to open file \"";
msg += fileName;
msg += "\" for writing.";
//pmsg = msg.c_str;
ST_THROW_RT_ERROR(msg.c_str());
ST_THROW_RT_ERROR("Error : Unable to open file for writing.");
}
fillInHeader(sampleRate, bits, channels);
@ -725,10 +722,9 @@ 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());
ST_THROW_RT_ERROR("Error : Unable to access output file stream.");
}
fillInHeader(sampleRate, bits, channels);
@ -740,7 +736,7 @@ WavOutFile::~WavOutFile()
{
finishHeader();
if (fptr) fclose(fptr);
fptr = NULL;
fptr = nullptr;
}
@ -875,7 +871,7 @@ void WavOutFile::write(const short *buffer, int numElems)
// use temp buffer to swap byte order if necessary
short* pTemp = (short*)getConvBuffer(numElems * sizeof(short));
memcpy(pTemp, buffer, numElems * 2);
memcpy(pTemp, buffer, (size_t)numElems * 2L);
_swap16Buffer(pTemp, numElems);
res = (int)fwrite(pTemp, 2, numElems, fptr);
@ -984,3 +980,5 @@ void WavOutFile::write(const float *buffer, int numElems)
}
bytesWritten += numBytes;
}
}

View File

@ -40,7 +40,12 @@
#ifndef WAVFILE_H
#define WAVFILE_H
#include <stdio.h>
#include <cstdio>
#include <string>
#include "SS_CharTypes.h"
namespace soundstretch
{
#ifndef uint
typedef unsigned int uint;
@ -118,9 +123,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;
@ -148,7 +150,7 @@ private:
public:
/// Constructor: Opens the given WAV file. If the file can't be opened,
/// throws 'runtime_error' exception.
WavInFile(const char *filename);
WavInFile(const STRING& filename);
WavInFile(FILE *file);
@ -244,7 +246,7 @@ private:
public:
/// Constructor: Creates a new WAV file. Throws a 'runtime_error' exception
/// if file creation fails.
WavOutFile(const char *fileName, ///< Filename
WavOutFile(const STRING& fileName, ///< Filename
int sampleRate, ///< Sample rate (e.g. 44100 etc)
int bits, ///< Bits per sample (8 or 16 bits)
int channels ///< Number of channels (1=mono, 2=stereo)
@ -274,4 +276,6 @@ public:
);
};
}
#endif

View File

@ -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 ++)
{

View File

@ -376,8 +376,6 @@ void BPMDetect::updateBeatPos(int process_samples)
// detect beats
for (int i = 0; i < skipstep; i++)
{
LONG_SAMPLETYPE max = 0;
float sum = beatcorr_ringbuff[beatcorr_ringbuffpos];
sum -= beat_lpf.update(sum);
@ -556,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++)
{

View File

@ -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");
}

View File

@ -59,8 +59,8 @@ FIRFilter::FIRFilter()
resultDivider = 0;
length = 0;
lengthDiv8 = 0;
filterCoeffs = NULL;
filterCoeffsStereo = NULL;
filterCoeffs = nullptr;
filterCoeffsStereo = nullptr;
}
@ -75,15 +75,11 @@ FIRFilter::~FIRFilter()
uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) const
{
int j, end;
#ifdef SOUNDTOUCH_FLOAT_SAMPLES
// when using floating point samples, use a scaler instead of a divider
// because division is much slower operation than multiplying.
double dScaler = 1.0 / (double)resultDivider;
#endif
// hint compiler autovectorization that loop length is divisible by 8
int ilength = length & -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);
@ -96,7 +92,7 @@ uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, ui
suml = sumr = 0;
ptr = src + j;
for (int i = 0; i < ilength; i ++)
for (uint i = 0; i < ilength; i ++)
{
suml += ptr[2 * i] * filterCoeffsStereo[2 * i];
sumr += ptr[2 * i + 1] * filterCoeffsStereo[2 * i + 1];
@ -121,11 +117,6 @@ uint FIRFilter::evaluateFilterStereo(SAMPLETYPE *dest, const SAMPLETYPE *src, ui
uint FIRFilter::evaluateFilterMono(SAMPLETYPE *dest, const SAMPLETYPE *src, uint numSamples) const
{
int j, end;
#ifdef SOUNDTOUCH_FLOAT_SAMPLES
// when using floating point samples, use a scaler instead of a divider
// because division is much slower operation than multiplying.
double dScaler = 1.0 / (double)resultDivider;
#endif
// hint compiler autovectorization that loop length is divisible by 8
int ilength = length & -8;
@ -160,16 +151,10 @@ uint FIRFilter::evaluateFilterMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, uin
{
int j, end;
#ifdef SOUNDTOUCH_FLOAT_SAMPLES
// when using floating point samples, use a scaler instead of a divider
// because division is much slower operation than multiplying.
double dScaler = 1.0 / (double)resultDivider;
#endif
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
@ -288,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!");
@ -301,6 +286,7 @@ FIRFilter * FIRFilter::newInstance()
uint uExtensions;
uExtensions = detectCPUextensions();
(void)uExtensions;
// Check if MMX/SSE instruction set extensions supported by CPU

View File

@ -38,7 +38,7 @@
namespace soundtouch
{
class InterpolateCubic final : public TransposerBase
class InterpolateCubic : public TransposerBase
{
protected:
virtual int transposeMono(SAMPLETYPE *dest,
@ -58,7 +58,7 @@ public:
virtual void resetRegisters() override;
int getLatency() const override
virtual int getLatency() const override
{
return 1;
}

View File

@ -39,7 +39,7 @@ namespace soundtouch
{
/// Linear transposer class that uses integer arithmetic
class InterpolateLinearInteger final : public TransposerBase
class InterpolateLinearInteger : public TransposerBase
{
protected:
int iFract;
@ -61,7 +61,7 @@ public:
virtual void resetRegisters() override;
int getLatency() const override
virtual int getLatency() const override
{
return 0;
}
@ -69,25 +69,25 @@ public:
/// Linear transposer class that uses floating point arithmetic
class InterpolateLinearFloat final : public TransposerBase
class InterpolateLinearFloat : public TransposerBase
{
protected:
double fract;
virtual int transposeMono(SAMPLETYPE *dest,
const SAMPLETYPE *src,
int &srcSamples) override;
int &srcSamples);
virtual int transposeStereo(SAMPLETYPE *dest,
const SAMPLETYPE *src,
int &srcSamples) override;
virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples) override;
int &srcSamples);
virtual int transposeMulti(SAMPLETYPE *dest, const SAMPLETYPE *src, int &srcSamples);
public:
InterpolateLinearFloat();
void resetRegisters() override;
virtual void resetRegisters();
int getLatency() const override
int getLatency() const
{
return 0;
}

View File

@ -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);

View File

@ -43,7 +43,7 @@
namespace soundtouch
{
class InterpolateShannon final : public TransposerBase
class InterpolateShannon : public TransposerBase
{
protected:
int transposeMono(SAMPLETYPE *dest,
@ -63,7 +63,7 @@ public:
void resetRegisters() override;
int getLatency() const override
virtual int getLatency() const override
{
return 3;
}

View File

@ -131,8 +131,6 @@ void RateTransposer::putSamples(const SAMPLETYPE *samples, uint nSamples)
// the 'set_returnBuffer_size' function.
void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples)
{
uint count;
if (nSamples == 0) return;
// Store samples to input buffer
@ -142,7 +140,7 @@ void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples)
// the filter
if (bUseAAFilter == false)
{
count = pTransposer->transpose(outputBuffer, inputBuffer);
(void)pTransposer->transpose(outputBuffer, inputBuffer);
return;
}
@ -309,7 +307,7 @@ TransposerBase *TransposerBase::newInstance()
default:
assert(false);
return NULL;
return nullptr;
}
#endif
}

View File

@ -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 :

View File

@ -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!");
@ -772,6 +753,7 @@ TDStretch * TDStretch::newInstance()
uint uExtensions;
uExtensions = detectCPUextensions();
(void)uExtensions;
// Check if MMX/SSE instruction set extensions supported by CPU

View File

@ -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;

View File

@ -294,8 +294,8 @@ void TDStretchMMX::overlapStereo(short *output, const short *input) const
FIRFilterMMX::FIRFilterMMX() : FIRFilter()
{
filterCoeffsAlign = NULL;
filterCoeffsUnalign = NULL;
filterCoeffsAlign = nullptr;
filterCoeffsUnalign = nullptr;
}

View File

@ -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'