[Scummvm-cvs-logs] scummvm master -> 88354bed23fae4a9fb719c875558d6b4ec069ac3
lordhoto
lordhoto at gmail.com
Sun Aug 7 16:02:06 CEST 2011
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6bd9cd33d9 SCUMM: Cleanup CMS code a bit.
88354bed23 SCUMM: Mark some overwritten methods as virtual.
Commit: 6bd9cd33d94867e6cf8fb72b5314d8ed586d8b33
https://github.com/scummvm/scummvm/commit/6bd9cd33d94867e6cf8fb72b5314d8ed586d8b33
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-07T06:56:49-07:00
Commit Message:
SCUMM: Cleanup CMS code a bit.
Changed paths:
engines/scumm/player_v2cms.cpp
engines/scumm/player_v2cms.h
diff --git a/engines/scumm/player_v2cms.cpp b/engines/scumm/player_v2cms.cpp
index c31998e..899474f 100644
--- a/engines/scumm/player_v2cms.cpp
+++ b/engines/scumm/player_v2cms.cpp
@@ -28,14 +28,6 @@
namespace Scumm {
-#define PROCESS_ATTACK 1
-#define PROCESS_RELEASE 2
-#define PROCESS_SUSTAIN 3
-#define PROCESS_DECAY 4
-#define PROCESS_VIBRATO 5
-
-#define CMS_RATE 22050
-
static const byte freqTable[] = {
3, 10, 17, 24, 31, 38, 45, 51,
58, 65, 71, 77, 83, 90, 96, 102,
@@ -492,27 +484,20 @@ void Player_V2CMS::playVoice() {
void Player_V2CMS::processChannel(Voice2 *channel) {
++_outputTableReady;
switch (channel->nextProcessState) {
- case PROCESS_RELEASE:
- processRelease(channel);
- break;
-
- case PROCESS_ATTACK:
+ case Voice2::kEnvelopeAttack:
processAttack(channel);
break;
- case PROCESS_DECAY:
+ case Voice2::kEnvelopeDecay:
processDecay(channel);
break;
- case PROCESS_SUSTAIN:
+ case Voice2::kEnvelopeSustain:
processSustain(channel);
break;
- case PROCESS_VIBRATO:
- processVibrato(channel);
- break;
-
- default:
+ case Voice2::kEnvelopeRelease:
+ processRelease(channel);
break;
}
}
@@ -530,7 +515,7 @@ void Player_V2CMS::processAttack(Voice2 *channel) {
int newVolume = channel->curVolume + channel->attackRate;
if (newVolume > channel->maxAmpl) {
channel->curVolume = channel->maxAmpl;
- channel->nextProcessState = PROCESS_DECAY;
+ channel->nextProcessState = Voice2::kEnvelopeDecay;
} else {
channel->curVolume = newVolume;
}
@@ -542,7 +527,7 @@ void Player_V2CMS::processDecay(Voice2 *channel) {
int newVolume = channel->curVolume - channel->decayRate;
if (newVolume <= channel->sustainRate) {
channel->curVolume = channel->sustainRate;
- channel->nextProcessState = PROCESS_SUSTAIN;
+ channel->nextProcessState = Voice2::kEnvelopeSustain;
} else {
channel->curVolume = newVolume;
}
@@ -670,7 +655,7 @@ void Player_V2CMS::playNote(byte *&data) {
freeVoice->curOctave = octave;
freeVoice->curFreq = freqTable[(note >> 8) << 2];
freeVoice->curVolume = 0;
- freeVoice->nextProcessState = PROCESS_ATTACK;
+ freeVoice->nextProcessState = Voice2::kEnvelopeAttack;
if (!(_lastMidiCommand & 1))
freeVoice->channel = 0xF0;
else
@@ -710,7 +695,7 @@ void Player_V2CMS::clearNote(byte *&data) {
if (voice) {
voice->chanNumber = 0xFF;
voice->nextVoice = 0;
- voice->nextProcessState = PROCESS_RELEASE;
+ voice->nextProcessState = Voice2::kEnvelopeRelease;
}
data += 2;
}
diff --git a/engines/scumm/player_v2cms.h b/engines/scumm/player_v2cms.h
index 01bbfa5..1b82515 100644
--- a/engines/scumm/player_v2cms.h
+++ b/engines/scumm/player_v2cms.h
@@ -48,11 +48,8 @@ public:
// AudioStream API
int readBuffer(int16 *buffer, const int numSamples);
bool isStereo() const { return true; }
- bool endOfData() const { return false; }
- int getRate() const { return _sampleRate; }
-
-protected:
+private:
#include "common/pack-start.h" // START STRUCT PACKING
struct Voice {
byte attack;
@@ -90,7 +87,14 @@ protected:
int8 unkRate;
int8 unkCount;
- int nextProcessState;
+ enum EnvelopeState {
+ kEnvelopeAttack,
+ kEnvelopeDecay,
+ kEnvelopeSustain,
+ kEnvelopeRelease
+ };
+
+ EnvelopeState nextProcessState;
uint8 curVolume;
uint8 curOctave;
uint8 curFreq;
Commit: 88354bed23fae4a9fb719c875558d6b4ec069ac3
https://github.com/scummvm/scummvm/commit/88354bed23fae4a9fb719c875558d6b4ec069ac3
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-07T06:58:27-07:00
Commit Message:
SCUMM: Mark some overwritten methods as virtual.
Changed paths:
engines/scumm/player_v2.h
engines/scumm/player_v2base.h
engines/scumm/player_v2cms.h
diff --git a/engines/scumm/player_v2.h b/engines/scumm/player_v2.h
index 14a0b9c..d932585 100644
--- a/engines/scumm/player_v2.h
+++ b/engines/scumm/player_v2.h
@@ -46,10 +46,7 @@ public:
virtual int getSoundStatus(int sound) const;
// AudioStream API
- int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const { return true; }
- bool endOfData() const { return false; }
- int getRate() const { return _sampleRate; }
+ virtual int readBuffer(int16 *buffer, const int numSamples);
protected:
unsigned int _update_step;
diff --git a/engines/scumm/player_v2base.h b/engines/scumm/player_v2base.h
index 2f04807..eb9ed94 100644
--- a/engines/scumm/player_v2base.h
+++ b/engines/scumm/player_v2base.h
@@ -86,9 +86,9 @@ public:
return numSamples;
}
*/
- bool isStereo() const { return true; }
- bool endOfData() const { return false; }
- int getRate() const { return _sampleRate; }
+ virtual bool isStereo() const { return true; }
+ virtual bool endOfData() const { return false; }
+ virtual int getRate() const { return _sampleRate; }
protected:
enum {
diff --git a/engines/scumm/player_v2cms.h b/engines/scumm/player_v2cms.h
index 1b82515..9faec5e 100644
--- a/engines/scumm/player_v2cms.h
+++ b/engines/scumm/player_v2cms.h
@@ -46,8 +46,8 @@ public:
virtual int getSoundStatus(int sound) const;
// AudioStream API
- int readBuffer(int16 *buffer, const int numSamples);
- bool isStereo() const { return true; }
+ virtual int readBuffer(int16 *buffer, const int numSamples);
+ virtual bool isStereo() const { return true; }
private:
#include "common/pack-start.h" // START STRUCT PACKING
More information about the Scummvm-git-logs
mailing list