VIDEO: Allow setting the mixer sound type used to play audio tracks
This commit is contained in:
parent
22ce8dbf38
commit
ec49730711
30 changed files with 117 additions and 93 deletions
|
@ -152,7 +152,7 @@ bool AccessVIDMovieDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
soundblasterRate = _stream->readByte();
|
soundblasterRate = _stream->readByte();
|
||||||
audioSampleRate = 1000000 / (256 - soundblasterRate);
|
audioSampleRate = 1000000 / (256 - soundblasterRate);
|
||||||
|
|
||||||
_audioTrack = new StreamAudioTrack(audioSampleRate);
|
_audioTrack = new StreamAudioTrack(audioSampleRate, getSoundType());
|
||||||
addTrack(_audioTrack);
|
addTrack(_audioTrack);
|
||||||
|
|
||||||
_stream->seek(chunkStartOffset); // seek back
|
_stream->seek(chunkStartOffset); // seek back
|
||||||
|
@ -194,7 +194,7 @@ bool AccessVIDMovieDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
|
|
||||||
// If sample rate was found, create an audio track
|
// If sample rate was found, create an audio track
|
||||||
if (audioSampleRate) {
|
if (audioSampleRate) {
|
||||||
_audioTrack = new StreamAudioTrack(audioSampleRate);
|
_audioTrack = new StreamAudioTrack(audioSampleRate, getSoundType());
|
||||||
addTrack(_audioTrack);
|
addTrack(_audioTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,8 @@ bool AccessVIDMovieDecoder::StreamVideoTrack::hasDirtyPalette() const {
|
||||||
return _dirtyPalette;
|
return _dirtyPalette;
|
||||||
}
|
}
|
||||||
|
|
||||||
AccessVIDMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 sampleRate) {
|
AccessVIDMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 sampleRate, Audio::Mixer::SoundType soundType) :
|
||||||
|
AudioTrack(soundType) {
|
||||||
_totalAudioQueued = 0; // currently 0 milliseconds queued
|
_totalAudioQueued = 0; // currently 0 milliseconds queued
|
||||||
|
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
|
|
|
@ -119,7 +119,7 @@ private:
|
||||||
|
|
||||||
class StreamAudioTrack : public AudioTrack {
|
class StreamAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
StreamAudioTrack(uint32 sampleRate);
|
StreamAudioTrack(uint32 sampleRate, Audio::Mixer::SoundType soundType);
|
||||||
~StreamAudioTrack();
|
~StreamAudioTrack();
|
||||||
|
|
||||||
void queueAudio(Common::SeekableReadStream *stream, byte chunkId);
|
void queueAudio(Common::SeekableReadStream *stream, byte chunkId);
|
||||||
|
|
|
@ -105,7 +105,7 @@ bool VQADecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
case MKTAG('V','Q','H','D'):
|
case MKTAG('V','Q','H','D'):
|
||||||
handleVQHD(_fileStream);
|
handleVQHD(_fileStream);
|
||||||
if (_header.flags & 1) {
|
if (_header.flags & 1) {
|
||||||
audioTrack = new VQAAudioTrack(&_header);
|
audioTrack = new VQAAudioTrack(&_header, getSoundType());
|
||||||
addTrack(audioTrack);
|
addTrack(audioTrack);
|
||||||
}
|
}
|
||||||
foundVQHD = true;
|
foundVQHD = true;
|
||||||
|
@ -282,7 +282,8 @@ void VQADecoder::readNextPacket() {
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
VQADecoder::VQAAudioTrack::VQAAudioTrack(const VQAHeader *header) {
|
VQADecoder::VQAAudioTrack::VQAAudioTrack(const VQAHeader *header, Audio::Mixer::SoundType soundType) :
|
||||||
|
AudioTrack(soundType) {
|
||||||
_audioStream = Audio::makeQueuingAudioStream(header->freq, false);
|
_audioStream = Audio::makeQueuingAudioStream(header->freq, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ private:
|
||||||
|
|
||||||
class VQAAudioTrack : public AudioTrack {
|
class VQAAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
VQAAudioTrack(const VQAHeader *header);
|
VQAAudioTrack(const VQAHeader *header, Audio::Mixer::SoundType soundType);
|
||||||
~VQAAudioTrack();
|
~VQAAudioTrack();
|
||||||
|
|
||||||
void handleSND0(Common::SeekableReadStream *stream);
|
void handleSND0(Common::SeekableReadStream *stream);
|
||||||
|
|
|
@ -328,8 +328,10 @@ void SEQPlayer::play(const Common::String &fileName, const int16 numTicks, const
|
||||||
#pragma mark AVIPlayer
|
#pragma mark AVIPlayer
|
||||||
|
|
||||||
AVIPlayer::AVIPlayer(EventManager *eventMan) :
|
AVIPlayer::AVIPlayer(EventManager *eventMan) :
|
||||||
VideoPlayer(eventMan, new Video::AVIDecoder(Audio::Mixer::kSFXSoundType)),
|
VideoPlayer(eventMan, new Video::AVIDecoder()),
|
||||||
_status(kAVINotOpen) {}
|
_status(kAVINotOpen) {
|
||||||
|
_decoder->setSoundType(Audio::Mixer::kSFXSoundType);
|
||||||
|
}
|
||||||
|
|
||||||
AVIPlayer::IOStatus AVIPlayer::open(const Common::String &fileName) {
|
AVIPlayer::IOStatus AVIPlayer::open(const Common::String &fileName) {
|
||||||
if (_status != kAVINotOpen) {
|
if (_status != kAVINotOpen) {
|
||||||
|
@ -981,11 +983,13 @@ void VMDPlayer::restrictPalette(const uint8 startColor, const int16 endColor) {
|
||||||
#pragma mark DuckPlayer
|
#pragma mark DuckPlayer
|
||||||
|
|
||||||
DuckPlayer::DuckPlayer(EventManager *eventMan, SegManager *segMan) :
|
DuckPlayer::DuckPlayer(EventManager *eventMan, SegManager *segMan) :
|
||||||
VideoPlayer(eventMan, new Video::AVIDecoder(Audio::Mixer::kSFXSoundType)),
|
VideoPlayer(eventMan, new Video::AVIDecoder()),
|
||||||
_plane(nullptr),
|
_plane(nullptr),
|
||||||
_status(kDuckClosed),
|
_status(kDuckClosed),
|
||||||
_volume(Audio::Mixer::kMaxChannelVolume),
|
_volume(Audio::Mixer::kMaxChannelVolume),
|
||||||
_doFrameOut(false) {}
|
_doFrameOut(false) {
|
||||||
|
_decoder->setSoundType(Audio::Mixer::kSFXSoundType);
|
||||||
|
}
|
||||||
|
|
||||||
void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, const int16 x, const int16 y) {
|
void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, const int16 x, const int16 y) {
|
||||||
if (_status != kDuckClosed) {
|
if (_status != kDuckClosed) {
|
||||||
|
|
|
@ -146,7 +146,7 @@ bool Scalpel3DOMovieDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
_stream->readUint32BE(); // Unknown 0x00000004 compression ratio?
|
_stream->readUint32BE(); // Unknown 0x00000004 compression ratio?
|
||||||
_stream->readUint32BE(); // Unknown 0x00000A2C
|
_stream->readUint32BE(); // Unknown 0x00000A2C
|
||||||
|
|
||||||
_audioTrack = new StreamAudioTrack(audioCodecTag, audioSampleRate, audioChannels);
|
_audioTrack = new StreamAudioTrack(audioCodecTag, audioSampleRate, audioChannels, getSoundType());
|
||||||
addTrack(_audioTrack);
|
addTrack(_audioTrack);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -393,7 +393,8 @@ void Scalpel3DOMovieDecoder::StreamVideoTrack::decodeFrame(Common::SeekableReadS
|
||||||
_curFrame++;
|
_curFrame++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Scalpel3DOMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels) {
|
Scalpel3DOMovieDecoder::StreamAudioTrack::StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels, Audio::Mixer::SoundType soundType) :
|
||||||
|
AudioTrack(soundType) {
|
||||||
switch (codecTag) {
|
switch (codecTag) {
|
||||||
case MKTAG('A','D','P','4'):
|
case MKTAG('A','D','P','4'):
|
||||||
case MKTAG('S','D','X','2'):
|
case MKTAG('S','D','X','2'):
|
||||||
|
|
|
@ -88,7 +88,7 @@ private:
|
||||||
|
|
||||||
class StreamAudioTrack : public AudioTrack {
|
class StreamAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels);
|
StreamAudioTrack(uint32 codecTag, uint32 sampleRate, uint32 channels, Audio::Mixer::SoundType soundType);
|
||||||
~StreamAudioTrack();
|
~StreamAudioTrack();
|
||||||
|
|
||||||
void queueAudio(Common::SeekableReadStream *stream, uint32 size);
|
void queueAudio(Common::SeekableReadStream *stream, uint32 size);
|
||||||
|
|
|
@ -52,7 +52,7 @@ AVISurface::AVISurface(const CResourceKey &key) : _movieName(key.getString()) {
|
||||||
_priorFrame = -1;
|
_priorFrame = -1;
|
||||||
|
|
||||||
// Create a decoder
|
// Create a decoder
|
||||||
_decoder = new AVIDecoder(Audio::Mixer::kPlainSoundType);
|
_decoder = new AVIDecoder();
|
||||||
if (!_decoder->loadFile(_movieName))
|
if (!_decoder->loadFile(_movieName))
|
||||||
error("Could not open video - %s", key.getString().c_str());
|
error("Could not open video - %s", key.getString().c_str());
|
||||||
|
|
||||||
|
|
|
@ -43,10 +43,9 @@ enum MovieFlag {
|
||||||
|
|
||||||
class AVIDecoder : public Video::AVIDecoder {
|
class AVIDecoder : public Video::AVIDecoder {
|
||||||
public:
|
public:
|
||||||
AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) :
|
AVIDecoder() {}
|
||||||
Video::AVIDecoder(soundType) {}
|
AVIDecoder(const Common::Rational &frameRateOverride) :
|
||||||
AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) :
|
Video::AVIDecoder(frameRateOverride) {}
|
||||||
Video::AVIDecoder(frameRateOverride, soundType) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of video tracks the decoder has
|
* Returns the number of video tracks the decoder has
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Voyeur {
|
||||||
// Number of audio frames to keep audio track topped up when playing back video
|
// Number of audio frames to keep audio track topped up when playing back video
|
||||||
#define SOUND_FRAMES_READAHEAD 3
|
#define SOUND_FRAMES_READAHEAD 3
|
||||||
|
|
||||||
RL2Decoder::RL2Decoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
|
RL2Decoder::RL2Decoder() {
|
||||||
_paletteStart = 0;
|
_paletteStart = 0;
|
||||||
_fileStream = nullptr;
|
_fileStream = nullptr;
|
||||||
_soundFrameNumber = -1;
|
_soundFrameNumber = -1;
|
||||||
|
@ -76,7 +76,7 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
// Add an audio track if sound is present
|
// Add an audio track if sound is present
|
||||||
_audioTrack = nullptr;
|
_audioTrack = nullptr;
|
||||||
if (_header._soundRate) {
|
if (_header._soundRate) {
|
||||||
_audioTrack = new RL2AudioTrack(_header, stream, _soundType);
|
_audioTrack = new RL2AudioTrack(_header, stream, getSoundType());
|
||||||
addTrack(_audioTrack);
|
addTrack(_audioTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,8 +433,9 @@ Graphics::Surface *RL2Decoder::RL2VideoTrack::getBackSurface() {
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
||||||
RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType):
|
RL2Decoder::RL2AudioTrack::RL2AudioTrack(const RL2FileHeader &header, Common::SeekableReadStream *stream, Audio::Mixer::SoundType soundType) :
|
||||||
_header(header), _soundType(soundType) {
|
AudioTrack(soundType),
|
||||||
|
_header(header) {
|
||||||
// Create audio straem for the audio track
|
// Create audio straem for the audio track
|
||||||
_audStream = Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2);
|
_audStream = Audio::makeQueuingAudioStream(_header._rate, _header._channels == 2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,6 @@ private:
|
||||||
|
|
||||||
class RL2AudioTrack : public AudioTrack {
|
class RL2AudioTrack : public AudioTrack {
|
||||||
private:
|
private:
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
const RL2FileHeader &_header;
|
const RL2FileHeader &_header;
|
||||||
Audio::QueuingAudioStream *_audStream;
|
Audio::QueuingAudioStream *_audStream;
|
||||||
protected:
|
protected:
|
||||||
|
@ -98,7 +97,6 @@ private:
|
||||||
Audio::Mixer::SoundType soundType);
|
Audio::Mixer::SoundType soundType);
|
||||||
~RL2AudioTrack();
|
~RL2AudioTrack();
|
||||||
|
|
||||||
Audio::Mixer::SoundType getSoundType() const { return _soundType; }
|
|
||||||
int numQueuedStreams() const { return _audStream->numQueuedStreams(); }
|
int numQueuedStreams() const { return _audStream->numQueuedStreams(); }
|
||||||
virtual bool isSeekable() const { return true; }
|
virtual bool isSeekable() const { return true; }
|
||||||
virtual bool seek(const Audio::Timestamp &time) { return true; }
|
virtual bool seek(const Audio::Timestamp &time) { return true; }
|
||||||
|
@ -156,7 +154,6 @@ private:
|
||||||
RL2AudioTrack *_audioTrack;
|
RL2AudioTrack *_audioTrack;
|
||||||
RL2VideoTrack *_videoTrack;
|
RL2VideoTrack *_videoTrack;
|
||||||
Common::SeekableReadStream *_fileStream;
|
Common::SeekableReadStream *_fileStream;
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
RL2FileHeader _header;
|
RL2FileHeader _header;
|
||||||
int _paletteStart;
|
int _paletteStart;
|
||||||
Common::Array<SoundFrame> _soundFrames;
|
Common::Array<SoundFrame> _soundFrames;
|
||||||
|
@ -171,7 +168,7 @@ private:
|
||||||
virtual bool seekIntern(const Audio::Timestamp &time);
|
virtual bool seekIntern(const Audio::Timestamp &time);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RL2Decoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
|
RL2Decoder();
|
||||||
virtual ~RL2Decoder();
|
virtual ~RL2Decoder();
|
||||||
|
|
||||||
virtual void close();
|
virtual void close();
|
||||||
|
|
|
@ -35,10 +35,10 @@ namespace ZVision {
|
||||||
|
|
||||||
Video::AVIDecoder::AVIAudioTrack *ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) {
|
Video::AVIDecoder::AVIAudioTrack *ZorkAVIDecoder::createAudioTrack(Video::AVIDecoder::AVIStreamHeader sHeader, Video::AVIDecoder::PCMWaveFormat wvInfo) {
|
||||||
if (wvInfo.tag != kWaveFormatZorkPCM)
|
if (wvInfo.tag != kWaveFormatZorkPCM)
|
||||||
return new AVIAudioTrack(sHeader, wvInfo, _soundType);
|
return new AVIAudioTrack(sHeader, wvInfo, getSoundType());
|
||||||
|
|
||||||
assert(wvInfo.size == 8);
|
assert(wvInfo.size == 8);
|
||||||
return new ZorkAVIAudioTrack(sHeader, wvInfo, _soundType);
|
return new ZorkAVIAudioTrack(sHeader, wvInfo, getSoundType());
|
||||||
}
|
}
|
||||||
|
|
||||||
ZorkAVIDecoder::ZorkAVIAudioTrack::ZorkAVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) :
|
ZorkAVIDecoder::ZorkAVIAudioTrack::ZorkAVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) :
|
||||||
|
|
|
@ -31,8 +31,7 @@ namespace ZVision {
|
||||||
|
|
||||||
class ZorkAVIDecoder : public Video::AVIDecoder {
|
class ZorkAVIDecoder : public Video::AVIDecoder {
|
||||||
public:
|
public:
|
||||||
ZorkAVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType) :
|
ZorkAVIDecoder() {}
|
||||||
Video::AVIDecoder(soundType) {}
|
|
||||||
|
|
||||||
virtual ~ZorkAVIDecoder() {}
|
virtual ~ZorkAVIDecoder() {}
|
||||||
|
|
||||||
|
|
|
@ -76,13 +76,13 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
AVIDecoder::AVIDecoder(Audio::Mixer::SoundType soundType) :
|
AVIDecoder::AVIDecoder() :
|
||||||
_frameRateOverride(0), _soundType(soundType) {
|
_frameRateOverride(0) {
|
||||||
initCommon();
|
initCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType) :
|
AVIDecoder::AVIDecoder(const Common::Rational &frameRateOverride) :
|
||||||
_frameRateOverride(frameRateOverride), _soundType(soundType) {
|
_frameRateOverride(frameRateOverride) {
|
||||||
initCommon();
|
initCommon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ AVIDecoder::~AVIDecoder() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AVIDecoder::AVIAudioTrack *AVIDecoder::createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo) {
|
AVIDecoder::AVIAudioTrack *AVIDecoder::createAudioTrack(AVIStreamHeader sHeader, PCMWaveFormat wvInfo) {
|
||||||
return new AVIAudioTrack(sHeader, wvInfo, _soundType);
|
return new AVIAudioTrack(sHeader, wvInfo, getSoundType());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AVIDecoder::seekToFrame(uint frame) {
|
bool AVIDecoder::seekToFrame(uint frame) {
|
||||||
|
@ -1007,8 +1007,13 @@ void AVIDecoder::AVIVideoTrack::setDither(const byte *palette) {
|
||||||
_videoCodec->setDither(Image::Codec::kDitherTypeVFW, palette);
|
_videoCodec->setDither(Image::Codec::kDitherTypeVFW, palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType)
|
AVIDecoder::AVIAudioTrack::AVIAudioTrack(const AVIStreamHeader &streamHeader, const PCMWaveFormat &waveFormat, Audio::Mixer::SoundType soundType) :
|
||||||
: _audsHeader(streamHeader), _wvInfo(waveFormat), _soundType(soundType), _audioStream(0), _packetStream(0), _curChunk(0) {
|
AudioTrack(soundType),
|
||||||
|
_audsHeader(streamHeader),
|
||||||
|
_wvInfo(waveFormat),
|
||||||
|
_audioStream(0),
|
||||||
|
_packetStream(0),
|
||||||
|
_curChunk(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AVIDecoder::AVIAudioTrack::~AVIAudioTrack() {
|
AVIDecoder::AVIAudioTrack::~AVIAudioTrack() {
|
||||||
|
|
|
@ -62,8 +62,8 @@ namespace Video {
|
||||||
*/
|
*/
|
||||||
class AVIDecoder : public VideoDecoder {
|
class AVIDecoder : public VideoDecoder {
|
||||||
public:
|
public:
|
||||||
AVIDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
|
AVIDecoder();
|
||||||
AVIDecoder(const Common::Rational &frameRateOverride, Audio::Mixer::SoundType soundType = Audio::Mixer::kPlainSoundType);
|
AVIDecoder(const Common::Rational &frameRateOverride);
|
||||||
virtual ~AVIDecoder();
|
virtual ~AVIDecoder();
|
||||||
|
|
||||||
bool loadStream(Common::SeekableReadStream *stream);
|
bool loadStream(Common::SeekableReadStream *stream);
|
||||||
|
@ -263,7 +263,6 @@ protected:
|
||||||
|
|
||||||
virtual void createAudioStream();
|
virtual void createAudioStream();
|
||||||
virtual void queueSound(Common::SeekableReadStream *stream);
|
virtual void queueSound(Common::SeekableReadStream *stream);
|
||||||
Audio::Mixer::SoundType getSoundType() const { return _soundType; }
|
|
||||||
void skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime);
|
void skipAudio(const Audio::Timestamp &time, const Audio::Timestamp &frameTime);
|
||||||
virtual void resetStream();
|
virtual void resetStream();
|
||||||
uint32 getCurChunk() const { return _curChunk; }
|
uint32 getCurChunk() const { return _curChunk; }
|
||||||
|
@ -288,7 +287,6 @@ protected:
|
||||||
|
|
||||||
AVIStreamHeader _audsHeader;
|
AVIStreamHeader _audsHeader;
|
||||||
PCMWaveFormat _wvInfo;
|
PCMWaveFormat _wvInfo;
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
Audio::AudioStream *_audioStream;
|
Audio::AudioStream *_audioStream;
|
||||||
Audio::PacketizedAudioStream *_packetStream;
|
Audio::PacketizedAudioStream *_packetStream;
|
||||||
uint32 _curChunk;
|
uint32 _curChunk;
|
||||||
|
@ -317,7 +315,6 @@ protected:
|
||||||
bool _foundMovieList;
|
bool _foundMovieList;
|
||||||
uint32 _movieListStart, _movieListEnd;
|
uint32 _movieListStart, _movieListEnd;
|
||||||
|
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
Common::Rational _frameRateOverride;
|
Common::Rational _frameRateOverride;
|
||||||
|
|
||||||
int _videoTrackCounter, _audioTrackCounter;
|
int _videoTrackCounter, _audioTrackCounter;
|
||||||
|
|
|
@ -1349,7 +1349,9 @@ void BinkDecoder::BinkVideoTrack::IDCTPut(DecodeContext &ctx, int16 *block) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BinkDecoder::BinkAudioTrack::BinkAudioTrack(BinkDecoder::AudioInfo &audio) : _audioInfo(&audio) {
|
BinkDecoder::BinkAudioTrack::BinkAudioTrack(BinkDecoder::AudioInfo &audio, Audio::Mixer::SoundType soundType) :
|
||||||
|
AudioTrack(soundType),
|
||||||
|
_audioInfo(&audio) {
|
||||||
_audioStream = Audio::makeQueuingAudioStream(_audioInfo->outSampleRate, _audioInfo->outChannels == 2);
|
_audioStream = Audio::makeQueuingAudioStream(_audioInfo->outSampleRate, _audioInfo->outChannels == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1598,7 +1600,7 @@ void BinkDecoder::initAudioTrack(AudioInfo &audio) {
|
||||||
else if (audio.codec == kAudioCodecDCT)
|
else if (audio.codec == kAudioCodecDCT)
|
||||||
audio.dct = new Common::DCT(frameLenBits, Common::DCT::DCT_III);
|
audio.dct = new Common::DCT(frameLenBits, Common::DCT::DCT_III);
|
||||||
|
|
||||||
addTrack(new BinkAudioTrack(audio));
|
addTrack(new BinkAudioTrack(audio, getSoundType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Video
|
} // End of namespace Video
|
||||||
|
|
|
@ -320,7 +320,7 @@ private:
|
||||||
|
|
||||||
class BinkAudioTrack : public AudioTrack {
|
class BinkAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
BinkAudioTrack(AudioInfo &audio);
|
BinkAudioTrack(AudioInfo &audio, Audio::Mixer::SoundType soundType);
|
||||||
~BinkAudioTrack();
|
~BinkAudioTrack();
|
||||||
|
|
||||||
/** Decode an audio packet. */
|
/** Decode an audio packet. */
|
||||||
|
|
|
@ -2784,6 +2784,7 @@ void VMDDecoder::setAutoStartSound(bool autoStartSound) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AdvancedVMDDecoder::AdvancedVMDDecoder(Audio::Mixer::SoundType soundType) {
|
AdvancedVMDDecoder::AdvancedVMDDecoder(Audio::Mixer::SoundType soundType) {
|
||||||
|
setSoundType(soundType);
|
||||||
_decoder = new VMDDecoder(g_system->getMixer(), soundType);
|
_decoder = new VMDDecoder(g_system->getMixer(), soundType);
|
||||||
_decoder->setAutoStartSound(false);
|
_decoder->setAutoStartSound(false);
|
||||||
}
|
}
|
||||||
|
@ -2860,11 +2861,9 @@ Common::Rational AdvancedVMDDecoder::VMDVideoTrack::getFrameRate() const {
|
||||||
return _decoder->getFrameRate();
|
return _decoder->getFrameRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
AdvancedVMDDecoder::VMDAudioTrack::VMDAudioTrack(VMDDecoder *decoder) : _decoder(decoder) {
|
AdvancedVMDDecoder::VMDAudioTrack::VMDAudioTrack(VMDDecoder *decoder) :
|
||||||
}
|
AudioTrack(decoder->getSoundType()),
|
||||||
|
_decoder(decoder) {
|
||||||
Audio::Mixer::SoundType AdvancedVMDDecoder::VMDAudioTrack::getSoundType() const {
|
|
||||||
return _decoder->getSoundType();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Audio::AudioStream *AdvancedVMDDecoder::VMDAudioTrack::getAudioStream() const {
|
Audio::AudioStream *AdvancedVMDDecoder::VMDAudioTrack::getAudioStream() const {
|
||||||
|
|
|
@ -595,8 +595,6 @@ private:
|
||||||
public:
|
public:
|
||||||
VMDAudioTrack(VMDDecoder *decoder);
|
VMDAudioTrack(VMDDecoder *decoder);
|
||||||
|
|
||||||
Audio::Mixer::SoundType getSoundType() const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual Audio::AudioStream *getAudioStream() const;
|
virtual Audio::AudioStream *getAudioStream() const;
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ void MPEGPSDecoder::readNextPacket() {
|
||||||
} else if (startCode >= 0x1C0 && startCode <= 0x1DF) {
|
} else if (startCode >= 0x1C0 && startCode <= 0x1DF) {
|
||||||
#ifdef USE_MAD
|
#ifdef USE_MAD
|
||||||
// MPEG Audio stream
|
// MPEG Audio stream
|
||||||
MPEGAudioTrack *audioTrack = new MPEGAudioTrack(*packet);
|
MPEGAudioTrack *audioTrack = new MPEGAudioTrack(*packet, getSoundType());
|
||||||
stream = audioTrack;
|
stream = audioTrack;
|
||||||
_streamMap[startCode] = audioTrack;
|
_streamMap[startCode] = audioTrack;
|
||||||
addTrack(audioTrack);
|
addTrack(audioTrack);
|
||||||
|
@ -512,7 +512,8 @@ void MPEGPSDecoder::MPEGVideoTrack::findDimensions(Common::SeekableReadStream *f
|
||||||
|
|
||||||
// The audio code here is almost entirely based on what we do in mp3.cpp
|
// The audio code here is almost entirely based on what we do in mp3.cpp
|
||||||
|
|
||||||
MPEGPSDecoder::MPEGAudioTrack::MPEGAudioTrack(Common::SeekableReadStream &firstPacket) {
|
MPEGPSDecoder::MPEGAudioTrack::MPEGAudioTrack(Common::SeekableReadStream &firstPacket, Audio::Mixer::SoundType soundType) :
|
||||||
|
AudioTrack(soundType) {
|
||||||
_audStream = Audio::makePacketizedMP3Stream(firstPacket);
|
_audStream = Audio::makePacketizedMP3Stream(firstPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ private:
|
||||||
// An MPEG audio track
|
// An MPEG audio track
|
||||||
class MPEGAudioTrack : public AudioTrack, public MPEGStream {
|
class MPEGAudioTrack : public AudioTrack, public MPEGStream {
|
||||||
public:
|
public:
|
||||||
MPEGAudioTrack(Common::SeekableReadStream &firstPacket);
|
MPEGAudioTrack(Common::SeekableReadStream &firstPacket, Audio::Mixer::SoundType soundType);
|
||||||
~MPEGAudioTrack();
|
~MPEGAudioTrack();
|
||||||
|
|
||||||
bool sendPacket(Common::SeekableReadStream *packet, uint32 pts, uint32 dts);
|
bool sendPacket(Common::SeekableReadStream *packet, uint32 pts, uint32 dts);
|
||||||
|
|
|
@ -247,7 +247,7 @@ void PSXStreamDecoder::readNextPacket() {
|
||||||
// We only handle one audio channel so far
|
// We only handle one audio channel so far
|
||||||
if (track == 1) {
|
if (track == 1) {
|
||||||
if (!_audioTrack) {
|
if (!_audioTrack) {
|
||||||
_audioTrack = new PSXAudioTrack(sector);
|
_audioTrack = new PSXAudioTrack(sector, getSoundType());
|
||||||
addTrack(_audioTrack);
|
addTrack(_audioTrack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,8 @@ static const int s_xaTable[5][2] = {
|
||||||
{ 122, -60 }
|
{ 122, -60 }
|
||||||
};
|
};
|
||||||
|
|
||||||
PSXStreamDecoder::PSXAudioTrack::PSXAudioTrack(Common::SeekableReadStream *sector) {
|
PSXStreamDecoder::PSXAudioTrack::PSXAudioTrack(Common::SeekableReadStream *sector, Audio::Mixer::SoundType soundType) :
|
||||||
|
AudioTrack(soundType) {
|
||||||
assert(sector);
|
assert(sector);
|
||||||
_endOfTrack = false;
|
_endOfTrack = false;
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,7 @@ private:
|
||||||
|
|
||||||
class PSXAudioTrack : public AudioTrack {
|
class PSXAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
PSXAudioTrack(Common::SeekableReadStream *sector);
|
PSXAudioTrack(Common::SeekableReadStream *sector, Audio::Mixer::SoundType soundType);
|
||||||
~PSXAudioTrack();
|
~PSXAudioTrack();
|
||||||
|
|
||||||
bool endOfTrack() const;
|
bool endOfTrack() const;
|
||||||
|
|
|
@ -267,8 +267,10 @@ void QuickTimeDecoder::VideoSampleDesc::initCodec() {
|
||||||
_videoCodec = Image::createQuickTimeCodec(_codecTag, _parentTrack->width, _parentTrack->height, _bitsPerSample & 0x1f);
|
_videoCodec = Image::createQuickTimeCodec(_codecTag, _parentTrack->width, _parentTrack->height, _bitsPerSample & 0x1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack)
|
QuickTimeDecoder::AudioTrackHandler::AudioTrackHandler(QuickTimeDecoder *decoder, QuickTimeAudioTrack *audioTrack) :
|
||||||
: _decoder(decoder), _audioTrack(audioTrack) {
|
SeekableAudioTrack(decoder->getSoundType()),
|
||||||
|
_decoder(decoder),
|
||||||
|
_audioTrack(audioTrack) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void QuickTimeDecoder::AudioTrackHandler::updateBuffer() {
|
void QuickTimeDecoder::AudioTrackHandler::updateBuffer() {
|
||||||
|
|
|
@ -277,7 +277,7 @@ uint32 BigHuffmanTree::getCode(Common::BitStream &bs) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmackerDecoder::SmackerDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
|
SmackerDecoder::SmackerDecoder() {
|
||||||
_fileStream = 0;
|
_fileStream = 0;
|
||||||
_firstFrameStart = 0;
|
_firstFrameStart = 0;
|
||||||
_frameTypes = 0;
|
_frameTypes = 0;
|
||||||
|
@ -369,7 +369,7 @@ bool SmackerDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
if (_header.audioInfo[i].compression == kCompressionRDFT || _header.audioInfo[i].compression == kCompressionDCT)
|
if (_header.audioInfo[i].compression == kCompressionRDFT || _header.audioInfo[i].compression == kCompressionDCT)
|
||||||
warning("Unhandled Smacker v2 audio compression");
|
warning("Unhandled Smacker v2 audio compression");
|
||||||
|
|
||||||
addTrack(new SmackerAudioTrack(_header.audioInfo[i], _soundType));
|
addTrack(new SmackerAudioTrack(_header.audioInfo[i], getSoundType()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -754,7 +754,8 @@ void SmackerDecoder::SmackerVideoTrack::unpackPalette(Common::SeekableReadStream
|
||||||
}
|
}
|
||||||
|
|
||||||
SmackerDecoder::SmackerAudioTrack::SmackerAudioTrack(const AudioInfo &audioInfo, Audio::Mixer::SoundType soundType) :
|
SmackerDecoder::SmackerAudioTrack::SmackerAudioTrack(const AudioInfo &audioInfo, Audio::Mixer::SoundType soundType) :
|
||||||
_audioInfo(audioInfo), _soundType(soundType) {
|
AudioTrack(soundType),
|
||||||
|
_audioInfo(audioInfo) {
|
||||||
_audioStream = Audio::makeQueuingAudioStream(_audioInfo.sampleRate, _audioInfo.isStereo);
|
_audioStream = Audio::makeQueuingAudioStream(_audioInfo.sampleRate, _audioInfo.isStereo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class BigHuffmanTree;
|
||||||
*/
|
*/
|
||||||
class SmackerDecoder : public VideoDecoder {
|
class SmackerDecoder : public VideoDecoder {
|
||||||
public:
|
public:
|
||||||
SmackerDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kSFXSoundType);
|
SmackerDecoder();
|
||||||
virtual ~SmackerDecoder();
|
virtual ~SmackerDecoder();
|
||||||
|
|
||||||
virtual bool loadStream(Common::SeekableReadStream *stream);
|
virtual bool loadStream(Common::SeekableReadStream *stream);
|
||||||
|
@ -164,8 +164,6 @@ private:
|
||||||
bool isRewindable() const { return true; }
|
bool isRewindable() const { return true; }
|
||||||
bool rewind();
|
bool rewind();
|
||||||
|
|
||||||
Audio::Mixer::SoundType getSoundType() const { return _soundType; }
|
|
||||||
|
|
||||||
void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize);
|
void queueCompressedBuffer(byte *buffer, uint32 bufferSize, uint32 unpackedSize);
|
||||||
void queuePCM(byte *buffer, uint32 bufferSize);
|
void queuePCM(byte *buffer, uint32 bufferSize);
|
||||||
|
|
||||||
|
@ -173,7 +171,6 @@ private:
|
||||||
Audio::AudioStream *getAudioStream() const;
|
Audio::AudioStream *getAudioStream() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
Audio::QueuingAudioStream *_audioStream;
|
Audio::QueuingAudioStream *_audioStream;
|
||||||
AudioInfo _audioInfo;
|
AudioInfo _audioInfo;
|
||||||
};
|
};
|
||||||
|
@ -186,8 +183,6 @@ private:
|
||||||
byte *_frameTypes;
|
byte *_frameTypes;
|
||||||
|
|
||||||
uint32 _firstFrameStart;
|
uint32 _firstFrameStart;
|
||||||
|
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Video
|
} // End of namespace Video
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
namespace Video {
|
namespace Video {
|
||||||
|
|
||||||
TheoraDecoder::TheoraDecoder(Audio::Mixer::SoundType soundType) : _soundType(soundType) {
|
TheoraDecoder::TheoraDecoder() {
|
||||||
_fileStream = 0;
|
_fileStream = 0;
|
||||||
|
|
||||||
_videoTrack = 0;
|
_videoTrack = 0;
|
||||||
|
@ -177,7 +177,7 @@ bool TheoraDecoder::loadStream(Common::SeekableReadStream *stream) {
|
||||||
th_setup_free(theoraSetup);
|
th_setup_free(theoraSetup);
|
||||||
|
|
||||||
if (_hasAudio) {
|
if (_hasAudio) {
|
||||||
_audioTrack = new VorbisAudioTrack(_soundType, _vorbisInfo);
|
_audioTrack = new VorbisAudioTrack(getSoundType(), _vorbisInfo);
|
||||||
|
|
||||||
// Get enough audio data to start us off
|
// Get enough audio data to start us off
|
||||||
while (!_audioTrack->hasAudio()) {
|
while (!_audioTrack->hasAudio()) {
|
||||||
|
@ -330,7 +330,8 @@ void TheoraDecoder::TheoraVideoTrack::translateYUVtoRGBA(th_ycbcr_buffer &YUVBuf
|
||||||
|
|
||||||
static vorbis_info *info = 0;
|
static vorbis_info *info = 0;
|
||||||
|
|
||||||
TheoraDecoder::VorbisAudioTrack::VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo) : _soundType(soundType) {
|
TheoraDecoder::VorbisAudioTrack::VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo) :
|
||||||
|
AudioTrack(soundType) {
|
||||||
vorbis_synthesis_init(&_vorbisDSP, &vorbisInfo);
|
vorbis_synthesis_init(&_vorbisDSP, &vorbisInfo);
|
||||||
vorbis_block_init(&_vorbisDSP, &_vorbisBlock);
|
vorbis_block_init(&_vorbisDSP, &_vorbisBlock);
|
||||||
info = &vorbisInfo;
|
info = &vorbisInfo;
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Video {
|
||||||
*/
|
*/
|
||||||
class TheoraDecoder : public VideoDecoder {
|
class TheoraDecoder : public VideoDecoder {
|
||||||
public:
|
public:
|
||||||
TheoraDecoder(Audio::Mixer::SoundType soundType = Audio::Mixer::kMusicSoundType);
|
TheoraDecoder();
|
||||||
virtual ~TheoraDecoder();
|
virtual ~TheoraDecoder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,8 +110,6 @@ private:
|
||||||
VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo);
|
VorbisAudioTrack(Audio::Mixer::SoundType soundType, vorbis_info &vorbisInfo);
|
||||||
~VorbisAudioTrack();
|
~VorbisAudioTrack();
|
||||||
|
|
||||||
Audio::Mixer::SoundType getSoundType() const { return _soundType; }
|
|
||||||
|
|
||||||
bool decodeSamples();
|
bool decodeSamples();
|
||||||
bool hasAudio() const;
|
bool hasAudio() const;
|
||||||
bool needsAudio() const;
|
bool needsAudio() const;
|
||||||
|
@ -126,7 +124,6 @@ private:
|
||||||
int _audioBufferFill;
|
int _audioBufferFill;
|
||||||
ogg_int16_t *_audioBuffer;
|
ogg_int16_t *_audioBuffer;
|
||||||
|
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
Audio::QueuingAudioStream *_audStream;
|
Audio::QueuingAudioStream *_audStream;
|
||||||
|
|
||||||
vorbis_block _vorbisBlock;
|
vorbis_block _vorbisBlock;
|
||||||
|
@ -142,8 +139,6 @@ private:
|
||||||
|
|
||||||
Common::SeekableReadStream *_fileStream;
|
Common::SeekableReadStream *_fileStream;
|
||||||
|
|
||||||
Audio::Mixer::SoundType _soundType;
|
|
||||||
|
|
||||||
ogg_sync_state _oggSync;
|
ogg_sync_state _oggSync;
|
||||||
ogg_page _oggPage;
|
ogg_page _oggPage;
|
||||||
ogg_packet _oggPacket;
|
ogg_packet _oggPacket;
|
||||||
|
|
|
@ -40,6 +40,7 @@ VideoDecoder::VideoDecoder() {
|
||||||
_playbackRate = 0;
|
_playbackRate = 0;
|
||||||
_audioVolume = Audio::Mixer::kMaxChannelVolume;
|
_audioVolume = Audio::Mixer::kMaxChannelVolume;
|
||||||
_audioBalance = 0;
|
_audioBalance = 0;
|
||||||
|
_soundType = Audio::Mixer::kPlainSoundType;
|
||||||
_pauseLevel = 0;
|
_pauseLevel = 0;
|
||||||
_needsUpdate = false;
|
_needsUpdate = false;
|
||||||
_lastTimeChange = 0;
|
_lastTimeChange = 0;
|
||||||
|
@ -143,6 +144,15 @@ void VideoDecoder::setBalance(int8 balance) {
|
||||||
((AudioTrack *)*it)->setBalance(_audioBalance);
|
((AudioTrack *)*it)->setBalance(_audioBalance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Audio::Mixer::SoundType VideoDecoder::getSoundType() const {
|
||||||
|
return _soundType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoDecoder::setSoundType(Audio::Mixer::SoundType soundType) {
|
||||||
|
assert(!isVideoLoaded());
|
||||||
|
_soundType = soundType;
|
||||||
|
}
|
||||||
|
|
||||||
bool VideoDecoder::isVideoLoaded() const {
|
bool VideoDecoder::isVideoLoaded() const {
|
||||||
return !_tracks.empty();
|
return !_tracks.empty();
|
||||||
}
|
}
|
||||||
|
@ -577,7 +587,11 @@ Audio::Timestamp VideoDecoder::FixedRateVideoTrack::getDuration() const {
|
||||||
return getFrameTime(getFrameCount());
|
return getFrameTime(getFrameCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoDecoder::AudioTrack::AudioTrack() : _volume(Audio::Mixer::kMaxChannelVolume), _balance(0), _muted(false) {
|
VideoDecoder::AudioTrack::AudioTrack(Audio::Mixer::SoundType soundType) :
|
||||||
|
_volume(Audio::Mixer::kMaxChannelVolume),
|
||||||
|
_soundType(soundType),
|
||||||
|
_balance(0),
|
||||||
|
_muted(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VideoDecoder::AudioTrack::endOfTrack() const {
|
bool VideoDecoder::AudioTrack::endOfTrack() const {
|
||||||
|
@ -605,7 +619,7 @@ void VideoDecoder::AudioTrack::start() {
|
||||||
Audio::AudioStream *stream = getAudioStream();
|
Audio::AudioStream *stream = getAudioStream();
|
||||||
assert(stream);
|
assert(stream);
|
||||||
|
|
||||||
g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, _muted ? 0 : getVolume(), getBalance(), DisposeAfterUse::NO);
|
g_system->getMixer()->playStream(_soundType, &_handle, stream, -1, _muted ? 0 : getVolume(), getBalance(), DisposeAfterUse::NO);
|
||||||
|
|
||||||
// Pause the audio again if we're still paused
|
// Pause the audio again if we're still paused
|
||||||
if (isPaused())
|
if (isPaused())
|
||||||
|
@ -624,7 +638,7 @@ void VideoDecoder::AudioTrack::start(const Audio::Timestamp &limit) {
|
||||||
|
|
||||||
stream = Audio::makeLimitingAudioStream(stream, limit, DisposeAfterUse::NO);
|
stream = Audio::makeLimitingAudioStream(stream, limit, DisposeAfterUse::NO);
|
||||||
|
|
||||||
g_system->getMixer()->playStream(getSoundType(), &_handle, stream, -1, _muted ? 0 : getVolume(), getBalance(), DisposeAfterUse::YES);
|
g_system->getMixer()->playStream(_soundType, &_handle, stream, -1, _muted ? 0 : getVolume(), getBalance(), DisposeAfterUse::YES);
|
||||||
|
|
||||||
// Pause the audio again if we're still paused
|
// Pause the audio again if we're still paused
|
||||||
if (isPaused())
|
if (isPaused())
|
||||||
|
@ -679,7 +693,8 @@ bool VideoDecoder::SeekableAudioTrack::seek(const Audio::Timestamp &time) {
|
||||||
return stream->seek(time);
|
return stream->seek(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack() {
|
VideoDecoder::StreamFileAudioTrack::StreamFileAudioTrack(Audio::Mixer::SoundType soundType) :
|
||||||
|
SeekableAudioTrack(soundType) {
|
||||||
_stream = 0;
|
_stream = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -737,7 +752,7 @@ bool VideoDecoder::addStreamFileTrack(const Common::String &baseName) {
|
||||||
if (!isVideoLoaded())
|
if (!isVideoLoaded())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
StreamFileAudioTrack *track = new StreamFileAudioTrack();
|
StreamFileAudioTrack *track = new StreamFileAudioTrack(getSoundType());
|
||||||
|
|
||||||
bool result = track->loadFromFile(baseName);
|
bool result = track->loadFromFile(baseName);
|
||||||
|
|
||||||
|
|
|
@ -430,6 +430,18 @@ public:
|
||||||
*/
|
*/
|
||||||
void setBalance(int8 balance);
|
void setBalance(int8 balance);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the mixer sound type audio is being played with.
|
||||||
|
*/
|
||||||
|
Audio::Mixer::SoundType getSoundType() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the mixer sound type used to play the audio tracks.
|
||||||
|
*
|
||||||
|
* This must be set before calling loadStream().
|
||||||
|
*/
|
||||||
|
void setSoundType(Audio::Mixer::SoundType soundType);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an audio track from a stream file.
|
* Add an audio track from a stream file.
|
||||||
*
|
*
|
||||||
|
@ -667,7 +679,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
class AudioTrack : public Track {
|
class AudioTrack : public Track {
|
||||||
public:
|
public:
|
||||||
AudioTrack();
|
AudioTrack(Audio::Mixer::SoundType soundType);
|
||||||
virtual ~AudioTrack() {}
|
virtual ~AudioTrack() {}
|
||||||
|
|
||||||
TrackType getTrackType() const { return kTrackTypeAudio; }
|
TrackType getTrackType() const { return kTrackTypeAudio; }
|
||||||
|
@ -712,11 +724,6 @@ protected:
|
||||||
*/
|
*/
|
||||||
uint32 getRunningTime() const;
|
uint32 getRunningTime() const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the sound type to be used when playing this audio track
|
|
||||||
*/
|
|
||||||
virtual Audio::Mixer::SoundType getSoundType() const { return Audio::Mixer::kPlainSoundType; }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mute the track
|
* Mute the track
|
||||||
*/
|
*/
|
||||||
|
@ -732,6 +739,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Audio::SoundHandle _handle;
|
Audio::SoundHandle _handle;
|
||||||
|
Audio::Mixer::SoundType _soundType;
|
||||||
byte _volume;
|
byte _volume;
|
||||||
int8 _balance;
|
int8 _balance;
|
||||||
bool _muted;
|
bool _muted;
|
||||||
|
@ -743,7 +751,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
class RewindableAudioTrack : public AudioTrack {
|
class RewindableAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
RewindableAudioTrack() {}
|
RewindableAudioTrack(Audio::Mixer::SoundType soundType) : AudioTrack(soundType) {}
|
||||||
virtual ~RewindableAudioTrack() {}
|
virtual ~RewindableAudioTrack() {}
|
||||||
|
|
||||||
bool isRewindable() const { return true; }
|
bool isRewindable() const { return true; }
|
||||||
|
@ -765,7 +773,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
class SeekableAudioTrack : public AudioTrack {
|
class SeekableAudioTrack : public AudioTrack {
|
||||||
public:
|
public:
|
||||||
SeekableAudioTrack() {}
|
SeekableAudioTrack(Audio::Mixer::SoundType soundType) : AudioTrack(soundType) {}
|
||||||
virtual ~SeekableAudioTrack() {}
|
virtual ~SeekableAudioTrack() {}
|
||||||
|
|
||||||
bool isSeekable() const { return true; }
|
bool isSeekable() const { return true; }
|
||||||
|
@ -789,7 +797,7 @@ protected:
|
||||||
*/
|
*/
|
||||||
class StreamFileAudioTrack : public SeekableAudioTrack {
|
class StreamFileAudioTrack : public SeekableAudioTrack {
|
||||||
public:
|
public:
|
||||||
StreamFileAudioTrack();
|
StreamFileAudioTrack(Audio::Mixer::SoundType soundType);
|
||||||
~StreamFileAudioTrack();
|
~StreamFileAudioTrack();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -953,6 +961,7 @@ private:
|
||||||
uint32 _pauseStartTime;
|
uint32 _pauseStartTime;
|
||||||
byte _audioVolume;
|
byte _audioVolume;
|
||||||
int8 _audioBalance;
|
int8 _audioBalance;
|
||||||
|
Audio::Mixer::SoundType _soundType;
|
||||||
|
|
||||||
AudioTrack *_mainAudioTrack;
|
AudioTrack *_mainAudioTrack;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue