Re: AudioConverterFillBuffer - resampling
Re: AudioConverterFillBuffer - resampling
- Subject: Re: AudioConverterFillBuffer - resampling
- From: email@hidden
- Date: Mon, 15 Jul 2002 05:48:54 -0500 (CDT)
I was inspired by this thread to try out the polyphase setting on the
converter, however I'm getting the same
kAudioConverterErr_PropertyNotSupported error message back that the OP
had. This may sound like the most redundant request for help in a while
but I can't figure it out. Here's the function I'm using (minus the error
checking after the SetProperty call):
static void setConverterToPolyphase(AudioConverterRef converter)
{
OSType srcAlgorithm = kAudioUnitSRCAlgorithm_Polyphase;
OSStatus error;// = noErr;
error = AudioConverterSetProperty(converter,
kAudioConverterSampleRateConverterAlgorithm,
sizeof(srcAlgorithm), &srcAlgorithm);
}
I call this function after calling AudioConverterNew successfully and
can't see quite what I'm doing wrong. I've tried things like using
sizeof(OSType), or replacing the ConverterAlgorithm with the inline 'srci'
to no avail. The function's code was originally in the related Objective-C
method which now is the caller of the function; it is still in a .m Obj-C
file (mentioned in case it affects compilation). Also possibly of note
is that I'm using the June release of Jaguar and am running it on a G3
iBook. The AudioConverter converts successfully using the default setting.
I am also wondering a couple of things in general about AudioConverter:
First, what did Bill mean by the limited utility of using convert
buffer? Do you mean because of memory issues? Right now I use
ConvertBuffer method all the time because of its relative simplicity in
data modelling.
Second, I have a vague recollection of an Apple employee saying that
it's okay to use AudioConverter within an IOProc. Am I correct in this
thought or are there possible problems, like an AudioConverter
conversion routine blocking? I'm planning to move the code into a separate
thread and I wonder how much of a priority it should be.
Last, has anyone who has been successful with using the polyphase
setting done a rough comparison of CPU usage by the two different quality
settings?
Thanks for any help,
Ben
On Wed, 10 Jul 2002, Bill Stewart wrote:
>
There's a limited utility to be gained by using the convert buffer calls
>
with sample rate converters...
>
>
The FillBuffer works fine - you call it with a destination buffer that you
>
want to convert, then it will call you until you've given enough data to
>
produce the samples you've requested.
>
>
See - /Developer/Examples/CoreAudio/CAServices/DefaultOutput I think is the
>
path
>
>
You can tweak the values that the sin wave calc uses to generate int, 8K
>
source if you want to validate that this works
>
>
Bill
>
<cut here>...
>
>>>> Chris Rogers <email@hidden> 07/09/02 06:02PM >>>
>
> Instead of:
>
>
>
> int srcAlgorithm = kAudioUnitSRCAlgorithm_Polyphase;
>
>
>
> try:
>
>
>
> OSType srcAlgorithm = kAudioUnitSRCAlgorithm_Polyphase;
>
>
>
>
>
> This has worked for me. The size of the property needs to be an "OSType"
>
>
>
>
>
> Good Luck,
>
> Chris Rogers
>
> Core Audio Engineer
>
> Apple Computer
>
>
>
>
>
>
>
>
>
>
>
>
>
>> I tried to set this property for my AudioConverter using the following code:
>
>>
>
>> int srcAlgorithm =
>
>> kAudioUnitSRCAlgorithm_Polyphase; // sample rate conversion
>
>> algorithm = Polyphase (i.e., higher-quality)
>
>> err = AudioConverterSetProperty(audioConverter,
>
>>
>
>> kAudioConverterSampleRateConverterAlgorithm,
>
>>
>
>> sizeof(srcAlgorithm),
>
>>
>
>> &srcAlgorithm);
>
>>
>
>> It returns with err == kAudioConverterErr_PropertyNotSupported. I
>
>> take it I am doing something wrong, but what?
>
>>
>
>> Thanks,
>
>> Harry Mahoney
_______________________________________________
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.