Setting the samplerate
Setting the samplerate
- Subject: Setting the samplerate
- From: Fredrik Oja <email@hidden>
- Date: Mon, 09 Sep 2002 11:04:21 +0200
I want to capture mono 16bit linear PCM from my audio devices. I have
one iMIC and one philips vestra pro camera. When I try to set the stream
format the call fails. What am I doing wrong? Below is some code
memset(&formatDesc, 0, sizeof(AudioStreamBasicDescription));
formatDesc.mFormatFlags = 0;
formatDesc.mFramesPerPacket = 1;//160;
formatDesc.mBytesPerFrame = 2;
formatDesc.mBytesPerPacket = formatDesc.mFramesPerPacket *
formatDesc.mBytesPerFrame;
formatDesc.mChannelsPerFrame = 1;
formatDesc.mBitsPerChannel = 16;
formatDesc.mSampleRate = (double) 8000.0;
formatDesc.mFormatID = kAudioFormatLinearPCM;
status = AudioDeviceSetProperty(
inputDevices[inputDeviceIndex].id, 0, 0,
true, kAudioDevicePropertyStreamFormat,
sizeof(formatDesc), &formatDesc);
if (status != kAudioHardwareNoError) {
printf("Failed setting AudioDevicePropertyStreamFormat\n");
}
I have also tried by only setting the samplerate variable and leaving
everything else at zero, but the call fails anyway.
Any suggestions will be greatly appreciated
/ Fredrik Oja
_______________________________________________
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.