aboutsummaryrefslogtreecommitdiff
path: root/queen/sound.cpp
diff options
context:
space:
mode:
authorGregory Montoir2003-12-20 16:54:46 +0000
committerGregory Montoir2003-12-20 16:54:46 +0000
commit33ca6ecfa5d97db0e63092268eca4e94c0851fa3 (patch)
tree8204d6ccfbc599ef7e4f7a6a48f660372653669d /queen/sound.cpp
parent2c19e18fc85becb52fceab42c7bddf19a0913459 (diff)
downloadscummvm-rg350-33ca6ecfa5d97db0e63092268eca4e94c0851fa3.tar.gz
scummvm-rg350-33ca6ecfa5d97db0e63092268eca4e94c0851fa3.tar.bz2
scummvm-rg350-33ca6ecfa5d97db0e63092268eca4e94c0851fa3.zip
some code to play the 'room background sfx' (equivalent to sfxplay(NULLstr))
svn-id: r11786
Diffstat (limited to 'queen/sound.cpp')
-rw-r--r--queen/sound.cpp65
1 files changed, 28 insertions, 37 deletions
diff --git a/queen/sound.cpp b/queen/sound.cpp
index 9c398d2ba6..ef4e9b65d2 100644
--- a/queen/sound.cpp
+++ b/queen/sound.cpp
@@ -135,6 +135,27 @@ void Sound::waitSfxFinished() {
_vm->input()->delay(10);
}
+void Sound::playSfx(uint16 sfx) {
+ if (sfx != 0) {
+ char name[13];
+ strcpy(name, _sfxName[sfx - 1]);
+ strcat(name, ".SB");
+ sfxPlay(name);
+ }
+}
+
+void Sound::playSfx(const char *base) {
+ char name[13];
+ strcpy(name, base);
+ // alter filename to add zeros and append ".SB"
+ for (int i = 0; i < 8; i++) {
+ if (name[i] == ' ')
+ name[i] = '0';
+ }
+ strcat(name, ".SB");
+ sfxPlay(name);
+}
+
void Sound::playSong(int16 songNum) {
if (songNum == STOP_MUSIC) {
_vm->music()->stopSong();
@@ -145,7 +166,7 @@ void Sound::playSong(int16 songNum) {
if (_tune[newTune - 1].sfx[0]) {
if (sfxOn())
- sfxPlay(_sfxName[_tune[newTune - 1].sfx[0] - 1]);
+ playSfx(_tune[newTune - 1].sfx[0]);
return;
}
@@ -174,57 +195,27 @@ void Sound::playSong(int16 songNum) {
int SBSound::playSound(byte *sound, uint32 size) {
- byte flags = 0 | SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
+ byte flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
return _mixer->playRaw(&_sfxHandle, sound, size, 11025, flags);
}
-void SBSound::sfxPlay(const char *base) {
- char name[13];
- strcpy(name, base);
- //alter filename to add zeros and append ".SB"
- for (int i = 0; i < 8; i++) {
- if (name[i] == ' ')
- name[i] = '0';
- }
- strcat(name, ".SB");
-
- waitSfxFinished();
-
+void SBSound::sfxPlay(const char *name) {
+ waitSfxFinished();
if (_vm->resource()->exists(name))
playSound(_vm->resource()->loadFileMalloc(name, SB_HEADER_SIZE), _vm->resource()->fileSize(name) - SB_HEADER_SIZE);
}
#ifdef USE_MAD
-void MP3Sound::sfxPlay(const char *base) {
- char name[13];
- strcpy(name, base);
- //alter filename to add zeros and append ".SB"
- for (int i = 0; i < 8; i++) {
- if (name[i] == ' ')
- name[i] = '0';
- }
- strcat(name, ".SB");
-
+void MP3Sound::sfxPlay(const char *name) {
waitSfxFinished();
-
if (_vm->resource()->exists(name))
_mixer->playMP3(&_sfxHandle, _vm->resource()->giveCompressedSound(name), _vm->resource()->fileSize(name));
}
#endif
#ifdef USE_VORBIS
-void OGGSound::sfxPlay(const char *base) {
- char name[13];
- strcpy(name, base);
- //alter filename to add zeros and append ".SB"
- for (int i = 0; i < 8; i++) {
- if (name[i] == ' ')
- name[i] = '0';
- }
- strcat(name, ".SB");
-
- waitSfxFinished();
-
+void OGGSound::sfxPlay(const char *name) {
+ waitSfxFinished();
if (_vm->resource()->exists(name)) {
OggVorbis_File *oggFile = new OggVorbis_File;
file_info *f = new file_info;