AudioUnits compilation tips

Ok, installed the Introjucer, changed the flag in there to compile AudioUnit, Save and Open in XCode, compiles cleanly straight off the bat! Game on!

amitio - when I just did it, introjucer adds the Juce AU Wrapper folder to point to files at eg. “/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp”. You may have installed these files in /Library/Developer/CoreAudio, in which case try symlinking from “/Applications/Xcode.app/Contents/Developer/Extras/”

Madwort,

Good news. and feel free to post any patches that you write in the forum - it’s going to be a great place to share ideas about audio coding in C!

Cheers for tips. I had create the symlink incorrectly. Once that was fixed it compiled with no issues.

I am having trouble trying to run the plugin however. I’m taking the component file and putting it in the /Library/Audio/Plug-Ins/Component folder but the plugin isn’t getting recognized.

Is your host (what software are you using?) definitely looking in there for AU plugins?

I’m using garageband and all other plug ins the folder are available. Could the problem be that garageband only allows for stereo tracks and the plugin is mono?

I don’t use it, but I’m fairly certain that Garageband does support mono tracks and plugins. Can you test it in Reaper or other DAW?

I had similar issues. AU lab just refused to recognise it, however when I booted up Logic it told me that the plugin had failed verification and disabled it. With Logic it’s possible to override that and use it anyway (and it worked ok) but maybe you can’t do that with Garageband. I’m out and about but will post the error when possible, something about MIDI input…

P.s. I’m pretty sure the problem isn’t about being mono…

Just tried it in reaper and it works fine in that.

For what it’s worth, the error I get when I try to use the plugin with Logic is as follows:

validating Audio Unit OwlSim by RebelTech:

  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
         AU Validation Tool
         Version: 1.6.1a1 
          Copyright 2003-2011, Apple, Inc. All Rights Reserved.

         Specify -h (-help) for command options
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

--------------------------------------------------
VALIDATING AUDIO UNIT: 'aumf' - 'OwlS' - 'RBLT'
--------------------------------------------------
Manufacturer String: RebelTech
AudioUnit Name: OwlSim
Component Version: 1.0.0 (0x10000)

* * PASS
--------------------------------------------------
TESTING OPEN TIMES:
COLD:
JUCE v2.0.40
Patch: Gain
Patch: Parametric EQ
Patch: Simple Delay
Patch: Template
Time to open AudioUnit:         9.604 ms
WARM:
Patch: Gain
Patch: Parametric EQ
Patch: Simple Delay
Patch: Template
Time to open AudioUnit:         0.039  ms
FIRST TIME:
Time for initialization:        0.010 ms

* * PASS
--------------------------------------------------
VERIFYING DEFAULT SCOPE FORMATS:
Input Scope Bus Configuration:
 Default Bus Count:1
    Default Format: AudioStreamBasicDescription:  1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved

Output Scope Bus Configuration:
 Default Bus Count:1
    Default Format: AudioStreamBasicDescription:  1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved

* * PASS
--------------------------------------------------
VERIFYING REQUIRED PROPERTIES:
  VERIFYING PROPERTY: Sample Rate
ca_debug_string: AudioUnitGetProperty: *ioDataSize == 0 on entry /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp:118
    PASS
  VERIFYING PROPERTY: Stream Format
ca_debug_string: AudioUnitGetProperty: *ioDataSize == 0 on entry /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUPlugInDispatch.cpp:118
    PASS
  VERIFYING PROPERTY: Maximum Frames Per Slice
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:391
    PASS
  VERIFYING PROPERTY: Last Render Error
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:397
    PASS

* * PASS
--------------------------------------------------
VERIFYING RECOMMENDED PROPERTIES:
  VERIFYING PROPERTY: Latency
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:376
    PASS
  VERIFYING PROPERTY: Tail Time
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:382
    PASS
  VERIFYING PROPERTY: Bypass Effect
    PASS

* * PASS
--------------------------------------------------
VERIFYING OPTIONAL PROPERTIES:
  VERIFYING PROPERTY Supported Number of Channels
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:404
    PASS
  VERIFYING PROPERTY Host Callbacks
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:489
    PASS
  VERIFYING PROPERTY Instrument Count
    PASS
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95
ca_require: inScope == kAudioUnitScope_Global InvalidScope /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIBase.cpp:95

* * PASS
--------------------------------------------------
VERIFYING SPECIAL PROPERTIES:

VERIFYING CUSTOM UI
Cocoa Views Available: 1
  JUCE_AUCocoaViewClass_6d19f19c8fbfb5a1
    PASS

HAS FACTORY PRESETS

VERIFYING CLASS INFO
    PASS

TESTING HOST CALLBACKS
    PASS

* * PASS
--------------------------------------------------
PUBLISHED PARAMETER INFO:

# # # 5 Global Scope Parameters:

* * PASS
--------------------------------------------------
FORMAT TESTS:

Reported Channel Capabilities (explicit):
      [1, 1]  

Input/Output Channel Handling:
1-1   1-2   1-4   1-5   1-6   1-7   1-8   2-2   2-4   2-5   2-6   2-7   2-8   4-4   4-5   5-5   6-6   7-7   8-8
X                                                                                                                 
ca_require: IsStreamFormatWritable(inScope, inElement) NotWritable /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:827

* * PASS
--------------------------------------------------
RENDER TESTS:
Input Format: AudioStreamBasicDescription:  1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Output Format: AudioStreamBasicDescription:  1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Render Test at 512 frames
Slicing Render Test at 64 frames
  PASS

Render Test at 64 frames, sample rate: 22050 Hz
Render Test at 137 frames, sample rate: 96000 Hz
Render Test at 4096 frames, sample rate: 48000 Hz
Render Test at 4096 frames, sample rate: 192000 Hz
Render Test at 4096 frames, sample rate: 11025 Hz
Render Test at 512 frames, sample rate: 44100 Hz
  PASS

1 Channel Test:
Render Test at 512 frames
  PASS

Checking connection semantics:
Connection format:
AudioStreamBasicDescription:  1 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
  PASS

Bad Max Frames - Render should fail
ca_require: inFramesToProcess <= mMaxFramesPerSlice TooManyFrames /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:1360
  from AU (0x8147e052): 'aumf' 'OwlS' 'RBLT', render err: -10874
  PASS

Checking parameter setting
Using AudioUnitSetParameter
Using AudioUnitScheduleParameter
  PASS

Test MIDI
ERROR: -4 IN CALL MusicDeviceSendMIDI

* * FAIL
--------------------------------------------------
AU VALIDATION FAILED: CORRECT THE ERRORS ABOVE.
--------------------------------------------------


validation result: failed validation

updating properties of AU OwlSim by RebelTech...done.

Hi Tom

Can you please clarify this,

"open introjucer file

In Config, enable Build AudioUnit

Under XCode(MacOSX) add extra frameworks – AudioUnit, CoreAudio, CoreAudioKit

Save project and open in Xcode"

What/where is the introjucer file?

Also - “In Config, enable Build AudioUnit”

Do you mean in the AppConfig.h file?

Also - how do you add extra frameworks?

Over all - I can’t tell if your instruction are done in Xcode or not?

Thanks

Paul.

Paul,

You need to download juce from http://www.juce.com/downloads , open the XCode project for introjucer, compile & run it, then use it to open OwlSim.juce. These instructions are done in IntroJucer.

Madwort

Ah - thanks Madwort. Unfortunately, as is the case once one problem is solved - another problem arises.

The build still fails with an error in AUCarbonViewBase.cpp in /Juce Library Code/Juce AU Wrapper/ folder

The error is:
/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp:263:30: Non-constant-expression cannot be narrowed from type ‘short’ to ‘CGFloat’ (aka ‘float’) in initializer list

and also

/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUCarbonViewBase/AUCarbonViewBase.cpp:263:46: Non-constant-expression cannot be narrowed from type ‘short’ to ‘CGFloat’ (aka ‘float’) in initializer list


Juce built fine. I made the changes described and then saved and opened in xcode.

Any ideas?

A reference to the same line of code is made in this post:

http://rawmaterialsoftware.com/viewtopic.php?p=54879&sid=3866eb634dc9e42bc52a856a2786e953#p54879

When I attempt to apply this change though, Xcode crashes if I then try and build OwlSim.

Ok - I fixed this and it built fine. I had to edit the AUCarbonViewBase.cpp file directly (not in the OwlSim Xcode project) by openning it in Xcode from here:

/Library/Developer/CoreAudio/AudioUnits/AUPublic/

The correction which worked for me is:

HISize originalSize = { static_cast<CGFloat>(mBottomRight.h), static_cast<CGFloat>(mBottomRight.v) };

Seems like a dangerous hack to go messing with Apple’s code but it worked.

The Au still failed validation in Logic but that’s not a problem as it can be forced as stated before.

Now for some actual plug in coding … finally!

Hi Paul,

Glad that you got this working in the end. Compiling Audio Units is a bit of a pain - if you just want to get up and running quickly you’re probably better off downloading Reaper or similar and compiling for VST instead.

Happy coding, and if you make something that you like, why not enter our patch competition (deadline Monday)? Doesn’t have to be anything complex, and you could win yourself an OWL pedal (RRP £220) :slight_smile:

http://hoxtonowl.com/patch-contest/

Tom.

Thanks Tom. I will definitely give it a shot.

Just to check one detail about the guidelines - the note about ‘No library dependencies!’

Does that include things like math.h ?

math.h is fine

This worked for me, on 10.9, Xcode 5.0.2 :

Download CoreAudioUtilityClasses.zip from here:
http://developer.apple.com/library/ios/#samplecode/CoreAudioUtilityClasses/

From the command line:

  • unzip ~/Downloads/CoreAudioUtilityClasses.zip
  • sudo mv CoreAudioUtilityClasses/CoreAudio /Library/Developer/
  • sudo mkdir /Applications/Xcode.app/Contents/Developer/Extras
  • sudo ln -s /Library/Developer/CoreAudio /Applications/Xcode.app/Contents/Developer/Extras/

I then get a compilation error in the VST 2.4 SDK,
vstsdk2.4/public.sdk/source/vst2.x/audioeffect.cpp
Change line 512
char temp[2] = {‘0’ + (char)digit, ‘\0’};
To
char temp[2] = {(char)(‘0’ + digit), ‘\0’};

hth,

Martin