[SOLVED] Drumkv1 does not load samples

MusE is a DAW for Linux with both MIDI and Audio editing. https://muse-sequencer.github.io

Moderators: MattKingUSA, khz, spamatica

User avatar
oscillator
Established Member
Posts: 1127
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Has thanked: 725 times
Been thanked: 296 times
Contact:

[SOLVED] Drumkv1 does not load samples

Post by oscillator »

Hi!

Using muse 3.0.2 and drumkv1 0.9.4 (and Debian 9 Stable).

When loading a new sample in drumkv1 plugin, nothing happens when I have pressed "Open" button. It is like nothing has been loaded.

Running the stand alone drumkv1_jack works ok, as does using drumkv1 in qtractor.

No message in log, even if I use the -D (or -D -D) switch.

Has anyone else experienced this or can help me?
Attachments
drumkv1_error.png
drumkv1_error.png (108.66 KiB) Viewed 1571 times
Last edited by oscillator on Thu Jul 18, 2019 6:36 am, edited 1 time in total.

MusE DAW running on Debian 11 Testing/XFCE4.
https://oscillator.se/musik

Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: Drumkv1 does not load samples

Post by Tim E. Real »

Tested: Observed.
Actually, it's intermittent. I got it to load a few times by trying again and again. But it's very touchy, it only worked a few times.

Sigh. Yet another plugin with UI problems in MusE...
User avatar
rncbc
Established Member
Posts: 1060
Joined: Mon Apr 19, 2010 12:20 pm
Has thanked: 45 times
Been thanked: 256 times
Contact:

Re: Drumkv1 does not load samples

Post by rncbc »

notwithstanding any issues on either side, v0.9.4 is way too old to make a stance!

please update to v0.9.8 or later--new rel coming up in a few days now;)

cheers
Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: Drumkv1 does not load samples

Post by Tim E. Real »

Hi Rui!
Yes I am using 0.9.8 on my side.
I am heavily debugging the situation...

Results so far...
Getting some very strange results in MusE...

I noticed that with MusE, in drumkv1's sample list, when I click or key up/down,
MusE receives the Qt event and sends it back to the plugin via QApplication::notify(),
BUT the plugin does not receive the signal most of the time.
The symptom is that most of the time the sample list window does not update correctly
and the GEN window does not update with the new list selection.

I put a breakpoint at moc_drumkv1widget.cpp line 194:

Code: Select all

        case 21: _t->updateSchedNotify((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
To my surprise, when I click or key up/down drumkv1's sample list, that slot is only being called sometimes,
and most of the time it is NOT being called.

Very strange. What could MusE be doing wrong.
Still checking...
Tim.
Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: Drumkv1 does not load samples

Post by Tim E. Real »

Same results with current drumkv1 git.
User avatar
rncbc
Established Member
Posts: 1060
Joined: Mon Apr 19, 2010 12:20 pm
Has thanked: 45 times
Been thanked: 256 times
Contact:

Re: Drumkv1 does not load samples

Post by rncbc »

hi Tim,

note that drumkv1.lv2 takes heavy use of the lv2_worker/schedule and lv2_patch/parameter interface protocols as also with traditional input control port(s) when changing sample elements in either way from a host generic/stock UI and/or from the native Qt/X11/external_ui.

otoh. notifications from the plugin to GUI (and in this direction only) is done via Qt's signal/slot mechanism (that being the updateSchedNotify() you're reading).

dunno about Muse, but this whole "complication" works fine on jalv, ardour(5.12 and 6+) and of course qtractor too.

hth.
cheers
User avatar
oscillator
Established Member
Posts: 1127
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Has thanked: 725 times
Been thanked: 296 times
Contact:

Re: Drumkv1 does not load samples

Post by oscillator »

Thank you Tim and Rui for helping me and looking into this.

Cheers,

Staffan

MusE DAW running on Debian 11 Testing/XFCE4.
https://oscillator.se/musik

User avatar
rncbc
Established Member
Posts: 1060
Joined: Mon Apr 19, 2010 12:20 pm
Has thanked: 45 times
Been thanked: 256 times
Contact:

Re: Drumkv1 does not load samples

Post by rncbc »

forgot to mention Carla the plugin swiss-army-knife these days...
you may test with it as long it works on Muse as well
cheers
User avatar
oscillator
Established Member
Posts: 1127
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Has thanked: 725 times
Been thanked: 296 times
Contact:

Re: Drumkv1 does not load samples

Post by oscillator »

That is a good idea. But what is the difference between using Carla and running drumkv1 stand alone?

I can load drumkv1 in Carla ok, but the first time I try to load a sample I get the same behaviour -- nothing happens. Second time it all works fine.

I have tried loading up drumkv1 in Carla and muse sends midi which I can see that drumkv1 receives in Carla. When I connect the drumkv1 outputs (using Catia) evertyhing works fine!

And this is with drumkv1 v 0.9.4. So I will compile and install 0.9.8 tonight.

Cadence, Catia and now Carla (first time use for me) = awesome software!

MusE DAW running on Debian 11 Testing/XFCE4.
https://oscillator.se/musik

User avatar
rncbc
Established Member
Posts: 1060
Joined: Mon Apr 19, 2010 12:20 pm
Has thanked: 45 times
Been thanked: 256 times
Contact:

Re: Drumkv1 does not load samples

Post by rncbc »

i meant Carla as a plugin inserted in Muse then drumkv1 inserted in Carla... yes kinda droste aka mise en abyme effect;)

cheers
Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: Drumkv1 does not load samples

Post by Tim E. Real »

Gotcha, ye bugger :twisted:
It's the old "using out-of-scope data, causing corruption" (TM).
Fixed in git master now.

Plugins that use the LV2 worker extension, such as the *v1 suite, typically might pass worker message data to the host,
to pass to the worker thread, and receive as a worker response.
The data passed, at least in drumkv1, is local and goes out of scope at the end of passing it.
Fault in MusE: We kept a local pointer to that passed data, and expected the data to 'hang around'
for the worker thread to eventually get around to using the data. Fail :!:

Solution: I installed a std::vector and copy the data not just the pointer :idea:
I use vector.resize() and then memcpy() whenever we get message data to be passed.

Tested OK with drumkv1, navigating sample list, opening samples, manipulating, presets etc.
This should help any plugin that uses workers.

Blatant excuse: "I didn't write the original code" :wink:
I was sooo hoping this would fix a few other plugins/suites/families but no, the others I tested don't use workers as much.

For the interested, here's the observed sequence of operations:

Code: Select all

[ Click or key up/down in drumkv1 sample list. ]

drumkv1_lv2::selectSample()
{
  ...
  m_schedule->schedule_work(); // OK. atom.type = gen1_select = 39, atom.size = 8, key good.
  ...
}

->

MusE::LV2Synth::lv2wrk_scheduleWork()
{
  ...
  return state->wrkThread->scheduleWork();  // OK.
}

->

MusE::LV2PluginWrapper_Worker::scheduleWork()
{
   ...
   _mSem.release(1);  // OK.
   return LV2_WORKER_SUCCESS;
}


[ Now the 'other' side of the worker: ]
->

MusE::LV2PluginWrapper_Worker::run()
{
   while(true)
   {
      _mSem.acquire(1);
      if(_closing)
         break;
      makeWork();  // OK.
   }
}

->

MusE::LV2PluginWrapper_Worker::makeWork()
{
  ...
  _state->wrkIface->work();
}

->

drumkv1_lv2_worker_work()
{
  if (pDrumk && pDrumk->worker_work(data, size)) {
    respond(handle, size, data);
    return LV2_WORKER_SUCCESS;
  }
  // FAIL!
  
  // GOT HERE.
  return LV2_WORKER_ERR_UNKNOWN;
}

->

drumkv1_lv2::worker_work()
{
  const drumkv1_lv2_worker_message *mesg
    = (const drumkv1_lv2_worker_message *) data;

  // FAIL! mesg contains garbage.
  // Type is frequently zero or some garbage high value.
  // Same with all other members.
}

->

// And so on. Fails to call the notifier.

Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: Drumkv1 does not load samples

Post by Tim E. Real »

Sampler plugins would naturally make use of the worker extensions,
to do heavy lifting of loading samples in the background.

Thus, not surprisingly, I'm happy to report that the LSP (multi)sampler series of plugins now works OK.
Their sample loading window was not working well before (sound familiar?). Tests OK now.

So potentially there are more plugins that will also work OK now.
User avatar
oscillator
Established Member
Posts: 1127
Joined: Sat Jan 17, 2015 6:07 pm
Location: SWEDEN
Has thanked: 725 times
Been thanked: 296 times
Contact:

Re: Drumkv1 does not load samples

Post by oscillator »

Awesome work, Tim! I compiled the master branch and now drumkv1 works in muse.

Thank you, impressive!

Staffan

MusE DAW running on Debian 11 Testing/XFCE4.
https://oscillator.se/musik

Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: [SOLVED] Drumkv1 does not load samples

Post by Tim E. Real »

Hi again.

Help! Is anyone having trouble with samplers like drumkv1 in MusE?
The loading of samples in the native UI window is fine. That part works, still.

But if I save the song and reload it, drumkv1 does not load the sample, and instead curiously
says the name of the plugin in the sample slot, not the wave file name like it should.

I'm having the same problem with other LV2 samplers. So it does not appear to be drumkv1's fault here.

(After I fixed the sample loader, I can't remember if I tested saving and loading a song having a drumkv1.
My records seem to say no. I'm trying to see if it's my system's fault after a recent update.)

Thanks.
Tim E. Real
Established Member
Posts: 660
Joined: Sat Sep 15, 2012 12:36 am
Has thanked: 36 times
Been thanked: 105 times

Re: [SOLVED] Drumkv1 does not load samples

Post by Tim E. Real »

OK I just discovered that saving and loading a song with drumkv1
seems to only work if the wave data is in the same directory as the song file.

I did not realize that drumkv1 saves a folder, in the song file's folder, containing links to the wave files.
The links are all correct. So we know that saving seems to be working.
But only the links pointing to wave files in the song file's directory will reload properly.
The other links, pointing to other locations, do not reload properly.

Another sampler I tested, the "Multi-Sampler x12..." series, would not even work with that test.
The window says "Loading..." no matter where my wave file sample is stored.

Strange... Bug(s) somewhere. ?
Post Reply