Thank you all for the responses! On Mon, Feb 29, 2016 at 9:05 PM, Harry van Haaren <harryhaa...@gmail.com> wrote: > On Mon, Feb 29, 2016 at 7:52 PM, Spencer Jackson <ssjackso...@gmail.com> > wrote: >> > The generic solution for cases like this is a lock-free ringbuffer. >> I've also used the jack ringbuffer for this and it was easy enough. > > Simple tutorial on using JACK ringbuffer and C++ event class here: > https://github.com/harryhaaren/realtimeAudioThreading
I've looked into JACK's ringbuffer implementation. It doesn't look too complicated. Thank you all for suggesting it! But I'm a little bit concerned about ISO standard compliance. According to the multi-threading-aware update to the C11 and C++11 memory models, the access to the ringbuffer's data (*buf) is technically a data race and therefore invokes undefined behaviour. Only read_ptr/write_ptr are somewhat protected (volatile). From what I understand, given the C11/C++11 memory model, one is supposed to use "atomics" for all read/write accesses in such situations (including *buf). But so far, I havn't gathered much experience in this kind of lock-free programming. >> >> But to be honest I've found this API to be a bit intimidating and I'm >> >> not familiar with any LV2 host that would allow me to test such a >> >> plugin. Any recommendations? Ardour? >> > >> > jalv, Carla, QTractor, Ardour.. > > +1 for Jalv, very fast turnover time, and LV2 implementation > by the lead LV2 developer: I concider it the reference implementation :) Sounds good! I'll look into it... >> > A LV2 simple synth example can be found at >> > http://lv2plug.in/book/#_sampler >> >> I like jalv for debugging because its quite simple and quick to load. >> I can run it with gdb and valgrind/callgrind without any trouble. I've >> found it important to test in other hosts too though but only once its >> working in jalv. > > +1 again > >> FWIW I hope you do make an LV2 plugin version as I rarely use >> standalone synths these days. > > +1, and LV2 is supported by MOD (hardware platform that runs LV2): > http://moddevices.com/ and https://vimeo.com/92739423 Yup. I see the benefit of having a synth as LV2 plugin instead of standalone. It's more flexible and I would have to reinvent less wheels. I just need to make friends with some of the LV2 hosts first. >> If you have any questions about my code I've linked you are welcome to >> ask. Also, LV2 has a ML and IRC channel and I'll be happy to offer any >> advice or support there that I can too. > > Same! Great! Cheers! SG _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev