aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-12-19 00:27:09 +0000
committerMax Horn2003-12-19 00:27:09 +0000
commit97ee61963c896e48a0acc5b4169ce96163e76b06 (patch)
tree67fb29271c611eeb1e2dd90e6148a4efa98ce049
parent32dd4cc0061de24c804bd7a9be9dfc6576dd19a1 (diff)
downloadscummvm-rg350-97ee61963c896e48a0acc5b4169ce96163e76b06.tar.gz
scummvm-rg350-97ee61963c896e48a0acc5b4169ce96163e76b06.tar.bz2
scummvm-rg350-97ee61963c896e48a0acc5b4169ce96163e76b06.zip
I am going to remove the default implementation of readBuffer() (AudioInputStream subclasses really really should implement readBuffer() for good performance)
svn-id: r11753
-rw-r--r--sword2/driver/d_sound.cpp4
-rw-r--r--sword2/driver/d_sound.h8
2 files changed, 9 insertions, 3 deletions
diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp
index 3d8011e4a0..c433620ea6 100644
--- a/sword2/driver/d_sound.cpp
+++ b/sword2/driver/d_sound.cpp
@@ -106,9 +106,7 @@ int16 MusicHandle::read() {
}
bool MusicHandle::eos() const {
- if (!_streaming || _filePos >= _fileEnd)
- return true;
- return false;
+ return (!_streaming || _filePos >= _fileEnd);
}
static void premix_proc(void *param, int16 *data, uint len) {
diff --git a/sword2/driver/d_sound.h b/sword2/driver/d_sound.h
index 3a273b8744..b36e402002 100644
--- a/sword2/driver/d_sound.h
+++ b/sword2/driver/d_sound.h
@@ -59,6 +59,14 @@ public:
bool isStereo() const { return false; }
int getRate() const { return 22050; }
+ virtual int readBuffer(int16 *buffer, const int numSamples) {
+ int samples;
+ for (samples = 0; samples < numSamples && !eos(); samples++) {
+ *buffer++ = read();
+ }
+ return samples;
+ }
+
int16 read();
bool eos() const;