Move raw audio flags from sound/mixer.h to sound/raw.h
svn-id: r47395
This commit is contained in:
parent
68826c27da
commit
dc5e08e623
48 changed files with 213 additions and 188 deletions
|
@ -252,7 +252,7 @@ Audio::AudioStream *WavSound::makeAudioStream(uint sound) {
|
|||
|
||||
void WavSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
convertVolume(vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::FLAG_LOOP) != 0), -1, vol);
|
||||
}
|
||||
|
||||
Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
|
||||
|
@ -263,7 +263,7 @@ Audio::AudioStream *VocSound::makeAudioStream(uint sound) {
|
|||
void VocSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
convertVolume(vol);
|
||||
_flags = flags;
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::FLAG_LOOP) != 0), -1, vol);
|
||||
}
|
||||
|
||||
void RawSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
|
@ -308,7 +308,7 @@ Audio::AudioStream *MP3Sound::makeAudioStream(uint sound) {
|
|||
|
||||
void MP3Sound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
convertVolume(vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::FLAG_LOOP) != 0), -1, vol);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -339,7 +339,7 @@ Audio::AudioStream *VorbisSound::makeAudioStream(uint sound) {
|
|||
|
||||
void VorbisSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
convertVolume(vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::FLAG_LOOP) != 0), -1, vol);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -370,7 +370,7 @@ Audio::AudioStream *FlacSound::makeAudioStream(uint sound) {
|
|||
|
||||
void FlacSound::playSound(uint sound, uint loopSound, Audio::Mixer::SoundType type, Audio::SoundHandle *handle, byte flags, int vol) {
|
||||
convertVolume(vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::Mixer::FLAG_LOOP) != 0), -1, vol);
|
||||
_mixer->playInputStream(type, handle, new LoopingAudioStream(this, sound, loopSound, (flags & Audio::FLAG_LOOP) != 0), -1, vol);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -616,13 +616,13 @@ void Sound::playVoice(uint sound) {
|
|||
_mixer->stopHandle(_voiceHandle);
|
||||
if (_vm->getGameType() == GType_PP) {
|
||||
if (sound < 11)
|
||||
_voice->playSound(sound, sound + 1, Audio::Mixer::kMusicSoundType, &_voiceHandle, Audio::Mixer::FLAG_LOOP, -1500);
|
||||
_voice->playSound(sound, sound + 1, Audio::Mixer::kMusicSoundType, &_voiceHandle, Audio::FLAG_LOOP, -1500);
|
||||
else
|
||||
_voice->playSound(sound, sound, Audio::Mixer::kMusicSoundType, &_voiceHandle, Audio::Mixer::FLAG_LOOP);
|
||||
_voice->playSound(sound, sound, Audio::Mixer::kMusicSoundType, &_voiceHandle, Audio::FLAG_LOOP);
|
||||
} else if (_vm->getGameType() == GType_FF || _vm->getGameId() == GID_SIMON1CD32) {
|
||||
_voice->playSound(sound, Audio::Mixer::kSpeechSoundType, &_voiceHandle, 0);
|
||||
} else {
|
||||
_voice->playSound(sound, Audio::Mixer::kSpeechSoundType, &_voiceHandle, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_voice->playSound(sound, Audio::Mixer::kSpeechSoundType, &_voiceHandle, Audio::FLAG_UNSIGNED);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -635,7 +635,7 @@ void Sound::playEffects(uint sound) {
|
|||
|
||||
if (_vm->getGameType() == GType_SIMON1)
|
||||
_mixer->stopHandle(_effectsHandle);
|
||||
_effects->playSound(sound, Audio::Mixer::kSFXSoundType, &_effectsHandle, (_vm->getGameId() == GID_SIMON1CD32) ? 0 : Audio::Mixer::FLAG_UNSIGNED);
|
||||
_effects->playSound(sound, Audio::Mixer::kSFXSoundType, &_effectsHandle, (_vm->getGameId() == GID_SIMON1CD32) ? 0 : Audio::FLAG_UNSIGNED);
|
||||
}
|
||||
|
||||
void Sound::playAmbient(uint sound) {
|
||||
|
@ -651,7 +651,7 @@ void Sound::playAmbient(uint sound) {
|
|||
return;
|
||||
|
||||
_mixer->stopHandle(_ambientHandle);
|
||||
_effects->playSound(sound, Audio::Mixer::kSFXSoundType, &_ambientHandle, Audio::Mixer::FLAG_LOOP | Audio::Mixer::FLAG_UNSIGNED);
|
||||
_effects->playSound(sound, Audio::Mixer::kSFXSoundType, &_ambientHandle, Audio::FLAG_LOOP | Audio::FLAG_UNSIGNED);
|
||||
}
|
||||
|
||||
bool Sound::hasVoice() const {
|
||||
|
@ -743,7 +743,7 @@ void Sound::playRawData(byte *soundData, uint sound, uint size, uint freq) {
|
|||
|
||||
byte flags = 0;
|
||||
if (_vm->getPlatform() == Common::kPlatformPC)
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(buffer, size, DisposeAfterUse::YES, freq, flags);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_effectsHandle, stream);
|
||||
|
|
|
@ -195,10 +195,10 @@ SndHandle *Sound::getHandle() {
|
|||
void Sound::playSoundBuffer(Audio::SoundHandle *handle, const SoundSample &buffer, int volume,
|
||||
sndHandleType handleType, bool loop) {
|
||||
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (loop)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
|
||||
const Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ?
|
||||
Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType;
|
||||
|
|
|
@ -186,7 +186,7 @@ void DrasculaEngine::playFile(const char *fname) {
|
|||
memset(soundData, 0x80, soundSize); // Mute speech but keep the pause
|
||||
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(soundData, soundSize - 64, DisposeAfterUse::YES,
|
||||
11025, Audio::Mixer::FLAG_UNSIGNED);
|
||||
11025, Audio::FLAG_UNSIGNED);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundHandle, stream);
|
||||
} else
|
||||
warning("playFile: Could not open %s", fname);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "common/util.h"
|
||||
#include "common/stream.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
#include "sound/wave.h"
|
||||
|
||||
#include "gob/sound/sounddesc.h"
|
||||
|
@ -120,7 +121,7 @@ void SoundDesc::convToSigned() {
|
|||
if (!_data || !_dataPtr)
|
||||
return;
|
||||
|
||||
if (_mixerFlags & Audio::Mixer::FLAG_16BITS) {
|
||||
if (_mixerFlags & Audio::FLAG_16BITS) {
|
||||
byte *data = _dataPtr;
|
||||
for (uint32 i = 0; i < _size; i++, data += 2)
|
||||
WRITE_LE_UINT16(data, READ_LE_UINT16(data) ^ 0x8000);
|
||||
|
@ -163,12 +164,12 @@ bool SoundDesc::loadWAV(byte *data, uint32 dSize) {
|
|||
if (!Audio::loadWAVFromStream(stream, wavSize, wavRate, wavFlags, &wavtype, 0))
|
||||
return false;
|
||||
|
||||
if (wavFlags & Audio::Mixer::FLAG_16BITS) {
|
||||
_mixerFlags |= Audio::Mixer::FLAG_16BITS;
|
||||
if (wavFlags & Audio::FLAG_16BITS) {
|
||||
_mixerFlags |= Audio::FLAG_16BITS;
|
||||
wavSize >>= 1;
|
||||
}
|
||||
|
||||
if (wavFlags & Audio::Mixer::FLAG_STEREO) {
|
||||
if (wavFlags & Audio::FLAG_STEREO) {
|
||||
warning("TODO: SoundDesc::loadWAV() - stereo");
|
||||
return false;
|
||||
}
|
||||
|
@ -178,7 +179,7 @@ bool SoundDesc::loadWAV(byte *data, uint32 dSize) {
|
|||
_size = wavSize;
|
||||
_frequency = wavRate;
|
||||
|
||||
if (wavFlags & Audio::Mixer::FLAG_UNSIGNED)
|
||||
if (wavFlags & Audio::FLAG_UNSIGNED)
|
||||
convToSigned();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "gob/sound/soundmixer.h"
|
||||
#include "gob/sound/sounddesc.h"
|
||||
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Gob {
|
||||
|
||||
SoundMixer::SoundMixer(Audio::Mixer &mixer, Audio::Mixer::SoundType type) : _mixer(&mixer) {
|
||||
|
@ -105,7 +107,7 @@ void SoundMixer::setSample(SoundDesc &sndDesc, int16 repCount, int16 frequency,
|
|||
sndDesc._repCount = repCount - 1;
|
||||
sndDesc._frequency = frequency;
|
||||
|
||||
_16bit = (sndDesc._mixerFlags & Audio::Mixer::FLAG_16BITS) != 0;
|
||||
_16bit = (sndDesc._mixerFlags & Audio::FLAG_16BITS) != 0;
|
||||
|
||||
_data = sndDesc.getData();
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "graphics/conversion.h"
|
||||
#endif
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Groovie {
|
||||
|
||||
|
@ -540,9 +541,9 @@ bool ROQPlayer::processBlockSoundMono(ROQBlockHeader &blockHeader) {
|
|||
}
|
||||
|
||||
// Queue the read buffer
|
||||
byte flags = Audio::Mixer::FLAG_16BITS;
|
||||
byte flags = Audio::FLAG_16BITS;
|
||||
#ifdef SCUMM_LITTLE_ENDIAN
|
||||
flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
#endif
|
||||
_audioStream->queueBuffer((byte *)buffer, blockHeader.size * 2, DisposeAfterUse::YES, flags);
|
||||
|
||||
|
@ -596,9 +597,9 @@ bool ROQPlayer::processBlockSoundStereo(ROQBlockHeader &blockHeader) {
|
|||
}
|
||||
|
||||
// Queue the read buffer
|
||||
byte flags = Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_STEREO;
|
||||
byte flags = Audio::FLAG_16BITS | Audio::FLAG_STEREO;
|
||||
#ifdef SCUMM_LITTLE_ENDIAN
|
||||
flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
#endif
|
||||
_audioStream->queueBuffer((byte *)buffer, blockHeader.size * 2, DisposeAfterUse::YES, flags);
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "groovie/vdx.h"
|
||||
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
#define TILE_SIZE 4 // Size of each tile on the image: only ever seen 4 so far
|
||||
#define VDX_IDENT 0x9267 // 37479
|
||||
|
@ -506,7 +507,7 @@ void VDXPlayer::chunkSound(Common::ReadStream *in) {
|
|||
byte *data = (byte *)malloc(60000);
|
||||
int chunksize = in->read(data, 60000);
|
||||
if (!Common::isDebugChannelEnabled(kGroovieDebugFast)) {
|
||||
_audioStream->queueBuffer(data, chunksize, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_audioStream->queueBuffer(data, chunksize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
#include "sound/voc.h"
|
||||
#include "sound/audiostream.h"
|
||||
|
||||
#include "sound/mp3.h"
|
||||
#include "sound/vorbis.h"
|
||||
#include "sound/flac.h"
|
||||
#include "sound/mp3.h"
|
||||
#include "sound/raw.h"
|
||||
#include "sound/vorbis.h"
|
||||
|
||||
namespace Kyra {
|
||||
|
||||
|
@ -244,9 +245,9 @@ namespace {
|
|||
Audio::SeekableAudioStream *makeVOCStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) {
|
||||
|
||||
#ifdef STREAM_AUDIO_FROM_DISK
|
||||
Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED, disposeAfterUse);
|
||||
Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::FLAG_UNSIGNED, disposeAfterUse);
|
||||
#else
|
||||
Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::Mixer::FLAG_UNSIGNED, DisposeAfterUse::NO);
|
||||
Audio::SeekableAudioStream *as = Audio::makeVOCStream(*stream, Audio::FLAG_UNSIGNED, DisposeAfterUse::NO);
|
||||
|
||||
if (disposeAfterUse)
|
||||
delete stream;
|
||||
|
|
|
@ -3926,7 +3926,7 @@ void SoundTowns::playSoundEffect(uint8 track) {
|
|||
uint32 outputRate = uint32(11025 * calculatePhaseStep(note, sfxRootNoteOffs, sfxRate, 11025, 0x2000));
|
||||
|
||||
_currentSFX = Audio::makeRawMemoryStream(sfxPlaybackBuffer, playbackBufferSize, DisposeAfterUse::YES,
|
||||
outputRate, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN, 0, 0);
|
||||
outputRate, Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN, 0, 0);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, _currentSFX);
|
||||
}
|
||||
|
||||
|
@ -4298,7 +4298,7 @@ int32 SoundTownsPC98_v2::voicePlay(const char *file, Audio::SoundHandle *handle,
|
|||
uint32 outputRate = uint32(11025 * SoundTowns::calculatePhaseStep(0x3c, 0x3c, sfxRate, 11025, 0x2000));
|
||||
|
||||
_currentSFX = Audio::makeRawMemoryStream(sfx, outsize, DisposeAfterUse::YES, outputRate,
|
||||
Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LITTLE_ENDIAN, 0, 0);
|
||||
Audio::FLAG_UNSIGNED | Audio::FLAG_LITTLE_ENDIAN, 0, 0);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_soundChannels[h], _currentSFX);
|
||||
if (handle)
|
||||
*handle = _soundChannels[h];
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "common/system.h"
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
#include "kyra/sound.h"
|
||||
#include "kyra/screen.h"
|
||||
|
@ -422,7 +423,7 @@ void VQAMovie::displayFrame(uint frameNum) {
|
|||
inbuf = (byte *)malloc(size);
|
||||
_file->read(inbuf, size);
|
||||
assert(_stream);
|
||||
_stream->queueBuffer(inbuf, size, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_stream->queueBuffer(inbuf, size, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
break;
|
||||
|
||||
case MKID_BE('SND1'): // Compressed sound, almost like AUD
|
||||
|
@ -435,12 +436,12 @@ void VQAMovie::displayFrame(uint frameNum) {
|
|||
|
||||
if (insize == outsize) {
|
||||
assert(_stream);
|
||||
_stream->queueBuffer(inbuf, insize, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_stream->queueBuffer(inbuf, insize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
} else {
|
||||
outbuf = (byte *)malloc(outsize);
|
||||
decodeSND1(inbuf, insize, outbuf, outsize);
|
||||
assert(_stream);
|
||||
_stream->queueBuffer(outbuf, outsize, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_stream->queueBuffer(outbuf, outsize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
free(inbuf);
|
||||
}
|
||||
break;
|
||||
|
@ -612,7 +613,7 @@ void VQAMovie::play() {
|
|||
case MKID_BE('SND0'): // Uncompressed sound
|
||||
inbuf = (byte *)malloc(size);
|
||||
_file->read(inbuf, size);
|
||||
_stream->queueBuffer(inbuf, size, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_stream->queueBuffer(inbuf, size, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
break;
|
||||
|
||||
case MKID_BE('SND1'): // Compressed sound
|
||||
|
@ -623,11 +624,11 @@ void VQAMovie::play() {
|
|||
_file->read(inbuf, insize);
|
||||
|
||||
if (insize == outsize) {
|
||||
_stream->queueBuffer(inbuf, insize, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_stream->queueBuffer(inbuf, insize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
} else {
|
||||
outbuf = (byte *)malloc(outsize);
|
||||
decodeSND1(inbuf, insize, outbuf, outsize);
|
||||
_stream->queueBuffer(outbuf, outsize, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_stream->queueBuffer(outbuf, outsize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
free(inbuf);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -90,10 +90,10 @@ void Sound::playSound(const char *soundName, int volume, bool loop, int channel)
|
|||
_vm->res()->toss(soundName);
|
||||
|
||||
handle->type = kEffectHandle;
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (loop)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
|
||||
_vm->res()->toss(soundName);
|
||||
|
||||
|
@ -146,7 +146,7 @@ void Sound::playVoice(const char *soundName, int volume) {
|
|||
soundStream->read(buffer, soundStream->size());
|
||||
|
||||
handle->type = kEffectHandle;
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
_vm->res()->toss(soundName);
|
||||
|
||||
|
@ -250,10 +250,10 @@ void Sound::playDSRSound(int soundIndex, int volume, bool loop) {
|
|||
SndHandle *handle = getHandle();
|
||||
|
||||
handle->type = kEffectHandle;
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (loop)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
|
||||
// Get sound data
|
||||
FabDecompressor fab;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "made/pmvplayer.h"
|
||||
#include "made/screen.h"
|
||||
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Made {
|
||||
|
||||
PmvPlayer::PmvPlayer(MadeEngine *vm, Audio::Mixer *mixer) : _fd(NULL), _vm(vm), _mixer(mixer) {
|
||||
|
@ -140,7 +142,7 @@ bool PmvPlayer::play(const char *filename) {
|
|||
soundSize = chunkCount * chunkSize;
|
||||
soundData = (byte *)malloc(soundSize);
|
||||
decompressSound(audioData + 8, soundData, chunkSize, chunkCount);
|
||||
_audioStream->queueBuffer(soundData, soundSize, DisposeAfterUse::YES, Audio::Mixer::FLAG_UNSIGNED);
|
||||
_audioStream->queueBuffer(soundData, soundSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||
}
|
||||
|
||||
// Handle palette
|
||||
|
|
|
@ -261,9 +261,9 @@ void SoundResource::load(byte *source, int size) {
|
|||
}
|
||||
|
||||
Audio::AudioStream *SoundResource::getAudioStream(int soundRate, bool loop) {
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
if (loop)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
|
||||
return Audio::makeRawMemoryStream(_soundData, _soundSize, DisposeAfterUse::NO, soundRate, flags, 0, 0);
|
||||
}
|
||||
|
|
|
@ -435,11 +435,11 @@ Audio::AudioStream *Sound::makeMohawkWaveStream(Common::SeekableReadStream *stre
|
|||
// The sound in the CD version of Riven is encoded in Intel DVI ADPCM
|
||||
// The sound in the DVD version of Riven is encoded in MPEG-2 Layer II or Intel DVI ADPCM
|
||||
if (data_chunk.encoding == kCodecRaw) {
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
if (data_chunk.channels == 2)
|
||||
flags |= Audio::Mixer::FLAG_STEREO;
|
||||
flags |= Audio::FLAG_STEREO;
|
||||
if (data_chunk.loop == 0xFFFF || loop)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
return Audio::makeRawMemoryStream(data_chunk.audio_data, data_chunk.size, DisposeAfterUse::YES, data_chunk.sample_rate, flags, data_chunk.loopStart, data_chunk.loopEnd);
|
||||
} else if (data_chunk.encoding == kCodecADPCM) {
|
||||
Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(data_chunk.audio_data, data_chunk.size, DisposeAfterUse::YES);
|
||||
|
@ -481,10 +481,10 @@ Audio::AudioStream *Sound::makeOldMohawkWaveStream(Common::SeekableReadStream *s
|
|||
stream->read(data, size);
|
||||
delete stream;
|
||||
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (loop)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
|
||||
return Audio::makeRawMemoryStream(data, size, DisposeAfterUse::YES, rate, flags, 0, 0);
|
||||
}
|
||||
|
|
|
@ -1161,11 +1161,11 @@ Audio::AudioStream *QTPlayer::createAudioStream(Common::SeekableReadStream *stre
|
|||
// Fortunately, most of the audio used in Myst videos is raw...
|
||||
uint16 flags = 0;
|
||||
if (_streams[_audioStreamIndex]->codec_tag == MKID_BE('raw '))
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
if (_streams[_audioStreamIndex]->channels == 2)
|
||||
flags |= Audio::Mixer::FLAG_STEREO;
|
||||
flags |= Audio::FLAG_STEREO;
|
||||
if (_streams[_audioStreamIndex]->bits_per_sample == 16)
|
||||
flags |= Audio::Mixer::FLAG_16BITS;
|
||||
flags |= Audio::FLAG_16BITS;
|
||||
uint32 dataSize = stream->size();
|
||||
byte *data = (byte *)malloc(dataSize);
|
||||
stream->read(data, dataSize);
|
||||
|
|
|
@ -416,11 +416,11 @@ Audio::AudioStream *DosSoundMan_br::loadChannelData(const char *filename, Channe
|
|||
int rate = 11025;
|
||||
|
||||
uint32 loopStart = 0, loopEnd = 0;
|
||||
uint32 flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
uint32 flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (looping) {
|
||||
loopEnd = dataSize;
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
}
|
||||
|
||||
ch->stream = Audio::makeRawMemoryStream((byte *)data, dataSize, DisposeAfterUse::YES, rate, flags, loopStart, loopEnd);
|
||||
|
|
|
@ -330,7 +330,7 @@ void SBSound::playSoundData(Common::File *f, uint32 size, Audio::SoundHandle *so
|
|||
f->read(sound, size);
|
||||
Audio::Mixer::SoundType type = (soundHandle == &_speechHandle) ? Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType;
|
||||
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, 11840, Audio::Mixer::FLAG_UNSIGNED);
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, 11840, Audio::FLAG_UNSIGNED);
|
||||
_mixer->playInputStream(type, soundHandle, stream);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,8 +304,8 @@ void Music::play(uint32 resourceId, MusicFlags flags) {
|
|||
(uint32)resData->offset + offs, (uint32)resData->offset + resData->size - offs);
|
||||
|
||||
if (!_digitalMusicContext->isCompressed()) {
|
||||
byte musicFlags = Audio::Mixer::FLAG_STEREO |
|
||||
Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
byte musicFlags = Audio::FLAG_STEREO |
|
||||
Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
|
||||
Audio::RawDiskStreamAudioBlock audioBlocks[1];
|
||||
audioBlocks[0].pos = 0;
|
||||
audioBlocks[0].len = resData->size / 2; // 16-bit sound
|
||||
|
|
|
@ -34,14 +34,15 @@
|
|||
|
||||
#include "common/file.h"
|
||||
|
||||
#include "sound/voc.h"
|
||||
#include "sound/wave.h"
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/adpcm.h"
|
||||
#include "sound/aiff.h"
|
||||
#ifdef ENABLE_SAGA2
|
||||
#include "sound/shorten.h"
|
||||
#endif
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/raw.h"
|
||||
#include "sound/voc.h"
|
||||
#include "sound/wave.h"
|
||||
|
||||
namespace Saga {
|
||||
|
||||
|
@ -268,12 +269,12 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
|||
buffer.soundType = resourceType;
|
||||
buffer.originalSize = 0;
|
||||
// Set default flags and frequency for PCM, VOC and VOX files, which got no header
|
||||
buffer.flags = Audio::Mixer::FLAG_16BITS;
|
||||
buffer.flags = Audio::FLAG_16BITS;
|
||||
buffer.frequency = 22050;
|
||||
if (_vm->getGameId() == GID_ITE) {
|
||||
if (_vm->getFeatures() & GF_8BIT_UNSIGNED_PCM) { // older ITE demos
|
||||
buffer.flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
buffer.flags &= ~Audio::Mixer::FLAG_16BITS;
|
||||
buffer.flags |= Audio::FLAG_UNSIGNED;
|
||||
buffer.flags &= ~Audio::FLAG_16BITS;
|
||||
} else {
|
||||
// Voice files in newer ITE demo versions are OKI ADPCM (VOX) encoded
|
||||
if (!scumm_stricmp(context->fileName(), "voicesd.rsc"))
|
||||
|
@ -284,9 +285,9 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
|||
|
||||
// Check for LE sounds
|
||||
if (!context->isBigEndian())
|
||||
buffer.flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
buffer.flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
if ((context->fileType() & GAME_VOICEFILE) && (_vm->getFeatures() & GF_LE_VOICES))
|
||||
buffer.flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
buffer.flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
|
||||
// Older Mac versions of ITE were Macbinary packed
|
||||
int soundOffset = (context->fileType() & GAME_MACBINARY) ? 36 : 0;
|
||||
|
@ -329,7 +330,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
|||
result = (data != 0);
|
||||
if (onlyHeader)
|
||||
free(data);
|
||||
buffer.flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
buffer.flags |= Audio::FLAG_UNSIGNED;
|
||||
}
|
||||
|
||||
if (result) {
|
||||
|
@ -355,9 +356,9 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
|||
buffer.frequency = readS.readUint16LE();
|
||||
buffer.originalSize = readS.readUint32LE();
|
||||
if (readS.readByte() == 8) // read sample bits
|
||||
buffer.flags &= ~Audio::Mixer::FLAG_16BITS;
|
||||
buffer.flags &= ~Audio::FLAG_16BITS;
|
||||
if (readS.readByte() != 0) // read stereo flag
|
||||
buffer.flags |= Audio::Mixer::FLAG_STEREO;
|
||||
buffer.flags |= Audio::FLAG_STEREO;
|
||||
|
||||
buffer.size = soundResourceLength;
|
||||
buffer.soundType = resourceType;
|
||||
|
@ -404,10 +405,10 @@ int SndRes::getVoiceLength(uint32 resourceId) {
|
|||
else
|
||||
msDouble = (double)buffer.originalSize;
|
||||
|
||||
if (buffer.flags & Audio::Mixer::FLAG_16BITS)
|
||||
if (buffer.flags & Audio::FLAG_16BITS)
|
||||
msDouble /= 2.0;
|
||||
|
||||
if (buffer.flags & Audio::Mixer::FLAG_STEREO)
|
||||
if (buffer.flags & Audio::FLAG_STEREO)
|
||||
msDouble /= 2.0;
|
||||
|
||||
msDouble = msDouble / buffer.frequency * 1000.0;
|
||||
|
|
|
@ -70,7 +70,7 @@ void Sound::playSoundBuffer(Audio::SoundHandle *handle, SoundBuffer &buffer, int
|
|||
Audio::AudioStream *stream = 0;
|
||||
|
||||
if (loop)
|
||||
buffer.flags |= Audio::Mixer::FLAG_LOOP;
|
||||
buffer.flags |= Audio::FLAG_LOOP;
|
||||
|
||||
Audio::Mixer::SoundType soundType = (handleType == kVoiceHandle) ?
|
||||
Audio::Mixer::kSpeechSoundType : Audio::Mixer::kSFXSoundType;
|
||||
|
|
|
@ -170,10 +170,10 @@ static byte *readSOLAudio(Common::SeekableReadStream *audioStream, uint32 &size,
|
|||
// Convert the SOL stream flags to our own format
|
||||
flags = 0;
|
||||
if (audioFlags & kSolFlag16Bit)
|
||||
flags |= Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
|
||||
|
||||
if (!(audioFlags & kSolFlagIsSigned))
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (audioFlags & kSolFlagCompressed) {
|
||||
buffer = (byte *)malloc(size * 2);
|
||||
|
@ -240,7 +240,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
|
|||
data = (byte *)malloc(size);
|
||||
assert(data);
|
||||
memcpy(data, audioRes->data, size);
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
|
|||
audioStream = Audio::makeRawMemoryStream(data, size, DisposeAfterUse::YES, _audioRate, flags);
|
||||
|
||||
if (audioStream) {
|
||||
*sampleLen = (flags & Audio::Mixer::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate;
|
||||
*sampleLen = (flags & Audio::FLAG_16BITS ? size >> 1 : size) * 60 / _audioRate;
|
||||
return audioStream;
|
||||
}
|
||||
|
||||
|
|
|
@ -551,7 +551,7 @@ static Audio::AudioStream *makeStream(byte *data, int size, int rate) {
|
|||
memcpy(sound, data, size);
|
||||
|
||||
// Convert stream format flags
|
||||
int flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
int flags = Audio::FLAG_UNSIGNED;
|
||||
return Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, flags, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
|
|||
if (track->digitalChannelNr != -1) {
|
||||
byte *channelData = track->channels[track->digitalChannelNr].data;
|
||||
delete pSnd->pStreamAud;
|
||||
pSnd->pStreamAud = Audio::makeRawMemoryStream(channelData, track->digitalSampleSize, DisposeAfterUse::NO, track->digitalSampleRate, Audio::Mixer::FLAG_UNSIGNED);
|
||||
pSnd->pStreamAud = Audio::makeRawMemoryStream(channelData, track->digitalSampleSize, DisposeAfterUse::NO, track->digitalSampleRate, Audio::FLAG_UNSIGNED);
|
||||
delete pSnd->pLoopStream;
|
||||
pSnd->pLoopStream = 0;
|
||||
pSnd->soundType = Audio::Mixer::kSFXSoundType;
|
||||
|
|
|
@ -169,10 +169,10 @@ void CUP_Player::updateSfx() {
|
|||
uint8 *soundData = _sfxBuffer + offset;
|
||||
if (READ_BE_UINT32(soundData) == MKID_BE('DATA')) {
|
||||
uint32 soundSize = READ_BE_UINT32(soundData + 4);
|
||||
uint32 flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
uint32 flags = Audio::FLAG_UNSIGNED;
|
||||
uint32 loopEnd = 0;
|
||||
if (sfx->flags & kSfxFlagLoop) {
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
loopEnd = soundSize - 8;
|
||||
}
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &sfxChannel->handle,
|
||||
|
|
|
@ -532,7 +532,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
|||
byte *ptr, *spoolPtr;
|
||||
int size = -1;
|
||||
int priority, rate;
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
Audio::Mixer::SoundType type = Audio::Mixer::kSFXSoundType;
|
||||
if (soundID > _vm->_numSounds)
|
||||
|
@ -636,7 +636,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
|||
|
||||
// TODO: Extra sound flags
|
||||
if (heFlags & 1) {
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
_heChannel[heChannel].timer = 0;
|
||||
} else {
|
||||
_heChannel[heChannel].timer = size * 1000 / rate;
|
||||
|
@ -644,7 +644,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
|||
|
||||
_mixer->stopHandle(_heSoundChannels[heChannel]);
|
||||
if (compType == 17) {
|
||||
Audio::AudioStream *voxStream = Audio::makeADPCMStream(&memStream, false, size, Audio::kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||
Audio::AudioStream *voxStream = Audio::makeADPCMStream(&memStream, false, size, Audio::kADPCMMSIma, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||
|
||||
// FIXME: Get rid of this crude hack to turn a ADPCM stream into a raw stream.
|
||||
// It seems it is only there to allow looping -- if that is true, we certainly
|
||||
|
@ -666,7 +666,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
|||
// makeADPCMStream returns a stream in native endianness, but RawMemoryStream
|
||||
// defaults to big endian. If we're on a little endian system, set the LE flag.
|
||||
#ifdef SCUMM_LITTLE_ENDIAN
|
||||
flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
#endif
|
||||
stream = Audio::makeRawMemoryStream(sound + heOffset, size - heOffset, DisposeAfterUse::YES, rate, flags, 0, 0);
|
||||
} else {
|
||||
|
@ -722,7 +722,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
|||
|
||||
// TODO: Extra sound flags
|
||||
if (heFlags & 1) {
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
_heChannel[heChannel].timer = 0;
|
||||
} else {
|
||||
_heChannel[heChannel].timer = size * 1000 / rate;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Scumm {
|
||||
|
||||
|
@ -78,13 +79,13 @@ IMuseDigital::~IMuseDigital() {
|
|||
int32 IMuseDigital::makeMixerFlags(int32 flags) {
|
||||
int32 mixerFlags = 0;
|
||||
if (flags & kFlagUnsigned)
|
||||
mixerFlags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
mixerFlags |= Audio::FLAG_UNSIGNED;
|
||||
if (flags & kFlag16Bits)
|
||||
mixerFlags |= Audio::Mixer::FLAG_16BITS;
|
||||
mixerFlags |= Audio::FLAG_16BITS;
|
||||
if (flags & kFlagLittleEndian)
|
||||
mixerFlags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
mixerFlags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
if (flags & kFlagStereo)
|
||||
mixerFlags |= Audio::Mixer::FLAG_STEREO;
|
||||
mixerFlags |= Audio::FLAG_STEREO;
|
||||
return mixerFlags;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol,
|
|||
_channels[i].pan = pan;
|
||||
_channels[i].freq = rate;
|
||||
_channels[i].ctr = 0;
|
||||
_channels[i].input = Audio::makeRawMemoryStream((const byte*)data, size, DisposeAfterUse::YES, rate, (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), loopStart, loopEnd);
|
||||
_channels[i].input = Audio::makeRawMemoryStream((const byte*)data, size, DisposeAfterUse::YES, rate, (loopStart != loopEnd ? Audio::FLAG_LOOP : 0), loopStart, loopEnd);
|
||||
// read the first sample
|
||||
_channels[i].input->readBuffer(&_channels[i].pos, 1);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "scumm/imuse/imuse.h"
|
||||
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
|
||||
namespace Scumm {
|
||||
|
@ -112,11 +113,11 @@ bool SmushMixer::handleFrame() {
|
|||
int32 size = _channels[i].chan->getAvailableSoundDataSize();
|
||||
byte *data = _channels[i].chan->getSoundData();
|
||||
|
||||
byte flags = stereo ? Audio::Mixer::FLAG_STEREO : 0;
|
||||
byte flags = stereo ? Audio::FLAG_STEREO : 0;
|
||||
if (is_16bit) {
|
||||
flags |= Audio::Mixer::FLAG_16BITS;
|
||||
flags |= Audio::FLAG_16BITS;
|
||||
} else {
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
}
|
||||
|
||||
if (_mixer->isReady()) {
|
||||
|
|
|
@ -50,8 +50,9 @@
|
|||
#include "scumm/insane/insane.h"
|
||||
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/vorbis.h"
|
||||
#include "sound/mp3.h"
|
||||
#include "sound/raw.h"
|
||||
#include "sound/vorbis.h"
|
||||
|
||||
#include "common/zlib.h"
|
||||
|
||||
|
@ -472,7 +473,7 @@ void SmushPlayer::handleIACT(int32 subSize, Common::SeekableReadStream &b) {
|
|||
_IACTstream = Audio::makeQueuingAudioStream(22050, true);
|
||||
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_IACTchannel, _IACTstream);
|
||||
}
|
||||
_IACTstream->queueBuffer(output_data, 0x1000, DisposeAfterUse::YES, Audio::Mixer::FLAG_STEREO | Audio::Mixer::FLAG_16BITS);
|
||||
_IACTstream->queueBuffer(output_data, 0x1000, DisposeAfterUse::YES, Audio::FLAG_STEREO | Audio::FLAG_16BITS);
|
||||
|
||||
bsize -= len;
|
||||
d_src += len;
|
||||
|
|
|
@ -164,7 +164,7 @@ void Sound::playSound(int soundID) {
|
|||
Audio::AudioStream *stream;
|
||||
int size = -1;
|
||||
int rate;
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine) {
|
||||
if (soundID >= 13 && soundID <= 32) {
|
||||
|
@ -351,7 +351,7 @@ void Sound::playSound(int soundID) {
|
|||
size -= waveSize;
|
||||
|
||||
if (loopEnd > 0)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
|
||||
stream = Audio::makeRawMemoryStream(sound, waveSize, DisposeAfterUse::YES, rate, flags, loopStart, loopEnd);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, 255, 0);
|
||||
|
@ -442,7 +442,7 @@ void Sound::playSound(int soundID) {
|
|||
// so maybe this is not really a problem.
|
||||
loopStart = READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8);
|
||||
loopEnd = READ_BE_UINT16(ptr + 14);
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
}
|
||||
|
||||
memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size);
|
||||
|
@ -659,7 +659,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
input = Audio::makeVOCStream(*_sfxFile, Audio::Mixer::FLAG_UNSIGNED);
|
||||
input = Audio::makeVOCStream(*_sfxFile, Audio::FLAG_UNSIGNED);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -740,7 +740,7 @@ bool Intro::nextPart(uint16 *&data) {
|
|||
memset(vData, 127, sizeof(DataFileHeader));
|
||||
|
||||
stream = Audio::makeRawMemoryStream(vData, _skyDisk->_lastLoadedFileSize, DisposeAfterUse::YES,
|
||||
11025, Audio::Mixer::FLAG_UNSIGNED);
|
||||
11025, Audio::FLAG_UNSIGNED);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_voice, stream, SOUND_VOICE);
|
||||
return true;
|
||||
case WAITVOICE:
|
||||
|
@ -757,13 +757,13 @@ bool Intro::nextPart(uint16 *&data) {
|
|||
case LOOPBG:
|
||||
_mixer->stopID(SOUND_BG);
|
||||
stream = Audio::makeRawMemoryStream(_bgBuf + 256, _bgSize - 768, DisposeAfterUse::YES,
|
||||
11025, Audio::Mixer::FLAG_UNSIGNED | Audio::Mixer::FLAG_LOOP, 0, 0);
|
||||
11025, Audio::FLAG_UNSIGNED | Audio::FLAG_LOOP, 0, 0);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSfx, stream, SOUND_BG);
|
||||
return true;
|
||||
case PLAYBG:
|
||||
_mixer->stopID(SOUND_BG);
|
||||
stream = Audio::makeRawMemoryStream(_bgBuf + 256, _bgSize - 768, DisposeAfterUse::YES,
|
||||
11025, Audio::Mixer::FLAG_UNSIGNED);
|
||||
11025, Audio::FLAG_UNSIGNED);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSfx, stream, SOUND_BG);
|
||||
return true;
|
||||
case STOPBG:
|
||||
|
|
|
@ -1038,7 +1038,7 @@ Sound::~Sound() {
|
|||
|
||||
void Sound::playSound(uint32 id, byte *sound, uint32 size, Audio::SoundHandle *handle) {
|
||||
byte flags = 0;
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
size -= sizeof(DataFileHeader);
|
||||
byte *buffer = (byte *)malloc(size);
|
||||
memcpy(buffer, sound+sizeof(DataFileHeader), size);
|
||||
|
@ -1111,13 +1111,13 @@ void Sound::playSound(uint16 sound, uint16 volume, uint8 channel) {
|
|||
uint32 dataLoop = READ_BE_UINT16(_sfxInfo + (sound << 3) + 6);
|
||||
dataOfs += _sfxBaseOfs;
|
||||
|
||||
byte flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
byte flags = Audio::FLAG_UNSIGNED;
|
||||
|
||||
uint32 loopSta = 0, loopEnd = 0;
|
||||
if (dataLoop) {
|
||||
loopSta = dataSize - dataLoop;
|
||||
loopEnd = dataSize;
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1249,7 +1249,7 @@ bool Sound::startSpeech(uint16 textNum) {
|
|||
|
||||
_mixer->stopID(SOUND_SPEECH);
|
||||
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(playBuffer, speechSize, DisposeAfterUse::YES, rate, Audio::Mixer::FLAG_UNSIGNED);
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(playBuffer, speechSize, DisposeAfterUse::YES, rate, Audio::FLAG_UNSIGNED);
|
||||
_mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_ingameSpeech, stream, SOUND_SPEECH);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
namespace Sword1 {
|
||||
|
||||
#define SOUND_SPEECH_ID 1
|
||||
#define SPEECH_FLAGS (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN)
|
||||
#define SPEECH_FLAGS (Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN)
|
||||
|
||||
Sound::Sound(const char *searchPath, Audio::Mixer *mixer, ResMan *pResMan) {
|
||||
g_eventRec.registerRandomSource(_rnd, "sword1sound");
|
||||
|
@ -265,13 +265,13 @@ void Sound::playSample(QueueElement *elem) {
|
|||
uint32 size = READ_LE_UINT32(sampleData + 0x28);
|
||||
uint8 flags;
|
||||
if (READ_LE_UINT16(sampleData + 0x22) == 16)
|
||||
flags = Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags = Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
|
||||
else
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
if (READ_LE_UINT16(sampleData + 0x16) == 2)
|
||||
flags |= Audio::Mixer::FLAG_STEREO;
|
||||
flags |= Audio::FLAG_STEREO;
|
||||
if (_fxList[elem->id].type == FX_LOOP)
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream(sampleData + 0x2C, size, DisposeAfterUse::NO, 11025, flags, 0, 0);
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &elem->handle, stream, elem->id, volume, pan);
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "tinsel/tinlib.h"
|
||||
#include "tinsel/tinsel.h"
|
||||
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Tinsel {
|
||||
|
||||
//----------------- LOCAL DEFINES ----------------------------
|
||||
|
@ -453,7 +455,7 @@ void BMVPlayer::MovieAudio(int audioOffset, int blobs) {
|
|||
else
|
||||
memset(data, 0, blobs * 128);
|
||||
|
||||
_audioStream->queueBuffer(data, blobs * 128, DisposeAfterUse::YES, Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_STEREO);
|
||||
_audioStream->queueBuffer(data, blobs * 128, DisposeAfterUse::YES, Audio::FLAG_16BITS | Audio::FLAG_STEREO);
|
||||
|
||||
if (currentSoundFrame == ADVANCE_SOUND) {
|
||||
if (!audioStarted) {
|
||||
|
|
|
@ -154,7 +154,7 @@ bool SoundManager::playSample(int id, Audio::Mixer::SoundType type, Audio::Sound
|
|||
#endif
|
||||
break;
|
||||
default:
|
||||
sampleStream = Audio::makeRawMemoryStream(sampleBuf, sampleLen, DisposeAfterUse::YES, 22050, Audio::Mixer::FLAG_UNSIGNED);
|
||||
sampleStream = Audio::makeRawMemoryStream(sampleBuf, sampleLen, DisposeAfterUse::YES, 22050, Audio::FLAG_UNSIGNED);
|
||||
break;
|
||||
}
|
||||
if (sampleStream) {
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "sound/mp3.h"
|
||||
#include "sound/voc.h"
|
||||
#include "sound/vorbis.h"
|
||||
#include "sound/raw.h"
|
||||
#include "sound/audiostream.h"
|
||||
|
||||
#include "touche/midi.h"
|
||||
|
@ -587,7 +588,7 @@ void ToucheEngine::res_loadSound(int priority, int num) {
|
|||
uint32 size;
|
||||
const uint32 offs = res_getDataOffset(kResourceTypeSound, num, &size);
|
||||
_fData.seek(offs);
|
||||
Audio::AudioStream *stream = Audio::makeVOCStream(_fData, Audio::Mixer::FLAG_UNSIGNED);
|
||||
Audio::AudioStream *stream = Audio::makeVOCStream(_fData, Audio::FLAG_UNSIGNED);
|
||||
if (stream) {
|
||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_sfxHandle, stream);
|
||||
}
|
||||
|
@ -645,7 +646,7 @@ void ToucheEngine::res_loadSpeechSegment(int num) {
|
|||
return;
|
||||
}
|
||||
_fSpeech[i].seek(offs);
|
||||
stream = Audio::makeVOCStream(_fSpeech[i], Audio::Mixer::FLAG_UNSIGNED);
|
||||
stream = Audio::makeVOCStream(_fSpeech[i], Audio::FLAG_UNSIGNED);
|
||||
} else {
|
||||
if (num >= 750) {
|
||||
num -= 750;
|
||||
|
|
|
@ -591,9 +591,9 @@ Audio::RewindableAudioStream *AnimationSequencePlayer::loadSound(int index, Anim
|
|||
case kAnimationSoundType16BitsRAW:
|
||||
size = f.size();
|
||||
rate = 22050;
|
||||
flags = Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags = Audio::FLAG_UNSIGNED;
|
||||
if (type == kAnimationSoundType16BitsRAW)
|
||||
flags = Audio::Mixer::FLAG_LITTLE_ENDIAN | Audio::Mixer::FLAG_16BITS;
|
||||
flags = Audio::FLAG_LITTLE_ENDIAN | Audio::FLAG_16BITS;
|
||||
|
||||
if (size != 0) {
|
||||
uint8 *sampleData = (uint8 *)malloc(size);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
#include "graphics/video/avi_decoder.h"
|
||||
|
||||
|
@ -325,9 +326,9 @@ Surface *AviDecoder::getNextFrame() {
|
|||
|
||||
byte flags = 0;
|
||||
if (_audsHeader.sampleSize == 2)
|
||||
flags |= Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN;
|
||||
else
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
|
||||
_audStream->queueBuffer(data, chunkSize, DisposeAfterUse::YES, flags);
|
||||
_fileStream->skip(chunkSize & 1); // Alignment
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
#include "graphics/dither.h"
|
||||
#include "graphics/video/coktelvideo/indeo3.h"
|
||||
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
Imd::Imd() {
|
||||
|
@ -2184,8 +2187,8 @@ void Vmd::emptySoundSlice(uint32 size) {
|
|||
|
||||
if (sound) {
|
||||
uint32 flags = 0;
|
||||
flags |= (_soundBytesPerSample == 2) ? Audio::Mixer::FLAG_16BITS : 0;
|
||||
flags |= (_soundStereo > 0) ? Audio::Mixer::FLAG_STEREO : 0;
|
||||
flags |= (_soundBytesPerSample == 2) ? Audio::FLAG_16BITS : 0;
|
||||
flags |= (_soundStereo > 0) ? Audio::FLAG_STEREO : 0;
|
||||
|
||||
_audioStream->queueBuffer(sound, size, DisposeAfterUse::YES, flags);
|
||||
}
|
||||
|
@ -2202,8 +2205,8 @@ void Vmd::filledSoundSlice(uint32 size) {
|
|||
|
||||
if (sound) {
|
||||
uint32 flags = 0;
|
||||
flags |= (_soundBytesPerSample == 2) ? Audio::Mixer::FLAG_16BITS : 0;
|
||||
flags |= (_soundStereo > 0) ? Audio::Mixer::FLAG_STEREO : 0;
|
||||
flags |= (_soundBytesPerSample == 2) ? Audio::FLAG_16BITS : 0;
|
||||
flags |= (_soundStereo > 0) ? Audio::FLAG_STEREO : 0;
|
||||
|
||||
_audioStream->queueBuffer(sound, size, DisposeAfterUse::YES, flags);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,10 @@
|
|||
#include "common/array.h"
|
||||
#include "graphics/dither.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/audiostream.h"
|
||||
|
||||
namespace Audio {
|
||||
class QueuingAudioStream;
|
||||
}
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
|
|
|
@ -35,8 +35,9 @@
|
|||
#include "common/stream.h"
|
||||
#include "common/system.h"
|
||||
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/audiostream.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "sound/raw.h"
|
||||
|
||||
namespace Graphics {
|
||||
|
||||
|
@ -574,9 +575,9 @@ bool SmackerDecoder::decodeNextFrame() {
|
|||
// Uncompressed audio (PCM)
|
||||
byte flags = 0;
|
||||
if (_header.audioInfo[0].is16Bits)
|
||||
flags = flags | Audio::Mixer::FLAG_16BITS;
|
||||
flags = flags | Audio::FLAG_16BITS;
|
||||
if (_header.audioInfo[0].isStereo)
|
||||
flags = flags | Audio::Mixer::FLAG_STEREO;
|
||||
flags = flags | Audio::FLAG_STEREO;
|
||||
|
||||
_audioStream->queueBuffer(soundBuffer, chunkSize, DisposeAfterUse::YES, flags);
|
||||
// The sound buffer will be deleted by QueuingAudioStream
|
||||
|
@ -829,9 +830,9 @@ void SmackerDecoder::queueCompressedBuffer(byte *buffer, uint32 bufferSize,
|
|||
|
||||
byte flags = 0;
|
||||
if (_header.audioInfo[0].is16Bits)
|
||||
flags = flags | Audio::Mixer::FLAG_16BITS;
|
||||
flags = flags | Audio::FLAG_16BITS;
|
||||
if (_header.audioInfo[0].isStereo)
|
||||
flags = flags | Audio::Mixer::FLAG_STEREO;
|
||||
flags = flags | Audio::FLAG_STEREO;
|
||||
_audioStream->queueBuffer(unpackedBuffer, unpackedSize, DisposeAfterUse::YES, flags);
|
||||
// unpackedBuffer will be deleted by QueuingAudioStream
|
||||
}
|
||||
|
|
|
@ -150,9 +150,9 @@ bool loadAIFFFromStream(Common::SeekableReadStream &stream, int &size, int &rate
|
|||
|
||||
flags = 0;
|
||||
if (bitsPerSample == 16)
|
||||
flags |= Audio::Mixer::FLAG_16BITS;
|
||||
flags |= Audio::FLAG_16BITS;
|
||||
if (numChannels == 2)
|
||||
flags |= Audio::Mixer::FLAG_STEREO;
|
||||
flags |= Audio::FLAG_STEREO;
|
||||
|
||||
stream.seek(soundOffset);
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ AudioStream *make8SVXStream(Common::ReadStream &input, bool loop) {
|
|||
// repeatHiSamples fields
|
||||
loopStart = 0;
|
||||
loopEnd = loader._header.oneShotHiSamples + loader._header.repeatHiSamples;
|
||||
flags |= Audio::Mixer::FLAG_LOOP;
|
||||
flags |= Audio::FLAG_LOOP;
|
||||
}
|
||||
|
||||
return Audio::makeRawMemoryStream((byte *)loader._data, loader._dataSize, DisposeAfterUse::YES, loader._header.samplesPerSec, flags, loopStart, loopEnd);
|
||||
|
|
|
@ -63,32 +63,6 @@ public:
|
|||
*/
|
||||
class Mixer {
|
||||
public:
|
||||
/**
|
||||
* Various flags which can be bit-ORed and then passed to
|
||||
* makeRawMemoryStream and some other AudioStream factories
|
||||
* to control their behavior.
|
||||
*
|
||||
* Engine authors are advised not to rely on a certain value or
|
||||
* order of these flags (in particular, do not store them verbatim
|
||||
* in savestates).
|
||||
*/
|
||||
enum RawFlags {
|
||||
/** unsigned samples (default: signed) */
|
||||
FLAG_UNSIGNED = 1 << 0,
|
||||
|
||||
/** sound is 16 bits wide (default: 8bit) */
|
||||
FLAG_16BITS = 1 << 1,
|
||||
|
||||
/** samples are little endian (default: big endian) */
|
||||
FLAG_LITTLE_ENDIAN = 1 << 2,
|
||||
|
||||
/** sound is in stereo (default: mono) */
|
||||
FLAG_STEREO = 1 << 3,
|
||||
|
||||
/** loop the audio */
|
||||
FLAG_LOOP = 1 << 6
|
||||
};
|
||||
|
||||
enum SoundType {
|
||||
kPlainSoundType = 0,
|
||||
|
||||
|
|
|
@ -331,10 +331,10 @@ bool RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &whe
|
|||
SeekableAudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
|
||||
DisposeAfterUse::Flag autoFree,
|
||||
int rate, byte flags) {
|
||||
const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0;
|
||||
const bool isUnsigned = (flags & Mixer::FLAG_UNSIGNED) != 0;
|
||||
const bool isLE = (flags & Mixer::FLAG_LITTLE_ENDIAN) != 0;
|
||||
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
||||
const bool isUnsigned = (flags & Audio::FLAG_UNSIGNED) != 0;
|
||||
const bool isLE = (flags & Audio::FLAG_LITTLE_ENDIAN) != 0;
|
||||
|
||||
// Verify the buffer sizes are sane
|
||||
if (is16Bit && isStereo) {
|
||||
|
@ -365,9 +365,9 @@ AudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
|
|||
uint loopStart, uint loopEnd) {
|
||||
SeekableAudioStream *stream = makeRawMemoryStream(ptr, len, autoFree, rate, flags);
|
||||
|
||||
const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0;
|
||||
const bool isLooping = (flags & Mixer::FLAG_LOOP) != 0;
|
||||
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
||||
const bool isLooping = (flags & Audio::FLAG_LOOP) != 0;
|
||||
|
||||
if (isLooping) {
|
||||
uint loopOffset = 0, loopLen = 0;
|
||||
|
@ -407,10 +407,10 @@ AudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
|
|||
|
||||
SeekableAudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks,
|
||||
int rate, byte flags, DisposeAfterUse::Flag disposeStream) {
|
||||
const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0;
|
||||
const bool isUnsigned = (flags & Mixer::FLAG_UNSIGNED) != 0;
|
||||
const bool isLE = (flags & Mixer::FLAG_LITTLE_ENDIAN) != 0;
|
||||
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
||||
const bool isUnsigned = (flags & Audio::FLAG_UNSIGNED) != 0;
|
||||
const bool isLE = (flags & Audio::FLAG_LITTLE_ENDIAN) != 0;
|
||||
|
||||
if (isStereo) {
|
||||
if (isUnsigned) {
|
||||
|
@ -431,9 +431,9 @@ AudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStream
|
|||
int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream, uint loopStart, uint loopEnd) {
|
||||
SeekableAudioStream *s = makeRawDiskStream(stream, block, numBlocks, rate, flags, disposeStream);
|
||||
|
||||
const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0;
|
||||
const bool isLooping = (flags & Mixer::FLAG_LOOP) != 0;
|
||||
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
||||
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
||||
const bool isLooping = (flags & Audio::FLAG_LOOP) != 0;
|
||||
|
||||
if (isLooping) {
|
||||
uint loopOffset = 0, loopLen = 0;
|
||||
|
|
27
sound/raw.h
27
sound/raw.h
|
@ -38,6 +38,33 @@ namespace Audio {
|
|||
class AudioStream;
|
||||
class SeekableAudioStream;
|
||||
|
||||
/**
|
||||
* Various flags which can be bit-ORed and then passed to
|
||||
* makeRawMemoryStream and some other AudioStream factories
|
||||
* to control their behavior.
|
||||
*
|
||||
* Engine authors are advised not to rely on a certain value or
|
||||
* order of these flags (in particular, do not store them verbatim
|
||||
* in savestates).
|
||||
*/
|
||||
enum RawFlags {
|
||||
/** unsigned samples (default: signed) */
|
||||
FLAG_UNSIGNED = 1 << 0,
|
||||
|
||||
/** sound is 16 bits wide (default: 8bit) */
|
||||
FLAG_16BITS = 1 << 1,
|
||||
|
||||
/** samples are little endian (default: big endian) */
|
||||
FLAG_LITTLE_ENDIAN = 1 << 2,
|
||||
|
||||
/** sound is in stereo (default: mono) */
|
||||
FLAG_STEREO = 1 << 3,
|
||||
|
||||
/** loop the audio */
|
||||
FLAG_LOOP = 1 << 6
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates a audio stream, which plays the given raw data.
|
||||
*
|
||||
|
|
|
@ -196,18 +196,18 @@ byte *loadShortenFromStream(Common::ReadStream &stream, int &size, int &rate, by
|
|||
case kTypeS8:
|
||||
break;
|
||||
case kTypeU8:
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
break;
|
||||
case kTypeS16LH:
|
||||
flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
case kTypeS16HL:
|
||||
flags |= Audio::Mixer::FLAG_16BITS;
|
||||
flags |= Audio::FLAG_16BITS;
|
||||
break;
|
||||
case kTypeU16LH:
|
||||
flags |= Audio::Mixer::FLAG_LITTLE_ENDIAN;
|
||||
flags |= Audio::FLAG_LITTLE_ENDIAN;
|
||||
case kTypeU16HL:
|
||||
flags |= Audio::Mixer::FLAG_16BITS;
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_16BITS;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
break;
|
||||
case kTypeWAV:
|
||||
// TODO: Perhaps implement this if we find WAV Shorten encoded files
|
||||
|
@ -426,16 +426,16 @@ byte *loadShortenFromStream(Common::ReadStream &stream, int &size, int &rate, by
|
|||
}
|
||||
|
||||
if (curChannel == channels - 1) {
|
||||
int dataSize = (flags & Audio::Mixer::FLAG_16BITS) ? 2 : 1;
|
||||
int limit = (flags & Audio::Mixer::FLAG_16BITS) ? 32767 : 127;
|
||||
limit = (flags & Audio::Mixer::FLAG_UNSIGNED) ? limit * 2 + 1 : limit;
|
||||
int dataSize = (flags & Audio::FLAG_16BITS) ? 2 : 1;
|
||||
int limit = (flags & Audio::FLAG_16BITS) ? 32767 : 127;
|
||||
limit = (flags & Audio::FLAG_UNSIGNED) ? limit * 2 + 1 : limit;
|
||||
|
||||
prevSize = size;
|
||||
size += (blockSize * dataSize);
|
||||
unpackedBuffer = (byte *) realloc(unpackedBuffer, size);
|
||||
pBuf = unpackedBuffer + prevSize;
|
||||
|
||||
if (flags & Audio::Mixer::FLAG_16BITS) {
|
||||
if (flags & Audio::FLAG_16BITS) {
|
||||
for (i = 0; i < blockSize; i++) {
|
||||
for (j = 0; j < channels; j++) {
|
||||
int16 val = (int16)(MIN<int32>(buffer[j][i], limit) & 0xFFFF);
|
||||
|
|
|
@ -119,18 +119,18 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
|
|||
|
||||
flags = 0;
|
||||
if (bitsPerSample == 8) // 8 bit data is unsigned
|
||||
flags |= Audio::Mixer::FLAG_UNSIGNED;
|
||||
flags |= Audio::FLAG_UNSIGNED;
|
||||
else if (bitsPerSample == 16) // 16 bit data is signed little endian
|
||||
flags |= (Audio::Mixer::FLAG_16BITS | Audio::Mixer::FLAG_LITTLE_ENDIAN);
|
||||
flags |= (Audio::FLAG_16BITS | Audio::FLAG_LITTLE_ENDIAN);
|
||||
else if (bitsPerSample == 4 && (type == 2 || type == 17))
|
||||
flags |= Audio::Mixer::FLAG_16BITS;
|
||||
flags |= Audio::FLAG_16BITS;
|
||||
else {
|
||||
warning("getWavInfo: unsupported bitsPerSample %d", bitsPerSample);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (numChannels == 2)
|
||||
flags |= Audio::Mixer::FLAG_STEREO;
|
||||
flags |= Audio::FLAG_STEREO;
|
||||
else if (numChannels != 1) {
|
||||
warning("getWavInfo: unsupported number of channels %d", numChannels);
|
||||
return false;
|
||||
|
@ -175,9 +175,9 @@ RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, Dispose
|
|||
}
|
||||
|
||||
if (type == 17) // MS IMA ADPCM
|
||||
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMSIma, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||
else if (type == 2) // MS ADPCM
|
||||
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMS, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||
|
||||
// Raw PCM. Just read everything at once.
|
||||
// TODO: More elegant would be to wrap the stream.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue