Moved the AudioCDManager as well as class AudioStream and its (standard) subclasses to namespace Audio
svn-id: r22231
This commit is contained in:
parent
ac0ae13bee
commit
27307acd7c
59 changed files with 203 additions and 134 deletions
|
@ -79,7 +79,7 @@ struct AdlibSoundInstrument {
|
||||||
byte amDepth;
|
byte amDepth;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AdlibSoundDriver : public SoundDriver, AudioStream {
|
class AdlibSoundDriver : public SoundDriver, Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
AdlibSoundDriver(Audio::Mixer *mixer);
|
AdlibSoundDriver(Audio::Mixer *mixer);
|
||||||
virtual ~AdlibSoundDriver();
|
virtual ~AdlibSoundDriver();
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Gob {
|
||||||
|
|
||||||
class GobEngine;
|
class GobEngine;
|
||||||
|
|
||||||
class Music : public AudioStream {
|
class Music : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
Music(GobEngine *vm);
|
Music(GobEngine *vm);
|
||||||
~Music();
|
~Music();
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
// TODO: This is a very primitive square wave generator. The only thing is
|
// TODO: This is a very primitive square wave generator. The only thing is
|
||||||
// has in common with the PC speaker is that it sounds terrible.
|
// has in common with the PC speaker is that it sounds terrible.
|
||||||
class SquareWaveStream : public AudioStream {
|
class SquareWaveStream : public Audio::AudioStream {
|
||||||
private:
|
private:
|
||||||
uint _rate;
|
uint _rate;
|
||||||
bool _beepForever;
|
bool _beepForever;
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
#include "base/engine.h"
|
#include "base/engine.h"
|
||||||
#include "common/rect.h"
|
#include "common/rect.h"
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
|
|
||||||
namespace Kyra {
|
namespace Kyra {
|
||||||
|
|
||||||
class Movie;
|
class Movie;
|
||||||
|
|
|
@ -71,7 +71,7 @@ void Sound::voicePlay(const char *file) {
|
||||||
|
|
||||||
Common::MemoryReadStream vocStream(fileData, fileSize);
|
Common::MemoryReadStream vocStream(fileData, fileSize);
|
||||||
_mixer->stopHandle(_vocHandle);
|
_mixer->stopHandle(_vocHandle);
|
||||||
_currentVocFile = makeVOCStream(vocStream);
|
_currentVocFile = Audio::makeVOCStream(vocStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_currentVocFile)
|
if (_currentVocFile)
|
||||||
|
@ -476,13 +476,13 @@ void KyraEngine::snd_voiceWaitForFinish(bool ingame) {
|
||||||
|
|
||||||
const Sound::SpeechCodecs Sound::_supportedCodes[] = {
|
const Sound::SpeechCodecs Sound::_supportedCodes[] = {
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
{ ".VO3", makeMP3Stream },
|
{ ".VO3", Audio::makeMP3Stream },
|
||||||
#endif // USE_MAD
|
#endif // USE_MAD
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
{ ".VOG", makeVorbisStream },
|
{ ".VOG", Audio::makeVorbisStream },
|
||||||
#endif // USE_VORBIS
|
#endif // USE_VORBIS
|
||||||
#ifdef USE_FLAC
|
#ifdef USE_FLAC
|
||||||
{ ".VOF", makeFlacStream },
|
{ ".VOF", Audio::makeFlacStream },
|
||||||
#endif // USE_FLAC
|
#endif // USE_FLAC
|
||||||
{ 0, 0 }
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,9 +30,8 @@
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
#include "kyra/kyra.h"
|
#include "kyra/kyra.h"
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
|
class AudioStream;
|
||||||
class Mixer;
|
class Mixer;
|
||||||
class SoundHandle;
|
class SoundHandle;
|
||||||
} // end of namespace Audio
|
} // end of namespace Audio
|
||||||
|
@ -68,13 +67,13 @@ protected:
|
||||||
Audio::Mixer *_mixer;
|
Audio::Mixer *_mixer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AudioStream *_currentVocFile;
|
Audio::AudioStream *_currentVocFile;
|
||||||
Audio::SoundHandle _vocHandle;
|
Audio::SoundHandle _vocHandle;
|
||||||
Common::File _compressHandle;
|
Common::File _compressHandle;
|
||||||
|
|
||||||
struct SpeechCodecs {
|
struct SpeechCodecs {
|
||||||
const char *fileext;
|
const char *fileext;
|
||||||
AudioStream *(*streamFunc)(Common::File*, uint32);
|
Audio::AudioStream *(*streamFunc)(Common::File*, uint32);
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SpeechCodecs _supportedCodes[];
|
static const SpeechCodecs _supportedCodes[];
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
namespace Kyra {
|
namespace Kyra {
|
||||||
|
|
||||||
class AdlibDriver : public AudioStream {
|
class AdlibDriver : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
AdlibDriver(Audio::Mixer *mixer);
|
AdlibDriver(Audio::Mixer *mixer);
|
||||||
~AdlibDriver();
|
~AdlibDriver();
|
||||||
|
|
|
@ -207,7 +207,7 @@ bool MP3Sound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
|
||||||
uint32 size;
|
uint32 size;
|
||||||
Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
|
Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
|
||||||
if (f) {
|
if (f) {
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, makeMP3Stream(f, size));
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeMP3Stream(f, size));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -219,7 +219,7 @@ bool OGGSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
|
||||||
uint32 size;
|
uint32 size;
|
||||||
Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
|
Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
|
||||||
if (f) {
|
if (f) {
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, makeVorbisStream(f, size));
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeVorbisStream(f, size));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -231,7 +231,7 @@ bool FLACSound::sfxPlay(const char *name, Audio::SoundHandle *soundHandle) {
|
||||||
uint32 size;
|
uint32 size;
|
||||||
Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
|
Common::File *f = _vm->resource()->giveCompressedSound(name, &size);
|
||||||
if (f) {
|
if (f) {
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, makeFlacStream(f, size));
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, soundHandle, Audio::makeFlacStream(f, size));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -41,18 +41,18 @@ namespace Saga {
|
||||||
#define BUFFER_SIZE 4096
|
#define BUFFER_SIZE 4096
|
||||||
|
|
||||||
struct TrackFormat {
|
struct TrackFormat {
|
||||||
DigitalTrackInfo* (*openTrackFunction)(int);
|
Audio::DigitalTrackInfo* (*openTrackFunction)(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
static const TrackFormat TRACK_FORMATS[] = {
|
static const TrackFormat TRACK_FORMATS[] = {
|
||||||
#ifdef USE_FLAC
|
#ifdef USE_FLAC
|
||||||
{ getFlacTrack },
|
{ Audio::getFlacTrack },
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
{ getVorbisTrack },
|
{ Audio::getVorbisTrack },
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
{ getMP3Track },
|
{ Audio::getMP3Track },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ NULL } // Terminator
|
{ NULL } // Terminator
|
||||||
|
@ -63,7 +63,7 @@ static const TrackFormat TRACK_FORMATS[] = {
|
||||||
// Sword 2, to make it easier to add support for compressed music... but I'll
|
// Sword 2, to make it easier to add support for compressed music... but I'll
|
||||||
// worry about that later.
|
// worry about that later.
|
||||||
|
|
||||||
class RAWInputStream : public AudioStream {
|
class RAWInputStream : public Audio::AudioStream {
|
||||||
private:
|
private:
|
||||||
ResourceContext *_context;
|
ResourceContext *_context;
|
||||||
Common::File *_file;
|
Common::File *_file;
|
||||||
|
@ -374,7 +374,7 @@ bool Music::isPlaying() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Music::play(uint32 resourceId, MusicFlags flags) {
|
void Music::play(uint32 resourceId, MusicFlags flags) {
|
||||||
AudioStream *audioStream = NULL;
|
Audio::AudioStream *audioStream = NULL;
|
||||||
MidiParser *parser;
|
MidiParser *parser;
|
||||||
ResourceContext *context;
|
ResourceContext *context;
|
||||||
byte *resourceData;
|
byte *resourceData;
|
||||||
|
|
|
@ -137,7 +137,7 @@ private:
|
||||||
MidiParser *xmidiParser;
|
MidiParser *xmidiParser;
|
||||||
MidiParser *smfParser;
|
MidiParser *smfParser;
|
||||||
|
|
||||||
DigitalTrackInfo *_track;
|
Audio::DigitalTrackInfo *_track;
|
||||||
|
|
||||||
byte *_midiMusicData;
|
byte *_midiMusicData;
|
||||||
|
|
||||||
|
|
|
@ -137,7 +137,7 @@ void SndRes::playVoice(uint32 resourceId) {
|
||||||
|
|
||||||
bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buffer, bool onlyHeader) {
|
bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buffer, bool onlyHeader) {
|
||||||
byte *soundResource;
|
byte *soundResource;
|
||||||
AudioStream *voxStream;
|
Audio::AudioStream *voxStream;
|
||||||
size_t soundResourceLength;
|
size_t soundResourceLength;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
GameSoundTypes resourceType;
|
GameSoundTypes resourceType;
|
||||||
|
@ -217,7 +217,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
||||||
buffer.buffer = NULL;
|
buffer.buffer = NULL;
|
||||||
free(soundResource);
|
free(soundResource);
|
||||||
} else {
|
} else {
|
||||||
voxStream = makeADPCMStream(&readS, soundResourceLength, kADPCMOki);
|
voxStream = Audio::makeADPCMStream(&readS, soundResourceLength, Audio::kADPCMOki);
|
||||||
buffer.buffer = (byte *)malloc(buffer.size);
|
buffer.buffer = (byte *)malloc(buffer.size);
|
||||||
voxSize = voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2);
|
voxSize = voxStream->readBuffer((int16*)buffer.buffer, soundResourceLength * 2);
|
||||||
if (voxSize != soundResourceLength * 2) {
|
if (voxSize != soundResourceLength * 2) {
|
||||||
|
@ -228,7 +228,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
case kSoundVOC:
|
case kSoundVOC:
|
||||||
data = loadVOCFromStream(readS, size, rate);
|
data = Audio::loadVOCFromStream(readS, size, rate);
|
||||||
if (data) {
|
if (data) {
|
||||||
buffer.frequency = rate;
|
buffer.frequency = rate;
|
||||||
buffer.sampleBits = 8;
|
buffer.sampleBits = 8;
|
||||||
|
@ -246,7 +246,7 @@ bool SndRes::load(ResourceContext *context, uint32 resourceId, SoundBuffer &buff
|
||||||
free(soundResource);
|
free(soundResource);
|
||||||
break;
|
break;
|
||||||
case kSoundWAV:
|
case kSoundWAV:
|
||||||
if (loadWAVFromStream(readS, size, rate, flags)) {
|
if (Audio::loadWAVFromStream(readS, size, rate, flags)) {
|
||||||
buffer.frequency = rate;
|
buffer.frequency = rate;
|
||||||
buffer.sampleBits = 16;
|
buffer.sampleBits = 16;
|
||||||
buffer.stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
|
buffer.stereo = ((flags & Audio::Mixer::FLAG_STEREO) != 0);
|
||||||
|
|
|
@ -1777,7 +1777,7 @@ int ScummEngine_v72he::getSoundResourceSize(int id) {
|
||||||
size = READ_BE_UINT32(ptr + 4);
|
size = READ_BE_UINT32(ptr + 4);
|
||||||
Common::MemoryReadStream stream(ptr, size);
|
Common::MemoryReadStream stream(ptr, size);
|
||||||
|
|
||||||
if (!loadWAVFromStream(stream, size, rate, flags)) {
|
if (!Audio::loadWAVFromStream(stream, size, rate, flags)) {
|
||||||
error("getSoundResourceSize: Not a valid WAV file");
|
error("getSoundResourceSize: Not a valid WAV file");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -538,12 +538,12 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags)
|
||||||
size = READ_LE_UINT32(ptr + 4);
|
size = READ_LE_UINT32(ptr + 4);
|
||||||
Common::MemoryReadStream stream(ptr, size);
|
Common::MemoryReadStream stream(ptr, size);
|
||||||
|
|
||||||
if (!loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
|
if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
|
||||||
error("playHESound: Not a valid WAV file (%d)", soundID);
|
error("playHESound: Not a valid WAV file (%d)", soundID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compType == 17) {
|
if (compType == 17) {
|
||||||
AudioStream *voxStream = makeADPCMStream(&stream, size, kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
Audio::AudioStream *voxStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMSIma, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||||
|
|
||||||
sound = (char *)malloc(size * 4);
|
sound = (char *)malloc(size * 4);
|
||||||
size = voxStream->readBuffer((int16*)sound, size * 2);
|
size = voxStream->readBuffer((int16*)sound, size * 2);
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
ImuseDigiSndMgr::soundStruct *soundHandle;
|
ImuseDigiSndMgr::soundStruct *soundHandle;
|
||||||
Audio::SoundHandle handle;
|
Audio::SoundHandle handle;
|
||||||
AppendableAudioStream *stream;
|
AppendableAudioStream *stream;
|
||||||
AudioStream *stream2;
|
Audio::AudioStream *stream2;
|
||||||
|
|
||||||
Track();
|
Track();
|
||||||
};
|
};
|
||||||
|
@ -106,7 +106,7 @@ private:
|
||||||
void callback();
|
void callback();
|
||||||
void switchToNextRegion(Track *track);
|
void switchToNextRegion(Track *track);
|
||||||
int allocSlot(int priority);
|
int allocSlot(int priority);
|
||||||
void startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority);
|
void startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority);
|
||||||
void selectVolumeGroup(int soundId, int volGroupId);
|
void selectVolumeGroup(int soundId, int volGroupId);
|
||||||
|
|
||||||
int32 getPosInMs(int soundId);
|
int32 getPosInMs(int soundId);
|
||||||
|
@ -135,7 +135,7 @@ public:
|
||||||
|
|
||||||
void setAudioNames(int32 num, char *names);
|
void setAudioNames(int32 num, char *names);
|
||||||
|
|
||||||
void startVoice(int soundId, AudioStream *input);
|
void startVoice(int soundId, Audio::AudioStream *input);
|
||||||
void startVoice(int soundId, const char *soundName);
|
void startVoice(int soundId, const char *soundName);
|
||||||
void startMusic(int soundId, int volume);
|
void startMusic(int soundId, int volume);
|
||||||
void startMusic(const char *soundName, int soundId, int hookId, int volume);
|
void startMusic(const char *soundName, int soundId, int hookId, int volume);
|
||||||
|
|
|
@ -208,7 +208,7 @@ void IMuseDigital::refreshScripts() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMuseDigital::startVoice(int soundId, AudioStream *input) {
|
void IMuseDigital::startVoice(int soundId, Audio::AudioStream *input) {
|
||||||
debug(5, "startVoiceStream(%d)", soundId);
|
debug(5, "startVoiceStream(%d)", soundId);
|
||||||
startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
|
startSound(soundId, "", 0, IMUSE_VOLGRP_VOICE, input, 0, 127, 127);
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, soundStruct *sound) {
|
||||||
int time_constant = ptr[offset];
|
int time_constant = ptr[offset];
|
||||||
offset += 2;
|
offset += 2;
|
||||||
len -= 2;
|
len -= 2;
|
||||||
sound->freq = getSampleRateFromVOCRate(time_constant);
|
sound->freq = Audio::getSampleRateFromVOCRate(time_constant);
|
||||||
sound->region[sound->numRegions].offset = offset;
|
sound->region[sound->numRegions].offset = offset;
|
||||||
sound->region[sound->numRegions].length = len;
|
sound->region[sound->numRegions].length = len;
|
||||||
sound->numRegions++;
|
sound->numRegions++;
|
||||||
|
@ -614,11 +614,11 @@ int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, b
|
||||||
if (!soundHandle->compressedStream) {
|
if (!soundHandle->compressedStream) {
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
if (oggMode)
|
if (oggMode)
|
||||||
soundHandle->compressedStream = makeVorbisStream(cmpFile, len);
|
soundHandle->compressedStream = Audio::makeVorbisStream(cmpFile, len);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
if (!oggMode)
|
if (!oggMode)
|
||||||
soundHandle->compressedStream = makeMP3Stream(cmpFile, len);
|
soundHandle->compressedStream = Audio::makeMP3Stream(cmpFile, len);
|
||||||
#endif
|
#endif
|
||||||
assert(soundHandle->compressedStream);
|
assert(soundHandle->compressedStream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
int type;
|
int type;
|
||||||
int volGroupId;
|
int volGroupId;
|
||||||
int disk;
|
int disk;
|
||||||
AudioStream *compressedStream;
|
Audio::AudioStream *compressedStream;
|
||||||
bool compressed;
|
bool compressed;
|
||||||
char lastFileName[24];
|
char lastFileName[24];
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,7 +67,7 @@ int IMuseDigital::allocSlot(int priority) {
|
||||||
return trackId;
|
return trackId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, AudioStream *input, int hookId, int volume, int priority) {
|
void IMuseDigital::startSound(int soundId, const char *soundName, int soundType, int volGroupId, Audio::AudioStream *input, int hookId, int volume, int priority) {
|
||||||
debug(5, "IMuseDigital::startSound(%d)", soundId);
|
debug(5, "IMuseDigital::startSound(%d)", soundId);
|
||||||
|
|
||||||
int l = allocSlot(priority);
|
int l = allocSlot(priority);
|
||||||
|
|
|
@ -92,7 +92,7 @@ void Player_MOD::startChannel(int id, void *data, int size, int rate, uint8 vol,
|
||||||
_channels[i].vol = vol;
|
_channels[i].vol = vol;
|
||||||
_channels[i].pan = pan;
|
_channels[i].pan = pan;
|
||||||
_channels[i].freq = rate;
|
_channels[i].freq = rate;
|
||||||
_channels[i].input = makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart);
|
_channels[i].input = Audio::makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | (loopStart != loopEnd ? Audio::Mixer::FLAG_LOOP : 0), (const byte*)data, size, loopStart, loopEnd - loopStart);
|
||||||
_channels[i].converter = Audio::makeRateConverter(rate, _mixer->getOutputRate(), false, false);
|
_channels[i].converter = Audio::makeRateConverter(rate, _mixer->getOutputRate(), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace Scumm {
|
||||||
/**
|
/**
|
||||||
* Generic Amiga MOD mixer - provides a 60Hz 'update' routine.
|
* Generic Amiga MOD mixer - provides a 60Hz 'update' routine.
|
||||||
*/
|
*/
|
||||||
class Player_MOD : public AudioStream {
|
class Player_MOD : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
Player_MOD(ScummEngine *scumm);
|
Player_MOD(ScummEngine *scumm);
|
||||||
virtual ~Player_MOD();
|
virtual ~Player_MOD();
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
int8 pan;
|
int8 pan;
|
||||||
uint16 freq;
|
uint16 freq;
|
||||||
Audio::RateConverter *converter;
|
Audio::RateConverter *converter;
|
||||||
AudioStream *input;
|
Audio::AudioStream *input;
|
||||||
};
|
};
|
||||||
|
|
||||||
Audio::Mixer *_mixer;
|
Audio::Mixer *_mixer;
|
||||||
|
|
|
@ -43,7 +43,7 @@ static const int NUMCHANS = 4;
|
||||||
/**
|
/**
|
||||||
* Scumm NES sound/music driver.
|
* Scumm NES sound/music driver.
|
||||||
*/
|
*/
|
||||||
class Player_NES : public AudioStream, public MusicEngine {
|
class Player_NES : public Audio::AudioStream, public MusicEngine {
|
||||||
public:
|
public:
|
||||||
Player_NES(ScummEngine *scumm);
|
Player_NES(ScummEngine *scumm);
|
||||||
virtual ~Player_NES();
|
virtual ~Player_NES();
|
||||||
|
|
|
@ -76,7 +76,7 @@ struct channel_data {
|
||||||
* This simulates the pc speaker sound, which is driven by the 8253 (square
|
* This simulates the pc speaker sound, which is driven by the 8253 (square
|
||||||
* wave generator) and a low-band filter.
|
* wave generator) and a low-band filter.
|
||||||
*/
|
*/
|
||||||
class Player_V2 : public AudioStream, public MusicEngine {
|
class Player_V2 : public Audio::AudioStream, public MusicEngine {
|
||||||
public:
|
public:
|
||||||
Player_V2(ScummEngine *scumm, bool pcjr);
|
Player_V2(ScummEngine *scumm, bool pcjr);
|
||||||
virtual ~Player_V2();
|
virtual ~Player_V2();
|
||||||
|
|
|
@ -871,7 +871,7 @@ void ScummEngine::saveOrLoad(Serializer *s) {
|
||||||
// as AudioCDManager::Status::playing, and MSVC6 has
|
// as AudioCDManager::Status::playing, and MSVC6 has
|
||||||
// a fit with that. This typedef simplifies the notation
|
// a fit with that. This typedef simplifies the notation
|
||||||
// to something MSVC6 can grasp.
|
// to something MSVC6 can grasp.
|
||||||
typedef AudioCDManager::Status AudioCDManager_Status;
|
typedef Audio::AudioCDManager::Status AudioCDManager_Status;
|
||||||
const SaveLoadEntry audioCDEntries[] = {
|
const SaveLoadEntry audioCDEntries[] = {
|
||||||
MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)),
|
MKLINE(AudioCDManager_Status, playing, sleUint32, VER(24)),
|
||||||
MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)),
|
MKLINE(AudioCDManager_Status, track, sleInt32, VER(24)),
|
||||||
|
@ -1140,7 +1140,7 @@ void ScummEngine::saveOrLoad(Serializer *s) {
|
||||||
// Save/load the Audio CD status
|
// Save/load the Audio CD status
|
||||||
//
|
//
|
||||||
if (s->getVersion() >= VER(24)) {
|
if (s->getVersion() >= VER(24)) {
|
||||||
AudioCDManager::Status info;
|
Audio::AudioCDManager::Status info;
|
||||||
if (s->isSaving())
|
if (s->isSaving())
|
||||||
info = AudioCD.getStatus();
|
info = AudioCD.getStatus();
|
||||||
s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
|
s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
|
||||||
|
|
|
@ -1270,7 +1270,7 @@ void SmushPlayer::tryCmpFile(const char *filename) {
|
||||||
if (_compressedFile.isOpen()) {
|
if (_compressedFile.isOpen()) {
|
||||||
int size = _compressedFile.size();
|
int size = _compressedFile.size();
|
||||||
_compressedFileMode = true;
|
_compressedFileMode = true;
|
||||||
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeMP3Stream(&_compressedFile, size));
|
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeMP3Stream(&_compressedFile, size));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1281,7 +1281,7 @@ void SmushPlayer::tryCmpFile(const char *filename) {
|
||||||
if (_compressedFile.isOpen()) {
|
if (_compressedFile.isOpen()) {
|
||||||
int size = _compressedFile.size();
|
int size = _compressedFile.size();
|
||||||
_compressedFileMode = true;
|
_compressedFileMode = true;
|
||||||
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, makeVorbisStream(&_compressedFile, size));
|
_vm->_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_compressedFileSoundHandle, Audio::makeVorbisStream(&_compressedFile, size));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -272,10 +272,10 @@ void Sound::playSound(int soundID) {
|
||||||
// We'd have to add the 'Creative Voice File' header for this, though,
|
// We'd have to add the 'Creative Voice File' header for this, though,
|
||||||
// or make readVOCFromMemory() less strict.
|
// or make readVOCFromMemory() less strict.
|
||||||
|
|
||||||
VocBlockHeader &voc_block_hdr = *(VocBlockHeader *)ptr;
|
Audio::VocBlockHeader &voc_block_hdr = *(Audio::VocBlockHeader *)ptr;
|
||||||
assert(voc_block_hdr.blocktype == 1);
|
assert(voc_block_hdr.blocktype == 1);
|
||||||
size = voc_block_hdr.size[0] + (voc_block_hdr.size[1] << 8) + (voc_block_hdr.size[2] << 16) - 2;
|
size = voc_block_hdr.size[0] + (voc_block_hdr.size[1] << 8) + (voc_block_hdr.size[2] << 16) - 2;
|
||||||
rate = getSampleRateFromVOCRate(voc_block_hdr.sr);
|
rate = Audio::getSampleRateFromVOCRate(voc_block_hdr.sr);
|
||||||
assert(voc_block_hdr.pack == 0);
|
assert(voc_block_hdr.pack == 0);
|
||||||
|
|
||||||
// Allocate a sound buffer, copy the data into it, and play
|
// Allocate a sound buffer, copy the data into it, and play
|
||||||
|
@ -600,29 +600,29 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_soundsPaused && _vm->_mixer->isReady()) {
|
if (!_soundsPaused && _vm->_mixer->isReady()) {
|
||||||
AudioStream *input = NULL;
|
Audio::AudioStream *input = NULL;
|
||||||
|
|
||||||
switch (_soundMode) {
|
switch (_soundMode) {
|
||||||
case kMP3Mode:
|
case kMP3Mode:
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
input = makeMP3Stream(_sfxFile, size);
|
input = Audio::makeMP3Stream(_sfxFile, size);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case kVorbisMode:
|
case kVorbisMode:
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
input = makeVorbisStream(_sfxFile, size);
|
input = Audio::makeVorbisStream(_sfxFile, size);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case kFlacMode:
|
case kFlacMode:
|
||||||
#ifdef USE_FLAC
|
#ifdef USE_FLAC
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
input = makeFlacStream(_sfxFile, size);
|
input = Audio::makeFlacStream(_sfxFile, size);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
input = makeVOCStream(*_sfxFile);
|
input = Audio::makeVOCStream(*_sfxFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!input) {
|
if (!input) {
|
||||||
|
|
|
@ -136,7 +136,7 @@ protected:
|
||||||
* An audio stream to which additional data can be appended on-the-fly.
|
* An audio stream to which additional data can be appended on-the-fly.
|
||||||
* Used by SMUSH and iMuseDigital.
|
* Used by SMUSH and iMuseDigital.
|
||||||
*/
|
*/
|
||||||
class AppendableAudioStream : public AudioStream {
|
class AppendableAudioStream : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
virtual void append(const byte *data, uint32 len) = 0;
|
virtual void append(const byte *data, uint32 len) = 0;
|
||||||
virtual void finish() = 0;
|
virtual void finish() = 0;
|
||||||
|
|
|
@ -187,7 +187,7 @@ void MoviePlayer::startSound() {
|
||||||
_fd.read(buffer, size);
|
_fd.read(buffer, size);
|
||||||
|
|
||||||
Common::MemoryReadStream stream(buffer, size);
|
Common::MemoryReadStream stream(buffer, size);
|
||||||
_bgSoundStream = makeWAVStream(stream);
|
_bgSoundStream = Audio::makeWAVStream(stream);
|
||||||
_mixer->stopHandle(_bgSound);
|
_mixer->stopHandle(_bgSound);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
|
@ -38,7 +38,7 @@ class MoviePlayer {
|
||||||
Audio::Mixer *_mixer;
|
Audio::Mixer *_mixer;
|
||||||
|
|
||||||
Audio::SoundHandle _bgSound;
|
Audio::SoundHandle _bgSound;
|
||||||
AudioStream *_bgSoundStream;
|
Audio::AudioStream *_bgSoundStream;
|
||||||
|
|
||||||
bool _omniTV;
|
bool _omniTV;
|
||||||
bool _playing;
|
bool _playing;
|
||||||
|
|
|
@ -133,7 +133,7 @@ void WavSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
|
||||||
|
|
||||||
byte wavFlags;
|
byte wavFlags;
|
||||||
int size, rate;
|
int size, rate;
|
||||||
if (!loadWAVFromStream(*_file, size, rate, wavFlags)) {
|
if (!Audio::loadWAVFromStream(*_file, size, rate, wavFlags)) {
|
||||||
error("playSound: Not a valid WAV file");
|
error("playSound: Not a valid WAV file");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ void VocSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags) {
|
||||||
_file->seek(_offsets[sound], SEEK_SET);
|
_file->seek(_offsets[sound], SEEK_SET);
|
||||||
|
|
||||||
int size, rate;
|
int size, rate;
|
||||||
byte *buffer = loadVOCFromStream(*_file, size, rate);
|
byte *buffer = Audio::loadVOCFromStream(*_file, size, rate);
|
||||||
_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
|
_mixer->playRaw(handle, buffer, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ void MP3Sound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
|
||||||
|
|
||||||
uint32 size = _offsets[sound + i] - _offsets[sound];
|
uint32 size = _offsets[sound + i] - _offsets[sound];
|
||||||
|
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeMP3Stream(_file, size));
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeMP3Stream(_file, size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void VorbisSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
|
||||||
|
|
||||||
uint32 size = _offsets[sound + i] - _offsets[sound];
|
uint32 size = _offsets[sound + i] - _offsets[sound];
|
||||||
|
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeVorbisStream(_file, size));
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeVorbisStream(_file, size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ void FlacSound::playSound(uint sound, Audio::SoundHandle *handle, byte flags)
|
||||||
|
|
||||||
uint32 size = _offsets[sound + i] - _offsets[sound];
|
uint32 size = _offsets[sound + i] - _offsets[sound];
|
||||||
|
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, makeFlacStream(_file, size));
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, handle, Audio::makeFlacStream(_file, size));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun
|
||||||
|
|
||||||
int size = READ_LE_UINT32(soundData + 4);
|
int size = READ_LE_UINT32(soundData + 4);
|
||||||
Common::MemoryReadStream stream(soundData, size);
|
Common::MemoryReadStream stream(soundData, size);
|
||||||
if (!loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
|
if (!Audio::loadWAVFromStream(stream, size, rate, flags, &compType, &blockAlign)) {
|
||||||
error("playSoundData: Not a valid WAV data");
|
error("playSoundData: Not a valid WAV data");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ void Sound::playSoundData(Audio::SoundHandle *handle, byte *soundData, uint soun
|
||||||
flags |= Audio::Mixer::FLAG_LOOP;
|
flags |= Audio::Mixer::FLAG_LOOP;
|
||||||
|
|
||||||
if (compType == 2) {
|
if (compType == 2) {
|
||||||
AudioStream *sndStream = makeADPCMStream(&stream, size, kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
Audio::AudioStream *sndStream = Audio::makeADPCMStream(&stream, size, Audio::kADPCMMS, rate, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1, blockAlign);
|
||||||
buffer = (byte *)malloc(size * 4);
|
buffer = (byte *)malloc(size * 4);
|
||||||
size = sndStream->readBuffer((int16*)buffer, size * 2);
|
size = sndStream->readBuffer((int16*)buffer, size * 2);
|
||||||
size *= 2; // 16bits.
|
size *= 2; // 16bits.
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Audio {
|
||||||
|
|
||||||
namespace Sky {
|
namespace Sky {
|
||||||
|
|
||||||
class AdlibMusic : public AudioStream, public MusicBase {
|
class AdlibMusic : public Audio::AudioStream, public MusicBase {
|
||||||
public:
|
public:
|
||||||
AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk);
|
AdlibMusic(Audio::Mixer *pMixer, Disk *pDisk);
|
||||||
~AdlibMusic(void);
|
~AdlibMusic(void);
|
||||||
|
|
|
@ -74,11 +74,11 @@ bool AnimationState::soundFinished(void) {
|
||||||
return !_snd->isSoundHandleActive(_bgSound);
|
return !_snd->isSoundHandleActive(_bgSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStream *AnimationState::createAudioStream(const char *name, void *arg) {
|
Audio::AudioStream *AnimationState::createAudioStream(const char *name, void *arg) {
|
||||||
if (arg)
|
if (arg)
|
||||||
return (AudioStream*)arg;
|
return (Audio::AudioStream*)arg;
|
||||||
else
|
else
|
||||||
return AudioStream::openStreamFile(name);
|
return Audio::AudioStream::openStreamFile(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoviePlayer::MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys)
|
MoviePlayer::MoviePlayer(Screen *scr, Audio::Mixer *snd, OSystem *sys)
|
||||||
|
@ -103,7 +103,7 @@ MoviePlayer::~MoviePlayer(void) {
|
||||||
void MoviePlayer::play(uint32 id) {
|
void MoviePlayer::play(uint32 id) {
|
||||||
#if defined(USE_MPEG2) && defined(USE_VORBIS)
|
#if defined(USE_MPEG2) && defined(USE_VORBIS)
|
||||||
AnimationState *anim = new AnimationState(_scr, _snd, _sys);
|
AnimationState *anim = new AnimationState(_scr, _snd, _sys);
|
||||||
AudioStream *stream = NULL;
|
Audio::AudioStream *stream = NULL;
|
||||||
if (SwordEngine::_systemVars.cutscenePackVersion == 1) {
|
if (SwordEngine::_systemVars.cutscenePackVersion == 1) {
|
||||||
if ((id == SEQ_INTRO) || (id == SEQ_FINALE) || (id == SEQ_HISTORY) || (id == SEQ_FERRARI)) {
|
if ((id == SEQ_INTRO) || (id == SEQ_FINALE) || (id == SEQ_HISTORY) || (id == SEQ_FERRARI)) {
|
||||||
// these sequences are language specific
|
// these sequences are language specific
|
||||||
|
@ -120,7 +120,7 @@ void MoviePlayer::play(uint32 id) {
|
||||||
for (uint32 segCnt = 0; segCnt < numSegs; segCnt++) {
|
for (uint32 segCnt = 0; segCnt < numSegs; segCnt++) {
|
||||||
oggSource->seek( header[SwordEngine::_systemVars.language * 2 + 0 + segCnt * 14]);
|
oggSource->seek( header[SwordEngine::_systemVars.language * 2 + 0 + segCnt * 14]);
|
||||||
uint32 segSize = header[SwordEngine::_systemVars.language * 2 + 1 + segCnt * 14];
|
uint32 segSize = header[SwordEngine::_systemVars.language * 2 + 1 + segCnt * 14];
|
||||||
AudioStream *apStream = makeVorbisStream(oggSource, segSize);
|
Audio::AudioStream *apStream = Audio::makeVorbisStream(oggSource, segSize);
|
||||||
if (!apStream)
|
if (!apStream)
|
||||||
error("Can't create Vorbis Stream from file %s", sndName);
|
error("Can't create Vorbis Stream from file %s", sndName);
|
||||||
sStream->appendStream(apStream);
|
sStream->appendStream(apStream);
|
||||||
|
@ -240,7 +240,7 @@ int SplittedAudioStream::getRate(void) const {
|
||||||
return 22050;
|
return 22050;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SplittedAudioStream::appendStream(AudioStream *stream) {
|
void SplittedAudioStream::appendStream(Audio::AudioStream *stream) {
|
||||||
FileQueue **que = &_queue;
|
FileQueue **que = &_queue;
|
||||||
while (*que)
|
while (*que)
|
||||||
que = &((*que)->next);
|
que = &((*que)->next);
|
||||||
|
|
|
@ -76,7 +76,7 @@ private:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual AudioStream *createAudioStream(const char *name, void *arg);
|
virtual Audio::AudioStream *createAudioStream(const char *name, void *arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
class MoviePlayer {
|
class MoviePlayer {
|
||||||
|
@ -98,15 +98,15 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FileQueue {
|
struct FileQueue {
|
||||||
AudioStream *stream;
|
Audio::AudioStream *stream;
|
||||||
FileQueue *next;
|
FileQueue *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SplittedAudioStream : public AudioStream {
|
class SplittedAudioStream : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
SplittedAudioStream(void);
|
SplittedAudioStream(void);
|
||||||
~SplittedAudioStream(void);
|
~SplittedAudioStream(void);
|
||||||
void appendStream(AudioStream *stream);
|
void appendStream(Audio::AudioStream *stream);
|
||||||
virtual int readBuffer(int16 *buffer, const int numSamples);
|
virtual int readBuffer(int16 *buffer, const int numSamples);
|
||||||
virtual bool isStereo(void) const;
|
virtual bool isStereo(void) const;
|
||||||
virtual bool endOfData(void) const;
|
virtual bool endOfData(void) const;
|
||||||
|
|
|
@ -86,7 +86,7 @@ bool spaceInBuf(uint16 blitSta, uint16 blitEnd, uint16 renderDest) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreditsPlayer::play(void) {
|
void CreditsPlayer::play(void) {
|
||||||
AudioStream *bgSoundStream = AudioStream::openStreamFile("credits");
|
Audio::AudioStream *bgSoundStream = Audio::AudioStream::openStreamFile("credits");
|
||||||
if (bgSoundStream == NULL) {
|
if (bgSoundStream == NULL) {
|
||||||
warning("\"credits.ogg\" not found, skipping credits sequence");
|
warning("\"credits.ogg\" not found, skipping credits sequence");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -47,7 +47,7 @@ WaveAudioStream::WaveAudioStream(Common::File *source, uint32 pSize) {
|
||||||
_sourceFile = source;
|
_sourceFile = source;
|
||||||
_sampleBuf = (uint8*)malloc(SMP_BUFSIZE);
|
_sampleBuf = (uint8*)malloc(SMP_BUFSIZE);
|
||||||
_sourceFile->incRef();
|
_sourceFile->incRef();
|
||||||
if (_sourceFile->isOpen() && loadWAVFromStream(*_sourceFile, size, rate, flags)) {
|
if (_sourceFile->isOpen() && Audio::loadWAVFromStream(*_sourceFile, size, rate, flags)) {
|
||||||
_isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0;
|
_isStereo = (flags & Audio::Mixer::FLAG_STEREO) != 0;
|
||||||
_rate = rate;
|
_rate = rate;
|
||||||
if (pSize && (int)pSize < size)
|
if (pSize && (int)pSize < size)
|
||||||
|
@ -107,16 +107,16 @@ bool WaveAudioStream::endOfData(void) const {
|
||||||
// These functions are only called from Music, so I'm just going to
|
// These functions are only called from Music, so I'm just going to
|
||||||
// assume that if locking is needed it has already been taken care of.
|
// assume that if locking is needed it has already been taken care of.
|
||||||
|
|
||||||
AudioStream *MusicHandle::createAudioSource(void) {
|
Audio::AudioStream *MusicHandle::createAudioSource(void) {
|
||||||
_file.seek(0);
|
_file.seek(0);
|
||||||
switch (_musicMode) {
|
switch (_musicMode) {
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
case MusicMp3:
|
case MusicMp3:
|
||||||
return makeMP3Stream(&_file, _file.size());
|
return Audio::makeMP3Stream(&_file, _file.size());
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
case MusicVorbis:
|
case MusicVorbis:
|
||||||
return makeVorbisStream(&_file, _file.size());
|
return Audio::makeVorbisStream(&_file, _file.size());
|
||||||
#endif
|
#endif
|
||||||
case MusicWave:
|
case MusicWave:
|
||||||
return makeWaveStream(&_file, 0);
|
return makeWaveStream(&_file, 0);
|
||||||
|
|
|
@ -44,7 +44,7 @@ enum MusicMode {
|
||||||
MusicVorbis
|
MusicVorbis
|
||||||
};
|
};
|
||||||
|
|
||||||
class WaveAudioStream : public AudioStream {
|
class WaveAudioStream : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
WaveAudioStream(Common::File *source, uint32 pSize);
|
WaveAudioStream(Common::File *source, uint32 pSize);
|
||||||
virtual ~WaveAudioStream();
|
virtual ~WaveAudioStream();
|
||||||
|
@ -61,15 +61,15 @@ private:
|
||||||
uint16 _bitsPerSample;
|
uint16 _bitsPerSample;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MusicHandle : public AudioStream {
|
class MusicHandle : public Audio::AudioStream {
|
||||||
private:
|
private:
|
||||||
Common::File _file;
|
Common::File _file;
|
||||||
bool _looping;
|
bool _looping;
|
||||||
int32 _fading;
|
int32 _fading;
|
||||||
int32 _fadeSamples;
|
int32 _fadeSamples;
|
||||||
MusicMode _musicMode;
|
MusicMode _musicMode;
|
||||||
AudioStream *_audioSource;
|
Audio::AudioStream *_audioSource;
|
||||||
AudioStream *createAudioSource(void);
|
Audio::AudioStream *createAudioSource(void);
|
||||||
public:
|
public:
|
||||||
MusicHandle() : _looping(false), _fading(0), _audioSource(NULL) {}
|
MusicHandle() : _looping(false), _fading(0), _audioSource(NULL) {}
|
||||||
virtual int readBuffer(int16 *buffer, const int numSamples);
|
virtual int readBuffer(int16 *buffer, const int numSamples);
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
int getRate() const;
|
int getRate() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Music : public AudioStream {
|
class Music : public Audio::AudioStream {
|
||||||
public:
|
public:
|
||||||
Music(Audio::Mixer *pMixer);
|
Music(Audio::Mixer *pMixer);
|
||||||
~Music();
|
~Music();
|
||||||
|
|
|
@ -201,7 +201,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
else if (_cowMode == CowMp3) {
|
else if (_cowMode == CowMp3) {
|
||||||
_cowFile.seek(index);
|
_cowFile.seek(index);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, Audio::makeMP3Stream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||||
// with compressed audio, we can't calculate the wave volume.
|
// with compressed audio, we can't calculate the wave volume.
|
||||||
// so default to talking.
|
// so default to talking.
|
||||||
for (int cnt = 0; cnt < 480; cnt++)
|
for (int cnt = 0; cnt < 480; cnt++)
|
||||||
|
@ -212,7 +212,7 @@ bool Sound::startSpeech(uint16 roomNo, uint16 localNo) {
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
else if (_cowMode == CowVorbis) {
|
else if (_cowMode == CowVorbis) {
|
||||||
_cowFile.seek(index);
|
_cowFile.seek(index);
|
||||||
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_speechHandle, Audio::makeVorbisStream(&_cowFile, sampleSize), SOUND_SPEECH_ID, speechVol, speechPan);
|
||||||
for (int cnt = 0; cnt < 480; cnt++)
|
for (int cnt = 0; cnt < 480; cnt++)
|
||||||
_waveVolume[cnt] = true;
|
_waveVolume[cnt] = true;
|
||||||
_waveVolPos = 0;
|
_waveVolPos = 0;
|
||||||
|
|
|
@ -43,9 +43,9 @@
|
||||||
|
|
||||||
namespace Sword2 {
|
namespace Sword2 {
|
||||||
|
|
||||||
static AudioStream *makeCLUStream(Common::File *fp, int size);
|
static Audio::AudioStream *makeCLUStream(Common::File *fp, int size);
|
||||||
|
|
||||||
static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) {
|
static Audio::AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd, uint32 id, uint32 *numSamples) {
|
||||||
debug(3, "Playing %s from CD %d", base, cd);
|
debug(3, "Playing %s from CD %d", base, cd);
|
||||||
|
|
||||||
if (!fh->file.isOpen()) {
|
if (!fh->file.isOpen()) {
|
||||||
|
@ -139,15 +139,15 @@ static AudioStream *getAudioStream(SoundFileHandle *fh, const char *base, int cd
|
||||||
return makeCLUStream(&fh->file, enc_len);
|
return makeCLUStream(&fh->file, enc_len);
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
case kMP3Mode:
|
case kMP3Mode:
|
||||||
return makeMP3Stream(&fh->file, enc_len);
|
return Audio::makeMP3Stream(&fh->file, enc_len);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
case kVorbisMode:
|
case kVorbisMode:
|
||||||
return makeVorbisStream(&fh->file, enc_len);
|
return Audio::makeVorbisStream(&fh->file, enc_len);
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_FLAC
|
#ifdef USE_FLAC
|
||||||
case kFlacMode:
|
case kFlacMode:
|
||||||
return makeFlacStream(&fh->file, enc_len);
|
return Audio::makeFlacStream(&fh->file, enc_len);
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -232,7 +232,7 @@ void CLUInputStream::refill() {
|
||||||
_bufferEnd = out;
|
_bufferEnd = out;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStream *makeCLUStream(Common::File *file, int size) {
|
Audio::AudioStream *makeCLUStream(Common::File *file, int size) {
|
||||||
return new CLUInputStream(file, size);
|
return new CLUInputStream(file, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,7 +718,7 @@ uint32 Sound::preFetchCompSpeech(uint32 speechId, uint16 **buf) {
|
||||||
|
|
||||||
SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1];
|
SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1];
|
||||||
|
|
||||||
AudioStream *input = getAudioStream(fh, "speech", cd, speechId, &numSamples);
|
Audio::AudioStream *input = getAudioStream(fh, "speech", cd, speechId, &numSamples);
|
||||||
|
|
||||||
if (!input)
|
if (!input)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -762,7 +762,7 @@ int32 Sound::playCompSpeech(uint32 speechId, uint8 vol, int8 pan) {
|
||||||
int cd = _vm->_resman->getCD();
|
int cd = _vm->_resman->getCD();
|
||||||
SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1];
|
SoundFileHandle *fh = (cd == 1) ? &_speechFile[0] : &_speechFile[1];
|
||||||
|
|
||||||
AudioStream *input = getAudioStream(fh, "speech", cd, speechId, NULL);
|
Audio::AudioStream *input = getAudioStream(fh, "speech", cd, speechId, NULL);
|
||||||
|
|
||||||
if (!input)
|
if (!input)
|
||||||
return RDERR_INVALIDID;
|
return RDERR_INVALIDID;
|
||||||
|
|
|
@ -265,7 +265,7 @@ int32 Sound::playFx(Audio::SoundHandle *handle, byte *data, uint32 len, uint8 vo
|
||||||
int rate, size;
|
int rate, size;
|
||||||
byte flags;
|
byte flags;
|
||||||
|
|
||||||
if (!loadWAVFromStream(stream, size, rate, flags)) {
|
if (!Audio::loadWAVFromStream(stream, size, rate, flags)) {
|
||||||
warning("playFX: Not a valid WAV file");
|
warning("playFX: Not a valid WAV file");
|
||||||
return RDERR_INVALIDWAV;
|
return RDERR_INVALIDWAV;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ enum {
|
||||||
RDSE_SPEAKING = 0
|
RDSE_SPEAKING = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
class CLUInputStream : public AudioStream {
|
class CLUInputStream : public Audio::AudioStream {
|
||||||
private:
|
private:
|
||||||
Common::File *_file;
|
Common::File *_file;
|
||||||
bool _firstTime;
|
bool _firstTime;
|
||||||
|
@ -118,12 +118,12 @@ struct SoundFileHandle {
|
||||||
volatile bool inUse;
|
volatile bool inUse;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MusicInputStream : public AudioStream {
|
class MusicInputStream : public Audio::AudioStream {
|
||||||
private:
|
private:
|
||||||
int _cd;
|
int _cd;
|
||||||
SoundFileHandle *_fh;
|
SoundFileHandle *_fh;
|
||||||
uint32 _musicId;
|
uint32 _musicId;
|
||||||
AudioStream *_decoder;
|
Audio::AudioStream *_decoder;
|
||||||
int16 _buffer[BUFFER_SIZE];
|
int16 _buffer[BUFFER_SIZE];
|
||||||
const int16 *_bufferEnd;
|
const int16 *_bufferEnd;
|
||||||
const int16 *_pos;
|
const int16 *_pos;
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
int32 getTimeRemaining();
|
int32 getTimeRemaining();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Sound : public AudioStream {
|
class Sound : public Audio::AudioStream {
|
||||||
private:
|
private:
|
||||||
Sword2Engine *_vm;
|
Sword2Engine *_vm;
|
||||||
|
|
||||||
|
|
|
@ -155,8 +155,8 @@ bool BaseAnimationState::init(const char *name, void *audioArg) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStream *BaseAnimationState::createAudioStream(const char *name, void *arg) {
|
Audio::AudioStream *BaseAnimationState::createAudioStream(const char *name, void *arg) {
|
||||||
return AudioStream::openStreamFile(name);
|
return Audio::AudioStream::openStreamFile(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseAnimationState::decodeFrame() {
|
bool BaseAnimationState::decodeFrame() {
|
||||||
|
|
|
@ -26,7 +26,9 @@
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
class AudioStream;
|
namespace Audio {
|
||||||
|
class AudioStream;
|
||||||
|
}
|
||||||
|
|
||||||
// Uncomment this if you are using libmpeg2 0.3.1.
|
// Uncomment this if you are using libmpeg2 0.3.1.
|
||||||
// #define USE_MPEG2_0_3_1
|
// #define USE_MPEG2_0_3_1
|
||||||
|
@ -91,7 +93,7 @@ protected:
|
||||||
Common::File *_mpegFile;
|
Common::File *_mpegFile;
|
||||||
|
|
||||||
Audio::SoundHandle _bgSound;
|
Audio::SoundHandle _bgSound;
|
||||||
AudioStream *_bgSoundStream;
|
Audio::AudioStream *_bgSoundStream;
|
||||||
|
|
||||||
#ifdef BACKEND_8BIT
|
#ifdef BACKEND_8BIT
|
||||||
int _palNum;
|
int _palNum;
|
||||||
|
@ -132,7 +134,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool checkPaletteSwitch();
|
bool checkPaletteSwitch();
|
||||||
virtual void drawYUV(int width, int height, byte *const *dat) = 0;
|
virtual void drawYUV(int width, int height, byte *const *dat) = 0;
|
||||||
virtual AudioStream *createAudioStream(const char *name, void *arg);
|
virtual Audio::AudioStream *createAudioStream(const char *name, void *arg);
|
||||||
|
|
||||||
#ifdef BACKEND_8BIT
|
#ifdef BACKEND_8BIT
|
||||||
void buildLookup(int p, int lines);
|
void buildLookup(int p, int lines);
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "sound/audiostream.h"
|
#include "sound/audiostream.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
// TODO: Switch from a SeekableReadStream to a plain ReadStream. This requires
|
// TODO: Switch from a SeekableReadStream to a plain ReadStream. This requires
|
||||||
// some internal refactoring but is definitely possible and will increase the
|
// some internal refactoring but is definitely possible and will increase the
|
||||||
// flexibility of this code.
|
// flexibility of this code.
|
||||||
|
@ -353,3 +355,5 @@ int16 ADPCMInputStream::decodeMS(ADPCMChannelStatus *c, byte code) {
|
||||||
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) {
|
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate, int channels, uint32 blockAlign) {
|
||||||
return new ADPCMInputStream(stream, size, type, rate, channels, blockAlign);
|
return new ADPCMInputStream(stream, size, type, rate, channels, blockAlign);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
#include "common/stream.h"
|
#include "common/stream.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
class AudioStream;
|
class AudioStream;
|
||||||
|
|
||||||
enum typesADPCM {
|
enum typesADPCM {
|
||||||
|
@ -37,5 +40,6 @@ enum typesADPCM {
|
||||||
|
|
||||||
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate = 22050, int channels = 2, uint32 blockAlign = 0);
|
AudioStream *makeADPCMStream(Common::SeekableReadStream *stream, uint32 size, typesADPCM type, int rate = 22050, int channels = 2, uint32 blockAlign = 0);
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "common/util.h"
|
#include "common/util.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
struct TrackFormat {
|
struct TrackFormat {
|
||||||
/** Decodername */
|
/** Decodername */
|
||||||
const char* decoderName;
|
const char* decoderName;
|
||||||
|
@ -165,3 +167,5 @@ int AudioCDManager::getCachedTrack(int track) {
|
||||||
debug(2, "Track %d not available in compressed format", track);
|
debug(2, "Track %d not available in compressed format", track);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
class DigitalTrackInfo {
|
class DigitalTrackInfo {
|
||||||
public:
|
public:
|
||||||
virtual bool error() = 0;
|
virtual bool error() = 0;
|
||||||
|
@ -82,6 +85,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Shortcut for accessing the audio CD manager. */
|
/** Shortcut for accessing the audio CD manager. */
|
||||||
#define AudioCD AudioCDManager::instance()
|
#define AudioCD Audio::AudioCDManager::instance()
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
#include "sound/vorbis.h"
|
#include "sound/vorbis.h"
|
||||||
#include "sound/flac.h"
|
#include "sound/flac.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
struct StreamFileFormat {
|
struct StreamFileFormat {
|
||||||
/** Decodername */
|
/** Decodername */
|
||||||
const char* decoderName;
|
const char* decoderName;
|
||||||
|
@ -209,3 +212,6 @@ AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic input stream for the resampling code.
|
* Generic input stream for the resampling code.
|
||||||
*/
|
*/
|
||||||
|
@ -116,11 +118,10 @@ AudioStream *makeLinearInputStream(int rate, byte flags, const byte *ptr, uint32
|
||||||
// us to go with the macro approach. So far this is
|
// us to go with the macro approach. So far this is
|
||||||
// the only template function that MSVC6 seemed to
|
// the only template function that MSVC6 seemed to
|
||||||
// compile incorrectly. Knock on wood.
|
// compile incorrectly. Knock on wood.
|
||||||
#define READSAMPLE(is16Bit, isUnsigned, ptr) \
|
|
||||||
((is16Bit ? READ_BE_UINT16(ptr) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0))
|
|
||||||
|
|
||||||
#define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE) \
|
#define READ_ENDIAN_SAMPLE(is16Bit, isUnsigned, ptr, isLE) \
|
||||||
((is16Bit ? (isLE ? READ_LE_UINT16(ptr) : READ_BE_UINT16(ptr)) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0))
|
((is16Bit ? (isLE ? READ_LE_UINT16(ptr) : READ_BE_UINT16(ptr)) : (*ptr << 8)) ^ (isUnsigned ? 0x8000 : 0))
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
using Common::File;
|
using Common::File;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark --- Flac stream ---
|
#pragma mark --- Flac stream ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -849,4 +851,6 @@ AudioStream *makeFlacStream(File *file, uint32 length)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif // #ifdef USE_FLAC
|
#endif // #ifdef USE_FLAC
|
||||||
|
|
|
@ -28,12 +28,15 @@
|
||||||
|
|
||||||
#ifdef USE_FLAC
|
#ifdef USE_FLAC
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
class DigitalTrackInfo;
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
class File;
|
class File;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
|
class AudioStream;
|
||||||
|
class DigitalTrackInfo;
|
||||||
|
|
||||||
DigitalTrackInfo *getFlacTrack(int track);
|
DigitalTrackInfo *getFlacTrack(int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,5 +47,7 @@ DigitalTrackInfo *getFlacTrack(int track);
|
||||||
*/
|
*/
|
||||||
AudioStream *makeFlacStream(Common::File *file, uint32 size);
|
AudioStream *makeFlacStream(Common::File *file, uint32 size);
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif // #ifdef USE_FLAC
|
#endif // #ifdef USE_FLAC
|
||||||
#endif // #ifndef SOUND_FLAC_H
|
#endif // #ifndef SOUND_FLAC_H
|
||||||
|
|
|
@ -29,12 +29,12 @@
|
||||||
#include "common/mutex.h"
|
#include "common/mutex.h"
|
||||||
|
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
|
|
||||||
|
class AudioStream;
|
||||||
class Channel;
|
class Channel;
|
||||||
class Mixer;
|
class Mixer;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
using Common::File;
|
using Common::File;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark --- MP3 (MAD) stream ---
|
#pragma mark --- MP3 (MAD) stream ---
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -487,4 +489,6 @@ DigitalTrackInfo *getMP3Track(int track) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
} // End of namespace Audio
|
||||||
|
|
||||||
|
#endif // #ifdef USE_MAD
|
||||||
|
|
12
sound/mp3.h
12
sound/mp3.h
|
@ -28,12 +28,15 @@
|
||||||
|
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
class DigitalTrackInfo;
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
class File;
|
class File;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
|
class AudioStream;
|
||||||
|
class DigitalTrackInfo;
|
||||||
|
|
||||||
DigitalTrackInfo *getMP3Track(int track);
|
DigitalTrackInfo *getMP3Track(int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +47,7 @@ DigitalTrackInfo *getMP3Track(int track);
|
||||||
*/
|
*/
|
||||||
AudioStream *makeMP3Stream(Common::File *file, uint32 size);
|
AudioStream *makeMP3Stream(Common::File *file, uint32 size);
|
||||||
|
|
||||||
#endif
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif // #ifdef USE_MAD
|
||||||
|
#endif // #ifndef SOUND_MP3_H
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#define FIXP_SHIFT 16
|
#define FIXP_SHIFT 16
|
||||||
|
|
||||||
class MidiDriver_Emulated : public AudioStream, public MidiDriver {
|
class MidiDriver_Emulated : public Audio::AudioStream, public MidiDriver {
|
||||||
protected:
|
protected:
|
||||||
bool _isOpen;
|
bool _isOpen;
|
||||||
Audio::Mixer *_mixer;
|
Audio::Mixer *_mixer;
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "sound/voc.h"
|
#include "sound/voc.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
int getSampleRateFromVOCRate(int vocSR) {
|
int getSampleRateFromVOCRate(int vocSR) {
|
||||||
if (vocSR == 0xa5 || vocSR == 0xa6) {
|
if (vocSR == 0xa5 || vocSR == 0xa6) {
|
||||||
return 11025;
|
return 11025;
|
||||||
|
@ -140,3 +142,5 @@ AudioStream *makeVOCStream(Common::ReadStream &stream) {
|
||||||
return makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, data, size, 0, 0);
|
return makeLinearInputStream(rate, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, data, size, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
|
@ -27,9 +27,13 @@
|
||||||
#include "common/stdafx.h"
|
#include "common/stdafx.h"
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
namespace Common { class ReadStream; }
|
namespace Common { class ReadStream; }
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
|
class AudioStream;
|
||||||
|
|
||||||
|
|
||||||
#if !defined(__GNUC__)
|
#if !defined(__GNUC__)
|
||||||
#pragma START_PACK_STRUCTS
|
#pragma START_PACK_STRUCTS
|
||||||
#endif
|
#endif
|
||||||
|
@ -81,4 +85,6 @@ extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate)
|
||||||
*/
|
*/
|
||||||
AudioStream *makeVOCStream(Common::ReadStream &stream);
|
AudioStream *makeVOCStream(Common::ReadStream &stream);
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,6 +44,8 @@
|
||||||
using Common::File;
|
using Common::File;
|
||||||
|
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
static AudioStream *makeVorbisStream(OggVorbis_File *file, int duration);
|
static AudioStream *makeVorbisStream(OggVorbis_File *file, int duration);
|
||||||
|
|
||||||
#pragma mark -
|
#pragma mark -
|
||||||
|
@ -134,7 +136,7 @@ static int seek_wrap(void *datasource, ogg_int64_t offset, int whence) {
|
||||||
f->curr_pos = f->file->pos() - f->start;
|
f->curr_pos = f->file->pos() - f->start;
|
||||||
|
|
||||||
#ifdef __SYMBIAN32__
|
#ifdef __SYMBIAN32__
|
||||||
// For symbian we now store the last read position and then close the file
|
// For symbian we now store the last read position and then close the file
|
||||||
if (f->file) {
|
if (f->file) {
|
||||||
f->file->close();
|
f->file->close();
|
||||||
}
|
}
|
||||||
|
@ -208,7 +210,7 @@ bool VorbisTrackInfo::openTrack() {
|
||||||
#ifndef __SYMBIAN32__
|
#ifndef __SYMBIAN32__
|
||||||
_file->incRef();
|
_file->incRef();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -233,7 +235,7 @@ void VorbisTrackInfo::play(Audio::Mixer *mixer, Audio::SoundHandle *handle, int
|
||||||
ov_time_seek(&_ov_file, (ogg_int64_t)(startFrame / 75.0 * 1000));
|
ov_time_seek(&_ov_file, (ogg_int64_t)(startFrame / 75.0 * 1000));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
ov_time_seek(&_ov_file, startFrame / 75.0);
|
ov_time_seek(&_ov_file, startFrame / 75.0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75);
|
AudioStream *input = makeVorbisStream(&_ov_file, duration * ov_info(&_ov_file, -1)->rate / 75);
|
||||||
|
@ -392,7 +394,7 @@ AudioStream *makeVorbisStream(File *file, uint32 size) {
|
||||||
#else
|
#else
|
||||||
f->file = file;
|
f->file = file;
|
||||||
#endif
|
#endif
|
||||||
f->start = file->pos();
|
f->start = file->pos();
|
||||||
f->len = size;
|
f->len = size;
|
||||||
f->curr_pos = 0;
|
f->curr_pos = 0;
|
||||||
|
|
||||||
|
@ -400,12 +402,16 @@ AudioStream *makeVorbisStream(File *file, uint32 size) {
|
||||||
warning("Invalid file format");
|
warning("Invalid file format");
|
||||||
delete ov_file;
|
delete ov_file;
|
||||||
delete f;
|
delete f;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
#ifndef __SYMBIAN32__
|
#ifndef __SYMBIAN32__
|
||||||
file->incRef();
|
file->incRef();
|
||||||
#endif
|
#endif
|
||||||
return new VorbisInputStream(ov_file, 0, true);
|
return new VorbisInputStream(ov_file, 0, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
|
#endif // #ifdef USE_VORBIS
|
||||||
|
|
|
@ -28,12 +28,15 @@
|
||||||
|
|
||||||
#ifdef USE_VORBIS
|
#ifdef USE_VORBIS
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
class DigitalTrackInfo;
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
class File;
|
class File;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
|
class AudioStream;
|
||||||
|
class DigitalTrackInfo;
|
||||||
|
|
||||||
DigitalTrackInfo *getVorbisTrack(int track);
|
DigitalTrackInfo *getVorbisTrack(int track);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +47,7 @@ DigitalTrackInfo *getVorbisTrack(int track);
|
||||||
*/
|
*/
|
||||||
AudioStream *makeVorbisStream(Common::File *file, uint32 size);
|
AudioStream *makeVorbisStream(Common::File *file, uint32 size);
|
||||||
|
|
||||||
#endif
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif // #ifdef USE_VORBIS
|
||||||
|
#endif // #ifndef SOUND_VORBIS_H
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "sound/wave.h"
|
#include "sound/wave.h"
|
||||||
#include "sound/adpcm.h"
|
#include "sound/adpcm.h"
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, byte &flags, uint16 *wavType, int *blockAlign_) {
|
bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, byte &flags, uint16 *wavType, int *blockAlign_) {
|
||||||
const uint32 initialPos = stream.pos();
|
const uint32 initialPos = stream.pos();
|
||||||
byte buf[4+1];
|
byte buf[4+1];
|
||||||
|
@ -181,3 +183,5 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) {
|
||||||
|
|
||||||
return makeLinearInputStream(rate, flags, data, size, 0, 0);
|
return makeLinearInputStream(rate, flags, data, size, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
|
@ -26,9 +26,12 @@
|
||||||
#include "common/stdafx.h"
|
#include "common/stdafx.h"
|
||||||
#include "common/scummsys.h"
|
#include "common/scummsys.h"
|
||||||
|
|
||||||
class AudioStream;
|
|
||||||
namespace Common { class SeekableReadStream; }
|
namespace Common { class SeekableReadStream; }
|
||||||
|
|
||||||
|
namespace Audio {
|
||||||
|
|
||||||
|
class AudioStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to load a WAVE from the given seekable stream. Returns true if
|
* Try to load a WAVE from the given seekable stream. Returns true if
|
||||||
* successful. In that case, the stream's seek position will be set to the
|
* successful. In that case, the stream's seek position will be set to the
|
||||||
|
@ -47,4 +50,6 @@ extern bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int
|
||||||
*/
|
*/
|
||||||
AudioStream *makeWAVStream(Common::SeekableReadStream &stream);
|
AudioStream *makeWAVStream(Common::SeekableReadStream &stream);
|
||||||
|
|
||||||
|
} // End of namespace Audio
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue