ZynAddSubFx.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * ZynAddSubFx.h - ZynAddSubFX-embedding plugin
  3. *
  4. * Copyright (c) 2008-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  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 ZYNADDSUBFX_H
  25. #define ZYNADDSUBFX_H
  26. #include <QMap>
  27. #include <QMutex>
  28. #include "AutomatableModel.h"
  29. #include "Instrument.h"
  30. #include "InstrumentView.h"
  31. #include "RemotePlugin.h"
  32. #include "zynaddsubfx/src/globals.h"
  33. class QPushButton;
  34. class LocalZynAddSubFx;
  35. class ZynAddSubFxView;
  36. class NotePlayHandle;
  37. class Knob;
  38. class LedCheckBox;
  39. class ZynAddSubFxRemotePlugin : public RemotePlugin
  40. {
  41. Q_OBJECT
  42. public:
  43. ZynAddSubFxRemotePlugin();
  44. virtual ~ZynAddSubFxRemotePlugin();
  45. virtual bool processMessage( const message & _m );
  46. signals:
  47. void clickedCloseButton();
  48. } ;
  49. class ZynAddSubFxInstrument : public Instrument
  50. {
  51. Q_OBJECT
  52. public:
  53. ZynAddSubFxInstrument( InstrumentTrack * _instrument_track );
  54. virtual ~ZynAddSubFxInstrument();
  55. virtual void play( sampleFrame * _working_buffer );
  56. virtual bool handleMidiEvent( const MidiEvent& event, const TimePos& time = TimePos(), f_cnt_t offset = 0 );
  57. virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
  58. virtual void loadSettings( const QDomElement & _this );
  59. virtual void loadFile( const QString & _file );
  60. virtual QString nodeName() const;
  61. virtual Flags flags() const
  62. {
  63. return IsSingleStreamed | IsMidiBased;
  64. }
  65. virtual PluginView * instantiateView( QWidget * _parent );
  66. private slots:
  67. void reloadPlugin();
  68. void updatePitchRange();
  69. void updatePortamento();
  70. void updateFilterFreq();
  71. void updateFilterQ();
  72. void updateBandwidth();
  73. void updateFmGain();
  74. void updateResCenterFreq();
  75. void updateResBandwidth();
  76. private:
  77. void initPlugin();
  78. void sendControlChange( MidiControllers midiCtl, float value );
  79. bool m_hasGUI;
  80. QMutex m_pluginMutex;
  81. LocalZynAddSubFx * m_plugin;
  82. ZynAddSubFxRemotePlugin * m_remotePlugin;
  83. FloatModel m_portamentoModel;
  84. FloatModel m_filterFreqModel;
  85. FloatModel m_filterQModel;
  86. FloatModel m_bandwidthModel;
  87. FloatModel m_fmGainModel;
  88. FloatModel m_resCenterFreqModel;
  89. FloatModel m_resBandwidthModel;
  90. BoolModel m_forwardMidiCcModel;
  91. QMap<int, bool> m_modifiedControllers;
  92. friend class ZynAddSubFxView;
  93. signals:
  94. void settingsChanged();
  95. } ;
  96. class ZynAddSubFxView : public InstrumentViewFixedSize
  97. {
  98. Q_OBJECT
  99. public:
  100. ZynAddSubFxView( Instrument * _instrument, QWidget * _parent );
  101. virtual ~ZynAddSubFxView();
  102. protected:
  103. virtual void dragEnterEvent( QDragEnterEvent * _dee );
  104. virtual void dropEvent( QDropEvent * _de );
  105. private:
  106. void modelChanged();
  107. QPushButton * m_toggleUIButton;
  108. Knob * m_portamento;
  109. Knob * m_filterFreq;
  110. Knob * m_filterQ;
  111. Knob * m_bandwidth;
  112. Knob * m_fmGain;
  113. Knob * m_resCenterFreq;
  114. Knob * m_resBandwidth;
  115. LedCheckBox * m_forwardMidiCC;
  116. private slots:
  117. void toggleUI();
  118. } ;
  119. #endif