CoreAudio in Simulator Bug ?
CoreAudio in Simulator Bug ?
- Subject: CoreAudio in Simulator Bug ?
- From: Mark's Studio <email@hidden>
- Date: Sat, 1 Nov 2008 20:26:25 +0100
I am having a bit of trouble with coreAudio and i am not sure if it's
me, CoreAudio, or maybe my developer setup there is wrong,
i am using the code below (taken from SpeakHere ) to setup an input
AudioQueue and everything seems to be running fine except the
calculations i do on the audio in the callback are completely wrong
(like wrong samplerate).
If i record a testtone via the line input on the MacBook in the
SpeakHere example and play it back, it clicks just like it's skipping
samples,
but if i play the same file in the Finder it's OK ?
OSStatus result = AudioSessionInitialize (
NULL,
NULL,
interruptionListenerCallback,
self
);
if(result)
printf("AudioSessionInitialize %d \n",result);
self.isActive = NO;
UInt32 sessionCategory = kAudioSessionCategory_RecordAudio;
AudioSessionSetProperty (
kAudioSessionProperty_AudioCategory,
sizeof (sessionCategory),
&sessionCategory
);
UInt32 sizeOfRecordingFormatASBDStruct = sizeof (audioFormat);
result = AudioQueueGetProperty (
queueObject,
kAudioQueueProperty_StreamDescription, // this constant is
only available in iPhone OS
&audioFormat,
&sizeOfRecordingFormatASBDStruct
);
if(result)
printf("AudioQueueGetProperty1 %d \n",result);
// these statements define the audio stream basic description
// for the file to record into.
audioFormat.mSampleRate = 44100;
audioFormat.mFormatID = kAudioFormatLinearPCM;
audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger |
kAudioFormatFlagIsPacked;
audioFormat.mFramesPerPacket = 1;
audioFormat.mChannelsPerFrame = 1;
audioFormat.mBitsPerChannel = 16;
audioFormat.mBytesPerPacket = 2;
audioFormat.mBytesPerFrame = 2;
// [self setupAudioFormat: kAudioFormatLinearPCM];
// audioFormat.mSampleRate = 176400;
result = AudioQueueNewInput (
&audioFormat,
recordingCallback,
self, // userData
NULL, // run loop
NULL, // run loop mode
0, // flags
&queueObject
);
if(result)
printf("AudioQueueNewInput %d \n",result);
// get the record format back from the queue's audio converter --
// the file may require a more specific stream description than was
// necessary to create the encoder.
result = AudioQueueGetProperty (
queueObject,
kAudioQueueProperty_StreamDescription, // this constant is
only available in iPhone OS
&audioFormat,
&sizeOfRecordingFormatASBDStruct
);
if(result)
printf("AudioQueueGetProperty %d \n",result);
result = AudioQueueAddPropertyListener (
[self queueObject],
kAudioQueueProperty_IsRunning,
propertyListenerCallback,
self
);
if(result)
printf("AudioQueueAddPropertyListener %d \n",result);
result = AudioSessionSetActive (true);
if(result)
printf("AudioSessionSetActive %d \n",result);
result = AudioQueueGetProperty (
queueObject,
kAudioQueueProperty_StreamDescription, // this constant is
only available in iPhone OS
&audioFormat,
&sizeOfRecordingFormatASBDStruct
);
if(result)
printf("AudioQueueGetProperty %d \n",result);
Peter Mark
Mark's Recording Studio A/S
Lundeskovsvej 3
2900 Hellerup
Denmark
Tel: +45 35366078
Fax: +45 35366038
Mobile: +45 20416018
www.marks-studio.dk
email@hidden
_______________________________________________
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