diff options
author | Johannes Schickel | 2015-07-23 22:33:57 +0200 |
---|---|---|
committer | Johannes Schickel | 2015-07-23 22:33:57 +0200 |
commit | 757077fecc2a939e767ccd29822547828a9c5e2f (patch) | |
tree | 15629acc95f621295a58a490f9a2be15ce442990 /engines | |
parent | cf42dc0a358da489ff93d32c18a5103de4dc4385 (diff) | |
download | scummvm-rg350-757077fecc2a939e767ccd29822547828a9c5e2f.tar.gz scummvm-rg350-757077fecc2a939e767ccd29822547828a9c5e2f.tar.bz2 scummvm-rg350-757077fecc2a939e767ccd29822547828a9c5e2f.zip |
AGOS: Add simple volume control when Simon1 AdLib output is used.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agos/midi.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp index c5bace0523..f636c1348a 100644 --- a/engines/agos/midi.cpp +++ b/engines/agos/midi.cpp @@ -288,7 +288,28 @@ void MidiPlayer::send(uint32 b) { return; if (_musicMode != kMusicModeDisabled) { - // Send directly to Accolade/Miles Audio driver + // Handle volume control for Simon1 output. + if (_musicMode == kMusicModeSimon1) { + // The driver does not support any volume control, thus we simply + // scale the velocities on note on for now. + // TODO: We should probably handle this at output level at some + // point. Then we can allow volume changes to affect already + // playing notes too. For now this simple change allows us to + // have some simple volume control though. + if ((b & 0xF0) == 0x90) { + byte volume = (b >> 16) & 0x7F; + + if (_current == &_sfx) { + volume = volume * _sfxVolume / 255; + } else if (_current == &_music) { + volume = volume * _musicVolume / 255; + } + + b = (b & 0xFF00FFFF) | (volume << 16); + } + } + + // Send directly to Accolade/Miles/Simon1 Audio driver _driver->send(b); return; } |