aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNorbert Lange2009-07-10 15:04:41 +0000
committerNorbert Lange2009-07-10 15:04:41 +0000
commit3ae850fe9c14d2feffbbad0b31df0c9f4ae0cb96 (patch)
treeea7215aa0b51593f4d078e1a93a9dd0e963a6ed6
parentc5a3ab2af29d1a03b54de3b61b969c571dbdc922 (diff)
downloadscummvm-rg350-3ae850fe9c14d2feffbbad0b31df0c9f4ae0cb96.tar.gz
scummvm-rg350-3ae850fe9c14d2feffbbad0b31df0c9f4ae0cb96.tar.bz2
scummvm-rg350-3ae850fe9c14d2feffbbad0b31df0c9f4ae0cb96.zip
added initialisation of channels
svn-id: r42339
-rw-r--r--sound/mods/maxtrax.cpp22
-rw-r--r--sound/mods/maxtrax.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/sound/mods/maxtrax.cpp b/sound/mods/maxtrax.cpp
index 4573ab3e3d..b922fb0dc3 100644
--- a/sound/mods/maxtrax.cpp
+++ b/sound/mods/maxtrax.cpp
@@ -48,6 +48,9 @@ MaxTrax::MaxTrax(int rate, bool stereo)
uint32 colorClock = kPalSystemClock / 2;
+ for (int i = 0; i < kNumChannels; ++i)
+ resetChannel(_channelCtx[i], (i & 1) != 0);
+
// init extraChannel
// extraChannel. chan_Number = 16, chan_Flags = chan_VoicesActive = 0
}
@@ -263,7 +266,7 @@ void MaxTrax::interrupt() {
if (voice.channel->volume < (1 << 7))
vol = (vol * voice.channel->volume) >> 7;
- newVolume = (byte)MAX(vol, (uint16)0x64);
+ newVolume = (byte)MIN(vol, (uint16)0x64);
voice.lastVolume = newVolume;
if ((voice.flags & VoiceContext::kFlagPortamento) != 0) {
@@ -499,6 +502,23 @@ void MaxTrax::noteOff(ChannelContext &channel, const byte note) {
}
}
+void MaxTrax::resetChannel(ChannelContext &chan, bool rightChannel) {
+ chan.modulation = 0;
+ chan.modulationTime = 1000;
+ chan.microtonal = -1;
+ chan.portamento = 500;
+ chan.pitchBend = 64 << 7;
+ chan.pitchReal = 0;
+ chan.pitchBendRange = 24;
+ chan.volume = 128;
+ chan.flags &= ~ChannelContext::kFlagPortamento & ~ChannelContext::kFlagMicrotonal;
+ chan.flags |= ChannelContext::kFlagAltered;
+ if (rightChannel)
+ chan.flags |= ChannelContext::kFlagRightChannel;
+ else
+ chan.flags &= ~ChannelContext::kFlagRightChannel;
+}
+
void MaxTrax::freeScores() {
if (_scores) {
for (int i = 0; i < _numScores; ++i)
diff --git a/sound/mods/maxtrax.h b/sound/mods/maxtrax.h
index 0e266dfc90..1edfa5945b 100644
--- a/sound/mods/maxtrax.h
+++ b/sound/mods/maxtrax.h
@@ -202,6 +202,7 @@ public:
void stopMusic();
void freePatches();
void freeScores();
+ void resetChannel(ChannelContext &chan, bool rightChannel);
int calcNote(VoiceContext &voice);
int8 noteOn(ChannelContext &channel, byte note, uint16 volume, uint16 pri);