In-game sound effects and voices should be working correctly now.

Implemented the following opcodes:
- o1_PLAYSND
- o1_ISSND
- o1_STOPSND
- o1_PLAYVOICE
- o1_SOUNDRATE
- o1_SETVOLUME

svn-id: r31666
This commit is contained in:
Filippos Karapetis 2008-04-23 17:21:49 +00:00
parent 79d6c9f042
commit b69ffa922a
5 changed files with 39 additions and 13 deletions

View file

@ -24,6 +24,7 @@
*/
#include "common/endian.h"
#include "sound/mixer.h"
#include "made/resource.h"
#include "made/graphics.h"
@ -161,12 +162,15 @@ void SoundResource::load(byte *source, int size) {
_soundSize = chunkCount * chunkSize;
_soundData = new byte[_soundSize];
decompressSound(source + 14, _soundData, chunkSize, chunkCount);
decompressSound(source + 14, _soundData, chunkSize, chunkCount);
}
Audio::AudioStream *SoundResource::getAudioStream() {
return Audio::makeLinearInputStream(_soundData, _soundSize, 22050, 0, 0, 0);
Audio::AudioStream *SoundResource::getAudioStream(int soundRate, bool loop) {
byte flags = Audio::Mixer::FLAG_UNSIGNED;
if (loop)
flags |= Audio::Mixer::FLAG_LOOP;
return Audio::makeLinearInputStream(_soundData, _soundSize, soundRate, flags, 0, 0);
}
/* MenuResource */