/[svn]/gigedit/trunk/src/gigedit/dimregionedit.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/dimregionedit.cpp

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

revision 2926 by schoenebeck, Sun Jun 5 14:33:58 2016 UTC revision 3329 by schoenebeck, Sun Jul 23 18:31:53 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (C) 2006-2016 Andreas Persson   * Copyright (C) 2006-2017 Andreas Persson
3   *   *
4   * This program is free software; you can redistribute it and/or   * This program is free software; you can redistribute it and/or
5   * modify it under the terms of the GNU General Public License as   * modify it under the terms of the GNU General Public License as
# Line 17  Line 17 
17   * 02110-1301 USA.   * 02110-1301 USA.
18   */   */
19    
20    #include "global.h"
21  #include "dimregionedit.h"  #include "dimregionedit.h"
22    
 #include "global.h"  
23  #include "compat.h"  #include "compat.h"
24    
25  VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :  VelocityCurve::VelocityCurve(double (gig::DimensionRegion::*getter)(uint8_t)) :
# Line 147  void CrossfadeCurve::draw_one_curve(cons Line 147  void CrossfadeCurve::draw_one_curve(cons
147  }  }
148    
149    
150    EGStateOptions::EGStateOptions() : HBox(),
151        label(_("May be cancelled: ")),
152        checkBoxAttack(_("Attack")),
153        checkBoxAttackHold(_("Attack Hold")),
154        checkBoxDecay1(_("Decay 1")),
155        checkBoxDecay2(_("Decay 2")),
156        checkBoxRelease(_("Release"))
157    {
158        set_spacing(6);
159    
160        pack_start(label);
161        pack_start(checkBoxAttack, Gtk::PACK_SHRINK);
162        pack_start(checkBoxAttackHold, Gtk::PACK_SHRINK);
163        pack_start(checkBoxDecay1, Gtk::PACK_SHRINK);
164        pack_start(checkBoxDecay2, Gtk::PACK_SHRINK);
165        pack_start(checkBoxRelease, Gtk::PACK_SHRINK);
166    
167        checkBoxAttack.set_tooltip_text(_(
168            "If checked: a note-off aborts the 'attack' stage."
169        ));
170        checkBoxAttackHold.set_tooltip_text(_(
171            "If checked: a note-off aborts the 'attack hold' stage."
172        ));
173        checkBoxDecay1.set_tooltip_text(_(
174            "If checked: a note-off aborts the 'decay 1' stage."
175        ));
176        checkBoxDecay2.set_tooltip_text(_(
177            "If checked: a note-off aborts the 'decay 2' stage."
178        ));
179        checkBoxRelease.set_tooltip_text(_(
180            "If checked: a note-on reverts back from the 'release' stage."
181        ));
182    }
183    
184    
185  DimRegionEdit::DimRegionEdit() :  DimRegionEdit::DimRegionEdit() :
186      velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),      velocity_curve(&gig::DimensionRegion::GetVelocityAttenuation),
187      release_curve(&gig::DimensionRegion::GetVelocityRelease),      release_curve(&gig::DimensionRegion::GetVelocityRelease),
# Line 230  DimRegionEdit::DimRegionEdit() : Line 265  DimRegionEdit::DimRegionEdit() :
265      eMSDecode(_("Decode Mid/Side Recordings")),      eMSDecode(_("Decode Mid/Side Recordings")),
266      eSampleStartOffset(_("Sample start offset"), 0, 2000),      eSampleStartOffset(_("Sample start offset"), 0, 2000),
267      eUnityNote(_("Unity note")),      eUnityNote(_("Unity note")),
268        eSampleGroup(_("Sample Group")),
269      eSampleFormatInfo(_("Sample Format")),      eSampleFormatInfo(_("Sample Format")),
270      eSampleID("Sample ID"),      eSampleID("Sample ID"),
271        eChecksum("Wave Data CRC-32"),
272      eFineTune(_("Fine tune"), -49, 50),      eFineTune(_("Fine tune"), -49, 50),
273      eGain(_("Gain"), -96, 0, 2, -655360),      eGain(_("Gain"), -96, 0, 2, -655360),
274      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),      eGainPlus6(_("Gain +6dB"), eGain, 6 * -655360),
# Line 264  DimRegionEdit::DimRegionEdit() : Line 301  DimRegionEdit::DimRegionEdit() :
301              &gig::DimensionRegion::EG1ControllerDecayInfluence);              &gig::DimensionRegion::EG1ControllerDecayInfluence);
302      connect(eEG1ControllerReleaseInfluence,      connect(eEG1ControllerReleaseInfluence,
303              &gig::DimensionRegion::EG1ControllerReleaseInfluence);              &gig::DimensionRegion::EG1ControllerReleaseInfluence);
304        {
305            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackCancel));
306            connect(eEG1StateOptions.checkBoxAttack, mp.pmember);
307        }
308        {
309            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.AttackHoldCancel));
310            connect(eEG1StateOptions.checkBoxAttackHold, mp.pmember);
311        }
312        {
313            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay1Cancel));
314            connect(eEG1StateOptions.checkBoxDecay1, mp.pmember);
315        }
316        {
317            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.Decay2Cancel));
318            connect(eEG1StateOptions.checkBoxDecay2, mp.pmember);
319        }
320        {
321            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG1Options.ReleaseCancel));
322            connect(eEG1StateOptions.checkBoxRelease, mp.pmember);
323        }
324      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);      connect(eLFO1Frequency, &gig::DimensionRegion::LFO1Frequency);
325      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);      connect(eLFO1InternalDepth, &gig::DimensionRegion::LFO1InternalDepth);
326      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);      connect(eLFO1ControlDepth, &gig::DimensionRegion::LFO1ControlDepth);
# Line 285  DimRegionEdit::DimRegionEdit() : Line 342  DimRegionEdit::DimRegionEdit() :
342              &gig::DimensionRegion::EG2ControllerDecayInfluence);              &gig::DimensionRegion::EG2ControllerDecayInfluence);
343      connect(eEG2ControllerReleaseInfluence,      connect(eEG2ControllerReleaseInfluence,
344              &gig::DimensionRegion::EG2ControllerReleaseInfluence);              &gig::DimensionRegion::EG2ControllerReleaseInfluence);
345        {
346            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackCancel));
347            connect(eEG2StateOptions.checkBoxAttack, mp.pmember);
348        }
349        {
350            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.AttackHoldCancel));
351            connect(eEG2StateOptions.checkBoxAttackHold, mp.pmember);
352        }
353        {
354            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay1Cancel));
355            connect(eEG2StateOptions.checkBoxDecay1, mp.pmember);
356        }
357        {
358            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.Decay2Cancel));
359            connect(eEG2StateOptions.checkBoxDecay2, mp.pmember);
360        }
361        {
362            ClassMemberPtr<gig::DimensionRegion, bool> mp(offsetof(gig::DimensionRegion, EG2Options.ReleaseCancel));
363            connect(eEG2StateOptions.checkBoxRelease, mp.pmember);
364        }
365      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);      connect(eLFO2Frequency, &gig::DimensionRegion::LFO2Frequency);
366      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);      connect(eLFO2InternalDepth, &gig::DimensionRegion::LFO2InternalDepth);
367      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);      connect(eLFO2ControlDepth, &gig::DimensionRegion::LFO2ControlDepth);
# Line 467  DimRegionEdit::DimRegionEdit() : Line 544  DimRegionEdit::DimRegionEdit() :
544      wSample->set_tooltip_text(_("Drag & drop a sample here"));      wSample->set_tooltip_text(_("Drag & drop a sample here"));
545  #endif  #endif
546      addProp(eUnityNote);      addProp(eUnityNote);
547        addProp(eSampleGroup);
548      addProp(eSampleFormatInfo);      addProp(eSampleFormatInfo);
549      addProp(eSampleID);      addProp(eSampleID);
550        addProp(eChecksum);
551      addRightHandSide(buttonSelectSample);      addRightHandSide(buttonSelectSample);
552      addHeader(_("Optional Settings"));      addHeader(_("Optional Settings"));
553      addProp(eSampleStartOffset);      addProp(eSampleStartOffset);
# Line 510  DimRegionEdit::DimRegionEdit() : Line 589  DimRegionEdit::DimRegionEdit() :
589      addProp(eEG1ControllerAttackInfluence);      addProp(eEG1ControllerAttackInfluence);
590      addProp(eEG1ControllerDecayInfluence);      addProp(eEG1ControllerDecayInfluence);
591      addProp(eEG1ControllerReleaseInfluence);      addProp(eEG1ControllerReleaseInfluence);
592        addLine(eEG1StateOptions);
593    
594      nextPage();      nextPage();
595    
# Line 655  DimRegionEdit::DimRegionEdit() : Line 735  DimRegionEdit::DimRegionEdit() :
735      addProp(eEG2ControllerAttackInfluence);      addProp(eEG2ControllerAttackInfluence);
736      addProp(eEG2ControllerDecayInfluence);      addProp(eEG2ControllerDecayInfluence);
737      addProp(eEG2ControllerReleaseInfluence);      addProp(eEG2ControllerReleaseInfluence);
738        addLine(eEG2StateOptions);
739      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));      lLFO2 = addHeader(_("Filter Cutoff Oscillator (LFO2)"));
740      addProp(eLFO2Frequency);      addProp(eLFO2Frequency);
741      addProp(eLFO2InternalDepth);      addProp(eLFO2InternalDepth);
# Line 923  void DimRegionEdit::addProp(LabelWidget& Line 1004  void DimRegionEdit::addProp(LabelWidget&
1004      rowno++;      rowno++;
1005  }  }
1006    
1007    void DimRegionEdit::addLine(Gtk::HBox& line)
1008    {
1009        table[pageno]->attach(line, 1, 3, rowno, rowno + 1,
1010                              Gtk::FILL, Gtk::SHRINK);
1011        rowno++;
1012    }
1013    
1014  void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)  void DimRegionEdit::addRightHandSide(Gtk::Widget& widget)
1015  {  {
1016      table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,      table[pageno]->attach(widget, 2, 3, rowno, rowno + 1,
# Line 955  void DimRegionEdit::set_dim_region(gig:: Line 1043  void DimRegionEdit::set_dim_region(gig::
1043      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);      eEG1ControllerAttackInfluence.set_value(d->EG1ControllerAttackInfluence);
1044      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);      eEG1ControllerDecayInfluence.set_value(d->EG1ControllerDecayInfluence);
1045      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);      eEG1ControllerReleaseInfluence.set_value(d->EG1ControllerReleaseInfluence);
1046        eEG1StateOptions.checkBoxAttack.set_value(d->EG1Options.AttackCancel);
1047        eEG1StateOptions.checkBoxAttackHold.set_value(d->EG1Options.AttackHoldCancel);
1048        eEG1StateOptions.checkBoxDecay1.set_value(d->EG1Options.Decay1Cancel);
1049        eEG1StateOptions.checkBoxDecay2.set_value(d->EG1Options.Decay2Cancel);
1050        eEG1StateOptions.checkBoxRelease.set_value(d->EG1Options.ReleaseCancel);
1051      eLFO1Frequency.set_value(d->LFO1Frequency);      eLFO1Frequency.set_value(d->LFO1Frequency);
1052      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);      eLFO1InternalDepth.set_value(d->LFO1InternalDepth);
1053      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);      eLFO1ControlDepth.set_value(d->LFO1ControlDepth);
# Line 973  void DimRegionEdit::set_dim_region(gig:: Line 1066  void DimRegionEdit::set_dim_region(gig::
1066      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);      eEG2ControllerAttackInfluence.set_value(d->EG2ControllerAttackInfluence);
1067      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);      eEG2ControllerDecayInfluence.set_value(d->EG2ControllerDecayInfluence);
1068      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);      eEG2ControllerReleaseInfluence.set_value(d->EG2ControllerReleaseInfluence);
1069        eEG2StateOptions.checkBoxAttack.set_value(d->EG2Options.AttackCancel);
1070        eEG2StateOptions.checkBoxAttackHold.set_value(d->EG2Options.AttackHoldCancel);
1071        eEG2StateOptions.checkBoxDecay1.set_value(d->EG2Options.Decay1Cancel);
1072        eEG2StateOptions.checkBoxDecay2.set_value(d->EG2Options.Decay2Cancel);
1073        eEG2StateOptions.checkBoxRelease.set_value(d->EG2Options.ReleaseCancel);
1074      eLFO2Frequency.set_value(d->LFO2Frequency);      eLFO2Frequency.set_value(d->LFO2Frequency);
1075      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);      eLFO2InternalDepth.set_value(d->LFO2InternalDepth);
1076      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);      eLFO2ControlDepth.set_value(d->LFO2ControlDepth);
# Line 1021  void DimRegionEdit::set_dim_region(gig:: Line 1119  void DimRegionEdit::set_dim_region(gig::
1119      eMSDecode.set_value(d->MSDecode);      eMSDecode.set_value(d->MSDecode);
1120      eSampleStartOffset.set_value(d->SampleStartOffset);      eSampleStartOffset.set_value(d->SampleStartOffset);
1121      eUnityNote.set_value(d->UnityNote);      eUnityNote.set_value(d->UnityNote);
1122        // show sample group name
1123        {
1124            Glib::ustring s = "---";
1125            if (d->pSample && d->pSample->GetGroup())
1126                s = d->pSample->GetGroup()->Name;
1127            eSampleGroup.text.set_text(s);
1128        }
1129      // assemble sample format info string      // assemble sample format info string
1130      {      {
1131          Glib::ustring s;          Glib::ustring s;
# Line 1052  void DimRegionEdit::set_dim_region(gig:: Line 1157  void DimRegionEdit::set_dim_region(gig::
1157          }          }
1158          eSampleID.text.set_text(s);          eSampleID.text.set_text(s);
1159      }      }
1160        // generate raw wave form data CRC-32 checksum string
1161        {
1162            Glib::ustring s = "---";
1163            if (d->pSample) {
1164                char buf[64] = {};
1165                snprintf(buf, sizeof(buf), "%x", d->pSample->GetWaveDataCRC32Checksum());
1166                s = buf;
1167            }
1168            eChecksum.text.set_text(s);
1169        }
1170      buttonSelectSample.set_sensitive(d && d->pSample);      buttonSelectSample.set_sensitive(d && d->pSample);
1171      eFineTune.set_value(d->FineTune);      eFineTune.set_value(d->FineTune);
1172      eGain.set_value(d->Gain);      eGain.set_value(d->Gain);
# Line 1101  void DimRegionEdit::VCFEnabled_toggled() Line 1216  void DimRegionEdit::VCFEnabled_toggled()
1216      eEG2ControllerAttackInfluence.set_sensitive(sensitive);      eEG2ControllerAttackInfluence.set_sensitive(sensitive);
1217      eEG2ControllerDecayInfluence.set_sensitive(sensitive);      eEG2ControllerDecayInfluence.set_sensitive(sensitive);
1218      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);      eEG2ControllerReleaseInfluence.set_sensitive(sensitive);
1219        eEG2StateOptions.set_sensitive(sensitive);
1220      lLFO2->set_sensitive(sensitive);      lLFO2->set_sensitive(sensitive);
1221      eLFO2Frequency.set_sensitive(sensitive);      eLFO2Frequency.set_sensitive(sensitive);
1222      eLFO2InternalDepth.set_sensitive(sensitive);      eLFO2InternalDepth.set_sensitive(sensitive);
# Line 1294  void DimRegionEdit::loop_infinite_toggle Line 1410  void DimRegionEdit::loop_infinite_toggle
1410    
1411  bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)  bool DimRegionEdit::set_sample(gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
1412  {  {
1413        bool result = false;
1414      for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();      for (std::set<gig::DimensionRegion*>::iterator itDimReg = dimregs.begin();
1415           itDimReg != dimregs.end(); ++itDimReg)           itDimReg != dimregs.end(); ++itDimReg)
1416      {      {
1417          set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);          result |= set_sample(*itDimReg, sample, copy_sample_unity, copy_sample_tune, copy_sample_loop);
1418      }      }
1419        return result;
1420  }  }
1421    
1422  bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)  bool DimRegionEdit::set_sample(gig::DimensionRegion* dimreg, gig::Sample* sample, bool copy_sample_unity, bool copy_sample_tune, bool copy_sample_loop)
# Line 1307  bool DimRegionEdit::set_sample(gig::Dime Line 1425  bool DimRegionEdit::set_sample(gig::Dime
1425          //TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here          //TODO: we should better move the code from MainWindow::on_sample_label_drop_drag_data_received() here
1426    
1427          // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()          // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()
1428          //dimreg_to_be_changed_signal.emit(dimregion);          //DimRegionChangeGuard(this, dimregion);
1429    
1430          // make sure stereo samples always are the same in both          // make sure stereo samples always are the same in both
1431          // dimregs in the samplechannel dimension          // dimregs in the samplechannel dimension
# Line 1377  bool DimRegionEdit::set_sample(gig::Dime Line 1495  bool DimRegionEdit::set_sample(gig::Dime
1495          update_model--;          update_model--;
1496    
1497          sample_ref_changed_signal.emit(oldref, sample);          sample_ref_changed_signal.emit(oldref, sample);
         // currently commented because we're sending a similar signal in MainWindow::on_sample_label_drop_drag_data_received()  
         //dimreg_changed_signal.emit(dimreg);  
1498          return true;          return true;
1499      }      }
1500      return false;      return false;
# Line 1447  void DimRegionEdit::set_LoopEnabled(gig: Line 1563  void DimRegionEdit::set_LoopEnabled(gig:
1563      if (value) {      if (value) {
1564          // create a new sample loop in case there is none yet          // create a new sample loop in case there is none yet
1565          if (!d->SampleLoops) {          if (!d->SampleLoops) {
1566                DimRegionChangeGuard(this, d);
1567    
1568              DLS::sample_loop_t loop;              DLS::sample_loop_t loop;
1569              loop.LoopType = gig::loop_type_normal;              loop.LoopType = gig::loop_type_normal;
1570              // loop the whole sample by default              // loop the whole sample by default
1571              loop.LoopStart  = 0;              loop.LoopStart  = 0;
1572              loop.LoopLength =              loop.LoopLength =
1573                  (d->pSample) ? d->pSample->SamplesTotal : 0;                  (d->pSample) ? d->pSample->SamplesTotal : 0;
             dimreg_to_be_changed_signal.emit(d);  
1574              d->AddSampleLoop(&loop);              d->AddSampleLoop(&loop);
             dimreg_changed_signal.emit(d);  
1575          }          }
1576      } else {      } else {
1577          if (d->SampleLoops) {          if (d->SampleLoops) {
1578              dimreg_to_be_changed_signal.emit(d);              DimRegionChangeGuard(this, d);
1579    
1580              // delete ALL existing sample loops              // delete ALL existing sample loops
1581              while (d->SampleLoops) {              while (d->SampleLoops) {
1582                  d->DeleteSampleLoop(&d->pSampleLoops[0]);                  d->DeleteSampleLoop(&d->pSampleLoops[0]);
1583              }              }
             dimreg_changed_signal.emit(d);  
1584          }          }
1585      }      }
1586  }  }
# Line 1514  void DimRegionEdit::nullOutSampleReferen Line 1630  void DimRegionEdit::nullOutSampleReferen
1630      gig::Sample* oldref = dimregion->pSample;      gig::Sample* oldref = dimregion->pSample;
1631      if (!oldref) return;      if (!oldref) return;
1632    
1633      dimreg_to_be_changed_signal.emit(dimregion);      DimRegionChangeGuard(this, dimregion);
1634    
1635      // in case currently assigned sample is a stereo one, then remove both      // in case currently assigned sample is a stereo one, then remove both
1636      // references (expected to be due to a "stereo dimension")      // references (expected to be due to a "stereo dimension")
# Line 1552  void DimRegionEdit::nullOutSampleReferen Line 1668  void DimRegionEdit::nullOutSampleReferen
1668      set_dim_region(dimregion);      set_dim_region(dimregion);
1669    
1670      sample_ref_changed_signal.emit(oldref, NULL);      sample_ref_changed_signal.emit(oldref, NULL);
     dimreg_changed_signal.emit(dimregion);  
1671  }  }
1672    
1673  void DimRegionEdit::onButtonSelectSamplePressed() {  void DimRegionEdit::onButtonSelectSamplePressed() {

Legend:
Removed from v.2926  
changed lines
  Added in v.3329

  ViewVC Help
Powered by ViewVC