From bfea71b0c46ea93b80ee2f6f08ba29ba8768171a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 3 Jan 2004 14:10:13 +0000 Subject: renamed AudioInputStream -> AudioStream svn-id: r12110 --- sound/audiostream.cpp | 32 ++++++++++++++++---------------- sound/audiostream.h | 14 +++++++------- sound/mixer.cpp | 20 ++++++++++---------- sound/mixer.h | 4 ++-- sound/mp3.cpp | 6 +++--- sound/mp3.h | 4 ++-- sound/rate.cpp | 6 +++--- sound/rate.h | 4 ++-- sound/resample.cpp | 6 +++--- sound/resample.h | 2 +- sound/voc.cpp | 4 ++-- sound/voc.h | 6 +++--- sound/vorbis.cpp | 10 +++++----- sound/vorbis.h | 4 ++-- 14 files changed, 61 insertions(+), 61 deletions(-) (limited to 'sound') diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 457f2b5bc1..2b5c56d971 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -54,7 +54,7 @@ * generated. */ template -class LinearMemoryStream : public AudioInputStream { +class LinearMemoryStream : public AudioStream { protected: const byte *_ptr; const byte *_end; @@ -125,7 +125,7 @@ int LinearMemoryStream::readBuffer(int16 *buf #pragma mark - -#pragma mark --- WrappedMemoryStream --- +#pragma mark --- AppendableMemoryStream --- #pragma mark - @@ -133,7 +133,7 @@ int LinearMemoryStream::readBuffer(int16 *buf * Wrapped memory stream. */ template -class WrappedMemoryStream : public WrappedAudioInputStream { +class AppendableMemoryStream : public AppendableAudioStream { protected: byte *_bufferStart; byte *_bufferEnd; @@ -144,8 +144,8 @@ protected: inline bool eosIntern() const { return _end == _pos; }; public: - WrappedMemoryStream(int rate, uint bufferSize); - ~WrappedMemoryStream() { free(_bufferStart); } + AppendableMemoryStream(int rate, uint bufferSize); + ~AppendableMemoryStream() { free(_bufferStart); } int readBuffer(int16 *buffer, const int numSamples); int16 read(); @@ -161,7 +161,7 @@ public: template -WrappedMemoryStream::WrappedMemoryStream(int rate, uint bufferSize) +AppendableMemoryStream::AppendableMemoryStream(int rate, uint bufferSize) : _finalized(false), _rate(rate) { // Verify the buffer size is sane @@ -176,7 +176,7 @@ WrappedMemoryStream::WrappedMemoryStream(int rate, } template -inline int16 WrappedMemoryStream::read() { +inline int16 AppendableMemoryStream::read() { assert(!eosIntern()); // Wrap around? @@ -190,7 +190,7 @@ inline int16 WrappedMemoryStream::read() { } template -int WrappedMemoryStream::readBuffer(int16 *buffer, const int numSamples) { +int AppendableMemoryStream::readBuffer(int16 *buffer, const int numSamples) { int samples = 0; while (samples < numSamples && !eosIntern()) { // Wrap around? @@ -209,7 +209,7 @@ int WrappedMemoryStream::readBuffer(int16 *buffer, } template -void WrappedMemoryStream::append(const byte *data, uint32 len) { +void AppendableMemoryStream::append(const byte *data, uint32 len) { // Verify the buffer size is sane if (is16Bit && stereo) @@ -225,7 +225,7 @@ void WrappedMemoryStream::append(const byte *data, uint32 size_to_end_of_buffer = _bufferEnd - _end; len -= size_to_end_of_buffer; if ((_end < _pos) || (_bufferStart + len >= _pos)) { - warning("WrappedMemoryStream: buffer overflow (A)"); + warning("AppendableMemoryStream: buffer overflow (A)"); return; } memcpy(_end, data, size_to_end_of_buffer); @@ -233,7 +233,7 @@ void WrappedMemoryStream::append(const byte *data, _end = _bufferStart + len; } else { if ((_end < _pos) && (_end + len >= _pos)) { - warning("WrappedMemoryStream: buffer overflow (B)"); + warning("AppendableMemoryStream: buffer overflow (B)"); return; } memcpy(_end, data, len); @@ -250,7 +250,7 @@ void WrappedMemoryStream::append(const byte *data, #if 0 // Work in progress!!! Not yet usable/finished/working/anything :-) -class ProcInputStream : public AudioInputStream { +class ProcInputStream : public AudioStream { public: typedef void InputProc (void *refCon, int16 *data, uint len); @@ -302,7 +302,7 @@ public: } else \ return new LinearMemoryStream(rate, ptr, len, loopOffset, loopLen, autoFree) -AudioInputStream *makeLinearInputStream(int rate, byte _flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen) { +AudioStream *makeLinearInputStream(int rate, byte _flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen) { const bool isStereo = (_flags & SoundMixer::FLAG_STEREO) != 0; const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0; const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0; @@ -326,11 +326,11 @@ AudioInputStream *makeLinearInputStream(int rate, byte _flags, const byte *ptr, #define MAKE_WRAPPED(STEREO, UNSIGNED) \ if (is16Bit) \ - return new WrappedMemoryStream(rate, len); \ + return new AppendableMemoryStream(rate, len); \ else \ - return new WrappedMemoryStream(rate, len) + return new AppendableMemoryStream(rate, len) -WrappedAudioInputStream *makeWrappedInputStream(int rate, byte _flags, uint32 len) { +AppendableAudioStream *makeAppendableAudioStream(int rate, byte _flags, uint32 len) { const bool isStereo = (_flags & SoundMixer::FLAG_STEREO) != 0; const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0; const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0; diff --git a/sound/audiostream.h b/sound/audiostream.h index e31c3ac505..ba381880e7 100644 --- a/sound/audiostream.h +++ b/sound/audiostream.h @@ -30,9 +30,9 @@ /** * Generic input stream for the resampling code. */ -class AudioInputStream { +class AudioStream { public: - virtual ~AudioInputStream() {} + virtual ~AudioStream() {} /** * Fill the given buffer with up to numSamples samples. @@ -48,7 +48,7 @@ public: /** * Read a single (16 bit signed) sample from the stream. */ - virtual int16 read() = 0; +// virtual int16 read() = 0; /** Is this a stereo stream? */ virtual bool isStereo() const = 0; @@ -76,13 +76,13 @@ public: virtual int getRate() const = 0; }; -class WrappedAudioInputStream : public AudioInputStream { +class AppendableAudioStream : public AudioStream { public: virtual void append(const byte *data, uint32 len) = 0; virtual void finish() = 0; }; -class ZeroInputStream : public AudioInputStream { +class ZeroInputStream : public AudioStream { private: int _len; public: @@ -100,7 +100,7 @@ public: int getRate() const { return -1; } }; -AudioInputStream *makeLinearInputStream(int rate, byte _flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen); -WrappedAudioInputStream *makeWrappedInputStream(int rate, byte _flags, uint32 len); +AudioStream *makeLinearInputStream(int rate, byte _flags, const byte *ptr, uint32 len, uint loopOffset, uint loopLen); +AppendableAudioStream *makeAppendableAudioStream(int rate, byte _flags, uint32 len); #endif diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 1312e11c38..ff414e46c5 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -52,12 +52,12 @@ private: protected: RateConverter *_converter; - AudioInputStream *_input; + AudioStream *_input; public: Channel(SoundMixer *mixer, PlayingSoundHandle *handle, bool isMusic, byte volume, int8 pan, int id = -1); - Channel(SoundMixer *mixer, PlayingSoundHandle *handle, AudioInputStream *input, bool autofreeStream, bool isMusic, byte volume, int8 pan, bool reverseStereo = false, int id = -1); + Channel(SoundMixer *mixer, PlayingSoundHandle *handle, AudioStream *input, bool autofreeStream, bool isMusic, byte volume, int8 pan, bool reverseStereo = false, int id = -1); virtual ~Channel(); void mix(int16 *data, uint len); @@ -229,7 +229,7 @@ void SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, u } // Create the input stream - AudioInputStream *input; + AudioStream *input; if (flags & SoundMixer::FLAG_LOOP) { if (loopEnd == 0) { input = makeLinearInputStream(rate, flags, (byte *)sound, size, 0, size); @@ -249,7 +249,7 @@ void SoundMixer::playRaw(PlayingSoundHandle *handle, void *sound, uint32 size, u #ifdef USE_MAD void SoundMixer::playMP3(PlayingSoundHandle *handle, File *file, uint32 size, byte volume, int8 pan, int id) { // Create the input stream - AudioInputStream *input = makeMP3Stream(file, size); + AudioStream *input = makeMP3Stream(file, size); playInputStream(handle, input, false, volume, pan, id); } #endif @@ -257,12 +257,12 @@ void SoundMixer::playMP3(PlayingSoundHandle *handle, File *file, uint32 size, by #ifdef USE_VORBIS void SoundMixer::playVorbis(PlayingSoundHandle *handle, File *file, uint32 size, byte volume, int8 pan, int id) { // Create the input stream - AudioInputStream *input = makeVorbisStream(file, size); + AudioStream *input = makeVorbisStream(file, size); playInputStream(handle, input, false, volume, pan, id); } #endif -void SoundMixer::playInputStream(PlayingSoundHandle *handle, AudioInputStream *input, bool isMusic, byte volume, int8 pan, int id, bool autofreeStream) { +void SoundMixer::playInputStream(PlayingSoundHandle *handle, AudioStream *input, bool isMusic, byte volume, int8 pan, int id, bool autofreeStream) { Common::StackLock lock(_mutex); if (input == 0) { @@ -467,7 +467,7 @@ Channel::Channel(SoundMixer *mixer, PlayingSoundHandle *handle, bool isMusic, assert(mixer); } -Channel::Channel(SoundMixer *mixer, PlayingSoundHandle *handle, AudioInputStream *input, +Channel::Channel(SoundMixer *mixer, PlayingSoundHandle *handle, AudioStream *input, bool autofreeStream, bool isMusic, byte volume, int8 pan, bool reverseStereo, int id) : _mixer(mixer), _handle(handle), _autofreeStream(autofreeStream), _isMusic(isMusic), _volume(volume), _pan(pan), _paused(false), _id(id), _converter(0), _input(input) { @@ -519,16 +519,16 @@ ChannelStream::ChannelStream(SoundMixer *mixer, PlayingSoundHandle *handle, uint rate, byte flags, uint32 buffer_size, byte volume, int8 pan) : Channel(mixer, handle, true, volume, pan) { // Create the input stream - _input = makeWrappedInputStream(rate, flags, buffer_size); + _input = makeAppendableAudioStream(rate, flags, buffer_size); // Get a rate converter instance _converter = makeRateConverter(_input->getRate(), mixer->getOutputRate(), _input->isStereo(), (flags & SoundMixer::FLAG_REVERSE_STEREO) != 0); } void ChannelStream::finish() { - ((WrappedAudioInputStream *)_input)->finish(); + ((AppendableAudioStream *)_input)->finish(); } void ChannelStream::append(void *data, uint32 len) { - ((WrappedAudioInputStream *)_input)->append((const byte *)data, len); + ((AppendableAudioStream *)_input)->append((const byte *)data, len); } diff --git a/sound/mixer.h b/sound/mixer.h index 6e88b11069..497191f5ee 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -28,7 +28,7 @@ #include "common/system.h" -class AudioInputStream; +class AudioStream; class Channel; class File; @@ -113,7 +113,7 @@ public: void playVorbis(PlayingSoundHandle *handle, File *file, uint32 size, byte volume = 255, int8 pan = 0, int id = -1); #endif - void playInputStream(PlayingSoundHandle *handle, AudioInputStream *input, bool isMusic, byte volume = 255, int8 pan = 0, int id = -1, bool autofreeStream = true); + void playInputStream(PlayingSoundHandle *handle, AudioStream *input, bool isMusic, byte volume = 255, int8 pan = 0, int id = -1, bool autofreeStream = true); /** Start a new stream. */ diff --git a/sound/mp3.cpp b/sound/mp3.cpp index 6c74c27d7f..1784300aae 100644 --- a/sound/mp3.cpp +++ b/sound/mp3.cpp @@ -37,7 +37,7 @@ #pragma mark - -class MP3InputStream : public AudioInputStream { +class MP3InputStream : public AudioStream { struct mad_stream _stream; struct mad_frame _frame; struct mad_synth _synth; @@ -261,7 +261,7 @@ int MP3InputStream::readBuffer(int16 *buffer, const int numSamples) { return samples; } -AudioInputStream *makeMP3Stream(File *file, uint size) { +AudioStream *makeMP3Stream(File *file, uint size) { return new MP3InputStream(file, mad_timer_zero, size); } @@ -376,7 +376,7 @@ void MP3TrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int start } // Play it - AudioInputStream *input = new MP3InputStream(_file, durationTime, 0); + AudioStream *input = new MP3InputStream(_file, durationTime, 0); mixer->playInputStream(handle, input, true); } diff --git a/sound/mp3.h b/sound/mp3.h index b0a1ee323d..e6b11b26a6 100644 --- a/sound/mp3.h +++ b/sound/mp3.h @@ -27,13 +27,13 @@ #ifdef USE_MAD -class AudioInputStream; +class AudioStream; class DigitalTrackInfo; class File; DigitalTrackInfo *makeMP3TrackInfo(File *file); -AudioInputStream *makeMP3Stream(File *file, uint size); +AudioStream *makeMP3Stream(File *file, uint size); #endif diff --git a/sound/rate.cpp b/sound/rate.cpp index 352243bc79..5d663867c2 100644 --- a/sound/rate.cpp +++ b/sound/rate.cpp @@ -80,7 +80,7 @@ protected: public: LinearRateConverter(st_rate_t inrate, st_rate_t outrate); - int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r); + int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r); int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) { return (ST_SUCCESS); } @@ -124,7 +124,7 @@ LinearRateConverter::LinearRateConverter(st_rate_t inrate * Return number of samples processed. */ template -int LinearRateConverter::flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) { +int LinearRateConverter::flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) { st_sample_t *ostart, *oend; st_sample_t out[2]; @@ -203,7 +203,7 @@ public: free(_buffer); } - virtual int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) { + virtual int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) { assert(input.isStereo() == stereo); st_sample_t *ptr; diff --git a/sound/rate.h b/sound/rate.h index f6d0304dcd..bd1c104ab1 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -27,7 +27,7 @@ #include "common/util.h" //#include "sound/audiostream.h" -class AudioInputStream; +class AudioStream; typedef int16 st_sample_t; typedef uint16 st_volume_t; @@ -71,7 +71,7 @@ class RateConverter { public: RateConverter() {} virtual ~RateConverter() {} - virtual int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) = 0; + virtual int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol_l, st_volume_t vol_r) = 0; virtual int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol) = 0; }; diff --git a/sound/resample.cpp b/sound/resample.cpp index 5a772389fb..fc87619e03 100644 --- a/sound/resample.cpp +++ b/sound/resample.cpp @@ -681,7 +681,7 @@ int st_resample_start(resample_t r, st_rate_t inrate, st_rate_t outrate) { * Processed signed long samples from ibuf to obuf. * Return number of samples processed. */ -int st_resample_flow(resample_t r, AudioInputStream &input, st_sample_t *obuf, st_size_t *osamp, st_volume_t vol) { +int st_resample_flow(resample_t r, AudioStream &input, st_sample_t *obuf, st_size_t *osamp, st_volume_t vol) { long i, k, last; long Nout = 0; // The number of bytes we effectively output long Nx; // The number of bytes we will read from input @@ -689,7 +689,7 @@ int st_resample_flow(resample_t r, AudioInputStream &input, st_sample_t *obuf, s const long obufSize = *osamp; /* -TODO: adjust for the changes made to AudioInputStream; add support for stereo +TODO: adjust for the changes made to AudioStream; add support for stereo initially, could just average the left/right channel -> bad for quality of course, but easiest to implement and would get this going again. Next step is to duplicate the X/Y buffers... a lot of computations don't care about @@ -946,7 +946,7 @@ ResampleRateConverter::~ResampleRateConverter() { free(Y2); } -int ResampleRateConverter::flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol) { +int ResampleRateConverter::flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol) { // return st_resample_flow(&rstuff, input, obuf, &osamp, vol); return 0; } diff --git a/sound/resample.h b/sound/resample.h index 46c33244ce..e235b95d78 100644 --- a/sound/resample.h +++ b/sound/resample.h @@ -85,7 +85,7 @@ protected: public: ResampleRateConverter(st_rate_t inrate, st_rate_t outrate, int quality); ~ResampleRateConverter(); - virtual int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol); + virtual int flow(AudioStream &input, st_sample_t *obuf, st_size_t osamp, st_volume_t vol); virtual int drain(st_sample_t *obuf, st_size_t osamp, st_volume_t vol); }; diff --git a/sound/voc.cpp b/sound/voc.cpp index f3d3d1319a..f6583b3631 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -152,14 +152,14 @@ byte *loadVOCFile(File *file, int &size, int &rate) { return data; } -AudioInputStream *makeVOCStream(byte *ptr) { +AudioStream *makeVOCStream(byte *ptr) { int size, rate, loops; byte *data = readVOCFromMemory(ptr, size, rate, loops); return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0); } -AudioInputStream *makeVOCStream(File *file) { +AudioStream *makeVOCStream(File *file) { int size, rate; byte *data = loadVOCFile(file, size, rate); diff --git a/sound/voc.h b/sound/voc.h index fd9da916e5..a57c2a06be 100644 --- a/sound/voc.h +++ b/sound/voc.h @@ -26,7 +26,7 @@ #include "stdafx.h" #include "common/scummsys.h" -class AudioInputStream; +class AudioStream; class File; #if !defined(__GNUC__) @@ -60,7 +60,7 @@ extern int getSampleRateFromVOCRate(int vocSR); extern byte *readVOCFromMemory(byte *ptr, int &size, int &rate, int &loops); extern byte *loadVOCFile(File *file, int &size, int &rate); -AudioInputStream *makeVOCStream(byte *ptr); -AudioInputStream *makeVOCStream(File *file); +AudioStream *makeVOCStream(byte *ptr); +AudioStream *makeVOCStream(File *file); #endif diff --git a/sound/vorbis.cpp b/sound/vorbis.cpp index bcee8b792b..e0b7bd0b57 100644 --- a/sound/vorbis.cpp +++ b/sound/vorbis.cpp @@ -32,7 +32,7 @@ #include -AudioInputStream *makeVorbisStream(OggVorbis_File *file, int duration); +AudioStream *makeVorbisStream(OggVorbis_File *file, int duration); #pragma mark - @@ -145,7 +145,7 @@ void VorbisTrackInfo::play(SoundMixer *mixer, PlayingSoundHandle *handle, int st ov_time_seek(&_ov_file, startFrame / 75.0); #endif - AudioInputStream *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); mixer->playInputStream(handle, input, true); } @@ -165,7 +165,7 @@ DigitalTrackInfo *makeVorbisTrackInfo(File *file) { #pragma mark - -class VorbisInputStream : public AudioInputStream { +class VorbisInputStream : public AudioStream { OggVorbis_File *_ov_file; int _end_pos; int _numChannels; @@ -274,11 +274,11 @@ void VorbisInputStream::refill() { _bufferEnd = (int16 *)read_pos; } -AudioInputStream *makeVorbisStream(OggVorbis_File *file, int duration) { +AudioStream *makeVorbisStream(OggVorbis_File *file, int duration) { return new VorbisInputStream(file, duration); } -AudioInputStream *makeVorbisStream(File *file, uint32 size) { +AudioStream *makeVorbisStream(File *file, uint32 size) { OggVorbis_File *ov_file = new OggVorbis_File; file_info *f = new file_info; diff --git a/sound/vorbis.h b/sound/vorbis.h index 3241f884ae..c09baca3e9 100644 --- a/sound/vorbis.h +++ b/sound/vorbis.h @@ -27,13 +27,13 @@ #ifdef USE_VORBIS -class AudioInputStream; +class AudioStream; class DigitalTrackInfo; class File; DigitalTrackInfo *makeVorbisTrackInfo(File *file); -AudioInputStream *makeVorbisStream(File *file, uint32 size); +AudioStream *makeVorbisStream(File *file, uint32 size); #endif -- cgit v1.2.3