Randomly no sound on cubase 12 pro osx

Hello all,
I have built a synthesizer with JUCE .
Testing it in Reaper and Mainstage it seems to work OK. It also runs in the standalone app and the debugger and doesnt say anything unusual.
Using cubase 12 Pro ocassionally when added a new instance on a new track there is no sound.
Saving and opening the program a few times results in random tracks playing sound.
It seems that after a while the program saves in a good state and continue to work indefinately.
Is there anyway to debug inside Cubase ?
I am guessing some sort of thread race is going on creating this.
It’s a curly one I have looked at it all for days and just scratch my head.





Screenshot 2023-06-20 at 9.31.25 PM

My code is up here.

Any ideas ??
Sean

1 Like

Its possible to launch the plugin in Cubase and then attach your debugger separately to the plugin process for debugging purposes. You should try to set that up, as you will definitely need to inspect things to determine why its failing intermittently at startup …

2 Likes

thanks I will take a look

1 Like

I have been stuck on this for days.

Such a strange bug. If the synth makes sound and is then saved on reload it works.
If it doesnt make sound loading up a saved state doesnt help.
I connected xcode to the process and set up a breakpoint inside some test code ( below ).
When the synth makes no sound the note on event and a breakpoint inside is triggered however the midi buffer looks empty when you look at it and midival is undefined. When it works you can see midi messages in the midibuffer object and the noteval is defined.
Is the midi buffer getting wiped in between the note on arriving and the breakpoint ?
What does cubase save about the “state” other than the parameters ?
It really feels like something is up with the midibuffer here.
I tried clearing the midibuffer at the end of the processing loop which doesnt help.


Screenshot 2023-06-23 at 7.27.17 PM
Screenshot 2023-06-23 at 7.24.33 PM

void waylosynth2::processBlock(AudioBuffer<float> &buffer, MidiBuffer &midiMessages)
{
    ScopedNoDenormals noDenormals;
    auto totalNumInputChannels = getTotalNumInputChannels();
    auto totalNumOutputChannels = getTotalNumOutputChannels();
    
    for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
        buffer.clear(i, 0, buffer.getNumSamples());
    
    int tt;
    MidiMessage p;

    for (MidiBuffer::Iterator i(midiMessages); i.getNextEvent(p, tt);){
        if (p.isNoteOn()){
            int midival = p.getNoteNumber();}
        
    }
    
// more synth code 



midiMessages.clear();

I may have “solved” this by setting the synth to return a simple sin wave as the “default”. I think somewhere in a complicated oscilltor class a variable may have not be being initialized fast enough for it not to get it into a state that somehow didnt work. I never really got to the bottom of it but a hack seems to have fixed it.