Possibly improve MAD sample conversion speed
No idea if this brings a noticeable improvement, but it probably makes better sense to only do the division step one time instead of doing it twice interleaved when processing stereo files, which are the most common scenario anyway. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
This commit is contained in:
parent
51e9648865
commit
2c0f04bbeb
1 changed files with 2 additions and 2 deletions
|
@ -469,11 +469,11 @@
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
// samples [0 ... n]
|
// samples [0 ... n]
|
||||||
float scale = (float)MAD_F_ONE;
|
|
||||||
for(ch = 0; ch < channels; ch++) {
|
for(ch = 0; ch < channels; ch++) {
|
||||||
vDSP_vflt32(&_synth.pcm.samples[ch][startingSample], 1, &_outputBuffer[ch], channels, _outputFrames);
|
vDSP_vflt32(&_synth.pcm.samples[ch][startingSample], 1, &_outputBuffer[ch], channels, _outputFrames);
|
||||||
vDSP_vsdiv(&_outputBuffer[ch], channels, &scale, &_outputBuffer[ch], channels, _outputFrames);
|
|
||||||
}
|
}
|
||||||
|
float scale = (float)MAD_F_ONE;
|
||||||
|
vDSP_vsdiv(&_outputBuffer[0], 1, &scale, &_outputBuffer[0], 1, _outputFrames * channels);
|
||||||
|
|
||||||
// Output to a file
|
// Output to a file
|
||||||
// FILE *f = fopen("data.raw", "a");
|
// FILE *f = fopen("data.raw", "a");
|
||||||
|
|
Loading…
Reference in a new issue