AU w/ VSTGUI using the Drawtest example

Apple APIs and Mac audio software development
Post Reply
Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

AU w/ VSTGUI using the Drawtest example

Post by Crandall1 » 29 Jan 2005, 01:59

I posted this over at KvR, but I'm thinking this might be a better spot for it.

Has anyone here managed to successfully compile the Drawtest AU available in the CVS of VSTGUI on Xcode? If so, I could really use some help here.

After a couple hours, I've gotten it to throw a lot less errors than it was. I changed aeffguieditor.cpp and .h to plugguieditor.cpp and .h, set PLUGGUI to 1 in the preprocessor defs, and all the other usual stuff.

It compiles about halfway, then throws a warning:

Dependancy analysis: warning: no rule to process mac/audiounit.exp

Note I'm starting with the CarbonView AU example provided by Apple, and swapping out the guts with the appropriate drawtest files.

Any help would be much appreciated.
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Urs
Site Supporter
Posts: 1138
Joined: 16 Aug 2002, 11:41
Location: Berlin
Contact:

Post by Urs » 29 Jan 2005, 03:55

The .exp file contains a simple list of the Entry points. It doesn't need to be processed, just uncheck it so it doesn't want to be compiled. I think it just has to be there, that's all...

So... there's an example AU using VSTGUI?!? Interesting...

Cheers,

;) Urs
www.u-he.com <- UHBIK, Zebra, Filterscape, More Feedback Machine, Triple Cheese, ask for Zoyd UB

Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

Post by Crandall1 » 29 Jan 2005, 11:41

Thanks, Urs.

I think the AU example was perhaps something that Arne whipped up for internal purposes, and decided for whatever reason to release in to the wild. It's definitely not ready for prime time.

But I figure since it was there, I'd put my money where my mouth is and actually take the time to prove to myself that it could be done.
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

Post by Crandall1 » 29 Jan 2005, 14:43

An update:

Without too much drama, the Drawtest AU example builds, links, and works using Xcode. How 'bout that?

Urs, while we're on the subject, some of our DSP blocks (the ones with memory, like our delay and filter blocks) require two separate audio paths. How does one access both inputs of a stereo signal in the AU process() loop at the same time? I can't for the life of me figure that out.

Is there some example code up on the internets somewhere that shows this? Or maybe you could put up a little piece that shows the Gain example working on both streams separately?

Thanks in advance!
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Urs
Site Supporter
Posts: 1138
Joined: 16 Aug 2002, 11:41
Location: Berlin
Contact:

Post by Urs » 29 Jan 2005, 15:18

Processing more than one channel at once is easy:

Don't use Kernels! - Kernels are a convenience feature of AU so that N-to-N effects are easy to write (just create one Kernel, and the AU applies it on any number of channels, as desired).

You might want to derive from AUBase::Render() (good for Synths) or AUEffectBase::ProcessBufferLists() (good for Effects), and then you've got the simple VST-style DIY way.

Example code is available on my website, the CAUGuiDemoAU in the CAUGuiSDK works this way (but you will have to check out the changes in PostPantherAdditions, I think the ParameterInfo struct has got new members):

http://www.u-he.com/caugui

Good luck,

;) Urs
www.u-he.com <- UHBIK, Zebra, Filterscape, More Feedback Machine, Triple Cheese, ask for Zoyd UB

Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

Post by Crandall1 » 29 Jan 2005, 16:07

Ahhhh. You are the man. It'd be nice if there was some, like, docs or something on this damned kit.

Okay, I've got one of our plugs processing stereo now, and I've got a GUI. Just need to put the two together. That's not as easy as it sounds, I don't think, but not insurmountable.

Thanks again!
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Urs
Site Supporter
Posts: 1138
Joined: 16 Aug 2002, 11:41
Location: Berlin
Contact:

Post by Urs » 29 Jan 2005, 17:13

Crandall1 wrote:Ahhhh. You are the man. It'd be nice if there was some, like, docs or something on this damned kit.
Well, hehe, with these few classes, what docs would you expect :P

The main differences to VSTGUI are these:

- Controls are only responsible for mousing

- Graphics objects are responsible for visualization

- the main view class doesn't have to remember any objects instatiated, because CAUGuiMan takes care of them (and their disposal), so you don't have to build
those crazy lists of memberCBitMapOrControlThisAndThat.

- unfortuantely CAUGui is AU specific (due to ParameterListeners mainly)
Crandall1 wrote:Okay, I've got one of our plugs processing stereo now, and I've got a GUI. Just need to put the two together. That's not as easy as it sounds, I don't think, but not insurmountable.

Thanks again!
Nowadays I use 2 interface classes (Gotta luv JAVA for that concept, but you can do it in C++ as well). One of them bothers with plugin API specific tasks, the other one with platform specific stuff. The whole framework addresses them as abstract classes only. I derive from these, for instance to deal with CoreGraphics, OpenGL or GDI on the graphics side and to deal with AU or VST on the plugin side. - This way I can write all code only once and just define any kind of target format. That's very handy ;)

;) Urs
www.u-he.com <- UHBIK, Zebra, Filterscape, More Feedback Machine, Triple Cheese, ask for Zoyd UB

Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

Post by Crandall1 » 29 Jan 2005, 18:47

Urs wrote:
Crandall1 wrote:Ahhhh. You are the man. It'd be nice if there was some, like, docs or something on this damned kit.
Well, hehe, with these few classes, what docs would you expect :P
Hah. I was talking about AudioUnits, not your CAG kit. That kit is missing a lot of the things I need to port our products to AU, so there's really no way I could use it without completely redoing our user interfaces. (I think I'm the only person in the world that actually _likes_ doing filmstrips for knobs. Must be coming from an art background to VST, rather than a programming background. But it doesn't bother me at all.)

No, the whole reason for this exchange is that my partner is doing the DSP for our next product, and while he's busy with that, I have nothing to do, so I thought I'd reexamine porting our existing VSTs to AU. The only way I'd really be happy with this is if I could use the VSTGUI like we did with our RTAS ports.

The main hurdles to porting were being able to access both streams of the stereo buffer simultaneously, and having an AU use a VSTGUI UI. I seem to have overcome both today, thanks to your help, so barring any unforseen nonsense (which I'm sure there will be plenty of) I'll hopefully have alpha versions of a couple of our plugs for AU by the end of the weekend.
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

Post by Crandall1 » 02 Feb 2005, 14:37

Okay. Since there doesn't appear to be any information on the 'net about this very thing, I figure I'd throw it out there. I've sent Arne my Xcode project, and he may add it to the CVS. Until he does, here are the instructions for building the Drawtest project from the VSTGUI CVS as an Audiounit using Xcode. (The CVS includes a Metroworks project, but Xcode is better because it's, like, free and stuff.) Thanks to Urs for the little hints above that got it working.

1) You must have the absolute latest NEWFRAME build of VSTGUI3. Go get it from the Sourceforge CVS, and put a copy of the whole folder in Drawtest. (You're going to make a couple changes, which will cause your VSTs to not build, so you want to work on a separate version for AU purposes.) You must also have the Audiounit effect templates installed. These don't come with the CoreAudio SDK. You must download them separately. You can find them here: http://developer.apple.com/samplecode/A ... lates.html

2) Once you've installed those according to the directions, start Xcode and do File->New Project->Audio Unit Effect With Carbon View. Make the directory the same as the location of the drawtest files.

3) Open up the Target Info window, add all your paths to the Header Search Paths (duh), change the Exported Symbols File to audiounit.exp, and the Prefix Header to vstplugsquartz.h (note that you have to put the whole relative path in here, from ${SRCROOT}.)

4) Delete the template files from the AU Source group (Delete References And Files), and add the Drawtest files to that group. DO NOT ADD pdrawtestmain.cpp. You don't need it for the AU.

5) Delete everything out of the Resources group except for Info.plist. Then, add all the Drawtest resource files, and also put audiounit.r in here.

6) Make a new group called VSTGUI, and add the VSTGUI files to the project. You don't need any of the normal VST files for this project, so don't add them.

7) Open up vstplugsquartz.h and add the following lines:

#include <Carbon/Carbon.h>
#define AU 1
#define PLUGGUI 1
#define AEffGUIEditor=PluginGUIEditor

then save and close it.

8) Open up pdrawtesteditor.cpp, and change all the AEffGUIEditor references to PluginGUIEditor

9) Right click on the External Frameworks and Libraries group, Add->Existing Frameworks. Add the Quicktime.framework and System.framework to the project.

10) Right click on the target, Add->New Build Phase->New Shell Script Build Phase. Make this:

cp -r build/drawtest.component $HOME/Library/Audio/Plug-Ins/Components

(Note that the word "drawtest" is dependent on what you called the project, of course.)

11) Build.

If you have any troubles, please post them here so we can all benefit from working them out, instead of mailing me directly.
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Dark Phoenix Ire
Posts: 39
Joined: 22 Nov 2003, 07:27
Location: Dublin , Ireland

Post by Dark Phoenix Ire » 11 Feb 2005, 16:44

<<--- offers to beta test plugs in AUs . . .

Just incase you need it .

Carry on, Interesting info guys :-D
Powerbook G4 1Ghz , Protools LE , Logic Pro 6, HydraTone, Zebra, Filterscape, Cameleon 5000 and Ohm Force.

Crandall1
Site Supporter
Posts: 40
Joined: 24 Feb 2003, 23:37
Location: Phoenix, AZ
Contact:

Post by Crandall1 » 17 Feb 2005, 14:37

You know what would be really handy? If someone put up a sample AU w/ sourcecode that used processBufferLists, but didn't have any wonky arrays or whatnot. Something like AGain, I guess.

I've got AUs building and using my DSP and the VSTGUI, but they're nowhere near close to passing the AU validation or working in Logic. They'll work in Rax, but that's about it. I have no idea how to use the preset mechanism, nor how to update the VSTGUI from within the AU.
-Chris Randall
-Audio Damage, Inc.

http://www.audiodamage.com
http://www.analogindustries.com

Powerbook 165C - 4 mb RAM - 20 mb HD - MacOS 7.1.1 - M - UpBeat - Cubasis - Opcode MIDI Translator

Sophia
Posts: 10
Joined: 21 Aug 2006, 09:04
Contact:

Post by Sophia » 12 Dec 2007, 19:07

This thread is totally old, but I just happened upon it while doing a sort of unrelated web search, and so I figured, why not respond, for the sake of anyone else happening upon it...
Crandall1 wrote:You know what would be really handy? If someone put up a sample AU w/ sourcecode that used processBufferLists, but didn't have any wonky arrays or whatnot. Something like AGain, I guess.
All you need to do is stuff like this:

Code: Select all

OSStatus YourPluginClass::ProcessBufferLists(
	AudioUnitRenderActionFlags & ioActionFlags, 
	const AudioBufferList & inBuffer, 
	AudioBufferList & outBuffer, 
	UInt32 inFramesToProcess)
{
	UInt32 numberOfInputChannels = inBuffer.mNumberBuffers;
	UInt32 numberOfOutputChannels = outBuffer.mNumberBuffers;
	float * firstInputChannelAudio = (float*)(inBuffer.mBuffers[0].mData);
	float * firstOutputChannelAudio = (float*)(outBuffer.mBuffers[0].mData);
0 there is the channel index for the first audio channel, so you would use 1 for the second audio channel, 2 for the third, etc.

larsby
Posts: 1
Joined: 21 Jun 2008, 08:23

Post by larsby » 21 Jun 2008, 09:07

I'm really stuck at the sending parameters back and forth between the AU and the VSTGUI.

Hope someone on this thread can help!

Post Reply