LfoController.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * LfoController.h - A LFO-based controller and dialog
  3. *
  4. * Copyright (c) 2008 Paul Giblock <drfaygo/at/gmail.com>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef LFO_CONTROLLER_H
  25. #define LFO_CONTROLLER_H
  26. #include <QWidget>
  27. #include "Model.h"
  28. #include "AutomatableModel.h"
  29. #include "Controller.h"
  30. #include "ControllerDialog.h"
  31. #include "TempoSyncKnobModel.h"
  32. #include "Oscillator.h"
  33. class automatableButtonGroup;
  34. class Knob;
  35. class LedCheckBox;
  36. class TempoSyncKnob;
  37. class PixmapButton;
  38. class LfoController : public Controller
  39. {
  40. Q_OBJECT
  41. public:
  42. LfoController( Model * _parent );
  43. virtual ~LfoController();
  44. void saveSettings( QDomDocument & _doc, QDomElement & _this ) override;
  45. void loadSettings( const QDomElement & _this ) override;
  46. QString nodeName() const override;
  47. public slots:
  48. ControllerDialog * createDialog( QWidget * _parent ) override;
  49. protected:
  50. // The internal per-controller value updating function
  51. void updateValueBuffer() override;
  52. FloatModel m_baseModel;
  53. TempoSyncKnobModel m_speedModel;
  54. FloatModel m_amountModel;
  55. FloatModel m_phaseModel;
  56. IntModel m_waveModel;
  57. IntModel m_multiplierModel;
  58. float m_duration;
  59. float m_phaseOffset;
  60. float m_currentPhase;
  61. sample_t (*m_sampleFunction)( const float );
  62. private:
  63. SampleBuffer * m_userDefSampleBuffer;
  64. protected slots:
  65. void updatePhase();
  66. void updateSampleFunction();
  67. void updateDuration();
  68. friend class LfoControllerDialog;
  69. } ;
  70. class LfoControllerDialog : public ControllerDialog
  71. {
  72. Q_OBJECT
  73. public:
  74. LfoControllerDialog( Controller * _controller, QWidget * _parent );
  75. virtual ~LfoControllerDialog();
  76. protected:
  77. void contextMenuEvent( QContextMenuEvent * _me ) override;
  78. void modelChanged() override;
  79. LfoController * m_lfo;
  80. Knob * m_baseKnob;
  81. TempoSyncKnob * m_speedKnob;
  82. Knob * m_amountKnob;
  83. Knob * m_phaseKnob;
  84. PixmapButton * m_userLfoBtn;
  85. automatableButtonGroup * m_waveBtnGrp;
  86. automatableButtonGroup * m_multiplierBtnGrp;
  87. private:
  88. PixmapButton * m_userWaveBtn;
  89. private slots:
  90. void askUserDefWave();
  91. } ;
  92. #endif