(Solved)Any advice getting arguments to work in Carbon view?

Official support for: sonicbirth.sourceforge.net
Post Reply New Topic
RELATED
PRODUCTS

Post

I am willing to put in the effort myself, I just need to know where to start. I currently run my own build of the framework with a few changes in the basic .nib files and some other tweaks, but this would be a much bigger fish to fry that just fixing scrollbars and whatnot.

I downloaded the source from the svn so that I could work on this, but looking at the code, i am not sure where to start. If someone "in the know" could simply tip me off on how the at runtime, the framework generates Cocoa and Carbon views within the DAW, that would at least let me know what code to start looking.

Here is the issue:
Let's say you are working in a program that does not work with Cocoa views, OR you simply don't want Cocoa to be sucking up CPU cycles when changing parameters at runtime, so you leave off the custom GUI to allow a Carbon GUI to be generated by the host. The arguments that appear under Cocoa as a popup window should appear as pull-down menus under Carbon, but they don't all work. For example, the "Bit Precision" argument works absolutely fine in Cocoa, generic Cocoa and Carbon, but the 'Load Audio file argument" does not.

My current workaround is to load every audio file that I think I will need into the plugin, and rig up an elaborate switching circuit... obviously this is a huge pain as well as making the plugin many megs large and eating excessive CPU:

Image

I have not tried every argument out, but most work... kTap, Indexed circuit, etc. The HUGE issue for me personally is getting the "audio file" argument working under Carbon. If nobody has any suggestions,then I'll go back to rifling through the code and hopefully I can turn something up.

Thank you.[/img]
Last edited by Aletheian-Alex on Wed Mar 19, 2008 4:25 pm, edited 1 time in total.

Post

I believe your starting point would be to create a proper subclass of SBAudioFileArgument which implements numberOfParameters > 0.

J

Post

eigentone wrote:I believe your starting point would be to create a proper subclass of SBAudioFileArgument which implements numberOfParameters > 0.

J
Ah yes, I am looking at that right now... referenced at line 301 of SBAudioFileArgument.m? I am still reading through code, and I am only a hobby programmer, so any tips would be fantastically appreciated.

I just got started, and am still unclear how SB passes the arguments on to coreaudio to let it render the generic views... so I'll be looking for that. Would it be easier to somehow SBAudioFileArgument to render a simple button that would pop up a standard OSX menu to select and load the file, or is that more difficult with the way that the SB runtime works? Sorry about the bonehead question, but like I said, I am still reading through the code and unsure how everything works still.

Thanks again!

One other small question, the @ signs (example @end) and - sign at the beginning of lines bugs out Xcode when compiling. I have just ignored the errors since they don't seem to have any effect on functionality... it is just annoying to see 700 errors when compiling, all saying:

error: expected unqualified-id before '-' token

And

error: expected unqualified-id before 'end'

Should I be worried about that? Or is that a SB code specific syntax?

Post

Aletheian-Alex wrote:
eigentone wrote:I believe your starting point would be to create a proper subclass of SBAudioFileArgument which implements numberOfParameters > 0.

J
Ah yes, I am looking at that right now... referenced at line 301 of SBAudioFileArgument.m? I am still reading through code, and I am only a hobby programmer, so any tips would be fantastically appreciated.

I just got started, and am still unclear how SB passes the arguments on to coreaudio to let it render the generic views... so I'll be looking for that. Would it be easier to somehow SBAudioFileArgument to render a simple button that would pop up a standard OSX menu to select and load the file, or is that more difficult with the way that the SB runtime works? Sorry about the bonehead question, but like I said, I am still reading through the code and unsure how everything works still.

Thanks again!
You're Welcome,

If you really wanted to just test it, you could assign the value to 1, recompile, ad see where that gets you. At best, you'll have to make a concrete subclass of SBAudioFileArgument which publishes those parameters. In SB, whenever you add a subclass, you have to add it to the published element list. If that approach doesn't work nearly immediately, you probably have several hours of work ahead of you (depending on your level of hobby). At worst, you will have to do all this and then handle specific implementation in the subclass and possibly the SBRuntime file itself, it could probably just be switched to 1 -- it's not really an automatable parameter, that is why I am guessing it is not published. If it the parameter were published, then playing a song could (potentially) open a file selector -- changing the value while playing would likely cause an overload every time - or that plus 'noise'. Ultimately, what you want the number to be is the number of options in the popup list (which is probably already a class member - or just query the array's count... wherever the menu titles are actually stored, I'm not looking at the code atm) - I'm guessing that the runtime implementation will populate the menu appropriately (because it already works for other types of indexed parameters), and that it was originally omitted because it had potentially irritating side effects.

J

Post

eigentone wrote:If you really wanted to just test it, you could assign the value to 1, recompile, ad see where that gets you. At best, you'll have to make a concrete subclass of SBAudioFileArgument which publishes those parameters.
I tried that as soon as i found that line of code because I thought as you said, it might just jog the runtime into popping up whatever parameter it sees, but alas... it didn't work magically like I had hoped. I also found a small typo in the file as well, but that did not seem to have any effect either. I am going to try again, reboot, dump my audio unit cache, build a dummy plugin and see what happens in AULab just to be sure it is not that simple before I write anything more complex.

In SB, whenever you add a subclass, you have to add it to the published element list. If that approach doesn't work nearly immediately, you probably have several hours of work ahead of you (depending on your level of hobby). At worst, you will have to do all this and then handle specific implementation in the subclass and possibly the SBRuntime file itself, it could probably just be switched to 1 -- it's not really an automatable parameter, that is why I am guessing it is not published. If it the parameter were published, then playing a song could (potentially) open a file selector -- changing the value while playing would likely cause an overload every time - or that plus 'noise'. Ultimately, what you want the number to be is the number of options in the popup list (which is probably already a class member - or just query the array's count... wherever the menu titles are actually stored, I'm not looking at the code atm) - I'm guessing that the runtime implementation will populate the menu appropriately (because it already works for other types of indexed parameters), and that it was originally omitted because it had potentially irritating side effects.

J
Thanks again. "Depending on your level of hobby"? Heck man... I am a musician with no formal training other than the Apple Devloper notes and some Linux hacking in C++, but I am always willing to work hard and try to solve a problem myself rather than begging around for someone else to fix it (regardless if it is over my head or not) especially if it might help other people with the same problem.

Anyway, I assumed all that above might be the case. I was about to try adding a query for the array count when I jumped back online here. I am going to look for the entry in the main runtime code and check out the references to elements. I had already done that but now I have more specifics to look for. Hopefully I can track down all the references and try out a few things, and I have a few fallback ideas if I can't just get it to work by changing a few lines of code.

Back to work I go... thanks again.

Post

Ah yes, I am looking at that right now... referenced at line 301 of SBAudioFileArgument.m? I am still reading through code, and I am only a hobby programmer, so any tips would be fantastically appreciated.

I just got started, and am still unclear how SB passes the arguments on to coreaudio to let it render the generic views...
The render function is handled through a function pointer which is assigned by the class instance and invoked by a render controller (SonicBirthRuntime...), typically called privateCalcFunc or pCalcFunc - the dsp is a c function in the mm file. How to render the generic views: I think you are looking for the GetParameter... calls in the Runtime, but each element maintains it's state.

Would it be easier to somehow SBAudioFileArgument to render a simple button that would pop up a standard OSX menu to select and load the file, or is that more difficult with the way that the SB runtime works? Sorry about the bonehead question, but like I said, I am still reading through the code and unsure how everything works still.
indexedNamesForParameter is already filled out with:
return [NSArray arrayWithObjects:@"Load file...", ((mFileName) ? [mFileName lastPathComponent] : @"No file loaded"), nil];

so, it may just work, as in, if you had a generic view of SB, if you set numberOfParameters to 1 then it may work, there may be a step or 2 in between. Then (perhaps) that may be all it takes for the parameter to be published, and you'll get a popup list in the generic editor that allows you to load a file. if you want a pre-filled list of files, you'll have to do more work.


One other small question, the @ signs (example @end) and - sign at the beginning of lines bugs out Xcode when compiling....<snip>...is that a SB code specific syntax?
That is a Objective-C, a programming language which is a superset of C. Fresh from the repository, the project should compile without errors, aside from a few areas, which I made sure to document with #warning statements (the build output will lead you to them). The main one is the the version of the CA SDK you are using, in leopard, there is a cpp file you must exclude from the build (all defs are in the header and duplicate definitions in the implementation). The other requirement is to change the visibility of one of AUBase's members from private to protected - AFAIR, that's it. Now, what you are seeing is, somewhere along the lines, the build settings must have gotten mixed up. Those errors are issued because the compiler is reading the file without Objective-C language extensions. If you are totally lost, you can re-check the project out, or maybe easier, set the files that cause errors to compile as Objective-C++ - this supports C, C++, Objective C, and Objective C++ syntax in the same files. This is done with the Compile Sources As build option. Basically, at some point, the compiler is compiling away in C or C++ and then encounters Objective-C - which uses a different syntax, like the @interface, @end, - (void)doStuff; [array objectAtIndex:32]; -- the same thing happens if you throw C++ at C files or Objective C files, so the Objective-C++ setting is required.

If it helps, I know the last commit I made built without error - and AFAIK, the last commit makira made was just a nib file.

J

Post

Many thanks.

Yes, it would not build at all (Xcode 3 in Leopard) when I first downloaded and hit "build" so I had to massage a few settings and it worked, but I didn't know about the cpp file in Leopard or the member visability. I got those exact errors, so I'll change that and see how it goes and then work on the audio file argument.

I am excited to get thing going... thanks again.

Post

I got it working!

Image

Thank you so so much for your help! I got nothing but errors galore (769 errors) in Xcode 3 under Leopard, so i edited the file and then booted up in Tiger and ran the last version of Xcode. I don't remember all of what I did, but among them:

-Change the references "private" in AUBase to "protected"
-Change "Compile Sources As" to file dependant
-Change "- (int) numberOfParameters" in SBAudioFileArgument to return 1
-Include CAAudiofile.cpp in the build

I made few other changes that i don't remember by trying a build, looking for the errors and then changing them up one by one until I got a working build. The final bash script would fail each time,but that doesn't matter really. I got a working build eventually and copied it over by hand.

So now it works... EXCELLENT! My life just became 100x easier. Thanks again!

The only issue is that I tried it out in a few different DAWs and they won't all load the file... BAH. I get this console error:

Code: Select all

3/19/08 12:35:33 AM [0x0-0x2e02e].com.motu.DigitalPerformer[429] Load failedLoad failedLoad failedLoad failed1 

3/19/08 12:35:33 AM [0x0-0x2e02e].com.motu.DigitalPerformer[429] nChannels = 1 

I'll try to get that ironed out.



EDIT: It DOES load the file in a few DAWs that I thought did not work, but not until you select the file, close the window and re-open it. The VST version just crashes Cubase.

Post

Aletheian-Alex wrote:I got it working!

Thank you so so much for your help! I got nothing but errors galore (769 errors) in Xcode 3 under Leopard, so i edited the file and then booted up in Tiger and ran the last version of Xcode. I don't remember all of what I did, but among them:

-Change the references "private" in AUBase to "protected"
-Change "Compile Sources As" to file dependant
-Change "- (int) numberOfParameters" in SBAudioFileArgument to return 1
-Include CAAudiofile.cpp in the build

I made few other changes that i don't remember by trying a build, looking for the errors and then changing them up one by one until I got a working build. The final bash script would fail each time,but that doesn't matter really. I got a working build eventually and copied it over by hand.

So now it works... EXCELLENT! My life just became 100x easier. Thanks again!

The only issue is that I tried it out in a few different DAWs and they won't all load the file... BAH. I get this console error:

I'll try to get that ironed out.



EDIT: It DOES load the file in a few DAWs that I thought did not work, but not until you select the file, close the window and re-open it. The VST version just crashes Cubase.
Excellent. You're Welcome. It will probably make the most sense to make a real subclass of SBAudioFileArgument (if you haven't done so already) -- otherwise, you will have to remember what you did every time you checkout the latest version and hope future changes don't break something. Creating the subclass is easy, but getting it published requires some understanding of the project -- which is something I intend to improve soon. I've just been very busy (and makira has been as well).

Best,

J

Post

Is this problem related to this topic?:

http://www.kvraudio.com/forum/viewtopic ... 41#3008041

Post

zmix wrote:Is this problem related to this topic?:

http://www.kvraudio.com/forum/viewtopic ... 41#3008041
It might be similar... not sure. The keyboard tap works fine for me in generic Cocoa views, but in generic Carbon view it only works while you are holding the button down with the mouse. I have not really had the need to look into it, but I imagine that it could be fixed in a similar way.

Post Reply

Return to “SonicBirth”