/[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 2221 by iliev, Thu Jul 28 17:17:42 2011 UTC revision 2229 by iliev, Thu Aug 4 19:02:36 2011 UTC
# Line 435  namespace sfz Line 435  namespace sfz
435              eq1_gain_oncc.set(i, 0);              eq1_gain_oncc.set(i, 0);
436              eq2_gain_oncc.set(i, 0);              eq2_gain_oncc.set(i, 0);
437              eq3_gain_oncc.set(i, 0);              eq3_gain_oncc.set(i, 0);
438                
439                pitchlfo_depthcc.set(i, 0);
440          }          }
441          cutoff_cc = 0;          cutoff_cc = 0;
442    
# Line 464  namespace sfz Line 466  namespace sfz
466          fileg_sustain  = 100; // in percentage          fileg_sustain  = 100; // in percentage
467          fileg_release  = 0;          fileg_release  = 0;
468    
469            fileg_vel2delay   = 0;
470            fileg_vel2attack  = 0;
471            fileg_vel2hold    = 0;
472            fileg_vel2decay   = 0;
473            fileg_vel2sustain = 0;
474            fileg_vel2release = 0;
475            fileg_depth       = 0;
476    
477          pitcheg_delay    = 0;          pitcheg_delay    = 0;
478          pitcheg_start    = 0; //in percentage          pitcheg_start    = 0; //in percentage
479          pitcheg_attack   = 0;          pitcheg_attack   = 0;
# Line 482  namespace sfz Line 492  namespace sfz
492    
493          amplfo_delay     = 0;          amplfo_delay     = 0;
494          amplfo_fade      = 0;          amplfo_fade      = 0;
495          amplfo_freq      = 0;          amplfo_freq      = -1; /* -1 is used to determine whether the LFO was initialized */
496          amplfo_depth     = 0;          amplfo_depth     = 0;
497    
498          fillfo_delay     = 0;          fillfo_delay     = 0;
499          fillfo_fade      = 0;          fillfo_fade      = 0;
500          fillfo_freq      = 0;          fillfo_freq      = -1; /* -1 is used to determine whether the LFO was initialized */
501          fillfo_depth     = 0;          fillfo_depth     = 0;
502    
503          pitchlfo_delay   = 0;          pitchlfo_delay   = 0;
504          pitchlfo_fade    = 0;          pitchlfo_fade    = 0;
505          pitchlfo_freq    = 0;          pitchlfo_freq    = -1; /* -1 is used to determine whether the LFO was initialized */
506          pitchlfo_depth   = 0;          pitchlfo_depth   = 0;
507      }      }
508    
# Line 692  namespace sfz Line 702  namespace sfz
702          region->ampeg_vel2decay   = ampeg_vel2decay;          region->ampeg_vel2decay   = ampeg_vel2decay;
703          region->ampeg_vel2sustain = ampeg_vel2sustain;          region->ampeg_vel2sustain = ampeg_vel2sustain;
704          region->ampeg_vel2release = ampeg_vel2release;          region->ampeg_vel2release = ampeg_vel2release;
705            
706            region->ampeg_delaycc   = ampeg_delaycc;
707            region->ampeg_startcc   = ampeg_startcc;
708            region->ampeg_attackcc  = ampeg_attackcc;
709            region->ampeg_holdcc    = ampeg_holdcc;
710            region->ampeg_decaycc   = ampeg_decaycc;
711            region->ampeg_sustaincc = ampeg_sustaincc;
712            region->ampeg_releasecc = ampeg_releasecc;
713    
714          region->fileg_delay    = fileg_delay;          region->fileg_delay    = fileg_delay;
715          region->fileg_start    = fileg_start;          region->fileg_start    = fileg_start;
# Line 700  namespace sfz Line 718  namespace sfz
718          region->fileg_decay    = fileg_decay;          region->fileg_decay    = fileg_decay;
719          region->fileg_sustain  = fileg_sustain;          region->fileg_sustain  = fileg_sustain;
720          region->fileg_release  = fileg_release;          region->fileg_release  = fileg_release;
721            region->fileg_depth    = fileg_depth;
722    
723            region->fileg_vel2delay   = fileg_vel2delay;
724            region->fileg_vel2attack  = fileg_vel2attack;
725            region->fileg_vel2hold    = fileg_vel2hold;
726            region->fileg_vel2decay   = fileg_vel2decay;
727            region->fileg_vel2sustain = fileg_vel2sustain;
728            region->fileg_vel2release = fileg_vel2release;
729    
730          region->pitcheg_delay    = pitcheg_delay;          region->pitcheg_delay    = pitcheg_delay;
731          region->pitcheg_start    = pitcheg_start;          region->pitcheg_start    = pitcheg_start;
# Line 721  namespace sfz Line 747  namespace sfz
747          region->amplfo_fade      = amplfo_fade;          region->amplfo_fade      = amplfo_fade;
748          region->amplfo_freq      = amplfo_freq;          region->amplfo_freq      = amplfo_freq;
749          region->amplfo_depth     = amplfo_depth;          region->amplfo_depth     = amplfo_depth;
750            
751            region->amplfo_freqcc    = amplfo_freqcc;
752    
753          region->fillfo_delay     = fillfo_delay;          region->fillfo_delay     = fillfo_delay;
754          region->fillfo_fade      = fillfo_fade;          region->fillfo_fade      = fillfo_fade;
755          region->fillfo_freq      = fillfo_freq;          region->fillfo_freq      = fillfo_freq;
756          region->fillfo_depth     = fillfo_depth;          region->fillfo_depth     = fillfo_depth;
757            
758            region->fillfo_freqcc    = fillfo_freqcc;
759    
760          region->pitchlfo_delay   = pitchlfo_delay;          region->pitchlfo_delay   = pitchlfo_delay;
761          region->pitchlfo_fade    = pitchlfo_fade;          region->pitchlfo_fade    = pitchlfo_fade;
762          region->pitchlfo_freq    = pitchlfo_freq;          region->pitchlfo_freq    = pitchlfo_freq;
763          region->pitchlfo_depth   = pitchlfo_depth;          region->pitchlfo_depth   = pitchlfo_depth;
764            
765            region->pitchlfo_depthcc = pitchlfo_depthcc;
766            region->pitchlfo_freqcc  = pitchlfo_freqcc;
767            
768            region->eg = eg;
769            region->lfos = lfos;
770    
771          return region;          return region;
772      }      }
# Line 957  namespace sfz Line 993  namespace sfz
993          std::string::size_type delimiter_index = token.find('=');          std::string::size_type delimiter_index = token.find('=');
994          std::string key = token.substr(0, delimiter_index);          std::string key = token.substr(0, delimiter_index);
995          std::string value = token.substr(delimiter_index + 1);          std::string value = token.substr(delimiter_index + 1);
996          int x, y;          int x, y, z;
997    
998          // sample definition          // sample definition
999          if ("sample" == key)          if ("sample" == key)
# Line 1088  namespace sfz Line 1124  namespace sfz
1124          else if ("amp_keycenter" == key) pCurDef->amp_keycenter = parseKey(value);          else if ("amp_keycenter" == key) pCurDef->amp_keycenter = parseKey(value);
1125          else if ("amp_veltrack"  == key) pCurDef->amp_veltrack = ToFloat(value);          else if ("amp_veltrack"  == key) pCurDef->amp_veltrack = ToFloat(value);
1126          else if ("amp_random"  == key) pCurDef->amp_random = ToFloat(value);          else if ("amp_random"  == key) pCurDef->amp_random = ToFloat(value);
1127          else if ("rt_decay"    == key) pCurDef->rt_decay = ToFloat(value);          else if ("rt_decay" == key || "rtdecay" == key) pCurDef->rt_decay = ToFloat(value);
1128          else if ("xfin_lokey"  == key) pCurDef->xfin_lokey = parseKey(value);          else if ("xfin_lokey"  == key) pCurDef->xfin_lokey = parseKey(value);
1129          else if ("xfin_hikey"  == key) pCurDef->xfin_hikey = parseKey(value);          else if ("xfin_hikey"  == key) pCurDef->xfin_hikey = parseKey(value);
1130          else if ("xfout_lokey" == key) pCurDef->xfout_lokey = parseKey(value);          else if ("xfout_lokey" == key) pCurDef->xfout_lokey = parseKey(value);
# Line 1122  namespace sfz Line 1158  namespace sfz
1158          else if ("pitch_random" == key) pCurDef->pitch_random = ToInt(value);          else if ("pitch_random" == key) pCurDef->pitch_random = ToInt(value);
1159          else if ("bend_up" == key || "bendup" == key) pCurDef->bend_up = ToInt(value);          else if ("bend_up" == key || "bendup" == key) pCurDef->bend_up = ToInt(value);
1160          else if ("bend_down" == key || "benddown" == key) pCurDef->bend_down = ToInt(value);          else if ("bend_down" == key || "benddown" == key) pCurDef->bend_down = ToInt(value);
1161          else if ("bend_step" == key) pCurDef->bend_step = ToInt(value);          else if ("bend_step" == key || "bendstep" == key) pCurDef->bend_step = ToInt(value);
1162    
1163          // filter          // filter
1164          else if ("fil_type" == key || "filtype" == key)          else if ("fil_type" == key || "filtype" == key)
# Line 1196  namespace sfz Line 1232  namespace sfz
1232          else if (sscanf(key.c_str(), "amp_velcurve_%d", &x)) {          else if (sscanf(key.c_str(), "amp_velcurve_%d", &x)) {
1233              pCurDef->amp_velcurve.set(x, ToFloat(value));              pCurDef->amp_velcurve.set(x, ToFloat(value));
1234          }          }
1235            
         // CCs  
         else if (key.find("cc") != std::string::npos)  
         {  
             std::string::size_type delimiter_index = key.find("cc");  
             std::string key_cc = key.substr(0, delimiter_index);  
             int num_cc = ToInt(key.substr(delimiter_index + 2));  
   
             // input controls  
             if ("lo" == key_cc) pCurDef->locc.set(num_cc, ToInt(value));  
             else if ("hi" == key_cc) pCurDef->hicc.set(num_cc, ToInt(value));  
             else if ("start_lo" == key_cc) pCurDef->start_locc.set(num_cc, ToInt(value));  
             else if ("start_hi" == key_cc) pCurDef->start_hicc.set(num_cc, ToInt(value));  
             else if ("stop_lo" == key_cc) pCurDef->stop_locc.set(num_cc, ToInt(value));  
             else if ("stop_hi" == key_cc) pCurDef->stop_hicc.set(num_cc, ToInt(value));  
             else if ("on_lo" == key_cc) pCurDef->on_locc.set(num_cc, ToInt(value));  
             else if ("on_hi" == key_cc) pCurDef->on_hicc.set(num_cc, ToInt(value));  
   
             // sample player  
             else if ("delay_on" == key_cc) pCurDef->delay_oncc.set(num_cc, ToFloat(value));  
             else if ("delay_samples_on" == key_cc) pCurDef->delay_samples_oncc.set(num_cc, ToInt(value));  
             else if ("offset_on" == key_cc) pCurDef->offset_oncc.set(num_cc, ToInt(value));  
   
             // amplifier  
             else if ("gain_on"  == key_cc || "gain_" == key_cc) pCurDef->gain_oncc.set(num_cc, ToFloat(value));  
             else if ("xfin_lo"  == key_cc) pCurDef->xfin_locc.set(num_cc, ToInt(value));  
             else if ("xfin_hi"  == key_cc) pCurDef->xfin_hicc.set(num_cc, ToInt(value));  
             else if ("xfout_lo" == key_cc) pCurDef->xfout_locc.set(num_cc, ToInt(value));  
             else if ("xfout_hi" == key_cc) pCurDef->xfout_hicc.set(num_cc, ToInt(value));  
   
             // filter  
             else if ("cutoff_on"  == key_cc || "cutoff_" == key_cc) {  
                 pCurDef->cutoff_oncc.set(num_cc, ToInt(value));  
                 pCurDef->cutoff_cc = num_cc;  
             } else if ("cutoff2_on" == key_cc) pCurDef->cutoff2_oncc.set(num_cc, ToInt(value));  
             else if ("cutoff_smooth"  == key_cc) pCurDef->cutoff_smoothcc.set(num_cc, ToInt(value));  
             else if ("cutoff2_smooth" == key_cc) pCurDef->cutoff2_smoothcc.set(num_cc, ToInt(value));  
             else if ("cutoff_step"  == key_cc) pCurDef->cutoff_stepcc.set(num_cc, ToInt(value));  
             else if ("cutoff2_step" == key_cc) pCurDef->cutoff2_stepcc.set(num_cc, ToInt(value));  
             else if ("cutoff_curve" == key_cc) pCurDef->cutoff_curvecc.set(num_cc, ToInt(value));  
             else if ("cutoff2_curve" == key_cc) pCurDef->cutoff2_curvecc.set(num_cc, ToInt(value));  
             else if ("resonance_on" == key_cc) pCurDef->resonance_oncc.set(num_cc, ToInt(value));  
             else if ("resonance2_on" == key_cc) pCurDef->resonance2_oncc.set(num_cc, ToInt(value));  
             else if ("resonance_smooth" == key_cc) pCurDef->resonance_smoothcc.set(num_cc, ToInt(value));  
             else if ("resonance2_smooth" == key_cc) pCurDef->resonance2_smoothcc.set(num_cc, ToInt(value));  
             else if ("resonance_step" == key_cc) pCurDef->resonance_stepcc.set(num_cc, ToInt(value));  
             else if ("resonance2_step" == key_cc) pCurDef->resonance2_stepcc.set(num_cc, ToInt(value));  
             else if ("resonance_curve" == key_cc) pCurDef->resonance_curvecc.set(num_cc, ToInt(value));  
             else if ("resonance2_curve" == key_cc) pCurDef->resonance2_curvecc.set(num_cc, ToInt(value));  
   
             // per voice equalizer  
             else if ("eq1_freq_on" == key_cc || "eq1_freq" == key_cc) pCurDef->eq1_freq_oncc.set(num_cc, ToInt(value));  
             else if ("eq2_freq_on" == key_cc || "eq2_freq" == key_cc) pCurDef->eq2_freq_oncc.set(num_cc, ToInt(value));  
             else if ("eq3_freq_on" == key_cc || "eq3_freq" == key_cc) pCurDef->eq3_freq_oncc.set(num_cc, ToInt(value));  
             else if ("eq1_bw_on" == key_cc || "eq1_bw" == key_cc) pCurDef->eq1_bw_oncc.set(num_cc, ToInt(value));  
             else if ("eq2_bw_on" == key_cc || "eq2_bw" == key_cc) pCurDef->eq2_bw_oncc.set(num_cc, ToInt(value));  
             else if ("eq3_bw_on" == key_cc || "eq3_bw" == key_cc) pCurDef->eq3_bw_oncc.set(num_cc, ToInt(value));  
             else if ("eq1_gain_on" == key_cc || "eq1_gain" == key_cc) pCurDef->eq1_gain_oncc.set(num_cc, ToInt(value));  
             else if ("eq2_gain_on" == key_cc || "eq2_gain" == key_cc) pCurDef->eq2_gain_oncc.set(num_cc, ToInt(value));  
             else if ("eq3_gain_on" == key_cc || "eq3_gain" == key_cc) pCurDef->eq3_gain_oncc.set(num_cc, ToInt(value));  
             else std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;  
         }  
1236          // v2 envelope generators          // v2 envelope generators
1237          else if (sscanf(key.c_str(), "eg%d%n", &x, &y)) {          else if (sscanf(key.c_str(), "eg%d%n", &x, &y)) {
1238              const char* s = key.c_str() + y;              const char* s = key.c_str() + y;
1239              if (sscanf(s, "_time%d", &y)) egnode(x, y).time = ToFloat(value);              if (sscanf(s, "_time%d%n", &y, &z)) {
1240              else if (sscanf(s, "_level%d", &y)) egnode(x, y).level = ToFloat(value);                  const char* s2 = s + z;
1241                    if (strcmp(s2, "") == 0) egnode(x, y).time = check(key, 0.0f, 100.0f, ToFloat(value));
1242                    else if (sscanf(s2, "_oncc%d", &z)) egnode(x, y).time_oncc.add( CC(z, check(key, 0.0f, 100.0f, ToFloat(value))) );
1243                } else if (sscanf(s, "_level%d%n", &y, &z)) {
1244                    const char* s2 = s + z;
1245                    if (strcmp(s2, "") == 0) egnode(x, y).level = check(key, 0.0f, 1.0f, ToFloat(value));
1246                    else if (sscanf(s2, "_oncc%d", &z)) egnode(x, y).level_oncc.add( CC(z, check(key, 0.0f, 1.0f, ToFloat(value))) );
1247                }
1248              else if (sscanf(s, "_shape%d", &y)) egnode(x, y).shape = ToFloat(value);              else if (sscanf(s, "_shape%d", &y)) egnode(x, y).shape = ToFloat(value);
1249              else if (sscanf(s, "_curve%d", &y)) egnode(x, y).curve = ToFloat(value);              else if (sscanf(s, "_curve%d", &y)) egnode(x, y).curve = ToFloat(value);
1250              else if (strcmp(s, "_sustain") == 0) eg(x).sustain = ToInt(value);              else if (strcmp(s, "_sustain") == 0) eg(x).sustain = ToInt(value);
# Line 1294  namespace sfz Line 1276  namespace sfz
1276          else if ("fileg_decay"   == key) pCurDef->fileg_decay = ToFloat(value);          else if ("fileg_decay"   == key) pCurDef->fileg_decay = ToFloat(value);
1277          else if ("fileg_sustain"   == key) pCurDef->fileg_sustain = ToFloat(value);          else if ("fileg_sustain"   == key) pCurDef->fileg_sustain = ToFloat(value);
1278          else if ("fileg_release"   == key) pCurDef->fileg_release = ToFloat(value);          else if ("fileg_release"   == key) pCurDef->fileg_release = ToFloat(value);
1279            else if ("fileg_depth"   == key) pCurDef->fileg_depth = check(key, -12000, 12000, ToInt(value));
1280            else if ("fileg_vel2delay"   == key) pCurDef->fileg_vel2delay = check(key, -100.0f, 100.0f, ToFloat(value));
1281            else if ("fileg_vel2attack"  == key) pCurDef->fileg_vel2attack = ToFloat(value);
1282            else if ("fileg_vel2hold"    == key) pCurDef->fileg_vel2hold = ToFloat(value);
1283            else if ("fileg_vel2decay"   == key) pCurDef->fileg_vel2decay = ToFloat(value);
1284            else if ("fileg_vel2sustain" == key) pCurDef->fileg_vel2sustain = ToFloat(value);
1285            else if ("fileg_vel2release" == key) pCurDef->fileg_vel2release = ToFloat(value);
1286          else if ("pitcheg_delay"   == key) pCurDef->pitcheg_delay = ToFloat(value);          else if ("pitcheg_delay"   == key) pCurDef->pitcheg_delay = ToFloat(value);
1287          else if ("pitcheg_start"   == key) pCurDef->pitcheg_start = ToFloat(value);          else if ("pitcheg_start"   == key) pCurDef->pitcheg_start = ToFloat(value);
1288          else if ("pitcheg_attack"  == key) pCurDef->pitcheg_attack = ToFloat(value);          else if ("pitcheg_attack"  == key) pCurDef->pitcheg_attack = ToFloat(value);
# Line 1328  namespace sfz Line 1317  namespace sfz
1317          else if (sscanf(key.c_str(), "lfo%d%n", &x, &y)) {          else if (sscanf(key.c_str(), "lfo%d%n", &x, &y)) {
1318              const char* s = key.c_str() + y;              const char* s = key.c_str() + y;
1319              if (strcmp(s, "_freq") == 0) lfo(x).freq = check(key, 0.0f, 20.0f, ToFloat(value));              if (strcmp(s, "_freq") == 0) lfo(x).freq = check(key, 0.0f, 20.0f, ToFloat(value));
1320                else if (sscanf(s, "_freq_oncc%d", &y)) lfo(x).freq_oncc.add( CC(y, check(key, 0.0f, 20.0f, ToFloat(value))) );
1321              else if (strcmp(s, "_wave") == 0) lfo(x).wave = ToInt(value);              else if (strcmp(s, "_wave") == 0) lfo(x).wave = ToInt(value);
1322              else if (strcmp(s, "_delay") == 0) lfo(x).delay = check(key, 0.0f, 100.0f, ToFloat(value));              else if (strcmp(s, "_delay") == 0) lfo(x).delay = check(key, 0.0f, 100.0f, ToFloat(value));
1323                else if (strcmp(s, "_fade") == 0) lfo(x).fade = check(key, 0.0f, 100.0f, ToFloat(value));
1324                else if (sscanf(s, "_fade_oncc%d", &y)) lfo(x).fade_oncc.add( CC(y, check(key, 0.0f, 100.0f, ToFloat(value))) );
1325                else if (strcmp(s, "_phase") == 0) lfo(x).phase = check(key, 0.0f, 360.0f, ToFloat(value));
1326                else if (sscanf(s, "_phase_oncc%d", &y)) lfo(x).phase_oncc.add( CC(y, check(key, 0.0f, 360.0f, ToFloat(value))) );
1327              else if (strcmp(s, "_volume") == 0) lfo(x).volume = check(key, -144.0f, 6.0f, ToFloat(value));              else if (strcmp(s, "_volume") == 0) lfo(x).volume = check(key, -144.0f, 6.0f, ToFloat(value));
1328              else if (strcmp(s, "_pitch") == 0) lfo(x).pitch = check(key, -9600, 9600, ToInt(value));              else if (strcmp(s, "_pitch") == 0) lfo(x).pitch = check(key, -9600, 9600, ToInt(value));
1329                else if (sscanf(s, "_pitch_oncc%d", &y)) lfo(x).pitch_oncc.add( CC(y, check(key, -9600, 9600, ToInt(value))) );
1330              else if (strcmp(s, "_cutoff") == 0) lfo(x).cutoff = check(key, -9600, 9600, ToInt(value));              else if (strcmp(s, "_cutoff") == 0) lfo(x).cutoff = check(key, -9600, 9600, ToInt(value));
1331              else if (strcmp(s, "_resonance") == 0) lfo(x).resonance = check(key, 0.0f, 40.0f, ToFloat(value));              else if (strcmp(s, "_resonance") == 0) lfo(x).resonance = check(key, 0.0f, 40.0f, ToFloat(value));
1332              else if (strcmp(s, "_pan") == 0) lfo(x).pan = check(key, -100.0f, 100.0f, ToFloat(value));              else if (strcmp(s, "_pan") == 0) lfo(x).pan = check(key, -100.0f, 100.0f, ToFloat(value));
1333              else std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;              else std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;
1334          }          }
1335    
1336            // CCs
1337            else if (key.find("cc") != std::string::npos)
1338            {
1339                std::string::size_type delimiter_index = key.find("cc");
1340                std::string key_cc = key.substr(0, delimiter_index);
1341                int num_cc = ToInt(key.substr(delimiter_index + 2));
1342    
1343                // input controls
1344                if ("lo" == key_cc) pCurDef->locc.set(num_cc, ToInt(value));
1345                else if ("hi" == key_cc) pCurDef->hicc.set(num_cc, ToInt(value));
1346                else if ("start_lo" == key_cc) pCurDef->start_locc.set(num_cc, ToInt(value));
1347                else if ("start_hi" == key_cc) pCurDef->start_hicc.set(num_cc, ToInt(value));
1348                else if ("stop_lo" == key_cc) pCurDef->stop_locc.set(num_cc, ToInt(value));
1349                else if ("stop_hi" == key_cc) pCurDef->stop_hicc.set(num_cc, ToInt(value));
1350                else if ("on_lo" == key_cc) pCurDef->on_locc.set(num_cc, ToInt(value));
1351                else if ("on_hi" == key_cc) pCurDef->on_hicc.set(num_cc, ToInt(value));
1352    
1353                // sample player
1354                else if ("delay_on" == key_cc) pCurDef->delay_oncc.set(num_cc, ToFloat(value));
1355                else if ("delay_samples_on" == key_cc) pCurDef->delay_samples_oncc.set(num_cc, ToInt(value));
1356                else if ("offset_on" == key_cc) pCurDef->offset_oncc.set(num_cc, ToInt(value));
1357    
1358                // amplifier
1359                else if ("gain_on"  == key_cc || "gain_" == key_cc) pCurDef->gain_oncc.set(num_cc, ToFloat(value));
1360                else if ("xfin_lo"  == key_cc) pCurDef->xfin_locc.set(num_cc, ToInt(value));
1361                else if ("xfin_hi"  == key_cc) pCurDef->xfin_hicc.set(num_cc, ToInt(value));
1362                else if ("xfout_lo" == key_cc) pCurDef->xfout_locc.set(num_cc, ToInt(value));
1363                else if ("xfout_hi" == key_cc) pCurDef->xfout_hicc.set(num_cc, ToInt(value));
1364    
1365                // filter
1366                else if ("cutoff_on"  == key_cc || "cutoff_" == key_cc) {
1367                    pCurDef->cutoff_oncc.set(num_cc, ToInt(value));
1368                    pCurDef->cutoff_cc = num_cc;
1369                } else if ("cutoff2_on" == key_cc) pCurDef->cutoff2_oncc.set(num_cc, ToInt(value));
1370                else if ("cutoff_smooth"  == key_cc) pCurDef->cutoff_smoothcc.set(num_cc, ToInt(value));
1371                else if ("cutoff2_smooth" == key_cc) pCurDef->cutoff2_smoothcc.set(num_cc, ToInt(value));
1372                else if ("cutoff_step"  == key_cc) pCurDef->cutoff_stepcc.set(num_cc, ToInt(value));
1373                else if ("cutoff2_step" == key_cc) pCurDef->cutoff2_stepcc.set(num_cc, ToInt(value));
1374                else if ("cutoff_curve" == key_cc) pCurDef->cutoff_curvecc.set(num_cc, ToInt(value));
1375                else if ("cutoff2_curve" == key_cc) pCurDef->cutoff2_curvecc.set(num_cc, ToInt(value));
1376                else if ("resonance_on" == key_cc) pCurDef->resonance_oncc.set(num_cc, ToInt(value));
1377                else if ("resonance2_on" == key_cc) pCurDef->resonance2_oncc.set(num_cc, ToInt(value));
1378                else if ("resonance_smooth" == key_cc) pCurDef->resonance_smoothcc.set(num_cc, ToInt(value));
1379                else if ("resonance2_smooth" == key_cc) pCurDef->resonance2_smoothcc.set(num_cc, ToInt(value));
1380                else if ("resonance_step" == key_cc) pCurDef->resonance_stepcc.set(num_cc, ToInt(value));
1381                else if ("resonance2_step" == key_cc) pCurDef->resonance2_stepcc.set(num_cc, ToInt(value));
1382                else if ("resonance_curve" == key_cc) pCurDef->resonance_curvecc.set(num_cc, ToInt(value));
1383                else if ("resonance2_curve" == key_cc) pCurDef->resonance2_curvecc.set(num_cc, ToInt(value));
1384    
1385                // per voice equalizer
1386                else if ("eq1_freq_on" == key_cc || "eq1_freq" == key_cc) pCurDef->eq1_freq_oncc.set(num_cc, ToInt(value));
1387                else if ("eq2_freq_on" == key_cc || "eq2_freq" == key_cc) pCurDef->eq2_freq_oncc.set(num_cc, ToInt(value));
1388                else if ("eq3_freq_on" == key_cc || "eq3_freq" == key_cc) pCurDef->eq3_freq_oncc.set(num_cc, ToInt(value));
1389                else if ("eq1_bw_on" == key_cc || "eq1_bw" == key_cc) pCurDef->eq1_bw_oncc.set(num_cc, ToInt(value));
1390                else if ("eq2_bw_on" == key_cc || "eq2_bw" == key_cc) pCurDef->eq2_bw_oncc.set(num_cc, ToInt(value));
1391                else if ("eq3_bw_on" == key_cc || "eq3_bw" == key_cc) pCurDef->eq3_bw_oncc.set(num_cc, ToInt(value));
1392                else if ("eq1_gain_on" == key_cc || "eq1_gain" == key_cc) pCurDef->eq1_gain_oncc.set(num_cc, ToInt(value));
1393                else if ("eq2_gain_on" == key_cc || "eq2_gain" == key_cc) pCurDef->eq2_gain_oncc.set(num_cc, ToInt(value));
1394                else if ("eq3_gain_on" == key_cc || "eq3_gain" == key_cc) pCurDef->eq3_gain_oncc.set(num_cc, ToInt(value));
1395                
1396                else if ("ampeg_delay"   == key_cc) pCurDef->ampeg_delaycc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1397                else if ("ampeg_start"   == key_cc) pCurDef->ampeg_startcc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1398                else if ("ampeg_attack"  == key_cc) pCurDef->ampeg_attackcc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1399                else if ("ampeg_hold"    == key_cc) pCurDef->ampeg_holdcc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1400                else if ("ampeg_decay"   == key_cc) pCurDef->ampeg_decaycc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1401                else if ("ampeg_sustain" == key_cc) pCurDef->ampeg_sustaincc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1402                else if ("ampeg_release" == key_cc) pCurDef->ampeg_releasecc.add( CC(num_cc, check(key, -100.0f, 100.0f, ToFloat(value))) );
1403                
1404                else if ("pitchlfo_depth" == key_cc) pCurDef->pitchlfo_depthcc.set(num_cc, ToInt(value));
1405                else if ("pitchlfo_freq" == key_cc) pCurDef->pitchlfo_freqcc.add( CC(num_cc, check(key, -200.0f, 200.0f, ToFloat(value))) );
1406                else if ("fillfo_freq" == key_cc) pCurDef->fillfo_freqcc.add( CC(num_cc, check(key, -200.0f, 200.0f, ToFloat(value))) );
1407                else if ("amplfo_freq" == key_cc) pCurDef->amplfo_freqcc.add( CC(num_cc, check(key, -200.0f, 200.0f, ToFloat(value))) );
1408                else std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;
1409            }
1410    
1411          else {          else {
1412              std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;              std::cerr << "The opcode '" << key << "' is unsupported by libsfz!" << std::endl;
1413          }          }
# Line 1381  namespace sfz Line 1451  namespace sfz
1451    
1452      EGNode::EGNode() : time(0), level(0), shape(0), curve(0) {      EGNode::EGNode() : time(0), level(0), shape(0), curve(0) {
1453      }      }
1454        
1455        void EGNode::Copy(const EGNode& egNode) {
1456            time  = egNode.time;
1457            level = egNode.level;
1458            shape = egNode.shape;
1459            curve = egNode.curve;
1460            
1461            time_oncc = egNode.time_oncc;
1462            level_oncc = egNode.level_oncc;
1463        }
1464    
1465      EG::EG() :      EG::EG() :
1466          sustain(0), loop(0), loop_count(0),          sustain(0), loop(0), loop_count(0),
1467          amplitude(0), cutoff(0) {          amplitude(0), cutoff(0) {
1468      }      }
1469        
1470        void EG::Copy(const EG& eg) {
1471            sustain    = eg.sustain;
1472            loop       = eg.loop;
1473            loop_count = eg.loop_count;
1474            amplitude  = eg.amplitude;
1475            cutoff     = eg.cutoff;
1476            node       = eg.node;
1477        }
1478    
1479      EG& File::eg(int x) {      EG& File::eg(int x) {
1480          while (pCurDef->eg.size() <= x) {          while (pCurDef->eg.size() <= x) {
# Line 1403  namespace sfz Line 1492  namespace sfz
1492      }      }
1493            
1494      LFO::LFO(): freq (-1),/* -1 is used to determine whether the LFO was initialized */      LFO::LFO(): freq (-1),/* -1 is used to determine whether the LFO was initialized */
1495                  wave(0), delay(0), pitch(0), cutoff(0), resonance(0), pan(0) {                  fade(0), phase(0), wave(0), delay(0), pitch(0), cutoff(0), resonance(0), pan(0) {
1496                    
1497      }      }
1498        
1499        void LFO::Copy(const LFO& lfo) {
1500            delay      = lfo.delay;
1501            freq       = lfo.freq;
1502            fade       = lfo.fade;
1503            phase      = lfo.phase;
1504            wave       = lfo.wave;
1505            volume     = lfo.volume;
1506            pitch      = lfo.pitch;
1507            cutoff     = lfo.cutoff;
1508            resonance  = lfo.resonance;
1509            pan        = lfo.pan;
1510            freq_oncc  = lfo.freq_oncc;
1511            fade_oncc  = lfo.fade_oncc;
1512            phase_oncc = lfo.phase_oncc;
1513            pitch_oncc = lfo.pitch_oncc;
1514        }
1515    
1516      LFO& File::lfo(int x) {      LFO& File::lfo(int x) {
1517          while (pCurDef->lfos.size() <= x) {          while (pCurDef->lfos.size() <= x) {

Legend:
Removed from v.2221  
changed lines
  Added in v.2229

  ViewVC Help
Powered by ViewVC