From 2249db2c6d7603bf3fc81241fa4b87b0a7f72610 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 28 Jun 2007 17:42:57 +0000 Subject: Started to refactor the Paula / Amiga MOD code: Made some stuff in class Paula private and added accessor APIs instead svn-id: r27759 --- sound/mods/rjp1.cpp | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) (limited to 'sound/mods/rjp1.cpp') diff --git a/sound/mods/rjp1.cpp b/sound/mods/rjp1.cpp index ab5d7430be..3f5582de51 100644 --- a/sound/mods/rjp1.cpp +++ b/sound/mods/rjp1.cpp @@ -113,8 +113,6 @@ protected: void stopPaulaChannel(uint8 channel); void setupPaulaChannel(uint8 channel, const int8 *waveData, uint16 offset, uint16 len, uint16 repeatPos, uint16 repeatLen); - void setupPaulaChannelPeriod(uint8 channel, int16 period); - void setPaulaChannelVolume(uint8 channel, uint8 volume); virtual void interrupt(); @@ -202,8 +200,7 @@ void Rjp1::startSong(int song) { } } // "start" Paula audiostream - _playing = true; - _end = false; + startPaula(); } void Rjp1::startSequence(uint8 channelNum, uint8 seqNum) { @@ -351,7 +348,7 @@ void Rjp1::modulatePeriod(Rjp1Channel *channel) { channel->freqInit += channel->freqInc; --channel->freqStep; } - setupPaulaChannelPeriod(channel - _channelsTable, channel->freqInit + channel->modulatePeriodNext); + setChannelPeriod(channel - _channelsTable, channel->freqInit + channel->modulatePeriodNext); } void Rjp1::setupNote(Rjp1Channel *channel, int16 period) { @@ -482,7 +479,7 @@ void Rjp1::modulateVolumeWaveform(Rjp1Channel *channel) { void Rjp1::setVolume(Rjp1Channel *channel) { channel->volume = (channel->volume * channel->volumeScale) / 64; channel->volume = CLIP(channel->volume, 0, 64); - setPaulaChannelVolume(channel - _channelsTable, channel->volume); + setChannelVolume(channel - _channelsTable, channel->volume); } void Rjp1::stopPaulaChannel(uint8 channel) { @@ -491,23 +488,10 @@ void Rjp1::stopPaulaChannel(uint8 channel) { void Rjp1::setupPaulaChannel(uint8 channel, const int8 *waveData, uint16 offset, uint16 len, uint16 repeatPos, uint16 repeatLen) { if (waveData) { - Channel *ch = &_voice[channel]; - ch->data = waveData; - ch->dataRepeat = waveData + repeatPos * 2; - ch->length = len * 2; - ch->lengthRepeat = repeatLen * 2; - ch->offset = offset * 2; + setChannelData(channel, waveData, waveData + repeatPos * 2, len * 2, repeatLen * 2, offset * 2); } } -void Rjp1::setupPaulaChannelPeriod(uint8 channel, int16 period) { - _voice[channel].period = period; -} - -void Rjp1::setPaulaChannelVolume(uint8 channel, uint8 volume) { - _voice[channel].volume = volume; -} - void Rjp1::interrupt() { for (int i = 0; i < 4; ++i) { _vars.currentChannel = i; -- cgit v1.2.3