// ----
// ---- file   : osc_additive16_v1.cpp
// ---- author : bsp
// ---- legal  : Distributed under terms of the MIT license (https://opensource.org/licenses/MIT)
// ----
// ----          Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
// ----          associated documentation files (the "Software"), to deal in the Software without restriction, including
// ----          without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// ----          copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
// ----          the following conditions:
// ----
// ----          The above copyright notice and this permission notice shall be included in all copies or substantial
// ----          portions of the Software.
// ----
// ----          THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
// ----          NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// ----          IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// ----          WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// ----          SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ----
// ---- info   : auto-generated by "Cycle"
// ----           $ g++ -Wall -Wno-unused-function -Wno-unused-variable -I../../tksampler -c osc_additive16_v1.cpp -o osc_additive16_v1.o
// ---- created: 08Jan2024 19:24:54
// ----
// ----
// ----

#include <plugin.h>

#include <stdlib.h>
#include <math.h>
#include <string.h>




#define PARAM_CENTER             0
#define PARAM_WIDTH              1
#define PARAM_CURVE_AMT          2
#define PARAM_SLOPE_B            3
#define PARAM_SLOPE_T            4
#define PARAM_FREQ_SCL           5
#define PARAM_COLOR              6
#define PARAM_AMP                7
#define NUM_PARAMS               8
static const char *loc_param_names[NUM_PARAMS] = {
   "center",                  // 0: CENTER
   "width",                   // 1: WIDTH
   "curve_amt",               // 2: CURVE_AMT
   "slope_b",                 // 3: SLOPE_B
   "slope_t",                 // 4: SLOPE_T
   "freq_scl",                // 5: FREQ_SCL
   "color",                   // 6: COLOR
   "amp",                     // 7: AMP

};
static float loc_param_resets[NUM_PARAMS] = {
   0.0f,                      // 0: CENTER
   0.125f,                    // 1: WIDTH
   1.0f,                      // 2: CURVE_AMT
   0.0f,                      // 3: SLOPE_B
   0.5f,                      // 4: SLOPE_T
   0.5f,                      // 5: FREQ_SCL
   0.5f,                      // 6: COLOR
   0.5f,                      // 7: AMP

};

#define MOD_CENTER               0
#define MOD_WIDTH                1
#define MOD_CURVE_AMT            2
#define MOD_SLOPE_B              3
#define MOD_SLOPE_T              4
#define MOD_FREQ_SCL             5
#define MOD_COLOR                6
#define NUM_MODS                 7
static const char *loc_mod_names[NUM_MODS] = {
   "center",               // 0: CENTER
   "width",                // 1: WIDTH
   "curve_amt",            // 2: CURVE_AMT
   "slope_b",              // 3: SLOPE_B
   "slope_t",              // 4: SLOPE_T
   "freq_scl",             // 5: FREQ_SCL
   "color",                // 6: COLOR

};

typedef struct osc_additive16_v1_info_s {
   st_plugin_info_t base;
} osc_additive16_v1_info_t;

typedef struct osc_additive16_v1_shared_s {
   st_plugin_shared_t base;
   float params[NUM_PARAMS];

} osc_additive16_v1_shared_t;

typedef struct osc_additive16_v1_voice_s {
   st_plugin_voice_t base;
   float             sample_rate;
   float             note_speed_fixed;
   float             note_speed_cur;
   float             note_speed_inc;
   float             note_cur;
   float             note_inc;
   float             mods[NUM_MODS];
   float mod_center_cur;
   float mod_center_inc;
   float mod_width_cur;
   float mod_width_inc;
   float mod_curve_amt_cur;
   float mod_curve_amt_inc;
   float mod_slope_b_cur;
   float mod_slope_b_inc;
   float mod_slope_t_cur;
   float mod_slope_t_inc;
   float mod_freq_scl_cur;
   float mod_freq_scl_inc;
   float mod_color_cur;
   float mod_color_inc;

   float tmp1;
   float tmp2;
   short tmp3;
   short tmp4;
   float tmp5;
   float tmp6;
   float tmp7;
   float tmp8_sin_phase;
   float tmp9_sin_phase;
   float tmp10_sin_phase;
   float tmp11_sin_phase;
   float tmp12_sin_phase;
   float tmp13_sin_phase;
   float tmp14_sin_phase;
   float tmp15_sin_phase;
   float tmp16_sin_phase;
   float tmp17_sin_phase;
   float tmp18_sin_phase;
   float tmp19_sin_phase;
   float tmp20_sin_phase;
   float tmp21_sin_phase;
   float tmp22_sin_phase;
   float tmp23_sin_phase;
   float var_x;
   float var_v_freq;
   float var_v_index;
   float var_v_index_slope;
   float var_v_slope;
   float var_v_out;
   float var_v_slope_t;
   float var_v_freq_add;
   float var_v_color;
   float var_v_amp;

} osc_additive16_v1_voice_t;

#define loop(X)  for(unsigned int i = 0u; i < (X); i++)
#define clamp(a,b,c) (((a)<(b))?(b):(((a)>(c))?(c):(a)))

static inline float mathLerpf(float _a, float _b, float _t) { return _a + (_b - _a) * _t; }
static inline float mathClampf(float a, float b, float c) { return (((a)<(b))?(b):(((a)>(c))?(c):(a))); }
static inline float mathMinf(float a, float b) { return (a<b)?a:b; }
static inline float mathMaxf(float a, float b) { return (a>b)?a:b; }
static inline float mathAbsMaxf(float _x, float _y) { return ( ( (_x<0.0f)?-_x:_x)>((_y<0.0f)?-_y:_y)?_x:_y ); }
static inline float mathAbsMinf(float _x, float _y) { return ( ((_x<0.0f)?-_x:_x)<((_y<0.0f)?-_y:_y)?_x:_y ); }
static inline float frac(float _x) { return _x - ((int)_x); }

static inline float winLinear(const float *_s, float _index) {
   int idx = (int)_index;
   float r = _index - (float)idx;
   return mathLerpf(_s[idx], _s[idx+1], r);
}

static float ffrac_s(float _f) { int i; if(_f >= 0.0f) { i = (int)_f; return _f - (float)i; } else { i = (int)-_f; return 1.0f - (-_f - (float)i); } }
static short curve_0[128] = {
-3, -2, 0, 3, 9, 16, 24, 34, 45, 58, 73, 89, 107, 127, 149, 172, 198, 225, 255, 286, 319, 354, 391, 431, 472, 515, 560, 607, 656, 706, 758, 811, 
866, 922, 978, 1036, 1093, 1151, 1209, 1267, 1324, 1380, 1435, 1488, 1540, 1589, 1637, 1682, 1725, 1765, 1802, 1836, 1868, 1896, 1922, 1945, 1965, 1981, 1995, 2006, 2015, 2020, 2023, 2024, 
2022, 2017, 2010, 2001, 1989, 1974, 1957, 1937, 1914, 1889, 1861, 1831, 1798, 1762, 1724, 1684, 1641, 1596, 1549, 1501, 1451, 1399, 1347, 1293, 1239, 1184, 1128, 1073, 1018, 963, 909, 856, 
803, 752, 701, 653, 605, 559, 515, 473, 432, 393, 356, 321, 288, 256, 226, 199, 173, 149, 127, 106, 87, 70, 55, 41, 29, 19, 10, 3, -2, -6, -9, -11, 
};
static short curve_1[128] = {
0, 34, 76, 127, 190, 266, 358, 471, 607, 764, 931, 1088, 1221, 1324, 1402, 1459, 1500, 1528, 1546, 1552, 1548, 1533, 1508, 1473, 1429, 1378, 1320, 1256, 1189, 1118, 1046, 973, 
900, 830, 762, 697, 636, 580, 530, 485, 446, 413, 387, 367, 353, 347, 349, 356, 368, 384, 403, 424, 448, 474, 501, 531, 561, 593, 625, 659, 694, 729, 765, 801, 
838, 876, 914, 952, 990, 1028, 1067, 1106, 1145, 1183, 1222, 1260, 1299, 1337, 1375, 1412, 1449, 1485, 1521, 1557, 1591, 1625, 1657, 1689, 1720, 1749, 1776, 1802, 1826, 1847, 1866, 1882, 
1894, 1901, 1903, 1898, 1884, 1858, 1823, 1769, 1678, 1443, 1038, 859, 742, 652, 579, 516, 461, 412, 367, 326, 289, 254, 221, 191, 162, 135, 110, 85, 62, 40, 20, 0, 
};
static short curve_2[64] = {
204, 208, 219, 235, 258, 286, 318, 355, 395, 439, 486, 535, 586, 638, 691, 745, 797, 848, 895, 932, 920, 861, 762, 631, 475, 297, 102, -105, -323, -546, -768, -981, 
-1173, -1312, -1298, -1143, -952, -758, -573, -401, -244, -103, 22, 133, 230, 312, 382, 439, 483, 517, 539, 551, 552, 544, 526, 499, 464, 421, 369, 310, 243, 169, 87, 0, 
};

#define USE_CYCLE_SINE_TBL  defined
static float cycle_sine_tbl_f[16384];

static float mathLogf(const float _x) {
   union {
      float f;
      unsigned int u;
   } bx;
   bx.f = _x;
   const unsigned int ex = bx.u >> 23;
   const signed int t = (signed int)ex - (signed int)127;
   const unsigned int s = (t < 0) ? (-t) : t;
   bx.u = 1065353216u | (bx.u & 8388607u);
   return
      -1.7417939f + (2.8212026f + (-1.4699568f + (0.44717955f - 0.056570851f * bx.f)*bx.f)*bx.f)*bx.f
      + 0.6931471806f * t;
}

static float mathPowerf(float _x, float _y) {
   float r;
   if(_y != 0.0f)
   {
      if(_x < 0.0f)
      {
         r = (float)( -expf(_y*mathLogf(-_x)) );
      }
      else if(_x > 0.0f)
      {
         r = (float)( expf(_y*mathLogf(_x)) );
      }
      else
      {
         r = 0.0f;
      }
   }
   else
   {
      r = 1.0f;
   }
   return Dstplugin_fix_denorm_32(r);
}

static float mathLogLinExpf(float _f, float _c) {
   // c: <0: log
   //     0: lin
   //    >0: exp
   stplugin_fi_t uSign;
   uSign.f = _f;
   stplugin_fi_t u;
   u.f = _f;
   u.u &= 0x7fffFFFFu;
   u.f = powf(u.f, powf(2.0f, _c));
   u.u |= uSign.u & 0x80000000u;
   return u.f;
}

static float loc_bipolar_to_scale(const float _t, const float _div, const float _mul) {
   // t (-1..1) => /_div .. *_mul
   
   float s;

   if(_t < 0.0f)
   {
      s = (1.0f / _div);
      s = 1.0f + (s - 1.0f) * -_t;
      if(s < 0.0f)
         s = 0.0f;
   }
   else
   {
      s = _mul;
      s = 1.0f + (s - 1.0f) * _t;
   }
   
   return s;
}

static void loc_prepare(st_plugin_voice_t *_voice);

void loc_prepare(st_plugin_voice_t *_voice) {
   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);
   ST_PLUGIN_VOICE_SHARED_CAST(osc_additive16_v1_shared_t);

   float out = 0.0f;
   // -------- lane "prepare" modIdx=0
   
   // -- mod="$m_slope_t" dstVar=out
   out = voice->mod_slope_t_cur;
   
   // -- mod="fma" dstVar=out
   out = (out * 2.0f) + -1.0f;
   
   // -- mod="bts" dstVar=out
   out = loc_bipolar_to_scale(out, 4.0f, 4.0f);
   
   // -- mod="0.0625" dstVar=out
   voice->tmp1/*seq*/ = 0.0625f;
   out *= voice->tmp1/*seq*/;
   
   // -- mod="sto v_slope_t" dstVar=out
   voice->var_v_slope_t = out;
   
   // -- mod="$m_freq_scl" dstVar=out
   out = voice->mod_freq_scl_cur;
   
   // -- mod="fma" dstVar=out
   out = (out * 2.0f) + -1.0f;
   
   // -- mod="bts" dstVar=out
   out = loc_bipolar_to_scale(out, 8.0f, 8.0f);
   
   // -- mod="sto v_freq_add" dstVar=out
   voice->var_v_freq_add = out;
   
   // -- mod="$m_color" dstVar=out
   out = voice->mod_color_cur;
   
   // -- mod="fma" dstVar=out
   out = (out * 8.0f) + -4.0f;
   
   // -- mod="sto v_color" dstVar=out
   voice->var_v_color = out;
   
   // -- mod="$p_amp" dstVar=out
   out = shared->params[PARAM_AMP];
   
   // -- mod="fma" dstVar=out
   out = (out * 2.0f) + -1.0f;
   
   // -- mod="bts" dstVar=out
   out = loc_bipolar_to_scale(out, 4.0f, 4.0f);
   
   // -- mod="sto v_amp" dstVar=out
   voice->var_v_amp = out;
} /* end prepare */

static unsigned int loc_copy_chars(char *_d, const unsigned int _dSize, const char *_s) {
   unsigned int r = 0u;
   if(NULL != _d)
   {
      // Write min(dSize,len(s)) characters to 'd'
      char *d = _d;
      if(NULL != _s)
      {
         const char *s = _s;
         for(;;)
         {
            if(r < _dSize)
            {
               char c = s[r++];
               *d++ = c;
               if(0 == c)
                  break;
            }
            else
            {
               if(r > 0u)
                  d[-1] = 0;  // force ASCIIZ
               break;
            }
         }
      }
      else
      {
         if(_dSize > 0u)
         {
            _d[0] = 0;
            r = 1u;
         }
      }
   }
   else
   {
      // Return total length of source string
      if(NULL != _s)
      {
         const char *s = _s;
         for(;;)
         {
            char c = s[r++];
            if(0 == c)
               break;
         }
      }
   }
   return r;
}

static unsigned int loc_copy_floats(float              *_d,
                                    const unsigned int  _dSize,
                                    const float        *_s,
                                    const unsigned int  _sNum
                                    ) {
   unsigned int r = 0u;
   if(NULL != _d)
   {
      // Write min(dSize,sNum) characters to 'd'
      if(NULL != _s)
      {
         unsigned int num = (_sNum > _dSize) ? _dSize : _sNum;
         memcpy((void*)_d, (const void*)_s, num * sizeof(float));
         r = num;
      }
   }
   else
   {
      // Query total number of presets
      r = _sNum;
   }
   return r;
}

static const char *ST_PLUGIN_API loc_get_param_name(st_plugin_info_t *_info,
                                                    unsigned int      _paramIdx
                                                    ) {
   (void)_info;
   return loc_param_names[_paramIdx];
}

static const char *ST_PLUGIN_API loc_get_param_group_name(st_plugin_info_t *_info,
                                                          unsigned int      _paramGroupIdx
                                                          ) {
   (void)_info;
   const char *r = NULL;
   return r;
}

static unsigned int ST_PLUGIN_API loc_get_param_group_idx(st_plugin_info_t *_info,
                                                          unsigned int      _paramIdx
                                                          ) {
   (void)_info;
   unsigned int r = ~0u;
   return r;
}

static float ST_PLUGIN_API loc_get_param_reset(st_plugin_info_t *_info,
                                               unsigned int      _paramIdx
                                               ) {
   (void)_info;
   return loc_param_resets[_paramIdx];
}

static float ST_PLUGIN_API loc_get_param_value(st_plugin_shared_t *_shared,
                                               unsigned int        _paramIdx
                                               ) {
   ST_PLUGIN_SHARED_CAST(osc_additive16_v1_shared_t);
   return shared->params[_paramIdx];
}

static void ST_PLUGIN_API loc_set_param_value(st_plugin_shared_t *_shared,
                                              unsigned int        _paramIdx,
                                              float               _value
                                              ) {
   ST_PLUGIN_SHARED_CAST(osc_additive16_v1_shared_t);
   shared->params[_paramIdx] = _value;
}

static unsigned int ST_PLUGIN_API loc_query_dynamic_param_preset_values(st_plugin_shared_t *_shared,
                                                                        const unsigned int  _paramIdx,
                                                                        float              *_retValues,
                                                                        const unsigned int  _retValuesSize
                                                                        ) {
   ST_PLUGIN_SHARED_CAST(osc_additive16_v1_shared_t);
   unsigned int r = 0u;
   return r;
}

static unsigned int ST_PLUGIN_API loc_query_dynamic_param_preset_name(st_plugin_shared_t *_shared,
                                                                      const unsigned int  _paramIdx,
                                                                      const unsigned int  _presetIdx,
                                                                      char               *_retBuf,
                                                                      const unsigned int  _retBufSize
                                                                      ) {
   ST_PLUGIN_SHARED_CAST(osc_additive16_v1_shared_t);
   unsigned int r = 0u;
   return r;
}

static unsigned int ST_PLUGIN_API loc_get_array_param_size(st_plugin_info_t   *_info,
                                                           const unsigned int  _paramIdx
                                                           ) {
   unsigned int r = 0u;
   switch(_paramIdx)
   {
      default:
         break;
   }
   return r;
}

static unsigned int ST_PLUGIN_API loc_get_array_param_num_variations(st_plugin_info_t   *_info,
                                                                     const unsigned int  _paramIdx
                                                                     ) {
   unsigned int r = 0u;
   switch(_paramIdx)
   {
      default:
         break;
   }
   return r;
}

static float * ST_PLUGIN_API loc_get_array_param_variation_ptr(st_plugin_shared_t *_shared,
                                                               const unsigned int  _paramIdx,
                                                               const unsigned int  _variationIdx
                                                               ) {
   ST_PLUGIN_SHARED_CAST(osc_additive16_v1_shared_t);
   float *r = NULL;
   switch(_paramIdx)
   {
      default:
         break;
   }
   return r;
}

static void ST_PLUGIN_API loc_set_array_param_edit_variation_idx(st_plugin_shared_t *_shared,
                                                                 const unsigned int  _paramIdx,
                                                                 const int           _variationIdx
                                                                 ) {
   ST_PLUGIN_SHARED_CAST(osc_additive16_v1_shared_t);
   switch(_paramIdx)
   {
      default:
         break;
   }
}

static int ST_PLUGIN_API loc_get_array_param_element_value_range(st_plugin_info_t   *_info,
                                                                 const unsigned int  _paramIdx,
                                                                 const unsigned int  _elementIdx,
                                                                 float              *_retStorageMin,
                                                                 float              *_retStorageMax,
                                                                 float              *_retDisplayMin,
                                                                 float              *_retDisplayMax,
                                                                 unsigned int       *_retDisplayPrecision
                                                                 ) {
   (void)_elementIdx;
   switch(_paramIdx)
   {
      default:
         break;
   }
   return 0;
}

static const char *ST_PLUGIN_API loc_get_mod_name(st_plugin_info_t *_info,
                                                  unsigned int      _modIdx
                                                  ) {
   (void)_info;
   return loc_mod_names[_modIdx];
}

static void ST_PLUGIN_API loc_set_sample_rate(st_plugin_voice_t *_voice,
                                              float              _sampleRate
                                              ) {
   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);
   voice->sample_rate = _sampleRate;
}

static void ST_PLUGIN_API loc_note_on(st_plugin_voice_t  *_voice,
                                      int                 _bGlide,
                                      unsigned char       _note,
                                      float               _vel
                                      ) {
   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);
   ST_PLUGIN_VOICE_SHARED_CAST(osc_additive16_v1_shared_t);
   (void)_bGlide;
   (void)_note;
   (void)_vel;
   if(!_bGlide)
   {
      memset((void*)voice->mods, 0, sizeof(voice->mods));
#ifdef OVERSAMPLE_FACTOR
      voice->note_speed_fixed = (0.5f / (voice->sample_rate * OVERSAMPLE_FACTOR));
#else
      voice->note_speed_fixed = (0.5f / voice->sample_rate);
#endif // OVERSAMPLE_FACTOR


      voice->tmp8_sin_phase = 0.0f;
      voice->tmp9_sin_phase = 0.0f;
      voice->tmp10_sin_phase = 0.0f;
      voice->tmp11_sin_phase = 0.0f;
      voice->tmp12_sin_phase = 0.0f;
      voice->tmp13_sin_phase = 0.0f;
      voice->tmp14_sin_phase = 0.0f;
      voice->tmp15_sin_phase = 0.0f;
      voice->tmp16_sin_phase = 0.0f;
      voice->tmp17_sin_phase = 0.0f;
      voice->tmp18_sin_phase = 0.0f;
      voice->tmp19_sin_phase = 0.0f;
      voice->tmp20_sin_phase = 0.0f;
      voice->tmp21_sin_phase = 0.0f;
      voice->tmp22_sin_phase = 0.0f;
      voice->tmp23_sin_phase = 0.0f;

      voice->var_x = 0.0f;
      voice->var_v_freq = 0.0f;
      voice->var_v_index = 0.0f;
      voice->var_v_index_slope = 0.0f;
      voice->var_v_slope = 0.0f;
      voice->var_v_out = 0.0f;
      voice->var_v_slope_t = 0.0f;
      voice->var_v_freq_add = 0.0f;
      voice->var_v_color = 0.0f;
      voice->var_v_amp = 0.0f;



   }
}

static void ST_PLUGIN_API loc_set_mod_value(st_plugin_voice_t *_voice,
                                            unsigned int       _modIdx,
                                            float              _value,
                                            unsigned           _frameOffset
                                            ) {
   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);
   (void)_frameOffset;
   voice->mods[_modIdx] = _value;
}

static void ST_PLUGIN_API loc_prepare_block(st_plugin_voice_t *_voice,
                                            unsigned int       _numFrames,
                                            float              _freqHz,
                                            float              _note,
                                            float              _vol,
                                            float              _pan
                                            ) {
   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);
   ST_PLUGIN_VOICE_SHARED_CAST(osc_additive16_v1_shared_t);
   (void)_note;
   (void)_vol;
   (void)_pan;

#ifdef OVERSAMPLE_FACTOR
   float noteSpeed = _freqHz / (voice->sample_rate * OVERSAMPLE_FACTOR);
#else
   float noteSpeed = _freqHz / voice->sample_rate;
#endif // OVERSAMPLE_FACTOR

   float modcenter       = shared->params[PARAM_CENTER      ]                       + voice->mods[MOD_CENTER       ];
   float modwidth        = shared->params[PARAM_WIDTH       ] * 8.0f                + voice->mods[MOD_WIDTH        ];
   float modcurve_amt    = shared->params[PARAM_CURVE_AMT   ]                       + voice->mods[MOD_CURVE_AMT    ];
   float modslope_b      = shared->params[PARAM_SLOPE_B     ]                       + voice->mods[MOD_SLOPE_B      ];
   float modslope_t      = shared->params[PARAM_SLOPE_T     ]                       + voice->mods[MOD_SLOPE_T      ];
   float modfreq_scl     = shared->params[PARAM_FREQ_SCL    ]                       + voice->mods[MOD_FREQ_SCL     ];
   float modcolor        = shared->params[PARAM_COLOR       ]                       + voice->mods[MOD_COLOR        ];

   if(_numFrames > 0u)
   {
      // lerp
      float recBlockSize = (1.0f / _numFrames);
      voice->note_speed_inc = (noteSpeed - voice->note_speed_cur) * recBlockSize;
      voice->note_inc       = (_note - voice->note_cur) * recBlockSize;
      voice->mod_center_inc       = (modcenter          - voice->mod_center_cur        ) * recBlockSize;
      voice->mod_width_inc        = (modwidth           - voice->mod_width_cur         ) * recBlockSize;
      voice->mod_curve_amt_inc    = (modcurve_amt       - voice->mod_curve_amt_cur     ) * recBlockSize;
      voice->mod_slope_b_inc      = (modslope_b         - voice->mod_slope_b_cur       ) * recBlockSize;
      voice->mod_slope_t_inc      = (modslope_t         - voice->mod_slope_t_cur       ) * recBlockSize;
      voice->mod_freq_scl_inc     = (modfreq_scl        - voice->mod_freq_scl_cur      ) * recBlockSize;
      voice->mod_color_inc        = (modcolor           - voice->mod_color_cur         ) * recBlockSize;

      loc_prepare(&voice->base);
   }
   else
   {
      // initial params/modulation (first block, not rendered)
      voice->note_speed_cur = noteSpeed;
      voice->note_speed_inc = 0.0f;
      voice->note_cur       = _note;
      voice->note_inc       = 0.0f;
      voice->mod_center_cur       = modcenter;
      voice->mod_center_inc       = 0.0f;
      voice->mod_width_cur        = modwidth;
      voice->mod_width_inc        = 0.0f;
      voice->mod_curve_amt_cur    = modcurve_amt;
      voice->mod_curve_amt_inc    = 0.0f;
      voice->mod_slope_b_cur      = modslope_b;
      voice->mod_slope_b_inc      = 0.0f;
      voice->mod_slope_t_cur      = modslope_t;
      voice->mod_slope_t_inc      = 0.0f;
      voice->mod_freq_scl_cur     = modfreq_scl;
      voice->mod_freq_scl_inc     = 0.0f;
      voice->mod_color_cur        = modcolor;
      voice->mod_color_inc        = 0.0f;

      loc_prepare(&voice->base);
   }

   // printf("xxx note_cur=%f\n", voice->note_cur);
}

static void ST_PLUGIN_API loc_process_replace(st_plugin_voice_t  *_voice,
                                              int                 _bMonoIn,
                                              const float        *_samplesIn,
                                              float              *_samplesOut,
                                              unsigned int        _numFrames
                                              ) {
   (void)_bMonoIn;
   (void)_samplesIn;

   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);
   ST_PLUGIN_VOICE_SHARED_CAST(osc_additive16_v1_shared_t);

   // Mono output (replicate left to right channel)
   unsigned int j = 0u;
   unsigned int jStep = _bMonoIn ? 1u : 2u;
   unsigned int k = 0u;
   for(unsigned int i = 0u; i < _numFrames; i++)
   {
      float out = _samplesIn[j];
      j += jStep;
#ifdef OVERSAMPLE_FACTOR
      float outOS = 0.0f;
#endif // OVERSAMPLE_FACTOR

#ifdef OVERSAMPLE_FACTOR
      for(unsigned int osi = 0u; osi < OVERSAMPLE_FACTOR; osi++)
#endif // OVERSAMPLE_FACTOR
      {
      float tmp_f;
      float tmp2_f;
      
      // ========
      // ======== lane "out" modIdx=0
      // ========
      
      // -- mod="set v_freq" dstVar=out
      voice->var_v_freq = 1;
      
      // -- mod="0.5" dstVar=out
      out = 0.5f;
      
      // -- mod="$m_center" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_center_cur;
      out -= voice->tmp2/*seq*/;
      
      // -- mod="sto v_index" dstVar=out
      voice->var_v_index = out;
      
      // -- mod="sto v_index_slope" dstVar=out
      voice->var_v_index_slope = out;
      
      // -- mod="set v_out" dstVar=out
      voice->var_v_out = 0;
      
      // -- mod="rep" dstVar=out
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp8_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp8_sin_phase = ffrac_s(voice->tmp8_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp9_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp9_sin_phase = ffrac_s(voice->tmp9_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp10_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp10_sin_phase = ffrac_s(voice->tmp10_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp11_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp11_sin_phase = ffrac_s(voice->tmp11_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp12_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp12_sin_phase = ffrac_s(voice->tmp12_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp13_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp13_sin_phase = ffrac_s(voice->tmp13_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp14_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp14_sin_phase = ffrac_s(voice->tmp14_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp15_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp15_sin_phase = ffrac_s(voice->tmp15_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp16_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp16_sin_phase = ffrac_s(voice->tmp16_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp17_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp17_sin_phase = ffrac_s(voice->tmp17_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp18_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp18_sin_phase = ffrac_s(voice->tmp18_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp19_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp19_sin_phase = ffrac_s(voice->tmp19_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp20_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp20_sin_phase = ffrac_s(voice->tmp20_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp21_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp21_sin_phase = ffrac_s(voice->tmp21_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp22_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp22_sin_phase = ffrac_s(voice->tmp22_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_0[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_0[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_index_slope" dstVar=out
      out = voice->var_v_index_slope;
      
      // -- mod="lut" dstVar=out
      voice->tmp2/*lut_f*/ = (out * 128);
      voice->tmp5/*lut_frac*/ = voice->tmp2/*lut_f*/ - (int)voice->tmp2/*lut_f*/;
      voice->tmp3/*lut_idx_a*/ = (int)voice->tmp2/*lut_f*/;
      if(voice->tmp3/*lut_idx_a*/ < 0)
      {
         voice->tmp3/*lut_idx_a*/ = 0;
         voice->tmp4/*lut_idx_b*/ = 0;
         voice->tmp5/*lut_frac*/ = 0.0f;
      }
      else if(voice->tmp3/*lut_idx_a*/ > 127)
      {
         voice->tmp3/*lut_idx_a*/ = 127;
         voice->tmp4/*lut_idx_b*/ = 127;
      }
      else
      {
         voice->tmp4/*lut_idx_b*/ = voice->tmp3/*lut_idx_a*/ + 1;
         if(voice->tmp4/*lut_idx_b*/ > 127)
            voice->tmp4/*lut_idx_b*/ = 127;
      }
      voice->tmp6/*lut_a*/ = curve_1[(unsigned int)voice->tmp3/*lut_idx_a*/] * (1.0f / 2048);
      voice->tmp7/*lut_b*/ = curve_1[(unsigned int)voice->tmp4/*lut_idx_b*/] * (1.0f / 2048);
      out = voice->tmp6/*lut_a*/ + (voice->tmp7/*lut_b*/ - voice->tmp6/*lut_a*/) * voice->tmp5/*lut_frac*/;
      
      // -- mod="$m_slope_b" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_slope_b_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="$v_slope" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_slope;
      
      // -- mod="1" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 1.0f;
      
      // -- mod="$m_slope_b" dstVar=voice->tmp5/*seq*/
      voice->tmp6/*seq*/ = voice->mod_slope_b_cur;
      voice->tmp5/*seq*/ -= voice->tmp6/*seq*/;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="pow" dstVar=out
      
      // ---- mod="pow" input "exp" seq 1/1
      
      // -- mod="$m_width" dstVar=voice->tmp2/*exp*/
      voice->tmp2/*exp*/ = voice->mod_width_cur;
      out = mathPowerf(out, voice->tmp2/*exp*/);
      
      // -- mod="$m_curve_amt" dstVar=out
      voice->tmp2/*seq*/ = voice->mod_curve_amt_cur;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="1" dstVar=out
      voice->tmp2/*seq*/ = 1.0f;
      
      // -- mod="$m_curve_amt" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->mod_curve_amt_cur;
      voice->tmp2/*seq*/ -= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_slope" dstVar=out
      voice->var_v_slope = out;
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="sin" dstVar=out
      
      // ---- mod="sin" input "freq" seq 1/1
      
      // -- mod="$v_freq" dstVar=voice->tmp6/*freq*/
      voice->tmp6/*freq*/ = voice->var_v_freq;
      voice->tmp5/*sin_speed*/ = voice->note_speed_cur * voice->tmp6/*freq*/;
      voice->tmp6/*sin_tmp*/ = (voice->tmp23_sin_phase);
      voice->tmp6/*sin_tmp*/ = ffrac_s(voice->tmp6/*sin_tmp*/);
      voice->tmp2/*seq*/ = cycle_sine_tbl_f[(unsigned short)(16384 * voice->tmp6/*sin_tmp*/)&16383u];
      voice->tmp23_sin_phase = ffrac_s(voice->tmp23_sin_phase + voice->tmp5/*sin_speed*/);
      
      // -- mod="lle" dstVar=voice->tmp2/*seq*/
      
      // ---- mod="lle" input "c" seq 1/1
      
      // -- mod="$v_color" dstVar=voice->tmp5/*c*/
      voice->tmp5/*c*/ = voice->var_v_color;
      voice->tmp2/*seq*/ = mathLogLinExpf(voice->tmp2/*seq*/, voice->tmp5/*c*/);
      
      // -- mod="0.0625" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = 0.0625f;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      
      // -- mod="$v_slope" dstVar=voice->tmp2/*seq*/
      voice->tmp5/*seq*/ = voice->var_v_slope;
      voice->tmp2/*seq*/ *= voice->tmp5/*seq*/;
      out += voice->tmp2/*seq*/;
      
      // -- mod="sto v_out" dstVar=out
      voice->var_v_out = out;
      
      // -- mod="inc v_freq" dstVar=out
      
      // ---- mod="inc v_freq" input "delta" seq 1/1
      
      // -- mod="$v_freq_add" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_freq_add;
      voice->var_v_freq += voice->tmp2/*delta*/;
      
      // -- mod="inc v_index" dstVar=out
      voice->var_v_index += 0.0625;
      
      // -- mod="inc v_index_slope" dstVar=out
      
      // ---- mod="inc v_index_slope" input "delta" seq 1/1
      
      // -- mod="$v_slope_t" dstVar=voice->tmp2/*delta*/
      voice->tmp2/*delta*/ = voice->var_v_slope_t;
      voice->var_v_index_slope += voice->tmp2/*delta*/;
      
      // ========
      // ======== lane "out" modIdx=1
      // ========
      
      // -- mod="$v_out" dstVar=out
      out = voice->var_v_out;
      
      // -- mod="$v_amp" dstVar=out
      voice->tmp2/*seq*/ = voice->var_v_amp;
      out *= voice->tmp2/*seq*/;
      
      // -- mod="clp" dstVar=out
      if(out > 0.999f) out = 0.999f;
      else if(out < -0.999f) out = -0.999f;

      /* end calc */

#ifdef OVERSAMPLE_FACTOR
         outOS += out;
#endif // OVERSAMPLE_FACTOR
      }
#ifdef OVERSAMPLE_FACTOR
      // Apply lowpass filter before downsampling
      //   (note) normalized Fc = F/Fs = 0.442947 / sqrt(oversample_factor² - 1)
      out = outOS * (1.0f / OVERSAMPLE_FACTOR);
#endif // OVERSAMPLE_FACTOR
      _samplesOut[k]      = out;
      _samplesOut[k + 1u] = out;

      // Next frame
      k += 2u;
      voice->note_speed_cur += voice->note_speed_inc;
      voice->mod_center_cur        += voice->mod_center_inc;
      voice->mod_width_cur         += voice->mod_width_inc;
      voice->mod_curve_amt_cur     += voice->mod_curve_amt_inc;
      voice->mod_slope_b_cur       += voice->mod_slope_b_inc;
      voice->mod_slope_t_cur       += voice->mod_slope_t_inc;
      voice->mod_freq_scl_cur      += voice->mod_freq_scl_inc;
      voice->mod_color_cur         += voice->mod_color_inc;
   } /* loop numFrames */
}

static st_plugin_shared_t *ST_PLUGIN_API loc_shared_new(st_plugin_info_t *_info) {
   osc_additive16_v1_shared_t *ret = (osc_additive16_v1_shared_t *)malloc(sizeof(osc_additive16_v1_shared_t));
   if(NULL != ret)
   {
      memset((void*)ret, 0, sizeof(*ret));
      ret->base.info  = _info;
      memcpy((void*)ret->params, (void*)loc_param_resets, NUM_PARAMS * sizeof(float));
   }
   return &ret->base;
}

static void ST_PLUGIN_API loc_shared_delete(st_plugin_shared_t *_shared) {
   free((void*)_shared);
}

static st_plugin_voice_t *ST_PLUGIN_API loc_voice_new(st_plugin_info_t *_info, unsigned int _voiceIdx) {
   osc_additive16_v1_voice_t *voice = (osc_additive16_v1_voice_t *)malloc(sizeof(osc_additive16_v1_voice_t));
   if(NULL != voice)
   {
      memset((void*)voice, 0, sizeof(*voice));
      voice->base.info = _info;
   }
   return &voice->base;
}

static void ST_PLUGIN_API loc_voice_delete(st_plugin_voice_t *_voice) {
   ST_PLUGIN_VOICE_CAST(osc_additive16_v1_voice_t);

   free((void*)_voice);
}

static void ST_PLUGIN_API loc_plugin_exit(st_plugin_info_t *_info) {
   free((void*)_info);
}

#ifdef USE_CYCLE_SINE_TBL
static void loc_calc_sine_tbl(void) {
#define QCOS_BITS 16
#define QCOS_ONE  (1 << QCOS_BITS)
#define QCOS_MASK (QCOS_ONE - 1)
   // (note) same as in TSR "C" implementation
   float *qcos = cycle_sine_tbl_f + 4096; // quarter cos tbl

   // calc quarter cos tbl
   int k = 0;
   for(int a = 0; a < (QCOS_ONE/4); a += (QCOS_ONE/16384)/*4*/)  // 4096 elements
   {
      int x = a - ((int)(QCOS_ONE * 0.25 + 0.5)) + ((a + ((int)(QCOS_ONE * 0.25 + 0.5)))&~QCOS_MASK);
      x = ((x * ((x<0?-x:x) - ((int)(QCOS_ONE * 0.5 + 0.5)))) >> QCOS_BITS) << 4;
      x += (((((int)(QCOS_ONE * 0.225 + 0.5)) * x) >> QCOS_BITS) * ((x<0?-x:x) - QCOS_ONE)) >> QCOS_BITS;
      qcos[k++] = x / float(QCOS_ONE);
   }

   // 0°..90° (rev qtbl)
   int j = 4096;
   k = 0;
   loop(4096)
      cycle_sine_tbl_f[k++] = qcos[--j];

   // 90..180° = cos tbl
   k += 4096;

   // 180°..360° (y-flip first half of tbl)
   j = 0;
   loop(8192)
      cycle_sine_tbl_f[k++] = -cycle_sine_tbl_f[j++];

#ifdef USE_CYCLE_SINE_TBL_I
   loop(16384)
      cycle_sine_tbl_i[i] = (short)(cycle_sine_tbl_f[i] * 2048.0f/*FX_ONE*/);
#endif // USE_CYCLE_SINE_TBL_I
}
#endif // USE_CYCLE_SINE_TBL

extern "C" {
st_plugin_info_t *osc_additive16_v1_init(void) {
   osc_additive16_v1_info_t *ret = (osc_additive16_v1_info_t *)malloc(sizeof(osc_additive16_v1_info_t));

   if(NULL != ret)
   {
      memset(ret, 0, sizeof(*ret));

      ret->base.api_version = ST_PLUGIN_API_VERSION;
      ret->base.id          = "osc_additive16_v1";  // unique id. don't change this in future builds.
      ret->base.author      = "bsp";
      ret->base.name        = "osc_additive16_v1";
      ret->base.short_name  = "osc_additive16_v1";
      ret->base.flags       = ST_PLUGIN_FLAG_OSC;
      ret->base.category    = ST_PLUGIN_CAT_UNKNOWN;
      ret->base.num_params  = NUM_PARAMS;
      ret->base.num_mods    = NUM_MODS;

      ret->base.shared_new                          = &loc_shared_new;
      ret->base.shared_delete                       = &loc_shared_delete;
      ret->base.voice_new                           = &loc_voice_new;
      ret->base.voice_delete                        = &loc_voice_delete;
      ret->base.get_param_name                      = &loc_get_param_name;
      ret->base.get_param_group_name                = &loc_get_param_group_name;
      ret->base.get_param_group_idx                 = &loc_get_param_group_idx;
      ret->base.get_param_reset                     = &loc_get_param_reset;
      ret->base.query_dynamic_param_preset_values   = &loc_query_dynamic_param_preset_values;
      ret->base.query_dynamic_param_preset_name     = &loc_query_dynamic_param_preset_name;
      ret->base.get_array_param_size                = &loc_get_array_param_size;
      ret->base.get_array_param_num_variations      = &loc_get_array_param_num_variations;
      ret->base.get_array_param_variation_ptr       = &loc_get_array_param_variation_ptr;
      ret->base.set_array_param_edit_variation_idx  = &loc_set_array_param_edit_variation_idx;
      ret->base.get_array_param_element_value_range = &loc_get_array_param_element_value_range;
      ret->base.get_param_value                     = &loc_get_param_value;
      ret->base.set_param_value                     = &loc_set_param_value;
      ret->base.get_mod_name                        = &loc_get_mod_name;
      ret->base.set_sample_rate                     = &loc_set_sample_rate;
      ret->base.note_on                             = &loc_note_on;
      ret->base.set_mod_value                       = &loc_set_mod_value;
      ret->base.prepare_block                       = &loc_prepare_block;
      ret->base.process_replace                     = &loc_process_replace;
      ret->base.plugin_exit                         = &loc_plugin_exit;

#ifdef USE_CYCLE_SINE_TBL
      loc_calc_sine_tbl();
#endif // USE_CYCLE_SINE_TBL
   }

   return &ret->base;
}

#ifndef STFX_SKIP_MAIN_INIT
ST_PLUGIN_APICALL st_plugin_info_t *ST_PLUGIN_API st_plugin_init(unsigned int _pluginIdx) {
   switch(_pluginIdx)
   {
      case 0u:
         return osc_additive16_v1_init();
   }
   return NULL;
}
#endif // STFX_SKIP_MAIN_INIT

} // extern "C"
