Skip to content

Crashing when adding multiple effects #70

@macramole

Description

@macramole

Hi, long time since my last message. I hope everything is ok.

I have an array of Patchable called effects where each one is actually an effect (BasiVerb, VAFilter, etc). So it represents a "daisy chain" of effects.

I'm adding and removing effects on the fly and when adding I experiment random crashes. My guess is some method I'm using is not thread safe.

The code is pretty simple:

void AudioEffects::addEffect(EffectUI *newEffect)
{
    effects.push_back(newEffect);

    if ( effects.size() == 1 ) {
        nodeIn0.disconnectOut();
        nodeIn1.disconnectOut();
        nodeOut0.disconnectIn();
        nodeOut1.disconnectIn();

        nodeIn0 >> effects[0]->channelOut(0) >> nodeOut0;
        nodeIn1 >> effects[0]->channelOut(1) >> nodeOut1;
    } else {
        int last = effects.size() - 1;
        effects[ last - 1 ]->disconnectOut();
        nodeOut0.disconnectIn();
        nodeOut1.disconnectIn();

        effects[ last - 1 ]->channelOut(0) >> effects[ last ]->channelIn(0);
        effects[ last - 1 ]->channelOut(1) >> effects[ last ]->channelIn(1);

        effects[ last ]->channelOut(0) >> nodeOut0;
        effects[ last ]->channelOut(1) >> nodeOut1;
    }
}

nodeIn0 and nodeIn1 are just PatchNodes.
AudioEffects is also a Patchable and is part of a larger pipeline that includes two Samplers and multiple Amps

I've tried:

  • unpatching everything and then patching again
  • stopping audio engine and restarting. This prevent crashes but has two issues: a short hiccup and JACK being disconnected and connected causing manually set "virtual cables" to not reconnect.

I hope you can point me in the right direction, thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions