Skip to content
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

AudioUnit does not update parameters to host if audio not running #5

Open
ollierik opened this issue Mar 18, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@ollierik
Copy link

AudioUnit does not seem to report parameter updates to the host if audio is not running.

Easy to reproduce on Max/MSP, where the audio engine can be enabled or disabled separately.

Probably happens since the process callback that would enqueue the changes coming from the GUI does not get called. This would probably also be an issue with AAX if such wrapper was written.

Easiest fix would probably be to add a timer that calls the processing even when GUI is not running. However, CPLUG would likely benefit from having a mechanism for parameter updates that is decoupled from the processing loop, but it would be quite a large rethink and refactor. :)

@Tremus
Copy link
Owner

Tremus commented May 7, 2024

Interesting. A potential solution may look like this:

struct CplugHostContext
{
    // [Any thread] VST3 & AUv2 only. Send parameter update to host
    void (*parameterChanged)(struct CplugHostContext* ctx, uint32_t eventType, uint32_t paramIndex, double value);
    // ... other features
};

CPLUG_API void* cplug_createPlugin(struct CplugHostContext*);

A plugin would simply keep a copy of the pointer and call the method from its GUI for example. This would only introduce a minor API change to the CPLUG API & wrapper implementations, and it would work well with other suggested features. See #3 (comment).

This change would be the second half to this existing function:

CPLUG/src/cplug.h

Lines 156 to 157 in 0e5ee95

// [hopefully audio thread] VST3 & AU only
CPLUG_API void cplug_setParameterValue(void*, uint32_t index, double value);

Unfortunately I won't test this any time soon because I don't own Max or plan on buying it any time soon. Their 30 day trial will force me to buy it if I choose to start promising support for the platform.

@Tremus Tremus added the bug Something isn't working label Jul 3, 2024
@Tremus
Copy link
Owner

Tremus commented Jul 7, 2024

The API change suggested above is now available on the develop branch

void (*sendParamEvent)(CplugHostContext* ctx, const CplugEvent*);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants