From 47105d3aa254127943a8b2af8d980d9e392d8b41 Mon Sep 17 00:00:00 2001 From: yaw-man Date: Tue, 9 Aug 2022 14:41:00 -0300 Subject: [PATCH] Supprimer commentaires vieillis --- src/yaw-tab/dsp.cpp | 224 +++----------------------------------------- src/yaw-tab/ui.cpp | 121 +----------------------- 2 files changed, 17 insertions(+), 328 deletions(-) diff --git a/src/yaw-tab/dsp.cpp b/src/yaw-tab/dsp.cpp index 9668707..16c1b01 100644 --- a/src/yaw-tab/dsp.cpp +++ b/src/yaw-tab/dsp.cpp @@ -2,91 +2,27 @@ START_NAMESPACE_DISTRHO - class InfoExamplePlugin : public Plugin + class TabPlugin : public Plugin { public: - InfoExamplePlugin() + TabPlugin() : Plugin(kParameterCount, 0, 0) { // clear all parameters std::memset(fParameters, 0, sizeof(float) * kParameterCount); - /* we can know some things right at the start - fParameters[kParameterBufferSize] = getBufferSize(); - fParameters[kParameterCanRequestParameterValueChanges] = canRequestParameterValueChanges(); - */ } protected: - /* -------------------------------------------------------------------------------------------------------- - * Information */ + const char* getLabel() const override { return "yaw-tab"; } + const char* getDescription() const override { return "Drawing tablet synth UI"; } + const char* getMaker() const override { return "yaw-audio"; } + const char* getHomePage() const override { return "https://yaw.man/plugins/yaw-tab"; } + const char* getLicense() const override { return "ISC"; } + uint32_t getVersion() const override { return d_version(1, 0, 0); } + int64_t getUniqueId() const override { return d_cconst('y', 'w', 't', 'b'); } - /** - Get the plugin label. - This label is a short restricted name consisting of only _, a-z, A-Z and 0-9 characters. - */ - const char* getLabel() const override - { - return "yaw-tab"; - } - /** - Get an extensive comment/description about the plugin. - */ - const char* getDescription() const override - { - return "Drawing tablet synth UI"; - } - - /** - Get the plugin author/maker. - */ - const char* getMaker() const override - { - return "yaw-audio"; - } - - /** - Get the plugin homepage. - */ - const char* getHomePage() const override - { - return "https://yaw.man/plugins/yaw-tab"; - } - - /** - Get the plugin license name (a single line of text). - For commercial plugins this should return some short copyright information. - */ - const char* getLicense() const override - { - return "ISC"; - } - - /** - Get the plugin version, in hexadecimal. - */ - uint32_t getVersion() const override - { - return d_version(1, 0, 0); - } - - /** - Get the plugin unique Id. - This value is used by LADSPA, DSSI and VST plugin formats. - */ - int64_t getUniqueId() const override - { - return d_cconst('y', 'w', 't', 'b'); - } - - /* -------------------------------------------------------------------------------------------------------- - * Init */ - - /** - Initialize the parameter @a index. - This function will be called once, shortly after the plugin is created. - */ void initParameter(uint32_t index, Parameter& parameter) override { parameter.hints = kParameterIsAutomable | kParameterIsOutput; @@ -95,65 +31,7 @@ protected: parameter.ranges.max = 16777216.0f; switch (index) - {/* - case kParameterBufferSize: - parameter.name = "BufferSize"; - parameter.symbol = "buffer_size"; - break; - case kParameterCanRequestParameterValueChanges: - parameter.name = "Parameter Changes"; - parameter.symbol = "parameter_changes"; - parameter.hints |= kParameterIsBoolean; - parameter.ranges.max = 1.0f; - break; - case kParameterTimePlaying: - parameter.name = "TimePlaying"; - parameter.symbol = "time_playing"; - parameter.hints |= kParameterIsBoolean; - parameter.ranges.max = 1.0f; - break; - case kParameterTimeFrame: - parameter.name = "TimeFrame"; - parameter.symbol = "time_frame"; - break; - case kParameterTimeValidBBT: - parameter.name = "TimeValidBBT"; - parameter.symbol = "time_validbbt"; - parameter.hints |= kParameterIsBoolean; - parameter.ranges.max = 1.0f; - break; - case kParameterTimeBar: - parameter.name = "TimeBar"; - parameter.symbol = "time_bar"; - break; - case kParameterTimeBeat: - parameter.name = "TimeBeat"; - parameter.symbol = "time_beat"; - break; - case kParameterTimeTick: - parameter.name = "TimeTick"; - parameter.symbol = "time_tick"; - break; - case kParameterTimeBarStartTick: - parameter.name = "TimeBarStartTick"; - parameter.symbol = "time_barstarttick"; - break; - case kParameterTimeBeatsPerBar: - parameter.name = "TimeBeatsPerBar"; - parameter.symbol = "time_beatsperbar"; - break; - case kParameterTimeBeatType: - parameter.name = "TimeBeatType"; - parameter.symbol = "time_beattype"; - break; - case kParameterTimeTicksPerBeat: - parameter.name = "TimeTicksPerBeat"; - parameter.symbol = "time_ticksperbeat"; - break; - case kParameterTimeBeatsPerMinute: - parameter.name = "TimeBeatsPerMinute"; - parameter.symbol = "time_beatsperminute"; - break;*/ + { case kParameterTabletX: parameter.name = "x"; parameter.symbol = "x"; @@ -181,37 +59,17 @@ protected: } } - /* -------------------------------------------------------------------------------------------------------- - * Internal data */ - - /** - Get the current value of a parameter. - The host may call this function from any context, including realtime processing. - */ float getParameterValue(uint32_t index) const override { return fParameters[index]; } - /** - Change a parameter value. - The host may call this function from any context, including realtime processing. - When a parameter is marked as automable, you must ensure no non-realtime operations are performed. - @note This function will only be called for parameter inputs. - */ void setParameterValue(uint32_t, float) override { // this is only called for input parameters, which we have none of. } - /* -------------------------------------------------------------------------------------------------------- - * Audio/MIDI Processing */ - - /** - Run/process function for plugins without MIDI input. - @note Some parameters might be null if there are no audio inputs or outputs. - */ void run(const float** inputs, float** outputs, uint32_t frames) override { /** @@ -227,76 +85,18 @@ protected: // get time position const TimePosition& timePos(getTimePosition()); - - // set basic values - /* - fParameters[kParameterTimePlaying] = timePos.playing ? 1.0f : 0.0f; - fParameters[kParameterTimeFrame] = timePos.frame; - fParameters[kParameterTimeValidBBT] = timePos.bbt.valid ? 1.0f : 0.0f; - - // set bbt - if (timePos.bbt.valid) - { - fParameters[kParameterTimeBar] = timePos.bbt.bar; - fParameters[kParameterTimeBeat] = timePos.bbt.beat; - fParameters[kParameterTimeTick] = timePos.bbt.tick; - fParameters[kParameterTimeBarStartTick] = timePos.bbt.barStartTick; - fParameters[kParameterTimeBeatsPerBar] = timePos.bbt.beatsPerBar; - fParameters[kParameterTimeBeatType] = timePos.bbt.beatType; - fParameters[kParameterTimeTicksPerBeat] = timePos.bbt.ticksPerBeat; - fParameters[kParameterTimeBeatsPerMinute] = timePos.bbt.beatsPerMinute; - } - else - { - fParameters[kParameterTimeBar] = 0.0f; - fParameters[kParameterTimeBeat] = 0.0f; - fParameters[kParameterTimeTick] = 0.0f; - fParameters[kParameterTimeBarStartTick] = 0.0f; - fParameters[kParameterTimeBeatsPerBar] = 0.0f; - fParameters[kParameterTimeBeatType] = 0.0f; - fParameters[kParameterTimeTicksPerBeat] = 0.0f; - fParameters[kParameterTimeBeatsPerMinute] = 0.0f; - } - */ - - fParameters[kParameterTabletPressure] = timePos.bbt.tick; } - /* -------------------------------------------------------------------------------------------------------- - * Callbacks (optional) */ - - /** - Optional callback to inform the plugin about a buffer size change. - This function will only be called when the plugin is deactivated. - @note This value is only a hint! - Hosts might call run() with a higher or lower number of frames. - */ - void bufferSizeChanged(uint32_t newBufferSize) override - { - //fParameters[kParameterBufferSize] = newBufferSize; - } - - // ------------------------------------------------------------------------------------------------------- - private: - // Parameters float fParameters[kParameterCount]; - /** - Set our plugin class as non-copyable and add a leak detector just in case. - */ - DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(InfoExamplePlugin) + DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(TabPlugin) }; -/* ------------------------------------------------------------------------------------------------------------ - * Plugin entry point, called by DPF to create a new plugin instance. */ - Plugin* createPlugin() { - return new InfoExamplePlugin(); + return new TabPlugin(); } -// ----------------------------------------------------------------------------------------------------------- - END_NAMESPACE_DISTRHO diff --git a/src/yaw-tab/ui.cpp b/src/yaw-tab/ui.cpp index 6246121..523c6e4 100644 --- a/src/yaw-tab/ui.cpp +++ b/src/yaw-tab/ui.cpp @@ -3,13 +3,13 @@ START_NAMESPACE_DISTRHO -class InfoExampleUI : public UI +class TabUI : public UI { static const uint kInitialWidth = 405; static const uint kInitialHeight = 256; public: - InfoExampleUI() + TabUI() : UI(kInitialWidth, kInitialHeight), fSampleRate(getSampleRate()), fResizable(isResizable()), @@ -30,19 +30,9 @@ public: } protected: - /* -------------------------------------------------------------------------------------------------------- - * DSP/Plugin Callbacks */ - /** - A parameter has changed on the plugin side. - This is called by the host to inform the UI about parameter changes. - */ void parameterChanged(uint32_t index, float value) override { - // some hosts send parameter change events for output parameters even when nothing changed - // we catch that here in order to prevent excessive repaints - //if (d_isEqual(fParameters[index], value)) - // return; fParameters[index] = value; @@ -57,24 +47,14 @@ protected: repaint(); } - /* -------------------------------------------------------------------------------------------------------- - * DSP/Plugin Callbacks (optional) */ - /** - Optional callback to inform the UI about a sample rate change on the plugin side. - */ void sampleRateChanged(double newSampleRate) override { fSampleRate = newSampleRate; repaint(); } - /* -------------------------------------------------------------------------------------------------------- - * Widget Callbacks */ - /** - The NanoVG drawing function. - */ void onNanoDisplay() override { const float lineHeight = 20 * fScale; @@ -84,95 +64,6 @@ protected: float x = 0.0f * fScale; float y = 15.0f * fScale; - /* - // buffer size - drawLeft(x, y, "Buffer Size:"); - drawRight(x, y, getTextBufInt(fParameters[kParameterBufferSize])); - y += lineHeight; - - // sample rate - drawLeft(x, y, "Sample Rate:"); - drawRight(x, y, getTextBufFloat(fSampleRate)); - y += lineHeight; - - // separator - y += lineHeight; - - // time stuff - drawLeft(x, y, "Playing:"); - drawRight(x, y, (fParameters[kParameterTimePlaying] > 0.5f) ? "Yes" : "No"); - y += lineHeight; - - drawLeft(x, y, "Frame:"); - drawRight(x, y, getTextBufInt(fParameters[kParameterTimeFrame])); - y += lineHeight; - - drawLeft(x, y, "Time:"); - drawRight(x, y, getTextBufTime(fParameters[kParameterTimeFrame])); - y += lineHeight; - - // separator - y += lineHeight; - - // param changes - drawLeft(x, y, "Param Changes:", 20); - drawRight(x, y, (fParameters[kParameterCanRequestParameterValueChanges] > 0.5f) ? "Yes" : "No", 40); - y += lineHeight; - - // resizable - drawLeft(x, y, "Host resizable:", 20); - drawRight(x, y, fResizable ? "Yes" : "No", 40); - y += lineHeight; - - // host scale factor - drawLeft(x, y, "Host scale factor:", 20); - drawRight(x, y, getTextBufFloat(fScaleFactor), 40); - y += lineHeight; - - // BBT - x = 200.0f * fScale; - y = 15.0f * fScale; - - const bool validBBT(fParameters[kParameterTimeValidBBT] > 0.5f); - drawLeft(x, y, "BBT Valid:"); - drawRight(x, y, validBBT ? "Yes" : "No"); - y += lineHeight; - - if (!validBBT) - return; - - drawLeft(x, y, "Bar:"); - drawRight(x, y, getTextBufInt(fParameters[kParameterTimeBar])); - y += lineHeight; - - drawLeft(x, y, "Beat:"); - drawRight(x, y, getTextBufInt(fParameters[kParameterTimeBeat])); - y += lineHeight; - - drawLeft(x, y, "Tick:"); - drawRight(x, y, getTextBufFloatExtra(fParameters[kParameterTimeTick])); - y += lineHeight; - - drawLeft(x, y, "Bar Start Tick:"); - drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBarStartTick])); - y += lineHeight; - - drawLeft(x, y, "Beats Per Bar:"); - drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBeatsPerBar])); - y += lineHeight; - - drawLeft(x, y, "Beat Type:"); - drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBeatType])); - y += lineHeight; - - drawLeft(x, y, "Ticks Per Beat:"); - drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeTicksPerBeat])); - y += lineHeight; - - drawLeft(x, y, "BPM:"); - drawRight(x, y, getTextBufFloat(fParameters[kParameterTimeBeatsPerMinute])); - y += lineHeight; - */ drawLeft(x, y, "x:"); drawRight(x, y, getTextBufFloat(fParameters[kParameterTabletX])); y += lineHeight; @@ -275,17 +166,15 @@ private: /** Set our UI class as non-copyable and add a leak detector just in case. */ - DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(InfoExampleUI) + DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(TabUI) }; -/* ------------------------------------------------------------------------------------------------------------ - * UI entry point, called by DPF to create a new UI instance. */ + UI* createUI() { - return new InfoExampleUI(); + return new TabUI(); } -// ----------------------------------------------------------------------------------------------------------- END_NAMESPACE_DISTRHO