• 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 mixer callback on inputs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AUGraph mixer callback on inputs


  • Subject: Re: AUGraph mixer callback on inputs
  • From: Etienne Gignac Bouchard <email@hidden>
  • Date: Fri, 15 May 2009 21:56:08 -0300
  • Thread-topic: AUGraph mixer callback on inputs

Ok well since my main problem is how to play sounds simultaneously, I don't
think openAL will be of any help.

So I registered a callback on the mixer input but now I realize I have a
very general question on callback functions.  I'm not sure how to use the
different parameters that are passed to it.

The file I'm trying to play is a 1 channel, 16 bits per channel wav file.

My callback function is:

static OSStatus renderCallback(void *inRefCon,
                            AudioUnitRenderActionFlags *ioActionFlags,
                            const AudioTimeStamp *inTimeStamp,
                            UInt32 inBusNumber,
                            UInt32 inNumberFrames,
                            AudioBufferList* ioData)
{
    InMemoryAudioFile *file = (InMemoryAudioFile *)inRefCon;

    UInt16 *audioData;

    for(int i = 0; i < inNumberFrames; i++)
    {
        audioData = ioData->mBuffers[i].mData;

        *audioData = [file getNextPacket]; //returns a UInt16
        ioData->mBuffers[i].mDataByteSize = 2; //16 bits is 2 bytes
        ioData->mBuffers[i].mNumberChannels = 1; //1 channel in file
    }
}


That code gives me a bad exec.  Why ?

Again, I'm pretty sure I'm not using the parameters correctly.

Thanks.

On 15/05/09 6:57 PM, "William Stewart" <email@hidden> wrote:

>
> On May 15, 2009, at 2:17 PM, Etienne Gignac Bouchard wrote:
>
>> Thank you for your reply Bill.
>>
>> I have looked at OpenAL before and it does look pretty straight
>> forward.
>>
>> One question though: is it possible to call alSourcePlay() on multiple
>> sources and have them play at the same time ? (without any weird
>> hardware
>> conflict or anything ?)
>
> There is no way to schedule openAL sources to begin playing at the
> same time, so I don't think you could do this with OpenAL
>
>>
>>
>> That might be a stupid question but the mixer audio unit was giving
>> me a
>> warm and fuzzy feeling about this that I don't have with openAL...
>>
>> Or can I add my openAL sources as input to my mixer ??
>>
>>
>> On 15/05/09 3:51 PM, "William Stewart" <email@hidden> wrote:
>>
>>>
>>> On May 15, 2009, at 10:40 AM, Etienne Gignac Bouchard wrote:
>>>
>>>> Good day.
>>>>
>>>> I'm currently trying to play multiple wav files through a mixer and
>>>> with a
>>>> remoteIO as the output.
>>>>
>>>> Right now I have an AUGraph with a mixer connected to the remoteIO.
>>>> I also
>>>> have preloaded my (wav) files in memory, using
>>>> AudioFileReadPackets() from
>>>> the AudioFile class.  All is well so far.
>>>>
>>>> But now I'm trying to bridge the gap between the audio buffers and
>>>> the mixer
>>>> inputs (16 of them).
>>>>
>>>> How should I proceed ?  Should I assign a callback function on every
>>>> input
>>>> of the mixer ?
>>>
>>> yes - you have to
>>>
>>>> Too bad the AUAudioFilePlayer unit isn't available.
>>>
>>> good feedback :) - please file a bug to request this addition
>>>
>>>>
>>>>
>>>> How would I proceed to do such a thing ?
>>>
>>> so, every callback you set is attached to the input element of the
>>> mixer you specify. presumably you want one file on one input, so if
>>> you have 16 callbacks active, you have 16 files you want to playback
>>> simultaneously.
>>>
>>> So each callback will just read through the file associated with it.
>>>
>>> I'm just wondering though - you might that OpenAL is easier to use -
>>> it essentially does this, but gives you a separation between the
>>> buffers that you attach to a given source (think of a source as a
>>> single callback/input on the mixer, and the buffers are the bits of
>>> the file that you have read). It then allows you to pan (locate in 3D
>>> space) each source independently, changes its volume, and so forth.
>>> We
>>> have examples (oalTouch) that you might want to have a look at
>>>
>>> Bill
>>>
>>>>
>>>>
>>>> Again, thank you.
>>>>
>>>> Etienne
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>
>>
>> _______________________________________________
>> 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
>


 _______________________________________________
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: AUGraph mixer callback on inputs (From: William Stewart <email@hidden>)

  • Prev by Date: Re: Peak and averagePowerForChannel are nice, but what about the actual current power?
  • Next by Date: Re: Peak and averagePowerForChannel are nice, but what about the actual current power?
  • Previous by thread: Re: AUGraph mixer callback on inputs
  • Next by thread: Iphone stream format woes ?
  • Index(es):
    • Date
    • Thread