• 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: exceptions to using RenderCallback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exceptions to using RenderCallback


  • Subject: Re: exceptions to using RenderCallback
  • From: Matt Grippaldi <email@hidden>
  • Date: Wed, 20 Jul 2016 17:12:52 -0400

If I understand the issue correctly to the best of my knowledge you should create another mixer input buss and add the render callback to the graph.  You can not have a render callback on the same input that you are using for the AudioFilePlayer AU.
Here is a snippet from some test code I have that renders multiple tracks of audio using graph render callbacks.

    UInt32 inputBuss = 0;
    for (int t=0; t < trackCount; ++t)
    {
        AURenderCallbackStruct input;
        input.inputProc = AudioTrackRenderProc;
        input.inputProcRefCon = &tracks[t];
      
        CheckError(AudioUnitSetProperty(mixerUnit, kAudioUnitProperty_StreamFormat,
                                        kAudioUnitScope_Input, inputBuss, streamFormat, sizeof(AudioStreamBasicDescription)),
                   "Failed to set mixer buss input stream format.\n");
        AUGraphSetNodeInputCallback(graph, mixerNode, inputBuss, &input);
        ++inputBuss;
    }

And whatever you do, don’t forget to match the steam formats or you may get an earful of noise that you won’t soon forget.

Hope this helps.
- Matt




On Jul 20, 2016, at 12:20 PM, Matt Grippaldi <email@hidden> wrote:

If I understand the issue correctly to the best of my knowledge you should create another mixer input buss and add the render callback to the graph.  You can not have a render callback on the same input that you are using for the AudioFilePlayer AU.
Here is a snippet from some test code I have that renders multiple tracks of audio using graph render callbacks.

    UInt32 inputBuss = 0;
    for (int t=0; t < trackCount; ++t)
    {
        AURenderCallbackStruct input;
        input.inputProc = AudioTrackRenderProc;
        input.inputProcRefCon = &tracks[t];
      
        CheckError(AudioUnitSetProperty(mixerUnit, kAudioUnitProperty_StreamFormat,
                                        kAudioUnitScope_Input, inputBuss, streamFormat, sizeof(AudioStreamBasicDescription)),
                   "Failed to set mixer buss input stream format.\n");
        AUGraphSetNodeInputCallback(graph, mixerNode, inputBuss, &input);
        ++inputBuss;
    }

And whatever you do, don’t forget to match the steam formats or you may get an earful of noise that you won’t soon forget.

Hope this helps.

- Matt Grippaldi










On Jul 20, 2016, at 6:31 AM, Marcin Rakowski <email@hidden> wrote:

Hi, I have a graph in which two separate AudioFilePlayer AUs are feediing into a Mixer unit that then outputs to Output unit. It works fine.

Then I set up a render callback on the Mixer unit, but it never gets called.

    AURenderCallbackStruct input;

    input.inputProc = SineWaveRenderProc;

    input.inputProcRefCon = &mixerCallback;

    CheckError(AudioUnitSetProperty(mixerUnit,

                                    kAudioUnitProperty_SetRenderCallback,

                                    kAudioUnitScope_Output,

                                    0,

                                    &input,

                                    sizeof(input)),

               "AudioUnitSetProperty failed");


Is this expected behaviour? The mixer is receiving samples on both inputs. Is there a way to switch where the unit is pulling data from, ie. inputs or RenderCallback?

--

Marcin
http://google.com/+MarcinRakowskiConnect
_____________________________________
"There are many paths, but only one journey."

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: 
 >exceptions to using RenderCallback (From: Marcin Rakowski <email@hidden>)

  • Prev by Date: exceptions to using RenderCallback
  • Next by Date: AudioUnitScheduleParameters with kStereoMixerParam_Volume
  • Previous by thread: exceptions to using RenderCallback
  • Next by thread: AudioUnitScheduleParameters with kStereoMixerParam_Volume
  • Index(es):
    • Date
    • Thread