need a new "peak" opcode

the actual peak opcode sux.

i need a peak controller like in Fruity Loose
the actual peak opcode is

"These opcodes maintain the output k-rate variable as the peak absolute level so far received.
Syntax

kres peak asig

kres peak ksig"

I need a "kreas peak asig,ktime"

where ktime is the time of the buffer where peak return the peak absolute level received since ktime.

i think it's easy to implement.

i propose to modif the file csound5/OOps/ugrw1.c line 3155 for :

/* peaka()
*
* Similar to peakk, but looks at an a rate input variable.

modified for a peak controller(not perfect but enought for use)

prototype:
kres peak asig, ktime
kres peak asig, ktime, /* hidden var ? */[ knextpeakout],[kpeaktimeout],[knextpeaktimeout]
*/
int peaka(CSOUND *csound, PEAK *p)
{
// unsigned is for hoe ?
int loop;
int ptime
int *latestpeaktime;
int *latestnextpeaktime;
MYFLT *peak;
MYFLT *asigin;
MYFLT *bufftime;
MYFLT *nextpeak;

bufftime = p->ktimein;
loop = csound->ksmps;
if(*bufftime == 0.0)
ptime = loop;
else
// i think time in ms and
time = A_FUNC_LIKE_CONVERT_TIME_TO_NUM_SAMPLE(*bufftime);
asigin = p->xsigin;
peak = p->kpeakout;
latestpeaktime = p->kpeaktimeout ;

//int overflow ?
*latestpeaktime += loop;

//maybe an hidden var? i don't know the arch of the global code
nextpeak = p->knextpeakout;
latestnextpeaktime = p->knextpeaktimeout ;

//int overflow ?
*latestpeaktime += loop;

//safe of int overflow
if((ptime <= loop) || ((ptime - loop) < *latestpeaktime) )
{
if((ptime <= loop) || ((ptime - loop) < *latestnextpeaktime))
{
*peak = 0.0;
*nextpeak = 0.0;
*latestpeaktime = 0;
*latestnextpeaktime = 0;
}
else
{
*peak = *nextpeak;
*latestpeaktime = *latestnextpeaktime;
*nextpeak = 0.0;
*latestnextpeaktime = 0;

}

}

do {
if (*peak < FABS(*asigin))
{
*peak = FABS(*asigin);
*nextpeak = 0;
*latestpeaktime = loop ;
*latestnextpeaktime = 0;
}
else if((*latestpeaktime > csound->ksmps) && (*nextpeak < FABS(*asigin)))
{
*nextpeak = FABS(*asigin);
*latestnextpeaktime = loop;
}
asigin++;
} while (--loop);

return OK;
}

vu meter

i think a vu meter (http://en.wikipedia.org/wiki/VU_meter) could be a good idea

zpack generic cialis cialis online staxyn ed drugs z-pack pharmacy uk cialis uk buy viagra uk z pack viagra online viagra uk ed pills z pak z-pak Canadian pharmacy viagra buy zithromax generic viagra cheap generic viagra avanafil Canadian pharmacy zpak kamagra uk