-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LiquidSFZ remaining integration issues #44
Comments
In current trunk, loading of LiquidSFZ instruments fails. diff --git a/devices/liquidsfz/liquidsfz.cc b/devices/liquidsfz/liquidsfz.cc
index 00abb7d8..e1b372f2 100644
--- a/devices/liquidsfz/liquidsfz.cc
+++ b/devices/liquidsfz/liquidsfz.cc
@@ -172,8 +172,6 @@ class LiquidSFZ : public AudioProcessor {
}
void
render (uint n_frames) override
- {
- if (loader_.idle())
{
if (synth_need_reset_)
{
@@ -190,6 +188,7 @@ class LiquidSFZ : public AudioProcessor {
synth_.add_event_note_off (ev.frame, ev.channel, ev.key);
break;
case MidiMessage::NOTE_ON:
+ if (loader_.idle())
synth_.add_event_note_on (ev.frame, ev.channel, ev.key, std::clamp (irintf (ev.velocity * 127), 0, 127));
break;
case MidiMessage::ALL_NOTES_OFF:
@@ -206,6 +205,8 @@ class LiquidSFZ : public AudioProcessor {
}
}
+ if (loader_.idle())
+ {
float *output[2] = {
oblock (stereo_out_, 0),
oblock (stereo_out_, 1)
|
Is there a way to trigger the problem? |
Save a LiqudSFZ device with an instrument assigned. |
I agree. At least the filename changes, midi events can safely be dropped while a file is being loaded. Your patch is not good, because it will introduce race conditions of both threads accessing the same data. Since we cannot use locks due to RT constraints, I guess the real fix will be to use a lock-free queue to send events to the loader thread. I'll look into it and come up with a real fix and submit a PR. However, here is a quick fix that just avoids the initial load problem and is still safe as in it doesn't introduce race conditions:
You can use this until we have a better solution. |
Yes, that's why I pinged you ;-)
We have lock free Queue like structures already. In
I suppose you mean this to be applied on top of my chage? |
I know.
No. Do not apply your change. It breaks stuff. Just my change and Anklang will load projects properly. I tested that. |
… Westerfeld, #44 #44 swesterfeld commented Jun 18, 2024: > > tim-janik commented Jun 18, 2024: > > all input events must always be processed in render > > I agree. At least the filename changes, midi events can safely be dropped while a file is being loaded. > > Your patch is not good, because it will introduce race conditions of both threads accessing the same data. > Since we cannot use locks due to RT constraints, I guess the real fix will be to use a lock-free queue to send events to the loader thread. > I'll look into it and come up with a real fix and submit a PR. > However, here is a quick fix that just avoids the initial load problem and is still safe as in it doesn't introduce race conditions Signed-off-by: Tim Janik <[email protected]>
…ocessing See also: #44 (comment) Signed-off-by: Tim Janik <[email protected]>
* Branch commit log: devices/liquidsfz/liquidsfz.cc: add TODO about unconditional event processing See also: #44 (comment) devices/liquidsfz/liquidsfz.cc: fix for LiquidSFZ race cond by Stefan Westerfeld, #44 #44 swesterfeld commented Jun 18, 2024: > > tim-janik commented Jun 18, 2024: > > all input events must always be processed in render > > I agree. At least the filename changes, midi events can safely be dropped while a file is being loaded. > > Your patch is not good, because it will introduce race conditions of both threads accessing the same data. > Since we cannot use locks due to RT constraints, I guess the real fix will be to use a lock-free queue to send events to the loader thread. > I'll look into it and come up with a real fix and submit a PR. > However, here is a quick fix that just avoids the initial load problem and is still safe as in it doesn't introduce race conditions Signed-off-by: Tim Janik <[email protected]>
Ok, I see now what you did. I've left a TODO comment in there, as I'd rather not have someone copy conditional input event processing by accident. |
See also tim-janik#44. Signed-off-by: Stefan Westerfeld <[email protected]>
List of issues that need fixing to complete successful integration of LiquidSFZ:
Updated 2024-06-12.
The text was updated successfully, but these errors were encountered: