Hello, hope you all are doing well!
First off I am pretty new to using Juce (have only spend about a month with it now) so the answer to this could be very obvious and I am just missing it. For context the audio plugin I am making is a kind of mix between a synth and a sampler where you drop an audio file into it and use midi input to boost the frequencies corresponding to the midi notes you play.
To handle the audio file loading and playing I am using a modified version of the Juce Build an Audio Player tutorial which uses an AudioTransportSource to play the file. I wanted to add an option to my plugin where the transport source would pause and play synchronously with the DAW you are using it in (in my case Logic Pro). I used getPlayHead()->getPosition()->getIsPlaying() within my process block to get whether or not the DAW is playing and call a function from my audio file player class that determines whether it needs to .start() or .stop() the transport source as needed.
This method works fine except for one issue, when I pause the playhead in Logic, the DAW freezes and the transport source stutters for about a second before everything goes back to normal and the transport source stops. I already have a pause/play button working for my file player that does not cause any freezing or stuttering when used independently from the playhead, and I have tried accessing the playhead from process block in the same way without stopping the transport source which also created no issues.
Since both aspects of this problem seem to be working fine in isolation I am wondering why they are becoming problematic when put together. I feel like I am missing something about the nature of how these methods interact, though it is possible that this is just an issue of how my code handles this interaction. I would really appreciate it if anyone has any insight on this or ideas for any possible workarounds. Thank you for the help.