Pure Virtual Function called when opening AudioUnit


#1

Hi All,

I am instanciating 2 Apple AudioUnits (Opening AU: AudioUnit:Effects/aufx,dcmp,appl), but getting an error "libc++abi.dylib: Pure virtual function called!" sporadically. 

        ScopedPointer<PluginDescription> lmtr = new PluginDescription();

        lmtr->fileOrIdentifier = "AudioUnit:Effects/aufx,lmtr,appl";

        AudioPluginInstance* plmtr = aupf->createInstanceFromDescription(*lmtr, sampleRate, bufferSize);

Adding in sleep statements mostly resolve the issue, but not always.


Is the Audio Unit created on a seperate thread? Is there a way of knowing when the Audio Unit has been successfully created?

Any ideas would be greatly appreciated.

 

Regards,

Tim

 


#2

I've been seeing this bug as well after an upgrade to El Capitan. It's hard to debug as the pure virtual function exception is catched by the debugger at [NSApp run] which doesn't really help. Not sure if this is a JUCE bug. There is a new AU API where you can now specify a completion callback but this will take some thinking on how to implement this in JUCE properly.


#3

Any progress on this? I’ve distilled my crash down to the function below, which crashes ~50% of the time somewhere under scanAndAddDragAndDroppedFiles or createPluginInstance. As Fabian said, hard to nail down exactly where.

I’m seeing this with both JUCE 4.0.3 and 4.1 (4.2 doesn’t build). Using Xcode 7.0 on OS X 10.10.5.

void crashMe()
{
    juce::AudioPluginFormatManager* pm = new juce::AudioPluginFormatManager;
    if (!pm) {
        return;
    }
    pm->addDefaultFormats();  

    const char* filename = "AudioUnit:Effects/aufx,lpas,appl";
    juce::StringArray files(filename);
    juce::OwnedArray <juce::PluginDescription> typesFound;
    juce::KnownPluginList kpl;
    kpl.scanAndAddDragAndDroppedFiles(*pm, files, typesFound);
    if (!typesFound.size()) {
        return;
    }
    juce::String errmsg;
    juce::AudioPluginInstance* inst = pm->createPluginInstance (*typesFound[0], 44100, 1024, errmsg);
}

#4

Can you check if the latest commit on develop fixes this issue?

Thank you for reporting!


#5

Hi guys,

Sorry if my initial question was so badly worded. I had literally started C++ and JUCE a few days before, and didn’t know how to phrase the question properly, as I had trouble even interpreting what was going wrong.

Thanks for the update Fabian, however, we moved away from attempting to use the Apple audio units, and instead created their functionality as custom audio processors. This did have the added advantage of being cross platform anyway.

Thank you Fabian, JUCE.
Tim