AU development URGENT HELP NEEDED Gen~ projects wont validate

James's icon

spoke to technical support and iv been getting nowhere. @GrahamWakefield you helped me with an xcode compile issue when i began this project and i was really hoping you could help me resolve the issues i am having. the project is drawing to a close and all my experiments are truning out plugins that dont work. i am in desperate need of some expert advice!

this is my support ticket if i forward the support email to whoever can help then i can provide all the files

hello,

i am trying to create some simple AU plugins using gen~ for use in logic for my final project at university, i have however been running into problem after problem. i have come to the conclusion there is either an issue with the software or more likely im doing something fundamentally wrong, i have extensively read over the information online regarding this topic and posted on the forums on a few occasions but im really starting to run out of time and i cant even get a volume slider to pass validation in any DAW.

• i can create gen~ patches fine that work in max no problem.
• i can compile the software with the basic edits to the .r file and the info.plist
*(edit since ticket sent to support) iv even managed to get a plugin that loads in live and validates in logic however when you load the plugin it crashes logic. and auvaltool throws an error as the 3 letter manuf code spins it out.... but somehow makes logic like it which it didnt before :/

however the only program that will load the plugins usually if logic fails (and it does, often) is live, and even then it usually either crashes or reacts in unwanted unexplainable ways. a dsp algorithm that works in max rarely will work in the plugin format on any daw. and the one exception i have i cannot tell why its different from my previous attempts that makes live like it at least.

i have created a crude left right crossfader (the plugin that works in live) to test controlling two parts of the software with one parameter and it works fine in max. im hoping you can tell me why it is that the plugin never loads. i must be doing something wrong.

Details:
xphd.r:-
#include
#include "XPHDConstants.h"

#define RES_ID 1000
#define COMP_TYPE 'aufx'
#define COMP_SUBTYPE 'xpdd'
#define COMP_MANUF 'JTFX'
#define VERSION XPHD_VERSION
// To work correctly with the generic view, the value for NAME must follow a specific pattern:
// :
#define NAME "JTFX: XPHD Plugin"
#define DESCRIPTION "description"
#define ENTRY_POINT "XPHDPluginEntry"
#include "AUResources.r"

.plist changes

manufacturer String JTFX
name String XPHD Plugin
subtype String xpdd
type String aufx
version Number 65537

i read somewhere that if you use a 3 character manuf string it helps with AUvaltool but it did nothing in my case so i kept 4 letters in the section as thats what i ideally want it to be. here is the output of auvaltool :-

VALIDATING AUDIO UNIT: 'aufx' - 'xpdd' - 'JTFX'
--------------------------------------------------
2015-04-24 12:19:19.888 auvaltool[1059:73820] 12:19:19.888 WARNING: >compload> AudioComponentPluginLoader.cpp:445: ParseInfoPlistArray: GTST.component -- file:///Users/jamestruscott/Library/Audio/Plug-Ins/Components/: trouble parsing Info.plist's AudioComponents; entry: {type = mutable dict, count = 7,
entries =>
2 : {contents = "manufacturer"} = {contents = "JFX"}
7 : {contents = "factoryFunction"} = {contents = "FilterFactory"}
8 : {contents = "subtype"} = {contents = "TEST"}
9 : {contents = "description"} = {contents = "Filter AU"}
10 : {contents = "type"} = {contents = "aufx"}
11 : {contents = "name"} = {contents = "GTST"}
12 : {contents = "version"} = {value = +65536, type = kCFNumberSInt64Type}
}
Manufacturer String: XPHD Plugin
AudioUnit Name: XPHD Plugin
Component Version: 1.0.0 (0x10000)
* * PASS
--------------------------------------------------
TESTING OPEN TIMES:
COLD:
FATAL ERROR: OpenAComponent: result: -1,0xFFFFFFFF
validation result: couldn't be opened

Max Patch
Copy patch and select New From Clipboard in Max.

Example Patcher Code:
the main project i am working on is here :-

System and Max Version:
MacOsx 10.10.3
MacBook Pro (Retina, 15-inch, Mid 2014)
2.8 GHz Intel Core i7
16 GB 1600 MHz DDR3

using Xcode v6.3 for development

max support info and version number

{
"version" : "Version 7.0.3 (1caa69f) (32-bit mac)",
"platform" : "mac",
"arch" : "x86",
"osversion" : "Mac OS X Version 10.10.3 x86_64",
"samplerate" : 44100,
"iovs" : 512,
"sigvs" : 64,
"scheduler_in_audio_interrupt" : "off",
"audio_drivername" : "Core Audio",
"audio_driver_subname" : "",
"license" : "permanent full",
"machine_id" : "b080ed648acff06d3662c36a7a46a04c",
"eventinterval" : 2,
"overdrive" : "off",
"mixerparallel" : "off",
"mixercrossfade" : 0,
"mixerlatency" : 30.0,
"mixerramptime" : 10.0,
"videoengine" : "avf",
"packages" : {
"Beap" : {
"name" : "BEAP",
"type" : "package",
"author" : "Matthew Davidson, Peter McCulloch",
"description" : "BEAP (Berklee Electro Acoustic Pedagogy) Modular is a synthesis pedagogical tool.",
"version" : "Master from GitHub",
"major_version" : "0",
"minor_version" : "0",
"min_max_version" : "612",
"min_osx_version" : "None",
"min_win_version" : "None",
"website" : "https://github.com/stretta/BEAP/wiki",
"link_mac32" : "https://github.com/stretta/BEAP/archive/master.zip",
"link_mac64" : "https://github.com/stretta/BEAP/archive/master.zip",
"link_win32" : "https://github.com/stretta/BEAP/archive/master.zip",
"link_win64" : "https://github.com/stretta/BEAP/archive/master.zip",
"relative_path" : "None",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/Beap",
"vol" : -308
}
,
"Gen" : {
"name" : "Gen",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/Gen",
"vol" : -309
}
,
"Jitter" : {
"name" : "Jitter",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/Jitter",
"vol" : -310
}
,
"Max for Live" : {
"name" : "Max for Live",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/Max for Live",
"vol" : -311
}
,
"MaxDefaultContent" : {
"name" : "MaxDefaultContent",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/MaxDefaultContent",
"vol" : -312
}
,
"MaxIntroLessons" : {
"name" : "MaxIntroLessons",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/MaxIntroLessons",
"vol" : -313
}
,
"mira" : {
"name" : "Mira",
"type" : "package",
"author" : "Cycling '74",
"description" : "Mira automatically connects to Max and mirrors your interface.",
"version" : "1.1.8",
"major_version" : "1",
"minor_version" : "1",
"min_max_version" : "7.0.2",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/mira",
"vol" : -314
}
,
"vizzie" : {
"name" : "vizzie",
"path" : "Macintosh HD:/Applications/Max.app/Contents/Resources/C74/packages/vizzie",
"vol" : -315
}
,
"Max" : {
"name" : "Max"
}
,
"MSP" : {
"name" : "MSP"
}

}

}

--

oscill's icon

Hi,

I've never used Gen but have some experience compiling AUs in Xcode and using them in Max. How does Gen work...are you trying to compile Gen-generated cpp files in an Xcode project?

Getting past auval is tricky but is a good sign that your AU is on the way to working with other hosts. Looks like you *might* have some sort of compiler setting or entry point issue? Can you set breakpoints in the AU constructor and step through to isolate where the problems start?

James's icon

unfortunately i have only limited knowledge of the compilation process, however if explained it i could certainly do what you mentioned. i have in the past used gdb and other dissasemblers as well as a java idea to set breakpoints in code but i don't know where to set them in relation to the generated project provided by C74.
however my issue is one that persists even when compiling examples cycling74 provided.

their guide suggests all is required is to successfully compile simple patches such as the one i am trying above is to simply change the strings in the plugin.r file to represent subtype, manufacturer, and plugin name. and then to do the same in the info.plist in resources and the project should work. and true to word it compiles fine. however it is clear the gen code just isn't being interpreted correctly.

if you could supply an email i would be grateful for a bit of your time so i can get to the bottom of this. I'm compiling AUs as my final year uni project. if i succeed it 1st material for sure. if i hand in 5 not working plugins. ill fail. its really getting close to desperate times. i have been using RackAFX to build some basic things just incase this whole idea just goes down the pipes! its surprisingly hard to get help with this. even technical support had some encouraging words for a panicking student.

"gen~ can export code but to date we have left it to community efforts to decide how to use the code that is generated."

which would be fine if i could find ANYBODY trying to do this who could help but its so new. iv had limited resources to help me out.

and unfortunately iv been left slightly regretting using using gen as my platform for development. but i just thought was my knowledge of c++ was limited and my knowledge of Max a lot better, this was the correct choice.

i hope you can help or put me in touch with someone who can.

many thanks for your reply

james

James's icon

the projects i have built using rackafx which perform the same tasks as the projects in gen i was building with identical algorithms run fine unfortunately my project requires i use gen~ for the whole process bar Xcode for compilation. so I'm not sure wether its a compilation issue or if its a gencode export issue. but I'm starting to thing its gen that is to blame

oli larkin's icon

hi james,

It's not an issue with your gen~ code and I think your 4char IDs 'xpdd' and 'JTFX' are OK. You should make sure that the plist has these 4 chars for the right fields and then the error about trouble parsing the .plist should go.

The real problem is that the "entry point" for your AudioUnit is not defined. You need to tell Xcode to export the entry point symbol. Apple have messed about with CoreAudio SDK and I think the Gen AU stuff on the wiki is out of date. Since you are compiling against a recent CoreAudio SDK, with a recent Mac OSX SDK (10.7+), you need to export the entry point symbol for the AUPlugIn interface (which replaces the Component Manager entry point used in 10.6 and lower). You must make sure the factoryFunction field in the plist matches the entry point of your plugin, which is created via the AUDIOCOMPONENT_ENTRY macro in the main cpp file for the audio unit. This should also be exported via the "Exported Symbols File" part of the Linker settings in the xcode target. You need a .exp file with the symbol name prefixed with an underscore e.g. _MyAUPluginFactory in it.

I have attached a modified MyAU project which you can duplicate, will be easier than modifying your project.

more info about the AU SDK changes here:

MyAU.zip
zip
oscill's icon

Hi James,

Looks like Oli has given you some very helpful hints and code above. Hopefully that solves your problem.

A tip on debugging: I find it helpful to setup auvaltool to run within Xcode as the Run action and watch the output in the Xcode console rather than terminal. Then it is very easy to breakpoint in your code. Xcode can also break automatically in places where your code causes crashes (e.g. BAD_ACCESS, etc.). Edit scheme->Run->Info - Build Config= Development, Executable=other...select /usr/bin/auvaltool, then in the arguments tab add something like: -v aufx xpdd JTFX

James's icon

hi there many thanks for your help and MyAU folder. i have unfortunately not been able to compile using it. i get an error that tells me that AUEffectBase.h is not there and if i add it from another project i get another error.

i have included my project to see if you can see my issue its hard to explain.

i hope we can get to the bottom of this soon !

many thanks again for your help

XPHD-3.zip
zip
James's icon

could it be because I'm using core audio sdk from 2012 as recommended in the C74 wiki?

oli larkin's icon

that might be an issue. I got it working with the 10.9 SDK using the (more recent) CoreAudio SDK that can be downloaded here:

the Xcode project expects to find the files in

/Applications/Developer/CoreAudio

oli

James's icon

yea still no dice i get a lexical processor issue saying it can't find AuEffectsBase.h in the plugin-prefix.pch file. iv tried adding AuEffectsBase.h from another project that included it from core audio but it does nothing for the issue. at present i am unable to compile completely.

were you able to compile my example?

oli larkin's icon

yep. do a clean and built again?

oscill's icon

did you update the AUBase location in the Target Build Settings "Rez Search Paths" and "Other Rez Flags"?

James's icon

i truly have now tried all of that and it wont even compile! im really panicing! has anyone built the AU and tested it? i now cannot build.

i have my source path correct in build settings the rez flags and paths both point to the correct core audio sdk in ~/Applications/Developer

and i have truly checked eerything twice and it wont build. im on a new mac with good everything and its pretty clean.

can someone run me through what i need to do to build the plugin? and if anyone can build it PLEASE send me it so i can atleast display one AU that was exported even if i have to explain i had to find a genius to help me and accredit that person in my doccumentation with a link to this forum page!

im really desperate to get this working guys i appreciate any and all help.
i will buy a box of beer/prefered beverage for the person that helps me get my head arount the issue so i can build my gen creations and have them load in logic before the deadline.

many thanks again.

James's icon

the current error stopping the build is a semantic issue in "ComponentBase.h"

it is on 2 lines

line 283:     Class *This = new Class((AudioComponentInstance)ci);

line 231:         return new(memory) Implementor(compInstance);

the error for both lines is as follows

Allocating an object of abstract class type 'XPHDPlugin';

im not sure what that means ? it seams to be not finding the correct class and so its trying to make one instead. i could be wrong. how do i fix this issue?

oscill's icon

AUBase has a couple of "pure virtual" functions that MUST be implemented by any derived classes (i.e. AUEffectBaseMultiChannel and in turn XPHDPlugin) before an instantiation of an object of the derived type (i.e. XPHDPlugin) is allowed. Until then the derived class remains abstract.

Try implementing the following two functions in XPHDPlugin:

virtual bool CanScheduleParameters() const { return false; } // is pure virtual in AUBase

virtual bool StreamFormatWritable(AudioUnitScope scope, AudioUnitElement element) { return true; } // is pure virtual in AUBase

James's icon

i wissh i had someone here to watch what is happening.

if there is anyone who wants to use teamviewer to help me or any remote desktop projection. i want more than anything to get this working like three weeks ago. my future depends on it. wether or not it was a good decision to put myself in this position is irrelevant but im here now and floundering.

if you help me learn how to compile my gen patches so they work in logic in less than a week you will gain a friend for life and i will do anything to pay you back!

James's icon

when you say XPHDPlugin do you mean in the XPHD.cpp? i cannoth find a function or file called XPHDPlugin

oscill's icon

Yes, the _class_ XPHDPlugin in the file XPHD.h.

I finally got your project to compile on my machine. Changed a few things:

- add the two functions above to class XPHDPlugin (you might want StreamFormatWritable to return false, depedning on how flexible your plugin should be. Not sure. Do you have a fixed # of input/output channels you expect?
- Target->Build Phases:
- added some missing Frameworks to the target linkage (may be overkill but won't hurt): Accelerate, Carbon, CoreAudio, AudioToolbox, AudioUnit, CoreData, AppKit, Foundation, CoreServices
- removed ALL .r files from Build Carbon Resources EXCEPT XPHD.r
- Removed all of the include files in XPHD-Prefix.pch. Add #include instead.
- XPHD Target Setting Preprocessor Macros: CA_USE_AUDIO_PLUGIN_ONLY=0

I can make it build and pass auval if I also implement SupportedNumChannels and fix it to 2-in, 2-out, but I'm not sure what your goal is for channel count. Unfortunately it still doesn't show up in Logic (may be I just don't have Logic setup correctly). It DOES show up in Auganizer (lightweight utility) and Reaper (have you considered trying this as an alternative to Logic?). I did not try to run it though.

Try out the items above and see if that gets you closer. Attached is the AU I built, too.

oscill's icon
oscill's icon

Geez, the file is only 692KB. Guess that's still too large for the forum. What's your email address?

James's icon

IV MANAGED TO GET IT TO BUILD

i added just

virtual bool CanScheduleParameters() const { return false; } // is pure virtual in AUBase

as the other function had a duplicate declaration.

however it still crashes logic every time.

im just going to create another project with the settings you mention above. hopefully it will get the last error done with.

James's icon

email :- jamesrosertruscott@hotmail.co.uk

James's icon

this plugin should be restricted to stereo use as it essentially crossfades between left and right speaker using the slider value and an inverse slider value. in mono it would just attenuate volume of the one channel so it wouldnt work well it needs to be fixed stereo ideally.

i have built and rebuilt now and logic wont have it. it shows up but it crashes on loading the plugin. then in live it shows but the plugin wont load. i havent tried reaper yet. ill give it a try now.

James's icon

yea as with my compiled version while it shows up in the AU list in the host, it wont load in any DAW. at least it doesn't crash the host like mine. however it does in logic and live display a dialogue saying "could not load AU plugin please contact manufacturer for an update."

oscill's icon

Your AU comes up and runs ok in AU Lab, and audio evens pans left and right when I move the slider (i.e. your process is being called). I have no idea about Logic. Can you find another workable solution in Reaper, Max, AU Lab, etc. - or routing audio in/out of one of these apps from/to Logic (if you must use it)?

James's icon

i can get my version to load in AULAB and reaper but it makes the signal dead basically like a mute button. no reaction to the slider, could you send me your version and ill see if its my computer or the plugin?