bundle depth sliders into the envelopes
This commit is contained in:
@@ -24,16 +24,16 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
// connect envelopeGenerators
|
||||
connect(ui_->envelopeOsc1Volume, &EnvelopeGenerator::envelopeChanged,
|
||||
this, [this](float a, float d, float s, float r) {
|
||||
audio_->parameters()->set(EnvelopeId::Osc1Volume, a, d, s, r);
|
||||
this, [this](float depth, float a, float d, float s, float r) {
|
||||
audio_->parameters()->set(EnvelopeId::Osc1Volume, depth, a, d, s, r);
|
||||
});
|
||||
connect(ui_->envelopeFilterCutoff, &EnvelopeGenerator::envelopeChanged,
|
||||
this, [this](float a, float d, float s, float r) {
|
||||
audio_->parameters()->set(EnvelopeId::FilterCutoff, a, d, s, r);
|
||||
this, [this](float depth, float a, float d, float s, float r) {
|
||||
audio_->parameters()->set(EnvelopeId::FilterCutoff, depth, a, d, s, r);
|
||||
});
|
||||
connect(ui_->envelopeFilterResonance, &EnvelopeGenerator::envelopeChanged,
|
||||
this, [this](float a, float d, float s, float r) {
|
||||
audio_->parameters()->set(EnvelopeId::FilterResonance, a, d, s, r);
|
||||
this, [this](float depth, float a, float d, float s, float r) {
|
||||
audio_->parameters()->set(EnvelopeId::FilterResonance, depth, a, d, s, r);
|
||||
});
|
||||
// this should be easy enough to put into a for each envelopeGenerator loop, each ui element just needs an EnvelopeId specifiers
|
||||
|
||||
@@ -47,16 +47,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
audio_->parameters()->set(ParamId::Osc1WaveSelector2, index);
|
||||
});
|
||||
|
||||
connect(ui_->sliderOsc1Volume, &SmartSlider::valueChanged, this, [this](float v) {
|
||||
audio_->parameters()->set(ParamId::Osc1Volume, v);
|
||||
});
|
||||
connect(ui_->sliderFilterCutoff, &SmartSlider::valueChanged, this, [this](float v) {
|
||||
audio_->parameters()->set(ParamId::FilterCutoff, v);
|
||||
});
|
||||
connect(ui_->sliderFilterResonance, &SmartSlider::valueChanged, this, [this](float v) {
|
||||
audio_->parameters()->set(ParamId::FilterResonance, v);
|
||||
});
|
||||
|
||||
// synth business
|
||||
audio_->start();
|
||||
|
||||
@@ -87,11 +77,4 @@ void MainWindow::onResetClicked() {
|
||||
ui_->comboOsc1WaveSelector1->setCurrentIndex(static_cast<int>(PARAM_DEFS[static_cast<size_t>(ParamId::Osc1WaveSelector1)].def));
|
||||
ui_->comboOsc1WaveSelector2->setCurrentIndex(static_cast<int>(PARAM_DEFS[static_cast<size_t>(ParamId::Osc1WaveSelector2)].def));
|
||||
|
||||
// misc sliders
|
||||
ui_->sliderOsc1Volume->setRange(PARAM_DEFS[static_cast<size_t>(ParamId::Osc1Volume)].min, PARAM_DEFS[static_cast<size_t>(ParamId::Osc1Volume)].max);
|
||||
ui_->sliderFilterCutoff->setRange(PARAM_DEFS[static_cast<size_t>(ParamId::FilterCutoff)].min, PARAM_DEFS[static_cast<size_t>(ParamId::FilterCutoff)].max);
|
||||
ui_->sliderFilterResonance->setRange(PARAM_DEFS[static_cast<size_t>(ParamId::FilterResonance)].min, PARAM_DEFS[static_cast<size_t>(ParamId::FilterResonance)].max);
|
||||
ui_->sliderOsc1Volume->setValue(PARAM_DEFS[static_cast<size_t>(ParamId::Osc1Volume)].def);
|
||||
ui_->sliderFilterCutoff->setValue(PARAM_DEFS[static_cast<size_t>(ParamId::FilterCutoff)].def);
|
||||
ui_->sliderFilterResonance->setValue(PARAM_DEFS[static_cast<size_t>(ParamId::FilterResonance)].def);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>940</width>
|
||||
<height>658</height>
|
||||
<width>1102</width>
|
||||
<height>564</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -39,8 +39,8 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>360</y>
|
||||
<width>300</width>
|
||||
<y>260</y>
|
||||
<width>350</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -54,7 +54,7 @@
|
||||
<widget class="Scope" name="scope" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<x>360</x>
|
||||
<y>20</y>
|
||||
<width>400</width>
|
||||
<height>200</height>
|
||||
@@ -67,9 +67,9 @@
|
||||
<widget class="EnvelopeGenerator" name="envelopeFilterCutoff" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>360</y>
|
||||
<width>300</width>
|
||||
<x>380</x>
|
||||
<y>260</y>
|
||||
<width>350</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -83,9 +83,9 @@
|
||||
<widget class="EnvelopeGenerator" name="envelopeFilterResonance" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>360</y>
|
||||
<width>300</width>
|
||||
<x>740</x>
|
||||
<y>260</y>
|
||||
<width>350</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -99,8 +99,8 @@
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>330</y>
|
||||
<x>140</x>
|
||||
<y>230</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@@ -120,8 +120,8 @@
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>330</y>
|
||||
<x>500</x>
|
||||
<y>230</y>
|
||||
<width>101</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@@ -141,8 +141,8 @@
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>710</x>
|
||||
<y>330</y>
|
||||
<x>860</x>
|
||||
<y>230</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
@@ -261,108 +261,6 @@
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="SmartSlider" name="sliderFilterCutoff" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>770</x>
|
||||
<y>30</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="SmartSlider" name="sliderOsc1Volume" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>700</x>
|
||||
<y>30</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="SmartSlider" name="sliderFilterResonance" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>840</x>
|
||||
<y>30</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>690</x>
|
||||
<y>10</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Volume</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>760</x>
|
||||
<y>10</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cutoff</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>830</x>
|
||||
<y>10</y>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Resonance</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -372,12 +270,6 @@
|
||||
<header>EnvelopeGenerator/EnvelopeGenerator.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>SmartSlider</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>SmartSlider/SmartSlider.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Scope</class>
|
||||
<extends>QWidget</extends>
|
||||
|
||||
@@ -15,6 +15,7 @@ EnvelopeGenerator::EnvelopeGenerator(QWidget* parent) : QWidget(parent), ui_(new
|
||||
this, &EnvelopeGenerator::emitEnvelope);
|
||||
};
|
||||
|
||||
connectSlider(ui_->sliderDepth);
|
||||
connectSlider(ui_->sliderAttack);
|
||||
connectSlider(ui_->sliderDecay);
|
||||
connectSlider(ui_->sliderSustain);
|
||||
@@ -26,6 +27,10 @@ EnvelopeGenerator::~EnvelopeGenerator() {
|
||||
}
|
||||
|
||||
// getters are here to separate ui from header
|
||||
float EnvelopeGenerator::depth() const {
|
||||
return ui_->sliderDepth->value();
|
||||
}
|
||||
|
||||
float EnvelopeGenerator::attack() const {
|
||||
return ui_->sliderAttack->value();
|
||||
}
|
||||
@@ -42,6 +47,10 @@ float EnvelopeGenerator::release() const {
|
||||
return ui_->sliderRelease->value();
|
||||
}
|
||||
|
||||
void EnvelopeGenerator::setDepth(float v) {
|
||||
ui_->sliderDepth->setValue(v);
|
||||
}
|
||||
|
||||
void EnvelopeGenerator::setAttack(float v) {
|
||||
ui_->sliderAttack->setValue(v);
|
||||
}
|
||||
@@ -60,6 +69,7 @@ void EnvelopeGenerator::setRelease(float v) {
|
||||
|
||||
void EnvelopeGenerator::emitEnvelope() {
|
||||
emit envelopeChanged(
|
||||
depth(),
|
||||
attack(),
|
||||
decay(),
|
||||
sustain(),
|
||||
@@ -71,11 +81,13 @@ void EnvelopeGenerator::init(EnvelopeId id) {
|
||||
|
||||
EnvelopeParam params = ENV_PARAMS[static_cast<size_t>(id)];
|
||||
|
||||
ui_->sliderDepth->setRange(PARAM_DEFS[static_cast<size_t>(params.depth)].min, PARAM_DEFS[static_cast<size_t>(params.depth)].max);
|
||||
ui_->sliderAttack->setRange(PARAM_DEFS[static_cast<size_t>(params.a)].min, PARAM_DEFS[static_cast<size_t>(params.a)].max);
|
||||
ui_->sliderDecay->setRange(PARAM_DEFS[static_cast<size_t>(params.d)].min, PARAM_DEFS[static_cast<size_t>(params.d)].max);
|
||||
ui_->sliderSustain->setRange(PARAM_DEFS[static_cast<size_t>(params.s)].min, PARAM_DEFS[static_cast<size_t>(params.s)].max);
|
||||
ui_->sliderRelease->setRange(PARAM_DEFS[static_cast<size_t>(params.r)].min, PARAM_DEFS[static_cast<size_t>(params.r)].max);
|
||||
|
||||
setDepth(PARAM_DEFS[static_cast<size_t>(params.depth)].def);
|
||||
setAttack(PARAM_DEFS[static_cast<size_t>(params.a)].def);
|
||||
setDecay(PARAM_DEFS[static_cast<size_t>(params.d)].def);
|
||||
setSustain(PARAM_DEFS[static_cast<size_t>(params.s)].def);
|
||||
|
||||
@@ -20,19 +20,21 @@ public:
|
||||
void init(EnvelopeId id);
|
||||
|
||||
// setters
|
||||
void setDepth(float v);
|
||||
void setAttack(float v);
|
||||
void setDecay(float v);
|
||||
void setSustain(float v);
|
||||
void setRelease(float v);
|
||||
|
||||
// getters
|
||||
float depth() const;
|
||||
float attack() const;
|
||||
float decay() const;
|
||||
float sustain() const;
|
||||
float release() const;
|
||||
|
||||
signals:
|
||||
void envelopeChanged(double a, double d, double s, double r);
|
||||
void envelopeChanged(double depth, double a, double d, double s, double r);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>300</width>
|
||||
<height>300</height>
|
||||
<width>347</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@@ -22,7 +22,7 @@
|
||||
<widget class="SmartSlider" name="sliderDecay" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<x>140</x>
|
||||
<y>20</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
@@ -35,7 +35,7 @@
|
||||
<widget class="SmartSlider" name="sliderRelease" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<x>280</x>
|
||||
<y>20</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
@@ -48,7 +48,7 @@
|
||||
<widget class="SmartSlider" name="sliderSustain" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<x>210</x>
|
||||
<y>20</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
@@ -61,7 +61,7 @@
|
||||
<widget class="SmartSlider" name="sliderAttack" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<x>70</x>
|
||||
<y>20</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
@@ -71,36 +71,10 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>290</y>
|
||||
<width>291</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>291</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<x>90</x>
|
||||
<y>-10</y>
|
||||
<width>21</width>
|
||||
<height>31</height>
|
||||
@@ -121,7 +95,7 @@
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<x>160</x>
|
||||
<y>-10</y>
|
||||
<width>21</width>
|
||||
<height>31</height>
|
||||
@@ -142,7 +116,7 @@
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<x>230</x>
|
||||
<y>-10</y>
|
||||
<width>20</width>
|
||||
<height>31</height>
|
||||
@@ -163,7 +137,7 @@
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<x>300</x>
|
||||
<y>-10</y>
|
||||
<width>20</width>
|
||||
<height>31</height>
|
||||
@@ -181,6 +155,66 @@
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="SmartSlider" name="sliderDepth" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>20</y>
|
||||
<width>65</width>
|
||||
<height>280</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>346</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>290</y>
|
||||
<width>346</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-10</y>
|
||||
<width>71</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Depth</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignmentFlag::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
||||
Reference in New Issue
Block a user