Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.5KB

  1. /*
  2. * DISTRHO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * For a full copy of the license see the LGPL.txt file
  15. */
  16. #ifndef __DISTRHO_UI_HPP__
  17. #define __DISTRHO_UI_HPP__
  18. #include "DistrhoUtils.hpp"
  19. START_NAMESPACE_DISTRHO
  20. // -------------------------------------------------
  21. // UI
  22. struct UIPrivateData;
  23. class UI
  24. {
  25. public:
  26. UI();
  27. virtual ~UI();
  28. // ---------------------------------------------
  29. // Host DSP State
  30. double d_sampleRate() const;
  31. void d_editParameter(uint32_t index, bool started);
  32. void d_setParameterValue(uint32_t index, float value);
  33. #if DISTRHO_PLUGIN_WANT_STATE
  34. void d_setState(const char* key, const char* value);
  35. #endif
  36. #if DISTRHO_PLUGIN_IS_SYNTH
  37. void d_sendNote(bool onOff, uint8_t channel, uint8_t note, uint8_t velocity);
  38. #endif
  39. // ---------------------------------------------
  40. // Host UI State
  41. void d_uiResize(unsigned int width, unsigned int height);
  42. protected:
  43. // ---------------------------------------------
  44. // Information
  45. virtual const char* d_name() const { return DISTRHO_PLUGIN_NAME; }
  46. virtual unsigned int d_width() const = 0;
  47. virtual unsigned int d_height() const = 0;
  48. // ---------------------------------------------
  49. // DSP Callbacks
  50. virtual void d_parameterChanged(uint32_t index, float value) = 0;
  51. #if DISTRHO_PLUGIN_WANT_PROGRAMS
  52. virtual void d_programChanged(uint32_t index) = 0;
  53. #endif
  54. #if DISTRHO_PLUGIN_WANT_STATE
  55. virtual void d_stateChanged(const char* key, const char* value) = 0;
  56. #endif
  57. #if DISTRHO_PLUGIN_IS_SYNTH
  58. virtual void d_noteReceived(bool onOff, uint8_t channel, uint8_t note, uint8_t velocity) = 0;
  59. #endif
  60. // ---------------------------------------------
  61. // UI Callbacks
  62. virtual void d_uiIdle() = 0;
  63. // ---------------------------------------------
  64. private:
  65. UIPrivateData* const pData;
  66. friend class UIInternal;
  67. };
  68. // -------------------------------------------------
  69. UI* createUI();
  70. // -------------------------------------------------
  71. END_NAMESPACE_DISTRHO
  72. #endif // __DISTRHO_UI_HPP__