rncbc / drumkv1

drumkv1 - an old-school drum-kit sampler
https://drumkv1.sourceforge.io
GNU General Public License v2.0
35 stars 7 forks source link

How does element picker work? #46

Open AnClark opened 1 year ago

AnClark commented 1 year ago

Hi, Rui!

I'm porting DrumkV1 to DPF, DISTRHO Plugin Framework. And I encountered a problem:

In official LV2 version, when I pick an element from the element list (the listbox on the left of sample view), sample view and other controllers changes corresponding to the element's params.

But in my implementation, things are not what I wish. No matter how I touch the element list, UI won't change.

So I wonder how does the element list work. Does it relate to features of LV2?

My repo: https://github.com/anclark/drumkv1/tree/dpf-implementation

rncbc commented 1 year ago

it relies on lv2 instance-access, something I guess it's banned on the DPF , last time i've checked, eons ago

AnClark commented 1 year ago

Actually, in DPF, I can use instance-access with DPF_PLUGIN_WANTS_DIRECT_ACCESS activated:

https://github.com/AnClark/drumkv1/blob/5b92448ecd184641bc23eefacb8ca804251eb54b/src/DistrhoPluginInfo.h#L42


In your official LV2 implementation (drumkv1_lv2.cpp or drumkv1_lv2ui.cpp), I wonder where the plugin updates the element params.

AnClark commented 1 year ago

Seems that this line relates to that feature:

https://github.com/rncbc/drumkv1/blob/86e159cc2dd470601dd4261f4013067f6558555e/src/drumkv1_lv2.cpp#L823

In my implementation, I directly call it in drumkv1_dpf::selectSample(int) in drumkv1_dpf.cpp, like this:

void drumkv1_dpf::selectSample (int key)
{
    fprintf(stderr, ">> Trigger selectSample, key = %d\n", key);
    drumkv1::setCurrentElementEx(key);
}

However, it still does not work as what I wish.