/[svn]/linuxsampler/trunk/src/engines/sfz/sfz.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/sfz/sfz.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2082 by persson, Sun Apr 11 10:20:24 2010 UTC revision 2086 by persson, Sun Apr 25 12:51:30 2010 UTC
# Line 154  namespace sfz Line 154  namespace sfz
154              rand    >= lorand     &&  rand    <  hirand     &&              rand    >= lorand     &&  rand    <  hirand     &&
155              timer   >= lotimer    &&  timer   <= hitimer    &&              timer   >= lotimer    &&  timer   <= hitimer    &&
156    
157              ( (sw_lokey == -1 || sw_hikey == -1 || sw_last  == -1) ||              ( sw_last == -1 ||
158                ((sw_last >= sw_lokey && sw_last <= sw_hikey) ? (last_sw_key == sw_last) : true) ) &&                ((sw_last >= sw_lokey && sw_last <= sw_hikey) ? (last_sw_key == sw_last) : false) ) &&
159    
160              ( (sw_down  == -1 || sw_lokey == -1 || sw_hikey == -1) ||              ( sw_down == -1 ||
161                ((sw_down >= sw_lokey && sw_down <= sw_hikey) ? (sw[sw_down]) : true) )  &&                ((sw_down >= sw_lokey && (sw_hikey == -1 || sw_down <= sw_hikey)) ? (sw[sw_down]) : false) )  &&
162    
163              ( (sw_up    == -1 || sw_lokey == -1 || sw_hikey == -1) ||              ( sw_up   == -1 ||
164                ((sw_up   >= sw_lokey && sw_up   <= sw_hikey) ? (!sw[sw_up])  : true) )  &&                ((sw_up   >= sw_lokey && (sw_hikey == -1 || sw_up   <= sw_hikey)) ? (!sw[sw_up]) : true) )  &&
165    
166              ((sw_previous != -1) ? (prev_sw_key == sw_previous) : true)  &&              ( sw_previous == -1 ||
167               ((trigger & trig) != 0)                prev_sw_key == sw_previous )  &&
168    
169                ((trigger & trig) != 0)
170          );          );
171    
172          if (!is_triggered)          if (!is_triggered)
# Line 220  namespace sfz Line 222  namespace sfz
222              rand    >= lorand           &&  rand    <  hirand             &&              rand    >= lorand           &&  rand    <  hirand             &&
223              timer   >= lotimer          &&  timer   <= hitimer            &&              timer   >= lotimer          &&  timer   <= hitimer            &&
224    
225              ( (sw_lokey == -1 || sw_hikey == -1 || sw_last  == -1) ||              ( sw_last == -1 ||
226                ((sw_last >= sw_lokey && sw_last <= sw_hikey) ? (last_sw_key == sw_last) : true) ) &&                ((sw_last >= sw_lokey && sw_last <= sw_hikey) ? (last_sw_key == sw_last) : false) ) &&
227    
228                ( sw_down == -1 ||
229                  ((sw_down >= sw_lokey && (sw_hikey == -1 || sw_down <= sw_hikey)) ? (sw[sw_down]) : false) )  &&
230    
231              ( (sw_down  == -1 || sw_lokey == -1 || sw_hikey == -1) ||              ( sw_up   == -1 ||
232                ((sw_down >= sw_lokey && sw_down <= sw_hikey) ? (sw[sw_down]) : true) )  &&                ((sw_up   >= sw_lokey && (sw_hikey == -1 || sw_up   <= sw_hikey)) ? (!sw[sw_up]) : true) )  &&
233    
234              ( (sw_up    == -1 || sw_lokey == -1 || sw_hikey == -1) ||              ( sw_previous == -1 ||
235                ((sw_up   >= sw_lokey && sw_up   <= sw_hikey) ? (!sw[sw_up])  : true) )  &&                prev_sw_key == sw_previous )  &&
236    
237              ((sw_previous != -1) ? (prev_sw_key == sw_previous) : true)  &&              ((trigger & trig) != 0)
              ((trigger & trig) != 0)  
238          );          );
239    
240          if (!is_triggered)          if (!is_triggered)
# Line 881  namespace sfz Line 885  namespace sfz
885    
886              // get keyswitches              // get keyswitches
887              low = pRegion->sw_lokey;              low = pRegion->sw_lokey;
888                if (low < 0) low = 0;
889              high = pRegion->sw_hikey;              high = pRegion->sw_hikey;
890              if(low == -1 && high == -1) {              if (high == -1) {
891                  // Key switches not defined, so nothing to do                  // Key switches not defined, so nothing to do
892              } else if(low >= 0 && low <= 127 && high >= 0 && high <= 127 && high >= low) {              } else if (low >= 0 && low <= 127 && high >= 0 && high <= 127 && high >= low) {
893                  for (int j = low; j <= high; j++) _instrument->KeySwitchBindings[j] = true;                  for (int j = low; j <= high; j++) _instrument->KeySwitchBindings[j] = true;
894              } else {              } else {
895                  std::cerr << "Invalid key switch range: " << low << " - " << high << std::endl;                  std::cerr << "Invalid key switch range: " << low << " - " << high << std::endl;
# Line 1143  namespace sfz Line 1148  namespace sfz
1148          else if ("bend_step" == key) pCurDef->bend_step = ToInt(value);          else if ("bend_step" == key) pCurDef->bend_step = ToInt(value);
1149    
1150          // filter          // filter
1151          else if ("fil_type" == key)          else if ("fil_type" == key || "filtype" == key)
1152          {          {
1153              if (value == "lpf_1p") pCurDef->fil_type = LPF_1P;              if (value == "lpf_1p") pCurDef->fil_type = LPF_1P;
1154              else if (value == "hpf_1p") pCurDef->fil_type = HPF_1P;              else if (value == "hpf_1p") pCurDef->fil_type = HPF_1P;
# Line 1238  namespace sfz Line 1243  namespace sfz
1243              else if ("offset_on" == key_cc) pCurDef->offset_oncc[num_cc] = ToInt(value);              else if ("offset_on" == key_cc) pCurDef->offset_oncc[num_cc] = ToInt(value);
1244    
1245              // amplifier              // amplifier
1246              else if ("gain_on"  == key_cc) pCurDef->gain_oncc[num_cc]  = ToFloat(value);              else if ("gain_on"  == key_cc || "gain_" == key_cc) pCurDef->gain_oncc[num_cc]  = ToFloat(value);
1247              else if ("xfin_lo"  == key_cc) pCurDef->xfin_locc[num_cc]  = ToInt(value);              else if ("xfin_lo"  == key_cc) pCurDef->xfin_locc[num_cc]  = ToInt(value);
1248              else if ("xfin_hi"  == key_cc) pCurDef->xfin_hicc[num_cc]  = ToInt(value);              else if ("xfin_hi"  == key_cc) pCurDef->xfin_hicc[num_cc]  = ToInt(value);
1249              else if ("xfout_lo" == key_cc) pCurDef->xfout_locc[num_cc] = ToInt(value);              else if ("xfout_lo" == key_cc) pCurDef->xfout_locc[num_cc] = ToInt(value);
1250              else if ("xfout_hi" == key_cc) pCurDef->xfout_hicc[num_cc] = ToInt(value);              else if ("xfout_hi" == key_cc) pCurDef->xfout_hicc[num_cc] = ToInt(value);
1251    
1252              // filter              // filter
1253              else if ("cutoff_on"  == key_cc) pCurDef->cutoff_oncc[num_cc]  = ToInt(value);              else if ("cutoff_on"  == key_cc || "cutoff_" == key_cc) pCurDef->cutoff_oncc[num_cc]  = ToInt(value);
1254              else if ("cutoff2_on" == key_cc) pCurDef->cutoff2_oncc[num_cc] = ToInt(value);              else if ("cutoff2_on" == key_cc) pCurDef->cutoff2_oncc[num_cc] = ToInt(value);
1255              else if ("cutoff_smooth"  == key_cc) pCurDef->cutoff_smoothcc[num_cc]  = ToInt(value);              else if ("cutoff_smooth"  == key_cc) pCurDef->cutoff_smoothcc[num_cc]  = ToInt(value);
1256              else if ("cutoff2_smooth" == key_cc) pCurDef->cutoff2_smoothcc[num_cc] = ToInt(value);              else if ("cutoff2_smooth" == key_cc) pCurDef->cutoff2_smoothcc[num_cc] = ToInt(value);
# Line 1263  namespace sfz Line 1268  namespace sfz
1268              else if ("resonance2_curve" == key_cc) pCurDef->resonance2_curvecc[num_cc] = ToInt(value);              else if ("resonance2_curve" == key_cc) pCurDef->resonance2_curvecc[num_cc] = ToInt(value);
1269    
1270              // per voice equalizer              // per voice equalizer
1271              else if ("eq1_freq_on" == key_cc) pCurDef->eq1_freq_oncc[num_cc] = ToInt(value);              else if ("eq1_freq_on" == key_cc || "eq1_freq" == key_cc) pCurDef->eq1_freq_oncc[num_cc] = ToInt(value);
1272              else if ("eq2_freq_on" == key_cc) pCurDef->eq2_freq_oncc[num_cc] = ToInt(value);              else if ("eq2_freq_on" == key_cc || "eq2_freq" == key_cc) pCurDef->eq2_freq_oncc[num_cc] = ToInt(value);
1273              else if ("eq3_freq_on" == key_cc) pCurDef->eq3_freq_oncc[num_cc] = ToInt(value);              else if ("eq3_freq_on" == key_cc || "eq3_freq" == key_cc) pCurDef->eq3_freq_oncc[num_cc] = ToInt(value);
1274              else if ("eq1_bw_on" == key_cc) pCurDef->eq1_bw_oncc[num_cc] = ToInt(value);              else if ("eq1_bw_on" == key_cc || "eq1_bw" == key_cc) pCurDef->eq1_bw_oncc[num_cc] = ToInt(value);
1275              else if ("eq2_bw_on" == key_cc) pCurDef->eq2_bw_oncc[num_cc] = ToInt(value);              else if ("eq2_bw_on" == key_cc || "eq2_bw" == key_cc) pCurDef->eq2_bw_oncc[num_cc] = ToInt(value);
1276              else if ("eq3_bw_on" == key_cc) pCurDef->eq3_bw_oncc[num_cc] = ToInt(value);              else if ("eq3_bw_on" == key_cc || "eq3_bw" == key_cc) pCurDef->eq3_bw_oncc[num_cc] = ToInt(value);
1277              else if ("eq1_gain_on" == key_cc) pCurDef->eq1_gain_oncc[num_cc] = ToInt(value);              else if ("eq1_gain_on" == key_cc || "eq1_gain" == key_cc) pCurDef->eq1_gain_oncc[num_cc] = ToInt(value);
1278              else if ("eq2_gain_on" == key_cc) pCurDef->eq2_gain_oncc[num_cc] = ToInt(value);              else if ("eq2_gain_on" == key_cc || "eq2_gain" == key_cc) pCurDef->eq2_gain_oncc[num_cc] = ToInt(value);
1279              else if ("eq3_gain_on" == key_cc) pCurDef->eq3_gain_oncc[num_cc] = ToInt(value);              else if ("eq3_gain_on" == key_cc || "eq3_gain" == key_cc) pCurDef->eq3_gain_oncc[num_cc] = ToInt(value);
1280              else std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;              else std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;
1281          }          }
1282          // v2 envelope generators          // v2 envelope generators

Legend:
Removed from v.2082  
changed lines
  Added in v.2086

  ViewVC Help
Powered by ViewVC