|
From: Christian S. <chr...@ep...> - 2003-12-30 16:10:02
|
Es geschah am Dienstag, 30. Dezember 2003 15:13 als ian esten schrieb: > > Keep in mind it must for example handle following tasks: > > assume there is a pitch envelope running (composed of linear segments). > > Now the user operates the pitchbender. > > The real time event is timestamped and delayed till the next audio > > fragment gets processed. If there is already an envelope running the > > pitchbender needs to "add" his own pitch to the current one possibly > > using an event. for example if we want two pitch envelopes modulating the > > same sample what's the best way to do it ? > > just add the two (or more) modulating sources scaled by the mod depths > to get the final mod amount. My idea is the following: using an array with array size = audio fragment size. So each element of the array refers to exactly one sample point of the current audio fragment. Each element of the array will hold a linked list with events for that sample point if there is at least one event to be processed for this sample point. if there are none then the array element reflects NULL. My idea is not to hold all raw events there that came, but the final sum for the respective modulation destination. So if for example a envelope generator wants to alter the pitch it looks if there's already a 'pitch' event in the array element for the respective sample point, if not it will create one with it's pitch delta, if there's already a 'pitch' event, then it will add it's pitch delta to the delta of the event. Each modulation source will do that and that way the audio thread doesn't have to make these calculations, it already has the final delta for the modulation destination (e.g. pitch, VCA, VCF cutoff, VCF resonance,...). The advantage of this array approach is we won't have to sort events and if we only have a small amount of modulation destinations we could even better create a two dimensional array (instead of linked lists), where the first index of the array is the sample point in the current audio fragment and the second index refers to the modulation destination, so if an envelope generator wants to alter the pitch it would just do this: fragment_events[sample_point][MOD_DST_PITCH] += egspitchdelta; I would prefer the two dimensional approach, as we don't have that much mod. destinations, do we? What do you guys think? CU Christian |