File: compressorgui.cpp

package info (click to toggle)
musescore 2.0.3%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 202,532 kB
  • ctags: 58,769
  • sloc: cpp: 257,595; xml: 172,226; ansic: 139,931; python: 6,565; sh: 6,383; perl: 423; makefile: 290; awk: 142; pascal: 67; sed: 3
file content (102 lines) | stat: -rw-r--r-- 4,439 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//=============================================================================
//  MuseSynth
//  Music Software Synthesizer
//
//  Copyright (C) 2013 Werner Schweer
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License version 2
//  as published by the Free Software Foundation and appearing in
//  the file LICENCE.GPL
//=============================================================================

#include "compressor.h"
#include "effects/effectgui.h"
#include "ui_compressor_gui.h"

namespace Ms {

//---------------------------------------------------------
//   gui
//---------------------------------------------------------

class CompressorGui : public EffectGui {
      Q_OBJECT

      Ui::CompressorGui cg;

      virtual void updateValues();

   public:
      CompressorGui(Compressor*, QWidget* parent = 0);
      };

//---------------------------------------------------------
//   gui
//---------------------------------------------------------

EffectGui* Compressor::gui()
      {
      if (!_gui) {
            _gui = new CompressorGui(this);
            _gui->setGeometry(0, 0, 640, 79);
            }
      return _gui;
      }

//---------------------------------------------------------
//    CompressorGui
//---------------------------------------------------------

CompressorGui::CompressorGui(Compressor* effect, QWidget* parent)
   : EffectGui(effect, parent)
      {
      cg.setupUi(this);
      connect(cg.rms,        SIGNAL(valueChanged(double,int)),                SLOT(valueChanged(double,int)));
      connect(cg.rms,        SIGNAL(valueChanged(double,int)), cg.rmsSpinBox, SLOT(setValue(double)));
      connect(cg.rmsSpinBox, SIGNAL(valueChanged(double)),     cg.rms,        SLOT(setValue(double)));

      connect(cg.attack,        SIGNAL(valueChanged(double,int)),                   SLOT(valueChanged(double,int)));
      connect(cg.attack,        SIGNAL(valueChanged(double,int)), cg.attackSpinBox, SLOT(setValue(double)));
      connect(cg.attackSpinBox, SIGNAL(valueChanged(double)),     cg.attack,        SLOT(setValue(double)));

      connect(cg.release,        SIGNAL(valueChanged(double,int)),                    SLOT(valueChanged(double,int)));
      connect(cg.release,        SIGNAL(valueChanged(double,int)), cg.releaseSpinBox, SLOT(setValue(double)));
      connect(cg.releaseSpinBox, SIGNAL(valueChanged(double)),     cg.release,        SLOT(setValue(double)));

      connect(cg.threshold,        SIGNAL(valueChanged(double,int)),                      SLOT(valueChanged(double,int)));
      connect(cg.threshold,        SIGNAL(valueChanged(double,int)), cg.thresholdSpinBox, SLOT(setValue(double)));
      connect(cg.thresholdSpinBox, SIGNAL(valueChanged(double)),     cg.threshold,        SLOT(setValue(double)));

      connect(cg.ratio,        SIGNAL(valueChanged(double,int)),                  SLOT(valueChanged(double,int)));
      connect(cg.ratio,        SIGNAL(valueChanged(double,int)), cg.ratioSpinBox, SLOT(setValue(double)));
      connect(cg.ratioSpinBox, SIGNAL(valueChanged(double)),     cg.ratio,        SLOT(setValue(double)));

      connect(cg.knee,        SIGNAL(valueChanged(double,int)),                 SLOT(valueChanged(double,int)));
      connect(cg.knee,        SIGNAL(valueChanged(double,int)), cg.kneeSpinBox, SLOT(setValue(double)));
      connect(cg.kneeSpinBox, SIGNAL(valueChanged(double)),     cg.knee,        SLOT(setValue(double)));

      connect(cg.gain,        SIGNAL(valueChanged(double,int)),                 SLOT(valueChanged(double,int)));
      connect(cg.gain,        SIGNAL(valueChanged(double,int)), cg.gainSpinBox, SLOT(setValue(double)));
      connect(cg.gainSpinBox, SIGNAL(valueChanged(double)),     cg.gain,        SLOT(setValue(double)));
      }

//---------------------------------------------------------
// updateValues
//---------------------------------------------------------

void CompressorGui::updateValues()
      {
      cg.rmsSpinBox->setValue(effect()->nvalue(0));
      cg.attackSpinBox->setValue(effect()->nvalue(1));
      cg.releaseSpinBox->setValue(effect()->nvalue(2));
      cg.thresholdSpinBox->setValue(effect()->nvalue(3));
      cg.ratioSpinBox->setValue(effect()->nvalue(4));
      cg.kneeSpinBox->setValue(effect()->nvalue(5));
      cg.gainSpinBox->setValue(effect()->nvalue(6));
      }

#include "compressorgui.moc"

}