Ticket #9169: audio_output.patch

File audio_output.patch, 2.9 KB (added by SF/sud03r, 15 years ago)

patch file containing the above changes.

  • gui/options.cpp

     
    4242#include "sound/mixer.h"
    4343#include "sound/fmopl.h"
    4444
     45#include "engines/metaengine.h"
     46
    4547namespace GUI {
    4648
    4749enum {
     
    625627        _midiPopUpDesc = new StaticTextWidget(boss, prefix + "auMidiPopupDesc", "Music driver:");
    626628        _midiPopUp = new PopUpWidget(boss, prefix + "auMidiPopup");
    627629
     630        // Query the metaEngine to know the supported output types
     631        Common::String gameId = ConfMan.get("gameid", _domain);
     632        const EnginePlugin *plugin = 0;
     633        int musicTypes = ~0;
     634
     635        EngineMan.findGame(gameId, &plugin);
     636        if (plugin) {
     637                musicTypes = (*plugin)->getSupportedMusicTypes(gameId.c_str());
     638        }
     639
    628640        // Populate it
    629641        const MidiDriverDescription *md = MidiDriver::getAvailableMidiDrivers();
    630642        while (md->name) {
    631                 _midiPopUp->appendEntry(md->description, md->id);
     643                // Show capable drivers only
     644                if (md->flags & musicTypes) {
     645                        _midiPopUp->appendEntry(md->description, md->id);
     646                }
    632647                md++;
    633648        }
    634649
  • engines/metaengine.h

     
    6363        virtual GameDescriptor findGame(const char *gameid) const = 0;
    6464
    6565        /**
     66         * Returns the music output types supported by the engine, for example
     67         * if a game supports MDT_MIDI and MDT_ADLIB the return value is
     68         * bitwise OR of MDT_MIDI and MDT_ADLIB
     69         * default is return all 1's
     70         *
     71         * @param gameid        game identifier
     72         * @return                      output types supported by the engine
     73         */
     74        virtual int getSupportedMusicTypes(const char *gameid) const {
     75                return ~0;
     76        }
     77       
     78        /**
    6679         * Runs the engine's game detector on the given list of files, and returns a
    6780         * (possibly empty) list of games supported by the engine which it was able
    6881         * to detect amongst the given files.
  • engines/scumm/detection.cpp

     
    701701        virtual GameList getSupportedGames() const;
    702702        virtual GameDescriptor findGame(const char *gameid) const;
    703703        virtual GameList detectGames(const Common::FSList &fslist) const;
     704        virtual int getSupportedMusicTypes(const char *gameid) const;
    704705
    705706        virtual Common::Error createInstance(OSystem *syst, Engine **engine) const;
    706707
     
    737738        return AdvancedDetector::findGameID(gameid, gameDescriptions, obsoleteGameIDsTable);
    738739}
    739740
     741int ScummMetaEngine::getSupportedMusicTypes(const char *gameid) const {
     742        for (const GameSettings *g = gameVariantsTable; g->gameid; ++g) {
     743                if (!scumm_stricmp(gameid, g->gameid)) {
     744                        return g->midi;
     745                }
     746        }
     747        return ~0;
     748}
     749
    740750static Common::String generatePreferredTarget(const DetectorResult &x) {
    741751        Common::String res(x.game.gameid);
    742752