aboutsummaryrefslogtreecommitdiff
path: root/sound/softsynth
diff options
context:
space:
mode:
authorFlorian Kagerer2010-10-05 16:22:55 +0000
committerFlorian Kagerer2010-10-05 16:22:55 +0000
commit0e0ab8b4024bf56bb8000bdf04bda19a0e8e3e00 (patch)
tree5627b4ccbfc56b95e4427e1fce7c159f26162a88 /sound/softsynth
parentc19c9482b2d2cdcacdd12c77d946ca31314931a8 (diff)
downloadscummvm-rg350-0e0ab8b4024bf56bb8000bdf04bda19a0e8e3e00.tar.gz
scummvm-rg350-0e0ab8b4024bf56bb8000bdf04bda19a0e8e3e00.tar.bz2
scummvm-rg350-0e0ab8b4024bf56bb8000bdf04bda19a0e8e3e00.zip
PC98 AUDIO: cleanup as suggested by sev (see devel)
svn-id: r53031
Diffstat (limited to 'sound/softsynth')
-rw-r--r--sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp22
-rw-r--r--sound/softsynth/fmtowns_pc98/towns_pc98_driver.h6
-rw-r--r--sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp28
-rw-r--r--sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h16
4 files changed, 41 insertions, 31 deletions
diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
index 21e8f9b2e5..3cf4caf0d1 100644
--- a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
+++ b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
@@ -160,7 +160,7 @@ public:
void reset();
};
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
class TownsPC98_MusicChannelPCM : public TownsPC98_MusicChannel {
public:
TownsPC98_MusicChannelPCM(TownsPC98_AudioDriver *driver, uint8 regOffs,
@@ -930,7 +930,7 @@ void TownsPC98_SfxChannel::reset() {
_drv->_ssgPatches[i + 12] = src[i + 12];
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_MusicChannelPCM::TownsPC98_MusicChannelPCM(TownsPC98_AudioDriver *driver, uint8 regOffs,
uint8 flgs, uint8 num, uint8 key, uint8 prt, uint8 id) :
TownsPC98_MusicChannel(driver, regOffs, flgs, num, key, prt, id), controlEvents(0) {
@@ -1019,11 +1019,11 @@ bool TownsPC98_MusicChannelPCM::control_ff_endOfTrack(uint8 para) {
return false;
}
}
-#endif // ifndef __DS__
+#endif // DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_AudioDriver::TownsPC98_AudioDriver(Audio::Mixer *mixer, EmuType type) : TownsPC98_FmSynth(mixer, type),
_channels(0), _ssgChannels(0), _sfxChannels(0),
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
_rhythmChannel(0),
#endif
_trackPtr(0), _sfxData(0), _sfxOffs(0), _ssgPatches(0),
@@ -1035,7 +1035,7 @@ TownsPC98_AudioDriver::TownsPC98_AudioDriver(Audio::Mixer *mixer, EmuType type)
_updateChannelsFlag(type == kType26 ? 0x07 : 0x3F), _finishedChannelsFlag(0),
_updateSSGFlag(type == kTypeTowns ? 0x00 : 0x07), _finishedSSGFlag(0),
_updateRhythmFlag(type == kType86 ?
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
0x01
#else
0x00
@@ -1075,7 +1075,7 @@ TownsPC98_AudioDriver::~TownsPC98_AudioDriver() {
delete _sfxChannels[i];
delete[] _sfxChannels;
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
delete _rhythmChannel;
#endif
@@ -1121,7 +1121,7 @@ bool TownsPC98_AudioDriver::init() {
}
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_hasPercussion) {
_rhythmChannel = new TownsPC98_MusicChannelPCM(this, 0, 0, 0, 0, 0, 1);
_rhythmChannel->init();
@@ -1168,7 +1168,7 @@ void TownsPC98_AudioDriver::loadMusicData(uint8 *data, bool loadPaused) {
}
if (_hasPercussion) {
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
_rhythmChannel->loadData(data + READ_LE_UINT16(src_a));
#endif
src_a += 2;
@@ -1230,7 +1230,7 @@ void TownsPC98_AudioDriver::reset() {
memcpy(_ssgPatches, _drvTables + 156, 256);
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_rhythmChannel)
_rhythmChannel->reset();
#endif
@@ -1253,7 +1253,7 @@ void TownsPC98_AudioDriver::fadeStep() {
if (!_fading) {
_fading = 19;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_hasPercussion) {
if (_updateRhythmFlag & _rhythmChannel->_idFlag)
_rhythmChannel->reset();
@@ -1285,7 +1285,7 @@ void TownsPC98_AudioDriver::timerCallbackB() {
}
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_hasPercussion)
if (_updateRhythmFlag & _rhythmChannel->_idFlag)
_rhythmChannel->processEvents();
diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h
index 162156b2b5..00fcf7c5d5 100644
--- a/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h
+++ b/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h
@@ -31,7 +31,7 @@
class TownsPC98_MusicChannel;
class TownsPC98_MusicChannelSSG;
class TownsPC98_SfxChannel;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
class TownsPC98_MusicChannelPCM;
#endif
@@ -39,7 +39,7 @@ class TownsPC98_AudioDriver : public TownsPC98_FmSynth {
friend class TownsPC98_MusicChannel;
friend class TownsPC98_MusicChannelSSG;
friend class TownsPC98_SfxChannel;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
friend class TownsPC98_MusicChannelPCM;
#endif
public:
@@ -88,7 +88,7 @@ protected:
TownsPC98_MusicChannel **_channels;
TownsPC98_MusicChannelSSG **_ssgChannels;
TownsPC98_SfxChannel **_sfxChannels;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_MusicChannelPCM *_rhythmChannel;
#endif
diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
index 7b94a46426..0a4984888d 100644
--- a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
+++ b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
@@ -377,7 +377,7 @@ private:
bool _ready;
};
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
class TownsPC98_FmSynthPercussionSource {
public:
TownsPC98_FmSynthPercussionSource(const uint32 timerbase, const uint32 rtt);
@@ -443,7 +443,7 @@ private:
bool _ready;
};
-#endif
+#endif // DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_FmSynthSquareSineSource::TownsPC98_FmSynthSquareSineSource(const uint32 timerbase, const uint32 rtt) : _tlTable(0),
_rtt(rtt), _tleTable(0), _updateRequest(-1), _tickLength(timerbase * 27), _ready(0), _reg(0), _rand(1), _outN(1),
@@ -629,7 +629,7 @@ void TownsPC98_FmSynthSquareSineSource::updateRegs() {
_updateRequest = -1;
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_FmSynthPercussionSource::TownsPC98_FmSynthPercussionSource(const uint32 timerbase, const uint32 rtt) :
_rtt(rtt), _tickLength(timerbase * 2), _timer(0), _ready(false), _volMaskA(0), _volMaskB(0), _volumeA(Audio::Mixer::kMaxMixerVolume), _volumeB(Audio::Mixer::kMaxMixerVolume) {
@@ -826,12 +826,12 @@ void TownsPC98_FmSynthPercussionSource::advanceInput(RhtChannel *ins) {
cur >>= 4;
}
}
-#endif // ifndef __DS__
+#endif // DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_FmSynth::TownsPC98_FmSynth(Audio::Mixer *mixer, EmuType type) :
_mixer(mixer),
_chanInternal(0), _ssg(0),
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
_prc(0),
#endif
_numChan(type == kType26 ? 3 : 6), _numSSG(type == kTypeTowns ? 0 : 3),
@@ -854,7 +854,7 @@ TownsPC98_FmSynth::~TownsPC98_FmSynth() {
deinit();
delete _ssg;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
delete _prc;
#endif
delete[] _chanInternal;
@@ -888,7 +888,7 @@ bool TownsPC98_FmSynth::init() {
_ssg->init(&_ssgTables[0], &_ssgTables[16]);
}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_hasPercussion) {
_prc = new TownsPC98_FmSynthPercussionSource(_timerbase, _rtt);
_prc->init(_percussionData);
@@ -922,7 +922,7 @@ void TownsPC98_FmSynth::reset() {
if (_ssg)
_ssg->reset();
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_prc)
_prc->reset();
#endif
@@ -959,7 +959,7 @@ void TownsPC98_FmSynth::writeReg(uint8 part, uint8 regAddress, uint8 value) {
_ssg->writeReg(l, value);
break;
case 0x10:
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
// pcm rhythm channel
if (_prc)
_prc->writeReg(l, value);
@@ -1155,7 +1155,7 @@ int TownsPC98_FmSynth::readBuffer(int16 *buffer, const int numSamples) {
if (_ssg)
_ssg->nextTick(tmp, render);
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_prc)
_prc->nextTick(tmp, render);
#endif
@@ -1194,7 +1194,7 @@ void TownsPC98_FmSynth::setVolumeIntern(int volA, int volB) {
_volumeB = CLIP<uint16>(volB, 0, Audio::Mixer::kMaxMixerVolume);
if (_ssg)
_ssg->setVolumeIntern(_volumeA, _volumeB);
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_prc)
_prc->setVolumeIntern(_volumeA, _volumeB);
#endif
@@ -1206,7 +1206,7 @@ void TownsPC98_FmSynth::setVolumeChannelMasks(int channelMaskA, int channelMaskB
_volMaskB = channelMaskB;
if (_ssg)
_ssg->setVolumeChannelMasks(_volMaskA >> _numChan, _volMaskB >> _numChan);
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
if (_prc)
_prc->setVolumeChannelMasks(_volMaskA >> (_numChan + _numSSG), _volMaskB >> (_numChan + _numSSG));
#endif
@@ -1422,7 +1422,7 @@ const int TownsPC98_FmSynth::_ssgTables[] = {
0x000575, 0x000463, 0x00039D, 0x0002FA, 0x000242, 0x0001B6, 0x00014C, 0x0000FB
};
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
const uint8 TownsPC98_FmSynth::_percussionData[] = {
0, 24, 1, 192, 1, 216, 2, 128, 4, 88, 23, 64, 27, 152, 1, 128, 29, 24, 2, 128, 31, 152, 0, 128, 136, 128, 128, 128, 0, 136, 97, 103, 153, 139, 34, 163, 72, 195, 27, 69, 1, 154, 137, 35, 8, 51, 169, 122, 164, 75, 133, 203, 81, 146, 168, 121, 185, 68, 202, 8, 33, 237, 49, 177, 12, 133, 140, 17, 160, 42, 161, 10, 0, 137, 176, 57,
233, 41, 160, 136, 235, 65, 177, 137, 128, 26, 164, 28, 3, 157, 51, 137, 1, 152, 113, 161, 40, 146, 115, 192, 56, 5, 169, 66, 161, 56, 1, 50, 145, 59, 39, 168, 97, 1, 160, 57, 7, 153, 50, 153, 32, 2, 25, 129, 32, 20, 186, 66, 129, 24, 153, 164, 142, 130, 169, 153, 26, 242, 138, 217, 9, 128, 204, 58, 209, 172, 40, 176, 141,
@@ -1537,7 +1537,7 @@ const uint8 TownsPC98_FmSynth::_percussionData[] = {
45, 136, 18, 144, 105, 138, 1, 160, 14, 128, 132, 145, 186, 37, 138, 41, 192, 48, 145, 46, 160, 33, 44, 24, 225, 16, 13, 132, 136, 137, 16, 148, 25, 170, 194, 82, 152, 136, 91, 24, 42, 169, 33, 233, 131, 179, 24, 185, 149, 16, 57, 172, 164, 18, 10, 211, 160, 147, 211, 33, 138, 243, 129, 16, 41, 193, 0, 43, 132, 155, 73,
58, 145, 244, 145, 43, 35, 9, 171, 16, 110, 25, 8, 28, 74, 162, 128, 26, 27, 82, 45, 136, 153, 18, 8, 136, 8
};
-#endif
+#endif // DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_FmSynth::ChanInternal::ChanInternal() {
memset(this, 0, sizeof(ChanInternal));
diff --git a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
index a6fd39646a..ddd249b1b8 100644
--- a/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
+++ b/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
@@ -30,9 +30,19 @@
#include "sound/mixer.h"
#include "common/list.h"
+#ifdef __DS__
+/* This disables the rhythm channel when emulating the PC-98 type 86 sound card.
+ * The only purpose is code size reduction for certain backends.
+ * At the moment the only games which make use of the rhythm channel are the
+ * (very rare) PC-98 versions of Legend of Kyrandia 2 and Lands of Lore. Music will
+ * still be okay, just missing a couple of rhythm instruments.
+ */
+#define DISABLE_PC98_RHYTHM_CHANNEL
+#endif
+
class TownsPC98_FmSynthOperator;
class TownsPC98_FmSynthSquareSineSource;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
class TownsPC98_FmSynthPercussionSource;
#endif
@@ -130,7 +140,7 @@ private:
};
TownsPC98_FmSynthSquareSineSource *_ssg;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
TownsPC98_FmSynthPercussionSource *_prc;
#endif
ChanInternal *_chanInternal;
@@ -172,7 +182,7 @@ private:
Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
static const uint8 _percussionData[];
#endif
static const uint32 _adtStat[];