• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Accessing user interface from ioProc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing user interface from ioProc


  • Subject: Accessing user interface from ioProc
  • From: Michael Bonnice <email@hidden>
  • Date: Wed, 19 Nov 2003 21:09:18 -0700

In my application, I listen to the input device and calculate an FFT
all within my ioProc. This works, and I can print the results using
fprintf(stderr, ...) from my ioProc. Now I'm ready to put the results
into my user interface.

This is an Objective-C program, and I'm new to Objective-C and Cocoa.
Naturally, before I've even got the grip of the object hierarchy and
the flow of control, I need to send a message to an object while in an
ioProc, and I don't know what scope the ioProc is in (or if this is
even a meaningful concept?)

There is a text field in my interface window that should display the
result. I stored a reference to that field, calculate the result, then
send the field the message to display the result. It does display it,
but I get an error message in the console each time I send the message:

2003-11-19 21:05:44.854 Tuner[466] *** _NSAutoreleaseNoPool(): Object
0x36b3d0 of class NSCFNumber autoreleased with no pool in place - just
leaking

Any ideas how to fix this?

Mike

Code fragments:

@interface TunerController : NSObject
{
...
IBOutlet id freqField; // the user interface item, a text field
...
}
...
@end

@implementation TunerController

- (void)awakeFromNib
{
[tuner setup]; // this will initialize our CoreAudio data
...
[tuner setLeftFreqField: freqField]; // tell the tuner where to
show the left frequency
}
..

@end

@interface Tuner : NSObject
{

...

IBOutlet id leftFreqField; // field showing the
frequency of the left channel
}

...
- (void)setLeftFreqField:(id)field;

@end

// define a C struct from the Obj-C object so audio callback can access
data
typedef struct {
@defs(Tuner);
} tunerdef;

// this is the audio processing callback

OSStatus inappIOProc (AudioDeviceID inDevice, const AudioTimeStamp*
inNow, const AudioBufferList* inInputData,
const AudioTimeStamp* inInputTime,
AudioBufferList* outOutputData, const AudioTimeStamp* inOutputTime,
void* defptr)
{
tunerdef* def = defptr; // get access to Tuner's data
float leftFreq;

// do the FFT math here, the answer is in leftFreq
..
[def->leftFreqField setDoubleValue: leftFreq]; // display
the result !!!!!!!!!!!!!! problem here !!!!!!!!!!
}

@implementation Tuner

- (void)setLeftFreqField:(id)field
{
leftFreqField = field; // store the field id in a place where the
ioProc can get it
}

@end
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Accessing user interface from ioProc
      • From: Michael Thornburgh <email@hidden>
    • Re: Accessing user interface from ioProc
      • From: Kurt Revis <email@hidden>
  • Prev by Date: DLS and reverb bug?
  • Next by Date: DLS and offline rendering problems
  • Previous by thread: DLS and reverb bug?
  • Next by thread: Re: Accessing user interface from ioProc
  • Index(es):
    • Date
    • Thread