3434namespace lmms ::gui
3535{
3636
37-
38- #define makeknob ( name, x, y, model, label, hint, unit ) \
39- Knob * name = new Knob(KnobType::Bright26, label, SMALL_FONT_SIZE, this ); \
40- (name) -> move ( x, y ); \
41- (name) ->setModel ( &controls-> model ); \
42- (name) ->setHintText ( hint, unit );
43-
44-
45-
4637DualFilterControlDialog::DualFilterControlDialog ( DualFilterControls* controls ) :
4738 EffectControlDialog ( controls )
4839{
@@ -52,16 +43,24 @@ DualFilterControlDialog::DualFilterControlDialog( DualFilterControls* controls )
5243 setPalette ( pal );
5344 setFixedSize ( 373 , 109 );
5445
55- makeknob ( cut1Knob, 24 , 26 , m_cut1Model, tr ( " FREQ" ), tr ( " Cutoff frequency" ), " Hz" )
56- makeknob ( res1Knob, 74 , 26 , m_res1Model, tr ( " RESO" ), tr ( " Resonance" ), " " )
57- makeknob ( gain1Knob, 124 , 26 , m_gain1Model, tr ( " GAIN" ), tr ( " Gain" ), " %" )
58- makeknob ( mixKnob, 173 , 37 , m_mixModel, tr ( " MIX" ), tr ( " Mix" ), " " )
59- makeknob ( cut2Knob, 222 , 26 , m_cut2Model, tr ( " FREQ" ), tr ( " Cutoff frequency" ), " Hz" )
60- makeknob ( res2Knob, 272 , 26 , m_res2Model, tr ( " RESO" ), tr ( " Resonance" ), " " )
61- makeknob ( gain2Knob, 322 , 26 , m_gain2Model, tr ( " GAIN" ), tr ( " Gain" ), " %" )
62-
63- gain1Knob-> setVolumeKnob ( true );
64- gain2Knob-> setVolumeKnob ( true );
46+ auto makeKnob = [this ](int x, int y, Model* model,
47+ const QString& label, const QString& hint, const QString& unit, bool isVolumeKnob = false )
48+ {
49+ Knob* knob = isVolumeKnob
50+ ? new VolumeKnob (KnobType::Bright26, label, SMALL_FONT_SIZE, this )
51+ : new Knob (KnobType::Bright26, label, SMALL_FONT_SIZE, this );
52+ knob->move (x, y);
53+ knob->setModel (model);
54+ knob->setHintText (hint, unit);
55+ };
56+
57+ makeKnob (24 , 26 , &controls->m_cut1Model , tr (" FREQ" ), tr (" Cutoff frequency" ), " Hz" );
58+ makeKnob (74 , 26 , &controls->m_res1Model , tr (" RESO" ), tr (" Resonance" ), " " );
59+ makeKnob (124 , 26 , &controls->m_gain1Model , tr (" GAIN" ), tr (" Gain" ), " %" , true );
60+ makeKnob (173 , 37 , &controls->m_mixModel , tr (" MIX" ), tr (" Mix" ), " " );
61+ makeKnob (222 , 26 , &controls->m_cut2Model , tr (" FREQ" ), tr (" Cutoff frequency" ), " Hz" );
62+ makeKnob (272 , 26 , &controls->m_res2Model , tr (" RESO" ), tr (" Resonance" ), " " );
63+ makeKnob (322 , 26 , &controls->m_gain2Model , tr (" GAIN" ), tr (" Gain" ), " %" , true );
6564
6665 auto enabled1Toggle = new LedCheckBox (" " , this , tr (" Filter 1 enabled" ), LedCheckBox::LedColor::Green);
6766 auto enabled2Toggle = new LedCheckBox (" " , this , tr (" Filter 2 enabled" ), LedCheckBox::LedColor::Green);
0 commit comments