- Library code update
- project update (added Eigen) git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@94 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -47,23 +47,28 @@ void ResamplingAudioSource::setResamplingRatio (const double samplesInPerOutputS
|
||||
ratio = jmax (0.0, samplesInPerOutputSample);
|
||||
}
|
||||
|
||||
void ResamplingAudioSource::prepareToPlay (int samplesPerBlockExpected,
|
||||
double sampleRate)
|
||||
void ResamplingAudioSource::prepareToPlay (int samplesPerBlockExpected, double sampleRate)
|
||||
{
|
||||
const SpinLock::ScopedLockType sl (ratioLock);
|
||||
|
||||
input->prepareToPlay (samplesPerBlockExpected, sampleRate);
|
||||
|
||||
buffer.setSize (numChannels, roundToInt (samplesPerBlockExpected * ratio) + 32);
|
||||
buffer.clear();
|
||||
sampsInBuffer = 0;
|
||||
bufferPos = 0;
|
||||
subSampleOffset = 0.0;
|
||||
|
||||
filterStates.calloc ((size_t) numChannels);
|
||||
srcBuffers.calloc ((size_t) numChannels);
|
||||
destBuffers.calloc ((size_t) numChannels);
|
||||
createLowPass (ratio);
|
||||
|
||||
flushBuffers();
|
||||
}
|
||||
|
||||
void ResamplingAudioSource::flushBuffers()
|
||||
{
|
||||
buffer.clear();
|
||||
bufferPos = 0;
|
||||
sampsInBuffer = 0;
|
||||
subSampleOffset = 0.0;
|
||||
resetFilters();
|
||||
}
|
||||
|
||||
@@ -225,7 +230,8 @@ void ResamplingAudioSource::setFilterCoefficients (double c1, double c2, double
|
||||
|
||||
void ResamplingAudioSource::resetFilters()
|
||||
{
|
||||
filterStates.clear ((size_t) numChannels);
|
||||
if (filterStates != nullptr)
|
||||
filterStates.clear ((size_t) numChannels);
|
||||
}
|
||||
|
||||
void ResamplingAudioSource::applyFilter (float* samples, int num, FilterState& fs)
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
*/
|
||||
double getResamplingRatio() const noexcept { return ratio; }
|
||||
|
||||
/** Clears any buffers and filters that the resampler is using. */
|
||||
void flushBuffers();
|
||||
|
||||
//==============================================================================
|
||||
void prepareToPlay (int samplesPerBlockExpected, double sampleRate) override;
|
||||
void releaseResources() override;
|
||||
|
||||
Reference in New Issue
Block a user