[Scummvm-cvs-logs] SF.net SVN: scummvm:[53031] scummvm/trunk/sound/softsynth/fmtowns_pc98

athrxx at users.sourceforge.net athrxx at users.sourceforge.net
Tue Oct 5 18:22:55 CEST 2010


Revision: 53031
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53031&view=rev
Author:   athrxx
Date:     2010-10-05 16:22:55 +0000 (Tue, 05 Oct 2010)

Log Message:
-----------
PC98 AUDIO: cleanup as suggested by sev (see devel)

Modified Paths:
--------------
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
    scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp	2010-10-05 10:52:20 UTC (rev 53030)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.cpp	2010-10-05 16:22:55 UTC (rev 53031)
@@ -160,7 +160,7 @@
 	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 @@
 	_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 @@
 		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 @@
 	_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 @@
 			delete _sfxChannels[i];
 		delete[] _sfxChannels;
 	}
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	delete _rhythmChannel;
 #endif
 
@@ -1121,7 +1121,7 @@
 		}
 	}
 
-#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 @@
 	}
 
 	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 @@
 		memcpy(_ssgPatches, _drvTables + 156, 256);
 	}
 
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	if (_rhythmChannel)
 		_rhythmChannel->reset();
 #endif
@@ -1253,7 +1253,7 @@
 
 	if (!_fading) {
 		_fading = 19;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 		if (_hasPercussion) {
 			if (_updateRhythmFlag & _rhythmChannel->_idFlag)
 				_rhythmChannel->reset();
@@ -1285,7 +1285,7 @@
 			}
 		}
 
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 		if (_hasPercussion)
 			if (_updateRhythmFlag & _rhythmChannel->_idFlag)
 				_rhythmChannel->processEvents();

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h	2010-10-05 10:52:20 UTC (rev 53030)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_driver.h	2010-10-05 16:22:55 UTC (rev 53031)
@@ -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 @@
 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 @@
 	TownsPC98_MusicChannel **_channels;
 	TownsPC98_MusicChannelSSG **_ssgChannels;
 	TownsPC98_SfxChannel **_sfxChannels;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	TownsPC98_MusicChannelPCM *_rhythmChannel;
 #endif
 

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp	2010-10-05 10:52:20 UTC (rev 53030)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.cpp	2010-10-05 16:22:55 UTC (rev 53031)
@@ -377,7 +377,7 @@
 	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 @@
 
 	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 @@
 	_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 @@
 		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 @@
 		deinit();
 
 	delete _ssg;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	delete _prc;
 #endif
 	delete[] _chanInternal;
@@ -888,7 +888,7 @@
 		_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 @@
 	if (_ssg)
 		_ssg->reset();
 
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	if (_prc)
 		_prc->reset();
 #endif
@@ -959,7 +959,7 @@
 			_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 @@
 
 		if (_ssg)
 			_ssg->nextTick(tmp, render);
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 		if (_prc)
 			_prc->nextTick(tmp, render);
 #endif
@@ -1194,7 +1194,7 @@
 	_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 @@
 	_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 @@
 	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 @@
 	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));

Modified: scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h
===================================================================
--- scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h	2010-10-05 10:52:20 UTC (rev 53030)
+++ scummvm/trunk/sound/softsynth/fmtowns_pc98/towns_pc98_fmsynth.h	2010-10-05 16:22:55 UTC (rev 53031)
@@ -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 @@
 	};
 
 	TownsPC98_FmSynthSquareSineSource *_ssg;
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	TownsPC98_FmSynthPercussionSource *_prc;
 #endif
 	ChanInternal *_chanInternal;
@@ -172,7 +182,7 @@
 	Audio::Mixer *_mixer;
 	Audio::SoundHandle _soundHandle;
 
-#ifndef __DS__
+#ifndef DISABLE_PC98_RHYTHM_CHANNEL
 	static const uint8 _percussionData[];
 #endif
 	static const uint32 _adtStat[];


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list