• 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: IO Proc doesn't behave as expected
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IO Proc doesn't behave as expected


  • Subject: Re: IO Proc doesn't behave as expected
  • From: Chris Rolfe <email@hidden>
  • Date: Tue, 15 Mar 2005 17:38:53 -0800

Thanks, I'll have at look at using CAStreamBasicDescription then.


On 3/15/05 10:50 AM, "William Stewart" <email@hidden> wrote:

>
> On 14/03/2005, at 11:57 PM, Chris Rolfe wrote:
>
>> On 3/12/05 11:59 AM, "Robert Grant" <email@hidden> wrote:
>>> There's something else going on here...
>>
>> Thanks for the response (it gave me the spur to continue
>> debugging...).
>>
>> The problem seems to be my output unit initialization. I'm using a
>> local
>> variable to set the output unit's format. I assumed that
>> AudioUnitSetProperty would copy the struct, but it appears to
>> expect the
>> caller to retain the memory.
>
> Nope.
>
> We strongly recommend that you use the CAStreamBasicDescription class
> in the SDK. Many problems in this area arise due to the rather
> finicky nature of this struct and problems developers have in filling
> it out.
>
> Bill
>>
>> Assuming I'm not mistaken, is this by-design? Is it generally true
>> of data
>> passed to AudioUnitSetProperty?
>>
>> Chris
>>
>>
>>
>> //=======================================================
>> // Code Example:
>>
>> // !! BUG !! Local data. Call succeeds, but host callback generates
>> garbage.
>> OSStatus setformat()
>> {
>> AudioStreamBasicDescription format = { 48000.0, type, flags, 4, 1,
>> 4, 2, 32
>> };
>> OSStatus err = AudioUnitSetProperty (theUnit,
>>                             kAudioUnitProperty_StreamFormat,
>>                             kAudioUnitScope_Input,
>>                             0,
>>                             format,
>>                             sizeof(AudioStreamBasicDescription));
>>
>> }
>>
>> // Works! Static data. Call succeeds. Sine tones fill the air.
>> AudioStreamBasicDescription format = { 48000.0, type, flags, 4, 1,
>> 4, 2, 32
>> };
>> OSStatus setformat()
>> {
>> OSStatus err = AudioUnitSetProperty (theUnit,
>>                             kAudioUnitProperty_StreamFormat,
>>                             kAudioUnitScope_Input,
>>                             0,
>>                             format,
>>                             sizeof(AudioStreamBasicDescription));
>> }
>>
>>
>> Chris
>>
>>
>>>
>>> Robert.
>>>
>>> On Mar 11, 2005, at 9:58 PM, Chris Rolfe wrote:
>>>
>>>> Taking for granted initialization, etc., can anyone suggest why
>>>> starting/sleeping/stopping an IO Proc works, but the same IO Proc
>>>> might
>>>> produce garbage when start/stop are called from a Cocoa UI, a la:
>>>>
>>>>
>>>> This works fine:
>>>>
>>>> void start() {  AudioOutputUnitStart (unit);   }
>>>> void stop()  {  AudioOutputUnitStop  (unit);   }
>>>>
>>>> void test()
>>>> {
>>>>         start();
>>>>         usleep (4 * 1000 * 1000); // sleep this thread while audio
>>>> plays
>>>>         stop();
>>>> }
>>>>
>>>> This sucks:
>>>>
>>>> -(void) startButton () { start() ; }
>>>> -(void) stopButton ()  { stop() ; }
>>>>
>>>> TIA,
>>>> Chris
>>>>
>>>>
>>>>  _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Coreaudio-api mailing list      (email@hidden)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> 40mac.com
>>>>
>>>> This email sent to email@hidden
>>>
>>
>> --
>> circular reasoning: a syllogism in which the premise depends on or is
>> equivalent to the conclusion; see, reasoning, circular.
>>
>>
>>  _______________________________________________
>> 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

--
circular reasoning: a syllogism in which the premise depends on or is
equivalent to the conclusion; see, reasoning, circular.


 _______________________________________________
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: 
 >Re: IO Proc doesn't behave as expected (From: William Stewart <email@hidden>)

  • Prev by Date: Re: Problem loading Cocoa AU view
  • Next by Date: Reg: AUHAL interface with the user space driver
  • Previous by thread: Re: IO Proc doesn't behave as expected
  • Next by thread: AudioOutputUnitStart
  • Index(es):
    • Date
    • Thread