diff options
author | Max Horn | 2003-07-28 11:13:01 +0000 |
---|---|---|
committer | Max Horn | 2003-07-28 11:13:01 +0000 |
commit | 9e051fa5070cd70ff0e69faa647ad26f66b64560 (patch) | |
tree | a54a6d7cf2305ff77012f1c1c8da345e10fbe2e0 /sound/rate.h | |
parent | 2b0c2a20b2ccf78832fe147ebe6a98b5277048ac (diff) | |
download | scummvm-rg350-9e051fa5070cd70ff0e69faa647ad26f66b64560.tar.gz scummvm-rg350-9e051fa5070cd70ff0e69faa647ad26f66b64560.tar.bz2 scummvm-rg350-9e051fa5070cd70ff0e69faa647ad26f66b64560.zip |
instead of 'int channels', use 'bool stereo' (less extensible, but then I don't think we'll ever support 5.1 sound :-)); fixed a bug in st_rate_flow where it sometimes would overflow the output buffer; made CopyRateConverter a template, too, increasing efficency
svn-id: r9239
Diffstat (limited to 'sound/rate.h')
-rw-r--r-- | sound/rate.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/rate.h b/sound/rate.h index 809042a8b2..72ae5a6021 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -81,15 +81,17 @@ public: virtual int drain(st_sample_t *obuf, st_size_t *osamp, st_volume_t vol); }; +template<bool stereo> class CopyRateConverter : public RateConverter { public: virtual int flow(AudioInputStream &input, st_sample_t *obuf, st_size_t *osamp, st_volume_t vol) { int16 tmp; st_size_t len = *osamp; + assert(input.isStereo() == stereo); while (!input.eof() && len--) { tmp = input.read() * vol / 256; clampedAdd(*obuf++, tmp); - if (input.isStereo()) + if (stereo) tmp = input.read() * vol / 256; clampedAdd(*obuf++, tmp); } |