Mercurial > hg > pub > prymula > com
comparison DPF-Prymula-audioplugins/dpf/distrho/src/DistrhoUIStub.cpp @ 3:84e66ea83026
DPF-Prymula-audioplugins-0.231015-2
author | prymula <prymula76@outlook.com> |
---|---|
date | Mon, 16 Oct 2023 21:53:34 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:cf2cb71d31dd | 3:84e66ea83026 |
---|---|
1 /* | |
2 * DISTRHO Plugin Framework (DPF) | |
3 * Copyright (C) 2012-2022 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 | |
17 #include "DistrhoUIInternal.hpp" | |
18 | |
19 START_NAMESPACE_DISTRHO | |
20 | |
21 // -------------------------------------------------------------------------------------------------------------------- | |
22 | |
23 #if ! DISTRHO_PLUGIN_WANT_STATE | |
24 static constexpr const setStateFunc setStateCallback = nullptr; | |
25 #endif | |
26 #if ! DISTRHO_PLUGIN_WANT_MIDI_INPUT | |
27 static constexpr const sendNoteFunc sendNoteCallback = nullptr; | |
28 #endif | |
29 | |
30 // -------------------------------------------------------------------------------------------------------------------- | |
31 | |
32 /** | |
33 * Stub UI class, does nothing but serving as example code for other implementations. | |
34 */ | |
35 class UIStub | |
36 { | |
37 public: | |
38 UIStub(const intptr_t winId, | |
39 const double sampleRate, | |
40 const char* const bundlePath, | |
41 void* const dspPtr, | |
42 const float scaleFactor) | |
43 : fUI(this, winId, sampleRate, | |
44 editParameterCallback, | |
45 setParameterCallback, | |
46 setStateCallback, | |
47 sendNoteCallback, | |
48 setSizeCallback, | |
49 fileRequestCallback, | |
50 bundlePath, dspPtr, scaleFactor) | |
51 { | |
52 } | |
53 | |
54 // ---------------------------------------------------------------------------------------------------------------- | |
55 | |
56 private: | |
57 // Stub stuff here | |
58 | |
59 // Plugin UI (after Stub stuff so the UI can call into us during its constructor) | |
60 UIExporter fUI; | |
61 | |
62 // ---------------------------------------------------------------------------------------------------------------- | |
63 // DPF callbacks | |
64 | |
65 void editParameter(uint32_t, bool) const | |
66 { | |
67 } | |
68 | |
69 static void editParameterCallback(void* const ptr, const uint32_t rindex, const bool started) | |
70 { | |
71 static_cast<UIStub*>(ptr)->editParameter(rindex, started); | |
72 } | |
73 | |
74 void setParameterValue(uint32_t, float) | |
75 { | |
76 } | |
77 | |
78 static void setParameterCallback(void* const ptr, const uint32_t rindex, const float value) | |
79 { | |
80 static_cast<UIStub*>(ptr)->setParameterValue(rindex, value); | |
81 } | |
82 | |
83 void setSize(uint, uint) | |
84 { | |
85 } | |
86 | |
87 static void setSizeCallback(void* const ptr, const uint width, const uint height) | |
88 { | |
89 static_cast<UIStub*>(ptr)->setSize(width, height); | |
90 } | |
91 | |
92 #if DISTRHO_PLUGIN_WANT_STATE | |
93 void setState(const char*, const char*) | |
94 { | |
95 } | |
96 | |
97 static void setStateCallback(void* const ptr, const char* key, const char* value) | |
98 { | |
99 static_cast<UIStub*>(ptr)->setState(key, value); | |
100 } | |
101 #endif | |
102 | |
103 #if DISTRHO_PLUGIN_WANT_MIDI_INPUT | |
104 void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity) | |
105 { | |
106 } | |
107 | |
108 static void sendNoteCallback(void* const ptr, const uint8_t channel, const uint8_t note, const uint8_t velocity) | |
109 { | |
110 static_cast<UIStub*>(ptr)->sendNote(channel, note, velocity); | |
111 } | |
112 #endif | |
113 | |
114 bool fileRequest(const char*) | |
115 { | |
116 return true; | |
117 } | |
118 | |
119 static bool fileRequestCallback(void* const ptr, const char* const key) | |
120 { | |
121 return static_cast<UIStub*>(ptr)->fileRequest(key); | |
122 } | |
123 }; | |
124 | |
125 // -------------------------------------------------------------------------------------------------------------------- | |
126 | |
127 END_NAMESPACE_DISTRHO |