Hello Takashi,
Now I have compiled and tested the patchies successfully. Some minor adaption where required. I have incorporated all your findings.
Please try to format the text a bit nicer. These line breaks appear like you're writing a poem :)i
Done.
You don't need to put inline unless it's really mandatory.
Done.
Hm, this whole stuff would fit better in ioplug code itself instead of open-coding in each plugin. Maybe providing a new helper function?
I am providing a new helper function called snd_pcm_ioplug_hw_avail() and I am reusing internally already existing functions.
Ditto. Basically the whole procedure here is some common pattern, so it wouldn't be too bad to have it in ioplug side.
I have provided a new area copy function which takes care about the buffer wrap around. This function is called snd_pcm_areas_copy_wrap(). This reduces the complexity of the JACK IO plug a lot. I have also compared the new implementation with other ALSA IO plugins. I could not found more simuilarities because not all plugins are creating a snd_pcm_channel_area_t for the DMA/HW buffer. Therefore functions like snd_pcm_areas_silence() and snd_pcm_areas_copy() cannot be used. For example the pulse IO plug is also not using snd_pcm_channel_area_t for the pulse buffer.
I hope you are fine with these changes, now. If not it would be great if you could give me a feedback in time.
Best regards
Timo