diff options
author | Torbjörn Andersson | 2009-07-06 18:15:50 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2009-07-06 18:15:50 +0000 |
commit | 7c155f87472c550f4bd2494fe31d599dfeb7058c (patch) | |
tree | 46e50c5a9ad7c20eb39ad13848a0d57c3c59a90d /sound | |
parent | e9a480062984189c3ab33212dda34ce3db469acd (diff) | |
download | scummvm-rg350-7c155f87472c550f4bd2494fe31d599dfeb7058c.tar.gz scummvm-rg350-7c155f87472c550f4bd2494fe31d599dfeb7058c.tar.bz2 scummvm-rg350-7c155f87472c550f4bd2494fe31d599dfeb7058c.zip |
GCC thinks it's wrong to goto past variables being initialised (even if they
aren't used afterwards). Fixed that, and some warnings.
svn-id: r42187
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mods/maxtrax.cpp | 122 | ||||
-rw-r--r-- | sound/mods/maxtrax.h | 6 |
2 files changed, 66 insertions, 62 deletions
diff --git a/sound/mods/maxtrax.cpp b/sound/mods/maxtrax.cpp index f945a5544b..f9cf247eee 100644 --- a/sound/mods/maxtrax.cpp +++ b/sound/mods/maxtrax.cpp @@ -181,6 +181,7 @@ bool MaxTrax::doSong(int songIndex, int advance) { _playerCtx.musicPlaying = true; Paula::startPaula(); + return true; } void MaxTrax::killVoice(byte num) { @@ -199,6 +200,8 @@ void MaxTrax::killVoice(byte num) { } int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, uint16 pri) { + bool processNote = true; + if (channel.microtonal >= 0) _microtonal[note % 127] = channel.microtonal; if (!volume) @@ -223,7 +226,7 @@ int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, ui voice.flags |= VoiceContext::kFlagPortamento; voice.endNote = channel.lastNote = note; voice.noteVolume = (_playerCtx.handleVolume) ? volume + 1 : 128; - goto endFunction; + processNote = false; } } else { // TODO: @@ -231,74 +234,75 @@ int8 MaxTrax::noteOn(ChannelContext &channel, const byte note, uint16 volume, ui // return if no channel found voiceNum = (channel.flags & ChannelContext::kFlagRightChannel) != 0 ? 0 : 1; } - assert(voiceNum >= 0 && voiceNum < ARRAYSIZE(_voiceCtx)); + if (processNote) { + assert(voiceNum >= 0 && voiceNum < ARRAYSIZE(_voiceCtx)); - VoiceContext &voice = _voiceCtx[voiceNum]; - voice.flags = 0; - if (voice.channel) { - killVoice(voiceNum); - voice.flags |= VoiceContext::kFlagStolen; - } - voice.channel = &channel; - voice.patch = &patch; - voice.baseNote = note; - - // calc note period - voice.priority = (byte)pri; - voice.status = VoiceContext::kStatusStart; - - voice.noteVolume = (_playerCtx.handleVolume) ? volume + 1 : 128; - - // ifeq HAS_FULLCHANVOL macro - if (channel.volume < 128) - voice.noteVolume = (voice.noteVolume * channel.volume) >> 7; - - voice.baseVolume = 0; - voice.lastTicks = 0; - - uint16 period = voice.lastPeriod; - if (!period) - period = 1000; - - int useOctave = 0; - // get samplestart for the given octave - const int8 *samplePtr = patch.samplePtr + (patch.sampleTotalLen << useOctave) - patch.sampleTotalLen; - if (patch.sampleAttackLen) { - Paula::setChannelSampleStart(voiceNum, samplePtr); - Paula::setChannelSampleLen(voiceNum, patch.sampleAttackLen << useOctave); - Paula::setChannelPeriod(voiceNum, period); - Paula::setChannelVolume(voiceNum, 0); - - Paula::enableChannel(voiceNum); - // wait for dma-clear - } + VoiceContext &voice = _voiceCtx[voiceNum]; + voice.flags = 0; + if (voice.channel) { + killVoice(voiceNum); + voice.flags |= VoiceContext::kFlagStolen; + } + voice.channel = &channel; + voice.patch = &patch; + voice.baseNote = note; + + // calc note period + voice.priority = (byte)pri; + voice.status = VoiceContext::kStatusStart; + + voice.noteVolume = (_playerCtx.handleVolume) ? volume + 1 : 128; + + // ifeq HAS_FULLCHANVOL macro + if (channel.volume < 128) + voice.noteVolume = (voice.noteVolume * channel.volume) >> 7; + + voice.baseVolume = 0; + voice.lastTicks = 0; - if (patch.sampleTotalLen > patch.sampleAttackLen) { - Paula::setChannelSampleStart(voiceNum, samplePtr + patch.sampleAttackLen); - Paula::setChannelSampleLen(voiceNum, (patch.sampleTotalLen - patch.sampleAttackLen) << useOctave); - if (!patch.sampleAttackLen) { - // need to enable channel + uint16 period = voice.lastPeriod; + if (!period) + period = 1000; + + int useOctave = 0; + // get samplestart for the given octave + const int8 *samplePtr = patch.samplePtr + (patch.sampleTotalLen << useOctave) - patch.sampleTotalLen; + if (patch.sampleAttackLen) { + Paula::setChannelSampleStart(voiceNum, samplePtr); + Paula::setChannelSampleLen(voiceNum, patch.sampleAttackLen << useOctave); Paula::setChannelPeriod(voiceNum, period); Paula::setChannelVolume(voiceNum, 0); Paula::enableChannel(voiceNum); + // wait for dma-clear } - // another pointless wait for DMA-Clear??? - } - channel.voicesActive++; - if (&channel < &_channelCtx[kNumChannels]) { - const byte flagsSet = ChannelContext::kFlagMono | ChannelContext::kFlagPortamento; - if ((channel.flags & flagsSet) == flagsSet && channel.lastNote < 0x80 && channel.lastNote != voice.baseNote) { - voice.portaTicks = 0; - voice.endNote = voice.baseNote; - voice.baseNote = channel.lastNote; - voice.flags |= VoiceContext::kFlagPortamento; + if (patch.sampleTotalLen > patch.sampleAttackLen) { + Paula::setChannelSampleStart(voiceNum, samplePtr + patch.sampleAttackLen); + Paula::setChannelSampleLen(voiceNum, (patch.sampleTotalLen - patch.sampleAttackLen) << useOctave); + if (!patch.sampleAttackLen) { + // need to enable channel + Paula::setChannelPeriod(voiceNum, period); + Paula::setChannelVolume(voiceNum, 0); + + Paula::enableChannel(voiceNum); + } + // another pointless wait for DMA-Clear??? + } + + channel.voicesActive++; + if (&channel < &_channelCtx[kNumChannels]) { + const byte flagsSet = ChannelContext::kFlagMono | ChannelContext::kFlagPortamento; + if ((channel.flags & flagsSet) == flagsSet && channel.lastNote < 0x80 && channel.lastNote != voice.baseNote) { + voice.portaTicks = 0; + voice.endNote = voice.baseNote; + voice.baseNote = channel.lastNote; + voice.flags |= VoiceContext::kFlagPortamento; + } + if ((channel.flags & ChannelContext::kFlagPortamento) != 0) + channel.lastNote = note; } - if ((channel.flags & ChannelContext::kFlagPortamento) != 0) - channel.lastNote = note; } -endFunction: _playerCtx.addedNote = true; _playerCtx.lastVoice = voiceNum; return voiceNum; diff --git a/sound/mods/maxtrax.h b/sound/mods/maxtrax.h index bb1244d53a..4055c750aa 100644 --- a/sound/mods/maxtrax.h +++ b/sound/mods/maxtrax.h @@ -217,8 +217,8 @@ public: static void outPutEvent(const Event &ev, int num = -1) { struct { byte cmd; - char *name; - char *param; + const char *name; + const char *param; } COMMANDS[] = { {0x80, "TEMPO ", "TEMPO, N/A "}, {0xa0, "SPECIAL ", "CHAN, SPEC # | VAL"}, @@ -253,4 +253,4 @@ public: }; } // End of namespace Audio -#endif
\ No newline at end of file +#endif |