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

[Bug]: Core Audio Glitching #1347

Open
1 task done
lucenta opened this issue Feb 9, 2024 · 0 comments
Open
1 task done

[Bug]: Core Audio Glitching #1347

lucenta opened this issue Feb 9, 2024 · 0 comments

Comments

@lucenta
Copy link

lucenta commented Feb 9, 2024

Detailed steps on how to reproduce the bug

I have a plugin that uses a high amount of CPU depending on the parameters set in the plugin.

I noticed that in a DAW setting the plugin will have pops/clicks if the CPU is high enough. In the standalone app, I get weird glitches and buzzing (sounds like a buffer is repeating itself over and over). I traced the problem to juce_mac_CoreAudio.cpp producing the repetitive glitching.

In juce_mac_CoreAudio.cpp we have

          callback->audioDeviceIOCallbackWithContext (getTempBuffers (inStream),  numInputChans,
                                                       getTempBuffers (outStream), numOutputChans,
                                                       bufferSize,
                                                       { timeStamp != nullptr ? &nanos : nullptr });

If i change the last argument to { nullptr }, i get no repetitive glitching, just pops and clicks at very high CPU, similar to how my DAW behaves. I see that this line calls the function

        void audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
                                               int numInputChannels,
                                               float* const* outputChannelData,
                                               int numOutputChannels,
                                               int numSamples,
                                               const AudioIODeviceCallbackContext& context) override

I see in that function we use the context to update the sample position in updateSampleTimeFromContext (context); I suspect that this is causing the problem.

What is the expected behaviour?

If CPU is high and we miss filling buffers, audio should just pop/click, not get stuck in a loop

Operating systems

macOS

What versions of the operating systems?

Any Mac version, including Intel based Macs.

Architectures

ARM

Stacktrace

No response

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

  • I agree to follow the Code of Conduct
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

No branches or pull requests

1 participant