• 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: Process and Render
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Process and Render


  • Subject: Re: Process and Render
  • From: paul webb <email@hidden>
  • Date: Fri, 25 Jun 2004 07:02:29 -0700 (PDT)

hello,

by doing float *W = new float[iFrames]; you will leak
memory with each callback as the example is not
deleting the arrays

try...

float* out1 =(float*) ioData->mBuffers[0].mData; // a
pointer to the address of the buffer data array

for (i=0; i<inNumFrames; i++)
out1[i]=somevalue between -1.0 / 1.0


or can increment pointer position with each loop using
for (i=0; i<inNumFrames; i++)
*out1++ =somevalue between -1.0 / 1.0;


paul

--- Aristotel Digenis <email@hidden> wrote:
> Thank you for that.
>
> I have had sucess using ProcessBufferList(). This is
> the first time I am
> using bufferlists so I have one question about that.
>
> In inBufferList.mBuffers[0].mData mData is an
> array correct? So I
> should be able to do the following
>
> inBufferList.mBuffers[0].mData[number] = something;
>
> But this does not seem to work. However I can copy
> mData to a new array
> as I have done bellow. For the time being I am
> working around this by
> doing the following:
>
> OSStatus
>
BProc::ProcessBufferLists(AudioUnitRenderActionFlags&
> iFlags,
> const AudioBufferList& inBufferList,
> AudioBufferList& outBufferList,
> UInt32 iFrames)
> {
> float *W = new float[iFrames];
> float *X = new float[iFrames];
> float *Y = new float[iFrames];
> float *Z = new float[iFrames];
>
> W = (float*) inBufferList.mBuffers[0].mData;
> X = (float*) inBufferList.mBuffers[1].mData;
> Y = (float*) inBufferList.mBuffers[2].mData;
> Z = (float*) inBufferList.mBuffers[3].mData;
>
> for(UInt32 i = 0; i < iFrames; i++)
> {
> W[i] = W[i] * fValue_Rotate;
> X[i] = X[i] * fValue_Rotate;
> Y[i] = Y[i] * fValue_Rotate;
> Z[i] = Z[i] * fValue_Rotate;
> }
>
> outBufferList.mBuffers[0].mData = W;
> outBufferList.mBuffers[1].mData = X;
> outBufferList.mBuffers[2].mData = Y;
> outBufferList.mBuffers[3].mData = Z;
>
> return noErr;
> }
>
> Is there a way avoid the extra code and read a
> specific array slot of a
> specific buffer array of a bufferlist? Such as:
>
>
> inBufferList.mBuffers[0].mData[number] = something;
>
> Thank you...
>
>
>
> William Stewart wrote:
>
> > AudioUnitRender is the API
> >
> > In AUBase (from AUDispatch) the API calls Render,
> which then drills
> > down some levels... Ultimately everything below
> here is implementation
> > detail
> >
> > In AUEffectBase we specialise this some more
> because most effects
> > process N-N channels = so we introduced the Kernel
> classes... If you
> > don't want to use Kernels, then you can overide
> ProcessBufferList (the
> > method in AUEffectBase that calls through to the
> kernels)
> >
> > Bill
> >
> > On 21/06/2004, at 2:45 AM, Aristotel Digenis
> wrote:
> >
> > Goodmorning,
> >
> > Over the weekend I have gone over the
> documentation of the SDK and
> > have some more questions.
> >
> > It appears that when processing N to N number
> of channels where
> > there is no interaction between the channels
> for the processing,
> > then we implement a new AUKernelBase and the
> processing for each
> > of the N channels happens inside the Kernel.
> An example of this
> > would be a gain plug-in where we have one
> slider for
> > amplitude...we can put in 10 channels and we
> will output 10
> > channels out, all amplified by the same ratio
> set by the slider.
> >
> > If the processing of N to N channels requires
> that the data from
> > one channel can affect the other channel, then
> we implement
> > ProcessBufferLists()? This function internally
> calls
> > AUKernelBases? I have not managed to find
> enough information on
> > this or how it is implemented.
> >
> > Then there is AudioUnitRender() which doesn't
> seem to be intended
> > for plugins (AUEffectBase type of Audio
> Units). To add to the
> > confusion i have also come accross Render(),
> DoRender(),
> > DoRenderBus(), DoRenderSlice()
> >
> > Could somebody who does understand the
> differences and uses help
> > me out please?
> >
> > Thank you in advance!!!
> >
> > Aristotel Digenis wrote:
> >
> > Hello again,
> >
> > As I have been using the SDK's
> SampleEffectUnit example to
> > learn AUs and adapt it to my needs, I have
> notices that the
> > Process() function is declared within a
> class inside the
> > SampleEffectUnit class as shown below.
> >
> > class SampleEffectUnit : public
> AUEffectBase
> > {
> > public:
> > SampleEffectUnit(AudioUnit component);
> > virtual AUKernelBase * NewKernel() {
> return new
> > SampleEffectKernel(this); }
> > virtual ComponentResult
> GetParameterValueStrings();
> > virtual ComponentResult
> GetParameterInfo();
> > virtual ComponentResult GetPropertyInfo();
> > virtual ComponentResult GetProperty();
> > virtual ComponentResult GetPresets()
> const;
> > virtual OSStatus NewFactoryPresetSet ();
> > virtual ComponentResult Version() { return
> > kSampleEffectUnitVersion; }
> >
> > protected:
> > class SampleEffectKernel : public
> AUKernelBase
> > {
> > public:
> > SampleEffectKernel(AUEffectBase
> *inAudioUnit ):
> > AUKernelBase(inAudioUnit){}
> >
> > virtual void Process();
> > virtual void Reset();
> > }; };
> >
> > I understand the purpose of the
> AUKernelBase but then I saw
> > the source code of AirSynth where the
> Process() function is
> > not declared inside a seperate AUKernel
> class. Instead the
> > Process function is declared inside the
> AirySynth class. I
> > tried to move the Process() function of my
> plug in out of the
> > SampleEffectKernel class and inside the
> SampleEffectUnit
> > class, but this results in no processing
> taking place. Does
> > the fact that AirySynth is a MusicDevice
> make a difference? Do
> > MusicDevices have different processing
> structure to Effect Units?
> >
> > Also, use SetParameter() functions in my
> constructor to set
> > the initial values of my sliders. This
> works fine and the
> > sliders do have an effect on the
> processing. Having read the
>
=== message truncated ===

=====
....................................................................................
http://www.robotsoftware.co.uk
http://www.fexia.com
.....................................................................................



__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: Process and Render (From: Aristotel Digenis <email@hidden>)

  • Prev by Date: My AUHAL Output Audio Unit
  • Next by Date: Re: My AUHAL Output Audio Unit
  • Previous by thread: Re: Process and Render
  • Next by thread: Re: Process and Render
  • Index(es):
    • Date
    • Thread