Re: AudioDeviceSetProperty and setting kAudioDevicePropertyStreamFormat
Re: AudioDeviceSetProperty and setting kAudioDevicePropertyStreamFormat
- Subject: Re: AudioDeviceSetProperty and setting kAudioDevicePropertyStreamFormat
- From: Howard Moon <email@hidden>
- Date: Wed, 2 Mar 2005 08:57:51 -0800
Rob,
I think the problem may be in selecting 22KHz. I suspect your audio
device is not supporting 22KHz. Different hardware support different
formats. If I use the built-in audio, I can only select 44.1, but if I
use my M-Audio Quattro, I can select many more audio formats, including
22050. You can run Audio MIDI Setup and see what the supported audio
formats are for each available device.
-Howard
On Mar 1, 2005, at 9:14 PM, Rob Frohne wrote:
Thanks Jeff!
That makes perfect sense now that you say it. I did a little poking
through the coreaudio.pdf document, and see AudioStreams listed in the
HAL layer, but I didn't see how I can do a sample rate conversion on
them. I hope your note below doesn't mean that I need to completely
scrap my work and start over, in order to make it possible to support
other sample rates than 44100 kHz. Can you point me to any examples,
or give me any other hints?
Thanks,
Rob
On Mar 1, 2005, at 5:52 PM, Jeff Moore wrote:
That error is kAudioDeviceUnsupportedFormatError. It means the device
doesn't support the format you want to use.
BTW, you should be using kAudioDevicePropertyNominalSampleRate if all
you want to do is change the sample rate. If you want to change more
than that, you need to write your code such that it deals with format
info at the AudioStream level, rather than the AudioDevice level.
On Mar 1, 2005, at 5:43 PM, Rob Frohne wrote:
Hi,
I am having a problem playing files with 22 kHz sample rate using
this code here. I get this
(OSStatus) 560226676
for err if the sample rate is not 44 kHz. I'm not sure how to get
Xcode to tell me what that error is. Somehow the command clicking
for the CoreAudio stuff isn't working in my project. (For example, I
can't select AudioDeviceSetProperty and command click it and find the
definition, etc.)
audio_data.format.mSampleRate = audio_data.sfinfo.samplerate ;
audio_data.format.mChannelsPerFrame = audio_data.sfinfo.channels ;
rate = (int *) &(audio_data.format.mSampleRate);
channels = (int *) &(audio_data.format.mChannelsPerFrame);
//Set the sample rate.
if ((err = AudioDeviceSetProperty (audio_data.device, NULL, 0,
false, kAudioDevicePropertyStreamFormat,
sizeof
(AudioStreamBasicDescription), &(audio_data.format))) != noErr)
{ printf ("AudioDeviceSetProperty
(kAudioDevicePropertyStreamFormat) failed.\n") ;
return -1;
} ;
Any tips or hints would be very welcome!
--
Jeff Moore
Core Audio
Apple
_______________________________________________
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
--
Rob Frohne, Ph.D., P.E.
E.F. Cross School of Engineering
Walla Walla College
http://www.wwc.edu/~frohro/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to 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