MixerToy: do an initialisation run on the mixer
The Interpolating mixer has internal state which must be setup by a previous frame (we assume 0 for the first frame). Since we work on exactly a period of the wave here, sending the same data twice works as it should.
This commit is contained in:
parent
258fbe371b
commit
dab42bf05b
@ -266,6 +266,12 @@ MainWindow::MessageReceived(BMessage* message)
|
|||||||
Interpolate sampler(media_raw_audio_format::B_AUDIO_FLOAT,
|
Interpolate sampler(media_raw_audio_format::B_AUDIO_FLOAT,
|
||||||
media_raw_audio_format::B_AUDIO_FLOAT);
|
media_raw_audio_format::B_AUDIO_FLOAT);
|
||||||
|
|
||||||
|
// First call initializes the "old sample" in the interpolator.
|
||||||
|
// Since we do the interpolation on exactly one period of the
|
||||||
|
// sound wave, this works.
|
||||||
|
sampler.Resample(fWaveView->waves[1].Raw(), sizeof(float), irate,
|
||||||
|
fWaveView->waves[2].Raw(), sizeof(float), orate, 1);
|
||||||
|
|
||||||
sampler.Resample(fWaveView->waves[1].Raw(), sizeof(float), irate,
|
sampler.Resample(fWaveView->waves[1].Raw(), sizeof(float), irate,
|
||||||
fWaveView->waves[2].Raw(), sizeof(float), orate, 1);
|
fWaveView->waves[2].Raw(), sizeof(float), orate, 1);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user