diff options
| author | Max Horn | 2003-09-11 22:57:06 +0000 |
|---|---|---|
| committer | Max Horn | 2003-09-11 22:57:06 +0000 |
| commit | 9e88df9e16bebd907e0f7afe22c09fc56a0696c9 (patch) | |
| tree | 5b890c3796030644657f499f55115a05e0b55c7f | |
| parent | 538812d9fc25d572bec89bb9559221c7776aa1f4 (diff) | |
| download | scummvm-rg350-9e88df9e16bebd907e0f7afe22c09fc56a0696c9.tar.gz scummvm-rg350-9e88df9e16bebd907e0f7afe22c09fc56a0696c9.tar.bz2 scummvm-rg350-9e88df9e16bebd907e0f7afe22c09fc56a0696c9.zip | |
some (untested!) support for backends which require unsigned audio samples
svn-id: r10183
| -rw-r--r-- | sound/rate.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sound/rate.h b/sound/rate.h index e1f72065bd..364c14f763 100644 --- a/sound/rate.h +++ b/sound/rate.h @@ -42,14 +42,23 @@ typedef uint32 st_rate_t; #define ST_SUCCESS (0) static inline void clampedAdd(int16& a, int b) { - register int val = a + b; + register int val; +#ifdef OUTPUT_UNSIGNED_AUDIO + val = (a ^ 0x8000) + b; +#else + val = a + b; +#endif if (val > ST_SAMPLE_MAX) val = ST_SAMPLE_MAX; else if (val < ST_SAMPLE_MIN) val = ST_SAMPLE_MIN; +#ifdef OUTPUT_UNSIGNED_AUDIO + a = ((int16)val) ^ 0x8000; +#else a = val; +#endif } // Q&D hack to get this SOX stuff to work |
