TITANIC: Further work on sound manager, fix extra enum comma

This commit is contained in:
Paul Gilbert 2016-08-06 19:21:21 -04:00
parent 7b5b06f9d3
commit 467967542b
6 changed files with 35 additions and 11 deletions

View File

@ -26,7 +26,7 @@
namespace Titanic {
CProximity::CProximity() : _field4(0), _channelVolume(100), _fieldC(0),
_speechHandle(-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
_soundHandle((uint)-1), _field14(0), _frequencyMultiplier(0.0), _field1C(1.875),
_repeated(false), _field24(10), _field28(0), _azimuth(0.0),
_range(0.5), _elevation(0), _posX(0.0), _posY(0.0), _posZ(0.0),
_hasVelocity(false), _velocityX(0), _velocityY(0), _velocityZ(0),

View File

@ -36,7 +36,7 @@ public:
int _field4;
int _channelVolume;
int _fieldC;
int _speechHandle;
uint _soundHandle;
int _field14;
double _frequencyMultiplier;
double _field1C;

View File

@ -38,7 +38,7 @@ enum QMixFlag {
QMIX_ALL = 0x01, // apply to all channels
QMIX_NOREMIX = 0x02, // don't remix
QMIX_CONTROL_NOREMIX = 0x04, // don't remix
QMIX_USEONCE = 0x10, // settings are temporary
QMIX_USEONCE = 0x10 // settings are temporary
};
// qsWaveMixEnableChannel flags: if mode==0, use conventional, high-performance

View File

@ -117,8 +117,22 @@ int QSoundManager::proc5() const {
return 0;
}
int QSoundManager::playSound(CWaveFile &soundRes, CProximity &prox) {
warning("TODO");
int QSoundManager::playSound(CWaveFile &waveFile, CProximity &prox) {
int channel = -1;
uint flags = QMIX_CLEARQUEUE;
for (uint idx = 0; idx < _slots.size(); ++idx) {
if (_slots[idx]._handle == prox._soundHandle) {
channel = _slots[idx]._channel;
flags = QMIX_QUEUEWAVE;
break;
}
}
if (channel >= 0 || (channel = flushChannels(prox._field24)) != -1) {
return playWave(&waveFile, channel, flags, prox);
}
return 0;
}
@ -145,6 +159,11 @@ void QSoundManager::stopAllChannels() {
flushChannels(10);
}
int QSoundManager::flushChannels(int iChannel) {
// TODO
return -1;
}
void QSoundManager::setVolume(uint handle, uint volume, uint seconds) {
for (uint idx = 0; idx < _slots.size(); ++idx) {
Slot &slot = _slots[idx];
@ -298,7 +317,7 @@ void QSoundManager::soundFreed(Audio::SoundHandle &handle) {
qsWaveMixFreeWave(handle);
}
void QSoundManager::flushChannels(int channel) {
void QSoundManager::stopChannels(int channel) {
int endChannel;
switch (channel) {
case 0:

View File

@ -240,9 +240,9 @@ private:
int _channelsMode[16];
private:
/**
* Flushes designated channels
* Stops a designated range of channels
*/
void flushChannels(int channel);
void stopChannels(int channel);
/**
* Updates the volume for a channel
@ -270,6 +270,11 @@ private:
* Sets a channel volume
*/
void setChannelVolume(int iChannel, uint volume, uint mode);
/**
* Flushes channels
*/
int flushChannels(int iChannel);
public:
int _field18;
int _field1C;

View File

@ -535,18 +535,18 @@ void CTrueTalkManager::playSpeech(TTtalker *talker, TTroomScript *roomScript, CV
}
// Start the speech
p1._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1);
p1._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p1);
if (!milli)
continue;
if (idx == 0)
g_vm->_events->sleep(milli);
p3._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3);
p3._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p3);
if (idx == 0)
g_vm->_events->sleep(milli);
p2._speechHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2);
p2._soundHandle = _gameManager->_sound.playSpeech(_dialogueFile, id - _dialogueId, p2);
}
}