diff options
author | Gregory Montoir | 2003-12-11 22:16:35 +0000 |
---|---|---|
committer | Gregory Montoir | 2003-12-11 22:16:35 +0000 |
commit | c2be8ed45dccc04528869bece0ef3f9ff6c9d743 (patch) | |
tree | 4591859bb6f6cb2e75b3a7dac4565047c81305af /queen/sound.cpp | |
parent | 38c4321f5965c5872e2d4e73d0a9e6ec05a35a2e (diff) | |
download | scummvm-rg350-c2be8ed45dccc04528869bece0ef3f9ff6c9d743.tar.gz scummvm-rg350-c2be8ed45dccc04528869bece0ef3f9ff6c9d743.tar.bz2 scummvm-rg350-c2be8ed45dccc04528869bece0ef3f9ff6c9d743.zip |
constructors cleanup
svn-id: r11589
Diffstat (limited to 'queen/sound.cpp')
-rw-r--r-- | queen/sound.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/queen/sound.cpp b/queen/sound.cpp index 4926493ca4..fbc710a711 100644 --- a/queen/sound.cpp +++ b/queen/sound.cpp @@ -21,7 +21,9 @@ #include "stdafx.h" #include "queen/sound.h" + #include "queen/input.h" +#include "queen/queen.h" #include "queen/resource.h" #define SB_HEADER_SIZE 110 @@ -92,44 +94,44 @@ static ov_callbacks g_File_wrap = { }; #endif -Sound::Sound(SoundMixer *mixer, Input *input, Resource *resource) : - _mixer(mixer), _input(input), _resource(resource), _sfxToggle(true), _speechToggle(true), _musicToggle(true), _lastOverride(0), _currentSong(0), _sfxHandle(0) { +Sound::Sound(SoundMixer *mixer, QueenEngine *vm) : + _mixer(mixer), _vm(vm), _sfxToggle(true), _speechToggle(true), _musicToggle(true), _lastOverride(0), _currentSong(0), _sfxHandle(0) { } Sound::~Sound() { } -Sound *Sound::giveSound(SoundMixer *mixer, Input *input, Resource *resource, uint8 compression) { +Sound *Sound::giveSound(SoundMixer *mixer, QueenEngine *vm, uint8 compression) { switch(compression) { case COMPRESSION_NONE: - return new SBSound(mixer, input, resource); + return new SBSound(mixer, vm); break; case COMPRESSION_MP3: #ifndef USE_MAD warning("Using MP3 compressed datafile, but MP3 support not compiled in"); - return new SilentSound(mixer, input, resource); + return new SilentSound(mixer, vm); #else - return new MP3Sound(mixer, input, resource); + return new MP3Sound(mixer, vm); #endif break; case COMPRESSION_OGG: #ifndef USE_VORBIS warning("Using OGG compressed datafile, but OGG support not compiled in"); - return new SilentSound(mixer, input, resource); + return new SilentSound(mixer, vm); #else - return new OGGSound(mixer, input, resource); + return new OGGSound(mixer, vm); #endif break; default: warning("Unknown compression type"); - return new SilentSound(mixer, input, resource); + return new SilentSound(mixer, vm); } } void Sound::waitSfxFinished() { while(_sfxHandle != 0) - _input->delay(10); + _vm->input()->delay(10); } void Sound::playSong(int16 songNum) { @@ -157,8 +159,8 @@ void SBSound::sfxPlay(const char *base) { waitSfxFinished(); - if (_resource->exists(name)) - playSound(_resource->loadFileMalloc(name, SB_HEADER_SIZE), _resource->fileSize(name) - SB_HEADER_SIZE); + if (_vm->resource()->exists(name)) + playSound(_vm->resource()->loadFileMalloc(name, SB_HEADER_SIZE), _vm->resource()->fileSize(name) - SB_HEADER_SIZE); } #ifdef USE_MAD @@ -174,8 +176,8 @@ void MP3Sound::sfxPlay(const char *base) { waitSfxFinished(); - if (_resource->exists(name)) - _mixer->playMP3(&_sfxHandle, _resource->giveCompressedSound(name), _resource->fileSize(name)); + if (_vm->resource()->exists(name)) + _mixer->playMP3(&_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name)); } #endif @@ -192,13 +194,13 @@ void OGGSound::sfxPlay(const char *base) { waitSfxFinished(); - if (_resource->exists(name)) { + if (_vm->resource()->exists(name)) { OggVorbis_File *oggFile = new OggVorbis_File; file_info *f = new file_info; - f->file = _resource->giveCompressedSound(name); - f->start = _resource->fileOffset(name); - f->len = _resource->fileSize(name); + f->file = _vm->resource()->giveCompressedSound(name); + f->start = _vm->resource()->fileOffset(name); + f->len = _vm->resource()->fileSize(name); f->curr_pos = 0; if (ov_open_callbacks((void *)f, oggFile, NULL, 0, g_File_wrap) < 0) { |