mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-18 06:31:02 +00:00
SLUDGE: play game wav sound in a rough way
This commit is contained in:
parent
da842ee14e
commit
ef9438065f
@ -24,14 +24,21 @@
|
||||
#include "AL/alure.h"
|
||||
#endif
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/file.h"
|
||||
|
||||
#include "audio/audiostream.h"
|
||||
#include "audio/mixer.h"
|
||||
#include "audio/decoders/wave.h"
|
||||
#include "audio/decoders/vorbis.h"
|
||||
|
||||
#include "sludge/allfiles.h"
|
||||
#include "sludge/debug.h"
|
||||
#include "sludge/newfatal.h"
|
||||
#include "sludge/sound.h"
|
||||
#include "sludge/moreio.h"
|
||||
#include "sludge/fileset.h"
|
||||
#include "sludge/sludge.h"
|
||||
|
||||
#define MAX_SAMPLES 8
|
||||
#define MAX_MODS 3
|
||||
@ -585,8 +592,30 @@ int cacheSound(int f) {
|
||||
}
|
||||
|
||||
bool startSound(int f, bool loopy) {
|
||||
if (soundOK) {
|
||||
if (loopy) // TODO: don't consider loop sound yet at this stage
|
||||
return false;
|
||||
// load sound
|
||||
setResourceForFatal(f);
|
||||
uint32 length = openFileFromNum(f);
|
||||
Common::SeekableReadStream *memImage = bigDataFile->readStream(length);
|
||||
if (memImage->size() != length || bigDataFile->err())
|
||||
debug("Sound reading failed");
|
||||
Audio::AudioStream *stream = Audio::makeWAVStream(memImage, DisposeAfterUse::NO);
|
||||
#ifdef USE_VORBIS
|
||||
if (!stream) {
|
||||
stream = Audio::makeVorbisStream(memImage, DisposeAfterUse::NO);
|
||||
}
|
||||
#endif
|
||||
delete memImage;
|
||||
if (!stream)
|
||||
return false;
|
||||
|
||||
// play sound
|
||||
Audio::SoundHandle soundHandle;
|
||||
g_sludge->_mixer->playStream(Audio::Mixer::kSFXSoundType, &soundHandle, stream, -1, Audio::Mixer::kMaxChannelVolume);
|
||||
#if 0
|
||||
if (soundOK) {
|
||||
|
||||
cacheLoopySound = loopy;
|
||||
int a = cacheSound(f);
|
||||
if (a == -1) {
|
||||
@ -597,8 +626,8 @@ bool startSound(int f, bool loopy) {
|
||||
soundCache[a].vol = defSoundVol;
|
||||
|
||||
playStream(a, false, loopy);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user