BitcrushControlDialog.cpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * BitcrushControlDialog.cpp - A native bitcrusher
  3. *
  4. * Copyright (c) 2014 Vesa Kivimäki <contact/dot/diizy/at/nbl/dot/fi>
  5. * Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #include <QLayout>
  26. #include <QLabel>
  27. #include "BitcrushControlDialog.h"
  28. #include "BitcrushControls.h"
  29. #include "embed.h"
  30. #include "ToolTip.h"
  31. #include "LedCheckbox.h"
  32. #include "Knob.h"
  33. BitcrushControlDialog::BitcrushControlDialog( BitcrushControls * controls ) :
  34. EffectControlDialog( controls )
  35. {
  36. setAutoFillBackground( true );
  37. QPalette pal;
  38. pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
  39. setPalette( pal );
  40. setFixedSize( 181, 128 );
  41. // labels
  42. QLabel * inLabel = new QLabel( tr( "IN" ), this );
  43. inLabel->move( 24, 15 );
  44. QLabel * outLabel = new QLabel( tr( "OUT" ), this );
  45. outLabel->move( 139, 15 );
  46. // input knobs
  47. Knob * inGain = new Knob( knobBright_26, this );
  48. inGain->move( 16, 32 );
  49. inGain->setModel( & controls->m_inGain );
  50. inGain->setLabel( tr( "GAIN" ) );
  51. inGain->setHintText( tr( "Input gain:" ) , " dBFS" );
  52. Knob * inNoise = new Knob( knobBright_26, this );
  53. inNoise->move( 14, 76 );
  54. inNoise->setModel( & controls->m_inNoise );
  55. inNoise->setLabel( tr( "NOISE" ) );
  56. inNoise->setHintText( tr( "Input noise:" ) , "%" );
  57. // output knobs
  58. Knob * outGain = new Knob( knobBright_26, this );
  59. outGain->move( 138, 32 );
  60. outGain->setModel( & controls->m_outGain );
  61. outGain->setLabel( tr( "GAIN" ) );
  62. outGain->setHintText( tr( "Output gain:" ) , " dBFS" );
  63. Knob * outClip = new Knob( knobBright_26, this );
  64. outClip->move( 138, 76 );
  65. outClip->setModel( & controls->m_outClip );
  66. outClip->setLabel( tr( "CLIP" ) );
  67. outClip->setHintText( tr( "Output clip:" ) , " dBFS");
  68. // leds
  69. LedCheckBox * rateEnabled = new LedCheckBox( "", this, tr( "Rate enabled" ), LedCheckBox::Green );
  70. rateEnabled->move( 64, 14 );
  71. rateEnabled->setModel( & controls->m_rateEnabled );
  72. ToolTip::add( rateEnabled, tr( "Enable sample-rate crushing" ) );
  73. LedCheckBox * depthEnabled = new LedCheckBox( "", this, tr( "Depth enabled" ), LedCheckBox::Green );
  74. depthEnabled->move( 101, 14 );
  75. depthEnabled->setModel( & controls->m_depthEnabled );
  76. ToolTip::add( depthEnabled, tr( "Enable bit-depth crushing" ) );
  77. // rate crushing knobs
  78. Knob * rate = new Knob( knobBright_26, this );
  79. rate->move( 59, 32 );
  80. rate->setModel( & controls->m_rate );
  81. rate->setLabel( tr( "FREQ" ) );
  82. rate->setHintText( tr( "Sample rate:" ) , " Hz" );
  83. Knob * stereoDiff = new Knob( knobBright_26, this );
  84. stereoDiff->move( 72, 76 );
  85. stereoDiff->setModel( & controls->m_stereoDiff );
  86. stereoDiff->setLabel( tr( "STEREO" ) );
  87. stereoDiff->setHintText( tr( "Stereo difference:" ) , "%" );
  88. // depth crushing knob
  89. Knob * levels = new Knob( knobBright_26, this );
  90. levels->move( 92, 32 );
  91. levels->setModel( & controls->m_levels );
  92. levels->setLabel( tr( "QUANT" ) );
  93. levels->setHintText( tr( "Levels:" ) , "" );
  94. }