AU vs. VST and juce


#1

I have some plugins (midi only no audio), they are pure JUCE and are using VST wrapper. I wanted to build the same plugins
but with AU wrapper, i got the build to work, but. I get assertions from JUCE all around the place, first from Timer and second
anywhere i try to create any UI components, i get assertions from line 2017 in juce_Component.cpp. The same code works perfectly
with VST but AU causes those assertions.

I create my UI class in the filter code, and it stays there so i don’t have to re-create the editor each time it’s closed/opened, i just add
it to a wrapper editor that get’s recreated. Theese assertions happen when the plugins are scanned, and later when i try to open the UI
in the host. Is there something that might be causing this ? Are there any special considerations when using AU. I used the JuceDemoPlugin
project and just added my sources, so the build parameters are the same, i just added the ObjC prefix stuff as a global define for the project
and the JucePlugin_Build_AU.

I tried removing the UI creation from the filter code, and made it run only when the editor is requested, but i still get the assertions when
opening the plugin editor.


#2

Looks like a dangling pointer - what’s the call stack?


#3
#0	0x929a2402 in __pthread_kill
#1	0x929a224f in pthread_kill
#2	0x9368f190 in Debugger
#3	0x0018c387 in juce::Component::removeComponentListener at juce_Component.cpp:2017
#4	0x00237857 in juce::Component::SafePointer<juce::Component>::detach at juce_Component.h:1948
#5	0x0023795f in juce::Component::SafePointer<juce::Component>::~SafePointer at juce_Component.h:1915
#6	0x00237edb in juce::Component::BailOutChecker::~BailOutChecker at juce_Component.h:1960
#7	0x00191a45 in juce::Component::sendVisibilityChangeMessage at juce_Component.cpp:199
#8	0x001d20cc in juce::Component::setVisible at juce_Component.cpp:172
#9	0x152f5b20 in juce::Component::addAndMakeVisible at juce_Component.cpp:1146
#10	0x1532938c in juce::Slider::lookAndFeelChanged at juce_Slider.cpp:342
#11	0x15329c01 in juce::Slider::Slider at juce_Slider.cpp:138
#12	0x150ead03 in MBase01Editor::MBase01Editor at MBase01Editor.cpp:53
#13	0x150e7965 in MBase01Controller::getEditor at MBase01Controller.cpp:40
#14	0x150eeb7b in EdoController::createEditor at EdoController.cpp:115
#15	0x152119c1 in juce::AudioProcessor::createEditorIfNeeded at juce_AudioProcessor.cpp:232
#16	0x150e16ca in -[JuceDemoAU_V1 uiViewForAudioUnit:withSize:] at juce_AU_Wrapper.mm:1122
#17	0x000fd1a3 in juce::AudioUnitPluginWindowCocoa::createView at juce_AudioUnitPluginFormat.mm:911
#18	0x00107b7a in juce::AudioUnitPluginWindowCocoa::AudioUnitPluginWindowCocoa at juce_AudioUnitPluginFormat.mm:849
#19	0x000ef540 in juce::AudioUnitPluginInstance::createEditor at juce_AudioUnitPluginFormat.mm:1090
#20	0x000be595 in juce::AudioProcessor::createEditorIfNeeded at juce_AudioProcessor.cpp:232
#21	0x00008e76 in PluginWindow::getWindowFor at GraphEditorPanel.cpp:80
#22	0x0000cccf in FilterComponent::mouseUp at GraphEditorPanel.cpp:305
#23	0x001a695c in juce::Component::internalMouseUp at juce_Component.cpp:2457
#24	0x0023c2cd in juce::MouseInputSourceInternal::sendMouseUp at juce_MouseInputSource.cpp:134
#25	0x002485b2 in juce::MouseInputSourceInternal::setButtons at juce_MouseInputSource.cpp:160
#26	0x00248e9b in juce::MouseInputSourceInternal::handleEvent at juce_MouseInputSource.cpp:271
#27	0x001cf1d3 in juce::MouseInputSource::handleEvent at juce_MouseInputSource.cpp:508
#28	0x001cf2b8 in juce::ComponentPeer::handleMouseEvent at juce_ComponentPeer.cpp:108
#29	0x002c2458 in juce::NSViewComponentPeer::sendMouseEvent at juce_mac_NSViewComponentPeer.mm:1358
#30	0x002c70b9 in juce::NSViewComponentPeer::redirectMouseUp at juce_mac_NSViewComponentPeer.mm:1370
#31	0x002be683 in -[JuceNSView_1_51_12_3 asyncMouseUp:] at juce_mac_NSViewComponentPeer.mm:359
#32	0x002be646 in -[JuceNSView_1_51_12_3 mouseUp:] at juce_mac_NSViewComponentPeer.mm:353
#33	0x9152c1d1 in -[NSWindow sendEvent:]
#34	0x914f8cd9 in -[NSApplication sendEvent:]
#35	0x9145662f in -[NSApplication run]
#36	0x002c7dcf in juce::MessageManager::runDispatchLoop at juce_mac_MessageManager.mm:303
#37	0x000ec1f4 in juce::JUCEApplication::main at juce_Application.cpp:171
#38	0x000ec3c7 in juce::JUCEApplication::main at juce_Application.cpp:301
#39	0x0000d1ad in main at HostStartup.cpp:111

console

info: A Demo Plugin demonstrating Juce
JUCE v1.51.12
EdoPresetManager::ctor presetDir exists
EdoPresetManager::ctor default bank loaded
EdoModulatorManager::ctor
EdoMidiDeviceManager::ctor
EdoMidiInputMapper::ctor
EdoLua::ctor
EdoModulatorManager::restoreMapping
EdoModulatorManager::restoreState
Initialising AU: Juce Demo Plugin
EdoController::createEditor
JUCE Assertion failure in /Users/atom/devel/juce/extras/audio plugin host/Builds/MacOSX/../../JuceLibraryCode/../../../amalgamation/../src/gui/components/juce_Component.cpp, line 2017
Debugger() was called!

the call that causes this is in the ctor of Slider, lookAndFeelChanged()


#4

Very peculiar. If you add another assertion:

void Component::addComponentListener (ComponentListener* const newListener) { jassert (isValidComponent()); componentListeners.add (newListener); }

…does that get triggered?


#5

no it does not, the method get’s called but no assertion.


#6

Weird. Does this make a difference?

[code]void Component::setVisible (bool shouldBeVisible)
{
if (flags.visibleFlag != shouldBeVisible)
{
// if component methods are being called from threads other than the message
// thread, you’ll need to use a MessageManagerLock object to make sure it’s thread-safe.
checkMessageManagerIsLocked

    SafePointer<Component> safePointer (this);

    flags.visibleFlag = shouldBeVisible;

    internalRepaint (0, 0, getWidth(), getHeight());

    sendFakeMouseMove();

    if (! shouldBeVisible)
    {
        if (currentlyFocusedComponent == this
            || isParentOf (currentlyFocusedComponent))
        {
            if (parentComponent_ != 0)
                parentComponent_->grabKeyboardFocus();
            else
                giveAwayFocus();
        }
    }

    if (safePointer != 0)
    {
        sendVisibilityChangeMessage();

        if (safePointer != 0 && flags.hasHeavyweightPeerFlag)
        {
            ComponentPeer* const peer = getPeer();

            jassert (peer != 0);
            if (peer != 0)
            {
                peer->setVisible (shouldBeVisible);
                internalHierarchyChanged();
            }
        }
    }
}

}[/code]


#7

no change i’m afraid


#8

Ah, I bet I know what this is.

If you create a component, then shutdown and re-start juce, that component won’t work any more, because it was registered with a messagemanager object that no longer exists. Not keeping any components as statics, are you?


#9

static as in static variables no, almost all UI components are created with Jucer, i have non jucer components in my UI wrapper class theese are two LookAndFeel classes one File class and a TooltipWindow. The rest are normaln components. If you wish to see this the code is public and in svn http://ctrlr.googlecode.com/svn/trunk/Controllers/MBase01/


#10

Ok, suggestion #2: It could be a symbol linkage clash between your plugin and the host - looks like the plugin is getting the wrong instance of Messagemanager, and using the host’s copy instead of its own. I’ve seen this kind of thing happen when c++ symbols are exported rather than being hidden or stripped - try a release build of the host (make sure it’s stripped) and I bet it’ll work fine.

Like obj-c, you can get cross-linkage problems in c++ too, but fortunately you can fix it by making the symbols private.


#11

BTW as far as I know AU doesn’t support MIDI out plugins


#12

it’s not a problem, i use MIDI hardware directly and via the process() method, it’s a lot if you can use the MIDI hardware, you get some control over
your hardware, it’s better then no control at all.


#13

Well allright the Release build of the Host helped. The window shows up i can edit my controls, but i can’t resize the window, something that was possible in VST, here when i try to resize the window the component get’s redrawn in some weird way and the window size does not change, i need to close/re-open my plugin to get the new size.