|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /*
- * DISTRHO Notes Plugin
- * Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * For a full copy of the GNU General Public License see the doc/GPL.txt file.
- */
-
- #include "DistrhoPluginNotes.hpp"
-
- #include <cmath>
-
- START_NAMESPACE_DISTRHO
-
- // -----------------------------------------------------------------------
-
- DistrhoPluginNotes::DistrhoPluginNotes()
- : Plugin(1, 0, 103) // 1 parameter, 0 programs, 103 states
- {
- fCurPage = 0;
- }
-
- DistrhoPluginNotes::~DistrhoPluginNotes()
- {
- }
-
- // -----------------------------------------------------------------------
- // Init
-
- void DistrhoPluginNotes::d_initParameter(uint32_t index, Parameter& parameter)
- {
- if (index != 0)
- return;
-
- parameter.hints = PARAMETER_IS_AUTOMABLE | PARAMETER_IS_INTEGER;
- parameter.name = "Page";
- parameter.symbol = "page";
- parameter.ranges.def = 1;
- parameter.ranges.min = 1;
- parameter.ranges.max = 100;
- parameter.ranges.step = 1;
- parameter.ranges.stepSmall = 1;
- parameter.ranges.stepLarge = 10;
- }
-
- void DistrhoPluginNotes::d_initStateKey(uint32_t index, d_string& stateKey)
- {
- switch (index)
- {
- case 0:
- stateKey = "readOnly";
- break;
- case 1 ... 100:
- stateKey = "pageText #" + d_string(index);
- break;
- case 101:
- stateKey = "guiWidth";
- break;
- case 102:
- stateKey = "guiHeight";
- break;
- }
- }
-
- // -----------------------------------------------------------------------
- // Internal data
-
- float DistrhoPluginNotes::d_getParameterValue(uint32_t index) const
- {
- if (index != 0)
- return 0.0f;
-
- return fCurPage;
- }
-
- void DistrhoPluginNotes::d_setParameterValue(uint32_t index, float value)
- {
- if (index != 0)
- return;
-
- fCurPage = int(value);
- }
-
- void DistrhoPluginNotes::d_setState(const char*, const char*)
- {
- // do nothing, used only for UI state
- }
-
- // -----------------------------------------------------------------------
- // Process
-
- void DistrhoPluginNotes::d_run(float** inputs, float** outputs, uint32_t frames, const MidiEvent*, uint32_t)
- {
- std::memcpy(outputs[0], inputs[0], sizeof(float)*frames);
- std::memcpy(outputs[1], inputs[1], sizeof(float)*frames);
- }
-
- // -----------------------------------------------------------------------
-
- Plugin* createPlugin()
- {
- return new DistrhoPluginNotes();
- }
-
- // -----------------------------------------------------------------------
-
- END_NAMESPACE_DISTRHO
|