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
3.0KB

  1. /*
  2. * DISTRHO Plugin Toolkit (DPT)
  3. * Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any purpose with
  6. * or without fee is hereby granted, provided that the above copyright notice and this
  7. * permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
  10. * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
  11. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  12. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  13. * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  14. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. #ifndef DISTRHO_UI_HPP_INCLUDED
  17. #define DISTRHO_UI_HPP_INCLUDED
  18. #include "DistrhoUtils.hpp"
  19. START_NAMESPACE_DISTRHO
  20. // -----------------------------------------------------------------------
  21. // UI
  22. class UI
  23. {
  24. public:
  25. UI();
  26. virtual ~UI();
  27. // -------------------------------------------------------------------
  28. // Host DSP State
  29. double d_getSampleRate() const noexcept;
  30. void d_editParameter(uint32_t index, bool started);
  31. void d_setParameterValue(uint32_t index, float value);
  32. #if DISTRHO_PLUGIN_WANT_STATE
  33. void d_setState(const char* key, const char* value);
  34. #endif
  35. #if DISTRHO_PLUGIN_IS_SYNTH
  36. void d_sendNote(bool onOff, uint8_t channel, uint8_t note, uint8_t velocity);
  37. #endif
  38. // -------------------------------------------------------------------
  39. // Host UI State
  40. void d_uiResize(unsigned int width, unsigned int height);
  41. protected:
  42. // -------------------------------------------------------------------
  43. // Basic Information
  44. virtual const char* d_getName() const noexcept { return DISTRHO_PLUGIN_NAME; }
  45. virtual unsigned int d_getWidth() const noexcept = 0;
  46. virtual unsigned int d_getHeight() const noexcept = 0;
  47. // -------------------------------------------------------------------
  48. // DSP Callbacks
  49. virtual void d_parameterChanged(uint32_t index, float value) = 0;
  50. #if DISTRHO_PLUGIN_WANT_PROGRAMS
  51. virtual void d_programChanged(uint32_t index) = 0;
  52. #endif
  53. #if DISTRHO_PLUGIN_WANT_STATE
  54. virtual void d_stateChanged(const char* key, const char* value) = 0;
  55. #endif
  56. #if DISTRHO_PLUGIN_IS_SYNTH
  57. virtual void d_noteReceived(bool onOff, uint8_t channel, uint8_t note, uint8_t velocity) = 0;
  58. #endif
  59. // -------------------------------------------------------------------
  60. // UI Callbacks (optional)
  61. virtual void d_uiIdle() {}
  62. // -------------------------------------------------------------------
  63. private:
  64. struct PrivateData;
  65. PrivateData* const pData;
  66. friend class UIInternal;
  67. };
  68. // -----------------------------------------------------------------------
  69. // Create UI, entry point
  70. extern UI* createUI();
  71. // -----------------------------------------------------------------------
  72. END_NAMESPACE_DISTRHO
  73. #endif // DISTRHO_UI_HPP_INCLUDED