Newbie problems Cocoa, objective-C using CoreAudio C libraries
Newbie problems Cocoa, objective-C using CoreAudio C libraries
- Subject: Newbie problems Cocoa, objective-C using CoreAudio C libraries
- From: "Craig Lewiston" <email@hidden>
- Date: Thu, 23 Oct 2008 15:41:07 -0400
I'm a newbie to Cocoa and CoreAudio, and have been trying to get the
AudioQueue Record Audio example working in a Cocoa app for a few days:
http://developer.apple.com/documentation/MusicAudio/Conceptual/AudioQueueProgrammingGuide/AQRecord/chapter_3_section_1.html
I have been somewhat successful, but not completely, and I think the
reason is due to my lack of understanding of how to use C libraries
within an Cocoa/Objective-C application. I have a few basic questions
I was hoping to get answered:
1. In the tutorial, the first step calls for creating a custom
structure to manage the state of the audio queue. This is done in C
with:
struct AQRecorderState {}
I initially approached this by creating a class,
@interface AQRecorderState : NSObject {}
I then wrote all the accessor methods necessary to implement the the
class within the rest of the tutorial code. I was able to get my code
to compile, but my program kept crashing while inside the callback
function HandleInputBuffer(){}, specifically when executing
AudioFileWritePackets (). I am now wondering if it is necessary to
define a class like I did, or if it's possible to just define the
structure in C, and use C commands to refer to the structure within my
Obj-C code. For those of you that have used Audio Queue and
Cocoa/Obj-C, how do you implement this -- as a C structure or an Obj-C
class?
2. Trouble with callback functions. I have been declaring my callback
function, static void HandleInputBuffer(){}, in the header file for my
application, after the @end interface declarative. Is there a proper
place/way to declare C callback functions in Objective-C files?
3. Finally, are there any working Cocoa examples implementing
AudioQueue? I am really only looking to see how these details I
mentioned above (structs, callbacks) are handled in Objective-C.
Thanks in advance,
Craig
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden