mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Fix a bug with the application of output bus volume.
This commit is contained in:
@@ -2655,10 +2655,21 @@ static ma_result ma_node_input_bus_read_pcm_frames(ma_node* pInputNode, ma_node_
|
|||||||
if (pOutputBus == pFirst) {
|
if (pOutputBus == pFirst) {
|
||||||
/* Fast path. First attachment. We just read straight into the output buffer (no mixing required). */
|
/* Fast path. First attachment. We just read straight into the output buffer (no mixing required). */
|
||||||
result = ma_node_read_pcm_frames(pOutputBus->pNode, pOutputBus->outputBusIndex, pRunningFramesOut, framesToRead, &framesJustRead, globalTime + framesProcessed);
|
result = ma_node_read_pcm_frames(pOutputBus->pNode, pOutputBus->outputBusIndex, pRunningFramesOut, framesToRead, &framesJustRead, globalTime + framesProcessed);
|
||||||
|
if (result == MA_SUCCESS || result == MA_AT_END) {
|
||||||
|
/* Apply volume, if necessary. */
|
||||||
|
if (volume != 1) {
|
||||||
|
ma_apply_volume_factor_f32(pRunningFramesOut, framesJustRead * inputChannels, volume);
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Slow path. Not the first attachment. Mixing required. */
|
/* Slow path. Not the first attachment. Mixing required. */
|
||||||
result = ma_node_read_pcm_frames(pOutputBus->pNode, pOutputBus->outputBusIndex, temp, framesToRead, &framesJustRead, globalTime + framesProcessed);
|
result = ma_node_read_pcm_frames(pOutputBus->pNode, pOutputBus->outputBusIndex, temp, framesToRead, &framesJustRead, globalTime + framesProcessed);
|
||||||
if (result == MA_SUCCESS || result == MA_AT_END) {
|
if (result == MA_SUCCESS || result == MA_AT_END) {
|
||||||
|
/* Apply volume, if necessary. */
|
||||||
|
if (volume != 1) {
|
||||||
|
ma_apply_volume_factor_f32(temp, framesJustRead * inputChannels, volume);
|
||||||
|
}
|
||||||
|
|
||||||
ma_mix_pcm_frames_f32(pRunningFramesOut, temp, framesJustRead, inputChannels, /*volume*/1);
|
ma_mix_pcm_frames_f32(pRunningFramesOut, temp, framesJustRead, inputChannels, /*volume*/1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user