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.

105 lines
3.3KB

  1. /*
  2. * DISTRHO Plugin Framework (DPF)
  3. * Copyright (C) 2012-2014 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 "extra/d_leakdetector.hpp"
  19. #include "src/DistrhoPluginChecks.h"
  20. #include "../dgl/Widget.hpp"
  21. START_NAMESPACE_DISTRHO
  22. // -----------------------------------------------------------------------
  23. // UI
  24. class UI : public DGL::Widget
  25. {
  26. public:
  27. UI();
  28. virtual ~UI();
  29. // -------------------------------------------------------------------
  30. // Host DSP State
  31. double d_getSampleRate() const noexcept;
  32. void d_editParameter(uint32_t index, bool started);
  33. void d_setParameterValue(uint32_t index, float value);
  34. #if DISTRHO_PLUGIN_WANT_STATE
  35. void d_setState(const char* key, const char* value);
  36. #endif
  37. #if DISTRHO_PLUGIN_IS_SYNTH
  38. void d_sendNote(uint8_t channel, uint8_t note, uint8_t velocity);
  39. #endif
  40. // -------------------------------------------------------------------
  41. // Host UI State
  42. void d_uiResize(uint width, uint height);
  43. protected:
  44. // -------------------------------------------------------------------
  45. // Basic Information
  46. virtual const char* d_getName() const noexcept { return DISTRHO_PLUGIN_NAME; }
  47. virtual uint d_getWidth() const noexcept = 0;
  48. virtual uint d_getHeight() const noexcept = 0;
  49. // -------------------------------------------------------------------
  50. // DSP Callbacks
  51. virtual void d_parameterChanged(uint32_t index, float value) = 0;
  52. #if DISTRHO_PLUGIN_WANT_PROGRAMS
  53. virtual void d_programChanged(uint32_t index) = 0;
  54. #endif
  55. #if DISTRHO_PLUGIN_WANT_STATE
  56. virtual void d_stateChanged(const char* key, const char* value) = 0;
  57. #endif
  58. // -------------------------------------------------------------------
  59. // UI Callbacks (optional)
  60. virtual void d_uiIdle() {}
  61. #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
  62. // -------------------------------------------------------------------
  63. // Direct DSP access - DO NOT USE THIS UNLESS STRICTLY NECESSARY!!
  64. void* d_getPluginInstancePointer() const noexcept;
  65. #endif
  66. // -------------------------------------------------------------------
  67. private:
  68. struct PrivateData;
  69. PrivateData* const pData;
  70. friend class UIExporter;
  71. DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(UI)
  72. };
  73. // -----------------------------------------------------------------------
  74. // Create UI, entry point
  75. extern UI* createUI();
  76. // -----------------------------------------------------------------------
  77. END_NAMESPACE_DISTRHO
  78. #endif // DISTRHO_UI_HPP_INCLUDED