samples/audio/DirectBufferPlayer: Fixed playing 16 bit sounds
authorJerome St-Louis <jerome@ecere.com>
Fri, 18 Apr 2014 08:54:26 +0000 (04:54 -0400)
committerJerome St-Louis <jerome@ecere.com>
Fri, 18 Apr 2014 08:54:26 +0000 (04:54 -0400)
samples/audio/DirectBufferPlayer/wavPlayer.ec

index 790e5fc..4346806 100644 (file)
@@ -62,7 +62,7 @@ class Form1 : Window
    void AudioCallback(byte *stream, int len)
    {
       static byte buffer[AUDIO_BUFFER_SIZE];
-      int s = Min(sound.length - pos, len);
+      int s = Min(sound.length * (sound.bits == 16 ? 2 : 1) - pos, len);
       memcpy(buffer, sound.data + pos, s);
       pos += s;
       if(s < len)