Skip to content

Conversation

@pkhead
Copy link

@pkhead pkhead commented Sep 25, 2025

This PR fully implements the clap_host_t request_restart method for Windows and macOS standalone, although the macOS implementation is currently untested.

@defiantnerd
Copy link
Collaborator

Thanks. Unfortunately this is not enough, audio/midi must be stopped during the restart. Your PR will probably lead to crashes and also they should trigger clap-helpers sanity checks.

@baconpaul
Copy link
Collaborator

why do you say that timo?

my concern about this was more that the activate doesn't wait for an inflight process to finish after setting audio running

so basically you do

sah->running = false
activate
sah->running = true

but if there's a process running with a large block size, that activate may happen before the process finishes and loops around to check running again

@defiantnerd
Copy link
Collaborator

We do mean the same thing. The host must make sure that it is not in a process call and also does not enter it whilst re-activating.

Therefore the processing must be stopped or bypassed.

@baconpaul
Copy link
Collaborator

right so this will need to do a little spin and process will have to set a skipped atomic.

@pkhead
Copy link
Author

pkhead commented Sep 26, 2025

oh. right. silly me. i was certain that a bug or oversight existed in my code, as i only skimmed the codebase for like 20 minutes before making this pr. i made this quick change to see if it worked, and i honestly i was uncertain if i should make an issue or a pr.

i did notice the existence of that fairly obvious unaddressed concurrency problem some time after submitting this. probably what's causing that weird audio glitch on my end.

er, i can try to implement the spinlock. i saw spinlock code somewhere in this project, i suppose i could find it and reappropriate it for usage here.

also, while audio is addressed i'm not sure if midi processing should be a concern. is it or is it not? or does implementing this fix fix whatever problems might occur with midi?

@baconpaul
Copy link
Collaborator

luckily in clap all events run through process so if you get that locked off properly then indeed midi note expression etc... will all be taken care of.

@pkhead
Copy link
Author

pkhead commented Sep 26, 2025

i think this is okay


if (!running)
{
memset(f, 0, frameCount * 2 * sizeof(float));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of the magic number "2" here should be the actual number of channels even if the current standalone implementation only assumes stereo.

@defiantnerd
Copy link
Collaborator

@baconpaul I would be okay with that for now, WDYT?

@defiantnerd
Copy link
Collaborator

@pkhead please check on the failed workflow issues. If you don't have time, let me know.

@baconpaul
Copy link
Collaborator

I pushed up a change to the clang format and misnamed macOS variable in AppDelegate.mm. Lets see how CI does now.

@baconpaul baconpaul changed the base branch from main to next October 12, 2025 14:08
@baconpaul
Copy link
Collaborator

I also changed the base branch to next

@defiantnerd
Copy link
Collaborator

thanks a lot - will merge to next

@defiantnerd defiantnerd merged commit 2e325bc into free-audio:next Oct 12, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants