test/loopwave.c
branchSDL-1.2
changeset 4002 e905bb5d9bc3
parent 1769 290b5baf2fca
equal deleted inserted replaced
4001:6831b8723a85 4002:e905bb5d9bc3
    41 	waveptr = wave.sound + wave.soundpos;
    41 	waveptr = wave.sound + wave.soundpos;
    42 	waveleft = wave.soundlen - wave.soundpos;
    42 	waveleft = wave.soundlen - wave.soundpos;
    43 
    43 
    44 	/* Go! */
    44 	/* Go! */
    45 	while ( waveleft <= len ) {
    45 	while ( waveleft <= len ) {
    46 		SDL_MixAudio(stream, waveptr, waveleft, SDL_MIX_MAXVOLUME);
    46 		SDL_memcpy(stream, waveptr, waveleft);
    47 		stream += waveleft;
    47 		stream += waveleft;
    48 		len -= waveleft;
    48 		len -= waveleft;
    49 		waveptr = wave.sound;
    49 		waveptr = wave.sound;
    50 		waveleft = wave.soundlen;
    50 		waveleft = wave.soundlen;
    51 		wave.soundpos = 0;
    51 		wave.soundpos = 0;
    52 	}
    52 	}
    53 	SDL_MixAudio(stream, waveptr, len, SDL_MIX_MAXVOLUME);
    53 	SDL_memcpy(stream, waveptr, len);
    54 	wave.soundpos += len;
    54 	wave.soundpos += len;
    55 }
    55 }
    56 
    56 
    57 static int done = 0;
    57 static int done = 0;
    58 void poked(int sig)
    58 void poked(int sig)