test/loopwave.c
changeset 2145 5c14978b1e97
parent 2049 5f6550e5184f
child 2179 8b76cc268771
equal deleted inserted replaced
2144:665c2669e6a3 2145:5c14978b1e97
    44     waveptr = wave.sound + wave.soundpos;
    44     waveptr = wave.sound + wave.soundpos;
    45     waveleft = wave.soundlen - wave.soundpos;
    45     waveleft = wave.soundlen - wave.soundpos;
    46 
    46 
    47     /* Go! */
    47     /* Go! */
    48     while (waveleft <= len) {
    48     while (waveleft <= len) {
    49         SDL_MixAudio(stream, waveptr, waveleft, SDL_MIX_MAXVOLUME);
    49         SDL_memcpy(stream, waveptr, waveleft);
    50         stream += waveleft;
    50         stream += waveleft;
    51         len -= waveleft;
    51         len -= waveleft;
    52         waveptr = wave.sound;
    52         waveptr = wave.sound;
    53         waveleft = wave.soundlen;
    53         waveleft = wave.soundlen;
    54         wave.soundpos = 0;
    54         wave.soundpos = 0;
    55     }
    55     }
    56     SDL_MixAudio(stream, waveptr, len, SDL_MIX_MAXVOLUME);
    56     SDL_memcpy(stream, waveptr, len);
    57     wave.soundpos += len;
    57     wave.soundpos += len;
    58 }
    58 }
    59 
    59 
    60 static int done = 0;
    60 static int done = 0;
    61 void
    61 void