Laurent Ganter - Mon, 6 Oct 2003 11:51:33 +0200
authorSam Lantinga <slouken@libsdl.org>
Mon, 06 Oct 2003 15:41:04 +0000
changeset 23666bbfd8bb710
parent 235 bdfad81062fa
child 237 5fb7a859f158
Laurent Ganter - Mon, 6 Oct 2003 11:51:33 +0200
* Fixed bug with MIDI volume in native Windows playback
CHANGES
native_midi/native_midi_win32.c
     1.1 --- a/CHANGES	Sun Oct 05 17:09:15 2003 +0000
     1.2 +++ b/CHANGES	Mon Oct 06 15:41:04 2003 +0000
     1.3 @@ -1,4 +1,6 @@
     1.4  1.2.6:
     1.5 +Laurent Ganter - Mon, 6 Oct 2003 11:51:33 +0200
     1.6 + * Fixed bug with MIDI volume in native Windows playback
     1.7  Andre Leiradella - Fri, 30 May 2003 16:12:03 -0300
     1.8   * Added SDL_RWops support for reading MOD files
     1.9  Kyle Davenport - Sat, 19 Apr 2003 17:13:31 -0500
     2.1 --- a/native_midi/native_midi_win32.c	Sun Oct 05 17:09:15 2003 +0000
     2.2 +++ b/native_midi/native_midi_win32.c	Mon Oct 06 15:41:04 2003 +0000
     2.3 @@ -273,16 +273,14 @@
     2.4  
     2.5  void native_midi_setvolume(int volume)
     2.6  {
     2.7 -  int calcVolume = volume << 1;
     2.8 -  if(calcVolume > 255)
     2.9 -  {
    2.10 -    calcVolume = 255;
    2.11 -  }
    2.12 -  else if (calcVolume < 0)
    2.13 -  {
    2.14 -    calcVolume = 0;
    2.15 -  }
    2.16 -  midiOutSetVolume((HMIDIOUT)hMidiStream, MAKEWORD(calcVolume , calcVolume));
    2.17 +  int calcVolume;
    2.18 +  if (volume > 128)
    2.19 +    volume = 128;
    2.20 +  if (volume < 0)
    2.21 +    volume = 0;
    2.22 +  calcVolume = (65535 * volume / 128);
    2.23 +
    2.24 +  midiOutSetVolume((HMIDIOUT)hMidiStream, MAKELONG(calcVolume , calcVolume));
    2.25  }
    2.26  
    2.27  char *native_midi_error()