Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: Martyn Shaw <martynshaw99@go...>  20090624 00:05:39

Hi Pardon my ignorance but... void EqualizationDialog::spline(double x[], double y[], int n, double y2[]) { int i; double p, sig, u[NUMBER_OF_BANDS]; should say something like void EqualizationDialog::spline(double x[], double y[], int n, double y2[]) { int i; double p, sig, u[n]; but I get an error (obviously). What is the audacity / wx way of doing this correctly? I don't see a lot of malloc's in the code so wonder if this is the best way. Thanks Martyn 
From: Leland <leland@au...>  20090624 01:04:36

Martyn Shaw wrote: > Hi > > Pardon my ignorance but... > > void EqualizationDialog::spline(double x[], double y[], int n, double > y2[]) > { > int i; > double p, sig, u[NUMBER_OF_BANDS]; > > should say something like > > void EqualizationDialog::spline(double x[], double y[], int n, double > y2[]) > { > int i; > double p, sig, u[n]; > > but I get an error (obviously). What is the audacity / wx way of > doing this correctly? I don't see a lot of malloc's in the code so > wonder if this is the best way. > Could do something like: double p, sig, *u = new double[n]; ... delete [] u; Leland 
From: Martyn Shaw <martynshaw99@go...>  20090628 22:55:13

Hi Leland Leland wrote: > Martyn Shaw wrote: >> Hi >> >> Pardon my ignorance but... >> >> void EqualizationDialog::spline(double x[], double y[], int n, double >> y2[]) >> { >> int i; >> double p, sig, u[NUMBER_OF_BANDS]; >> >> should say something like >> >> void EqualizationDialog::spline(double x[], double y[], int n, double >> y2[]) >> { >> int i; >> double p, sig, u[n]; >> >> but I get an error (obviously). What is the audacity / wx way of >> doing this correctly? I don't see a lot of malloc's in the code so >> wonder if this is the best way. >> > Could do something like: > > double p, sig, *u = new double[n]; > > ... > > delete [] u; Thanks for that, have put it in. If EqualizationDialog::spline is going to be called many times with the same n (say 100 or 1000 times), and then later with another value of n, is there a more efficient way? (Of academic interest really, since the cubic spline interpolation isn't that slow.) TTFN Martyn > Leland > 
From: Michael Chinen <mchinen@gm...>  20090630 03:47:18

On Sun, Jun 28, 2009 at 3:55 PM, Martyn Shaw<martynshaw99@...> wrote: > Hi Leland > > Leland wrote: >> Martyn Shaw wrote: >>> Hi >>> >>> Pardon my ignorance but... >>> >>> void EqualizationDialog::spline(double x[], double y[], int n, double >>> y2[]) >>> { >>> int i; >>> double p, sig, u[NUMBER_OF_BANDS]; >>> >>> should say something like >>> >>> void EqualizationDialog::spline(double x[], double y[], int n, double >>> y2[]) >>> { >>> int i; >>> double p, sig, u[n]; >>> >>> but I get an error (obviously). What is the audacity / wx way of >>> doing this correctly? I don't see a lot of malloc's in the code so >>> wonder if this is the best way. >>> >> Could do something like: >> >> double p, sig, *u = new double[n]; >> >> ... >> >> delete [] u; > > Thanks for that, have put it in. > > If EqualizationDialog::spline is going to be called many times with > the same n (say 100 or 1000 times), and then later with another value > of n, is there a more efficient way? (Of academic interest really, > since the cubic spline interpolation isn't that slow.) Hi Martyn, In that case I might move the array up a level in the call stack and pass a pointer to it into the function so many calls use the same memory with just one allocation/delete. Or perhaps as a member variable of EqualizationDialog if it made sense. Michael > > TTFN > Martyn > >> Leland >> > >  > _______________________________________________ > audacitydevel mailing list > audacitydevel@... > https://lists.sourceforge.net/lists/listinfo/audacitydevel > 