#defaults=no #patchname=no 0.0) { if (r <= cp) { // If delta is to be taken from value's min/max range... if (dt == DELTA_FROM_RANGE) { // Calculate the lo/hi values using the change bias if (cb > 0.0) { // Positive bias lo = (vmin - v) - ((vmin - v) * cb); hi = vmax - v; } else { // Negative bias lo = vmin - v; hi = (vmax - v) + ((vmax - v) * cb); } // Else the delta is based on lo/hi percentages } else { // Calculate the lo/hi values using the change bias if (cb > 0.0) { // Positive bias lo = -1.0 + cb; hi = 1.0; } else { // Negative bias lo = -1.0; hi = 1.0 + cb; } } // Generate a random scaled change amount r = rand(lo, hi) * sc; // If the change amount should be rounded to a multiple if (cm > 0.0) { if (r < 0.0) { h = -0.5; } else { h = 0.5; } // Scale by cm, round, and type cast to int yi = ((r / cm) + h); // Type cast back to float yf = yi; // Unscale back by cm r = yf * cm; } // If delta is from value's min/max range if (dt == DELTA_FROM_RANGE) { // Add change amount to v x = v + r; // Else delta is a percentage of current value } else { // Add change amount percentage of current value x = v + (v * r); } // If the final result should be rounded to a multiple if (fm > 0.0) { if (x < 0.0) { h = -0.5; } else { h = 0.5; } // Scale by fm, round, and type cast to int yi = ((x / fm) + h); // Type cast back to float yf = yi; // Unscale back by fm x = yf * fm; } // Although Zebra will attempt to do limits, sometimes it gets wonky, so do it here too if (x < vmin) { x = vmin; } if (x > vmax) { x = vmax; } } } return x; } // Default scaling float s = 1.0; // General purpose counting int i; for ( i = 1; i <= 4; i++ ) { if (Filter[i].active) { Filter[i].Type = delta(Filter[i].Type, Filter[i].Type.min, Filter[i].Type.max, DELTA_FROM_RANGE, 0.05, 0.0, s, 0.0, 0.0); Filter[i].Cutoff = delta(Filter[i].Cutoff, Filter[i].Cutoff.min, Filter[i].Cutoff.max, DELTA_FROM_RANGE, 0.75, 0.75, s, 0.0, 0.0); Filter[i].Resonance = delta(Filter[i].Resonance, Filter[i].Resonance.min, Filter[i].Resonance.max, DELTA_FROM_VALUE, 0.50, 0.75, s, 0.0, 0.0); Filter[i].ModDepth1 = delta(Filter[i].ModDepth1, Filter[i].ModDepth1.min, Filter[i].ModDepth1.max, DELTA_FROM_RANGE, 0.25, 0.5, s, 0.0, 0.0); Filter[i].ModDepth2 = delta(Filter[i].ModDepth2, Filter[i].ModDepth2.min, Filter[i].ModDepth2.max, DELTA_FROM_RANGE, 0.25, 0.5, s, 0.0, 0.0); Filter[i].KeyFollow = delta(Filter[i].KeyFollow, Filter[i].KeyFollow.min, Filter[i].KeyFollow.max, DELTA_FROM_RANGE, 0.25, 0.5, s, 0.0, 0.0); Filter[i].Drive = delta(Filter[i].Drive, Filter[i].Drive.min, Filter[i].Drive.max, DELTA_FROM_RANGE, 0.5, 0.5, s, 0.0, 0.0); } } for ( i = 1; i <= 2; i++ ) { if (XMF[i].active) { XMF[i].Type = delta(XMF[i].Type, XMF[i].Type.min, XMF[i].Type.max, DELTA_FROM_RANGE, 0.05, 0.0, s, 0.0, 0.0); XMF[i].Cutoff = delta(XMF[i].Cutoff, XMF[i].Cutoff.min, XMF[i].Cutoff.max, DELTA_FROM_RANGE, 0.75, 0.75, s, 0.0, 0.0); XMF[i].Resonance = delta(XMF[i].Resonance, XMF[i].Resonance.min, XMF[i].Resonance.max, DELTA_FROM_VALUE, 0.50, 0.75, s, 0.0, 0.0); XMF[i].KeyFollow = delta(XMF[i].KeyFollow, XMF[i].KeyFollow.min, XMF[i].KeyFollow.max, DELTA_FROM_RANGE, 0.25, 0.5, s, 0.0, 0.0); XMF[i].Overload = delta(XMF[i].Overload, XMF[i].Overload.min, XMF[i].Overload.max, DELTA_FROM_RANGE, 0.5, 0.5, s, 0.0, 0.0); XMF[i].XFMmod = delta(XMF[i].XFMmod, XMF[i].XFMmod.min, XMF[i].XFMmod.max, DELTA_FROM_RANGE, 0.25, 0.5, s, 0.0, 0.0); XMF[i].Bias = delta(XMF[i].Bias, XMF[i].Bias.min, XMF[i].Bias.max, DELTA_FROM_RANGE, 0.25, -0.5, s, 0.0, 0.0); XMF[i].Click = delta(XMF[i].Click, XMF[i].Click.min, XMF[i].Click.max, DELTA_FROM_RANGE, 0.25, 0.5, s, 0.0, 0.0); } } ?>