>> this is very dangerous. you must never call snd_pcm_mmap_commit() >> *before* you have actually written the data. > >i tought _mmap_commit() does only updating some sw-pointers for >alsa and has no real effect in the sense of commiting frames or >whatever. cause it's also only the only process (thread) which is >writing to the sounddevice it seems to be no problem to put it after >_mmap_commit(). but you are right that it's somehow cleaner and more >logical to put it before.
its not the only thread involved, however. the interrupt handler for the audio interface will be looking at the sw ptrs to check if an xrun has occurred, and may stop the card if one has (depending on the sw params). if you update the sw ptrs before actually copying the data, you will avoid the interrupt handler from realizing this, but the audible effect will still be horrible.
