TSAGE: Apply naming conventions to some sound variables and functions

This commit is contained in:
Strangerke 2012-09-03 07:58:35 +02:00
parent e9730ca597
commit 978f74817a
2 changed files with 183 additions and 183 deletions

View File

@ -66,7 +66,7 @@ SoundManager::~SoundManager() {
++i;
delete driver;
}
_sfTerminate();
sfTerminate();
// g_system->getTimerManager()->removeTimerProc(_sfUpdateCallback);
}
@ -132,7 +132,7 @@ void SoundManager::syncSounds() {
}
void SoundManager::update() {
_sfSoundServer();
sfSoundServer();
}
Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
@ -144,22 +144,22 @@ Common::List<SoundDriverEntry> &SoundManager::buildDriverList(bool detectFlag) {
// Adlib driver
SoundDriverEntry sd;
sd.driverNum = ADLIB_DRIVER_NUM;
sd.status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
sd.field2 = 0;
sd.field6 = 15000;
sd.shortDescription = "Adlib or SoundBlaster";
sd.longDescription = "3812fm";
sd._driverNum = ADLIB_DRIVER_NUM;
sd._status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
sd._field2 = 0;
sd._field6 = 15000;
sd._shortDescription = "Adlib or SoundBlaster";
sd._longDescription = "3812fm";
_availableDrivers.push_back(sd);
// SoundBlaster entry
SoundDriverEntry sdFx;
sdFx.driverNum = SBLASTER_DRIVER_NUM;
sdFx.status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
sdFx.field2 = 0;
sdFx.field6 = 15000;
sdFx.shortDescription = "SndBlast";
sdFx.longDescription = "SoundBlaster";
sdFx._driverNum = SBLASTER_DRIVER_NUM;
sdFx._status = detectFlag ? SNDSTATUS_DETECTED : SNDSTATUS_SKIPPED;
sdFx._field2 = 0;
sdFx._field6 = 15000;
sdFx._shortDescription = "SndBlast";
sdFx._longDescription = "SoundBlaster";
_availableDrivers.push_back(sdFx);
_driversDetected = true;
@ -204,7 +204,7 @@ void SoundManager::installDriver(int driverNum) {
(*i)->mute(true);
// Install the driver
if (!_sfInstallDriver(driver))
if (!sfInstallDriver(driver))
error("Sound driver initialization failed");
switch (driverNum) {
@ -214,11 +214,11 @@ void SoundManager::installDriver(int driverNum) {
byte *bankData = g_resourceManager->getResource(RES_BANK, driverNum, 0, true);
if (bankData) {
// Install the patch bank data
_sfInstallPatchBank(driver, bankData);
sfInstallPatchBank(driver, bankData);
DEALLOCATE(bankData);
} else {
// Could not locate patch bank data, so unload the driver
_sfUnInstallDriver(driver);
sfUnInstallDriver(driver);
// Unmute currently active sounds
for (Common::List<Sound *>::iterator i = _playList.begin(); i != _playList.end(); ++i)
@ -260,7 +260,7 @@ void SoundManager::unInstallDriver(int driverNum) {
(*j)->mute(true);
// Uninstall the driver
_sfUnInstallDriver(*i);
sfUnInstallDriver(*i);
// Re-orient all the loaded sounds
for (j = _soundList.begin(); j != _soundList.end(); ++j)
@ -303,7 +303,7 @@ void SoundManager::unloadSound(int soundNum) {
}
int SoundManager::determineGroup(const byte *soundData) {
return _sfDetermineGroup(soundData);
return sfDetermineGroup(soundData);
}
void SoundManager::checkResVersion(const byte *soundData) {
@ -325,7 +325,7 @@ int SoundManager::extractLoop(const byte *soundData) {
}
void SoundManager::extractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum) {
_sfExtractTrackInfo(trackInfo, soundData, groupNum);
sfExtractTrackInfo(trackInfo, soundData, groupNum);
}
void SoundManager::addToSoundList(Sound *sound) {
@ -338,46 +338,46 @@ void SoundManager::removeFromSoundList(Sound *sound) {
}
void SoundManager::addToPlayList(Sound *sound) {
_sfAddToPlayList(sound);
sfAddToPlayList(sound);
}
void SoundManager::removeFromPlayList(Sound *sound) {
if (_soundManager)
_sfRemoveFromPlayList(sound);
sfRemoveFromPlayList(sound);
}
bool SoundManager::isOnPlayList(Sound *sound) {
return _sfIsOnPlayList(sound);
return sfIsOnPlayList(sound);
}
void SoundManager::updateSoundVol(Sound *sound) {
_sfUpdateVolume(sound);
sfUpdateVolume(sound);
}
void SoundManager::updateSoundPri(Sound *sound) {
_sfUpdatePriority(sound);
sfUpdatePriority(sound);
}
void SoundManager::updateSoundLoop(Sound *sound) {
_sfUpdateLoop(sound);
sfUpdateLoop(sound);
}
void SoundManager::rethinkVoiceTypes() {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
_sfRethinkVoiceTypes();
sfRethinkVoiceTypes();
}
void SoundManager::_sfSoundServer() {
void SoundManager::sfSoundServer() {
if (sfManager()._needToRethink) {
_sfRethinkVoiceTypes();
sfRethinkVoiceTypes();
sfManager()._needToRethink = false;
} else {
_sfDereferenceAll();
sfDereferenceAll();
}
// If the master volume has changed, update it
if (sfManager()._newVolume != sfManager()._masterVol)
_sfSetMasterVol(sfManager()._newVolume);
sfSetMasterVol(sfManager()._newVolume);
// If a time index has been set for any sound, fast forward to it
SynchronizedList<Sound *>::iterator i;
@ -385,14 +385,14 @@ void SoundManager::_sfSoundServer() {
Sound *s = *i;
if (s->_newTimeIndex != 0) {
s->mute(true);
s->_soSetTimeIndex(s->_newTimeIndex);
s->soSetTimeIndex(s->_newTimeIndex);
s->mute(false);
s->_newTimeIndex = 0;
}
}
// Handle any fading if necessary
_sfProcessFading();
sfProcessFading();
// Poll all sound drivers in case they need it
for (Common::List<SoundDriver *>::iterator j = sfManager()._installedDrivers.begin();
@ -401,7 +401,7 @@ void SoundManager::_sfSoundServer() {
}
}
void SoundManager::_sfProcessFading() {
void SoundManager::sfProcessFading() {
// Loop through processing active sounds
bool removeFlag = false;
Common::List<Sound *>::iterator i = sfManager()._playList.begin();
@ -410,9 +410,9 @@ void SoundManager::_sfProcessFading() {
++i;
if (!s->_pausedCount)
removeFlag = s->_soServiceTracks();
removeFlag = s->soServiceTracks();
if (removeFlag) {
_sfDoRemoveFromPlayList(s);
sfDoRemoveFromPlayList(s);
s->_stoppedAsynchronously = true;
sfManager()._needToRethink = true;
}
@ -429,13 +429,13 @@ void SoundManager::_sfProcessFading() {
s->_volume + s->_fadeSteps : s->_fadeDest;
}
_sfDoUpdateVolume(s);
sfDoUpdateVolume(s);
if (s->_volume != s->_fadeDest)
s->_fadeCounter = s->_fadeTicks;
else {
s->_fadeDest = -1;
if (s->_stopAfterFadeFlag) {
_sfDoRemoveFromPlayList(s);
sfDoRemoveFromPlayList(s);
s->_stoppedAsynchronously = true;
sfManager()._needToRethink = true;
}
@ -475,7 +475,7 @@ bool SoundManager::isFading() {
return false;
}
void SoundManager::_sfUpdateVoiceStructs() {
void SoundManager::sfUpdateVoiceStructs() {
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
VoiceTypeStruct *vs = sfManager()._voiceTypeStructPtrs[voiceIndex];
if (!vs)
@ -504,7 +504,7 @@ void SoundManager::_sfUpdateVoiceStructs() {
}
}
void SoundManager::_sfUpdateVoiceStructs2() {
void SoundManager::sfUpdateVoiceStructs2() {
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
VoiceTypeStruct *vtStruct = sfManager()._voiceTypeStructPtrs[voiceIndex];
if (!vtStruct)
@ -528,7 +528,7 @@ void SoundManager::_sfUpdateVoiceStructs2() {
}
}
void SoundManager::_sfUpdateCallback(void *ref) {
void SoundManager::sfUpdateCallback(void *ref) {
((SoundManager *)ref)->update();
}
@ -587,7 +587,7 @@ SoundManager &SoundManager::sfManager() {
return *_soundManager;
}
int SoundManager::_sfDetermineGroup(const byte *soundData) {
int SoundManager::sfDetermineGroup(const byte *soundData) {
const byte *p = soundData + READ_LE_UINT16(soundData + 8);
uint32 v;
while ((v = READ_LE_UINT32(p)) != 0) {
@ -600,22 +600,22 @@ int SoundManager::_sfDetermineGroup(const byte *soundData) {
return 0;
}
void SoundManager::_sfAddToPlayList(Sound *sound) {
void SoundManager::sfAddToPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
_sfDoAddToPlayList(sound);
sfDoAddToPlayList(sound);
sound->_stoppedAsynchronously = false;
_sfRethinkVoiceTypes();
sfRethinkVoiceTypes();
}
void SoundManager::_sfRemoveFromPlayList(Sound *sound) {
void SoundManager::sfRemoveFromPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
if (_sfDoRemoveFromPlayList(sound))
_sfRethinkVoiceTypes();
if (sfDoRemoveFromPlayList(sound))
sfRethinkVoiceTypes();
}
bool SoundManager::_sfIsOnPlayList(Sound *sound) {
bool SoundManager::sfIsOnPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
bool result = contains(_soundManager->_playList, sound);
@ -623,7 +623,7 @@ bool SoundManager::_sfIsOnPlayList(Sound *sound) {
return result;
}
void SoundManager::_sfRethinkSoundDrivers() {
void SoundManager::sfRethinkSoundDrivers() {
// Free any existing entries
int idx;
@ -643,7 +643,7 @@ void SoundManager::_sfRethinkSoundDrivers() {
i != sfManager()._installedDrivers.end(); ++i) {
// Process the group data for each sound driver
SoundDriver *driver = *i;
const byte *groupData = driver->_groupOffset->pData;
const byte *groupData = driver->_groupOffset->_pData;
while (*groupData != 0xff) {
byte byteVal = *groupData++;
@ -690,7 +690,7 @@ void SoundManager::_sfRethinkSoundDrivers() {
i != sfManager()._installedDrivers.end(); ++i) {
// Process the group data for each sound driver
SoundDriver *driver = *i;
const byte *groupData = driver->_groupOffset->pData;
const byte *groupData = driver->_groupOffset->_pData;
while (*groupData != 0xff) {
byte byteVal = *groupData++;
@ -746,8 +746,8 @@ void SoundManager::_sfRethinkSoundDrivers() {
}
}
void SoundManager::_sfRethinkVoiceTypes() {
_sfDereferenceAll();
void SoundManager::sfRethinkVoiceTypes() {
sfDereferenceAll();
// Pre-processing
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
@ -797,7 +797,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if ((sound->_mutedCount != 0) || (sound->_pausedCount != 0))
continue;
_sfUpdateVoiceStructs();
sfUpdateVoiceStructs();
Common::fill(sound->_chWork, sound->_chWork + SOUND_ARR_SIZE, false);
for (;;) {
@ -831,7 +831,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if (foundPriority)
continue;
_sfUpdateVoiceStructs2();
sfUpdateVoiceStructs2();
break;
}
@ -860,7 +860,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
maxPriority = MAX(maxPriority, vtStruct->_entries[idx]._type1._priority2);
if (!maxPriority) {
_sfUpdateVoiceStructs2();
sfUpdateVoiceStructs2();
break;
}
@ -944,7 +944,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
continue;
}
_sfUpdateVoiceStructs2();
sfUpdateVoiceStructs2();
break;
} else {
// Channel mode 1 handling (loc_23FAC)
@ -973,7 +973,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if (foundPriority)
continue;
if (entryIndex == -1) {
_sfUpdateVoiceStructs2();
sfUpdateVoiceStructs2();
break;
}
}
@ -1008,7 +1008,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
continue;
}
_sfUpdateVoiceStructs2();
sfUpdateVoiceStructs2();
break;
}
@ -1051,7 +1051,7 @@ void SoundManager::_sfRethinkVoiceTypes() {
if (!foundPriority)
continue;
if (priorityIndex == -1) {
_sfUpdateVoiceStructs2();
sfUpdateVoiceStructs2();
break;
}
@ -1271,38 +1271,38 @@ void SoundManager::_sfRethinkVoiceTypes() {
}
}
void SoundManager::_sfUpdateVolume(Sound *sound) {
_sfDereferenceAll();
_sfDoUpdateVolume(sound);
void SoundManager::sfUpdateVolume(Sound *sound) {
sfDereferenceAll();
sfDoUpdateVolume(sound);
}
void SoundManager::_sfDereferenceAll() {
void SoundManager::sfDereferenceAll() {
// Orignal used handles for both the driver list and voiceTypeStructPtrs list. This method then refreshed
// pointer lists based on the handles. Since in ScummVM we're just using pointers directly, this
// method doesn't need any implementation
}
void SoundManager::_sfUpdatePriority(Sound *sound) {
void SoundManager::sfUpdatePriority(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
int tempPriority = (sound->_fixedPriority == 255) ? sound->_sndResPriority : sound->_priority;
if (sound->_priority != tempPriority) {
sound->_priority = tempPriority;
if (_sfDoRemoveFromPlayList(sound)) {
_sfDoAddToPlayList(sound);
_sfRethinkVoiceTypes();
if (sfDoRemoveFromPlayList(sound)) {
sfDoAddToPlayList(sound);
sfRethinkVoiceTypes();
}
}
}
void SoundManager::_sfUpdateLoop(Sound *sound) {
void SoundManager::sfUpdateLoop(Sound *sound) {
if (sound->_fixedLoop)
sound->_loop = sound->_sndResLoop;
else
sound->_loop = sound->_fixedLoop;
}
void SoundManager::_sfSetMasterVol(int volume) {
void SoundManager::sfSetMasterVol(int volume) {
if (volume > 127)
volume = 127;
@ -1316,7 +1316,7 @@ void SoundManager::_sfSetMasterVol(int volume) {
}
}
void SoundManager::_sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum) {
void SoundManager::sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum) {
trackInfo->_numTracks = 0;
const byte *p = soundData + READ_LE_UINT16(soundData + 8);
@ -1345,11 +1345,11 @@ void SoundManager::_sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *s
}
}
void SoundManager::_sfTerminate() {
void SoundManager::sfTerminate() {
}
void SoundManager::_sfExtractGroupMask() {
void SoundManager::sfExtractGroupMask() {
uint32 mask = 0;
for (Common::List<SoundDriver *>::iterator i = sfManager()._installedDrivers.begin();
@ -1359,37 +1359,37 @@ void SoundManager::_sfExtractGroupMask() {
_soundManager->_groupsAvail = mask;
}
bool SoundManager::_sfInstallDriver(SoundDriver *driver) {
bool SoundManager::sfInstallDriver(SoundDriver *driver) {
if (!driver->open())
return false;
sfManager()._installedDrivers.push_back(driver);
driver->_groupOffset = driver->getGroupData();
driver->_groupMask = driver->_groupOffset->groupMask;
driver->_groupMask = driver->_groupOffset->_groupMask;
_sfExtractGroupMask();
_sfRethinkSoundDrivers();
sfExtractGroupMask();
sfRethinkSoundDrivers();
driver->setMasterVolume(sfManager()._masterVol);
return true;
}
void SoundManager::_sfUnInstallDriver(SoundDriver *driver) {
void SoundManager::sfUnInstallDriver(SoundDriver *driver) {
sfManager()._installedDrivers.remove(driver);
delete driver;
_sfExtractGroupMask();
_sfRethinkSoundDrivers();
sfExtractGroupMask();
sfRethinkSoundDrivers();
}
void SoundManager::_sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
void SoundManager::sfInstallPatchBank(SoundDriver *driver, const byte *bankData) {
driver->installPatch(bankData, g_vm->_memoryManager.getSize(bankData));
}
/**
* Adds the specified sound in the playing sound list, inserting in order of priority
*/
void SoundManager::_sfDoAddToPlayList(Sound *sound) {
void SoundManager::sfDoAddToPlayList(Sound *sound) {
Common::StackLock slock2(sfManager()._serverSuspendedMutex);
Common::List<Sound *>::iterator i = sfManager()._playList.begin();
@ -1402,7 +1402,7 @@ void SoundManager::_sfDoAddToPlayList(Sound *sound) {
/**
* Removes the specified sound from the play list
*/
bool SoundManager::_sfDoRemoveFromPlayList(Sound *sound) {
bool SoundManager::sfDoRemoveFromPlayList(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
bool result = false;
@ -1417,7 +1417,7 @@ bool SoundManager::_sfDoRemoveFromPlayList(Sound *sound) {
return result;
}
void SoundManager::_sfDoUpdateVolume(Sound *sound) {
void SoundManager::sfDoUpdateVolume(Sound *sound) {
Common::StackLock slock(sfManager()._serverSuspendedMutex);
for (int voiceIndex = 0; voiceIndex < SOUND_ARR_SIZE; ++voiceIndex) {
@ -1583,7 +1583,7 @@ void Sound::_prime(int soundResID, bool dontQueue) {
_remoteReceiver = ALLOCATE(200);
}
_soPrimeSound(dontQueue);
soPrimeSound(dontQueue);
if (!dontQueue)
_soundManager->addToSoundList(this);
@ -1767,7 +1767,7 @@ void Sound::release() {
_hold = -1;
}
void Sound::_soPrimeSound(bool dontQueue) {
void Sound::soPrimeSound(bool dontQueue) {
if (!dontQueue) {
_priority = (_fixedPriority != -1) ? _fixedPriority : _sndResPriority;
_loop = !_fixedLoop ? _fixedLoop : _sndResLoop;
@ -1785,21 +1785,21 @@ void Sound::_soPrimeSound(bool dontQueue) {
_timer = 0;
_newTimeIndex = 0;
_loopTimer = 0;
_soPrimeChannelData();
soPrimeChannelData();
}
void Sound::_soSetTimeIndex(uint timeIndex) {
void Sound::soSetTimeIndex(uint timeIndex) {
Common::StackLock slock(g_globals->_soundManager._serverSuspendedMutex);
if (timeIndex != _timer) {
_soundManager->_soTimeIndexFlag = true;
_timer = 0;
_loopTimer = 0;
_soPrimeChannelData();
soPrimeChannelData();
while (timeIndex > 0) {
if (_soServiceTracks()) {
SoundManager::_sfDoRemoveFromPlayList(this);
if (soServiceTracks()) {
SoundManager::sfDoRemoveFromPlayList(this);
_stoppedAsynchronously = true;
_soundManager->_needToRethink = true;
break;
@ -1812,9 +1812,9 @@ void Sound::_soSetTimeIndex(uint timeIndex) {
}
}
bool Sound::_soServiceTracks() {
bool Sound::soServiceTracks() {
if (_isEmpty) {
_soRemoteReceive();
soRemoteReceive();
return false;
}
@ -1823,9 +1823,9 @@ bool Sound::_soServiceTracks() {
int mode = *_channelData[trackCtr];
if (mode == 0) {
_soServiceTrackType0(trackCtr, _channelData[trackCtr]);
soServiceTrackType0(trackCtr, _channelData[trackCtr]);
} else if (mode == 1) {
_soServiceTrackType1(trackCtr, _channelData[trackCtr]);
soServiceTrackType1(trackCtr, _channelData[trackCtr]);
} else {
error("Unknown sound mode encountered");
}
@ -1851,7 +1851,7 @@ bool Sound::_soServiceTracks() {
}
}
void Sound::_soPrimeChannelData() {
void Sound::soPrimeChannelData() {
if (_isEmpty) {
for (int idx = 0; idx < 16; ++idx) {
_chProgram[idx] = 0;
@ -1917,11 +1917,11 @@ void Sound::_soPrimeChannelData() {
}
}
void Sound::_soRemoteReceive() {
error("_soRemoteReceive not implemented");
void Sound::soRemoteReceive() {
error("soRemoteReceive not implemented");
}
void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
void Sound::soServiceTrackType0(int trackIndex, const byte *channelData) {
if (_trkRest[trackIndex]) {
--_trkRest[trackIndex];
return;
@ -1970,7 +1970,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
// Only do processing if fast forwarding to a given time index
if (channelNum != -1) {
if (voiceType == VOICETYPE_1) {
_soUpdateDamper(vtStruct, channelNum, chVoiceType, v);
soUpdateDamper(vtStruct, channelNum, chVoiceType, v);
} else if (voiceNum != -1) {
assert(driver);
driver->proc18(voiceNum, chVoiceType);
@ -1991,9 +1991,9 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
if (channelNum != -1) {
if (voiceType != VOICETYPE_0) {
if (chFlags & 0x10)
_soPlaySound2(vtStruct, channelData, channelNum, chVoiceType, v);
soPlaySound2(vtStruct, channelData, channelNum, chVoiceType, v);
else
_soPlaySound(vtStruct, channelData, channelNum, chVoiceType, v, b);
soPlaySound(vtStruct, channelData, channelNum, chVoiceType, v, b);
} else if (voiceNum != -1) {
assert(driver);
driver->proc20(voiceNum, chVoiceType);
@ -2030,17 +2030,17 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
int cmdVal = cmdList[v];
if (channelNum == -1) {
if (_soDoUpdateTracks(cmdVal, b))
if (soDoUpdateTracks(cmdVal, b))
return;
} else {
_soDoTrackCommand(_trkChannel[trackIndex], cmdVal, b);
soDoTrackCommand(_trkChannel[trackIndex], cmdVal, b);
if (!_soundManager->_soTimeIndexFlag) {
if (cmdVal == 7)
b = static_cast<byte>(_volume * (int)b / 127);
if (voiceType != VOICETYPE_0) {
_soProc38(vtStruct, channelNum, chVoiceType, cmdVal, b);
soProc38(vtStruct, channelNum, chVoiceType, cmdVal, b);
} else if (voiceNum != -1) {
assert(driver);
driver->proc24(voiceNum, chVoiceType, this, cmdVal, b);
@ -2067,17 +2067,17 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
int value = *pData++;
if (channelNum != -1) {
_soDoTrackCommand(_trkChannel[trackIndex], cmd, value);
soDoTrackCommand(_trkChannel[trackIndex], cmd, value);
if (!_soundManager->_soTimeIndexFlag) {
if (voiceType != VOICETYPE_0) {
_soProc38(vtStruct, channelNum, chVoiceType, cmd, value);
soProc38(vtStruct, channelNum, chVoiceType, cmd, value);
} else if (voiceNum != -1) {
assert(driver);
driver->proc24(voiceNum, chVoiceType, this, cmd, value);
}
}
} else if (_soDoUpdateTracks(cmd, value)) {
} else if (soDoUpdateTracks(cmd, value)) {
return;
}
} else if (!(v & 0x2)) {
@ -2091,7 +2091,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
_chPitchBlend[channel] = pitchBlend;
if (voiceType != VOICETYPE_0) {
_soProc40(vtStruct, channelNum, pitchBlend);
soProc40(vtStruct, channelNum, pitchBlend);
} else if (voiceNum != -1) {
assert(driver);
driver->setPitchBlend(channel, pitchBlend);
@ -2115,7 +2115,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
}
}
} else {
_soSetTrackPos(trackIndex, pData - channelData, program);
soSetTrackPos(trackIndex, pData - channelData, program);
}
} else {
@ -2139,7 +2139,7 @@ void Sound::_soServiceTrackType0(int trackIndex, const byte *channelData) {
}
}
void Sound::_soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0) {
void Sound::soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0) {
bool hasDamper = _chDamper[channelNum] != 0;
for (uint idx = 0; idx < voiceType->_entries.size(); ++idx) {
@ -2161,8 +2161,8 @@ void Sound::_soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceTyp
}
}
void Sound::_soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1) {
int entryIndex = _soFindSound(vtStruct, channelNum);
void Sound::soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1) {
int entryIndex = soFindSound(vtStruct, channelNum);
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
@ -2175,11 +2175,11 @@ void Sound::_soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int
}
}
void Sound::_soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0) {
void Sound::soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0) {
for (int trackCtr = 0; trackCtr < _trackInfo._numTracks; ++trackCtr) {
const byte *instrument = _channelData[trackCtr];
if ((*(instrument + 13) == v0) && (*instrument == 1)) {
int entryIndex = _soFindSound(vtStruct, channelNum);
int entryIndex = soFindSound(vtStruct, channelNum);
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
@ -2199,7 +2199,7 @@ void Sound::_soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, in
}
}
void Sound::_soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value) {
void Sound::soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value) {
if (cmd == 64) {
if (value == 0) {
for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
@ -2231,7 +2231,7 @@ void Sound::_soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voice
}
}
void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend) {
void Sound::soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend) {
for (uint entryIndex = 0; entryIndex < vtStruct->_entries.size(); ++entryIndex) {
VoiceStructEntryType1 &vte = vtStruct->_entries[entryIndex]._type1;
@ -2244,7 +2244,7 @@ void Sound::_soProc40(VoiceTypeStruct *vtStruct, int channelNum, int pitchBlend)
}
}
void Sound::_soDoTrackCommand(int channelNum, int command, int value) {
void Sound::soDoTrackCommand(int channelNum, int command, int value) {
switch (command) {
case 1:
_chModulation[channelNum] = value;
@ -2264,7 +2264,7 @@ void Sound::_soDoTrackCommand(int channelNum, int command, int value) {
}
}
bool Sound::_soDoUpdateTracks(int command, int value) {
bool Sound::soDoUpdateTracks(int command, int value) {
if ((command == 76) || (_hold != value))
return false;
@ -2278,7 +2278,7 @@ bool Sound::_soDoUpdateTracks(int command, int value) {
return true;
}
void Sound::_soSetTrackPos(int trackIndex, int trackPos, int cueValue) {
void Sound::soSetTrackPos(int trackIndex, int trackPos, int cueValue) {
_trkIndex[trackIndex] = trackPos;
if (cueValue == 127) {
if (!_soundManager->_soTimeIndexFlag)
@ -2294,7 +2294,7 @@ void Sound::_soSetTrackPos(int trackIndex, int trackPos, int cueValue) {
}
}
void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
void Sound::soServiceTrackType1(int trackIndex, const byte *channelData) {
if (_soundManager->_soTimeIndexFlag || !_trkState[trackIndex])
return;
@ -2310,7 +2310,7 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
else {
if (vtStruct->_voiceType != VOICETYPE_0) {
if (_trkState[trackIndex] == 1) {
int entryIndex = _soFindSound(vtStruct, *(channelData + 1));
int entryIndex = soFindSound(vtStruct, *(channelData + 1));
if (entryIndex != -1) {
SoundDriver *driver = vtStruct->_entries[entryIndex]._driver;
assert(driver);
@ -2352,7 +2352,7 @@ void Sound::_soServiceTrackType1(int trackIndex, const byte *channelData) {
}
}
int Sound::_soFindSound(VoiceTypeStruct *vtStruct, int channelNum) {
int Sound::soFindSound(VoiceTypeStruct *vtStruct, int channelNum) {
int entryIndex = -1, entry2Index = -1;
int v6 = 0, v8 = 0;
@ -2539,10 +2539,10 @@ AdlibSoundDriver::AdlibSoundDriver(): SoundDriver() {
_maxVersion = 0x10A;
_masterVolume = 0;
_groupData.groupMask = 9;
_groupData.v1 = 0x46;
_groupData.v2 = 0;
_groupData.pData = &adlib_group_data[0];
_groupData._groupMask = 9;
_groupData._v1 = 0x46;
_groupData._v2 = 0;
_groupData._pData = &adlib_group_data[0];
_mixer = g_vm->_mixer;
_sampleRate = _mixer->getOutputRate();
@ -2823,7 +2823,7 @@ int AdlibSoundDriver::readBuffer(int16 *buffer, const int numSamples) {
memset(buffer, 0, sizeof(int16) * numSamples);
while (samplesLeft) {
if (!_samplesTillCallback) {
SoundManager::_sfUpdateCallback(NULL);
SoundManager::sfUpdateCallback(NULL);
flush();
_samplesTillCallback = _samplesPerCallback;
@ -2852,11 +2852,11 @@ SoundBlasterDriver::SoundBlasterDriver(): SoundDriver() {
_maxVersion = 0x10A;
_masterVolume = 0;
_groupData.groupMask = 1;
_groupData.v1 = 0x3E;
_groupData.v2 = 0;
_groupData._groupMask = 1;
_groupData._v1 = 0x3E;
_groupData._v2 = 0;
static byte const group_data[] = { 3, 1, 1, 0, 0xff };
_groupData.pData = group_data;
_groupData._pData = group_data;
_mixer = g_vm->_mixer;
_sampleRate = _mixer->getOutputRate();

View File

@ -54,18 +54,18 @@ enum VoiceType {VOICETYPE_0 = 0, VOICETYPE_1 = 1};
class SoundDriverEntry {
public:
int driverNum;
SoundDriverStatus status;
int field2, field6;
Common::String shortDescription;
Common::String longDescription;
int _driverNum;
SoundDriverStatus _status;
int _field2, _field6;
Common::String _shortDescription;
Common::String _longDescription;
};
struct GroupData {
uint32 groupMask;
byte v1;
byte v2;
const byte *pData;
uint32 _groupMask;
byte _v1;
byte _v2;
const byte *_pData;
};
struct RegisterValue {
@ -229,31 +229,31 @@ public:
// _sf methods
static SoundManager &sfManager();
static void _sfTerminate();
static int _sfDetermineGroup(const byte *soundData);
static void _sfAddToPlayList(Sound *sound);
static void _sfRemoveFromPlayList(Sound *sound);
static bool _sfIsOnPlayList(Sound *sound);
static void _sfRethinkSoundDrivers();
static void _sfRethinkVoiceTypes();
static void _sfUpdateVolume(Sound *sound);
static void _sfDereferenceAll();
static void _sfUpdatePriority(Sound *sound);
static void _sfUpdateLoop(Sound *sound);
static void _sfSetMasterVol(int volume);
static void _sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum);
static void _sfExtractGroupMask();
static bool _sfInstallDriver(SoundDriver *driver);
static void _sfUnInstallDriver(SoundDriver *driver);
static void _sfInstallPatchBank(SoundDriver *driver, const byte *bankData);
static void _sfDoAddToPlayList(Sound *sound);
static bool _sfDoRemoveFromPlayList(Sound *sound);
static void _sfDoUpdateVolume(Sound *sound);
static void _sfSoundServer();
static void _sfProcessFading();
static void _sfUpdateVoiceStructs();
static void _sfUpdateVoiceStructs2();
static void _sfUpdateCallback(void *ref);
static void sfTerminate();
static int sfDetermineGroup(const byte *soundData);
static void sfAddToPlayList(Sound *sound);
static void sfRemoveFromPlayList(Sound *sound);
static bool sfIsOnPlayList(Sound *sound);
static void sfRethinkSoundDrivers();
static void sfRethinkVoiceTypes();
static void sfUpdateVolume(Sound *sound);
static void sfDereferenceAll();
static void sfUpdatePriority(Sound *sound);
static void sfUpdateLoop(Sound *sound);
static void sfSetMasterVol(int volume);
static void sfExtractTrackInfo(trackInfoStruct *trackInfo, const byte *soundData, int groupNum);
static void sfExtractGroupMask();
static bool sfInstallDriver(SoundDriver *driver);
static void sfUnInstallDriver(SoundDriver *driver);
static void sfInstallPatchBank(SoundDriver *driver, const byte *bankData);
static void sfDoAddToPlayList(Sound *sound);
static bool sfDoRemoveFromPlayList(Sound *sound);
static void sfDoUpdateVolume(Sound *sound);
static void sfSoundServer();
static void sfProcessFading();
static void sfUpdateVoiceStructs();
static void sfUpdateVoiceStructs2();
static void sfUpdateCallback(void *ref);
};
class Sound: public EventHandler {
@ -343,23 +343,23 @@ public:
void orientAfterDriverChange();
// _so methods
void _soPrimeSound(bool dontQueue);
void _soSetTimeIndex(uint timeIndex);
bool _soServiceTracks();
void _soPrimeChannelData();
void _soRemoteReceive();
void _soServiceTrackType0(int trackIndex, const byte *channelData);
void _soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0);
void _soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1);
void _soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0);
void _soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value);
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);
void soPrimeSound(bool dontQueue);
void soSetTimeIndex(uint timeIndex);
bool soServiceTracks();
void soPrimeChannelData();
void soRemoteReceive();
void soServiceTrackType0(int trackIndex, const byte *channelData);
void soUpdateDamper(VoiceTypeStruct *voiceType, int channelNum, VoiceType mode, int v0);
void soPlaySound(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0, int v1);
void soPlaySound2(VoiceTypeStruct *vtStruct, const byte *channelData, int channelNum, VoiceType voiceType, int v0);
void soProc38(VoiceTypeStruct *vtStruct, int channelNum, VoiceType voiceType, int cmd, int value);
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);
void _soServiceTrackType1(int trackIndex, const byte *channelData);
int _soFindSound(VoiceTypeStruct *vtStruct, int channelNum);
void soServiceTrackType1(int trackIndex, const byte *channelData);
int soFindSound(VoiceTypeStruct *vtStruct, int channelNum);
};
class ASound: public EventHandler {