aboutsummaryrefslogtreecommitdiff
path: root/x11.cpp
diff options
context:
space:
mode:
authorLionel Ulmer2002-05-18 14:53:19 +0000
committerLionel Ulmer2002-05-18 14:53:19 +0000
commit3b4c6ceb0f621b68a5a44922d7218987faedb10e (patch)
tree55d9b1ff3d1cb7fb60612360eef2d26b87167d86 /x11.cpp
parent53f993be44ac34c3f17677cb432a366dec962824 (diff)
downloadscummvm-rg350-3b4c6ceb0f621b68a5a44922d7218987faedb10e.tar.gz
scummvm-rg350-3b4c6ceb0f621b68a5a44922d7218987faedb10e.tar.bz2
scummvm-rg350-3b4c6ceb0f621b68a5a44922d7218987faedb10e.zip
Added infrastructure to support more than 8 bit signed / unsigned RAW
mixers. Porters, beware, the default configuration is now 16 bit stereo instead of 16 mono as before (I changed X11 and SDL but no others). I did not add support for any other format yet, I will let Endy do it when he needs it :-) svn-id: r4348
Diffstat (limited to 'x11.cpp')
-rw-r--r--x11.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/x11.cpp b/x11.cpp
index e88a298f6d..b33c0c89e4 100644
--- a/x11.cpp
+++ b/x11.cpp
@@ -256,21 +256,18 @@ static void *sound_and_music_thread(void *params)
sched_yield();
while (1) {
- unsigned short *buf = (unsigned short *)sound_buffer;
+ unsigned char *buf = (unsigned char *)sound_buffer;
int size, written;
- sound_proc(proc_param, (byte *)sound_buffer, FRAG_SIZE >> 1);
- /* Now convert to stereo */
- for (int i = ((FRAG_SIZE >> 2) - 1); i >= 0; i--) {
- buf[2 * i + 1] = buf[2 * i] = buf[i];
- }
+ sound_proc(proc_param, (byte *)sound_buffer, FRAG_SIZE);
#ifdef CAPTURE_SOUND
fwrite(buf, 2, FRAG_SIZE >> 1, f);
fflush(f);
#endif
size = FRAG_SIZE;
while (size > 0) {
- written = write(sound_fd, sound_buffer, size);
+ written = write(sound_fd, buf, size);
+ buf += written;
size -= written;
}
}