Skip to content

Commit

Permalink
Added win32 implementation of native_midi_setvolume(), compliments of
Browse files Browse the repository at this point in the history
 "Java the Hut" on the 3DRealms forums:

   http://forums.3drealms.com/ubb/ultimatebb.php?ubb=get_topic;f=24;t=000014

Java the Hut
  posted 01-01-2003 10:44 PM

I found a missing feature in the SDL_mixer library. The volume control does
 not work for the native Win32 midi feature.

The void native_midi_setvolume(int volume) function in the native_midi_win32.c
 file has no code, so changing the music volume does nothing.

This code adds volume control for the midi music in the Win32 ROTT. You will
 have to download the SDL_mixer code and compile it yourself.

  [...code snipped...]

It is kind of cool to have a working Win32 ROTT with sound and music.
  • Loading branch information
icculus committed Jan 2, 2003
1 parent 226329d commit 4117c46
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions native_midi/native_midi_win32.c
Expand Up @@ -273,6 +273,16 @@ 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));
}

char *native_midi_error()
Expand Down

0 comments on commit 4117c46

Please sign in to comment.