diff options
author | Max Horn | 2003-08-01 12:49:24 +0000 |
---|---|---|
committer | Max Horn | 2003-08-01 12:49:24 +0000 |
commit | d9bd77032a9f70ca34dbd917224dcc9bc37cfa0c (patch) | |
tree | 8ac0289e93b4f72710ad4acbb812f98dba4b695a /sound/audiostream.cpp | |
parent | 0df319e9520aa6fdcaff96f91826ccd7cff2c14a (diff) | |
download | scummvm-rg350-d9bd77032a9f70ca34dbd917224dcc9bc37cfa0c.tar.gz scummvm-rg350-d9bd77032a9f70ca34dbd917224dcc9bc37cfa0c.tar.bz2 scummvm-rg350-d9bd77032a9f70ca34dbd917224dcc9bc37cfa0c.zip |
implemented raw sound looping; some debug output enabled temporarily
svn-id: r9360
Diffstat (limited to 'sound/audiostream.cpp')
-rw-r--r-- | sound/audiostream.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index 133333503b..b6ac2d08a1 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -40,7 +40,7 @@ static inline int16 readSample(const byte *ptr) { template<bool stereo, bool is16Bit, bool isUnsigned> -class LinearMemoryStream : public AudioInputStream { +class LinearMemoryStream : public LinearAudioInputStream { protected: const byte *_ptr; const byte *_end; @@ -58,11 +58,17 @@ public: return val; } bool eof() const { - return _end <= _ptr; + return _ptr >= _end; } bool isStereo() const { return stereo; } + void reset(const byte *data, uint32 len) { + _ptr = data; + _end = data + len; + if (stereo) // Stereo requires even sized data + assert(len % 2 == 0); + } }; @@ -413,7 +419,7 @@ void VorbisInputStream::refill() { template<bool stereo> -static AudioInputStream *makeLinearInputStream(const byte *ptr, uint32 len, bool is16Bit, bool isUnsigned) { +static LinearAudioInputStream *makeLinearInputStream(const byte *ptr, uint32 len, bool is16Bit, bool isUnsigned) { if (isUnsigned) { if (is16Bit) return new LinearMemoryStream<stereo, true, true>(ptr, len); @@ -444,7 +450,7 @@ static WrappedAudioInputStream *makeWrappedInputStream(uint32 len, bool is16Bit, } -AudioInputStream *makeLinearInputStream(byte _flags, const byte *ptr, uint32 len) { +LinearAudioInputStream *makeLinearInputStream(byte _flags, const byte *ptr, uint32 len) { const bool is16Bit = (_flags & SoundMixer::FLAG_16BITS) != 0; const bool isUnsigned = (_flags & SoundMixer::FLAG_UNSIGNED) != 0; if (_flags & SoundMixer::FLAG_STEREO) { |