Cleanup
[carla.git] / source / native-plugins / notes.cpp
blobf369928d0b14c9e3511aa1e539671cc8cfc5e558
1 /*
2 * Carla Native Plugins
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation; either version 2 of
8 * the License, or any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * For a full copy of the GNU General Public License see the doc/GPL.txt file.
18 #include "CarlaDefines.h"
20 #include "CarlaNativeExtUI.hpp"
22 // -----------------------------------------------------------------------
24 class NotesPlugin : public NativePluginAndUiClass
26 public:
27 NotesPlugin(const NativeHostDescriptor* const host)
28 : NativePluginAndUiClass(host, "notes-ui"),
29 fCurPage(1) {}
31 protected:
32 // -------------------------------------------------------------------
33 // Plugin parameter calls
35 uint32_t getParameterCount() const override
37 return 1;
40 const NativeParameter* getParameterInfo(const uint32_t index) const override
42 if (index != 0)
43 return nullptr;
45 static NativeParameter param;
47 param.hints = static_cast<NativeParameterHints>(NATIVE_PARAMETER_IS_ENABLED
48 |NATIVE_PARAMETER_IS_AUTOMATABLE
49 |NATIVE_PARAMETER_IS_INTEGER);
50 param.name = "Page";
51 param.unit = nullptr;
52 param.ranges.def = 1.0f;
53 param.ranges.min = 1.0f;
54 param.ranges.max = 100.0f;
55 param.ranges.step = 1.0f;
56 param.ranges.stepSmall = 1.0f;
57 param.ranges.stepLarge = 1.0f;
58 param.scalePointCount = 0;
59 param.scalePoints = nullptr;
61 return &param;
64 float getParameterValue(const uint32_t index) const override
66 if (index != 0)
67 return 0.0f;
69 return static_cast<float>(fCurPage);
72 // -------------------------------------------------------------------
73 // Plugin state calls
75 void setParameterValue(const uint32_t index, const float value) override
77 if (index != 0)
78 return;
80 fCurPage = static_cast<int>(value);
83 // -------------------------------------------------------------------
84 // Plugin process calls
86 void process(const float* const*, float**, const uint32_t, const NativeMidiEvent* const, const uint32_t) override
90 private:
91 int fCurPage;
93 PluginClassEND(NotesPlugin)
94 CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NotesPlugin)
97 // -----------------------------------------------------------------------
99 static const NativePluginDescriptor notesDesc = {
100 /* category */ NATIVE_PLUGIN_CATEGORY_UTILITY,
101 /* hints */ static_cast<NativePluginHints>(NATIVE_PLUGIN_IS_RTSAFE
102 |NATIVE_PLUGIN_HAS_UI),
103 /* supports */ NATIVE_PLUGIN_SUPPORTS_NOTHING,
104 /* audioIns */ 0,
105 /* audioOuts */ 0,
106 /* midiIns */ 0,
107 /* midiOuts */ 0,
108 /* paramIns */ 1,
109 /* paramOuts */ 0,
110 /* name */ "Notes",
111 /* label */ "notes",
112 /* maker */ "falkTX",
113 /* copyright */ "GNU GPL v2+",
114 PluginDescriptorFILL(NotesPlugin)
117 // -----------------------------------------------------------------------
119 CARLA_API_EXPORT
120 void carla_register_native_plugin_notes();
122 CARLA_API_EXPORT
123 void carla_register_native_plugin_notes()
125 carla_register_native_plugin(&notesDesc);
128 // -----------------------------------------------------------------------