• 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: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL


  • Subject: Re: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
  • From: Jean-Yves Avenard <email@hidden>
  • Date: Wed, 15 Jun 2011 09:51:28 +1000

Hi

I should add that :

desc used in my earlier post is set as:

    ComponentDescription desc;
    desc.componentType = kAudioUnitType_Output;
    desc.componentSubType = kAudioUnitSubType_HALOutput;;
    desc.componentManufacturer = kAudioUnitManufacturer_Apple;
    desc.componentFlags = 0;
    desc.componentFlagsMask = 0;

Now when calling:
    err = AudioUnitSetProperty(mComponent,
                               kAudioOutputUnitProperty_CurrentDevice,
                               kAudioUnitScope_Global,
                               0,
                               &mDeviceID, sizeof(mDeviceID));

mDeviceID is set to the default device....


Now, if I do use the default device directly, doing:
    desc.componentType = kAudioUnitType_Output;
    desc.componentSubType = kAudioUnitSubType_DefaultOutput;
    desc.componentManufacturer = kAudioUnitManufacturer_Apple;
    desc.componentFlags = 0;
    desc.componentFlagsMask = 0;

and as such never having to assign
kAudioOutputUnitProperty_CurrentDevice ; then everything works okay. I
can switch between AC3 -> PCM -> AC3 automatically without hassle.

The reason for the audio type to change is related to the media being
played. This is for the open source project MythTV which is a software
PVR and is used to watch FreeToAir television.
Often, the media you watch is AC3 audio, and suddenly you have an ad
which would by stereo mp2/mp3, then back to 5.1 AC3... So it is
required to be able to change audio content on the fly.

I thought that the audio device not having IO, could be a timing issue
after releasing hog mode as usually, if I stop the playback
completely, I can restart it and stereo PCM will play again. I tried
putting various wait time: but it never seems to make a difference.

Thanks in advance for any help
JY

On 14 June 2011 23:38, Jean-Yves Avenard <email@hidden> wrote:
> Hi there.
>
> MacOS 10.6:
>
> I am experiencing an issue in that following playing AC3 digital audio
> ; changing then to playing plain stereo PCM fails (going in the
> opposite direction always works fine).
>
> The error occurs there:
>
>    AudioComponent comp = AudioComponentFindNext(NULL, &desc);
>    if (comp == NULL)
>    {
>        Error("AudioComponentFindNext failed");
>        return false;
>    }
>
>    OSStatus err = AudioComponentInstanceNew(comp, &mComponent);
>    if (err)
>    {
>        Error(QString("AudioComponentInstanceNew returned %1")
>              .arg(err));
>        return false;
>    }
>    err = AudioUnitSetProperty(mComponent,
>                               kAudioOutputUnitProperty_CurrentDevice,
>                               kAudioUnitScope_Global,
>                               0,
>                               &mDeviceID, sizeof(mDeviceID));
>  /\/\/\/\ err = -10851
> Playing only analog, I can destroy / recreate the AudioUnit as much as
> I like. But if previously I was playing an AC3 digital stream, then
> kAudioOutputUnitProperty_CurrentDevice fails with error: -10851.
> Googling tells me that -10851 is kAudioUnitErr_InvalidPropertyValue).
>
> From searching, as per
> (http://developer.apple.com/library/mac/#technotes/tn2091/_index.html)
> usually this error occurs when IO is disabled and mostly seen on input
> device which are disabled by default).
>
> And effectively, upon checking IO status with:
>    UInt32 hasIO = 0;
>    UInt32 size_hasIO=sizeof(hasIO);
>    err = AudioUnitGetProperty(mComponent,
>                               kAudioOutputUnitProperty_HasIO,
>                               kAudioUnitScope_Output,
>                               0,
>                               &hasIO, &size_hasIO);
>    Debug(QString("HasIO = %1").arg(hasIO));
>
> This prints HasIO = 0
>
> So following SPDIF mode (e.g remove hog, re-enabling mixer etc..) ;
> the standard device lost IO.
>
> I have tried re-enabling IO:
>        UInt32 enableIO = 1;
>        err = AudioUnitSetProperty(mComponent,
>                                   kAudioOutputUnitProperty_EnableIO,
>                                   kAudioUnitScope_Output,
>                                   0,
>                                   &enableIO, sizeof(enableIO));
>
> However, kAudioOutputUnitProperty_CurrentDevice still fails (and
> checking  kAudioOutputUnitProperty_HasIO, still shows that it still do
> not have IO, even after attempting to enable it)
>
> Any ideas about what's going on and what I am missing?
>
> I've spent the whole day on this, and I just don't get it :(
>
> Thank you
> Jean-Yves
>
 _______________________________________________
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

  • Follow-Ups:
    • Re: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
      • From: Jean-Yves Avenard <email@hidden>
References: 
 >Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL (From: Jean-Yves Avenard <email@hidden>)

  • Prev by Date: Re: Configuring RemoteIO Audio unit to play and record iLBC on the iPhone
  • Next by Date: modify-in-place AudioUnits in graphs for iOS
  • Previous by thread: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
  • Next by thread: Re: Failing to set kAudioOutputUnitProperty_CurrentDevice to HAL
  • Index(es):
    • Date
    • Thread