mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 09:36:21 +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"
|
#include "AL/alure.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "common/debug.h"
|
||||||
#include "common/file.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/allfiles.h"
|
||||||
#include "sludge/debug.h"
|
#include "sludge/debug.h"
|
||||||
#include "sludge/newfatal.h"
|
#include "sludge/newfatal.h"
|
||||||
#include "sludge/sound.h"
|
#include "sludge/sound.h"
|
||||||
#include "sludge/moreio.h"
|
#include "sludge/moreio.h"
|
||||||
#include "sludge/fileset.h"
|
#include "sludge/fileset.h"
|
||||||
|
#include "sludge/sludge.h"
|
||||||
|
|
||||||
#define MAX_SAMPLES 8
|
#define MAX_SAMPLES 8
|
||||||
#define MAX_MODS 3
|
#define MAX_MODS 3
|
||||||
@ -585,8 +592,30 @@ int cacheSound(int f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool startSound(int f, bool loopy) {
|
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 0
|
||||||
|
if (soundOK) {
|
||||||
|
|
||||||
cacheLoopySound = loopy;
|
cacheLoopySound = loopy;
|
||||||
int a = cacheSound(f);
|
int a = cacheSound(f);
|
||||||
if (a == -1) {
|
if (a == -1) {
|
||||||
@ -597,8 +626,8 @@ bool startSound(int f, bool loopy) {
|
|||||||
soundCache[a].vol = defSoundVol;
|
soundCache[a].vol = defSoundVol;
|
||||||
|
|
||||||
playStream(a, false, loopy);
|
playStream(a, false, loopy);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user