aboutsummaryrefslogtreecommitdiff
path: root/engines/sky
diff options
context:
space:
mode:
authorMatthew Hoops2015-04-03 00:18:58 -0400
committerMatthew Hoops2015-07-07 20:19:42 -0400
commitf1f29302f5401c4782985cec4d47d069b99036ee (patch)
tree60c6c8c7b2867cf9524197d2c2c0734746906b71 /engines/sky
parent2fa1ce51dd3cb00eef289094fe9f660c237254bc (diff)
downloadscummvm-rg350-f1f29302f5401c4782985cec4d47d069b99036ee.tar.gz
scummvm-rg350-f1f29302f5401c4782985cec4d47d069b99036ee.tar.bz2
scummvm-rg350-f1f29302f5401c4782985cec4d47d069b99036ee.zip
AUDIO: Remove the legacy OPL API
Diffstat (limited to 'engines/sky')
-rw-r--r--engines/sky/music/adlibchannel.cpp4
-rw-r--r--engines/sky/music/adlibchannel.h4
-rw-r--r--engines/sky/music/adlibmusic.cpp11
-rw-r--r--engines/sky/music/adlibmusic.h7
4 files changed, 16 insertions, 10 deletions
diff --git a/engines/sky/music/adlibchannel.cpp b/engines/sky/music/adlibchannel.cpp
index 8400fef6eb..b57f20f0f8 100644
--- a/engines/sky/music/adlibchannel.cpp
+++ b/engines/sky/music/adlibchannel.cpp
@@ -29,7 +29,7 @@
namespace Sky {
-AdLibChannel::AdLibChannel(FM_OPL *opl, uint8 *pMusicData, uint16 startOfData) {
+AdLibChannel::AdLibChannel(OPL::OPL *opl, uint8 *pMusicData, uint16 startOfData) {
_opl = opl;
_musicData = pMusicData;
_channelData.loopPoint = startOfData;
@@ -95,7 +95,7 @@ void AdLibChannel::updateVolume(uint16 pVolume) {
*/
void AdLibChannel::setRegister(uint8 regNum, uint8 value) {
if (_adlibRegMirror[regNum] != value) {
- OPLWriteReg (_opl, regNum, value);
+ _opl->writeReg(regNum, value);
_adlibRegMirror[regNum] = value;
}
}
diff --git a/engines/sky/music/adlibchannel.h b/engines/sky/music/adlibchannel.h
index 80dae93b2c..240dd5c8c0 100644
--- a/engines/sky/music/adlibchannel.h
+++ b/engines/sky/music/adlibchannel.h
@@ -60,13 +60,13 @@ typedef struct {
class AdLibChannel : public ChannelBase {
public:
- AdLibChannel (FM_OPL *opl, uint8 *pMusicData, uint16 startOfData);
+ AdLibChannel (OPL::OPL *opl, uint8 *pMusicData, uint16 startOfData);
virtual ~AdLibChannel();
virtual uint8 process(uint16 aktTime);
virtual void updateVolume(uint16 pVolume);
virtual bool isActive();
private:
- FM_OPL *_opl;
+ OPL::OPL *_opl;
uint8 *_musicData;
AdLibChannelType _channelData;
diff --git a/engines/sky/music/adlibmusic.cpp b/engines/sky/music/adlibmusic.cpp
index dd64c5bc81..2b73cb1411 100644
--- a/engines/sky/music/adlibmusic.cpp
+++ b/engines/sky/music/adlibmusic.cpp
@@ -22,6 +22,7 @@
#include "common/endian.h"
+#include "common/textconsole.h"
#include "sky/music/adlibmusic.h"
#include "sky/music/adlibchannel.h"
@@ -34,14 +35,16 @@ AdLibMusic::AdLibMusic(Audio::Mixer *pMixer, Disk *pDisk) : MusicBase(pMixer, pD
_driverFileBase = 60202;
_sampleRate = pMixer->getOutputRate();
- _opl = makeAdLibOPL(_sampleRate);
+ _opl = OPL::Config::create();
+ if (!_opl || !_opl->init(_sampleRate))
+ error("Failed to create OPL");
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
AdLibMusic::~AdLibMusic() {
- OPLDestroy(_opl);
_mixer->stopHandle(_soundHandle);
+ delete _opl;
}
int AdLibMusic::readBuffer(int16 *data, const int numSamples) {
@@ -61,7 +64,7 @@ int AdLibMusic::readBuffer(int16 *data, const int numSamples) {
render = (remaining > _nextMusicPoll) ? _nextMusicPoll : remaining;
remaining -= render;
_nextMusicPoll -= render;
- YM3812UpdateOne(_opl, data, render);
+ _opl->readBuffer(data, render);
data += render;
if (_nextMusicPoll == 0) {
pollMusic();
@@ -102,7 +105,7 @@ void AdLibMusic::setupChannels(uint8 *channelData) {
void AdLibMusic::startDriver() {
uint16 cnt = 0;
while (_initSequence[cnt] || _initSequence[cnt + 1]) {
- OPLWriteReg (_opl, _initSequence[cnt], _initSequence[cnt + 1]);
+ _opl->writeReg(_initSequence[cnt], _initSequence[cnt + 1]);
cnt += 2;
}
}
diff --git a/engines/sky/music/adlibmusic.h b/engines/sky/music/adlibmusic.h
index 886eef026e..9a0796d774 100644
--- a/engines/sky/music/adlibmusic.h
+++ b/engines/sky/music/adlibmusic.h
@@ -25,7 +25,10 @@
#include "sky/music/musicbase.h"
#include "audio/audiostream.h"
-#include "audio/fmopl.h"
+
+namespace OPL {
+class OPL;
+}
namespace Sky {
@@ -42,7 +45,7 @@ public:
virtual void setVolume(uint16 param);
private:
- FM_OPL *_opl;
+ OPL::OPL *_opl;
Audio::SoundHandle _soundHandle;
uint8 *_initSequence;
uint32 _sampleRate, _nextMusicPoll;