Hi everybody, i'm new to this list, so i hope this question is not off-topic.
I'm trying to play several samples in parallel or at certain undetermined points, e.g. when an event happens. To test this i load two different WAV files, that i can play independently, start the first one, do a "sleep(1)" and then start the second one. The samples play only for a very short time, this seems to be related to the "buffer_time". What value should i use for buffer_time? I've got the length of the sample, its rate, its number of channels and its bits per samplevalue. I tried length*1000000/rate/channels/bits_per_sample. This really seems to be the time in micro seconds, but one is played far too short. In detail, how i try to play a sample: I open one handle for each time i want to play a sample using "plughw:0,0" in NON_BLOCK mode, set format, channel, rate. Then i set the buffer_time according to the formula above, i also tried a "500000". I chose the period_time to be 100000. Then i get buffer_size and period_size. After that i set start_threshold to buffer_size and avail_min to period_size. Could this be the problem? xfer_align is set to 1 and then i start playing it by using "writei". This way i start to play one sample, do a "sleep(1)", start to play another sample, do a "sleep(1)", then i play the first sample again, using another handle. Has anybody got any hints for me? Has anybody got a working example where two sounds are played in parallel? This should be used in games somewhere. Do i need to use a handle for each sample i try to play? Do i need to chose another device name instead of "plughw:0,0" for each sample? I'd also like to use an async_handler to inform my program when a started sample is played completely. How can i do this? It seems that the handler is called (buffer_time/period_time) times during each sample, is that correct? Best regards, Torsten. http://www.s.netic.de/tmohr/linux.html _______________________________________________ Alsa-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/alsa-devel