aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;