mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 04:01:23 +00:00
some (untested!) support for backends which require unsigned audio samples
svn-id: r10183
This commit is contained in:
parent
538812d9fc
commit
9e88df9e16
11
sound/rate.h
11
sound/rate.h
@ -42,14 +42,23 @@ typedef uint32 st_rate_t;
|
|||||||
#define ST_SUCCESS (0)
|
#define ST_SUCCESS (0)
|
||||||
|
|
||||||
static inline void clampedAdd(int16& a, int b) {
|
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)
|
if (val > ST_SAMPLE_MAX)
|
||||||
val = ST_SAMPLE_MAX;
|
val = ST_SAMPLE_MAX;
|
||||||
else if (val < ST_SAMPLE_MIN)
|
else if (val < ST_SAMPLE_MIN)
|
||||||
val = ST_SAMPLE_MIN;
|
val = ST_SAMPLE_MIN;
|
||||||
|
|
||||||
|
#ifdef OUTPUT_UNSIGNED_AUDIO
|
||||||
|
a = ((int16)val) ^ 0x8000;
|
||||||
|
#else
|
||||||
a = val;
|
a = val;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Q&D hack to get this SOX stuff to work
|
// Q&D hack to get this SOX stuff to work
|
||||||
|
Loading…
x
Reference in New Issue
Block a user