[Scummvm-cvs-logs] CVS: scummvm/backends/midi adlib.cpp,1.15,1.16
Max Horn
fingolfin at users.sourceforge.net
Sun May 4 14:18:34 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/midi
In directory sc8-pr-cvs1:/tmp/cvs-serv4049/backends/midi
Modified Files:
adlib.cpp
Log Message:
new fmopl (from adplug, which has it from mame; we can use it under the LGPL should we ever have to)
Index: adlib.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/midi/adlib.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- adlib.cpp 6 Mar 2003 21:45:01 -0000 1.15
+++ adlib.cpp 4 May 2003 21:17:42 -0000 1.16
@@ -510,7 +510,6 @@
bool _isOpen;
bool _game_SmallHeader;
- FM_OPL *_opl;
byte *_adlib_reg_cache;
SoundMixer *_mixer;
@@ -715,8 +714,6 @@
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 @@
_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 @@
// Detach the premix callback handler
_mixer->setupPremix (0, 0);
+
+ // Turn of the OPL emulation
+ YM3812Shutdown();
_isOpen = false;
}
@@ -860,22 +860,18 @@
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)
More information about the Scummvm-git-logs
mailing list