aboutsummaryrefslogtreecommitdiff
path: root/sound/softsynth/fmtowns_pc98/towns_audio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sound/softsynth/fmtowns_pc98/towns_audio.cpp')
-rw-r--r--sound/softsynth/fmtowns_pc98/towns_audio.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/sound/softsynth/fmtowns_pc98/towns_audio.cpp b/sound/softsynth/fmtowns_pc98/towns_audio.cpp
index 5c0961b8c3..5e1ac0201f 100644
--- a/sound/softsynth/fmtowns_pc98/towns_audio.cpp
+++ b/sound/softsynth/fmtowns_pc98/towns_audio.cpp
@@ -1404,8 +1404,11 @@ void TownsAudioInterface::updateOutputVolume() {
// balance values for our -128 to 127 volume range
// CD-AUDIO
- int volume = (int)(((float)MAX(_outputLevel[12], _outputLevel[13]) * 255.0f) / 63.0f);
- int balance = (int)((float)((_outputLevel[13] - _outputLevel[12]) * 127.0f) / (float)MAX(_outputLevel[12], _outputLevel[13]));
+ uint32 maxVol = MAX(_outputLevel[12], _outputLevel[13]);
+
+ int volume = (int)(maxVol * (255.0f / 63.0f));
+ int balance = maxVol ? (int)( ( ((int)_outputLevel[13] - _outputLevel[12]) * 127) / (float)maxVol) : 0;
+
AudioCD.setVolume(volume);
AudioCD.setBalance(balance);
}