Re: Cocoa and PortAudio
Re: Cocoa and PortAudio
- Subject: Re: Cocoa and PortAudio
- From: Jont Olof Lyttkens <email@hidden>
- Date: Thu, 17 Oct 2002 12:27:34 +0200
>
I think you need to give us more details. Please show us the whole of
>
the
>
callback code and please copy & paste the error message instead of
>
paraphrasing it. It still doesn't look like a C++ versus Obj-C issue -
>
it
>
seems simpler than that.
Okay. Here's the Document-files for the app. In the project of course
I've also included all the PortAudio-files required to use the API, but
these are the only files I've been messing around with. Are the
portAudio-files of importance as well? In that case they can be found at
http://www.portaudio.com.
the JontesCallbackfunction looks like this (modified for
pitch-modification via an NSSlider named pitchSlide, comments excluded:
#import "MyDocument.h"
static int jontesCallback(void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
PaTimestamp outTime, void *userData)
{
// TypeCasting av userData och outPutBuffer
jontesTestData *data = (jontesTestData*)userData;
float *out = (float*)outputBuffer;
unsigned int i;
(void) outTime; // to prevent unused variable warnings.
(void) inputBuffer;
for( i = 0; i < framesPerBuffer; i++ )
{
*out++ = data -> left_phase;
*out++ = data -> right_phase;
data -> left_phase += [pitchSlider floatValue] * 0.01f;
if( data -> left_phase >= 1.0f )
{
data -> left_phase -= 2.0f;
}
data -> right_phase += [pitchSlider floatValue] * 0.01f;
if ( data -> right_phase >= 1.0f )
{
data -> right_phase -= 2.0f;
}
}
return 0;
}
@implementation MyDocument { .. }
The error message I get is:
Compiling MyDocument.mm (1 error)
"pitchSlider" undeclared (first use this function) (Each undeclared
identifier is reported only once for each function is appears in.)
Thanx in advance
/Jont Olof
/* MyDocument */
#import <Cocoa/Cocoa.h>
#import <iostream.h>
#import <math.h>
#import "portaudio.h"
#define NUM_SECONDS (4)
#define SAMPLE_RATE (44100)
typedef struct
{
float left_phase;
float right_phase;
}
jontesTestData;
static jontesTestData data;
@interface MyDocument : NSDocument
{
PortAudioStream *stream;
PaError err;
IBOutlet NSSlider *pitchSlider;
}
- (IBAction)audioStart:(id)sender;
- (IBAction)audioStop:(id)sender;
@end
[demime 0.98b removed an attachment of type application/octet-stream which had a name of MyDocument.mm]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.