mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 21:21:05 +00:00
Get rid of FLAG_LOOP
svn-id: r47473
This commit is contained in:
parent
b036392a7b
commit
f189cc39fc
@ -95,7 +95,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol,
|
|||||||
_channels[i].pan = pan;
|
_channels[i].pan = pan;
|
||||||
_channels[i].freq = rate;
|
_channels[i].freq = rate;
|
||||||
_channels[i].ctr = 0;
|
_channels[i].ctr = 0;
|
||||||
_channels[i].input = Audio::makeRawMemoryStream_OLD((const byte*)data, size, DisposeAfterUse::YES, rate, (loopStart != loopEnd ? Audio::FLAG_LOOP : 0), loopStart, loopEnd);
|
_channels[i].input = Audio::makeRawMemoryStream_OLD((const byte*)data, size, DisposeAfterUse::YES, rate, 0, loopStart, loopEnd);
|
||||||
// read the first sample
|
// read the first sample
|
||||||
_channels[i].input->readBuffer(&_channels[i].pos, 1);
|
_channels[i].input->readBuffer(&_channels[i].pos, 1);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,6 @@ void Sound::playSound(int soundID) {
|
|||||||
Audio::AudioStream *stream;
|
Audio::AudioStream *stream;
|
||||||
int size = -1;
|
int size = -1;
|
||||||
int rate;
|
int rate;
|
||||||
byte flags = Audio::FLAG_UNSIGNED;
|
|
||||||
|
|
||||||
if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine) {
|
if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine) {
|
||||||
if (soundID >= 13 && soundID <= 32) {
|
if (soundID >= 13 && soundID <= 32) {
|
||||||
@ -204,7 +203,7 @@ void Sound::playSound(int soundID) {
|
|||||||
sound = (byte *)malloc(size);
|
sound = (byte *)malloc(size);
|
||||||
memcpy(sound, ptr, size);
|
memcpy(sound, ptr, size);
|
||||||
|
|
||||||
stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, flags);
|
stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, Audio::FLAG_UNSIGNED);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
|
||||||
}
|
}
|
||||||
// WORKAROUND bug # 1311447
|
// WORKAROUND bug # 1311447
|
||||||
@ -227,7 +226,7 @@ void Sound::playSound(int soundID) {
|
|||||||
// Allocate a sound buffer, copy the data into it, and play
|
// Allocate a sound buffer, copy the data into it, and play
|
||||||
sound = (byte *)malloc(size);
|
sound = (byte *)malloc(size);
|
||||||
memcpy(sound, ptr, size);
|
memcpy(sound, ptr, size);
|
||||||
stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, flags);
|
stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, Audio::FLAG_UNSIGNED);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
|
||||||
}
|
}
|
||||||
// Support for sampled sound effects in Monkey Island 1 and 2
|
// Support for sampled sound effects in Monkey Island 1 and 2
|
||||||
@ -299,7 +298,7 @@ void Sound::playSound(int soundID) {
|
|||||||
// Allocate a sound buffer, copy the data into it, and play
|
// Allocate a sound buffer, copy the data into it, and play
|
||||||
sound = (byte *)malloc(size);
|
sound = (byte *)malloc(size);
|
||||||
memcpy(sound, ptr + 6, size);
|
memcpy(sound, ptr + 6, size);
|
||||||
stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, flags);
|
stream = Audio::makeRawMemoryStream(sound, size, DisposeAfterUse::YES, rate, Audio::FLAG_UNSIGNED);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID);
|
||||||
}
|
}
|
||||||
else if ((_vm->_game.platform == Common::kPlatformFMTowns && _vm->_game.version == 3) || READ_BE_UINT32(ptr) == MKID_BE('SOUN') || READ_BE_UINT32(ptr) == MKID_BE('TOWS')) {
|
else if ((_vm->_game.platform == Common::kPlatformFMTowns && _vm->_game.version == 3) || READ_BE_UINT32(ptr) == MKID_BE('SOUN') || READ_BE_UINT32(ptr) == MKID_BE('TOWS')) {
|
||||||
@ -350,10 +349,7 @@ void Sound::playSound(int soundID) {
|
|||||||
}
|
}
|
||||||
size -= waveSize;
|
size -= waveSize;
|
||||||
|
|
||||||
if (loopEnd > 0)
|
stream = Audio::makeRawMemoryStream_OLD(sound, waveSize, DisposeAfterUse::YES, rate, Audio::FLAG_UNSIGNED, loopStart, loopEnd);
|
||||||
flags |= Audio::FLAG_LOOP;
|
|
||||||
|
|
||||||
stream = Audio::makeRawMemoryStream_OLD(sound, waveSize, DisposeAfterUse::YES, rate, flags, loopStart, loopEnd);
|
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, 255, 0);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, 255, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -426,7 +422,6 @@ void Sound::playSound(int soundID) {
|
|||||||
// offset 26: ? if != 0: stop current sound?
|
// offset 26: ? if != 0: stop current sound?
|
||||||
// offset 27: ? loopcount? 0xff == -1 for infinite?
|
// offset 27: ? loopcount? 0xff == -1 for infinite?
|
||||||
|
|
||||||
flags = 0;
|
|
||||||
size = READ_BE_UINT16(ptr + 12);
|
size = READ_BE_UINT16(ptr + 12);
|
||||||
assert(size);
|
assert(size);
|
||||||
|
|
||||||
@ -442,11 +437,10 @@ void Sound::playSound(int soundID) {
|
|||||||
// so maybe this is not really a problem.
|
// so maybe this is not really a problem.
|
||||||
loopStart = READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8);
|
loopStart = READ_BE_UINT16(ptr + 10) - READ_BE_UINT16(ptr + 8);
|
||||||
loopEnd = READ_BE_UINT16(ptr + 14);
|
loopEnd = READ_BE_UINT16(ptr + 14);
|
||||||
flags |= Audio::FLAG_LOOP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size);
|
memcpy(sound, ptr + READ_BE_UINT16(ptr + 8), size);
|
||||||
stream = Audio::makeRawMemoryStream_OLD(sound, size, DisposeAfterUse::YES, rate, flags, loopStart, loopEnd);
|
stream = Audio::makeRawMemoryStream_OLD(sound, size, DisposeAfterUse::YES, rate, 0, loopStart, loopEnd);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, vol, 0);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, vol, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1111,17 +1111,13 @@ void Sound::playSound(uint16 sound, uint16 volume, uint8 channel) {
|
|||||||
uint32 dataLoop = READ_BE_UINT16(_sfxInfo + (sound << 3) + 6);
|
uint32 dataLoop = READ_BE_UINT16(_sfxInfo + (sound << 3) + 6);
|
||||||
dataOfs += _sfxBaseOfs;
|
dataOfs += _sfxBaseOfs;
|
||||||
|
|
||||||
byte flags = Audio::FLAG_UNSIGNED;
|
|
||||||
|
|
||||||
uint32 loopSta = 0, loopEnd = 0;
|
uint32 loopSta = 0, loopEnd = 0;
|
||||||
if (dataLoop) {
|
if (dataLoop) {
|
||||||
loopSta = dataSize - dataLoop;
|
loopSta = dataSize - dataLoop;
|
||||||
loopEnd = dataSize;
|
loopEnd = dataSize;
|
||||||
flags |= Audio::FLAG_LOOP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Audio::AudioStream *stream = Audio::makeRawMemoryStream_OLD(_soundData + dataOfs, dataSize, DisposeAfterUse::NO, sampleRate, Audio::FLAG_UNSIGNED, loopSta, loopEnd);
|
||||||
Audio::AudioStream *stream = Audio::makeRawMemoryStream_OLD(_soundData + dataOfs, dataSize, DisposeAfterUse::NO, sampleRate, flags, loopSta, loopEnd);
|
|
||||||
|
|
||||||
if (channel == 0)
|
if (channel == 0)
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_ingameSound0, stream, SOUND_CH0, volume, 0);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_ingameSound0, stream, SOUND_CH0, volume, 0);
|
||||||
|
@ -253,7 +253,7 @@ bool SubSeekableAudioStream::seek(const Timestamp &where) {
|
|||||||
|
|
||||||
|
|
||||||
void QueuingAudioStream::queueBuffer(byte *data, uint32 size, DisposeAfterUse::Flag disposeAfterUse, byte flags) {
|
void QueuingAudioStream::queueBuffer(byte *data, uint32 size, DisposeAfterUse::Flag disposeAfterUse, byte flags) {
|
||||||
AudioStream *stream = makeRawMemoryStream_OLD(data, size, disposeAfterUse, getRate(), flags, 0, 0);
|
AudioStream *stream = makeRawMemoryStream(data, size, disposeAfterUse, getRate(), flags);
|
||||||
queueAudioStream(stream, DisposeAfterUse::YES);
|
queueAudioStream(stream, DisposeAfterUse::YES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +365,7 @@ AudioStream *makeRawMemoryStream_OLD(const byte *ptr, uint32 len,
|
|||||||
uint loopStart, uint loopEnd) {
|
uint loopStart, uint loopEnd) {
|
||||||
SeekableAudioStream *s = makeRawMemoryStream(ptr, len, autoFree, rate, flags);
|
SeekableAudioStream *s = makeRawMemoryStream(ptr, len, autoFree, rate, flags);
|
||||||
|
|
||||||
if ((flags & Audio::FLAG_LOOP) != 0) {
|
if (loopStart != loopEnd) {
|
||||||
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
|
||||||
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
|
||||||
|
|
||||||
|
@ -58,10 +58,7 @@ enum RawFlags {
|
|||||||
FLAG_LITTLE_ENDIAN = 1 << 2,
|
FLAG_LITTLE_ENDIAN = 1 << 2,
|
||||||
|
|
||||||
/** sound is in stereo (default: mono) */
|
/** sound is in stereo (default: mono) */
|
||||||
FLAG_STEREO = 1 << 3,
|
FLAG_STEREO = 1 << 3
|
||||||
|
|
||||||
/** loop the audio (deprecated) */
|
|
||||||
FLAG_LOOP = 1 << 6
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user