diff options
author | oparviai <oparviai@f3a24b6a-cf45-0410-b55a-8c22e2698227> | 2013-06-14 21:34:33 +0400 |
---|---|---|
committer | oparviai <oparviai@f3a24b6a-cf45-0410-b55a-8c22e2698227> | 2013-06-14 21:34:33 +0400 |
commit | 4c3cded3b6e52787f37dd2ac2022effd6d5e50f9 (patch) | |
tree | cc53df59fe21c6e8ceb8f75357e86e4be56ddbeb | |
parent | 41c97b8cc2618ee9fc5a67c092c93450a5609f62 (diff) |
Bugfix and cleanups
-rw-r--r-- | source/SoundStretch/main.cpp | 4 | ||||
-rw-r--r-- | source/SoundTouch/RateTransposer.cpp | 12 | ||||
-rw-r--r-- | source/SoundTouch/TDStretch.cpp | 6 |
3 files changed, 9 insertions, 13 deletions
diff --git a/source/SoundStretch/main.cpp b/source/SoundStretch/main.cpp index c34db33..daff86c 100644 --- a/source/SoundStretch/main.cpp +++ b/source/SoundStretch/main.cpp @@ -48,8 +48,8 @@ using namespace soundtouch;
using namespace std;
-// Processing chunk size
-#define BUFF_SIZE 2048
+// Processing chunk size (size chosen to be divisible by 2, 4, 6, 8, 10, 12, 14, 16 channels ...)
+#define BUFF_SIZE 6720
#if _WIN32
#include <io.h>
diff --git a/source/SoundTouch/RateTransposer.cpp b/source/SoundTouch/RateTransposer.cpp index 6913972..3fb1e46 100644 --- a/source/SoundTouch/RateTransposer.cpp +++ b/source/SoundTouch/RateTransposer.cpp @@ -394,9 +394,9 @@ RateTransposerInteger::~RateTransposerInteger() void RateTransposerInteger::resetRegisters()
{
iSlopeCount = 0;
- if (sPrevSample) delete[] sPrevSample;
+ delete[] sPrevSample;
sPrevSample = new SAMPLETYPE[numChannels];
- memset(sPrevSample, 0, numChannels*sizeof(*sPrevSample));
+ memset(sPrevSample, 0, numChannels * sizeof(SAMPLETYPE));
}
@@ -579,7 +579,7 @@ RateTransposerFloat::RateTransposerFloat() : RateTransposer() {
// Notice: use local function calling syntax for sake of clarity,
// to indicate the fact that C++ constructor can't call virtual functions.
- sPrevSample=0;
+ sPrevSample = NULL;
RateTransposerFloat::resetRegisters();
RateTransposerFloat::setRate(1.0f);
}
@@ -587,16 +587,16 @@ RateTransposerFloat::RateTransposerFloat() : RateTransposer() RateTransposerFloat::~RateTransposerFloat()
{
- if (sPrevSample) delete[] sPrevSample;
+ delete[] sPrevSample;
}
void RateTransposerFloat::resetRegisters()
{
fSlopeCount = 0;
- if (sPrevSample) delete[] sPrevSample;
+ delete[] sPrevSample;
sPrevSample = new SAMPLETYPE[numChannels];
- memset(sPrevSample, 0, numChannels*sizeof(*sPrevSample));
+ memset(sPrevSample, 0, numChannels * sizeof(SAMPLETYPE));
}
diff --git a/source/SoundTouch/TDStretch.cpp b/source/SoundTouch/TDStretch.cpp index f2060bc..3f215dc 100644 --- a/source/SoundTouch/TDStretch.cpp +++ b/source/SoundTouch/TDStretch.cpp @@ -51,8 +51,6 @@ #include "cpu_detect.h"
#include "TDStretch.h"
-#include <stdio.h>
-
using namespace soundtouch;
#define max(x, y) (((x) > (y)) ? (x) : (y))
@@ -159,7 +157,6 @@ void TDStretch::setParameters(int aSampleRate, int aSequenceMS, // set tempo to recalculate 'sampleReq'
setTempo(tempo);
-
}
@@ -511,7 +508,6 @@ void TDStretch::processNominalTempo() }
*/
-#include <stdio.h>
// Processes as many processing frames of the samples 'inputBuffer', store
// the result into 'outputBuffer'
@@ -601,7 +597,7 @@ void TDStretch::acceptNewOverlapLength(int newOverlapLength) {
delete[] pMidBufferUnaligned;
- pMidBufferUnaligned = new SAMPLETYPE[overlapLength * 2 + 16 / sizeof(SAMPLETYPE)];
+ pMidBufferUnaligned = new SAMPLETYPE[overlapLength * channels + 16 / sizeof(SAMPLETYPE)];
// ensure that 'pMidBuffer' is aligned to 16 byte boundary for efficiency
pMidBuffer = (SAMPLETYPE *)SOUNDTOUCH_ALIGN_POINTER_16(pMidBufferUnaligned);
|