Open main menu

Music drivers redesign

Revision as of 01:05, 22 May 2008 by Jvprat (talk | contribs) (Initial draft of the music drivers redesign)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Here are the notes about the upcoming music drivers redesign. This starts with the aim to generalize the music driver managing code and enabling custom configuration options for each driver, while simplifying the usage from the engines.

Music drivers types (interfaces)

  • AdLib (MTD_ADLIB)
  • FM Towns (MTD_TOWNS)
  • PC Speaker (MTD_SPKR)
  • PCJr (MTD_PCJR)
  • Apple ii? (MTD_APPLEII?)
  • MIDI
    • GM (MTD_GM)
    • MT32 (MTD_MT32)
    • GS (MTD_GS)
    • ...?
  • Digitalised/CD-Audio (MTD_DIGI?)
  • ...?

Usage from the engines

There are two proposals currently. The first one delegates all the work to the music driver manager involving just one call to it which already returns the music driver created depending on the settings, and it just has to be casted to use it. This ensures a coherent behaviour through all the engines:

musicdriver = MusicDriverManager->createDriver(MusicTypePreferenceList(MDT_MT32, MDT_ADLIB, MDT_SPKR));
switch (musicdriver->type) {
case MDT_ADLIB:
  adlibdriver = (MusicDriverAdlib *)musicdriver;
  ...
}

The other proposal looks like the current implementation and it involves two calls to the music driver manager: the first one to ask what driver will be used, and the second one to create it:

musictype = MusicDriverManager->getMusicType(MusicTypePreferenceList(MDT_MT32, MDT_ADLIB, MDT_SPKR));
switch (musictype) {
case MDT_ADLIB:
  adlibdriver = MusicDriverManager.createAdlibDriver();
  ...
}

Music driver implementations

  • NULL driver (Reported as anything, one of the requested types, the most preferred, for example)
  • Emulators
    • AdLib emulator (MDT_ADLIB)
    • FM Towns emulator (MDT_TOWNS)
    • PC Speaker emulator (MTD_SPKR)
    • PCJR emulator (MTD_PCJR)
    • MT-32 emulator (MTD_MT32)
  • Native midi drivers (Reported as MTD_GM, MTD_MT32... depending on the configuration)
  • Wrappers / Mapping
    • GM->MT-32 wrapper (MTD_GM)
    • GM->AdLib wrapper (MTD_GM)
    • GM->PC Speaker wrapper (MTD_GM)
    • MT-32->GM wrapper (MTD_MT32)

Configuration from the user interface

  • General configuration:
    • The user can configure the default options of the drivers/devices (This ALSA device is an MT-32 and use this volume, the FluidSynth driver should use this soundfont file, ...)
    • The user can priorize the music types globaly (i.e. I prefer GM, then AdLib, then PC Speaker, and nothing else) and the default driver/device for each type
  • For each game:
    • The MetaEngine offers an API for querying which music types are supported by a given target, in order of preference and the user can choose one of those (default will use the previously configured priorities)
    • The user can manually choose an output device and configure it