Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL_Mixer MIDI Volume issues on Windows Vista/7

I'm not actually well versed in C++ or SDL_Mixer, but I'm asking this question anyway on behalf on the Doom community. Put simply, nobody writing Doom source ports can seem to figure out how to control normal sound volume and MIDI sound volume independently using SDL_Mixer on Windows Vista or 7. I'll let James Haley, author of Eternity Engine, put it in his own words:

Seems the concept of independent volume for native MIDI doesn't exist under Windows Vista or 7, as using MIDI volume sliders in any application that has them (including most games that use SDL_mixer) also affects the volume of digital sound output. This makes attempting to adjust the relative volume of music for comfort impossible.

Has anybody found any workarounds for this? I'm guessing it's unlikely given how Microsoft seems to have skimped throughout the OS on any way to control the volume of individual sound devices separately.

I've heard of various workarounds all involving a Timidity driver, but this requires the user go above and beyond simply installing the game on his system. The only port that I know of that definitively fixes this issue is ZDoom, but it uses the GPL-incompatible FModEx and is thus not a suitable solution.

If you want some code to look at, Chocolate Doom is perhaps the easiest Doom source port to grok and you can grab its source here.

Any suggestions on other open-source sound and music libraries would be welcome as well.

like image 588
AlexMax Avatar asked May 03 '11 02:05

AlexMax


1 Answers

A solution would be to ship with a FluidSynth-enabled SDL_mixer. You would also need to ship a SoundFont2 file to go with it. Fortunately, there are free SF2's out there, and some are even optimized for Doom's MIDI files. Licenses shouldn't be a problem, since SoundFonts are assets, not code.

You then load the SF2 using Mix_SetSoundFonts().

like image 176
Nikos C. Avatar answered Sep 21 '22 17:09

Nikos C.