Audio Plugin System, Current Situation
<i>This post was originally made by <b>danij</b> on the dengDevs blog. It was posted under the categories: Blog, Engine, Mac OS X, Unix/Linux, Windows.</i>
I thought it would be a good idea to clarify the current situation with the Doomsday audio system(s).
Doomsday uses a plugin system for audio playback. This allows playback via various APIs including SDL_mixer, DirectSound and OpenAL. Each audio playback plugin can provide up to three different interfaces; sfx playback, music playback and CD audio.
As Doomsday is only able to load and utilize one audio plugin at a time, this means that in order for sfx, music and CD audio playback to be available, the currently loaded audio plugin must provide an interface for each.
On MacOS and *nix, sfx and MIDI playback is done via the SDL_mixer plugin (note that on MacOS, this plugin infact used QuickTime instead for MIDI playback).
Historically, because of the above limitation, MIDI playback and CD audio playback were implemented within the engine itself on the Windows platform.
3D sound (including EAX reverb effects) has only ever worked via DirectSound. This necessitates the use of the -dsound plugin if 3D sound is desired.
So as you can see, the audio plugin system was in a bit of mess. Work began in 1.9.0-beta6 towards rectifying the situation. Here is where we are at currently:
<ul>
<li>The SDL_mixer plugin has been moved into the engine and is now the default method of audio playback as, it is available on all supported platforms. This interface currently provides sfx and MIDI playback but no CD audio. It *should* also provide playback of a handful of common music formats such as MP3 but it would appear that either this has broken down at some point or it simply never worked at all (SDL_mixer has not been used under Windows prior to 1.9.0-beta6.1 so I'm not able to check this for myself).</li>
<li>The Windows-specific MIDI and CD audio playback (via Windows multimedia) has been moved into a plugin (naturally, the plugin itself is so too Windows only), called dsWinMM. dsWinMM provides interfaces for MIDI and CD audio playback but not sfx.</li>
<li>The OpenAL plugin can now be compiled for all supported platforms. It however only currently supports sfx playback, no MIDI or CD audio.</li>
<li>The new DirectSound plugin combines the functionality of the old "compatible" plugin and the ds9 plugin. Naturally this plugin is Windows-specific and currently only provides interfaces for sfx playback, no MIDI or CD audio.</li>
</ul>
The next phase of development on the audio plugin system will address the core issue behind the current problems; simultaneous use of multiple audio plugins. This will allow the user to choose which plugin to use for each playback interface. For example, the user could have 3D sfx via DirectSound, MIDI playback via SDL_mixer and CD audio via Windows Multimedia. It should also be possible to "hot swap" the audio playback methods dynamically at runtime so if a certain MIDI sounded particularly dreadful via SDL_mixer they could switch to Windows Multimedia without restarting Doomsday.
In addition, the currently MacOS-only QuickTime interface for MIDI playback which is hardcoded in the engine (it was internalized along with the rest of the SDL_mixer plugin) will be moved into a new plugin and made available on Windows also.
So hopefully this explains why (e.g.) MIDI doesn't work when you use DirectSound or why sfx doesn't work when you use Windows Multimedia.
I thought it would be a good idea to clarify the current situation with the Doomsday audio system(s).
Doomsday uses a plugin system for audio playback. This allows playback via various APIs including SDL_mixer, DirectSound and OpenAL. Each audio playback plugin can provide up to three different interfaces; sfx playback, music playback and CD audio.
As Doomsday is only able to load and utilize one audio plugin at a time, this means that in order for sfx, music and CD audio playback to be available, the currently loaded audio plugin must provide an interface for each.
On MacOS and *nix, sfx and MIDI playback is done via the SDL_mixer plugin (note that on MacOS, this plugin infact used QuickTime instead for MIDI playback).
Historically, because of the above limitation, MIDI playback and CD audio playback were implemented within the engine itself on the Windows platform.
3D sound (including EAX reverb effects) has only ever worked via DirectSound. This necessitates the use of the -dsound plugin if 3D sound is desired.
So as you can see, the audio plugin system was in a bit of mess. Work began in 1.9.0-beta6 towards rectifying the situation. Here is where we are at currently:
<ul>
<li>The SDL_mixer plugin has been moved into the engine and is now the default method of audio playback as, it is available on all supported platforms. This interface currently provides sfx and MIDI playback but no CD audio. It *should* also provide playback of a handful of common music formats such as MP3 but it would appear that either this has broken down at some point or it simply never worked at all (SDL_mixer has not been used under Windows prior to 1.9.0-beta6.1 so I'm not able to check this for myself).</li>
<li>The Windows-specific MIDI and CD audio playback (via Windows multimedia) has been moved into a plugin (naturally, the plugin itself is so too Windows only), called dsWinMM. dsWinMM provides interfaces for MIDI and CD audio playback but not sfx.</li>
<li>The OpenAL plugin can now be compiled for all supported platforms. It however only currently supports sfx playback, no MIDI or CD audio.</li>
<li>The new DirectSound plugin combines the functionality of the old "compatible" plugin and the ds9 plugin. Naturally this plugin is Windows-specific and currently only provides interfaces for sfx playback, no MIDI or CD audio.</li>
</ul>
The next phase of development on the audio plugin system will address the core issue behind the current problems; simultaneous use of multiple audio plugins. This will allow the user to choose which plugin to use for each playback interface. For example, the user could have 3D sfx via DirectSound, MIDI playback via SDL_mixer and CD audio via Windows Multimedia. It should also be possible to "hot swap" the audio playback methods dynamically at runtime so if a certain MIDI sounded particularly dreadful via SDL_mixer they could switch to Windows Multimedia without restarting Doomsday.
In addition, the currently MacOS-only QuickTime interface for MIDI playback which is hardcoded in the engine (it was internalized along with the rest of the SDL_mixer plugin) will be moved into a new plugin and made available on Windows also.
So hopefully this explains why (e.g.) MIDI doesn't work when you use DirectSound or why sfx doesn't work when you use Windows Multimedia.