ApplicationCommandManager on Audio Unit behaving strange


#1

Im having a wierd problem when loading several AUs on logic:

if i load two instances of my plugin and open their gui, when i run an ApplicationCommand on the first instance (with a button for example), it triggers the command on the second instance instead. the second instance, is triggering itself properly. but this leaves the first instance unusable.

i haven’t declared it singleton or anything. is this just me? or is anyone else experiencing this? should i use the ApplicationCommandManager inside the plugin at all? what am i missing?

this maybe something deeper than the ApplicationCommandManager. im not sure yet. still investigating.


#2

Yes, the application command manager stuff really isn’t designed for plugins. Even though it’s not a singleton itself, it’ll look through all the known windows when trying to find a command target, and in a plugin that would include other instances of the plug. You might be able to get it to work by overriding some of its virtual methods though…


#3

wow you got me panicking for a moment there… working a year and a half on my software integrating the wrong function, i went looking for those virtual functions i couldnt overwrite. but then…

then, i found the following function:
setFirstCommandTarget();

since my main editor component is the command target i just put this at the end of my constructor:

and this at the start of my destructor:

when the editor is open is the only time you can invoke commands in plugins anyhow, so this is just perfect for working with plugins, no rewrites, no nuthin :smiley:
yay!

jules, your code is better than you even realize


#4

ah yes, that’d do it. TBH the command manager stuff is so complicated that even I can never remember how it works…