vestige.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. /*
  2. * vestige.h - instrument VeSTige for hosting VST-plugins
  3. *
  4. * Copyright (c) 2005-2014 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 _VESTIGE_H
  25. #define _VESTIGE_H
  26. #include <QMutex>
  27. #include <QLayout>
  28. #include <QMdiSubWindow>
  29. #include <QScrollArea>
  30. #include "Instrument.h"
  31. #include "InstrumentView.h"
  32. #include "Note.h"
  33. #include "Knob.h"
  34. #include "AutomatableModel.h"
  35. class QPixmap;
  36. class QPushButton;
  37. class PixmapButton;
  38. class VstPlugin;
  39. class vestigeInstrument : public Instrument
  40. {
  41. Q_OBJECT
  42. public:
  43. vestigeInstrument( InstrumentTrack * _instrument_track );
  44. virtual ~vestigeInstrument();
  45. virtual void play( sampleFrame * _working_buffer );
  46. virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
  47. virtual void loadSettings( const QDomElement & _this );
  48. virtual QString nodeName( void ) const;
  49. virtual void loadFile( const QString & _file );
  50. virtual Flags flags() const
  51. {
  52. return IsSingleStreamed | IsMidiBased;
  53. }
  54. virtual bool handleMidiEvent( const MidiEvent& event, const MidiTime& time, f_cnt_t offset = 0 );
  55. virtual PluginView * instantiateView( QWidget * _parent );
  56. protected slots:
  57. void setParameter( Model * action );
  58. void handleConfigChange( QString cls, QString attr, QString value );
  59. void reloadPlugin();
  60. private:
  61. void closePlugin( void );
  62. VstPlugin * m_plugin;
  63. QMutex m_pluginMutex;
  64. QString m_pluginDLL;
  65. QMdiSubWindow * m_subWindow;
  66. QScrollArea * m_scrollArea;
  67. FloatModel ** knobFModel;
  68. QObject * p_subWindow;
  69. int paramCount;
  70. friend class VestigeInstrumentView;
  71. friend class manageVestigeInstrumentView;
  72. } ;
  73. class manageVestigeInstrumentView : public InstrumentView
  74. {
  75. Q_OBJECT
  76. public:
  77. manageVestigeInstrumentView( Instrument * _instrument, QWidget * _parent, vestigeInstrument * m_vi2 );
  78. virtual ~manageVestigeInstrumentView();
  79. protected slots:
  80. void syncPlugin( void );
  81. void displayAutomatedOnly( void );
  82. void setParameter( Model * action );
  83. void closeWindow();
  84. protected:
  85. virtual void dragEnterEvent( QDragEnterEvent * _dee );
  86. virtual void dropEvent( QDropEvent * _de );
  87. virtual void paintEvent( QPaintEvent * _pe );
  88. private:
  89. static QPixmap * s_artwork;
  90. vestigeInstrument * m_vi;
  91. QWidget *widget;
  92. QGridLayout * l;
  93. QPushButton * m_syncButton;
  94. QPushButton * m_displayAutomatedOnly;
  95. QPushButton * m_closeButton;
  96. Knob ** vstKnobs;
  97. } ;
  98. class VestigeInstrumentView : public InstrumentView
  99. {
  100. Q_OBJECT
  101. public:
  102. VestigeInstrumentView( Instrument * _instrument, QWidget * _parent );
  103. virtual ~VestigeInstrumentView();
  104. protected slots:
  105. void updateMenu( void );
  106. void openPlugin( void );
  107. void managePlugin( void );
  108. void openPreset( void );
  109. void savePreset( void );
  110. void nextProgram();
  111. void previousProgram();
  112. void selPreset( void );
  113. void toggleGUI( void );
  114. void noteOffAll( void );
  115. protected:
  116. virtual void dragEnterEvent( QDragEnterEvent * _dee );
  117. virtual void dropEvent( QDropEvent * _de );
  118. virtual void paintEvent( QPaintEvent * _pe );
  119. private:
  120. virtual void modelChanged( void );
  121. static QPixmap * s_artwork;
  122. vestigeInstrument * m_vi;
  123. int lastPosInMenu;
  124. PixmapButton * m_openPluginButton;
  125. PixmapButton * m_openPresetButton;
  126. PixmapButton * m_rolLPresetButton;
  127. PixmapButton * m_rolRPresetButton;
  128. QPushButton * m_selPresetButton;
  129. QPushButton * m_toggleGUIButton;
  130. PixmapButton * m_managePluginButton;
  131. PixmapButton * m_savePresetButton;
  132. Instrument * _instrument2;
  133. QWidget * _parent2;
  134. } ;
  135. #endif