aboutsummaryrefslogtreecommitdiff
path: root/saga/sound.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2004-04-29 01:24:18 +0000
committerEugene Sandulenko2004-04-29 01:24:18 +0000
commitd7835da8c7d3bc223c8b1ec84e9b0b7439dbb6fc (patch)
tree95aebf0be9cbe8765c51cb9e947dd3034d6a7e8f /saga/sound.cpp
parent4c889000f2dd40f32286bb5637fdbcd869b5cee6 (diff)
downloadscummvm-rg350-d7835da8c7d3bc223c8b1ec84e9b0b7439dbb6fc.tar.gz
scummvm-rg350-d7835da8c7d3bc223c8b1ec84e9b0b7439dbb6fc.tar.bz2
scummvm-rg350-d7835da8c7d3bc223c8b1ec84e9b0b7439dbb6fc.zip
Voices are played
svn-id: r13668
Diffstat (limited to 'saga/sound.cpp')
-rw-r--r--saga/sound.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/saga/sound.cpp b/saga/sound.cpp
index 7bb2b88b26..1b3b95d91d 100644
--- a/saga/sound.cpp
+++ b/saga/sound.cpp
@@ -31,13 +31,16 @@
#include "sound.h"
#include "game_mod.h"
+#include "sound/mixer.h"
+
namespace Saga {
/*
* Begin module component
\*--------------------------------------------------------------------------*/
-Sound::Sound(int enabled) {
+Sound::Sound(SagaEngine *vm, SoundMixer *mixer, int enabled) :
+ _vm(vm), _mixer(mixer) {
int result;
/* Load sound module resource file contexts */
@@ -52,7 +55,7 @@ Sound::Sound(int enabled) {
}
/* Grab sound resource information for the current game */
- //GAME_GetSoundInfo(&SoundModule.snd_info);
+ GAME_GetSoundInfo(&_snd_info);
_soundInitialized = 1;
return;
@@ -112,12 +115,21 @@ int Sound::stop(int channel) {
}
int Sound::playVoice(R_SOUNDBUFFER *buf) {
- (void)buf;
+ byte flags;
+ int game_id = GAME_GetGame();
if (!_soundInitialized) {
return R_FAILURE;
}
+ if((game_id == R_GAME_ITE_DISK) || (game_id == R_GAME_ITE_DEMO)) {
+ flags = SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE;
+ } else {
+ flags = SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS |
+ SoundMixer::FLAG_LITTLE_ENDIAN;
+ }
+ _mixer->playRaw(&_voiceHandle, buf->res_data, buf->res_len, buf->s_freq, flags);
+
return R_SUCCESS;
}
@@ -126,6 +138,8 @@ int Sound::pauseVoice(void) {
return R_FAILURE;
}
+ _mixer->pauseHandle(_voiceHandle, true);
+
return R_SUCCESS;
}
@@ -134,6 +148,8 @@ int Sound::resumeVoice(void) {
return R_FAILURE;
}
+ _mixer->pauseHandle(_voiceHandle, false);
+
return R_SUCCESS;
}
@@ -142,6 +158,8 @@ int Sound::stopVoice(void) {
return R_FAILURE;
}
+ _mixer->stopHandle(_voiceHandle);
+
return R_SUCCESS;
}