VstPlugin.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * VstPlugin.h - declaration of VstPlugin class
  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 _VST_PLUGIN_H
  25. #define _VST_PLUGIN_H
  26. #include <QMap>
  27. #include <QMutex>
  28. #include <QPointer>
  29. #include <QString>
  30. #include <QTimer>
  31. #include <QWidget>
  32. #include "JournallingObject.h"
  33. #include "communication.h"
  34. class vstSubWin;
  35. class PLUGIN_EXPORT VstPlugin : public RemotePlugin, public JournallingObject
  36. {
  37. Q_OBJECT
  38. public:
  39. VstPlugin( const QString & _plugin );
  40. virtual ~VstPlugin();
  41. void tryLoad( const QString &remoteVstPluginExecutable );
  42. virtual bool processMessage( const message & _m );
  43. inline bool hasEditor() const
  44. {
  45. return m_pluginWindowID != 0;
  46. }
  47. /// Same as pluginWidget(), but can be overwritten in sub-classes to modify
  48. /// behavior the UI. This is used in VstInstrumentPlugin to wrap the VST UI
  49. /// in a QMdiSubWindow
  50. virtual QWidget* editor();
  51. inline const QString & name() const
  52. {
  53. return m_name;
  54. }
  55. inline int version() const
  56. {
  57. return m_version;
  58. }
  59. inline const QString & vendorString() const
  60. {
  61. return m_vendorString;
  62. }
  63. inline const QString & productString() const
  64. {
  65. return m_productString;
  66. }
  67. inline const QString& currentProgramName() const
  68. {
  69. return m_currentProgramName;
  70. }
  71. inline const QString& allProgramNames() const
  72. {
  73. return m_allProgramNames;
  74. }
  75. int currentProgram();
  76. const QMap<QString, QString> & parameterDump();
  77. void setParameterDump( const QMap<QString, QString> & _pdump );
  78. QWidget * pluginWidget();
  79. virtual void loadSettings( const QDomElement & _this );
  80. virtual void saveSettings( QDomDocument & _doc, QDomElement & _this );
  81. inline virtual QString nodeName() const
  82. {
  83. return "vstplugin";
  84. }
  85. virtual void createUI(QWidget *parent);
  86. bool eventFilter(QObject *obj, QEvent *event);
  87. QString embedMethod() const;
  88. public slots:
  89. void setTempo( bpm_t _bpm );
  90. void updateSampleRate();
  91. void openPreset( void );
  92. void setProgram( int index );
  93. void rotateProgram( int offset );
  94. void loadProgramNames();
  95. void savePreset( void );
  96. void setParam( int i, float f );
  97. void idleUpdate();
  98. void showUI() override;
  99. void hideUI() override;
  100. void toggleUI() override;
  101. void handleClientEmbed();
  102. private:
  103. void loadChunk( const QByteArray & _chunk );
  104. QByteArray saveChunk();
  105. void toggleEditorVisibility(int visible = -1);
  106. QString m_plugin;
  107. QPointer<QWidget> m_pluginWidget;
  108. int m_pluginWindowID;
  109. QSize m_pluginGeometry;
  110. const QString m_embedMethod;
  111. bool m_badDllFormat;
  112. QString m_name;
  113. int m_version;
  114. QString m_vendorString;
  115. QString m_productString;
  116. QString m_currentProgramName;
  117. QString m_allProgramNames;
  118. QString p_name;
  119. QMap<QString, QString> m_parameterDump;
  120. int m_currentProgram;
  121. QTimer m_idleTimer;
  122. } ;
  123. #endif