aboutsummaryrefslogtreecommitdiff
path: root/audio/softsynth
diff options
context:
space:
mode:
authorJohannes Schickel2012-09-30 21:36:52 +0200
committerJohannes Schickel2012-09-30 21:36:52 +0200
commit04baadcf7a205b3da7b830463f2189b4e018330f (patch)
treef250f761382168874591e82a017f5f7c5d231599 /audio/softsynth
parent78e8b9dd5901fa396e06611c3320b17e50ef0822 (diff)
downloadscummvm-rg350-04baadcf7a205b3da7b830463f2189b4e018330f.tar.gz
scummvm-rg350-04baadcf7a205b3da7b830463f2189b4e018330f.tar.bz2
scummvm-rg350-04baadcf7a205b3da7b830463f2189b4e018330f.zip
AUDIO: Switch MidiDriver_ADLIB to new OPL API.
Diffstat (limited to 'audio/softsynth')
-rw-r--r--audio/softsynth/adlib.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/audio/softsynth/adlib.cpp b/audio/softsynth/adlib.cpp
index a0429e54f8..44cd79b530 100644
--- a/audio/softsynth/adlib.cpp
+++ b/audio/softsynth/adlib.cpp
@@ -593,7 +593,7 @@ public:
private:
bool _scummSmallHeader; // FIXME: This flag controls a special mode for SCUMM V3 games
- FM_OPL *_opl;
+ OPL::OPL *_opl;
byte *_regCache;
int _timerCounter;
@@ -941,7 +941,8 @@ int MidiDriver_ADLIB::open() {
_regCache = (byte *)calloc(256, 1);
- _opl = makeAdLibOPL(getRate());
+ _opl = OPL::Config::create();
+ _opl->init(getRate());
adlibWrite(1, 0x20);
adlibWrite(8, 0x40);
@@ -967,8 +968,7 @@ void MidiDriver_ADLIB::close() {
}
// Turn off the OPL emulation
- OPLDestroy(_opl);
-// YM3812Shutdown();
+ delete _opl;
free(_regCache);
}
@@ -1076,12 +1076,15 @@ void MidiDriver_ADLIB::adlibWrite(byte reg, byte value) {
#endif
_regCache[reg] = value;
- OPLWriteReg(_opl, reg, value);
+ _opl->writeReg(reg, value);
}
void MidiDriver_ADLIB::generateSamples(int16 *data, int len) {
- memset(data, 0, sizeof(int16) * len);
- YM3812UpdateOne(_opl, data, len);
+ if (_opl->isStereo()) {
+ len *= 2;
+ }
+
+ _opl->readBuffer(data, len);
}
void MidiDriver_ADLIB::onTimer() {