diff options
-rw-r--r-- | sound/mods/maxtrax.cpp | 22 | ||||
-rw-r--r-- | sound/mods/maxtrax.h | 1 |
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); |