[Scummvm-cvs-logs] SF.net SVN: scummvm:[50281] scummvm/trunk
athrxx at users.sourceforge.net
athrxx at users.sourceforge.net
Fri Jun 25 20:47:52 CEST 2010
Revision: 50281
http://scummvm.svn.sourceforge.net/scummvm/?rev=50281&view=rev
Author: athrxx
Date: 2010-06-25 18:47:52 +0000 (Fri, 25 Jun 2010)
Log Message:
-----------
AUDIO: some fixes in the audio device code (no sound option, new GUIO flags)
Modified Paths:
--------------
scummvm/trunk/common/util.cpp
scummvm/trunk/common/util.h
scummvm/trunk/engines/gob/gob.cpp
scummvm/trunk/gui/options.cpp
scummvm/trunk/gui/options.h
scummvm/trunk/sound/mididrv.cpp
scummvm/trunk/sound/mididrv.h
scummvm/trunk/sound/musicplugin.cpp
scummvm/trunk/sound/null.cpp
scummvm/trunk/sound/null.h
scummvm/trunk/sound/softsynth/pcspk.cpp
Modified: scummvm/trunk/common/util.cpp
===================================================================
--- scummvm/trunk/common/util.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/common/util.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -305,6 +305,7 @@
{ GUIO_MIDIPCJR, "midiPCJr" },
{ GUIO_MIDIADLIB, "midiAdLib" },
{ GUIO_MIDITOWNS, "midiTowns" },
+ { GUIO_MIDIPC98, "midiPC98" },
{ GUIO_MIDIMT32, "midiMt32" },
{ GUIO_MIDIGM, "midiGM" },
Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/common/util.h 2010-06-25 18:47:52 UTC (rev 50281)
@@ -224,8 +224,9 @@
GUIO_MIDIPCJR = (1 << 8),
GUIO_MIDIADLIB = (1 << 9),
GUIO_MIDITOWNS = (1 << 10),
- GUIO_MIDIMT32 = (1 << 11),
- GUIO_MIDIGM = (1 << 12)
+ GUIO_MIDIPC98 = (1 << 11),
+ GUIO_MIDIMT32 = (1 << 12),
+ GUIO_MIDIGM = (1 << 13)
};
bool checkGameGUIOption(GameGUIOption option, const String &str);
Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/engines/gob/gob.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -346,7 +346,7 @@
bool GobEngine::initGameParts() {
// just detect some devices some of which will be always there if the music is not disabled
- _noMusic = MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB) ? false : true;
+ _noMusic = MidiDriver::getMusicType(MidiDriver::detectDevice(MDT_PCSPK | MDT_MIDI | MDT_ADLIB)) == MT_NULL ? true : false;
_saveLoad = 0;
_global = new Global(this);
Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/gui/options.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -136,18 +136,18 @@
}
}
-template<class T> bool prdEqualsDeviceProperty(MusicDevices::iterator d, T lookupProp, Common::MemFunc0<T, MusicDevice> devicePropFunc) {
+template<class T> bool equalsDeviceProperty(MusicDevices::iterator d, T lookupProp, Common::MemFunc0<T, MusicDevice> devicePropFunc) {
return lookupProp == devicePropFunc(&*d);
}
-bool prdMidiDefault(MusicDevices::iterator d, Common::String dom, bool, MusicPlugin::List::const_iterator&) {
- return !(dom == Common::ConfigManager::kApplicationDomain && d->getMusicType() == MT_TOWNS) ? true : false;
+bool musicDeviceSkipSettingDefault(MusicDevices::iterator d, Common::String dom, MusicPlugin::List::const_iterator &m, uint32 guio) {
+ return (dom == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS) || (dom != Common::ConfigManager::kApplicationDomain && (!guio || (guio & (MidiDriver::musicType2GUIO(d->getMusicType()))))) || d->getMusicDriverId() == "auto" || d->getMusicDriverId() == "null" ? true : false;
}
-bool prdMidiSpec(MusicDevices::iterator d, Common::String, bool isAutoPlugin, MusicPlugin::List::const_iterator &m) {
- if (isAutoPlugin)
+bool musicDeviceSkipSettingSpec(MusicDevices::iterator d, Common::String, MusicPlugin::List::const_iterator &m, uint32) {
+ if (d->getMusicDriverId() == "auto")
m++;
- return ((d->getMusicType() >= MT_GM) || isAutoPlugin) ? true : false;
+ return ((d->getMusicType() >= MT_GM) || d->getMusicDriverId() == "auto") ? true : false;
}
void OptionsDialog::open() {
@@ -208,21 +208,21 @@
}
// Audio options
- if (!loadMusicDeviceSetting(_midiPopUp, "music_driver", prdMidiDefault))
+ if (!loadMusicDeviceSetting(_midiPopUp, "music_driver", musicDeviceSkipSettingDefault))
_midiPopUp->setSelected(0);
- if (!loadMusicDeviceSetting(_mt32DevicePopUp, "mt32_device", prdMidiSpec)) {
+ if (!loadMusicDeviceSetting(_mt32DevicePopUp, "mt32_device", musicDeviceSkipSettingSpec)) {
if (_domain.equals(Common::ConfigManager::kApplicationDomain)) {
- if (!loadMusicDeviceSetting(_mt32DevicePopUp, "", prdMidiSpec, MT_MT32))
+ if (!loadMusicDeviceSetting(_mt32DevicePopUp, "", musicDeviceSkipSettingSpec, MT_MT32))
_mt32DevicePopUp->setSelected(0);
} else {
_mt32DevicePopUp->setSelected(0);
}
}
- if (!loadMusicDeviceSetting(_gmDevicePopUp, "gm_device", prdMidiSpec)) {
+ if (!loadMusicDeviceSetting(_gmDevicePopUp, "gm_device", musicDeviceSkipSettingSpec)) {
if (_domain.equals(Common::ConfigManager::kApplicationDomain)) {
- if (!loadMusicDeviceSetting(_gmDevicePopUp, "", prdMidiSpec, MT_GM))
+ if (!loadMusicDeviceSetting(_gmDevicePopUp, "", musicDeviceSkipSettingSpec, MT_GM))
_gmDevicePopUp->setSelected(0);
} else {
_gmDevicePopUp->setSelected(0);
@@ -364,9 +364,9 @@
}
// Audio options
- saveMusicDeviceSetting(_midiPopUp, "music_driver", prdMidiDefault);
- saveMusicDeviceSetting(_mt32DevicePopUp, "mt32_device", prdMidiSpec);
- saveMusicDeviceSetting(_gmDevicePopUp, "gm_device", prdMidiSpec);
+ saveMusicDeviceSetting(_midiPopUp, "music_driver", musicDeviceSkipSettingDefault);
+ saveMusicDeviceSetting(_mt32DevicePopUp, "mt32_device", musicDeviceSkipSettingSpec);
+ saveMusicDeviceSetting(_gmDevicePopUp, "gm_device", musicDeviceSkipSettingSpec);
if (_oplPopUp) {
if (_enableAudioSettings) {
@@ -667,7 +667,8 @@
for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
if ((_domain == Common::ConfigManager::kApplicationDomain && d->getMusicType() != MT_TOWNS) || // global dialog - skip useless FM-Towns option there
(_domain != Common::ConfigManager::kApplicationDomain && !(_guioptions & allFlags)) || // No flags are specified
- _guioptions & (MidiDriver::musicType2GUIO(d->getMusicType()))) // flag is present
+ _guioptions & (MidiDriver::musicType2GUIO(d->getMusicType())) // flag is present
+ || d->getMusicDriverId() == "auto" || d->getMusicDriverId() == "null") // always add default and null device
_midiPopUp->appendEntry(d->getCompleteName(), musicId++);
if (d->getMusicType() >= MT_GM || m == p.begin()) {
_mt32DevicePopUp->appendEntry(d->getCompleteName(), midiId);
@@ -790,7 +791,7 @@
_enableVolumeSettings = true;
}
-bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MidiSettingsExtraPred pred, MusicType preferredType) {
+bool OptionsDialog::loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicDeviceSkipFunc skipfunc, MusicType preferredType) {
if (!popup || !popup->isEnabled())
return true;
@@ -801,11 +802,11 @@
for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end() && id != -1; m++) {
MusicDevices i = (**m)->getDevices();
for (MusicDevices::iterator d = i.begin(); d != i.end(); d++) {
- if ((setting.empty() && preferredType) ? prdEqualsDeviceProperty(d, preferredType, Common::mem_fun(&MusicDevice::getMusicType)) : prdEqualsDeviceProperty(d, drv, Common::mem_fun(&MusicDevice::getCompleteId))) {
+ if ((setting.empty()) ? equalsDeviceProperty(d, preferredType, Common::mem_fun(&MusicDevice::getMusicType)) : equalsDeviceProperty(d, drv, Common::mem_fun(&MusicDevice::getCompleteId))) {
popup->setSelected(id);
id = -1;
break;
- } else if (pred(d, _domain, m == p.begin(), m)) {
+ } else if (skipfunc(d, _domain, m, _guioptions)) {
id++;
}
}
@@ -820,7 +821,7 @@
return true;
}
-void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MidiSettingsExtraPred pred) {
+void OptionsDialog::saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicDeviceSkipFunc skipfunc) {
if (!popup || !_enableAudioSettings)
return;
@@ -834,7 +835,7 @@
ConfMan.set(setting, d->getCompleteId(), _domain);
found = true;
break;
- } else if (pred(d, _domain, m == p.begin(), m)) {
+ } else if (skipfunc(d, _domain, m, _guioptions)) {
id++;
}
}
Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/gui/options.h 2010-06-25 18:47:52 UTC (rev 50281)
@@ -79,9 +79,9 @@
void setVolumeSettingsState(bool enabled);
void setSubtitleSettingsState(bool enabled);
- typedef bool (MidiSettingsExtraPred)(MusicDevices::iterator, Common::String, bool, MusicPlugin::List::const_iterator&);
- bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MidiSettingsExtraPred pred, MusicType preferredType = MT_NULL);
- void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MidiSettingsExtraPred pred);
+ typedef bool (MusicDeviceSkipFunc)(MusicDevices::iterator, Common::String, MusicPlugin::List::const_iterator&, uint32);
+ bool loadMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicDeviceSkipFunc skipfunc, MusicType preferredType = MT_AUTO);
+ void saveMusicDeviceSetting(PopUpWidget *popup, Common::String setting, MusicDeviceSkipFunc skipfunc);
TabWidget *_tabWidget;
int _graphicsTabId;
Modified: scummvm/trunk/sound/mididrv.cpp
===================================================================
--- scummvm/trunk/sound/mididrv.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/sound/mididrv.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -95,7 +95,7 @@
}
}
- return MT_NULL;
+ return MT_AUTO;
}
Common::String MidiDriver::getDeviceString(DeviceHandle handle, DeviceStringType type) {
@@ -139,6 +139,11 @@
if (flags & MDT_PCJR)
return hdl;
break;
+
+ case MT_CMS:
+ if (flags & MDT_CMS)
+ return hdl;
+ break;
case MT_ADLIB:
if (flags & MDT_ADLIB)
@@ -150,14 +155,20 @@
return hdl;
break;
+ case MT_PC98:
+ if (flags & MDT_PC98)
+ return hdl;
+ break;
+
case MT_GM:
case MT_GS:
case MT_MT32:
if (flags & MDT_MIDI)
return hdl;
+ break;
+
case MT_NULL:
- if (getDeviceString(hdl, MidiDriver::kDriverId).equals("null"))
- return 0;
+ return hdl;
default:
break;
@@ -172,7 +183,7 @@
if ((flags & MDT_MIDI) && (l == 1)) {
// If a preferred MT32 or GM device has been selected that device gets returned
hdl = getDeviceHandle(ConfMan.get((flags & MDT_PREFER_MT32) ? "mt32_device" : ((flags & MDT_PREFER_GM) ? "gm_device" : "auto"), Common::ConfigManager::kApplicationDomain));
- if (getMusicType(hdl) != MT_NULL) {
+ if (getMusicType(hdl) != MT_AUTO) {
if (flags & MDT_PREFER_MT32)
// If we have a preferred MT32 device we disable the gm/mt32 mapping (more about this in mididrv.h)
_forceTypeMT32 = true;
@@ -203,7 +214,7 @@
}
}
- MusicType tp = MT_NULL;
+ MusicType tp = MT_AUTO;
if (flags & MDT_TOWNS)
tp = MT_TOWNS;
else if (flags & MDT_ADLIB)
@@ -211,7 +222,7 @@
else if (flags & MDT_PCSPK)
tp = MT_PCSPK;
else
- tp = MT_NULL;
+ tp = MT_AUTO;
for (MusicPlugin::List::const_iterator m = p.begin(); m != p.end(); m++) {
MusicDevices i = (**m)->getDevices();
Modified: scummvm/trunk/sound/mididrv.h
===================================================================
--- scummvm/trunk/sound/mididrv.h 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/sound/mididrv.h 2010-06-25 18:47:52 UTC (rev 50281)
@@ -50,14 +50,17 @@
* Music types that music drivers can implement and engines can rely on.
*/
enum MusicType {
- MT_NULL = 0, // Null / Auto
- MT_PCSPK = 1, // PC Speaker
- MT_PCJR = 2, // PCjr
- MT_ADLIB = 3, // AdLib
- MT_TOWNS = 4, // FM-TOWNS
- MT_GM = 5, // General MIDI
- MT_MT32 = 6, // MT-32
- MT_GS = 7 // Roland GS
+ MT_AUTO = 0, // Auto
+ MT_NULL, // Null
+ MT_PCSPK, // PC Speaker
+ MT_PCJR, // PCjr
+ MT_CMS, // CMS
+ MT_ADLIB, // AdLib
+ MT_TOWNS, // FM-TOWNS
+ MT_PC98, // PC98
+ MT_GM, // General MIDI
+ MT_MT32, // MT-32
+ MT_GS // Roland GS
};
/**
@@ -75,12 +78,13 @@
MDT_PCSPK = 1 << 0, // PC Speaker: Maps to MD_PCSPK and MD_PCJR
MDT_CMS = 1 << 1, // Creative Music System / Gameblaster: Maps to MD_CMS
MDT_PCJR = 1 << 2, // Tandy/PC Junior driver
- MDT_ADLIB = 1 << 3, // AdLib: Maps to MD_ADLIB
- MDT_TOWNS = 1 << 4, // FM-TOWNS: Maps to MD_TOWNS
- MDT_MIDI = 1 << 5, // Real MIDI
- MDT_PREFER_MIDI = 1 << 6, // Real MIDI output is preferred
- MDT_PREFER_MT32 = 1 << 7, // MT-32 output is preferred
- MDT_PREFER_GM = 1 << 8 // GM output is preferred
+ MDT_ADLIB = 1 << 3, // AdLib: Maps to MT_ADLIB
+ MDT_TOWNS = 1 << 4, // FM-TOWNS: Maps to MT_TOWNS
+ MDT_PC98 = 1 << 5, // FM-TOWNS: Maps to MT_PC98
+ MDT_MIDI = 1 << 6, // Real MIDI
+ MDT_PREFER_MIDI = 1 << 7, // Real MIDI output is preferred
+ MDT_PREFER_MT32 = 1 << 8, // MT-32 output is preferred
+ MDT_PREFER_GM = 1 << 9 // GM output is preferred
};
/**
Modified: scummvm/trunk/sound/musicplugin.cpp
===================================================================
--- scummvm/trunk/sound/musicplugin.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/sound/musicplugin.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -60,7 +60,5 @@
}
MidiDriver::DeviceHandle MusicDevice::getHandle() {
- if (_musicDriverId.equals("auto") || _musicDriverId.equals("null"))
- return 0;
return (MidiDriver::DeviceHandle)Common::hashit(getCompleteId().c_str());
}
Modified: scummvm/trunk/sound/null.cpp
===================================================================
--- scummvm/trunk/sound/null.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/sound/null.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -45,8 +45,15 @@
const char *getId() const {
return "auto";
}
+ MusicDevices getDevices() const;
};
+MusicDevices AutoMusicPlugin::getDevices() const {
+ MusicDevices devices;
+ devices.push_back(MusicDevice(this, _s(""), MT_AUTO));
+ return devices;
+}
+
//#if PLUGIN_ENABLED_DYNAMIC(NULL)
//REGISTER_PLUGIN_DYNAMIC(NULL, PLUGIN_TYPE_MUSIC, NullMusicPlugin);
//#else
Modified: scummvm/trunk/sound/null.h
===================================================================
--- scummvm/trunk/sound/null.h 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/sound/null.h 2010-06-25 18:47:52 UTC (rev 50281)
@@ -53,4 +53,4 @@
Common::Error createInstance(MidiDriver **mididriver, MidiDriver::DeviceHandle = 0) const;
};
-#endif
\ No newline at end of file
+#endif
Modified: scummvm/trunk/sound/softsynth/pcspk.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/pcspk.cpp 2010-06-25 18:20:31 UTC (rev 50280)
+++ scummvm/trunk/sound/softsynth/pcspk.cpp 2010-06-25 18:47:52 UTC (rev 50281)
@@ -184,4 +184,4 @@
//REGISTER_PLUGIN_DYNAMIC(PCJR, PLUGIN_TYPE_MUSIC, PCjrMusicPlugin);
//#else
REGISTER_PLUGIN_STATIC(PCJR, PLUGIN_TYPE_MUSIC, PCjrMusicPlugin);
-//#endif
\ No newline at end of file
+//#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list