• 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: AUGraph with built-in input failing to set device (OSX)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUGraph with built-in input failing to set device (OSX)


  • Subject: Re: AUGraph with built-in input failing to set device (OSX)
  • From: John Nastos <email@hidden>
  • Date: Thu, 06 Dec 2012 17:57:10 -0800

Thanks for the pointer to Chris's book and the code downloads.

Actually, in the code you referenced (Chapter 8), he just uses an AUGraph for the output.  The input side is just an audio unit, unconnected from the graph.  He then feeds the audio from the input unit to the output unit (which is part of the graph) by grabbing samples from the ring buffer.

So, if he's doing it that way, rather than adding the input unit to the graph itself, it seems to further point towards the fact that the built-in input can't be used as part of an AUGraph.  Seems odd, though, as I said in my original email, I can add other inputs (Soundflower, for example) to the graph.

The main reason I wanted to use the AUGraph stuff was the convenience methods, but perhaps I should just go without them on that side.

Is there a way that I can determine if an AudioUnit is currently running?  Similar to `AUGraphIsRunning`?  That's one of the convenience methods I was hoping to use.

- jn


On Thu, Dec 6, 2012 at 1:13 PM, Tim Kemp <email@hidden> wrote:
The code sample you provided is actually the old way of doing it -- it uses a now-deprecated call (AudioHardwareGetProperty). 

You're quite right, sorry. Thanks for the pastie link, that's much easier to read. I have run it and I can reproduce your problem on my machine.

Are you trying to do what I assumed - that is, collect input from the default input device? This here from Chris Adamson's website (companion to his excellent Learning Core Audio book) is a fully working version of that, using an AUGraph. Note that he's using Audio Component Services to find the input component, create an AU instance of it and configure it fully before it's added to the graph: http://www.informit.com/store/learning-core-audio-a-hands-on-guide-to-audio-programming-9780321636843 (click Downloads tab. You want the Chapter 8 sample.)

Hope that helps.

On 6 Dec 2012, at 15:17, John Nastos wrote:

Tim et al,

The code sample you provided is actually the old way of doing it -- it uses a now-deprecated call (AudioHardwareGetProperty). 

The way that I'm getting the default device ID works fine, assuming I get a reference to the AudioUnit using `AudioComponentInstanceNew` -- however, it does not work when using `AUGraphNodeInfo`

Is it not possible to use the default input in an AUGraph like this?

Here's the code again on pastie if it makes it easier to read: http://pastie.org/5490322

Note that this (not using an AUGraph) works fine: http://pastie.org/5490326

- John Nastos


On Thu, Dec 6, 2012 at 11:22 AM, Tim Kemp <email@hidden> wrote:
A -10851 error means "Invalid Property Value" (see here: https://developer.apple.com/library/mac/#documentation/AudioUnit/Reference/AUComponentServicesReference/Reference/reference.html)

You've set something it doesn't like.

Take a look at this:

OSStatus SetDefaultInputDeviceAsCurrent(){
    UInt32 size;
    OSStatus err =noErr;
    size = sizeof(AudioDeviceID);

    AudioDeviceID inputDevice;
    err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice,
                                                  &size,
                                                  &inputDevice);

    if (err)
        return err;

    err =AudioUnitSetProperty(InputUnit,
                         kAudioOutputUnitProperty_CurrentDevice,
                         kAudioUnitScope_Global,
                         0,
                         &inputDevice,
                         sizeof(inputDevice));

   return err;

}

From http://developer.apple.com/library/mac/#technotes/tn2091/_index.html which is an article describing exactly what you want to do (using the HALOutput object to collect input.)



On 4 Dec 2012, at 04:56, John Nastos wrote:

 _______________________________________________
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




--
- John Nastos
http://johnnastos.com
 _______________________________________________
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: 
 >AUGraph with built-in input failing to set device (OSX) (From: John Nastos <email@hidden>)
 >Re: AUGraph with built-in input failing to set device (OSX) (From: Tim Kemp <email@hidden>)
 >Re: AUGraph with built-in input failing to set device (OSX) (From: John Nastos <email@hidden>)
 >Re: AUGraph with built-in input failing to set device (OSX) (From: Tim Kemp <email@hidden>)

  • Prev by Date: resuming audio after interrupt
  • Next by Date: auval -v Silent Flag Error
  • Previous by thread: Re: AUGraph with built-in input failing to set device (OSX)
  • Next by thread: Re: Looking up AU parameters
  • Index(es):
    • Date
    • Thread