Re: Threading Question
Re: Threading Question
- Subject: Re: Threading Question
- From: Richard Dobson <email@hidden>
- Date: Mon, 30 Jan 2012 23:30:37 +0000
Yes. It almost always comes down to counting samples and reading a list
of event messages. The Synthesis Toolkit (STK, also part of MoMu) has
example code for all this (and more), in its ADSR class.
Richard Dobson
On 30/01/2012 22:37, Gregory Wieber wrote:
Perhaps instead of having attack and decay as functions, maybe you
could do your ADSR using a switch/case statement that uses an integer to
indicate which portion of the envelope you're in, and a sampleCount that
is incremented and causes the envelope to go into the next boundary when
the right number of samples have elapsed.
Eg, (I wrote this hastily, meant to be taken as pseudo code)
int ADSRIndex = 0; // attacking
...
nextBoundary = SAMPLE_RATE * attackInSeconds;
...
switch (ADSRIndex)
{
case:
{
if (++sampleCount > nextBoundary)
{
ADSRIndex+= 1; // now its decaying
}
else amplitude+= amplitudeIncrement;
}
... etc
}
_______________________________________________
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