diff options
author | Max Horn | 2003-05-04 21:17:42 +0000 |
---|---|---|
committer | Max Horn | 2003-05-04 21:17:42 +0000 |
commit | 325c9b321c8f8b63f777c96833e2f27c7695cabf (patch) | |
tree | 2d8ab75b5d9c1f751d6f326b3dfc1154c826558e /backends/midi | |
parent | 9659a4b4ed705a0a82b2b52245e7c096536b78a1 (diff) | |
download | scummvm-rg350-325c9b321c8f8b63f777c96833e2f27c7695cabf.tar.gz scummvm-rg350-325c9b321c8f8b63f777c96833e2f27c7695cabf.tar.bz2 scummvm-rg350-325c9b321c8f8b63f777c96833e2f27c7695cabf.zip |
new fmopl (from adplug, which has it from mame; we can use it under the LGPL should we ever have to)
svn-id: r7328
Diffstat (limited to 'backends/midi')
-rw-r--r-- | backends/midi/adlib.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/backends/midi/adlib.cpp b/backends/midi/adlib.cpp index 8d9341d12a..4738501b3f 100644 --- a/backends/midi/adlib.cpp +++ b/backends/midi/adlib.cpp @@ -510,7 +510,6 @@ private: bool _isOpen; bool _game_SmallHeader; - FM_OPL *_opl; byte *_adlib_reg_cache; SoundMixer *_mixer; @@ -715,8 +714,6 @@ int MidiDriver_ADLIB::open() { int i; MidiChannelAdl *mc; - int env_bits = g_system->property(OSystem::PROP_GET_FMOPL_ENV_BITS, NULL); - int eg_ent = g_system->property(OSystem::PROP_GET_FMOPL_EG_ENT, NULL); for (i = 0, mc = _midi_channels; i != ARRAYSIZE(_midi_channels); i++, mc++) { mc->_channel = i; @@ -726,9 +723,9 @@ int MidiDriver_ADLIB::open() { _adlib_reg_cache = (byte *)calloc(256, 1); - OPLBuildTables((env_bits ? env_bits : FMOPL_ENV_BITS_HQ), (eg_ent ? eg_ent : FMOPL_EG_ENT_HQ)); - - _opl = OPLCreate(OPL_TYPE_YM3812, 3579545, g_system->property(OSystem::PROP_GET_SAMPLE_RATE, 0)); + // We need to emulate one YM3812 chip + if (0 != YM3812Init(1, 3579545, g_system->property(OSystem::PROP_GET_SAMPLE_RATE, 0))) + error("Error initialising YM3812 sound chip emulation"); adlib_write(1, 0x20); adlib_write(8, 0x40); @@ -750,6 +747,9 @@ void MidiDriver_ADLIB::close() { // Detach the premix callback handler _mixer->setupPremix (0, 0); + + // Turn of the OPL emulation + YM3812Shutdown(); _isOpen = false; } @@ -860,22 +860,18 @@ void MidiDriver_ADLIB::adlib_write(byte port, byte value) { return; _adlib_reg_cache[port] = value; - OPLWriteReg(_opl, port, value); + YM3812Write(0, 0, port); + YM3812Write(0, 1, value); } void MidiDriver_ADLIB::generate_samples(int16 *data, int len) { int step; - if (!_opl) { - memset(data, 0, len * sizeof(int16)); - return; - } - do { step = len; if (step > _next_tick) step = _next_tick; - YM3812UpdateOne(_opl, data, step); + YM3812UpdateOne(0, data, step); if (!(_next_tick -= step)) { if (_timer_proc) |