| @@ -1928,58 +1928,44 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Post-poned UI Stuff | |||
| void uiParameterChange(const uint32_t index, const float /*value*/) noexcept override | |||
| void uiParameterChange(const uint32_t index, const float value) noexcept override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
| CARLA_ASSERT(index < pData->param.count); | |||
| CARLA_SAFE_ASSERT_RETURN(index < pData->param.count,); | |||
| if (! fIsUiVisible) | |||
| return; | |||
| if (fDescriptor == nullptr || fHandle == nullptr) | |||
| return; | |||
| if (index >= pData->param.count) | |||
| return; | |||
| //if (fDescriptor->ui_set_parameter_value != nullptr) | |||
| // fDescriptor->ui_set_parameter_value(fHandle, index, value); | |||
| if (fDescriptor->ui_set_parameter_value != nullptr) | |||
| fDescriptor->ui_set_parameter_value(fHandle, index, value); | |||
| } | |||
| void uiMidiProgramChange(const uint32_t index) noexcept override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
| CARLA_ASSERT(index < pData->midiprog.count); | |||
| CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,); | |||
| if (! fIsUiVisible) | |||
| return; | |||
| if (fDescriptor == nullptr || fHandle == nullptr) | |||
| return; | |||
| if (index >= pData->midiprog.count) | |||
| return; | |||
| //if (fDescriptor->ui_set_midi_program != nullptr) // TODO | |||
| // fDescriptor->ui_set_midi_program(fHandle, 0, pData->midiprog.data[index].bank, pData->midiprog.data[index].program); | |||
| if (fDescriptor->ui_set_midi_program != nullptr) | |||
| fDescriptor->ui_set_midi_program(fHandle, 0, pData->midiprog.data[index].bank, pData->midiprog.data[index].program); | |||
| } | |||
| void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) noexcept override | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
| CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
| CARLA_ASSERT(note < MAX_MIDI_NOTE); | |||
| CARLA_ASSERT(velo > 0 && velo < MAX_MIDI_VALUE); | |||
| CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | |||
| CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,); | |||
| CARLA_SAFE_ASSERT_RETURN(velo > 0 && velo < MAX_MIDI_VALUE,); | |||
| if (! fIsUiVisible) | |||
| return; | |||
| if (fDescriptor == nullptr || fHandle == nullptr) | |||
| return; | |||
| if (channel >= MAX_MIDI_CHANNELS) | |||
| return; | |||
| if (note >= MAX_MIDI_NOTE) | |||
| return; | |||
| if (velo >= MAX_MIDI_VALUE) | |||
| return; | |||
| // TODO | |||
| } | |||
| @@ -1988,17 +1974,13 @@ public: | |||
| { | |||
| CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); | |||
| CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
| CARLA_ASSERT(note < MAX_MIDI_NOTE); | |||
| CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | |||
| CARLA_SAFE_ASSERT_RETURN(note < MAX_MIDI_NOTE,); | |||
| if (! fIsUiVisible) | |||
| return; | |||
| if (fDescriptor == nullptr || fHandle == nullptr) | |||
| return; | |||
| if (channel >= MAX_MIDI_CHANNELS) | |||
| return; | |||
| if (note >= MAX_MIDI_NOTE) | |||
| return; | |||
| // TODO | |||
| } | |||
| @@ -165,13 +165,6 @@ protected: | |||
| delete[] key; | |||
| delete[] value; | |||
| } | |||
| else if (std::strcmp(msg, "exiting") == 0) | |||
| { | |||
| waitChildClose(); | |||
| fUiState = UiHide; | |||
| uiClosed(); | |||
| } | |||
| else | |||
| { | |||
| carla_stderr("msgReceived : %s", msg); | |||
| @@ -68,13 +68,13 @@ OBJS += \ | |||
| midi-transpose.c.o \ | |||
| nekofilter.c.o | |||
| ifeq ($(_ignore_WIN32__),true) | |||
| ifneq ($(WIN32),true) | |||
| # -------------------------------------------------------------- | |||
| # External-UI plugins | |||
| OBJS += \ | |||
| ext-bigmeter.cpp.o \ | |||
| ext-notes.cpp.o | |||
| bigmeter.cpp.o | |||
| # ext-notes.cpp.o | |||
| endif | |||
| # -------------------------------------------------------------- | |||
| @@ -207,6 +207,9 @@ CXXDEPS = ../CarlaNative.h ../CarlaNative.hpp | |||
| audio-file.cpp.o: audio-file.cpp audio-base.hpp $(CXXDEPS) | |||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
| bigmeter.cpp.o: bigmeter.cpp $(CXXDEPS) ../CarlaNativeExtUI.hpp | |||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||
| distrho-3bandeq.cpp.o: distrho-3bandeq.cpp 3bandeq/*.cpp 3bandeq/*.h 3bandeq/*.hpp $(CXXDEPS) | |||
| $(CXX) $< $(BUILD_CXX_FLAGS) -I../dgl -I3bandeq -DDISTRHO_NAMESPACE=DISTRHO_3BandEQ -c -o $@ | |||
| @@ -84,7 +84,7 @@ void carla_register_all_plugins() | |||
| carla_register_native_plugin_carla(); | |||
| // External-UI plugins | |||
| //carla_register_native_plugin_bigmeter(); | |||
| carla_register_native_plugin_bigmeter(); | |||
| //carla_register_native_plugin_notes(); | |||
| #endif | |||
| @@ -0,0 +1,197 @@ | |||
| /* | |||
| * Carla Native Plugins | |||
| * Copyright (C) 2012-2014 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 "CarlaDefines.h" | |||
| #ifdef CARLA_OS_WIN | |||
| # error This file should not be compiled for Windows | |||
| #endif | |||
| #include "CarlaNativeExtUI.hpp" | |||
| #include <cmath> | |||
| // ----------------------------------------------------------------------- | |||
| class BigMeterPlugin : public NativePluginAndUiClass | |||
| { | |||
| public: | |||
| BigMeterPlugin(const NativeHostDescriptor* const host) | |||
| : NativePluginAndUiClass(host, "/bigmeter-ui"), | |||
| fColor(0), | |||
| fOutLeft(0.0f), | |||
| fOutRight(0.0f) | |||
| { | |||
| } | |||
| protected: | |||
| // ------------------------------------------------------------------- | |||
| // Plugin parameter calls | |||
| uint32_t getParameterCount() const override | |||
| { | |||
| return 3; | |||
| } | |||
| const NativeParameter* getParameterInfo(const uint32_t index) const override | |||
| { | |||
| if (index >= 3) | |||
| return nullptr; | |||
| static NativeParameter param; | |||
| static NativeParameterScalePoint scalePoints[2]; | |||
| int hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE; | |||
| param.name = nullptr; | |||
| param.unit = nullptr; | |||
| param.ranges.def = 0.0f; | |||
| param.ranges.min = 0.0f; | |||
| param.ranges.max = 1.0f; | |||
| param.ranges.step = 1.0f; | |||
| param.ranges.stepSmall = 1.0f; | |||
| param.ranges.stepLarge = 1.0f; | |||
| param.scalePointCount = 0; | |||
| param.scalePoints = nullptr; | |||
| switch (index) | |||
| { | |||
| case 0: | |||
| hints |= PARAMETER_IS_INTEGER|PARAMETER_USES_SCALEPOINTS; | |||
| param.name = "Color"; | |||
| param.ranges.def = 1.0f; | |||
| param.ranges.min = 1.0f; | |||
| param.ranges.max = 2.0f; | |||
| scalePoints[0].label = "Green"; | |||
| scalePoints[1].label = "Blue"; | |||
| scalePoints[0].value = 1.0f; | |||
| scalePoints[1].value = 2.0f; | |||
| param.scalePointCount = 2; | |||
| param.scalePoints = scalePoints; | |||
| break; | |||
| case 1: | |||
| hints |= PARAMETER_IS_OUTPUT; | |||
| param.name = "Out Left"; | |||
| break; | |||
| case 2: | |||
| hints |= PARAMETER_IS_OUTPUT; | |||
| param.name = "Out Right"; | |||
| break; | |||
| } | |||
| param.hints = static_cast<NativeParameterHints>(hints); | |||
| return ¶m; | |||
| } | |||
| float getParameterValue(const uint32_t index) const override | |||
| { | |||
| switch (index) | |||
| { | |||
| case 0: | |||
| return (float)fColor; | |||
| case 1: | |||
| return fOutLeft; | |||
| case 2: | |||
| return fOutRight; | |||
| default: | |||
| return 0.0f; | |||
| } | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Plugin state calls | |||
| void setParameterValue(const uint32_t index, const float value) override | |||
| { | |||
| switch (index) | |||
| { | |||
| case 0: | |||
| fColor = (int)value; | |||
| break; | |||
| case 1: | |||
| fOutLeft = value; | |||
| break; | |||
| case 2: | |||
| fOutRight = value; | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| // Plugin process calls | |||
| void process(float** inputs, float**, const uint32_t frames, const NativeMidiEvent* const, const uint32_t) override | |||
| { | |||
| float tmp, tmpLeft, tmpRight; | |||
| tmpLeft = tmpRight = 0.0f; | |||
| for (uint32_t i=0; i < frames; ++i) | |||
| { | |||
| tmp = std::abs(inputs[0][i]); | |||
| if (tmp > tmpLeft) | |||
| tmpLeft = tmp; | |||
| tmp = std::abs(inputs[1][i]); | |||
| if (tmp > tmpRight) | |||
| tmpRight = tmp; | |||
| } | |||
| fOutLeft = tmpLeft; | |||
| fOutRight = tmpRight; | |||
| } | |||
| private: | |||
| int fColor; | |||
| float fOutLeft, fOutRight; | |||
| PluginClassEND(BigMeterPlugin) | |||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(BigMeterPlugin) | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| static const NativePluginDescriptor bigmeterDesc = { | |||
| /* category */ PLUGIN_CATEGORY_UTILITY, | |||
| /* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI), | |||
| /* supports */ static_cast<NativePluginSupports>(0x0), | |||
| /* audioIns */ 2, | |||
| /* audioOuts */ 0, | |||
| /* midiIns */ 0, | |||
| /* midiOuts */ 0, | |||
| /* paramIns */ 1, | |||
| /* paramOuts */ 2, | |||
| /* name */ "Big Meter", | |||
| /* label */ "bigmeter", | |||
| /* maker */ "falkTX", | |||
| /* copyright */ "GNU GPL v2+", | |||
| PluginDescriptorFILL(BigMeterPlugin) | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| CARLA_EXPORT | |||
| void carla_register_native_plugin_bigmeter() | |||
| { | |||
| carla_register_native_plugin(&bigmeterDesc); | |||
| } | |||
| // ----------------------------------------------------------------------- | |||
| @@ -1,8 +1,8 @@ | |||
| #!/usr/bin/env python3 | |||
| # -*- coding: utf-8 -*- | |||
| # DISTRHO BigMeter Plugin | |||
| # Copyright (C) 2013 Filipe Coelho <falktx@falktx.com> | |||
| # Carla Native Plugins | |||
| # Copyright (C) 2012-2014 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 | |||
| @@ -14,22 +14,18 @@ | |||
| # 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 GPL.txt file | |||
| # For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| # ------------------------------------------------------------------------------------------------------------ | |||
| # Imports (Global) | |||
| from numpy import rint | |||
| from sys import argv, exit | |||
| try: | |||
| from PyQt5.QtWidgets import QApplication | |||
| except: | |||
| from PyQt4.QtGui import QApplication | |||
| from sys import exit | |||
| # ----------------------------------------------------------------------- | |||
| # Imports (ExternalUI) | |||
| from carla_style import CarlaApplication | |||
| from externalui import ExternalUI | |||
| from digitalpeakmeter import DigitalPeakMeter | |||
| @@ -41,7 +37,7 @@ class DistrhoUIBigMeter(DigitalPeakMeter, ExternalUI): | |||
| DigitalPeakMeter.__init__(self, None) | |||
| ExternalUI.__init__(self) | |||
| channels = 6 if argv[0].endswith("bigmeterM-ui") else 2 | |||
| channels = 2 #6 if argv[0].endswith("bigmeterM-ui") else 2 | |||
| self.setChannels(channels) | |||
| self.setColor(self.GREEN) | |||
| @@ -63,7 +59,7 @@ class DistrhoUIBigMeter(DigitalPeakMeter, ExternalUI): | |||
| if index == 0: | |||
| color = rint(value)+1 | |||
| if not color in (self.GREEN, self.BLUE): | |||
| if color not in (self.GREEN, self.BLUE): | |||
| return | |||
| self.setColor(color) | |||
| @@ -102,7 +98,7 @@ class DistrhoUIBigMeter(DigitalPeakMeter, ExternalUI): | |||
| #--------------- main ------------------ | |||
| if __name__ == '__main__': | |||
| app = QApplication(argv) | |||
| app = CarlaApplication("BigMeter") | |||
| #app... | |||
| gui = DistrhoUIBigMeter() | |||
| exit(app.exec_()) | |||