--- uae-0.8.29-orig/src/sd-file/sound.c 2008-11-30 10:18:27 +0900 +++ uae-0.8.29/src/sd-file/sound.c 2009-06-21 11:55:43 +0900 @@ -93,7 +93,7 @@ buf[t+2] = (v>>16) & 255; buf[t+3] = (v>>24) & 255; - t = 20; v = 0x00010001 + (/* currprefs.stereo */ 1 ? 0x10000 : 0); + t = 20; v = 0x00010001 + (currprefs.sound_stereo ? 0x10000 : 0); buf[t] = v & 255; buf[t+1] = (v>>8) & 255; buf[t+2] = (v>>16) & 255; @@ -104,12 +104,14 @@ buf[t+1] = (v>>8) & 255; buf[t+2] = (v>>16) & 255; buf[t+3] = (v>>24) & 255; - t = 32; v = (2 * 2) + 65536 * 16; + t = 32; v = ((currprefs.sound_bits == 8 ? 1 : 2) + * (currprefs.sound_stereo ? 2 : 1)) + 65536*currprefs.sound_bits; buf[t] = v & 255; buf[t+1] = (v>>8) & 255; buf[t+2] = (v>>16) & 255; buf[t+3] = (v>>24) & 255; - t = 28; v = (currprefs.sound_freq * 2 * 2); + t = 28; v = (currprefs.sound_freq * (currprefs.sound_bits == 8 ? 1 : 2) + * (currprefs.sound_stereo ? 2 : 1)); buf[t] = v & 255; buf[t+1] = (v>>8) & 255; buf[t+2] = (v>>16) & 255; @@ -118,8 +120,13 @@ obtained_freq = currprefs.sound_freq; - init_sound_table16 (); - sample_handler = sample16s_handler; + if (currprefs.sound_bits == 16) { + init_sound_table16 (); + sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; + } else { + init_sound_table8 (); + sample_handler = currprefs.sound_stereo ? sample8s_handler : sample8_handler; + } sound_available = 1; sndbufsize = 44100; printf ("Writing sound into \"sound.output\"; 16 bits at %d Hz\n",