VOYEUR: Fixes for observing audio events

This commit is contained in:
Paul Gilbert 2014-01-29 22:40:00 -05:00
parent f2af864c6b
commit 55f2b4ea52
4 changed files with 11 additions and 5 deletions

View File

@ -396,7 +396,7 @@ void ThreadResource::parsePlayCommands() {
_vm->flipPageAndWaitForFade(); _vm->flipPageAndWaitForFade();
_vm->_voy._field478 &= ~1; _vm->_voy._field478 &= ~1;
_vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset * 11025); _vm->_soundManager.setVOCOffset(_vm->_voy._vocSecondsOffset);
Common::String filename = _vm->_soundManager.getVOCFileName( Common::String filename = _vm->_soundManager.getVOCFileName(
_vm->_videoId + 159); _vm->_videoId + 159);
_vm->_soundManager.startVOCPlay(filename); _vm->_soundManager.startVOCPlay(filename);

View File

@ -30,6 +30,7 @@ namespace Voyeur {
SoundManager::SoundManager(Audio::Mixer *mixer) { SoundManager::SoundManager(Audio::Mixer *mixer) {
_mixer = mixer; _mixer = mixer;
_vocOffset = 0;
} }
void SoundManager::playVOCMap(byte *voc, int vocSize) { void SoundManager::playVOCMap(byte *voc, int vocSize) {
@ -40,7 +41,7 @@ void SoundManager::playVOCMap(byte *voc, int vocSize) {
} }
bool SoundManager::vocMapStatus() { bool SoundManager::vocMapStatus() {
// TODO error("TODO: vocMapStatus");
return false; return false;
} }
@ -54,10 +55,11 @@ void SoundManager::abortVOCMap() {
void SoundManager::stopVOCPlay() { void SoundManager::stopVOCPlay() {
_mixer->stopHandle(_soundHandle); _mixer->stopHandle(_soundHandle);
_vocOffset = 0;
} }
void SoundManager::setVOCOffset(int offset) { void SoundManager::setVOCOffset(int offset) {
error("TODO: setVOCOffset"); _vocOffset = offset;
} }
Common::String SoundManager::getVOCFileName(int idx) { Common::String SoundManager::getVOCFileName(int idx) {
@ -69,10 +71,11 @@ void SoundManager::startVOCPlay(const Common::String &filename) {
if (!f.open(filename)) if (!f.open(filename))
error("Could not find voc file - %s", filename.c_str()); error("Could not find voc file - %s", filename.c_str());
Audio::AudioStream *audioStream = Audio::makeVOCStream(f.readStream(f.size()), Audio::SeekableAudioStream *audioStream = Audio::makeVOCStream(f.readStream(f.size()),
Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
_mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream); _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream);
audioStream->seek(Audio::Timestamp(_vocOffset * 1000, 11025));
} }
void SoundManager::startVOCPlay(int soundId) { void SoundManager::startVOCPlay(int soundId) {

View File

@ -36,6 +36,7 @@ private:
VoyeurEngine *_vm; VoyeurEngine *_vm;
Audio::Mixer *_mixer; Audio::Mixer *_mixer;
Audio::SoundHandle _soundHandle; Audio::SoundHandle _soundHandle;
int _vocOffset;
public: public:
SoundManager(Audio::Mixer *mixer); SoundManager(Audio::Mixer *mixer);
void setVm(VoyeurEngine *vm) { _vm = vm; } void setVm(VoyeurEngine *vm) { _vm = vm; }

View File

@ -670,6 +670,8 @@ void VoyeurEngine::reviewTape() {
case EVTYPE_AUDIO: { case EVTYPE_AUDIO: {
_videoId = e._videoId; _videoId = e._videoId;
_voy._vocSecondsOffset = e._computerOn; _voy._vocSecondsOffset = e._computerOn;
_bVoy->getBoltGroup(0x7F00);
_graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 + _graphicsManager._backgroundPage = _bVoy->boltEntry(0x7F00 +
BLIND_TABLE[_videoId])._picResource; BLIND_TABLE[_videoId])._picResource;
_graphicsManager._backColors = _bVoy->boltEntry(0x7F01 + _graphicsManager._backColors = _bVoy->boltEntry(0x7F01 +
@ -684,7 +686,7 @@ void VoyeurEngine::reviewTape() {
_voy._field478 &= ~1; _voy._field478 &= ~1;
// Play suond for the given duration // Play suond for the given duration
_soundManager.setVOCOffset(_voy._vocSecondsOffset * 11025); _soundManager.setVOCOffset(_voy._vocSecondsOffset);
_soundManager.startVOCPlay(_videoId + 159); _soundManager.startVOCPlay(_videoId + 159);
uint32 offFrame = e._computerOff; uint32 offFrame = e._computerOff;