On Tue, Jun 18, 2002 at 07:47:59PM +0200, dunk fordyce wrote: > now im wondering whats the best way to play multiple samples at once?
That would require mixing the different samples (i.e. adding the pcm values and doing clipping). // 16-bit samples, int16_t buf1[1024], buf2[1024], out[1024]; int32_t mix; while (...) { // Do as long as there are samples available // Fill buf1 and buf2 with PCM data from different samples for (int c=0; c < 1024; c++) { mix = buf1[c] + buf2[c]; if (mix > 32768) out[c] = 32768; else if (mix < -32767) out[c] = -32767; else out[c] = (int16_t)mix; } snd_pcm_writei(sound_handle, out, sizeof(out)); } The above is just psuedo code. You can also look at somethink like JACK (http://jackit.sf.net) if you prefer a callback driven interface. Good luck, Andy ---------------------------------------------------------------------------- Bringing you mounds of caffeinated joy >>> http://thinkgeek.com/sf <<< _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel