From 0cd9f1cc2db777f9208a7573f8e1e97bd0698b6d Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 6 Oct 2003 15:41:04 +0000 Subject: [PATCH] Laurent Ganter - Mon, 6 Oct 2003 11:51:33 +0200 * Fixed bug with MIDI volume in native Windows playback --- CHANGES | 2 ++ native_midi/native_midi_win32.c | 18 ++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGES b/CHANGES index bb808e73..72431c82 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,6 @@ 1.2.6: +Laurent Ganter - Mon, 6 Oct 2003 11:51:33 +0200 + * Fixed bug with MIDI volume in native Windows playback Andre Leiradella - Fri, 30 May 2003 16:12:03 -0300 * Added SDL_RWops support for reading MOD files Kyle Davenport - Sat, 19 Apr 2003 17:13:31 -0500 diff --git a/native_midi/native_midi_win32.c b/native_midi/native_midi_win32.c index d68e254f..0631c291 100644 --- a/native_midi/native_midi_win32.c +++ b/native_midi/native_midi_win32.c @@ -273,16 +273,14 @@ int native_midi_active() void native_midi_setvolume(int volume) { - int calcVolume = volume << 1; - if(calcVolume > 255) - { - calcVolume = 255; - } - else if (calcVolume < 0) - { - calcVolume = 0; - } - midiOutSetVolume((HMIDIOUT)hMidiStream, MAKEWORD(calcVolume , calcVolume)); + int calcVolume; + if (volume > 128) + volume = 128; + if (volume < 0) + volume = 0; + calcVolume = (65535 * volume / 128); + + midiOutSetVolume((HMIDIOUT)hMidiStream, MAKELONG(calcVolume , calcVolume)); } char *native_midi_error()