MusicDevice instead of AUMidiEffect?


#1

Hi,

I want to create an au instrument using juce. However, when I specified the flag in kAudioUnitType_MusicDevice and run AUEval, I get a failure when it tries to evaluate the Instrument count property, because this is not part of AUMidiEffect.

Do I have to write a second wrapper inheriting from MusicDeviceBase instead of AUMidiEffect?


#2

I don’t think it should actually need to inherit from that class, it should be possible to get it working just by implementing the right behaviours. I’ll check that out soon, but let me know if you find any clues.


#3

Gave it a go last night, inheriting from MusicDeviceBase.
To get it to work you just needed to change some of the base class calls in the wrapper, implement a GetSampleRate() and implement all the midi note functions in MusicDeviceBase.

The only thing that is a bit dirty, is in Inialize(), when you check for auNumInputs it will return an error because there is never input to a MusicDeviceBase.

Works fine in AULab, but it would be good to check it in other hosts to see if they use some of MusicDeviceBase/AUBase functions to do with automation and gestures.


#4

Hi jules, gb,

I’m wrestling with the same problem. When simply setting kAudioUnitType_MusicDevice for JucePlugin_AUMainType, I can
-see the plugin in AULab as a instrument I can add
-it seems to work correctly as an instrument in GarageBand

But problems I still have :
-no audio out in AULab (‘audio engine not started’), AudioHijackPro
-validation error with auval, complaining about instrument count property

What would you recommend as a safe way of creating a juce-based AU MusicDevice? And has anybody tried it with Logic yet?


#5

Meanwhile got it working too, but some hairy stuff there:

Must indeed inherit from MusicDeviceBase and add the stuff that you no longer can inherit from AuMidiEffectBase, as gb points out.

But since this base class does not provide audio input I needed to fake empty input buffers and send those to the juce plug. Not clean but it works

Also, for unclear reasons, I needed to set up the AU with one (fake) input channel in the MusicDeviceBase constructor, or else GarageBand wouldn’t touch it.

anyhow, it now passes 100% in auval and works fine as a synth in AUlab, Garageband, AudioHijackPro and Logic Express


#6

Yeah, the main thing is to watch out for when changing the juce_AudioUnitWrapper is that you don’t try to write or try to initalize an input element as there won’t be one.
Haven’t tried my version in Garage Band yet, but its fine in AULab which is usually pretty tough if you don’t follow the spec.
Would be great if we could get this into juce or to pass on some code to jules to verify, at the moment we are all using different hacks for the same thing?

Also, was doing some debug in Ableton and they seem to be using a different base again for audio unit instruments, it works ok from musicdevicebase, but the offset which is meant to match up to the sample time since the start of the buffer that the midi event occured is always 0. So all your midi events appear to have happened at the start of a render block. Only had a quick look, I’ll keep you filled in.


#7

Yes, if you all want to send me your bodges I’d be happy to try to merge all the ideas together!


#8

Had a look there at the current version from svn, looks like it could be just the job, will wait for the next release. Thanks :slight_smile:


#9

have been busy lately, missed this one
jules you still need input or has it been done already? I can send some rough code if you like


#10

It’s done - grab the tip and see if it works for you…


#11