Add stereo re-sampler

This commit is contained in:
Charles J. Cliffe
2014-12-26 21:55:13 -05:00
parent 0fc47bc916
commit 44602303a7
7 changed files with 26 additions and 7 deletions
+9 -1
View File
@@ -9,7 +9,7 @@
DemodulatorPreThread::DemodulatorPreThread(DemodulatorThreadInputQueue* pQueueIn, DemodulatorThreadPostInputQueue* pQueueOut,
DemodulatorThreadControlCommandQueue *threadQueueControl, DemodulatorThreadCommandQueue* threadQueueNotify) :
inputQueue(pQueueIn), postInputQueue(pQueueOut), terminated(false), initialized(false), audio_resampler(NULL), resample_ratio(1), audio_resample_ratio(
inputQueue(pQueueIn), postInputQueue(pQueueOut), terminated(false), initialized(false), audio_resampler(NULL), stereo_resampler(NULL), resample_ratio(1), audio_resample_ratio(
1), resampler(NULL), commandQueue(NULL), fir_filter(NULL), audioInputQueue(NULL), threadQueueNotify(threadQueueNotify), threadQueueControl(
threadQueueControl) {
@@ -71,6 +71,12 @@ void DemodulatorPreThread::initialize() {
audio_resampler = msresamp_rrrf_create(audio_resample_ratio, As);
// msresamp_crcf_print(audio_resampler);
if (stereo_resampler) {
msresamp_rrrf_destroy(stereo_resampler);
}
stereo_resampler = msresamp_rrrf_create(audio_resample_ratio, As);
initialized = true;
// std::cout << "inputResampleRate " << params.bandwidth << std::endl;
@@ -217,6 +223,7 @@ void DemodulatorPreThread::threadMain() {
resamp->audio_resample_ratio = audio_resample_ratio;
resamp->audio_resampler = audio_resampler;
resamp->stereo_resampler = stereo_resampler;
resamp->resample_ratio = resample_ratio;
resamp->resampler = resampler;
resamp->bandwidth = params.bandwidth;
@@ -240,6 +247,7 @@ void DemodulatorPreThread::threadMain() {
fir_filter = result.fir_filter;
resampler = result.resampler;
audio_resampler = result.audio_resampler;
stereo_resampler = result.stereo_resampler;
resample_ratio = result.resample_ratio;
audio_resample_ratio = result.audio_resample_ratio;