aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage
diff options
context:
space:
mode:
authorPaul Gilbert2011-06-08 23:23:57 +1000
committerPaul Gilbert2011-06-08 23:23:57 +1000
commitb0372e42100012d8a9e6ab949940c960ced7fee5 (patch)
tree51baf16656a93d14215b83825ed53ff429b8e888 /engines/tsage
parent8e9e25c786c8100a9a5a5955b7153e0b6e27c8eb (diff)
downloadscummvm-rg350-b0372e42100012d8a9e6ab949940c960ced7fee5.tar.gz
scummvm-rg350-b0372e42100012d8a9e6ab949940c960ced7fee5.tar.bz2
scummvm-rg350-b0372e42100012d8a9e6ab949940c960ced7fee5.zip
TSAGE: Finished implementing voice type 1 post processing for _sfRethinkVoiceTypes
Diffstat (limited to 'engines/tsage')
-rw-r--r--engines/tsage/sound.cpp72
-rw-r--r--engines/tsage/sound.h6
2 files changed, 67 insertions, 11 deletions
diff --git a/engines/tsage/sound.cpp b/engines/tsage/sound.cpp
index 62f8787ace..ff8b87eb83 100644
--- a/engines/tsage/sound.cpp
+++ b/engines/tsage/sound.cpp
@@ -801,10 +801,66 @@ void SoundManager::_sfRethinkVoiceTypes() {
}
for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
- VoiceStructEntry &vse = vs->_entries[idx];
- if (vse._type1._sound2) {
- //dx/ax = vse._sound2;
- //si = 0;
+ VoiceStructEntryType1 &vse = vs->_entries[idx]._type1;
+ Sound *sound = vse._sound2;
+ int channelNum = vse._channelNum2;
+
+ if (!sound)
+ continue;
+
+ for (uint entryIndex = 0; entryIndex < vs->_entries.size(); ++entryIndex) {
+ VoiceStructEntryType1 &vse2 = vs->_entries[entryIndex]._type1;
+ if (!vse2._sound && (vse._sound3 == sound) && (vse._channelNum3 == channelNum)) {
+ vse2._sound = sound;
+ vse2._channelNum = channelNum;
+ vse._channelNum = vse2._channelNum2;
+ vse._fieldD = vse2._field13;
+ vse._sound2 = NULL;
+ break;
+ }
+ }
+ }
+
+ uint idx2 = 0;
+ for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
+ VoiceStructEntryType1 &vse = vs->_entries[idx]._type1;
+ Sound *sound = vse._sound2;
+ if (!sound)
+ continue;
+
+ while (vs->_entries[idx2]._type1._sound)
+ ++idx2;
+
+ VoiceStructEntryType1 &vse2 = vs->_entries[idx2]._type1;
+ vse2._sound = sound;
+ vse2._channelNum = vse._channelNum;
+ vse2._fieldD = vse._field13;
+ vse._field4 = -1;
+ vse2._field5 = 0;
+ vse2._field6 = 0;
+
+ SoundDriver *driver = vs->_entries[idx2]._driver;
+ assert(driver);
+
+ driver->updateVoice(vs->_entries[idx2]._voiceNum);
+ driver->proc38(vs->_entries[idx2]._voiceNum, 1, vse2._sound->_chModulation[vse2._channelNum]);
+ driver->proc38(vs->_entries[idx2]._voiceNum, 7,
+ vse2._sound->_chVolume[vse2._channelNum] * vse2._sound->_volume / 127);
+ driver->proc38(vs->_entries[idx2]._voiceNum, 10, vse2._sound->_chPan[vse2._channelNum]);
+ driver->proc40(vs->_entries[idx2]._voiceNum, vse2._sound->_chPitchBlend[vse2._channelNum]);
+ }
+
+ for (uint idx = 0; idx < vs->_entries.size(); ++idx) {
+ VoiceStructEntryType1 &vse = vs->_entries[idx]._type1;
+
+ if (!vse._sound && (vse._sound3)) {
+ vse._field4 = -1;
+ vse._field5 = 0;
+ vse._field6 = 0;
+
+ SoundDriver *driver = vs->_entries[idx]._driver;
+ assert(driver);
+ driver->updateVoice(voiceIndex);
}
}
}
@@ -1580,7 +1636,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
_chPitchBlend[channel] = pitchBlend;
if (voiceType != VOICETYPE_0) {
- _soProc40(vtStruct, channelNum);
+ _soProc40(vtStruct, channelNum, pitchBlend);
} else if (voiceNum != -1) {
assert(driver);
driver->setPitchBlend(channel, pitchBlend);
@@ -1712,13 +1768,13 @@ void Sound::_soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voice
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
- driver->proc38(vtStruct->_entries[entryIndex]._voiceNum);
+ driver->proc38(vtStruct->_entries[entryIndex]._voiceNum, cmd, value);
}
}
}
}
-void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum) {
+void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend) {
for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
VoiceStructEntryType1 &vte = vtStruct->_entries[entryIndex]._type1;
@@ -1726,7 +1782,7 @@ void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
- driver->proc40(vtStruct->_entries[entryIndex]._voiceNum);
+ driver->proc40(vtStruct->_entries[entryIndex]._voiceNum, pitchBlend);
}
}
}
diff --git a/engines/tsage/sound.h b/engines/tsage/sound.h
index 30e2233f77..2f634a9a21 100644
--- a/engines/tsage/sound.h
+++ b/engines/tsage/sound.h
@@ -92,8 +92,8 @@ public:
virtual void setVolume1(int channel, int v2, int v3, int volume) {}
virtual void setPitchBlend(int channel, int pitchBlend) {}
virtual void proc32(int voiceNum, int program, ...) {} // TODO: Determine params
- virtual void proc38(int voiceNum) {}
- virtual void proc40(int voiceNum) {}
+ virtual void proc38(int voiceNum, int cmd, int value) {}
+ virtual void proc40(int voiceNum, int pitchBlend) {}
virtual void proc42(int voiceNum, ...) {} // TODO: Determine params
virtual void updateVoice(int voiceNum) {}
};
@@ -334,7 +334,7 @@ public:
void _soProc32(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int v0);
void _soProc42(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int v0);
void _soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value);
- void _soProc40(VoiceTypeStruct *vtStruct, int channelNum);
+ void _soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend);
void _soDoTrackCommand(int channelNum, int command, int value);
bool _soDoUpdateTracks(int command, int value);
void _soSetTrackPos(int trackIndex, int trackPos, int cueValue);