aboutsummaryrefslogtreecommitdiff
path: root/sky/adlibmusic.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sky/adlibmusic.cpp')
-rw-r--r--sky/adlibmusic.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/sky/adlibmusic.cpp b/sky/adlibmusic.cpp
index 2e62b9db03..295f7e97bd 100644
--- a/sky/adlibmusic.cpp
+++ b/sky/adlibmusic.cpp
@@ -20,6 +20,7 @@
*/
#include "sky/adlibmusic.h"
+#include "sound/fmopl.h"
void SkyAdlibMusic::passMixerFunc(void *param, int16 *buf, uint len) {
@@ -32,17 +33,15 @@ SkyAdlibMusic::SkyAdlibMusic(SoundMixer *pMixer, SkyDisk *pSkyDisk)
_driverFileBase = 60202;
_mixer = pMixer;
_sampleRate = g_system->property(OSystem::PROP_GET_SAMPLE_RATE, 0);
- 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);
- OPLBuildTables((env_bits ? env_bits : FMOPL_ENV_BITS_HQ), (eg_ent ? eg_ent : FMOPL_EG_ENT_HQ));
- _opl = OPLCreate(OPL_TYPE_YM3812, 3579545, _sampleRate);
+ if (0 != YM3812Init(1, 3579545, _sampleRate))
+ error("Error initialising YM3812 sound chip emulation");
_mixer->setupPremix(this, passMixerFunc);
}
SkyAdlibMusic::~SkyAdlibMusic(void) {
_mixer->setupPremix(NULL, NULL);
- OPLDestroy(_opl);
+ YM3812Shutdown();
}
void SkyAdlibMusic::premixerCall(int16 *buf, uint len) {
@@ -64,7 +63,7 @@ void SkyAdlibMusic::premixerCall(int16 *buf, uint len) {
render = (len > _nextMusicPoll) ? (_nextMusicPoll) : (len);
len -= render;
_nextMusicPoll -= render;
- YM3812UpdateOne(_opl, buf, render);
+ YM3812UpdateOne(0, buf, render);
buf += render;
if (_nextMusicPoll == 0) {
pollMusic();
@@ -86,7 +85,7 @@ void SkyAdlibMusic::setupChannels(uint8 *channelData) {
channelData++;
for (uint8 cnt = 0; cnt < _numberOfChannels; cnt++) {
uint16 chDataStart = ((channelData[(cnt << 1) | 1] << 8) | channelData[cnt << 1]) + _musicDataLoc;
- _channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart, _opl);
+ _channels[cnt] = new SkyAdlibChannel(_musicData, chDataStart);
}
}
@@ -94,7 +93,8 @@ void SkyAdlibMusic::startDriver(void) {
uint16 cnt = 0;
while (_initSequence[cnt] || _initSequence[cnt+1]) {
- OPLWriteReg(_opl, _initSequence[cnt], _initSequence[cnt+1]);
+ YM3812Write(0, 0, _initSequence[cnt]);
+ YM3812Write(0, 1, _initSequence[cnt+1]);
cnt += 2;
}
_allowedCommands = 0xD;