aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2004-02-24 22:39:42 +0000
committerMax Horn2004-02-24 22:39:42 +0000
commitd158280425efac5f4ec72e00fb2b7389cdfb5a75 (patch)
treef1bdab69e381b2a28320fdeb30936482565e5099 /sound
parent70f910cbe19e9c7320a56fa48669f7a5e9df00e6 (diff)
downloadscummvm-rg350-d158280425efac5f4ec72e00fb2b7389cdfb5a75.tar.gz
scummvm-rg350-d158280425efac5f4ec72e00fb2b7389cdfb5a75.tar.bz2
scummvm-rg350-d158280425efac5f4ec72e00fb2b7389cdfb5a75.zip
the OSystem changes we discussed on the ML (note: renaming of the existing OSystem API is not yet finished); porters will have to fix their ports to get them to compile again
svn-id: r13036
Diffstat (limited to 'sound')
-rw-r--r--sound/fmopl.cpp24
-rw-r--r--sound/fmopl.h3
-rw-r--r--sound/mixer.cpp6
3 files changed, 30 insertions, 3 deletions
diff --git a/sound/fmopl.cpp b/sound/fmopl.cpp
index 8b34779da6..60dacbfc33 100644
--- a/sound/fmopl.cpp
+++ b/sound/fmopl.cpp
@@ -1117,3 +1117,27 @@ int OPLTimerOver(FM_OPL *OPL, int c) {
(OPL->TimerHandler)(OPL->TimerParam + c, (double)OPL->T[c] * OPL->TimerBase);
return OPL->status >> 7;
}
+
+FM_OPL *makeAdlibOPL(int rate) {
+ // We need to emulate one YM3812 chip
+ int env_bits = FMOPL_ENV_BITS_HQ;
+ int eg_ent = FMOPL_EG_ENT_HQ;
+#ifdef _WIN32_WCE
+ // TODO: On WinCE, use low quality FMOPL by default.
+ // FIXME: Don't use 'CE_' or similar prefixes if you need platform specific
+ // config keys. Rather use a seperate config domain - e.g. for WinCE we have
+ // two such domains already, "wince" and "smartfon-keys" (although I wonder
+ // a bit about the latter one).
+ if (ConfMan.getBool("CE_FM_high_quality"))
+ env_bits = FMOPL_ENV_BITS_HQ;
+ else
+ env_bits = FMOPL_ENV_BITS_LQ;
+
+ if (ConfMan.getBool("CE_FM_high_quality"))
+ eg_ent = FMOPL_EG_ENT_HQ;
+ else
+ eg_ent = FMOPL_EG_ENT_LQ;
+#endif
+ OPLBuildTables(env_bits, eg_ent);
+ return OPLCreate(OPL_TYPE_YM3812, 3579545, rate);
+}
diff --git a/sound/fmopl.h b/sound/fmopl.h
index 65a1a47b05..509f0abc80 100644
--- a/sound/fmopl.h
+++ b/sound/fmopl.h
@@ -159,3 +159,6 @@ int OPLTimerOver(FM_OPL *OPL, int c);
void OPLWriteReg(FM_OPL *OPL, int r, int v);
void YM3812UpdateOne(FM_OPL *OPL, int16 *buffer, int length);
#endif
+
+// Factory method
+FM_OPL *makeAdlibOPL(int rate);
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index c7260ee02e..afe31813f4 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -111,7 +111,7 @@ SoundMixer::SoundMixer() {
_premixProc = 0;
int i = 0;
- _outputRate = (uint) _syst->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
+ _outputRate = (uint) _syst->getOutputSampleRate();
if (_outputRate == 0)
error("OSystem returned invalid sample rate");
@@ -124,11 +124,11 @@ SoundMixer::SoundMixer() {
for (i = 0; i != NUM_CHANNELS; i++)
_channels[i] = 0;
- _mixerReady = _syst->set_sound_proc(mixCallback, this, OSystem::SOUND_16BIT);
+ _mixerReady = _syst->setSoundCallback(mixCallback, this);
}
SoundMixer::~SoundMixer() {
- _syst->clear_sound_proc();
+ _syst->clearSoundCallback();
stopAll();
_syst->delete_mutex(_mutex);
}