• 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
Re: Getting available sample rate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting available sample rate


  • Subject: Re: Getting available sample rate
  • From: Jeff Moore <email@hidden>
  • Date: Thu, 27 Nov 2008 09:51:04 -0800


On Nov 27, 2008, at 3:30 AM, Stéphane Letz wrote:


// Sampling rate
err = AudioDeviceGetPropertyInfo(selDevID, 0, false, kAudioDevicePropertyAvailableNominalSampleRates, &size, &isWritable);
if (err != noErr) {
NSLog(@"err in (info) kAudioDevicePropertyAvailableNominalSampleRates");
}

int count = size / sizeof(AudioValueRange);
JPLog("Sample rate different values: %ld\n",count);

AudioValueRange valueTable[count];
err = AudioDeviceGetProperty(selDevID, 0, false, kAudioDevicePropertyAvailableNominalSampleRates, &size, valueTable);
if (err != noErr) {
NSLog(@"err in (info) kAudioDevicePropertyAvailableNominalSampleRates");
}


for (i = 0; i < count; i++) {
JPLog("Sample rate value: %ld\n",(long)valueTable[i].mMinimum);
[samplerateText addItemWithTitle:[[NSNumber numberWithLong: (long)valueTable[i].mMinimum] stringValue]];
}

But it appears that will some devices like Echo Gina, this code only sees 6 possible values (8000, 11025, 16000, 22050, 32000, 64000) where 10 are available (8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000) as seen by Audio Midi Setup for example.


Could it be:

1) that we always use the AudioDeviceGetProperty call using the "isInput" parameter to false, event for input only device?

It's possible that could make a difference I suppose, but I don't think that it would in this case. You could fix the ambiguity by using AudioObjectGetPropertyData() and using the global scope to fetch the available sample rates.


2) that we read the mMinimum field of AudioValueRange? (where 2 fields mMinimum and mMaximum are available ?

This seems possible. A device can mix and match ranges with one value and ranges that cover many values. I believe that AMS filters the list to only display the common rates.


3) any other reason?

It's always possible that you've hit a bug in the HAL. But since it seems to do the right thing in AMS, it seems more likely that there is something else going on here.


--

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
References: 
 >Getting available sample rate (From: Stéphane Letz <email@hidden>)

  • Prev by Date: Happy Thanksgiving :)
  • Next by Date: Re: Fstream application
  • Previous by thread: Getting available sample rate
  • Next by thread: Fstream application
  • Index(es):
    • Date
    • Thread