Re: AudioFilePlayer & 4-channel wav file
Re: AudioFilePlayer & 4-channel wav file
- Subject: Re: AudioFilePlayer & 4-channel wav file
- From: Mike Aizatsky <email@hidden>
- Date: Tue, 29 Nov 2005 23:35:45 +0300
Sorry for bumping up the question, but I still can't get the
4-channel output...
Right now AudioFilePlayer correctly has 4 output channels, and mixer
correctly creates 4 input channels. But the trouble is in sound
absence!
I'm setting following volumes in the mixer:
Global Volume: 1.000
1.000 (1.000) (0.000)
1.000 (0.000) (1.000)
1.000 (1.000) (0.000)
1.000 (0.000) (1.000)
1.000 1.000
And whenever I ask mixer for kMatrixMixerParam_PreAveragePower for any
of the input channels I'm getting -infinity. Please not that
everything works OK if I set 2 channel output format in player for the
same 4 channel file or just use 2-channel file in with the same code.
I hear first 2 channels in speakers, and preAveragePower are good
numbers. Can you give me any debugging hints?
On 11/15/05, William Stewart <email@hidden> wrote:
>
> On 15/11/2005, at 2:10 AM, Mike Aizatsky wrote:
>
> > William,
> >
> > Sorry for late reply - had no time to check this things out.
> >
> > I'm still unable to get 4-channel output from filePlayer. To make a
> > clean and controlled experiment I'm setting up the graph with only one
> > filePlayer.
> >
> > My file stream description:
> >
> > mSampleRate=22050.0, mFormatID=1819304813, mFormatFlags=12,
> > mBytesPerPacket=8, mFramesPerPacket=1, mBytesPerFrame=8,
> > mChannelsPerFrame=4, mBitsPerChannel=16, mReserved=0
> >
> > Default filePlayer output stream:
> >
> > mSampleRate=44100.0, mFormatID=1819304813, mFormatFlags=43,
> > mBytesPerPacket=4, mFramesPerPacket=1, mBytesPerFrame=4,
> > mChannelsPerFrame=2, mBitsPerChannel=32, mReserved=0
> >
> > Whenever I'm trying to match file channel number in filePlayer's
> > output stream format right after graph.open() and before
> > graph.initialize() to:
> >
> > mSampleRate=44100.0, mFormatID=1819304813, mFormatFlags=43,
> > mBytesPerPacket=8, mFramesPerPacket=1, mBytesPerFrame=8,
> > mChannelsPerFrame=4, mBitsPerChannel=32, mReserved=0
> >
> > I'm getting the kAudioUnitErr_FormatNotSupported on setting AU
> > property. Any idea what's going on?
>
> Yes - its not going to output this format - you should use
> CAStreamBasicDescription (from the PublicUtility folder in the SDK).
>
> Then set up a canonical desc (float 32) with 4 chans (deinterleaved)
> for the output - then that will work
>
> Bill
>
> >
> > On 10/25/05, William Stewart <email@hidden> wrote:
> >> You can't change a format once you have initialised an AU...
> >>
> >> Typically, what happens is this:
> >>
> >> Set the formats - at least the output side
> >> Set a connection
> >> Initialize
> >>
> >> One of the things that happens when you init with a connection is to
> >> get the format of the output side of the connection and establish
> >> that as the input side's format.
> >>
> >> Once an AU is initialised, it won't generally allow its format to
> >> change until you uninitialise it - because it uses formats to know
> >> what state to establish....
> >>
> >> So, if you want to change the output format of the file player, you'd
> >> have to disconnect it, uninitialise it (if you'd done this in the
> >> past), then set its format, reconnect it, and initialise it. When its
> >> reconnected, the matrix mixer will then know that you have 4 channels
> >> on that input too of course - and if that's changing, then the MM
> >> would also have to be uninitialised... It sounds complicated (and it
> >> probably is!), but you can build up management objects around this to
> >> manage these kinds of transitions.
> >>
> >> HTH
> >>
> >> Bill
> >>
> >> On 24/10/2005, at 11:46 PM, Mike Aizatsky wrote:
> >>
> >>> William,
> >>>
> >>> I'm doing all this stuff after I have all my graph set up. What's
> >>> the
> >>> difference between different initialization times? What are the
> >>> guidelines?
> >>>
> >>>> Also, which mixer AU?
> >>>
> >>> Matrix
> >>>
> >>> On 10/24/05, William Stewart <email@hidden> wrote:
> >>>>
> >>>> On 23/10/2005, at 2:12 AM, Mike Aizatsky wrote:
> >>>>
> >>>>> Hi!
> >>>>>
> >>>>> I've successfully set up an AU graph: file player -> mixer ->
> >>>>> effect
> >>>>> -> output unit. Everything works correctly, until I'm feeding the
> >>>>> 4-channel wav file into file player. Despite all my efforts it
> >>>>> still
> >>>>> has only 2 channels on exit.
> >>>>
> >>>> Are you setting the output format on the FilePlayer? You would need
> >>>> to do this *before* you connect it to something. You'll also find I
> >>>> think that CAStreamBasicDescription (in PublicUtility) has a
> >>>> good set
> >>>> of utilities for setting up and printing these structs.
> >>>>
> >>>>>
> >>>>> Here's the file format description:
> >>>>>
> >>>>> - - - - - - - - - - - - - - - - - - - -
> >>>>> Sample Rate:22050.000000
> >>>>> Format ID:lpcm
> >>>>> Format Flags:C
> >>>>> Bytes per Packet:8
> >>>>> Frames per Packet:1
> >>>>> Bytes per Frame:8
> >>>>> Channels per Frame:4
> >>>>> Bits per Channel:16
> >>>>> - - - - - - - - - - - - - - - - - - - -
> >>>>>
> >>>>> For this file, AUFilePlayer says it has the following output
> >>>>> format:
> >>>>>
> >>>>> - - - - - - - - - - - - - - - - - - - -
> >>>>> Sample Rate:44100.000000
> >>>>> Format ID:lpcm
> >>>>> Format Flags:2B
> >>>>> Bytes per Packet:4
> >>>>> Frames per Packet:1
> >>>>> Bytes per Frame:4
> >>>>> Channels per Frame:2
> >>>>> Bits per Channel:32
> >>>>> - - - - - - - - - - - - - - - - - - - -
> >>>>>
> >>>>>
> >>>>> It even ignore my manual output format setup:
> >>>>>
> >>>>> ------------------------
> >>>>> AudioStreamBasicDescription filePlayerDesc;
> >>>>> dataSize = sizeof(AudioStreamBasicDescription);
> >>>>>
> >>>>> filePlayerDesc.mFormatID = kAudioFormatLinearPCM;
> >>>>> filePlayerDesc.mFormatFlags =
> >>>>> kAudioFormatFlagsNativeFloatPacked;
> >>>>> filePlayerDesc.mBitsPerChannel = 32;
> >>>>> filePlayerDesc.mChannelsPerFrame = 4;
> >>>>> filePlayerDesc.mFramesPerPacket = 1;
> >>>>> filePlayerDesc.mBytesPerPacket =
> >>>>> filePlayerDesc.mBytesPerFrame =
> >>>>> sizeof(Float32) * filePlayerDesc.mChannelsPerFrame;
> >>>>> filePlayerDesc.mFormatFlags |=
> >>>>> kAudioFormatFlagIsNonInterleaved;
> >>>>> verify_noerr( AudioUnitSetProperty(myFilePlayerUnit,
> >>>>>
> >>>>> kAudioUnitProperty_StreamFormat,kAudioUnitScope_Output,
> >>>>> 0,&filePlayerDesc,dataSize));
> >>>>> ----------------------------
> >>>>>
> >>>>> Any hints, how can I have 4 channels of output to mix it in the
> >>>>> mixer
> >>>>> from file player unit?
> >>>>
> >>>> Is this being done *before* you connect it to the mixer? Also,
> >>>> which
> >>>> mixer AU?
> >>>>
> >>>> Bill
> >>>>
> >>>>>
> >>>>> --
> >>>>> Regards,
> >>>>> Mike
> >>>>> _______________________________________________
> >>>>> Do not post admin requests to the list. They will be ignored.
> >>>>> Coreaudio-api mailing list (email@hidden)
> >>>>> Help/Unsubscribe/Update your Subscription:
> >>>>> 40apple.com
> >>>>>
> >>>>> This email sent to email@hidden
> >>>>
> >>>> --
> >>>> mailto:email@hidden
> >>>> tel: +1 408 974 4056
> >>>> ___________________________________________________________________
> >>>> __
> >>>> ___
> >>>> __
> >>>> "Much human ingenuity has gone into finding the ultimate Before.
> >>>> The current state of knowledge can be summarized thus:
> >>>> In the beginning, there was nothing, which exploded" - Terry
> >>>> Pratchett
> >>>> ___________________________________________________________________
> >>>> __
> >>>> ___
> >>>> __
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Regards,
> >>> Mike
> >>
> >> --
> >> mailto:email@hidden
> >> tel: +1 408 974 4056
> >> _____________________________________________________________________
> >> ___
> >> __
> >> "Much human ingenuity has gone into finding the ultimate Before.
> >> The current state of knowledge can be summarized thus:
> >> In the beginning, there was nothing, which exploded" - Terry
> >> Pratchett
> >> _____________________________________________________________________
> >> ___
> >> __
> >>
> >>
> >
> >
> > --
> > Regards,
> > Mike
>
> --
> mailto:email@hidden
> tel: +1 408 974 4056
> ________________________________________________________________________
> __
> "Much human ingenuity has gone into finding the ultimate Before.
> The current state of knowledge can be summarized thus:
> In the beginning, there was nothing, which exploded" - Terry Pratchett
> ________________________________________________________________________
> __
>
>
--
Regards,
Mike
_______________________________________________
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