| @@ -32,8 +32,7 @@ CXX ?= g++ | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| BASE_FLAGS = -Wall -Wextra -fPIC -DPIC -pipe | BASE_FLAGS = -Wall -Wextra -fPIC -DPIC -pipe | ||||
| BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -mfpmath=sse | |||||
| BASE_OPTS += -fdata-sections -ffunction-sections | |||||
| BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -mfpmath=sse -fdata-sections -ffunction-sections | |||||
| LINK_OPTS = -Wl,--gc-sections | LINK_OPTS = -Wl,--gc-sections | ||||
| ifeq ($(RASPPI),true) | ifeq ($(RASPPI),true) | ||||
| @@ -45,7 +44,8 @@ endif | |||||
| ifeq ($(DEBUG),true) | ifeq ($(DEBUG),true) | ||||
| BASE_FLAGS += -DDEBUG -O0 -g | BASE_FLAGS += -DDEBUG -O0 -g | ||||
| else | else | ||||
| BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden -fvisibility-inlines-hidden | |||||
| BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden | |||||
| CXXFLAGS += -fvisibility-inlines-hidden | |||||
| LINK_OPTS += -Wl,--strip-all | LINK_OPTS += -Wl,--strip-all | ||||
| endif | endif | ||||
| @@ -93,6 +93,10 @@ ifeq ($(HAVE_QT4),true) | |||||
| MOC ?= $(shell pkg-config --variable=moc_location QtCore) | MOC ?= $(shell pkg-config --variable=moc_location QtCore) | ||||
| RCC ?= $(shell pkg-config --variable=rcc_location QtCore) | RCC ?= $(shell pkg-config --variable=rcc_location QtCore) | ||||
| UIC ?= $(shell pkg-config --variable=uic_location QtCore) | UIC ?= $(shell pkg-config --variable=uic_location QtCore) | ||||
| else | |||||
| MOC ?= moc | |||||
| RCC ?= rcc | |||||
| UIC ?= uic | |||||
| endif | endif | ||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| @@ -20,10 +20,10 @@ | |||||
| #include "CarlaBackend.hpp" | #include "CarlaBackend.hpp" | ||||
| #include "CarlaString.hpp" | #include "CarlaString.hpp" | ||||
| #include "CarlaNative.h" | |||||
| // Avoid including extra libs here | // Avoid including extra libs here | ||||
| typedef void* lo_address; | typedef void* lo_address; | ||||
| typedef struct _PluginDescriptor PluginDescriptor; | |||||
| #ifndef LADSPA_RDF_HPP_INCLUDED | #ifndef LADSPA_RDF_HPP_INCLUDED | ||||
| struct LADSPA_RDF_Descriptor; | struct LADSPA_RDF_Descriptor; | ||||
| #endif | #endif | ||||
| @@ -854,6 +854,7 @@ public: | |||||
| static CarlaPlugin* newDSSI(const Initializer& init, const char* const guiFilename); | static CarlaPlugin* newDSSI(const Initializer& init, const char* const guiFilename); | ||||
| static CarlaPlugin* newLV2(const Initializer& init); | static CarlaPlugin* newLV2(const Initializer& init); | ||||
| static CarlaPlugin* newVST(const Initializer& init); | static CarlaPlugin* newVST(const Initializer& init); | ||||
| static CarlaPlugin* newCSOUND(const Initializer& init); | |||||
| static CarlaPlugin* newGIG(const Initializer& init, const bool use16Outs); | static CarlaPlugin* newGIG(const Initializer& init, const bool use16Outs); | ||||
| static CarlaPlugin* newSF2(const Initializer& init, const bool use16Outs); | static CarlaPlugin* newSF2(const Initializer& init, const bool use16Outs); | ||||
| static CarlaPlugin* newSFZ(const Initializer& init, const bool use16Outs); | static CarlaPlugin* newSFZ(const Initializer& init, const bool use16Outs); | ||||
| @@ -737,14 +737,14 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons | |||||
| plugin = CarlaPlugin::newVST(init); | plugin = CarlaPlugin::newVST(init); | ||||
| break; | break; | ||||
| case PLUGIN_VST3: | |||||
| //plugin = CarlaPlugin::newVST3(init); | |||||
| break; | |||||
| case PLUGIN_AU: | case PLUGIN_AU: | ||||
| //plugin = CarlaPlugin::newAU(init); | //plugin = CarlaPlugin::newAU(init); | ||||
| break; | break; | ||||
| case PLUGIN_CSOUND: | |||||
| plugin = CarlaPlugin::newCSOUND(init); | |||||
| break; | |||||
| case PLUGIN_GIG: | case PLUGIN_GIG: | ||||
| plugin = CarlaPlugin::newGIG(init, (extra != nullptr)); | plugin = CarlaPlugin::newGIG(init, (extra != nullptr)); | ||||
| break; | break; | ||||
| @@ -20,7 +20,7 @@ | |||||
| #include "CarlaEngineInternal.hpp" | #include "CarlaEngineInternal.hpp" | ||||
| #include "CarlaStateUtils.hpp" | #include "CarlaStateUtils.hpp" | ||||
| #include "CarlaNative.hpp" | |||||
| #include "carla_native/CarlaNative.hpp" | |||||
| #include <QtCore/QProcess> | #include <QtCore/QProcess> | ||||
| #include <QtCore/QTextStream> | #include <QtCore/QTextStream> | ||||
| @@ -142,12 +142,12 @@ private: | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class CarlaEngineNative : public PluginDescriptorClass, | |||||
| class CarlaEngineNative : public PluginClass, | |||||
| public CarlaEngine | public CarlaEngine | ||||
| { | { | ||||
| public: | public: | ||||
| CarlaEngineNative(const HostDescriptor* const host) | CarlaEngineNative(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| CarlaEngine(), | CarlaEngine(), | ||||
| fIsRunning(true), | fIsRunning(true), | ||||
| fThread(this) | fThread(this) | ||||
| @@ -197,8 +197,8 @@ protected: | |||||
| { | { | ||||
| carla_debug("CarlaEngineNative::init(\"%s\")", clientName); | carla_debug("CarlaEngineNative::init(\"%s\")", clientName); | ||||
| fBufferSize = PluginDescriptorClass::getBufferSize(); | |||||
| fSampleRate = PluginDescriptorClass::getSampleRate(); | |||||
| fBufferSize = PluginClass::getBufferSize(); | |||||
| fSampleRate = PluginClass::getSampleRate(); | |||||
| CarlaEngine::init(clientName); | CarlaEngine::init(clientName); | ||||
| return true; | return true; | ||||
| @@ -230,7 +230,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() override | |||||
| uint32_t getParameterCount() const override | |||||
| { | { | ||||
| if (pData->curPluginCount == 0 || pData->plugins == nullptr) | if (pData->curPluginCount == 0 || pData->plugins == nullptr) | ||||
| return 0; | return 0; | ||||
| @@ -243,7 +243,7 @@ protected: | |||||
| return pData->plugins[0].plugin->getParameterCount(); | return pData->plugins[0].plugin->getParameterCount(); | ||||
| } | } | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= getParameterCount()) | if (index >= getParameterCount()) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -303,7 +303,7 @@ protected: | |||||
| return ¶m; | return ¶m; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) override | |||||
| float getParameterValue(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= getParameterCount()) | if (index >= getParameterCount()) | ||||
| return 0.0f; | return 0.0f; | ||||
| @@ -316,7 +316,7 @@ protected: | |||||
| return plugin->getParameterValue(index); | return plugin->getParameterValue(index); | ||||
| } | } | ||||
| const char* getParameterText(const uint32_t index, const float value) override // FIXME - use value | |||||
| const char* getParameterText(const uint32_t index, const float value) const override // FIXME - use value | |||||
| { | { | ||||
| if (index >= getParameterCount()) | if (index >= getParameterCount()) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -336,7 +336,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| uint32_t getMidiProgramCount() override | |||||
| uint32_t getMidiProgramCount() const override | |||||
| { | { | ||||
| if (pData->curPluginCount == 0 || pData->plugins == nullptr) | if (pData->curPluginCount == 0 || pData->plugins == nullptr) | ||||
| return 0; | return 0; | ||||
| @@ -349,7 +349,7 @@ protected: | |||||
| return plugin->getMidiProgramCount(); | return plugin->getMidiProgramCount(); | ||||
| } | } | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= getMidiProgramCount()) | if (index >= getMidiProgramCount()) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -446,7 +446,7 @@ protected: | |||||
| runPendingRtEvents(); | runPendingRtEvents(); | ||||
| } | } | ||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t midiEventCount, const ::MidiEvent* const midiEvents) override | |||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const ::MidiEvent* const midiEvents, const uint32_t midiEventCount) override | |||||
| { | { | ||||
| if (pData->curPluginCount == 0) | if (pData->curPluginCount == 0) | ||||
| { | { | ||||
| @@ -458,7 +458,7 @@ protected: | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // Time Info | // Time Info | ||||
| const ::TimeInfo* timeInfo(PluginDescriptorClass::getTimeInfo()); | |||||
| const ::TimeInfo* timeInfo(PluginClass::getTimeInfo()); | |||||
| fTimeInfo.playing = timeInfo->playing; | fTimeInfo.playing = timeInfo->playing; | ||||
| fTimeInfo.frame = timeInfo->frame; | fTimeInfo.frame = timeInfo->frame; | ||||
| @@ -592,7 +592,7 @@ protected: | |||||
| case CarlaEngineNativeThread::UiShow: | case CarlaEngineNativeThread::UiShow: | ||||
| break; | break; | ||||
| case CarlaEngineNativeThread::UiCrashed: | case CarlaEngineNativeThread::UiCrashed: | ||||
| hostDispatcher(HOST_OPCODE_UI_UNAVAILABLE, 0, 0, nullptr, 0.0f); | |||||
| hostUiUnavailable(); | |||||
| break; | break; | ||||
| case CarlaEngineNativeThread::UiHide: | case CarlaEngineNativeThread::UiHide: | ||||
| uiClosed(); | uiClosed(); | ||||
| @@ -641,7 +641,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin state calls | // Plugin state calls | ||||
| char* getState() override | |||||
| char* getState() const override | |||||
| { | { | ||||
| QString string; | QString string; | ||||
| QTextStream out(&string); | QTextStream out(&string); | ||||
| @@ -731,7 +731,7 @@ private: | |||||
| bool fIsRunning; | bool fIsRunning; | ||||
| CarlaEngineNativeThread fThread; | CarlaEngineNativeThread fThread; | ||||
| PluginDescriptorClassEND(CarlaEngineNative) | |||||
| PluginClassEND(CarlaEngineNative) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineNative) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineNative) | ||||
| }; | }; | ||||
| @@ -588,45 +588,9 @@ const SaveState& CarlaPlugin::getSaveState() | |||||
| // ---------------------------- | // ---------------------------- | ||||
| // Basic info | // Basic info | ||||
| switch (getType()) | |||||
| { | |||||
| case PLUGIN_NONE: | |||||
| saveState.type = carla_strdup("None"); | |||||
| break; | |||||
| case PLUGIN_INTERNAL: | |||||
| saveState.type = carla_strdup("Internal"); | |||||
| break; | |||||
| case PLUGIN_LADSPA: | |||||
| saveState.type = carla_strdup("LADSPA"); | |||||
| break; | |||||
| case PLUGIN_DSSI: | |||||
| saveState.type = carla_strdup("DSSI"); | |||||
| break; | |||||
| case PLUGIN_LV2: | |||||
| saveState.type = carla_strdup("LV2"); | |||||
| break; | |||||
| case PLUGIN_VST: | |||||
| saveState.type = carla_strdup("VST"); | |||||
| break; | |||||
| case PLUGIN_VST3: | |||||
| saveState.type = carla_strdup("VST3"); | |||||
| break; | |||||
| case PLUGIN_AU: | |||||
| saveState.type = carla_strdup("AU"); | |||||
| break; | |||||
| case PLUGIN_GIG: | |||||
| saveState.type = carla_strdup("GIG"); | |||||
| break; | |||||
| case PLUGIN_SF2: | |||||
| saveState.type = carla_strdup("SF2"); | |||||
| break; | |||||
| case PLUGIN_SFZ: | |||||
| saveState.type = carla_strdup("SFZ"); | |||||
| break; | |||||
| } | |||||
| getLabel(strBuf); | getLabel(strBuf); | ||||
| saveState.type = carla_strdup(getPluginTypeAsString(getType())); | |||||
| saveState.name = carla_strdup(fName); | saveState.name = carla_strdup(fName); | ||||
| saveState.label = carla_strdup(strBuf); | saveState.label = carla_strdup(strBuf); | ||||
| saveState.binary = carla_strdup(fFilename); | saveState.binary = carla_strdup(fFilename); | ||||
| @@ -0,0 +1,94 @@ | |||||
| /* | |||||
| * Carla VST Plugin | |||||
| * Copyright (C) 2011-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 "CarlaPluginInternal.hpp" | |||||
| #define WANT_CSOUND 1 | |||||
| #ifdef WANT_CSOUND | |||||
| //#include "CarlaVstUtils.hpp" | |||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| class CsoundPlugin : public CarlaPlugin | |||||
| { | |||||
| public: | |||||
| CsoundPlugin(CarlaEngine* const engine, const unsigned short id) | |||||
| : CarlaPlugin(engine, id) | |||||
| { | |||||
| carla_debug("CsoundPlugin::CsoundPlugin(%p, %i)", engine, id); | |||||
| } | |||||
| ~Vst3Plugin() override | |||||
| { | |||||
| carla_debug("Vst3Plugin::~Vst3Plugin()"); | |||||
| pData->singleMutex.lock(); | |||||
| pData->masterMutex.lock(); | |||||
| if (pData->client != nullptr && pData->client->isActive()) | |||||
| pData->client->deactivate(); | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| // Information (base) | |||||
| PluginType getType() const override | |||||
| { | |||||
| return PLUGIN_CSOUND; | |||||
| } | |||||
| private: | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CsoundPlugin) | |||||
| }; | |||||
| CARLA_BACKEND_END_NAMESPACE | |||||
| #endif | |||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| CarlaPlugin* CarlaPlugin::newCsound(const Initializer& init) | |||||
| { | |||||
| carla_debug("CarlaPlugin::newCsound(%p, \"%s\", \"%s\", \"%s\")", init.engine, init.filename, init.name, init.label); | |||||
| #ifdef WANT_CSOUND | |||||
| CsoundPlugin* const plugin(new CsoundPlugin(init.engine, init.id)); | |||||
| //if (! plugin->init(init.filename, init.name, init.label)) | |||||
| { | |||||
| delete plugin; | |||||
| return nullptr; | |||||
| } | |||||
| plugin->reload(); | |||||
| if (init.engine->getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK && ! plugin->canRunInRack()) | |||||
| { | |||||
| init.engine->setLastError("Carla's rack mode can only work with Stereo VST3 plugins, sorry!"); | |||||
| delete plugin; | |||||
| return nullptr; | |||||
| } | |||||
| return plugin; | |||||
| #else | |||||
| init.engine->setLastError("VST3 support not available"); | |||||
| return nullptr; | |||||
| #endif | |||||
| } | |||||
| CARLA_BACKEND_END_NAMESPACE | |||||
| @@ -19,9 +19,16 @@ | |||||
| #ifdef WANT_LINUXSAMPLER | #ifdef WANT_LINUXSAMPLER | ||||
| // fix broken headers | |||||
| #define old__cplusplus __cplusplus | |||||
| #undef __cplusplus | |||||
| #include "linuxsampler/EngineFactory.h" | #include "linuxsampler/EngineFactory.h" | ||||
| #include <linuxsampler/Sampler.h> | #include <linuxsampler/Sampler.h> | ||||
| #define __cplusplus old__cplusplus | |||||
| #undef old__cplusplus | |||||
| #include <QtCore/QFileInfo> | #include <QtCore/QFileInfo> | ||||
| namespace LinuxSampler { | namespace LinuxSampler { | ||||
| @@ -19,7 +19,7 @@ | |||||
| #ifdef WANT_NATIVE | #ifdef WANT_NATIVE | ||||
| #include "CarlaNative.h" | |||||
| #include "carla_native/CarlaNative.h" | |||||
| #include <QtCore/Qt> | #include <QtCore/Qt> | ||||
| @@ -1826,19 +1826,19 @@ public: | |||||
| if (fHandle2 == nullptr) | if (fHandle2 == nullptr) | ||||
| { | { | ||||
| fDescriptor->process(fHandle, fAudioInBuffers, fAudioOutBuffers, frames, fMidiEventCount, fMidiEvents); | |||||
| fDescriptor->process(fHandle, fAudioInBuffers, fAudioOutBuffers, frames, fMidiEvents, fMidiEventCount); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| fDescriptor->process(fHandle, | fDescriptor->process(fHandle, | ||||
| (pData->audioIn.count > 0) ? &fAudioInBuffers[0] : nullptr, | (pData->audioIn.count > 0) ? &fAudioInBuffers[0] : nullptr, | ||||
| (pData->audioOut.count > 0) ? &fAudioOutBuffers[0] : nullptr, | (pData->audioOut.count > 0) ? &fAudioOutBuffers[0] : nullptr, | ||||
| frames, fMidiEventCount, fMidiEvents); | |||||
| frames, fMidiEvents, fMidiEventCount); | |||||
| fDescriptor->process(fHandle2, | fDescriptor->process(fHandle2, | ||||
| (pData->audioIn.count > 0) ? &fAudioInBuffers[1] : nullptr, | (pData->audioIn.count > 0) ? &fAudioInBuffers[1] : nullptr, | ||||
| (pData->audioOut.count > 0) ? &fAudioOutBuffers[1] : nullptr, | (pData->audioOut.count > 0) ? &fAudioOutBuffers[1] : nullptr, | ||||
| frames, fMidiEventCount, fMidiEvents); | |||||
| frames, fMidiEvents, fMidiEventCount); | |||||
| } | } | ||||
| fIsProcessing = false; | fIsProcessing = false; | ||||
| @@ -15,7 +15,7 @@ | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | * For a full copy of the GNU General Public License see the doc/GPL.txt file. | ||||
| */ | */ | ||||
| #include "CarlaStandalone.hpp" | |||||
| #include "CarlaHost.hpp" | |||||
| #include "CarlaBackendUtils.hpp" | #include "CarlaBackendUtils.hpp" | ||||
| #include "CarlaOscUtils.hpp" | #include "CarlaOscUtils.hpp" | ||||
| @@ -23,6 +23,8 @@ | |||||
| #include "CarlaPlugin.hpp" | #include "CarlaPlugin.hpp" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| #include "carla_native/CarlaNative.h" | |||||
| #include "CarlaLogThread.hpp" | #include "CarlaLogThread.hpp" | ||||
| #include "CarlaStyle.hpp" | #include "CarlaStyle.hpp" | ||||
| @@ -100,12 +100,11 @@ endif | |||||
| LIBS = ../libcarla_engine.a | LIBS = ../libcarla_engine.a | ||||
| LIBS += ../libcarla_plugin.a | LIBS += ../libcarla_plugin.a | ||||
| LIBS += ../libcarla_native.a | |||||
| LIBS += ../../modules/carla_native.a | |||||
| LIBS += ../../modules/juce_core.a | LIBS += ../../modules/juce_core.a | ||||
| LIBS += ../../modules/juce_audio_basics.a | LIBS += ../../modules/juce_audio_basics.a | ||||
| LIBS += ../../modules/rtmempool.a | LIBS += ../../modules/rtmempool.a | ||||
| LIBS += ../../modules/theme.a | LIBS += ../../modules/theme.a | ||||
| LIBS += ../../modules/widgets.a | |||||
| ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ||||
| LIBS += ../../modules/lilv.a | LIBS += ../../modules/lilv.a | ||||
| @@ -140,7 +139,7 @@ debug: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| %.cpp.o: %.cpp ../CarlaBackend.hpp ../CarlaEngine.hpp ../CarlaNative.h ../CarlaPlugin.hpp ../CarlaStandalone.hpp | |||||
| %.cpp.o: %.cpp ../CarlaBackend.hpp ../CarlaEngine.hpp ../CarlaPlugin.hpp ../CarlaHost.hpp | |||||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | ||||
| ../libcarla_standalone.dll: $(OBJS) $(LIBS) | ../libcarla_standalone.dll: $(OBJS) $(LIBS) | ||||
| @@ -21,21 +21,21 @@ | |||||
| // TODO - merge single file | // TODO - merge single file | ||||
| #include "juce_core/AppConfig.h" | #include "juce_core/AppConfig.h" | ||||
| #include "juce_audio_basics/AppConfig.h" | #include "juce_audio_basics/AppConfig.h" | ||||
| #include "juce_audio_formats/AppConfig.h" | |||||
| #include "juce_audio_devices/AppConfig.h" | |||||
| #include "juce_events/AppConfig.h" | |||||
| // #include "juce_audio_formats/AppConfig.h" | |||||
| // #include "juce_audio_devices/AppConfig.h" | |||||
| // #include "juce_events/AppConfig.h" | |||||
| #include "juce_audio_basics/juce_audio_basics.h" | #include "juce_audio_basics/juce_audio_basics.h" | ||||
| #include "juce_audio_devices/juce_audio_devices.h" | |||||
| #include "juce_audio_formats/juce_audio_formats.h" | |||||
| #include "juce_audio_processors/juce_audio_processors.h" | |||||
| // #include "juce_audio_devices/juce_audio_devices.h" | |||||
| // #include "juce_audio_formats/juce_audio_formats.h" | |||||
| // #include "juce_audio_processors/juce_audio_processors.h" | |||||
| #include "juce_core/juce_core.h" | #include "juce_core/juce_core.h" | ||||
| #include "juce_events/juce_events.h" | |||||
| // #include "juce_data_structures/juce_data_structures.h" | |||||
| // #include "juce_events/juce_events.h" | |||||
| // #include "juce_graphics/juce_graphics.h" | |||||
| // #include "juce_gui_basics/juce_gui_basics.h" | |||||
| //#include "modules/juce_audio_utils/juce_audio_utils.h" | //#include "modules/juce_audio_utils/juce_audio_utils.h" | ||||
| //#include "modules/juce_data_structures/juce_data_structures.h" | |||||
| //#include "modules/juce_graphics/juce_graphics.h" | |||||
| //#include "modules/juce_gui_basics/juce_gui_basics.h" | |||||
| //#include "modules/juce_gui_extra/juce_gui_extra.h" | //#include "modules/juce_gui_extra/juce_gui_extra.h" | ||||
| #endif // CARLA_JUCE_HEADER_H_INCLUDED | #endif // CARLA_JUCE_HEADER_H_INCLUDED | ||||
| @@ -8,6 +8,11 @@ all: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| carla_native: | |||||
| $(MAKE) -C carla_native | |||||
| # -------------------------------------------------------------- | |||||
| dgl: | dgl: | ||||
| $(MAKE) -C distrho/dgl | $(MAKE) -C distrho/dgl | ||||
| @@ -56,11 +61,6 @@ theme_%: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| widgets: | |||||
| $(MAKE) -C widgets | |||||
| # -------------------------------------------------------------- | |||||
| jackbridge-win32: | jackbridge-win32: | ||||
| $(MAKE) -C jackbridge win32 | $(MAKE) -C jackbridge win32 | ||||
| @@ -87,4 +87,4 @@ clean: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| .PHONY: dgl juce_audio_basics juce_core lilv rtmempool theme widgets | |||||
| .PHONY: carla_native dgl juce_audio_basics juce_core lilv rtmempool theme | |||||
| @@ -87,7 +87,7 @@ typedef enum { | |||||
| PLUGIN_OPCODE_NULL = 0, // nothing | PLUGIN_OPCODE_NULL = 0, // nothing | ||||
| PLUGIN_OPCODE_BUFFER_SIZE_CHANGED = 1, // uses value | PLUGIN_OPCODE_BUFFER_SIZE_CHANGED = 1, // uses value | ||||
| PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, // uses opt | PLUGIN_OPCODE_SAMPLE_RATE_CHANGED = 2, // uses opt | ||||
| PLUGIN_OPCODE_OFFLINE_CHANGED = 3, // uses value | |||||
| PLUGIN_OPCODE_OFFLINE_CHANGED = 3, // uses value (0=off, 1=on) | |||||
| PLUGIN_OPCODE_UI_NAME_CHANGED = 4 // uses ptr | PLUGIN_OPCODE_UI_NAME_CHANGED = 4 // uses ptr | ||||
| } PluginDispatcherOpcode; | } PluginDispatcherOpcode; | ||||
| @@ -99,10 +99,10 @@ typedef enum { | |||||
| HOST_OPCODE_SET_BALANCE_RIGHT = 4, // uses opt | HOST_OPCODE_SET_BALANCE_RIGHT = 4, // uses opt | ||||
| HOST_OPCODE_SET_PANNING = 5, // uses opt | HOST_OPCODE_SET_PANNING = 5, // uses opt | ||||
| HOST_OPCODE_GET_PARAMETER_MIDI_CC = 6, // uses index; return answer | HOST_OPCODE_GET_PARAMETER_MIDI_CC = 6, // uses index; return answer | ||||
| HOST_OPCODE_SET_PARAMETER_MIDI_CC = 7, // uses index and opt | |||||
| HOST_OPCODE_SET_PARAMETER_MIDI_CC = 7, // uses index and value | |||||
| HOST_OPCODE_SET_PROCESS_PRECISION = 8, // uses value | HOST_OPCODE_SET_PROCESS_PRECISION = 8, // uses value | ||||
| HOST_OPCODE_UPDATE_PARAMETER = 9, // uses value, -1 for all | |||||
| HOST_OPCODE_UPDATE_MIDI_PROGRAM = 10, // uses value, -1 for all; may use index for channel | |||||
| HOST_OPCODE_UPDATE_PARAMETER = 9, // uses index, -1 for all | |||||
| HOST_OPCODE_UPDATE_MIDI_PROGRAM = 10, // uses index, -1 for all; may use value for channel | |||||
| HOST_OPCODE_RELOAD_PARAMETERS = 11, // nothing | HOST_OPCODE_RELOAD_PARAMETERS = 11, // nothing | ||||
| HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 12, // nothing | HOST_OPCODE_RELOAD_MIDI_PROGRAMS = 12, // nothing | ||||
| HOST_OPCODE_RELOAD_ALL = 13, // nothing | HOST_OPCODE_RELOAD_ALL = 13, // nothing | ||||
| @@ -205,7 +205,7 @@ typedef struct { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // PluginDescriptor | // PluginDescriptor | ||||
| typedef struct { | |||||
| typedef struct _PluginDescriptor { | |||||
| const PluginCategory category; | const PluginCategory category; | ||||
| const PluginHints hints; | const PluginHints hints; | ||||
| const PluginSupports supports; | const PluginSupports supports; | ||||
| @@ -220,7 +220,7 @@ typedef struct { | |||||
| const char* const maker; | const char* const maker; | ||||
| const char* const copyright; | const char* const copyright; | ||||
| PluginHandle (*instantiate)(HostDescriptor* host); | |||||
| PluginHandle (*instantiate)(const HostDescriptor* host); | |||||
| void (*cleanup)(PluginHandle handle); | void (*cleanup)(PluginHandle handle); | ||||
| uint32_t (*get_parameter_count)(PluginHandle handle); | uint32_t (*get_parameter_count)(PluginHandle handle); | ||||
| @@ -244,7 +244,7 @@ typedef struct { | |||||
| void (*activate)(PluginHandle handle); | void (*activate)(PluginHandle handle); | ||||
| void (*deactivate)(PluginHandle handle); | void (*deactivate)(PluginHandle handle); | ||||
| void (*process)(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents); | |||||
| void (*process)(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount); | |||||
| char* (*get_state)(PluginHandle handle); | char* (*get_state)(PluginHandle handle); | ||||
| void (*set_state)(PluginHandle handle, const char* data); | void (*set_state)(PluginHandle handle, const char* data); | ||||
| @@ -28,18 +28,18 @@ | |||||
| */ | */ | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // Plugin Descriptor Class | |||||
| // Plugin Class | |||||
| class PluginDescriptorClass | |||||
| class PluginClass | |||||
| { | { | ||||
| public: | public: | ||||
| PluginDescriptorClass(const HostDescriptor* const host) | |||||
| PluginClass(const HostDescriptor* const host) | |||||
| : pHost(host) | : pHost(host) | ||||
| { | { | ||||
| CARLA_ASSERT(host != nullptr); | CARLA_ASSERT(host != nullptr); | ||||
| } | } | ||||
| virtual ~PluginDescriptorClass() | |||||
| virtual ~PluginClass() | |||||
| { | { | ||||
| } | } | ||||
| @@ -143,34 +143,142 @@ protected: | |||||
| return pHost->ui_save_file(pHost->handle, isDir, title, filter); | return pHost->ui_save_file(pHost->handle, isDir, title, filter); | ||||
| } | } | ||||
| intptr_t hostDispatcher(const HostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) const | |||||
| // ------------------------------------------------------------------- | |||||
| // Host dispatcher calls | |||||
| void hostSetVolume(const float value) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, 0); | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| return pHost->dispatcher(pHost->handle, opcode, index, value, ptr, opt); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_VOLUME, 0, 0, nullptr, value); | |||||
| } | |||||
| void hostSetDryWet(const float value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_DRYWET, 0, 0, nullptr, value); | |||||
| } | |||||
| void hostSetBalanceLeft(const float value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_BALANCE_LEFT, 0, 0, nullptr, value); | |||||
| } | |||||
| void hostSetBalanceRight(const float value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_BALANCE_RIGHT, 0, 0, nullptr, value); | |||||
| } | |||||
| void hostSetPanning(const float value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PANNING, 0, 0, nullptr, value); | |||||
| } | |||||
| intptr_t hostGetParameterMidiCC(const int32_t index) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, -1); | |||||
| return pHost->dispatcher(pHost->handle, HOST_OPCODE_GET_PARAMETER_MIDI_CC, index, 0, nullptr, 0.0f); | |||||
| } | |||||
| void hostSetParameterMidiCC(const int32_t index, const intptr_t value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PARAMETER_MIDI_CC, index, value, nullptr, 0.0f); | |||||
| } | |||||
| void hostSetProcessPrecision(const intptr_t value) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_SET_PROCESS_PRECISION, 0, value, nullptr, 0.0f); | |||||
| } | |||||
| void hostUpdateParameter(const int32_t index) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_UPDATE_PARAMETER, index, 0, nullptr, 0.0f); | |||||
| } | |||||
| void hostUpdateAllParameters() const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_UPDATE_PARAMETER, -1, 0, nullptr, 0.0f); | |||||
| } | |||||
| void hostUpdateMidiProgram(const int32_t index, const intptr_t channel = 0) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_UPDATE_MIDI_PROGRAM, index, channel, nullptr, 0.0f); | |||||
| } | |||||
| void hostUpdateAllMidiPrograms(const intptr_t channel = 0) const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_UPDATE_MIDI_PROGRAM, -1, channel, nullptr, 0.0f); | |||||
| } | |||||
| void hostReloadParameters() const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_RELOAD_PARAMETERS, 0, 0, nullptr, 0.0f); | |||||
| } | |||||
| void hostReloadMidiPrograms() const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_RELOAD_MIDI_PROGRAMS, 0, 0, nullptr, 0.0f); | |||||
| } | |||||
| void hostReloadAll() const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_RELOAD_ALL, 0, 0, nullptr, 0.0f); | |||||
| } | |||||
| void hostUiUnavailable() const | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||||
| pHost->dispatcher(pHost->handle, HOST_OPCODE_UI_UNAVAILABLE, 0, 0, nullptr, 0.0f); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| virtual uint32_t getParameterCount() | |||||
| virtual uint32_t getParameterCount() const | |||||
| { | { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| virtual const Parameter* getParameterInfo(const uint32_t index) | |||||
| virtual const Parameter* getParameterInfo(const uint32_t index) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| virtual float getParameterValue(const uint32_t index) | |||||
| virtual float getParameterValue(const uint32_t index) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), 0.0f); | CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), 0.0f); | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| virtual const char* getParameterText(const uint32_t index, const float value) | |||||
| virtual const char* getParameterText(const uint32_t index, const float value) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -182,12 +290,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| virtual uint32_t getMidiProgramCount() | |||||
| virtual uint32_t getMidiProgramCount() const | |||||
| { | { | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| virtual const MidiProgram* getMidiProgramInfo(const uint32_t index) | |||||
| virtual const MidiProgram* getMidiProgramInfo(const uint32_t index) const | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(index < getMidiProgramCount(), nullptr); | CARLA_SAFE_ASSERT_RETURN(index < getMidiProgramCount(), nullptr); | ||||
| return nullptr; | return nullptr; | ||||
| @@ -232,7 +340,7 @@ protected: | |||||
| { | { | ||||
| } | } | ||||
| virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t midiEventCount, const MidiEvent* const midiEvents) = 0; | |||||
| virtual void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) = 0; | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin UI calls | // Plugin UI calls | ||||
| @@ -277,7 +385,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin state calls | // Plugin state calls | ||||
| virtual char* getState() | |||||
| virtual char* getState() const | |||||
| { | { | ||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| @@ -288,18 +396,32 @@ protected: | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin dispatcher | |||||
| // Plugin dispatcher calls | |||||
| virtual intptr_t pluginDispatcher(const PluginDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) | |||||
| virtual void bufferSizeChanged(const uint32_t bufferSize) | |||||
| { | { | ||||
| return 0; | |||||
| return; | |||||
| // unused | // unused | ||||
| (void)opcode; | |||||
| (void)index; | |||||
| (void)value; | |||||
| (void)ptr; | |||||
| (void)opt; | |||||
| (void)bufferSize; | |||||
| } | |||||
| virtual void sampleRateChanged(const double sampleRate) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(sampleRate > 0.0,); | |||||
| } | |||||
| virtual void offlineChanged(const bool isOffline) | |||||
| { | |||||
| return; | |||||
| // unused | |||||
| (void)isOffline; | |||||
| } | |||||
| virtual void uiNameChanged(const char* const uiName) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(uiName != nullptr,); | |||||
| } | } | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -311,7 +433,7 @@ private: | |||||
| #ifndef DOXYGEN | #ifndef DOXYGEN | ||||
| public: | public: | ||||
| #define handlePtr ((PluginDescriptorClass*)handle) | |||||
| #define handlePtr ((PluginClass*)handle) | |||||
| static uint32_t _get_parameter_count(PluginHandle handle) | static uint32_t _get_parameter_count(PluginHandle handle) | ||||
| { | { | ||||
| @@ -393,9 +515,9 @@ public: | |||||
| handlePtr->deactivate(); | handlePtr->deactivate(); | ||||
| } | } | ||||
| static void _process(PluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||||
| static void _process(PluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| handlePtr->process(inBuffer, outBuffer, frames, midiEventCount, midiEvents); | |||||
| handlePtr->process(inBuffer, outBuffer, frames, midiEvents, midiEventCount); | |||||
| } | } | ||||
| static char* _get_state(PluginHandle handle) | static char* _get_state(PluginHandle handle) | ||||
| @@ -410,12 +532,31 @@ public: | |||||
| static intptr_t _dispatcher(PluginHandle handle, PluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt) | static intptr_t _dispatcher(PluginHandle handle, PluginDispatcherOpcode opcode, int32_t index, intptr_t value, void* ptr, float opt) | ||||
| { | { | ||||
| return handlePtr->pluginDispatcher(opcode, index, value, ptr, opt); | |||||
| switch(opcode) | |||||
| { | |||||
| case PLUGIN_OPCODE_NULL: | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_BUFFER_SIZE_CHANGED: | |||||
| CARLA_SAFE_ASSERT_RETURN(value > 0, 0); | |||||
| handlePtr->bufferSizeChanged(static_cast<uint32_t>(value)); | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_SAMPLE_RATE_CHANGED: | |||||
| handlePtr->sampleRateChanged(static_cast<double>(opt)); | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_OFFLINE_CHANGED: | |||||
| handlePtr->offlineChanged(value != 0); | |||||
| return 0; | |||||
| case PLUGIN_OPCODE_UI_NAME_CHANGED: | |||||
| handlePtr->uiNameChanged(static_cast<const char*>(ptr)); | |||||
| return 0; | |||||
| } | |||||
| return 0; | |||||
| } | } | ||||
| #undef handlePtr | #undef handlePtr | ||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginDescriptorClass) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginClass) | |||||
| #endif | #endif | ||||
| }; | }; | ||||
| @@ -423,15 +564,15 @@ public: | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| #define PluginDescriptorClassEND(ClassName) \ | |||||
| public: \ | |||||
| static PluginHandle _instantiate(HostDescriptor* host) \ | |||||
| { \ | |||||
| return new ClassName(host); \ | |||||
| } \ | |||||
| static void _cleanup(PluginHandle handle) \ | |||||
| { \ | |||||
| delete (ClassName*)handle; \ | |||||
| #define PluginClassEND(ClassName) \ | |||||
| public: \ | |||||
| static PluginHandle _instantiate(const HostDescriptor* host) \ | |||||
| { \ | |||||
| return new ClassName(host); \ | |||||
| } \ | |||||
| static void _cleanup(PluginHandle handle) \ | |||||
| { \ | |||||
| delete (ClassName*)handle; \ | |||||
| } | } | ||||
| #define PluginDescriptorFILL(ClassName) \ | #define PluginDescriptorFILL(ClassName) \ | ||||
| @@ -458,4 +599,6 @@ public: \ | |||||
| ClassName::_set_state, \ | ClassName::_set_state, \ | ||||
| ClassName::_dispatcher | ClassName::_dispatcher | ||||
| // ----------------------------------------------------------------------- | |||||
| #endif // CARLA_NATIVE_HPP_INCLUDED | #endif // CARLA_NATIVE_HPP_INCLUDED | ||||
| @@ -4,16 +4,13 @@ | |||||
| # Created by falkTX | # Created by falkTX | ||||
| # | # | ||||
| include ../Makefile.mk | |||||
| ifeq ($(HAVE_QT4),true) | |||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) | |||||
| else | |||||
| BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) | |||||
| endif | |||||
| include ../../Makefile.mk | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| BUILD_C_FLAGS += -I. -I.. -I../../includes | |||||
| BUILD_CXX_FLAGS += -I. -I.. -I../../includes -I../../utils | |||||
| ifeq ($(HAVE_AF_DEPS),true) | ifeq ($(HAVE_AF_DEPS),true) | ||||
| AF_C_FLAGS = $(BUILD_C_FLAGS) | AF_C_FLAGS = $(BUILD_C_FLAGS) | ||||
| AF_C_FLAGS += $(shell pkg-config --cflags sndfile) | AF_C_FLAGS += $(shell pkg-config --cflags sndfile) | ||||
| @@ -34,9 +31,6 @@ GL_CXX_FLAGS += -I../../modules/distrho | |||||
| GL_CXX_FLAGS += $(shell pkg-config --cflags gl) | GL_CXX_FLAGS += $(shell pkg-config --cflags gl) | ||||
| endif | endif | ||||
| QT_CXX_FLAGS = $(BUILD_CXX_FLAGS) | |||||
| QT_CXX_FLAGS += -I../../modules/distrho -I../../modules/widgets | |||||
| ifeq ($(HAVE_ZYN_DEPS),true) | ifeq ($(HAVE_ZYN_DEPS),true) | ||||
| ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) | ZYN_CXX_FLAGS = $(BUILD_CXX_FLAGS) | ||||
| ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml zlib) | ZYN_CXX_FLAGS += $(shell pkg-config --cflags fftw3 mxml zlib) | ||||
| @@ -48,15 +42,19 @@ endif | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| # Simple plugins | |||||
| # Simple plugins (C) | |||||
| OBJS = \ | OBJS = \ | ||||
| bypass.c.o \ | bypass.c.o \ | ||||
| lfo.c.o \ | lfo.c.o \ | ||||
| midi-sequencer.cpp.o \ | |||||
| midi-gain.c.o \ | |||||
| midi-split.c.o \ | midi-split.c.o \ | ||||
| midi-through.c.o \ | midi-through.c.o \ | ||||
| midi-transpose.c.o \ | midi-transpose.c.o \ | ||||
| nekofilter.c.o \ | |||||
| nekofilter.c.o | |||||
| # Simple plugins (C++) | |||||
| OBJS += \ | |||||
| midi-sequencer.cpp.o \ | |||||
| vex.cpp.o | vex.cpp.o | ||||
| # AudioFile | # AudioFile | ||||
| @@ -74,19 +72,19 @@ OBJS += \ | |||||
| midi-file.cpp.o | midi-file.cpp.o | ||||
| endif | endif | ||||
| # DISTRHO plugins (OpenGL) | |||||
| ifeq ($(HAVE_OPENGL),true) | |||||
| OBJS += \ | |||||
| distrho-3bandeq.cpp.o \ | |||||
| distrho-3bandsplitter.cpp.o \ | |||||
| distrho-nekobi.cpp.o \ | |||||
| distrho-pingpongpan.cpp.o \ | |||||
| distrho-stereoenhancer.cpp.o | |||||
| endif | |||||
| # # DISTRHO plugins (OpenGL) | |||||
| # ifeq ($(HAVE_OPENGL),true) | |||||
| # OBJS += \ | |||||
| # distrho-3bandeq.cpp.o \ | |||||
| # distrho-3bandsplitter.cpp.o \ | |||||
| # distrho-nekobi.cpp.o \ | |||||
| # distrho-pingpongpan.cpp.o \ | |||||
| # distrho-stereoenhancer.cpp.o | |||||
| # endif | |||||
| # DISTRHO plugins (Qt) | |||||
| OBJS += \ | |||||
| distrho-notes.cpp.o | |||||
| # # DISTRHO plugins (Qt) | |||||
| # OBJS += \ | |||||
| # distrho-notes.cpp.o | |||||
| ifeq ($(HAVE_ZYN_DEPS),true) | ifeq ($(HAVE_ZYN_DEPS),true) | ||||
| # ZynAddSubFX | # ZynAddSubFX | ||||
| @@ -135,26 +133,38 @@ ZYN_UI_FILES_H = \ | |||||
| endif | endif | ||||
| endif | endif | ||||
| TARGET = ../libcarla_native.a | |||||
| # -------------------------------------------------------------- | |||||
| all: ../carla_native.a | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| all: $(TARGET) | |||||
| ../carla_native.a: $(OBJS) | |||||
| rm -f $@ | |||||
| $(AR) rs $@ $^ | |||||
| clean: | |||||
| rm -f $(OBJS) $(TARGET) $(ZYN_UI_FILES_H) $(ZYN_UI_FILES_CPP) | |||||
| rm -f moc_*.cpp | |||||
| ../carla_native.dll: $(OBJS) | |||||
| $(CXX) $^ -shared $(LINK_FLAGS) -o $@ | |||||
| debug: | |||||
| $(MAKE) DEBUG=true | |||||
| ../carla_native.dylib: $(OBJS) | |||||
| $(CXX) $^ -dynamiclib $(LINK_FLAGS) -o $@ | |||||
| ../carla_native.so: $(OBJS) | |||||
| $(CXX) $^ -shared $(LINK_FLAGS) -o $@ | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| CDEPS = ../CarlaNative.h | |||||
| CXXDEPS = ../CarlaNative.h ../CarlaNative.hpp | |||||
| CDEPS = CarlaNative.h | |||||
| CXXDEPS = CarlaNative.h CarlaNative.hpp | |||||
| $(TARGET): $(OBJS) | |||||
| $(AR) rs $@ $^ | |||||
| %.c.o: %.c | |||||
| $(CC) $< $(BUILD_C_FLAGS) -c -o $@ | |||||
| %.cpp.o: %.cpp | |||||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||||
| moc_%.cpp: %.hpp | |||||
| $(MOC) $< -DMOC_PARSING -o $@ | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| @@ -179,7 +189,7 @@ distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp pingpongpan/*.cpp pingpongpan | |||||
| distrho-stereoenhancer.cpp.o: distrho-stereoenhancer.cpp stereoenhancer/*.cpp stereoenhancer/*.h stereoenhancer/*.hpp distrho/DistrhoPluginCarla.cpp $(CXXDEPS) | distrho-stereoenhancer.cpp.o: distrho-stereoenhancer.cpp stereoenhancer/*.cpp stereoenhancer/*.h stereoenhancer/*.hpp distrho/DistrhoPluginCarla.cpp $(CXXDEPS) | ||||
| $(CXX) $< $(GL_CXX_FLAGS) -Istereoenhancer -DDISTRHO_NAMESPACE=DISTRHO_StereoEnhancer -c -o $@ | $(CXX) $< $(GL_CXX_FLAGS) -Istereoenhancer -DDISTRHO_NAMESPACE=DISTRHO_StereoEnhancer -c -o $@ | ||||
| distrho-notes.cpp.o: distrho-notes.cpp notes/moc_DistrhoUINotes.cpp notes/*.cpp notes/*.h notes/*.hpp distrho/DistrhoPluginCarla.cpp $(CXXDEPS) | |||||
| distrho-notes.cpp.o: distrho-notes.cpp notes/*.cpp notes/*.h notes/*.hpp distrho/DistrhoPluginCarla.cpp $(CXXDEPS) | |||||
| $(CXX) $< $(QT_CXX_FLAGS) -Inotes -DDISTRHO_NAMESPACE=DISTRHO_Notes -c -o $@ | $(CXX) $< $(QT_CXX_FLAGS) -Inotes -DDISTRHO_NAMESPACE=DISTRHO_Notes -c -o $@ | ||||
| midi-file.cpp.o: midi-file.cpp midi-base.hpp $(CXXDEPS) | midi-file.cpp.o: midi-file.cpp midi-base.hpp $(CXXDEPS) | ||||
| @@ -200,17 +210,6 @@ zynaddsubfx-src.cpp.o: zynaddsubfx-src.cpp $(ZYN_UI_FILES_H) $(ZYN_UI_FILES_CPP) | |||||
| zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_H) | zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_H) | ||||
| $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ | $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ | ||||
| # -------------------------------------------------------------- | |||||
| %.c.o: %.c | |||||
| $(CC) $< $(BUILD_C_FLAGS) -c -o $@ | |||||
| %.cpp.o: %.cpp | |||||
| $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||||
| moc_%.cpp: %.hpp | |||||
| $(MOC) $< -DMOC_PARSING -o $@ | |||||
| zynaddsubfx/UI/%.cpp: zynaddsubfx/UI/%.fl | zynaddsubfx/UI/%.cpp: zynaddsubfx/UI/%.fl | ||||
| ntk-fluid -c -o zynaddsubfx/UI/$*.cpp -h zynaddsubfx/UI/$*.h $< | ntk-fluid -c -o zynaddsubfx/UI/$*.cpp -h zynaddsubfx/UI/$*.h $< | ||||
| @@ -219,5 +218,9 @@ zynaddsubfx/UI/%.h: zynaddsubfx/UI/%.fl | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| ../libs/%: | |||||
| $(MAKE) -C ../libs $* | |||||
| clean: | |||||
| rm -f *.o ../carla_native.* | |||||
| rm -f $(ZYN_UI_FILES_H) $(ZYN_UI_FILES_CPP) | |||||
| debug: | |||||
| $(MAKE) DEBUG=true | |||||
| @@ -22,12 +22,12 @@ | |||||
| #define PROGRAM_COUNT 16 | #define PROGRAM_COUNT 16 | ||||
| class AudioFilePlugin : public PluginDescriptorClass, | |||||
| class AudioFilePlugin : public PluginClass, | |||||
| public AbstractAudioPlayer | public AbstractAudioPlayer | ||||
| { | { | ||||
| public: | public: | ||||
| AudioFilePlugin(const HostDescriptor* const host) | AudioFilePlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| AbstractAudioPlayer(), | AbstractAudioPlayer(), | ||||
| fLoopMode(false), | fLoopMode(false), | ||||
| fDoProcess(false), | fDoProcess(false), | ||||
| @@ -53,12 +53,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() override | |||||
| uint32_t getParameterCount() const override | |||||
| { | { | ||||
| return 0; // TODO - loopMode | return 0; // TODO - loopMode | ||||
| } | } | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index != 0) | if (index != 0) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -80,7 +80,7 @@ protected: | |||||
| return ¶m; | return ¶m; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) override | |||||
| float getParameterValue(const uint32_t index) const override | |||||
| { | { | ||||
| if (index != 0) | if (index != 0) | ||||
| return 0.0f; | return 0.0f; | ||||
| @@ -116,7 +116,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float**, float** const outBuffer, const uint32_t frames, const uint32_t, const MidiEvent* const) override | |||||
| void process(float**, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override | |||||
| { | { | ||||
| const TimeInfo* const timePos(getTimeInfo()); | const TimeInfo* const timePos(getTimeInfo()); | ||||
| @@ -237,7 +237,7 @@ private: | |||||
| } | } | ||||
| } | } | ||||
| PluginDescriptorClassEND(AudioFilePlugin) | |||||
| PluginClassEND(AudioFilePlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioFilePlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AudioFilePlugin) | ||||
| }; | }; | ||||
| @@ -17,7 +17,11 @@ | |||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| static PluginHandle bypass_instantiate(HostDescriptor* host) | |||||
| #include <string.h> | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginHandle bypass_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| // dummy, return non-NULL | // dummy, return non-NULL | ||||
| return (PluginHandle)0x1; | return (PluginHandle)0x1; | ||||
| @@ -26,20 +30,15 @@ static PluginHandle bypass_instantiate(HostDescriptor* host) | |||||
| (void)host; | (void)host; | ||||
| } | } | ||||
| static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||||
| static void bypass_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| float* in = inBuffer[0]; | |||||
| float* out = outBuffer[0]; | |||||
| for (uint32_t i=0; i < frames; ++i) | |||||
| *out++ = *in++; | |||||
| memcpy(outBuffer[0], inBuffer[0], sizeof(float)*frames); | |||||
| return; | return; | ||||
| // unused | // unused | ||||
| (void)handle; | (void)handle; | ||||
| (void)midiEventCount; | |||||
| (void)midiEvents; | (void)midiEvents; | ||||
| (void)midiEventCount; | |||||
| } | } | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -12,7 +12,7 @@ | |||||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| * GNU General Public License for more details. | * 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. | |||||
| */ | */ | ||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| @@ -21,21 +21,21 @@ | |||||
| #include <math.h> | #include <math.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #ifndef __linux__ | |||||
| # define uint unsigned int | |||||
| #endif | |||||
| typedef enum _LfoParams { | |||||
| PARAM_MODE = 0, | |||||
| PARAM_SPEED = 1, | |||||
| PARAM_MULTIPLIER = 2, | |||||
| PARAM_BASE_START = 3, | |||||
| PARAM_LFO_OUT = 4, | |||||
| PARAM_COUNT = 5 | |||||
| typedef unsigned int uint; | |||||
| // ----------------------------------------------------------------------- | |||||
| typedef enum { | |||||
| PARAM_MODE = 0, | |||||
| PARAM_SPEED, | |||||
| PARAM_MULTIPLIER, | |||||
| PARAM_BASE_START, | |||||
| PARAM_LFO_OUT, | |||||
| PARAM_COUNT | |||||
| } LfoParams; | } LfoParams; | ||||
| typedef struct _LfoHandle { | |||||
| HostDescriptor* host; | |||||
| typedef struct { | |||||
| const HostDescriptor* host; | |||||
| int mode; | int mode; | ||||
| float speed; | float speed; | ||||
| float multiplier; | float multiplier; | ||||
| @@ -43,7 +43,9 @@ typedef struct _LfoHandle { | |||||
| float value; | float value; | ||||
| } LfoHandle; | } LfoHandle; | ||||
| static PluginHandle lfo_instantiate(HostDescriptor* host) | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginHandle lfo_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| LfoHandle* const handle = (LfoHandle*)malloc(sizeof(LfoHandle)); | LfoHandle* const handle = (LfoHandle*)malloc(sizeof(LfoHandle)); | ||||
| @@ -108,7 +110,7 @@ const Parameter* lfo_get_parameter_info(PluginHandle handle, uint32_t index) | |||||
| param.hints |= PARAMETER_IS_INTEGER|PARAMETER_USES_SCALEPOINTS; | param.hints |= PARAMETER_IS_INTEGER|PARAMETER_USES_SCALEPOINTS; | ||||
| param.ranges.def = 1.0f; | param.ranges.def = 1.0f; | ||||
| param.ranges.min = 1.0f; | param.ranges.min = 1.0f; | ||||
| param.ranges.max = 3.0f; | |||||
| param.ranges.max = 5.0f; | |||||
| param.ranges.step = 1.0f; | param.ranges.step = 1.0f; | ||||
| param.ranges.stepSmall = 1.0f; | param.ranges.stepSmall = 1.0f; | ||||
| param.ranges.stepLarge = 1.0f; | param.ranges.stepLarge = 1.0f; | ||||
| @@ -119,7 +121,7 @@ const Parameter* lfo_get_parameter_info(PluginHandle handle, uint32_t index) | |||||
| param.name = "Speed"; | param.name = "Speed"; | ||||
| param.unit = "(coef)"; | param.unit = "(coef)"; | ||||
| param.ranges.def = 1.0f; | param.ranges.def = 1.0f; | ||||
| param.ranges.min = 0.1f; | |||||
| param.ranges.min = 0.01f; | |||||
| param.ranges.max = 2.0f; | param.ranges.max = 2.0f; | ||||
| param.ranges.step = 0.25f; | param.ranges.step = 0.25f; | ||||
| param.ranges.stepSmall = 0.1f; | param.ranges.stepSmall = 0.1f; | ||||
| @@ -129,7 +131,7 @@ const Parameter* lfo_get_parameter_info(PluginHandle handle, uint32_t index) | |||||
| param.name = "Multiplier"; | param.name = "Multiplier"; | ||||
| param.unit = "(coef)"; | param.unit = "(coef)"; | ||||
| param.ranges.def = 1.0f; | param.ranges.def = 1.0f; | ||||
| param.ranges.min = 0.0f; | |||||
| param.ranges.min = 0.01f; | |||||
| param.ranges.max = 2.0f; | param.ranges.max = 2.0f; | ||||
| param.ranges.step = 0.01f; | param.ranges.step = 0.01f; | ||||
| param.ranges.stepSmall = 0.0001f; | param.ranges.stepSmall = 0.0001f; | ||||
| @@ -138,7 +140,7 @@ const Parameter* lfo_get_parameter_info(PluginHandle handle, uint32_t index) | |||||
| case PARAM_BASE_START: | case PARAM_BASE_START: | ||||
| param.name = "Start value"; | param.name = "Start value"; | ||||
| param.unit = NULL; | param.unit = NULL; | ||||
| param.ranges.def = -1.0f; | |||||
| param.ranges.def = 0.0f; | |||||
| param.ranges.min = -1.0f; | param.ranges.min = -1.0f; | ||||
| param.ranges.max = 1.0f; | param.ranges.max = 1.0f; | ||||
| param.ranges.step = 0.01f; | param.ranges.step = 0.01f; | ||||
| @@ -205,47 +207,47 @@ static void lfo_set_parameter_value(PluginHandle handle, uint32_t index, float v | |||||
| } | } | ||||
| } | } | ||||
| static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||||
| static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| HostDescriptor* const host = handlePtr->host; | |||||
| const TimeInfo* const timeInfo = host->get_time_info(host->handle); | |||||
| const HostDescriptor* const host = handlePtr->host; | |||||
| const TimeInfo* const timeInfo = host->get_time_info(host->handle); | |||||
| if (! timeInfo->playing) | if (! timeInfo->playing) | ||||
| return; | return; | ||||
| const float bpm = timeInfo->bbt.valid ? timeInfo->bbt.beatsPerMinute : 120.0; | |||||
| const float SR = host->get_sample_rate(host->handle); | |||||
| const float bpm = timeInfo->bbt.valid ? timeInfo->bbt.beatsPerMinute : 120.0; | |||||
| const float sampleRate = host->get_sample_rate(host->handle); | |||||
| const float rate = handlePtr->speed/(bpm/60.0f/SR); | |||||
| const uint rateI = rate; | |||||
| const float speedRate = handlePtr->speed/(bpm/60.0f/sampleRate); | |||||
| const uint speedRatei = speedRate; | |||||
| float value = 0.0f; | float value = 0.0f; | ||||
| switch (handlePtr->mode) | switch (handlePtr->mode) | ||||
| { | { | ||||
| case 1: // Triangle | case 1: // Triangle | ||||
| value = fabs(1.0f-(float)(timeInfo->frame % rateI)/(rate/2.0f)); | |||||
| value = fabs(1.0f-(float)(timeInfo->frame % speedRatei)/(speedRate/2.0f)); | |||||
| break; | break; | ||||
| case 2: // Sawtooth | case 2: // Sawtooth | ||||
| value = (float)(timeInfo->frame % rateI)/rate; | |||||
| value = (float)(timeInfo->frame % speedRatei)/speedRate; | |||||
| break; | break; | ||||
| case 3: // Sawtooth (inverted) | case 3: // Sawtooth (inverted) | ||||
| value = 1.0f - (float)(timeInfo->frame % rateI)/rate; | |||||
| value = 1.0f - (float)(timeInfo->frame % speedRatei)/speedRate; | |||||
| break; | break; | ||||
| case 4: // Sine -- TODO! | case 4: // Sine -- TODO! | ||||
| value = 0.0f; | value = 0.0f; | ||||
| break; | break; | ||||
| case 5: // Square | case 5: // Square | ||||
| value = (timeInfo->frame % rateI <= rateI/2) ? 1.0f : 0.0f; | |||||
| value = (timeInfo->frame % speedRatei <= speedRatei/2) ? 1.0f : 0.0f; | |||||
| break; | break; | ||||
| } | } | ||||
| value *= handlePtr->multiplier; | value *= handlePtr->multiplier; | ||||
| value += handlePtr->baseStart; | value += handlePtr->baseStart; | ||||
| if (value < 0.0f) | |||||
| if (value <= 0.0f) | |||||
| handlePtr->value = 0.0f; | handlePtr->value = 0.0f; | ||||
| else if (value > 1.0f) | |||||
| else if (value >= 1.0f) | |||||
| handlePtr->value = 1.0f; | handlePtr->value = 1.0f; | ||||
| else | else | ||||
| handlePtr->value = value; | handlePtr->value = value; | ||||
| @@ -256,8 +258,8 @@ static void lfo_process(PluginHandle handle, float** inBuffer, float** outBuffer | |||||
| (void)inBuffer; | (void)inBuffer; | ||||
| (void)outBuffer; | (void)outBuffer; | ||||
| (void)frames; | (void)frames; | ||||
| (void)midiEventCount; | |||||
| (void)midiEvents; | (void)midiEvents; | ||||
| (void)midiEventCount; | |||||
| } | } | ||||
| #undef handlePtr | #undef handlePtr | ||||
| @@ -20,12 +20,12 @@ | |||||
| #include <smf.h> | #include <smf.h> | ||||
| class MidiFilePlugin : public PluginDescriptorClass, | |||||
| class MidiFilePlugin : public PluginClass, | |||||
| public AbstractMidiPlayer | public AbstractMidiPlayer | ||||
| { | { | ||||
| public: | public: | ||||
| MidiFilePlugin(const HostDescriptor* const host) | MidiFilePlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| fMidiOut(this), | fMidiOut(this), | ||||
| fWasPlayingBefore(false) | fWasPlayingBefore(false) | ||||
| { | { | ||||
| @@ -53,7 +53,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float**, float**, const uint32_t frames, const uint32_t, const MidiEvent* const) override | |||||
| void process(float**, float**, const uint32_t frames, const MidiEvent* const, const uint32_t) override | |||||
| { | { | ||||
| const TimeInfo* const timePos(getTimeInfo()); | const TimeInfo* const timePos(getTimeInfo()); | ||||
| @@ -76,7 +76,7 @@ protected: | |||||
| for (int i=0; i < MAX_MIDI_CHANNELS; ++i) | for (int i=0; i < MAX_MIDI_CHANNELS; ++i) | ||||
| { | { | ||||
| midiEvent.data[0] = MIDI_STATUS_CONTROL_CHANGE+i; | midiEvent.data[0] = MIDI_STATUS_CONTROL_CHANGE+i; | ||||
| PluginDescriptorClass::writeMidiEvent(&midiEvent); | |||||
| PluginClass::writeMidiEvent(&midiEvent); | |||||
| } | } | ||||
| carla_stdout("WAS PLAYING BEFORE, NOW STOPPED"); | carla_stdout("WAS PLAYING BEFORE, NOW STOPPED"); | ||||
| @@ -116,7 +116,7 @@ protected: | |||||
| midiEvent.data[3] = event->data[3]; | midiEvent.data[3] = event->data[3]; | ||||
| midiEvent.size = event->size; | midiEvent.size = event->size; | ||||
| PluginDescriptorClass::writeMidiEvent(&midiEvent); | |||||
| PluginClass::writeMidiEvent(&midiEvent); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -212,7 +212,7 @@ private: | |||||
| } | } | ||||
| } | } | ||||
| PluginDescriptorClassEND(MidiFilePlugin) | |||||
| PluginClassEND(MidiFilePlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MidiFilePlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MidiFilePlugin) | ||||
| }; | }; | ||||
| @@ -0,0 +1,271 @@ | |||||
| /* | |||||
| * Carla Native Plugins | |||||
| * 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 "CarlaNative.h" | |||||
| #include "CarlaMIDI.h" | |||||
| #include <stdlib.h> | |||||
| #include <string.h> | |||||
| // ----------------------------------------------------------------------- | |||||
| typedef enum { | |||||
| PARAM_GAIN = 0, | |||||
| PARAM_APPLY_NOTES, | |||||
| PARAM_APPLY_AFTERTOUCH, | |||||
| PARAM_APPLY_CC, | |||||
| PARAM_COUNT | |||||
| } MidiGainParams; | |||||
| typedef struct { | |||||
| const HostDescriptor* host; | |||||
| float gain; | |||||
| bool applyNotes; | |||||
| bool applyAftertouch; | |||||
| bool applyCC; | |||||
| } MidiGainHandle; | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginHandle midiGain_instantiate(const HostDescriptor* host) | |||||
| { | |||||
| MidiGainHandle* const handle = (MidiGainHandle*)malloc(sizeof(MidiGainHandle)); | |||||
| if (handle == NULL) | |||||
| return NULL; | |||||
| handle->host = host; | |||||
| handle->gain = 1.0f; | |||||
| handle->applyNotes = true; | |||||
| handle->applyAftertouch = true; | |||||
| handle->applyCC = false; | |||||
| return handle; | |||||
| } | |||||
| #define handlePtr ((MidiGainHandle*)handle) | |||||
| static void midiGain_cleanup(PluginHandle handle) | |||||
| { | |||||
| free(handlePtr); | |||||
| } | |||||
| static uint32_t midiGain_get_parameter_count(PluginHandle handle) | |||||
| { | |||||
| return PARAM_COUNT; | |||||
| // unused | |||||
| (void)handle; | |||||
| } | |||||
| const Parameter* midiGain_get_parameter_info(PluginHandle handle, uint32_t index) | |||||
| { | |||||
| if (index > PARAM_COUNT) | |||||
| return NULL; | |||||
| static Parameter param; | |||||
| param.hints = PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE; | |||||
| param.unit = NULL; | |||||
| param.scalePointCount = 0; | |||||
| param.scalePoints = NULL; | |||||
| switch (index) | |||||
| { | |||||
| case PARAM_GAIN: | |||||
| param.name = "Gain"; | |||||
| param.ranges.def = 1.0f; | |||||
| param.ranges.min = 0.001f; | |||||
| param.ranges.max = 4.0f; | |||||
| param.ranges.step = PARAMETER_RANGES_DEFAULT_STEP; | |||||
| param.ranges.stepSmall = PARAMETER_RANGES_DEFAULT_STEP_SMALL; | |||||
| param.ranges.stepLarge = PARAMETER_RANGES_DEFAULT_STEP_LARGE; | |||||
| break; | |||||
| case PARAM_APPLY_NOTES: | |||||
| param.name = "Apply Notes"; | |||||
| param.hints |= PARAMETER_IS_BOOLEAN; | |||||
| param.ranges.def = 1.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; | |||||
| break; | |||||
| case PARAM_APPLY_AFTERTOUCH: | |||||
| param.name = "Apply Aftertouch"; | |||||
| param.hints |= PARAMETER_IS_BOOLEAN; | |||||
| param.ranges.def = 1.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; | |||||
| break; | |||||
| case PARAM_APPLY_CC: | |||||
| param.name = "Apply CC"; | |||||
| param.hints |= PARAMETER_IS_BOOLEAN; | |||||
| 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; | |||||
| break; | |||||
| } | |||||
| return ¶m; | |||||
| // unused | |||||
| (void)handle; | |||||
| } | |||||
| static float midiGain_get_parameter_value(PluginHandle handle, uint32_t index) | |||||
| { | |||||
| switch (index) | |||||
| { | |||||
| case PARAM_GAIN: | |||||
| return handlePtr->gain; | |||||
| case PARAM_APPLY_NOTES: | |||||
| return handlePtr->applyNotes ? 1.0f : 0.0f; | |||||
| case PARAM_APPLY_AFTERTOUCH: | |||||
| return handlePtr->applyAftertouch ? 1.0f : 0.0f; | |||||
| case PARAM_APPLY_CC: | |||||
| return handlePtr->applyCC ? 1.0f : 0.0f; | |||||
| default: | |||||
| return 0.0f; | |||||
| } | |||||
| } | |||||
| static void midiGain_set_parameter_value(PluginHandle handle, uint32_t index, float value) | |||||
| { | |||||
| switch (index) | |||||
| { | |||||
| case PARAM_GAIN: | |||||
| handlePtr->gain = value; | |||||
| break; | |||||
| case PARAM_APPLY_NOTES: | |||||
| handlePtr->applyNotes = (value >= 0.5f); | |||||
| break; | |||||
| case PARAM_APPLY_AFTERTOUCH: | |||||
| handlePtr->applyAftertouch = (value >= 0.5f); | |||||
| break; | |||||
| case PARAM_APPLY_CC: | |||||
| handlePtr->applyCC = (value >= 0.5f); | |||||
| break; | |||||
| } | |||||
| } | |||||
| static void midiGain_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | |||||
| const HostDescriptor* const host = handlePtr->host; | |||||
| const float gain = handlePtr->gain; | |||||
| const bool applyNotes = handlePtr->applyNotes; | |||||
| const bool applyAftertouch = handlePtr->applyAftertouch; | |||||
| const bool applyCC = handlePtr->applyCC; | |||||
| MidiEvent tmpEvent; | |||||
| for (uint32_t i=0; i < midiEventCount; ++i) | |||||
| { | |||||
| const MidiEvent* const midiEvent = &midiEvents[i]; | |||||
| const uint8_t status = MIDI_GET_STATUS_FROM_DATA(midiEvent->data); | |||||
| if (midiEvent->size == 3 && ((applyNotes && (status == MIDI_STATUS_NOTE_OFF || status == MIDI_STATUS_NOTE_ON)) || | |||||
| (applyAftertouch && status == MIDI_STATUS_POLYPHONIC_AFTERTOUCH) || | |||||
| (applyCC && status == MIDI_STATUS_CONTROL_CHANGE))) | |||||
| { | |||||
| memcpy(&tmpEvent, midiEvent, sizeof(MidiEvent)); | |||||
| float value = (float)midiEvent->data[2] * gain; | |||||
| if (value <= 0.0f) | |||||
| tmpEvent.data[2] = 0; | |||||
| else if (value >= 1.27f) | |||||
| tmpEvent.data[2] = 127; | |||||
| else | |||||
| tmpEvent.data[2] = (uint8_t)value; | |||||
| host->write_midi_event(host->handle, &tmpEvent); | |||||
| } | |||||
| else | |||||
| host->write_midi_event(host->handle, midiEvent); | |||||
| } | |||||
| return; | |||||
| // unused | |||||
| (void)inBuffer; | |||||
| (void)outBuffer; | |||||
| (void)frames; | |||||
| } | |||||
| // ----------------------------------------------------------------------- | |||||
| static const PluginDescriptor midiGainDesc = { | |||||
| .category = PLUGIN_CATEGORY_UTILITY, | |||||
| .hints = PLUGIN_IS_RTSAFE, | |||||
| .supports = PLUGIN_SUPPORTS_EVERYTHING, | |||||
| .audioIns = 0, | |||||
| .audioOuts = 0, | |||||
| .midiIns = 1, | |||||
| .midiOuts = 1, | |||||
| .parameterIns = 0, | |||||
| .parameterOuts = 0, | |||||
| .name = "MIDI Gain", | |||||
| .label = "midiGain", | |||||
| .maker = "falkTX", | |||||
| .copyright = "GNU GPL v2+", | |||||
| .instantiate = midiGain_instantiate, | |||||
| .cleanup = midiGain_cleanup, | |||||
| .get_parameter_count = midiGain_get_parameter_count, | |||||
| .get_parameter_info = midiGain_get_parameter_info, | |||||
| .get_parameter_value = midiGain_get_parameter_value, | |||||
| .get_parameter_text = NULL, | |||||
| .get_midi_program_count = NULL, | |||||
| .get_midi_program_info = NULL, | |||||
| .set_parameter_value = midiGain_set_parameter_value, | |||||
| .set_midi_program = NULL, | |||||
| .set_custom_data = NULL, | |||||
| .ui_show = NULL, | |||||
| .ui_idle = NULL, | |||||
| .ui_set_parameter_value = NULL, | |||||
| .ui_set_midi_program = NULL, | |||||
| .ui_set_custom_data = NULL, | |||||
| .activate = NULL, | |||||
| .deactivate = NULL, | |||||
| .process = midiGain_process, | |||||
| .get_state = NULL, | |||||
| .set_state = NULL, | |||||
| .dispatcher = NULL | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| void carla_register_native_plugin_midiGain() | |||||
| { | |||||
| carla_register_native_plugin(&midiGainDesc); | |||||
| } | |||||
| // ----------------------------------------------------------------------- | |||||
| @@ -18,12 +18,12 @@ | |||||
| #include "CarlaNative.hpp" | #include "CarlaNative.hpp" | ||||
| #include "midi-base.hpp" | #include "midi-base.hpp" | ||||
| class MidiSequencerPlugin : public PluginDescriptorClass, | |||||
| class MidiSequencerPlugin : public PluginClass, | |||||
| public AbstractMidiPlayer | public AbstractMidiPlayer | ||||
| { | { | ||||
| public: | public: | ||||
| MidiSequencerPlugin(const HostDescriptor* const host) | MidiSequencerPlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| fWantInEvents(false), | fWantInEvents(false), | ||||
| fMidiOut(this) | fMidiOut(this) | ||||
| { | { | ||||
| @@ -136,7 +136,7 @@ protected: | |||||
| { | { | ||||
| } | } | ||||
| void process(float**, float**, const uint32_t frames, const uint32_t midiEventCount, const MidiEvent* const midiEvents) override | |||||
| void process(float**, float**, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override | |||||
| { | { | ||||
| const TimeInfo* const timePos = getTimeInfo(); | const TimeInfo* const timePos = getTimeInfo(); | ||||
| @@ -184,7 +184,7 @@ protected: | |||||
| midiEvent.data[3] = event->data[3]; | midiEvent.data[3] = event->data[3]; | ||||
| midiEvent.size = event->size; | midiEvent.size = event->size; | ||||
| PluginDescriptorClass::writeMidiEvent(&midiEvent); | |||||
| PluginClass::writeMidiEvent(&midiEvent); | |||||
| } | } | ||||
| private: | private: | ||||
| @@ -226,7 +226,7 @@ private: | |||||
| MidiPattern fMidiOut; | MidiPattern fMidiOut; | ||||
| PluginDescriptorClassEND(MidiSequencerPlugin) | |||||
| PluginClassEND(MidiSequencerPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MidiSequencerPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MidiSequencerPlugin) | ||||
| }; | }; | ||||
| @@ -18,33 +18,17 @@ | |||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| #include <stdlib.h> | |||||
| typedef struct _MidiSplitHandle { | |||||
| HostDescriptor* host; | |||||
| } MidiSplitHandle; | |||||
| static PluginHandle midiSplit_instantiate(HostDescriptor* host) | |||||
| { | |||||
| MidiSplitHandle* const handle = (MidiSplitHandle*)malloc(sizeof(MidiSplitHandle)); | |||||
| if (handle == NULL) | |||||
| return NULL; | |||||
| handle->host = host; | |||||
| return handle; | |||||
| } | |||||
| #define handlePtr ((MidiSplitHandle*)handle) | |||||
| // ----------------------------------------------------------------------- | |||||
| static void midiSplit_cleanup(PluginHandle handle) | |||||
| static PluginHandle midiSplit_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| free(handlePtr); | |||||
| // use HostDescriptor as PluginHandle | |||||
| return (PluginHandle)host; | |||||
| } | } | ||||
| static void midiSplit_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||||
| static void midiSplit_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| HostDescriptor* const host = handlePtr->host; | |||||
| const HostDescriptor* const host = (const HostDescriptor*)handle; | |||||
| MidiEvent tmpEvent; | MidiEvent tmpEvent; | ||||
| for (uint32_t i=0; i < midiEventCount; ++i) | for (uint32_t i=0; i < midiEventCount; ++i) | ||||
| @@ -76,8 +60,6 @@ static void midiSplit_process(PluginHandle handle, float** inBuffer, float** out | |||||
| (void)frames; | (void)frames; | ||||
| } | } | ||||
| #undef handlePtr | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor midiSplitDesc = { | static const PluginDescriptor midiSplitDesc = { | ||||
| @@ -96,7 +78,7 @@ static const PluginDescriptor midiSplitDesc = { | |||||
| .copyright = "GNU GPL v2+", | .copyright = "GNU GPL v2+", | ||||
| .instantiate = midiSplit_instantiate, | .instantiate = midiSplit_instantiate, | ||||
| .cleanup = midiSplit_cleanup, | |||||
| .cleanup = NULL, | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| @@ -18,33 +18,17 @@ | |||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| #include <stdlib.h> | |||||
| typedef struct _MidiThroughHandle { | |||||
| HostDescriptor* host; | |||||
| } MidiThroughHandle; | |||||
| static PluginHandle midiThrough_instantiate(HostDescriptor* host) | |||||
| { | |||||
| MidiThroughHandle* const handle = (MidiThroughHandle*)malloc(sizeof(MidiThroughHandle)); | |||||
| if (handle == NULL) | |||||
| return NULL; | |||||
| handle->host = host; | |||||
| return handle; | |||||
| } | |||||
| #define handlePtr ((MidiThroughHandle*)handle) | |||||
| // ----------------------------------------------------------------------- | |||||
| static void midiThrough_cleanup(PluginHandle handle) | |||||
| static PluginHandle midiThrough_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| free(handlePtr); | |||||
| // use HostDescriptor as PluginHandle | |||||
| return (PluginHandle)host; | |||||
| } | } | ||||
| static void midiThrough_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||||
| static void midiThrough_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| HostDescriptor* const host = handlePtr->host; | |||||
| const HostDescriptor* const host = (const HostDescriptor*)handle; | |||||
| for (uint32_t i=0; i < midiEventCount; ++i) | for (uint32_t i=0; i < midiEventCount; ++i) | ||||
| host->write_midi_event(host->handle, &midiEvents[i]); | host->write_midi_event(host->handle, &midiEvents[i]); | ||||
| @@ -57,8 +41,6 @@ static void midiThrough_process(PluginHandle handle, float** inBuffer, float** o | |||||
| (void)frames; | (void)frames; | ||||
| } | } | ||||
| #undef handlePtr | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static const PluginDescriptor midiThroughDesc = { | static const PluginDescriptor midiThroughDesc = { | ||||
| @@ -77,7 +59,7 @@ static const PluginDescriptor midiThroughDesc = { | |||||
| .copyright = "GNU GPL v2+", | .copyright = "GNU GPL v2+", | ||||
| .instantiate = midiThrough_instantiate, | .instantiate = midiThrough_instantiate, | ||||
| .cleanup = midiThrough_cleanup, | |||||
| .cleanup = NULL, | |||||
| .get_parameter_count = NULL, | .get_parameter_count = NULL, | ||||
| .get_parameter_info = NULL, | .get_parameter_info = NULL, | ||||
| @@ -20,12 +20,16 @@ | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| typedef struct _MidiTransposeHandle { | |||||
| HostDescriptor* host; | |||||
| // ----------------------------------------------------------------------- | |||||
| typedef struct { | |||||
| const HostDescriptor* host; | |||||
| int octaves; | int octaves; | ||||
| } MidiTransposeHandle; | } MidiTransposeHandle; | ||||
| static PluginHandle midiTranspose_instantiate(HostDescriptor* host) | |||||
| // ----------------------------------------------------------------------- | |||||
| static PluginHandle midiTranspose_instantiate(const HostDescriptor* host) | |||||
| { | { | ||||
| MidiTransposeHandle* const handle = (MidiTransposeHandle*)malloc(sizeof(MidiTransposeHandle)); | MidiTransposeHandle* const handle = (MidiTransposeHandle*)malloc(sizeof(MidiTransposeHandle)); | ||||
| @@ -93,9 +97,9 @@ static void midiTranspose_set_parameter_value(PluginHandle handle, uint32_t inde | |||||
| handlePtr->octaves = (int)value; | handlePtr->octaves = (int)value; | ||||
| } | } | ||||
| static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||||
| static void midiTranspose_process(PluginHandle handle, float** inBuffer, float** outBuffer, uint32_t frames, const MidiEvent* midiEvents, uint32_t midiEventCount) | |||||
| { | { | ||||
| HostDescriptor* const host = handlePtr->host; | |||||
| const HostDescriptor* const host = handlePtr->host; | |||||
| const int octaves = handlePtr->octaves; | const int octaves = handlePtr->octaves; | ||||
| MidiEvent tmpEvent; | MidiEvent tmpEvent; | ||||
| @@ -17,7 +17,9 @@ | |||||
| #include "CarlaNative.h" | #include "CarlaNative.h" | ||||
| // ----------------------------------------------------------------------- | |||||
| // Plugin Code | // Plugin Code | ||||
| #include "nekofilter/nekofilter.c" | #include "nekofilter/nekofilter.c" | ||||
| #include "nekofilter/filter.c" | #include "nekofilter/filter.c" | ||||
| #include "nekofilter/log.c" | #include "nekofilter/log.c" | ||||
| @@ -25,14 +25,14 @@ | |||||
| #define LOG_LEVEL LOG_LEVEL_ERROR | #define LOG_LEVEL LOG_LEVEL_ERROR | ||||
| #include "CarlaNative.h" | |||||
| #include <assert.h> | #include <assert.h> | ||||
| #include <math.h> | #include <math.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include "CarlaNative.h" | |||||
| #include "filter.h" | #include "filter.h" | ||||
| #include "log.h" | #include "log.h" | ||||
| @@ -47,7 +47,7 @@ struct nekofilter | |||||
| filter_handle filter; | filter_handle filter; | ||||
| float params_global[GLOBAL_PARAMETERS_COUNT]; | float params_global[GLOBAL_PARAMETERS_COUNT]; | ||||
| float params_bands[BAND_PARAMETERS_COUNT*BANDS_COUNT]; | float params_bands[BAND_PARAMETERS_COUNT*BANDS_COUNT]; | ||||
| HostDescriptor* host; | |||||
| const HostDescriptor* host; | |||||
| #ifdef WANT_UI | #ifdef WANT_UI | ||||
| struct control* ui; | struct control* ui; | ||||
| #endif | #endif | ||||
| @@ -55,7 +55,7 @@ struct nekofilter | |||||
| PluginHandle | PluginHandle | ||||
| nekofilter_instantiate( | nekofilter_instantiate( | ||||
| HostDescriptor* host) | |||||
| const HostDescriptor* host) | |||||
| { | { | ||||
| struct nekofilter * nekofilter_ptr; | struct nekofilter * nekofilter_ptr; | ||||
| unsigned int i; | unsigned int i; | ||||
| @@ -329,8 +329,8 @@ nekofilter_process( | |||||
| float** inBuffer, | float** inBuffer, | ||||
| float** outBuffer, | float** outBuffer, | ||||
| uint32_t frames, | uint32_t frames, | ||||
| uint32_t midiEventCount, | |||||
| const MidiEvent* midiEvents) | |||||
| const MidiEvent* midiEvents, | |||||
| uint32_t midiEventCount) | |||||
| { | { | ||||
| LOG_DEBUG("nekofilter_run"); | LOG_DEBUG("nekofilter_run"); | ||||
| filter_run( | filter_run( | ||||
| @@ -47,6 +47,8 @@ | |||||
| # define FORK_STR "fork" | # define FORK_STR "fork" | ||||
| #endif | #endif | ||||
| #include "CarlaNative.h" | |||||
| #include <errno.h> | #include <errno.h> | ||||
| #include <fcntl.h> | #include <fcntl.h> | ||||
| #include <locale.h> | #include <locale.h> | ||||
| @@ -65,11 +67,9 @@ | |||||
| # include <sched.h> | # include <sched.h> | ||||
| #endif | #endif | ||||
| #include "CarlaNative.h" | |||||
| struct control | struct control | ||||
| { | { | ||||
| HostDescriptor* host; | |||||
| const HostDescriptor* host; | |||||
| bool running; /* true if UI launched and 'exiting' not received */ | bool running; /* true if UI launched and 'exiting' not received */ | ||||
| bool visible; /* true if 'show' sent */ | bool visible; /* true if 'show' sent */ | ||||
| @@ -245,8 +245,12 @@ nekoui_show( | |||||
| return; | return; | ||||
| } | } | ||||
| write(control_ptr->send_pipe, "show\n", 5); | |||||
| ssize_t ign = write(control_ptr->send_pipe, "show\n", 5); | |||||
| control_ptr->visible = true; | control_ptr->visible = true; | ||||
| return; | |||||
| // ignored | |||||
| (void)ign; | |||||
| } | } | ||||
| void | void | ||||
| @@ -258,15 +262,19 @@ nekoui_hide( | |||||
| return; | return; | ||||
| } | } | ||||
| write(control_ptr->send_pipe, "hide\n", 5); | |||||
| ssize_t ign = write(control_ptr->send_pipe, "hide\n", 5); | |||||
| control_ptr->visible = false; | control_ptr->visible = false; | ||||
| return; | |||||
| // ignored | |||||
| (void)ign; | |||||
| } | } | ||||
| void | void | ||||
| nekoui_quit( | nekoui_quit( | ||||
| struct control * control_ptr) | struct control * control_ptr) | ||||
| { | { | ||||
| write(control_ptr->send_pipe, "quit\n", 5); | |||||
| ssize_t ign = write(control_ptr->send_pipe, "quit\n", 5); | |||||
| control_ptr->visible = false; | control_ptr->visible = false; | ||||
| /* for a while wait child to exit, we dont like zombie processes */ | /* for a while wait child to exit, we dont like zombie processes */ | ||||
| @@ -282,6 +290,10 @@ nekoui_quit( | |||||
| wait_child(control_ptr->pid); | wait_child(control_ptr->pid); | ||||
| } | } | ||||
| } | } | ||||
| return; | |||||
| // ignored | |||||
| (void)ign; | |||||
| } | } | ||||
| #if defined(FORK_TIME_MEASURE) | #if defined(FORK_TIME_MEASURE) | ||||
| @@ -325,10 +337,35 @@ static int clone_fn(void * context) | |||||
| #endif | #endif | ||||
| static bool do_fork(const char * argv[6], int* ret) | |||||
| { | |||||
| int ret2 = *ret = FORK(); | |||||
| switch (ret2) | |||||
| { | |||||
| case 0: /* child process */ | |||||
| /* fork duplicated the handles, close pipe ends that are used by parent process */ | |||||
| #if !defined(USE_VFORK) | |||||
| /* it looks we cant do this for vfork() */ | |||||
| close(pipe1[1]); | |||||
| close(pipe2[0]); | |||||
| #endif | |||||
| execvp(argv[0], (char **)argv); | |||||
| fprintf(stderr, "exec of UI failed: %s\n", strerror(errno)); | |||||
| return false; | |||||
| case -1: | |||||
| fprintf(stderr, "fork() failed to create new process for plugin UI\n"); | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| static | static | ||||
| struct control* | struct control* | ||||
| nekoui_instantiate( | nekoui_instantiate( | ||||
| HostDescriptor* host) | |||||
| const HostDescriptor* host) | |||||
| { | { | ||||
| struct control * control_ptr; | struct control * control_ptr; | ||||
| char * filename; | char * filename; | ||||
| @@ -359,6 +396,11 @@ nekoui_instantiate( | |||||
| } | } | ||||
| control_ptr->host = host; | control_ptr->host = host; | ||||
| control_ptr->running = false; | |||||
| control_ptr->visible = false; | |||||
| control_ptr->send_pipe = -1; | |||||
| control_ptr->recv_pipe = -1; | |||||
| control_ptr->pid = -1; | |||||
| if (pipe(pipe1) != 0) | if (pipe(pipe1) != 0) | ||||
| { | { | ||||
| @@ -385,11 +427,6 @@ nekoui_instantiate( | |||||
| char sample_rate_str[12] = { 0 }; | char sample_rate_str[12] = { 0 }; | ||||
| snprintf(sample_rate_str, 12, "%g", host->get_sample_rate(host->handle)); | snprintf(sample_rate_str, 12, "%g", host->get_sample_rate(host->handle)); | ||||
| control_ptr->running = false; | |||||
| control_ptr->visible = false; | |||||
| control_ptr->pid = -1; | |||||
| argv[1] = filename; | argv[1] = filename; | ||||
| argv[2] = sample_rate_str; | argv[2] = sample_rate_str; | ||||
| argv[3] = ui_recv_pipe; /* reading end */ | argv[3] = ui_recv_pipe; /* reading end */ | ||||
| @@ -413,25 +450,8 @@ nekoui_instantiate( | |||||
| fprintf(stderr, "clone2() exec not implemented yet\n"); | fprintf(stderr, "clone2() exec not implemented yet\n"); | ||||
| goto fail_free_control; | goto fail_free_control; | ||||
| #else | #else | ||||
| ret = FORK(); | |||||
| switch (ret) | |||||
| { | |||||
| case 0: /* child process */ | |||||
| /* fork duplicated the handles, close pipe ends that are used by parent process */ | |||||
| #if !defined(USE_VFORK) | |||||
| /* it looks we cant do this for vfork() */ | |||||
| close(pipe1[1]); | |||||
| close(pipe2[0]); | |||||
| #endif | |||||
| execvp(argv[0], (char **)argv); | |||||
| fprintf(stderr, "exec of UI failed: %s\n", strerror(errno)); | |||||
| goto fail_free_control; | |||||
| case -1: | |||||
| fprintf(stderr, "fork() failed to create new process for plugin UI\n"); | |||||
| goto fail_free_control; | |||||
| } | |||||
| if (! do_fork(argv, &ret)) | |||||
| goto fail_free_control; | |||||
| #endif | #endif | ||||
| FORK_TIME_MEASURE_END(FORK_STR "() time"); | FORK_TIME_MEASURE_END(FORK_STR "() time"); | ||||
| @@ -525,21 +545,26 @@ void nekoui_set_parameter_value( | |||||
| char buf[100]; | char buf[100]; | ||||
| int len; | int len; | ||||
| char * locale; | char * locale; | ||||
| ssize_t ign; | |||||
| //printf("port_event(%u, %f) called\n", (unsigned int)port_index, *(float *)buffer); | //printf("port_event(%u, %f) called\n", (unsigned int)port_index, *(float *)buffer); | ||||
| locale = strdup(setlocale(LC_NUMERIC, NULL)); | locale = strdup(setlocale(LC_NUMERIC, NULL)); | ||||
| setlocale(LC_NUMERIC, "POSIX"); | setlocale(LC_NUMERIC, "POSIX"); | ||||
| write(control_ptr->send_pipe, "port_value\n", 11); | |||||
| ign = write(control_ptr->send_pipe, "port_value\n", 11); | |||||
| len = sprintf(buf, "%u\n", (unsigned int)index); | len = sprintf(buf, "%u\n", (unsigned int)index); | ||||
| write(control_ptr->send_pipe, buf, len); | |||||
| ign = write(control_ptr->send_pipe, buf, len); | |||||
| len = sprintf(buf, "%.10f\n", value); | len = sprintf(buf, "%.10f\n", value); | ||||
| write(control_ptr->send_pipe, buf, len); | |||||
| ign = write(control_ptr->send_pipe, buf, len); | |||||
| fsync(control_ptr->send_pipe); | fsync(control_ptr->send_pipe); | ||||
| setlocale(LC_NUMERIC, locale); | setlocale(LC_NUMERIC, locale); | ||||
| free(locale); | free(locale); | ||||
| return; | |||||
| // ignored | |||||
| (void)ign; | |||||
| } | } | ||||
| #undef control_ptr | #undef control_ptr | ||||
| @@ -26,7 +26,7 @@ using namespace juce; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class VexArpPlugin : public PluginDescriptorClass | |||||
| class VexArpPlugin : public PluginClass | |||||
| { | { | ||||
| public: | public: | ||||
| enum Params { | enum Params { | ||||
| @@ -40,7 +40,7 @@ public: | |||||
| }; | }; | ||||
| VexArpPlugin(const HostDescriptor* const host) | VexArpPlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| fSettings(), | fSettings(), | ||||
| fArp(&fSettings) | fArp(&fSettings) | ||||
| { | { | ||||
| @@ -65,12 +65,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() override | |||||
| uint32_t getParameterCount() const override | |||||
| { | { | ||||
| return kParamCount; | return kParamCount; | ||||
| } | } | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| static Parameter paramInfo; | static Parameter paramInfo; | ||||
| static ParameterScalePoint scalePoints[4]; | static ParameterScalePoint scalePoints[4]; | ||||
| @@ -168,7 +168,7 @@ protected: | |||||
| return ¶mInfo; | return ¶mInfo; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) override | |||||
| float getParameterValue(const uint32_t index) const override | |||||
| { | { | ||||
| switch (index) | switch (index) | ||||
| { | { | ||||
| @@ -197,7 +197,7 @@ protected: | |||||
| switch (index) | switch (index) | ||||
| { | { | ||||
| case kParamOnOff: | case kParamOnOff: | ||||
| fSettings.on = (value > 0.5f); | |||||
| fSettings.on = (value >= 0.5f); | |||||
| break; | break; | ||||
| case kParamLength: | case kParamLength: | ||||
| fSettings.length = value; | fSettings.length = value; | ||||
| @@ -220,7 +220,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float**, float**, const uint32_t frames, const uint32_t midiEventCount, const MidiEvent* const midiEvents) override | |||||
| void process(float**, float**, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override | |||||
| { | { | ||||
| if (! fSettings.on) | if (! fSettings.on) | ||||
| { | { | ||||
| @@ -280,18 +280,26 @@ protected: | |||||
| } | } | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin dispatcher calls | |||||
| void sampleRateChanged(const double sampleRate) override | |||||
| { | |||||
| fArp.setSampleRate(sampleRate); | |||||
| } | |||||
| private: | private: | ||||
| VexArpSettings fSettings; | VexArpSettings fSettings; | ||||
| VexArp fArp; | VexArp fArp; | ||||
| MidiBuffer fMidiInBuffer; | MidiBuffer fMidiInBuffer; | ||||
| PluginDescriptorClassEND(VexArpPlugin) | |||||
| PluginClassEND(VexArpPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexArpPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexArpPlugin) | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class VexChorusPlugin : public PluginDescriptorClass | |||||
| class VexChorusPlugin : public PluginClass | |||||
| { | { | ||||
| public: | public: | ||||
| enum Params { | enum Params { | ||||
| @@ -301,7 +309,7 @@ public: | |||||
| }; | }; | ||||
| VexChorusPlugin(const HostDescriptor* const host) | VexChorusPlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| chorus(parameters) | chorus(parameters) | ||||
| { | { | ||||
| parameters[0] = 0.6f; | parameters[0] = 0.6f; | ||||
| @@ -314,12 +322,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() override | |||||
| uint32_t getParameterCount() const override | |||||
| { | { | ||||
| return kParamCount; | return kParamCount; | ||||
| } | } | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| static Parameter paramInfo; | static Parameter paramInfo; | ||||
| @@ -357,7 +365,7 @@ protected: | |||||
| return ¶mInfo; | return ¶mInfo; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) override | |||||
| float getParameterValue(const uint32_t index) const override | |||||
| { | { | ||||
| if (index < kParamCount) | if (index < kParamCount) | ||||
| return parameters[index]; | return parameters[index]; | ||||
| @@ -376,7 +384,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t, const MidiEvent* const) override | |||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override | |||||
| { | { | ||||
| if (inBuffer[0] != outBuffer[0]) | if (inBuffer[0] != outBuffer[0]) | ||||
| carla_copyFloat(outBuffer[0], inBuffer[0], frames); | carla_copyFloat(outBuffer[0], inBuffer[0], frames); | ||||
| @@ -386,17 +394,25 @@ protected: | |||||
| chorus.processBlock(outBuffer[0], outBuffer[1], frames); | chorus.processBlock(outBuffer[0], outBuffer[1], frames); | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin dispatcher calls | |||||
| void sampleRateChanged(const double sampleRate) override | |||||
| { | |||||
| chorus.setSampleRate(sampleRate); | |||||
| } | |||||
| private: | private: | ||||
| VexChorus chorus; | VexChorus chorus; | ||||
| float parameters[2]; | float parameters[2]; | ||||
| PluginDescriptorClassEND(VexChorusPlugin) | |||||
| PluginClassEND(VexChorusPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexChorusPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexChorusPlugin) | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class VexDelayPlugin : public PluginDescriptorClass | |||||
| class VexDelayPlugin : public PluginClass | |||||
| { | { | ||||
| public: | public: | ||||
| enum Params { | enum Params { | ||||
| @@ -406,7 +422,7 @@ public: | |||||
| }; | }; | ||||
| VexDelayPlugin(const HostDescriptor* const host) | VexDelayPlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| delay(parameters) | delay(parameters) | ||||
| { | { | ||||
| parameters[0] = 4.0f; | parameters[0] = 4.0f; | ||||
| @@ -419,12 +435,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() override | |||||
| uint32_t getParameterCount() const override | |||||
| { | { | ||||
| return kParamCount; | return kParamCount; | ||||
| } | } | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| static Parameter paramInfo; | static Parameter paramInfo; | ||||
| @@ -464,7 +480,7 @@ protected: | |||||
| return ¶mInfo; | return ¶mInfo; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) override | |||||
| float getParameterValue(const uint32_t index) const override | |||||
| { | { | ||||
| if (index < kParamCount) | if (index < kParamCount) | ||||
| return parameters[index]; | return parameters[index]; | ||||
| @@ -483,7 +499,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t, const MidiEvent* const) override | |||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override | |||||
| { | { | ||||
| if (inBuffer[0] != outBuffer[0]) | if (inBuffer[0] != outBuffer[0]) | ||||
| carla_copyFloat(outBuffer[0], inBuffer[0], frames); | carla_copyFloat(outBuffer[0], inBuffer[0], frames); | ||||
| @@ -496,17 +512,25 @@ protected: | |||||
| delay.processBlock(outBuffer[0], outBuffer[1], frames, bpm); | delay.processBlock(outBuffer[0], outBuffer[1], frames, bpm); | ||||
| } | } | ||||
| // ------------------------------------------------------------------- | |||||
| // Plugin dispatcher calls | |||||
| void sampleRateChanged(const double sampleRate) override | |||||
| { | |||||
| delay.setSampleRate(sampleRate); | |||||
| } | |||||
| private: | private: | ||||
| VexDelay delay; | VexDelay delay; | ||||
| float parameters[2]; | float parameters[2]; | ||||
| PluginDescriptorClassEND(VexDelayPlugin) | |||||
| PluginClassEND(VexDelayPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexDelayPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexDelayPlugin) | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class VexReverbPlugin : public PluginDescriptorClass | |||||
| class VexReverbPlugin : public PluginClass | |||||
| { | { | ||||
| public: | public: | ||||
| enum Params { | enum Params { | ||||
| @@ -517,7 +541,7 @@ public: | |||||
| }; | }; | ||||
| VexReverbPlugin(const HostDescriptor* const host) | VexReverbPlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| reverb(parameters) | reverb(parameters) | ||||
| { | { | ||||
| parameters[0] = 0.6f; | parameters[0] = 0.6f; | ||||
| @@ -529,12 +553,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() override | |||||
| uint32_t getParameterCount() const override | |||||
| { | { | ||||
| return kParamCount; | return kParamCount; | ||||
| } | } | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| static Parameter paramInfo; | static Parameter paramInfo; | ||||
| @@ -578,7 +602,7 @@ protected: | |||||
| return ¶mInfo; | return ¶mInfo; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) override | |||||
| float getParameterValue(const uint32_t index) const override | |||||
| { | { | ||||
| if (index < kParamCount) | if (index < kParamCount) | ||||
| return parameters[index]; | return parameters[index]; | ||||
| @@ -597,7 +621,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin process calls | // Plugin process calls | ||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t, const MidiEvent* const) override | |||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) override | |||||
| { | { | ||||
| for (uint32_t i=0; i< frames; ++i) | for (uint32_t i=0; i< frames; ++i) | ||||
| outBuffer[0][i] = inBuffer[0][i]/2.0f; | outBuffer[0][i] = inBuffer[0][i]/2.0f; | ||||
| @@ -611,7 +635,7 @@ private: | |||||
| VexReverb reverb; | VexReverb reverb; | ||||
| float parameters[3]; | float parameters[3]; | ||||
| PluginDescriptorClassEND(VexReverbPlugin) | |||||
| PluginClassEND(VexReverbPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexReverbPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(VexReverbPlugin) | ||||
| }; | }; | ||||
| @@ -24,8 +24,6 @@ | |||||
| #include "CarlaString.hpp" | #include "CarlaString.hpp" | ||||
| #include "RtList.hpp" | #include "RtList.hpp" | ||||
| #include <QtCore/QThread> | |||||
| #include "zynaddsubfx/Misc/Master.h" | #include "zynaddsubfx/Misc/Master.h" | ||||
| #include "zynaddsubfx/Misc/Part.h" | #include "zynaddsubfx/Misc/Part.h" | ||||
| #include "zynaddsubfx/Misc/Util.h" | #include "zynaddsubfx/Misc/Util.h" | ||||
| @@ -236,6 +234,8 @@ private: | |||||
| ProgramInfo() = delete; | ProgramInfo() = delete; | ||||
| ProgramInfo(ProgramInfo&) = delete; | ProgramInfo(ProgramInfo&) = delete; | ||||
| ProgramInfo(const ProgramInfo&) = delete; | ProgramInfo(const ProgramInfo&) = delete; | ||||
| ProgramInfo& operator=(ProgramInfo&); | |||||
| ProgramInfo& operator=(const ProgramInfo&); | |||||
| #endif | #endif | ||||
| }; | }; | ||||
| @@ -354,18 +354,18 @@ static ZynAddSubFxInstanceCount sInstanceCount; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class ZynAddSubFxThread : public QThread | |||||
| class ZynAddSubFxThread : public juce::Thread | |||||
| { | { | ||||
| public: | public: | ||||
| ZynAddSubFxThread(Master* const master, const HostDescriptor* const host) | ZynAddSubFxThread(Master* const master, const HostDescriptor* const host) | ||||
| : fMaster(master), | |||||
| : juce::Thread("ZynAddSubFxThread"), | |||||
| fMaster(master), | |||||
| kHost(host), | kHost(host), | ||||
| #ifdef WANT_ZYNADDSUBFX_UI | #ifdef WANT_ZYNADDSUBFX_UI | ||||
| fUi(nullptr), | fUi(nullptr), | ||||
| fUiClosed(0), | fUiClosed(0), | ||||
| fNextUiAction(-1), | fNextUiAction(-1), | ||||
| #endif | #endif | ||||
| fQuit(false), | |||||
| fChangeProgram(false), | fChangeProgram(false), | ||||
| fNextChannel(0), | fNextChannel(0), | ||||
| fNextBank(0), | fNextBank(0), | ||||
| @@ -375,11 +375,10 @@ public: | |||||
| ~ZynAddSubFxThread() | ~ZynAddSubFxThread() | ||||
| { | { | ||||
| // must be closed by now | |||||
| #ifdef WANT_ZYNADDSUBFX_UI | #ifdef WANT_ZYNADDSUBFX_UI | ||||
| // must be closed by now | |||||
| CARLA_ASSERT(fUi == nullptr); | CARLA_ASSERT(fUi == nullptr); | ||||
| #endif | #endif | ||||
| CARLA_ASSERT(fQuit); | |||||
| } | } | ||||
| void loadProgramLater(const uint8_t channel, const uint32_t bank, const uint32_t program) | void loadProgramLater(const uint8_t channel, const uint32_t bank, const uint32_t program) | ||||
| @@ -403,12 +402,6 @@ public: | |||||
| fMaster = master; | fMaster = master; | ||||
| } | } | ||||
| void stop() | |||||
| { | |||||
| fQuit = true; | |||||
| quit(); | |||||
| } | |||||
| #ifdef WANT_ZYNADDSUBFX_UI | #ifdef WANT_ZYNADDSUBFX_UI | ||||
| void uiHide() | void uiHide() | ||||
| { | { | ||||
| @@ -430,7 +423,7 @@ public: | |||||
| protected: | protected: | ||||
| void run() override | void run() override | ||||
| { | { | ||||
| while (! fQuit) | |||||
| while (! threadShouldExit()) | |||||
| { | { | ||||
| #ifdef WANT_ZYNADDSUBFX_UI | #ifdef WANT_ZYNADDSUBFX_UI | ||||
| Fl::lock(); | Fl::lock(); | ||||
| @@ -529,7 +522,7 @@ protected: | |||||
| } | } | ||||
| #ifdef WANT_ZYNADDSUBFX_UI | #ifdef WANT_ZYNADDSUBFX_UI | ||||
| if (fQuit && fUi != nullptr) | |||||
| if (threadShouldExit() && fUi != nullptr) | |||||
| { | { | ||||
| Fl::lock(); | Fl::lock(); | ||||
| delete fUi; | delete fUi; | ||||
| @@ -547,38 +540,37 @@ private: | |||||
| #ifdef WANT_ZYNADDSUBFX_UI | #ifdef WANT_ZYNADDSUBFX_UI | ||||
| MasterUI* fUi; | MasterUI* fUi; | ||||
| int fUiClosed; | int fUiClosed; | ||||
| int fNextUiAction; | |||||
| volatile int fNextUiAction; | |||||
| #endif | #endif | ||||
| bool fQuit; | |||||
| bool fChangeProgram; | |||||
| uint8_t fNextChannel; | |||||
| uint32_t fNextBank; | |||||
| uint32_t fNextProgram; | |||||
| volatile bool fChangeProgram; | |||||
| volatile uint8_t fNextChannel; | |||||
| volatile uint32_t fNextBank; | |||||
| volatile uint32_t fNextProgram; | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| #define ZynPluginDescriptorClassEND(ClassName) \ | |||||
| public: \ | |||||
| static PluginHandle _instantiate(HostDescriptor* host) \ | |||||
| { \ | |||||
| sInstanceCount.addOne(host); \ | |||||
| return new ClassName(host); \ | |||||
| } \ | |||||
| static void _cleanup(PluginHandle handle) \ | |||||
| { \ | |||||
| delete (ClassName*)handle; \ | |||||
| sInstanceCount.removeOne(); \ | |||||
| #define ZynPluginClassEND(ClassName) \ | |||||
| public: \ | |||||
| static PluginHandle _instantiate(const HostDescriptor* host) \ | |||||
| { \ | |||||
| sInstanceCount.addOne(host); \ | |||||
| return new ClassName(host); \ | |||||
| } \ | |||||
| static void _cleanup(PluginHandle handle) \ | |||||
| { \ | |||||
| delete (ClassName*)handle; \ | |||||
| sInstanceCount.removeOne(); \ | |||||
| } | } | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class FxAbstractPlugin : public PluginDescriptorClass | |||||
| class FxAbstractPlugin : public PluginClass | |||||
| { | { | ||||
| protected: | protected: | ||||
| FxAbstractPlugin(const HostDescriptor* const host, const uint32_t paramCount, const uint32_t programCount) | FxAbstractPlugin(const HostDescriptor* const host, const uint32_t paramCount, const uint32_t programCount) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| fEffect(nullptr), | fEffect(nullptr), | ||||
| efxoutl(new float[synth->buffersize]), | efxoutl(new float[synth->buffersize]), | ||||
| efxoutr(new float[synth->buffersize]), | efxoutr(new float[synth->buffersize]), | ||||
| @@ -616,12 +608,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| uint32_t getParameterCount() final | |||||
| uint32_t getParameterCount() const final | |||||
| { | { | ||||
| return kParamCount; | return kParamCount; | ||||
| } | } | ||||
| float getParameterValue(const uint32_t index) final | |||||
| float getParameterValue(const uint32_t index) const final | |||||
| { | { | ||||
| return fEffect->getpar(index+2); | return fEffect->getpar(index+2); | ||||
| } | } | ||||
| @@ -629,7 +621,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| uint32_t getMidiProgramCount() final | |||||
| uint32_t getMidiProgramCount() const final | |||||
| { | { | ||||
| return kProgramCount; | return kProgramCount; | ||||
| } | } | ||||
| @@ -648,11 +640,11 @@ protected: | |||||
| fEffect->setpreset(program); | fEffect->setpreset(program); | ||||
| const float volume(float(fEffect->getpar(0))/127.0f); | const float volume(float(fEffect->getpar(0))/127.0f); | ||||
| hostDispatcher(HOST_OPCODE_SET_VOLUME, 0, 0, nullptr, volume); | |||||
| hostSetVolume(volume); | |||||
| const unsigned char pan(fEffect->getpar(1)); | const unsigned char pan(fEffect->getpar(1)); | ||||
| const float panning(float(pan)/63.5f-1.0f); | const float panning(float(pan)/63.5f-1.0f); | ||||
| hostDispatcher(HOST_OPCODE_SET_PANNING, 0, 0, nullptr, (pan == 64) ? 0.0f : panning); | |||||
| hostSetPanning(panning); | |||||
| fEffect->changepar(0, 127); | fEffect->changepar(0, 127); | ||||
| fEffect->changepar(1, 64); | fEffect->changepar(1, 64); | ||||
| @@ -668,11 +660,11 @@ protected: | |||||
| if (fFirstInit) | if (fFirstInit) | ||||
| { | { | ||||
| fFirstInit = false; | fFirstInit = false; | ||||
| hostDispatcher(HOST_OPCODE_SET_DRYWET, 0, 0, nullptr, 0.5f); | |||||
| hostSetDryWet(0.5f); | |||||
| } | } | ||||
| } | } | ||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t, const MidiEvent* const) final | |||||
| void process(float** const inBuffer, float** const outBuffer, const uint32_t frames, const MidiEvent* const, const uint32_t) final | |||||
| { | { | ||||
| CARLA_ASSERT(synth->buffersize == static_cast<int>(frames)); | CARLA_ASSERT(synth->buffersize == static_cast<int>(frames)); | ||||
| @@ -685,31 +677,23 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin dispatcher | // Plugin dispatcher | ||||
| intptr_t pluginDispatcher(const PluginDispatcherOpcode opcode, const int32_t, const intptr_t, void* const, const float) final | |||||
| void bufferSizeChanged(const uint32_t bufferSize) final | |||||
| { | { | ||||
| switch (opcode) | |||||
| { | |||||
| case PLUGIN_OPCODE_BUFFER_SIZE_CHANGED: | |||||
| { | |||||
| const uint32_t bufferSize(getBufferSize()); | |||||
| delete[] efxoutl; | |||||
| delete[] efxoutr; | |||||
| efxoutl = new float[bufferSize]; | |||||
| efxoutr = new float[bufferSize]; | |||||
| carla_zeroFloat(efxoutl, synth->buffersize); | |||||
| carla_zeroFloat(efxoutr, synth->buffersize); | |||||
| *((float**)&fEffect->efxoutl) = efxoutl; | |||||
| *((float**)&fEffect->efxoutr) = efxoutr; | |||||
| // no break | |||||
| } | |||||
| case PLUGIN_OPCODE_SAMPLE_RATE_CHANGED: | |||||
| sInstanceCount.maybeReinit(getHostHandle()); | |||||
| break; | |||||
| default: | |||||
| break; | |||||
| } | |||||
| delete[] efxoutl; | |||||
| delete[] efxoutr; | |||||
| efxoutl = new float[bufferSize]; | |||||
| efxoutr = new float[bufferSize]; | |||||
| carla_zeroFloat(efxoutl, synth->buffersize); | |||||
| carla_zeroFloat(efxoutr, synth->buffersize); | |||||
| *((float**)&fEffect->efxoutl) = efxoutl; | |||||
| *((float**)&fEffect->efxoutr) = efxoutr; | |||||
| return 0; | |||||
| sInstanceCount.maybeReinit(getHostHandle()); | |||||
| } | |||||
| void sampleRateChanged(const double) final | |||||
| { | |||||
| sInstanceCount.maybeReinit(getHostHandle()); | |||||
| } | } | ||||
| Effect* fEffect; | Effect* fEffect; | ||||
| @@ -735,7 +719,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -821,7 +805,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -853,7 +837,7 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxAlienWahPlugin) | |||||
| ZynPluginClassEND(FxAlienWahPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxAlienWahPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxAlienWahPlugin) | ||||
| }; | }; | ||||
| @@ -872,7 +856,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -964,7 +948,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1014,7 +998,7 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxChorusPlugin) | |||||
| ZynPluginClassEND(FxChorusPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxChorusPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxChorusPlugin) | ||||
| }; | }; | ||||
| @@ -1033,7 +1017,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1145,7 +1129,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1183,7 +1167,7 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxDistortionPlugin) | |||||
| ZynPluginClassEND(FxDistortionPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxDistortionPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxDistortionPlugin) | ||||
| }; | }; | ||||
| @@ -1202,7 +1186,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1283,7 +1267,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1318,7 +1302,7 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxDynamicFilterPlugin) | |||||
| ZynPluginClassEND(FxDynamicFilterPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxDynamicFilterPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxDynamicFilterPlugin) | ||||
| }; | }; | ||||
| @@ -1337,7 +1321,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1394,7 +1378,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1441,7 +1425,7 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxEchoPlugin) | |||||
| ZynPluginClassEND(FxEchoPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxEchoPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxEchoPlugin) | ||||
| }; | }; | ||||
| @@ -1460,7 +1444,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1569,7 +1553,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1625,7 +1609,7 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxPhaserPlugin) | |||||
| ZynPluginClassEND(FxPhaserPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxPhaserPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxPhaserPlugin) | ||||
| }; | }; | ||||
| @@ -1644,7 +1628,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin parameter calls | // Plugin parameter calls | ||||
| const Parameter* getParameterInfo(const uint32_t index) override | |||||
| const Parameter* getParameterInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kParamCount) | if (index >= kParamCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1736,7 +1720,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| if (index >= kProgramCount) | if (index >= kProgramCount) | ||||
| return nullptr; | return nullptr; | ||||
| @@ -1795,23 +1779,23 @@ protected: | |||||
| return &midiProg; | return &midiProg; | ||||
| } | } | ||||
| ZynPluginDescriptorClassEND(FxReverbPlugin) | |||||
| ZynPluginClassEND(FxReverbPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxReverbPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FxReverbPlugin) | ||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class ZynAddSubFxPlugin : public PluginDescriptorClass | |||||
| class ZynAddSubFxPlugin : public PluginClass | |||||
| { | { | ||||
| public: | public: | ||||
| ZynAddSubFxPlugin(const HostDescriptor* const host) | ZynAddSubFxPlugin(const HostDescriptor* const host) | ||||
| : PluginDescriptorClass(host), | |||||
| : PluginClass(host), | |||||
| fMaster(new Master()), | fMaster(new Master()), | ||||
| fSampleRate(getSampleRate()), | fSampleRate(getSampleRate()), | ||||
| fIsActive(false), | fIsActive(false), | ||||
| fThread(fMaster, host) | fThread(fMaster, host) | ||||
| { | { | ||||
| fThread.start(); | |||||
| fThread.startThread(3); | |||||
| for (int i = 0; i < NUM_MIDI_PARTS; ++i) | for (int i = 0; i < NUM_MIDI_PARTS; ++i) | ||||
| fMaster->partonoff(i, 1); | fMaster->partonoff(i, 1); | ||||
| @@ -1824,8 +1808,7 @@ public: | |||||
| //ensure that everything has stopped | //ensure that everything has stopped | ||||
| pthread_mutex_lock(&fMaster->mutex); | pthread_mutex_lock(&fMaster->mutex); | ||||
| pthread_mutex_unlock(&fMaster->mutex); | pthread_mutex_unlock(&fMaster->mutex); | ||||
| fThread.stop(); | |||||
| fThread.wait(); | |||||
| fThread.stopThread(-1); | |||||
| delete fMaster; | delete fMaster; | ||||
| fMaster = nullptr; | fMaster = nullptr; | ||||
| @@ -1835,12 +1818,12 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin midi-program calls | // Plugin midi-program calls | ||||
| uint32_t getMidiProgramCount() override | |||||
| uint32_t getMidiProgramCount() const override | |||||
| { | { | ||||
| return sPrograms.count(); | return sPrograms.count(); | ||||
| } | } | ||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) override | |||||
| const MidiProgram* getMidiProgramInfo(const uint32_t index) const override | |||||
| { | { | ||||
| return sPrograms.getInfo(index); | return sPrograms.getInfo(index); | ||||
| } | } | ||||
| @@ -1890,7 +1873,7 @@ protected: | |||||
| fIsActive = false; | fIsActive = false; | ||||
| } | } | ||||
| void process(float**, float** const outBuffer, const uint32_t frames, const uint32_t midiEventCount, const MidiEvent* const midiEvents) override | |||||
| void process(float**, float** const outBuffer, const uint32_t frames, const MidiEvent* const midiEvents, const uint32_t midiEventCount) override | |||||
| { | { | ||||
| if (pthread_mutex_trylock(&fMaster->mutex) != 0) | if (pthread_mutex_trylock(&fMaster->mutex) != 0) | ||||
| { | { | ||||
| @@ -1964,7 +1947,7 @@ protected: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin state calls | // Plugin state calls | ||||
| char* getState() override | |||||
| char* getState() const override | |||||
| { | { | ||||
| config.save(); | config.save(); | ||||
| @@ -1980,6 +1963,7 @@ protected: | |||||
| fMaster->applyparameters(true); | fMaster->applyparameters(true); | ||||
| } | } | ||||
| #if 0 | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Plugin dispatcher | // Plugin dispatcher | ||||
| @@ -2011,6 +1995,7 @@ protected: | |||||
| (void)value; | (void)value; | ||||
| (void)ptr; | (void)ptr; | ||||
| } | } | ||||
| #endif | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| @@ -2021,7 +2006,7 @@ private: | |||||
| ZynAddSubFxThread fThread; | ZynAddSubFxThread fThread; | ||||
| ZynPluginDescriptorClassEND(ZynAddSubFxPlugin) | |||||
| ZynPluginClassEND(ZynAddSubFxPlugin) | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ZynAddSubFxPlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ZynAddSubFxPlugin) | ||||
| }; | }; | ||||
| @@ -0,0 +1,387 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef ADnoteUI_h | |||||
| #define ADnoteUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include "../Params/ADnoteParameters.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "../Misc/Master.h" | |||||
| #include "ResonanceUI.h" | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include "WidgetPDial.h" | |||||
| #include "EnvelopeUI.h" | |||||
| #include "LFOUI.h" | |||||
| #include "FilterUI.h" | |||||
| #include "OscilGenUI.h" | |||||
| #include "PresetsUI.h" | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Value_Slider.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| class ADvoicelistitem : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *ADnoteVoiceListItem; | |||||
| Fl_Group *voicelistitemgroup; | |||||
| public: | |||||
| Fl_Value_Slider *voicevolume; | |||||
| private: | |||||
| void cb_voicevolume_i(Fl_Value_Slider*, void*); | |||||
| static void cb_voicevolume(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Check_Button *voiceresonanceenabled; | |||||
| private: | |||||
| void cb_voiceresonanceenabled_i(Fl_Check_Button*, void*); | |||||
| static void cb_voiceresonanceenabled(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *voicelfofreq; | |||||
| private: | |||||
| void cb_voicelfofreq_i(Fl_Value_Slider*, void*); | |||||
| static void cb_voicelfofreq(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| WidgetPDial *voicepanning; | |||||
| private: | |||||
| void cb_voicepanning_i(WidgetPDial*, void*); | |||||
| static void cb_voicepanning(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Group *voiceoscil; | |||||
| Fl_Value_Output *detunevalueoutput; | |||||
| private: | |||||
| void cb_detunevalueoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_detunevalueoutput(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Slider *voicedetune; | |||||
| private: | |||||
| void cb_voicedetune_i(Fl_Slider*, void*); | |||||
| static void cb_voicedetune(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Box *noiselabel; | |||||
| private: | |||||
| void cb_noiselabel_i(Fl_Box*, void*); | |||||
| static void cb_noiselabel(Fl_Box*, void*); | |||||
| Fl_Check_Button *voiceenabled; | |||||
| void cb_voiceenabled_i(Fl_Check_Button*, void*); | |||||
| static void cb_voiceenabled(Fl_Check_Button*, void*); | |||||
| public: | |||||
| ADvoicelistitem(int x,int y, int w, int h, const char *label=0); | |||||
| void init(ADnoteParameters *parameters,int nvoice_,Master *master_); | |||||
| void refreshlist(); | |||||
| ~ADvoicelistitem(); | |||||
| private: | |||||
| ADnoteParameters *pars; | |||||
| int nvoice; | |||||
| Oscilloscope *osc; | |||||
| Master *master; | |||||
| }; | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| class ADvoiceUI : public Fl_Group { | |||||
| public: | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *ADnoteVoiceParameters; | |||||
| Fl_Group *voiceparametersgroup; | |||||
| Fl_Group *voicemodegroup; | |||||
| Fl_Group *voiceFMparametersgroup; | |||||
| Fl_Group *modfrequency; | |||||
| EnvelopeUI *voiceFMfreqenvgroup; | |||||
| private: | |||||
| void cb_On_i(Fl_Check_Button*, void*); | |||||
| static void cb_On(Fl_Check_Button*, void*); | |||||
| void cb_Coarse_i(Fl_Counter*, void*); | |||||
| static void cb_Coarse(Fl_Counter*, void*); | |||||
| void cb_Octave_i(Fl_Counter*, void*); | |||||
| static void cb_Octave(Fl_Counter*, void*); | |||||
| void cb__i(Fl_Slider*, void*); | |||||
| static void cb_(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Output *fmdetunevalueoutput; | |||||
| private: | |||||
| void cb_fmdetunevalueoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_fmdetunevalueoutput(Fl_Value_Output*, void*); | |||||
| void cb_Detune_i(Fl_Choice*, void*); | |||||
| static void cb_Detune(Fl_Choice*, void*); | |||||
| void cb_Vol_i(Fl_Value_Slider*, void*); | |||||
| static void cb_Vol(Fl_Value_Slider*, void*); | |||||
| void cb_V_i(Fl_Value_Slider*, void*); | |||||
| static void cb_V(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| EnvelopeUI *voiceFMampenvgroup; | |||||
| private: | |||||
| void cb_On1_i(Fl_Check_Button*, void*); | |||||
| static void cb_On1(Fl_Check_Button*, void*); | |||||
| void cb_F_i(Fl_Value_Slider*, void*); | |||||
| static void cb_F(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Group *modoscil; | |||||
| Fl_Group *fmoscil; | |||||
| Fl_Button *changeFMoscilbutton; | |||||
| private: | |||||
| void cb_changeFMoscilbutton_i(Fl_Button*, void*); | |||||
| static void cb_changeFMoscilbutton(Fl_Button*, void*); | |||||
| void cb_Phase_i(Fl_Slider*, void*); | |||||
| static void cb_Phase(Fl_Slider*, void*); | |||||
| void cb_Use_i(Fl_Choice*, void*); | |||||
| static void cb_Use(Fl_Choice*, void*); | |||||
| void cb_External_i(Fl_Choice*, void*); | |||||
| static void cb_External(Fl_Choice*, void*); | |||||
| void cb_Type_i(Fl_Choice*, void*); | |||||
| static void cb_Type(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_Type[]; | |||||
| public: | |||||
| EnvelopeUI *voicefreqenvgroup; | |||||
| private: | |||||
| void cb_On2_i(Fl_Check_Button*, void*); | |||||
| static void cb_On2(Fl_Check_Button*, void*); | |||||
| public: | |||||
| LFOUI *voicefreqlfogroup; | |||||
| private: | |||||
| void cb_On3_i(Fl_Check_Button*, void*); | |||||
| static void cb_On3(Fl_Check_Button*, void*); | |||||
| void cb_Octave1_i(Fl_Counter*, void*); | |||||
| static void cb_Octave1(Fl_Counter*, void*); | |||||
| void cb_Coarse1_i(Fl_Counter*, void*); | |||||
| static void cb_Coarse1(Fl_Counter*, void*); | |||||
| void cb_1_i(Fl_Slider*, void*); | |||||
| static void cb_1(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Output *detunevalueoutput; | |||||
| private: | |||||
| void cb_detunevalueoutput1_i(Fl_Value_Output*, void*); | |||||
| static void cb_detunevalueoutput1(Fl_Value_Output*, void*); | |||||
| void cb_440Hz_i(Fl_Check_Button*, void*); | |||||
| static void cb_440Hz(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *fixedfreqetdial; | |||||
| private: | |||||
| void cb_fixedfreqetdial_i(WidgetPDial*, void*); | |||||
| static void cb_fixedfreqetdial(WidgetPDial*, void*); | |||||
| void cb_Detune1_i(Fl_Choice*, void*); | |||||
| static void cb_Detune1(Fl_Choice*, void*); | |||||
| public: | |||||
| Fl_Group *voiceoscil; | |||||
| Fl_Button *changevoiceoscilbutton; | |||||
| private: | |||||
| void cb_changevoiceoscilbutton_i(Fl_Button*, void*); | |||||
| static void cb_changevoiceoscilbutton(Fl_Button*, void*); | |||||
| void cb_Phase1_i(Fl_Slider*, void*); | |||||
| static void cb_Phase1(Fl_Slider*, void*); | |||||
| void cb_R_i(Fl_Check_Button*, void*); | |||||
| static void cb_R(Fl_Check_Button*, void*); | |||||
| void cb_Use1_i(Fl_Choice*, void*); | |||||
| static void cb_Use1(Fl_Choice*, void*); | |||||
| void cb_Stereo_i(WidgetPDial*, void*); | |||||
| static void cb_Stereo(WidgetPDial*, void*); | |||||
| void cb_Unison_i(Fl_Choice*, void*); | |||||
| static void cb_Unison(Fl_Choice*, void*); | |||||
| void cb_Vibratto_i(WidgetPDial*, void*); | |||||
| static void cb_Vibratto(WidgetPDial*, void*); | |||||
| void cb_Invert_i(Fl_Choice*, void*); | |||||
| static void cb_Invert(Fl_Choice*, void*); | |||||
| void cb_Frequency_i(Fl_Slider*, void*); | |||||
| static void cb_Frequency(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Output *unisonspreadoutput; | |||||
| private: | |||||
| void cb_unisonspreadoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_unisonspreadoutput(Fl_Value_Output*, void*); | |||||
| void cb_Vib_i(WidgetPDial*, void*); | |||||
| static void cb_Vib(WidgetPDial*, void*); | |||||
| void cb_Vol1_i(Fl_Value_Slider*, void*); | |||||
| static void cb_Vol1(Fl_Value_Slider*, void*); | |||||
| void cb_V1_i(Fl_Value_Slider*, void*); | |||||
| static void cb_V1(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| EnvelopeUI *voiceampenvgroup; | |||||
| private: | |||||
| void cb_Pan_i(WidgetPDial*, void*); | |||||
| static void cb_Pan(WidgetPDial*, void*); | |||||
| void cb_On4_i(Fl_Check_Button*, void*); | |||||
| static void cb_On4(Fl_Check_Button*, void*); | |||||
| public: | |||||
| LFOUI *voiceamplfogroup; | |||||
| private: | |||||
| void cb_On5_i(Fl_Check_Button*, void*); | |||||
| static void cb_On5(Fl_Check_Button*, void*); | |||||
| void cb_Minus_i(Fl_Check_Button*, void*); | |||||
| static void cb_Minus(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Group *voicefiltergroup; | |||||
| EnvelopeUI *voicefilterenvgroup; | |||||
| private: | |||||
| void cb_On6_i(Fl_Check_Button*, void*); | |||||
| static void cb_On6(Fl_Check_Button*, void*); | |||||
| public: | |||||
| LFOUI *voicefilterlfogroup; | |||||
| private: | |||||
| void cb_On7_i(Fl_Check_Button*, void*); | |||||
| static void cb_On7(Fl_Check_Button*, void*); | |||||
| void cb_2_i(Fl_Choice*, void*); | |||||
| static void cb_2(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_[]; | |||||
| public: | |||||
| Fl_Check_Button *bypassfiltercheckbutton; | |||||
| private: | |||||
| void cb_bypassfiltercheckbutton_i(Fl_Check_Button*, void*); | |||||
| static void cb_bypassfiltercheckbutton(Fl_Check_Button*, void*); | |||||
| void cb_Delay_i(Fl_Value_Slider*, void*); | |||||
| static void cb_Delay(Fl_Value_Slider*, void*); | |||||
| void cb_On8_i(Fl_Check_Button*, void*); | |||||
| static void cb_On8(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Box *noiselabel; | |||||
| private: | |||||
| void cb_noiselabel1_i(Fl_Box*, void*); | |||||
| static void cb_noiselabel1(Fl_Box*, void*); | |||||
| public: | |||||
| Fl_Check_Button *voiceonbutton; | |||||
| private: | |||||
| void cb_voiceonbutton_i(Fl_Check_Button*, void*); | |||||
| static void cb_voiceonbutton(Fl_Check_Button*, void*); | |||||
| public: | |||||
| ADvoiceUI(int x,int y, int w, int h, const char *label=0); | |||||
| void init(ADnoteParameters *parameters,int nvoice_,Master *master_); | |||||
| ~ADvoiceUI(); | |||||
| private: | |||||
| int nvoice; | |||||
| ADnoteParameters *pars; | |||||
| OscilEditor *oscedit; | |||||
| Oscilloscope *osc; | |||||
| Oscilloscope *oscFM; | |||||
| Master *master; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Text_Display.H> | |||||
| #include <FL/Fl_Scroll.H> | |||||
| #include <FL/Fl_Pack.H> | |||||
| class ADnoteUI : public PresetsUI_ { | |||||
| Fl_Double_Window* make_window(); | |||||
| public: | |||||
| Fl_Double_Window *ADnoteGlobalParameters; | |||||
| EnvelopeUI *freqenv; | |||||
| Fl_Counter *octave; | |||||
| private: | |||||
| void cb_octave_i(Fl_Counter*, void*); | |||||
| static void cb_octave(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *coarsedet; | |||||
| private: | |||||
| void cb_coarsedet_i(Fl_Counter*, void*); | |||||
| static void cb_coarsedet(Fl_Counter*, void*); | |||||
| public: | |||||
| LFOUI *freqlfo; | |||||
| Fl_Slider *freq; | |||||
| private: | |||||
| void cb_freq_i(Fl_Slider*, void*); | |||||
| static void cb_freq(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Output *detunevalueoutput; | |||||
| private: | |||||
| void cb_detunevalueoutput2_i(Fl_Value_Output*, void*); | |||||
| static void cb_detunevalueoutput2(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Choice *detunetype; | |||||
| private: | |||||
| void cb_detunetype_i(Fl_Choice*, void*); | |||||
| static void cb_detunetype(Fl_Choice*, void*); | |||||
| void cb_relBW_i(WidgetPDial*, void*); | |||||
| static void cb_relBW(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *volume; | |||||
| private: | |||||
| void cb_volume_i(Fl_Value_Slider*, void*); | |||||
| static void cb_volume(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *vsns; | |||||
| private: | |||||
| void cb_vsns_i(Fl_Value_Slider*, void*); | |||||
| static void cb_vsns(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| WidgetPDial *pan; | |||||
| private: | |||||
| void cb_pan_i(WidgetPDial*, void*); | |||||
| static void cb_pan(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pstr; | |||||
| private: | |||||
| void cb_pstr_i(WidgetPDial*, void*); | |||||
| static void cb_pstr(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pt; | |||||
| private: | |||||
| void cb_pt_i(WidgetPDial*, void*); | |||||
| static void cb_pt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pstc; | |||||
| private: | |||||
| void cb_pstc_i(WidgetPDial*, void*); | |||||
| static void cb_pstc(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pvel; | |||||
| private: | |||||
| void cb_pvel_i(WidgetPDial*, void*); | |||||
| static void cb_pvel(WidgetPDial*, void*); | |||||
| public: | |||||
| EnvelopeUI *ampenv; | |||||
| LFOUI *amplfo; | |||||
| Fl_Check_Button *rndgrp; | |||||
| private: | |||||
| void cb_rndgrp_i(Fl_Check_Button*, void*); | |||||
| static void cb_rndgrp(Fl_Check_Button*, void*); | |||||
| public: | |||||
| EnvelopeUI *filterenv; | |||||
| LFOUI *filterlfo; | |||||
| FilterUI *filterui; | |||||
| Fl_Check_Button *stereo; | |||||
| private: | |||||
| void cb_stereo_i(Fl_Check_Button*, void*); | |||||
| static void cb_stereo(Fl_Check_Button*, void*); | |||||
| void cb_Show_i(Fl_Button*, void*); | |||||
| static void cb_Show(Fl_Button*, void*); | |||||
| void cb_Show1_i(Fl_Button*, void*); | |||||
| static void cb_Show1(Fl_Button*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_Resonance_i(Fl_Button*, void*); | |||||
| static void cb_Resonance(Fl_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *ADnoteVoice; | |||||
| ADvoiceUI *advoice; | |||||
| private: | |||||
| void cb_Close1_i(Fl_Button*, void*); | |||||
| static void cb_Close1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *currentvoicecounter; | |||||
| private: | |||||
| void cb_currentvoicecounter_i(Fl_Counter*, void*); | |||||
| static void cb_currentvoicecounter(Fl_Counter*, void*); | |||||
| void cb_C1_i(Fl_Button*, void*); | |||||
| static void cb_C1(Fl_Button*, void*); | |||||
| void cb_P1_i(Fl_Button*, void*); | |||||
| static void cb_P1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *ADnoteVoiceList; | |||||
| private: | |||||
| void cb_Hide_i(Fl_Button*, void*); | |||||
| static void cb_Hide(Fl_Button*, void*); | |||||
| public: | |||||
| ADnoteUI(ADnoteParameters *parameters,Master *master_); | |||||
| ~ADnoteUI(); | |||||
| void refresh(); | |||||
| private: | |||||
| ADnoteParameters *pars; | |||||
| ResonanceUI *resui; | |||||
| Master *master; | |||||
| int nvoice; | |||||
| ADvoicelistitem *voicelistitem[NUM_VOICES]; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,420 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/BankUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| void BankProcess_::process() { | |||||
| ; | |||||
| } | |||||
| BankSlot::BankSlot(int x,int y, int w, int h, const char *label):Fl_Button(x,y,w,h,label) { | |||||
| what=NULL; | |||||
| whatslot=NULL; | |||||
| nslot=0; | |||||
| nselected=NULL; | |||||
| } | |||||
| int BankSlot::handle(int event) { | |||||
| if (what==NULL) return(0); | |||||
| if (Fl::event_inside(this)){ | |||||
| *what=0;*whatslot=nslot; | |||||
| if ((event==FL_RELEASE)&&(Fl::event_button()==1))*what=1; | |||||
| if ((event==FL_RELEASE)&&(Fl::event_button()==3))*what=2; | |||||
| if (event==FL_PUSH) highlight=1; | |||||
| }else highlight=0; | |||||
| int tmp=Fl_Button::handle(event); | |||||
| if ((*what!=0) && Fl::event_inside(this)) (bp->*fnc)(); | |||||
| return(tmp); | |||||
| } | |||||
| void BankSlot::init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_) { | |||||
| nslot=nslot_; | |||||
| what=what_; | |||||
| whatslot=whatslot_; | |||||
| fnc=fnc_; | |||||
| bp=bp_; | |||||
| bank=bank_; | |||||
| nselected=nselected_; | |||||
| box(FL_THIN_UP_BOX); | |||||
| labelfont(0); | |||||
| labelsize(13); | |||||
| align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE|FL_ALIGN_CLIP); | |||||
| highlight=0; | |||||
| refresh(); | |||||
| } | |||||
| void BankSlot::refresh() { | |||||
| if (bank->emptyslot(nslot)) | |||||
| color(46); | |||||
| else if (bank->isPADsynth_used(nslot)) | |||||
| color(26); | |||||
| else | |||||
| color(51); | |||||
| if (*nselected==nslot) | |||||
| color(6); | |||||
| copy_label(bank->getnamenumbered(nslot).c_str()); | |||||
| } | |||||
| void BankUI::cb_Close_i(Fl_Button*, void*) { | |||||
| bankuiwindow->hide(); | |||||
| } | |||||
| void BankUI::cb_Close(Fl_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| void BankUI::cb_writebutton_i(Fl_Light_Button* o, void*) { | |||||
| if (o->value()>0.5) mode=2; | |||||
| removeselection(); | |||||
| } | |||||
| void BankUI::cb_writebutton(Fl_Light_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->parent()->user_data()))->cb_writebutton_i(o,v); | |||||
| } | |||||
| void BankUI::cb_readbutton_i(Fl_Light_Button* o, void*) { | |||||
| if (o->value()>0.5) mode=1; | |||||
| removeselection(); | |||||
| } | |||||
| void BankUI::cb_readbutton(Fl_Light_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->parent()->user_data()))->cb_readbutton_i(o,v); | |||||
| } | |||||
| void BankUI::cb_clearbutton_i(Fl_Light_Button* o, void*) { | |||||
| if (o->value()>0.5) mode=3; | |||||
| removeselection(); | |||||
| } | |||||
| void BankUI::cb_clearbutton(Fl_Light_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->parent()->user_data()))->cb_clearbutton_i(o,v); | |||||
| } | |||||
| void BankUI::cb_swapbutton_i(Fl_Light_Button* o, void*) { | |||||
| if (o->value()>0.5) mode=4; | |||||
| removeselection(); | |||||
| } | |||||
| void BankUI::cb_swapbutton(Fl_Light_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->parent()->user_data()))->cb_swapbutton_i(o,v); | |||||
| } | |||||
| void BankUI::cb_New_i(Fl_Button*, void*) { | |||||
| const char *dirname; | |||||
| dirname=fl_input("New empty Bank:"); | |||||
| if (dirname==NULL) return; | |||||
| int result=bank->newbank(dirname); | |||||
| if (result!=0) fl_alert("Error: Could not make a new bank (directory).."); | |||||
| refreshmainwindow(); | |||||
| } | |||||
| void BankUI::cb_New(Fl_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->user_data()))->cb_New_i(o,v); | |||||
| } | |||||
| void BankUI::cb_auto_i(Fl_Check_Button* o, void*) { | |||||
| config.cfg.BankUIAutoClose=(int) o->value(); | |||||
| } | |||||
| void BankUI::cb_auto(Fl_Check_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->user_data()))->cb_auto_i(o,v); | |||||
| } | |||||
| void BankUI::cb_banklist_i(Fl_Choice* o, void*) { | |||||
| int n=o->value(); | |||||
| std::string dirname=bank->banks[n].dir; | |||||
| if (dirname.empty()) return; | |||||
| if (bank->loadbank(dirname)==2) | |||||
| fl_alert("Error: Could not load the bank from the directory\n%s.",dirname.c_str()); | |||||
| for (int i=0;i<BANK_SIZE;i++) bs[i]->refresh(); | |||||
| refreshmainwindow(); | |||||
| } | |||||
| void BankUI::cb_banklist(Fl_Choice* o, void* v) { | |||||
| ((BankUI*)(o->parent()->user_data()))->cb_banklist_i(o,v); | |||||
| } | |||||
| void BankUI::cb_Refresh_i(Fl_Button*, void*) { | |||||
| rescan_for_banks(); | |||||
| banklist->value(0); | |||||
| } | |||||
| void BankUI::cb_Refresh(Fl_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->user_data()))->cb_Refresh_i(o,v); | |||||
| } | |||||
| void BankUI::cb_Show_i(Fl_Check_Button* o, void*) { | |||||
| config.cfg.CheckPADsynth=(int) o->value(); | |||||
| refreshmainwindow(); | |||||
| } | |||||
| void BankUI::cb_Show(Fl_Check_Button* o, void* v) { | |||||
| ((BankUI*)(o->parent()->user_data()))->cb_Show_i(o,v); | |||||
| } | |||||
| Fl_Double_Window* BankUI::make_window() { | |||||
| { Fl_Double_Window* o = bankuiwindow = new Fl_Double_Window(785, 575, "Bank"); | |||||
| bankuiwindow->user_data((void*)(this)); | |||||
| { Fl_Button* o = new Fl_Button(705, 546, 70, 24, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| { Fl_Group* o = new Fl_Group(5, 34, 772, 491); | |||||
| o->box(FL_ENGRAVED_FRAME); | |||||
| { Fl_Pack* o = new Fl_Pack(10, 39, 150, 481); | |||||
| o->box(FL_BORDER_FRAME); | |||||
| o->box(FL_NO_BOX); | |||||
| for (int i=0;i<32;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; | |||||
| o->end(); | |||||
| } // Fl_Pack* o | |||||
| { Fl_Pack* o = new Fl_Pack(163, 39, 150, 481); | |||||
| o->box(FL_BORDER_FRAME); | |||||
| o->box(FL_NO_BOX); | |||||
| for (int i=32;i<64;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; | |||||
| o->end(); | |||||
| } // Fl_Pack* o | |||||
| { Fl_Pack* o = new Fl_Pack(316, 39, 150, 481); | |||||
| o->box(FL_BORDER_FRAME); | |||||
| o->box(FL_NO_BOX); | |||||
| for (int i=64;i<96;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; | |||||
| o->end(); | |||||
| } // Fl_Pack* o | |||||
| { Fl_Pack* o = new Fl_Pack(469, 39, 150, 481); | |||||
| o->box(FL_BORDER_FRAME); | |||||
| o->box(FL_NO_BOX); | |||||
| for (int i=96;i<128;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; | |||||
| o->end(); | |||||
| } // Fl_Pack* o | |||||
| { Fl_Pack* o = new Fl_Pack(622, 39, 150, 481); | |||||
| o->box(FL_BORDER_FRAME); | |||||
| o->box(FL_NO_BOX); | |||||
| for (int i=128;i<160;i++){bs[i]=new BankSlot (0,0,o->w(),15," ");bs[i]->init(i,&what,&slot,&BankProcess_::process,(BankProcess_ *)this,bank,&nselected);}; | |||||
| o->end(); | |||||
| } // Fl_Pack* o | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { modeselect = new Fl_Group(5, 528, 425, 42); | |||||
| modeselect->box(FL_ENGRAVED_BOX); | |||||
| { Fl_Light_Button* o = writebutton = new Fl_Light_Button(116, 534, 99, 30, "WRITE"); | |||||
| writebutton->type(102); | |||||
| writebutton->down_box(FL_THIN_DOWN_BOX); | |||||
| writebutton->selection_color((Fl_Color)1); | |||||
| writebutton->labeltype(FL_ENGRAVED_LABEL); | |||||
| writebutton->labelfont(1); | |||||
| writebutton->labelsize(13); | |||||
| writebutton->callback((Fl_Callback*)cb_writebutton); | |||||
| if (bank->locked()) o->deactivate(); | |||||
| } // Fl_Light_Button* writebutton | |||||
| { Fl_Light_Button* o = readbutton = new Fl_Light_Button(11, 534, 99, 30, "READ"); | |||||
| readbutton->type(102); | |||||
| readbutton->down_box(FL_THIN_DOWN_BOX); | |||||
| readbutton->selection_color((Fl_Color)101); | |||||
| readbutton->labeltype(FL_ENGRAVED_LABEL); | |||||
| readbutton->labelfont(1); | |||||
| readbutton->labelsize(13); | |||||
| readbutton->callback((Fl_Callback*)cb_readbutton); | |||||
| o->value(1); | |||||
| } // Fl_Light_Button* readbutton | |||||
| { Fl_Light_Button* o = clearbutton = new Fl_Light_Button(221, 534, 99, 30, "CLEAR"); | |||||
| clearbutton->type(102); | |||||
| clearbutton->down_box(FL_THIN_DOWN_BOX); | |||||
| clearbutton->selection_color(FL_FOREGROUND_COLOR); | |||||
| clearbutton->labeltype(FL_ENGRAVED_LABEL); | |||||
| clearbutton->labelfont(1); | |||||
| clearbutton->labelsize(13); | |||||
| clearbutton->callback((Fl_Callback*)cb_clearbutton); | |||||
| if (bank->locked()) o->deactivate(); | |||||
| } // Fl_Light_Button* clearbutton | |||||
| { Fl_Light_Button* o = swapbutton = new Fl_Light_Button(325, 534, 99, 30, "SWAP"); | |||||
| swapbutton->type(102); | |||||
| swapbutton->down_box(FL_THIN_DOWN_BOX); | |||||
| swapbutton->selection_color((Fl_Color)227); | |||||
| swapbutton->labeltype(FL_ENGRAVED_LABEL); | |||||
| swapbutton->labelfont(1); | |||||
| swapbutton->labelsize(13); | |||||
| swapbutton->callback((Fl_Callback*)cb_swapbutton); | |||||
| if (bank->locked()) o->deactivate(); | |||||
| } // Fl_Light_Button* swapbutton | |||||
| modeselect->end(); | |||||
| } // Fl_Group* modeselect | |||||
| { Fl_Button* o = new Fl_Button(685, 5, 93, 25, "New Bank..."); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_New); | |||||
| o->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| } // Fl_Button* o | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(705, 529, 60, 15, "auto close"); | |||||
| o->tooltip("automatically close the bank window if the instrument is loaded"); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_auto); | |||||
| o->value(config.cfg.BankUIAutoClose); | |||||
| } // Fl_Check_Button* o | |||||
| { banklist = new Fl_Choice(5, 8, 220, 20); | |||||
| banklist->down_box(FL_BORDER_BOX); | |||||
| banklist->labelfont(1); | |||||
| banklist->textfont(1); | |||||
| banklist->textsize(11); | |||||
| banklist->callback((Fl_Callback*)cb_banklist); | |||||
| banklist->align(Fl_Align(FL_ALIGN_CENTER)); | |||||
| } // Fl_Choice* banklist | |||||
| { Fl_Button* o = new Fl_Button(230, 8, 105, 20, "Refresh bank list"); | |||||
| o->tooltip("Refresh the bank list (rescan)"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color(FL_LIGHT1); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_Refresh); | |||||
| } // Fl_Button* o | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(435, 530, 150, 15, "Show PADsynth status"); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_Show); | |||||
| o->value(config.cfg.CheckPADsynth); | |||||
| } // Fl_Check_Button* o | |||||
| o->label(bank->bankfiletitle.c_str()); | |||||
| if (bank->bankfiletitle.empty()) o->label ("Choose a bank from the bank list on the left (or go to settings if to configure the bank location) or choose 'New Bank...' to make a new bank."); | |||||
| bankuiwindow->end(); | |||||
| } // Fl_Double_Window* bankuiwindow | |||||
| return bankuiwindow; | |||||
| } | |||||
| BankUI::BankUI(Master *master_,int *npart_) { | |||||
| fnc=&BankProcess_::process; | |||||
| master=master_; | |||||
| npart=npart_; | |||||
| bank=&master_->bank; | |||||
| what=0; | |||||
| nselected=-1; | |||||
| make_window(); | |||||
| mode=1; | |||||
| } | |||||
| BankUI::~BankUI() { | |||||
| bankuiwindow->hide(); | |||||
| delete(bankuiwindow); | |||||
| } | |||||
| void BankUI::show() { | |||||
| bankuiwindow->show(); | |||||
| simplesetmode(config.cfg.UserInterfaceMode==2); | |||||
| } | |||||
| void BankUI::hide() { | |||||
| bankuiwindow->hide(); | |||||
| } | |||||
| void BankUI::init(Fl_Valuator *cbwig_) { | |||||
| cbwig=cbwig_; | |||||
| rescan_for_banks(); | |||||
| } | |||||
| void BankUI::process() { | |||||
| int slot=this->slot; | |||||
| if ((what==2)&&(bank->emptyslot(slot)==0)&&(mode!=4)) {//Rename slot | |||||
| const char *tmp=fl_input("Slot (instrument) name:",bank->getname(slot).c_str()); | |||||
| if (tmp!=NULL) bank->setname(slot,tmp,-1); | |||||
| bs[slot]->refresh(); | |||||
| }; | |||||
| if ((what==1)&&(mode==1)&&(!bank->emptyslot(slot))){//Reads from slot | |||||
| pthread_mutex_lock(&master->part[*npart]->load_mutex); | |||||
| bank->loadfromslot(slot,master->part[*npart]); | |||||
| pthread_mutex_unlock(&master->part[*npart]->load_mutex); | |||||
| master->part[*npart]->applyparameters(); | |||||
| snprintf((char *)master->part[*npart]->Pname,PART_MAX_NAME_LEN,"%s",bank->getname(slot).c_str()); | |||||
| cbwig->do_callback(); | |||||
| if (config.cfg.BankUIAutoClose!=0) | |||||
| bankuiwindow->hide(); | |||||
| }; | |||||
| if ((what==1)&&(mode==2)){//save(write) to slot | |||||
| if (!bank->emptyslot(slot)){ | |||||
| if (!fl_choice("Overwrite the slot no. %d ?","No","Yes",NULL,slot+1)) goto nooverwriteslot; | |||||
| }; | |||||
| pthread_mutex_lock(&master->part[*npart]->load_mutex); | |||||
| bank->savetoslot(slot,master->part[*npart]); | |||||
| pthread_mutex_unlock(&master->part[*npart]->load_mutex); | |||||
| bs[slot]->refresh(); | |||||
| mode=1;readbutton->value(1);writebutton->value(0); | |||||
| nooverwriteslot:; | |||||
| }; | |||||
| if ((what==1)&&(mode==3)&&(!bank->emptyslot(slot))){//Clears the slot | |||||
| if (fl_choice("Clear the slot no. %d ?","No","Yes",NULL,slot+1)){ | |||||
| bank->clearslot(slot); | |||||
| bs[slot]->refresh(); | |||||
| }; | |||||
| }; | |||||
| if (mode==4){//swap | |||||
| bool done=false; | |||||
| if ((what==1)&&(nselected>=0)){ | |||||
| bank->swapslot(nselected,slot); | |||||
| int ns=nselected; | |||||
| nselected=-1; | |||||
| bs[slot]->refresh(); | |||||
| bs[ns]->refresh(); | |||||
| done=true; | |||||
| }; | |||||
| if (((nselected<0)||(what==2))&&(!done)){ | |||||
| int ns=nselected; | |||||
| nselected=slot; | |||||
| if (ns>0) bs[ns]->refresh(); | |||||
| bs[slot]->refresh(); | |||||
| }; | |||||
| }; | |||||
| if (mode!=4) refreshmainwindow(); | |||||
| } | |||||
| void BankUI::refreshmainwindow() { | |||||
| bankuiwindow->label(bank->bankfiletitle.c_str()); | |||||
| mode=1;readbutton->value(1);writebutton->value(0);clearbutton->value(0);swapbutton->value(0); | |||||
| nselected=-1; | |||||
| if (bank->locked()){ | |||||
| writebutton->deactivate(); | |||||
| clearbutton->deactivate(); | |||||
| swapbutton->deactivate(); | |||||
| } else { | |||||
| writebutton->activate(); | |||||
| clearbutton->activate(); | |||||
| swapbutton->activate(); | |||||
| }; | |||||
| for (int i=0;i<BANK_SIZE;i++) | |||||
| bs[i]->refresh(); | |||||
| } | |||||
| void BankUI::removeselection() { | |||||
| if (nselected>=0) { | |||||
| int ns=nselected; | |||||
| nselected=-1; | |||||
| bs[ns]->refresh(); | |||||
| }; | |||||
| } | |||||
| void BankUI::rescan_for_banks() { | |||||
| banklist->clear(); | |||||
| bank->rescanforbanks(); | |||||
| for (unsigned int i=0;i<bank->banks.size();i++) { | |||||
| banklist->add(bank->banks[i].name.c_str()); | |||||
| } | |||||
| if (banklist->size() == 0) | |||||
| banklist->add(" "); | |||||
| } | |||||
| void BankUI::simplesetmode(bool beginnerui) { | |||||
| readbutton->value(1); | |||||
| mode=1; | |||||
| removeselection(); | |||||
| if (beginnerui) modeselect->hide(); | |||||
| else modeselect->show(); | |||||
| } | |||||
| @@ -0,0 +1,103 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef BankUI_h | |||||
| #define BankUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_File_Chooser.H> | |||||
| #include "../Misc/Master.h" | |||||
| #include "../Misc/Part.h" | |||||
| #include "../Misc/Bank.h" | |||||
| #include "../Misc/Config.h" | |||||
| #include "../Misc/Util.h" | |||||
| class BankProcess_ { | |||||
| public: | |||||
| virtual void process(); | |||||
| Bank *bank; | |||||
| }; | |||||
| class BankSlot : public Fl_Button,BankProcess_ { | |||||
| public: | |||||
| BankSlot(int x,int y, int w, int h, const char *label=0); | |||||
| int handle(int event); | |||||
| void init(int nslot_, int *what_, int *whatslot_,void (BankProcess_:: *fnc_)(void),BankProcess_ *bp_,Bank *bank_,int *nselected_); | |||||
| void refresh(); | |||||
| private: | |||||
| int *what,*whatslot,nslot,highlight, *nselected; | |||||
| void (BankProcess_:: *fnc)(void); | |||||
| BankProcess_ *bp; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Pack.H> | |||||
| #include <FL/Fl_Light_Button.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| class BankUI : public BankProcess_ { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *bankuiwindow; | |||||
| private: | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group *modeselect; | |||||
| Fl_Light_Button *writebutton; | |||||
| private: | |||||
| void cb_writebutton_i(Fl_Light_Button*, void*); | |||||
| static void cb_writebutton(Fl_Light_Button*, void*); | |||||
| public: | |||||
| Fl_Light_Button *readbutton; | |||||
| private: | |||||
| void cb_readbutton_i(Fl_Light_Button*, void*); | |||||
| static void cb_readbutton(Fl_Light_Button*, void*); | |||||
| public: | |||||
| Fl_Light_Button *clearbutton; | |||||
| private: | |||||
| void cb_clearbutton_i(Fl_Light_Button*, void*); | |||||
| static void cb_clearbutton(Fl_Light_Button*, void*); | |||||
| public: | |||||
| Fl_Light_Button *swapbutton; | |||||
| private: | |||||
| void cb_swapbutton_i(Fl_Light_Button*, void*); | |||||
| static void cb_swapbutton(Fl_Light_Button*, void*); | |||||
| void cb_New_i(Fl_Button*, void*); | |||||
| static void cb_New(Fl_Button*, void*); | |||||
| void cb_auto_i(Fl_Check_Button*, void*); | |||||
| static void cb_auto(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *banklist; | |||||
| private: | |||||
| void cb_banklist_i(Fl_Choice*, void*); | |||||
| static void cb_banklist(Fl_Choice*, void*); | |||||
| void cb_Refresh_i(Fl_Button*, void*); | |||||
| static void cb_Refresh(Fl_Button*, void*); | |||||
| void cb_Show_i(Fl_Check_Button*, void*); | |||||
| static void cb_Show(Fl_Check_Button*, void*); | |||||
| public: | |||||
| BankUI(Master *master_,int *npart_); | |||||
| virtual ~BankUI(); | |||||
| void show(); | |||||
| void hide(); | |||||
| void init(Fl_Valuator *cbwig_); | |||||
| void process(); | |||||
| void refreshmainwindow(); | |||||
| void removeselection(); | |||||
| void rescan_for_banks(); | |||||
| void simplesetmode(bool beginnerui); | |||||
| private: | |||||
| BankSlot *bs[BANK_SIZE]; | |||||
| int slot,what; //"what"=what button is pressed | |||||
| int mode,*npart,nselected; | |||||
| Master *master; | |||||
| void (BankProcess_::* fnc)(void); | |||||
| public: | |||||
| Fl_Valuator *cbwig; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,573 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/ConfigUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| void ConfigUI::cb_configwindow_i(Fl_Double_Window* o, void*) { | |||||
| writebankcfg(); | |||||
| o->hide(); | |||||
| } | |||||
| void ConfigUI::cb_configwindow(Fl_Double_Window* o, void* v) { | |||||
| ((ConfigUI*)(o->user_data()))->cb_configwindow_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb__i(Fl_Choice* o, void*) { | |||||
| if ((int)o->value()==0) samplerateinput->activate(); | |||||
| else samplerateinput->deactivate(); | |||||
| int samplerates[8]={44100,16000,22050,32000,44100,48000,88200,96000}; | |||||
| config.cfg.SampleRate=samplerates[(int)o->value()]; | |||||
| setsamplerateinput(); | |||||
| } | |||||
| void ConfigUI::cb_(Fl_Choice* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb__i(o,v); | |||||
| } | |||||
| Fl_Menu_Item ConfigUI::menu_[] = { | |||||
| {"Custom", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"16000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"22050Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"32000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"44100Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"48000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"88200Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"96000Hz", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void ConfigUI::cb_samplerateinput_i(Fl_Int_Input* o, void*) { | |||||
| char *tmp; | |||||
| config.cfg.SampleRate=strtoul(o->value(),&tmp,10); | |||||
| } | |||||
| void ConfigUI::cb_samplerateinput(Fl_Int_Input* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_samplerateinput_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Buffer_i(Fl_Int_Input* o, void*) { | |||||
| char *tmp; | |||||
| config.cfg.SoundBufferSize=strtoul(o->value(),&tmp,10); | |||||
| } | |||||
| void ConfigUI::cb_Buffer(Fl_Int_Input* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Buffer_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Swap_i(Fl_Light_Button* o, void*) { | |||||
| config.cfg.SwapStereo=(int) o->value(); | |||||
| } | |||||
| void ConfigUI::cb_Swap(Fl_Light_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Swap_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_OscilSize_i(Fl_Choice* o, void*) { | |||||
| config.cfg.OscilSize=128<<o->value(); | |||||
| } | |||||
| void ConfigUI::cb_OscilSize(Fl_Choice* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_OscilSize_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item ConfigUI::menu_OscilSize[] = { | |||||
| {"128", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"256", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"512", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"1024", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"2048", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"4096", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"8192", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {"16384", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 14, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void ConfigUI::cb_Dump_i(Fl_File_Input* o, void*) { | |||||
| config.cfg.DumpFile = o->value(); | |||||
| } | |||||
| void ConfigUI::cb_Dump(Fl_File_Input* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Dump_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Dump1_i(Fl_Check_Button* o, void*) { | |||||
| config.cfg.DumpNotesToFile=(int) o->value(); | |||||
| dump.startnow();//this has effect only if this option was disabled; | |||||
| } | |||||
| void ConfigUI::cb_Dump1(Fl_Check_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Dump1_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Append_i(Fl_Check_Button* o, void*) { | |||||
| config.cfg.DumpAppend=(int) o->value(); | |||||
| } | |||||
| void ConfigUI::cb_Append(Fl_Check_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->user_data()))->cb_Append_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_OSS_i(Fl_File_Input* o, void*) { | |||||
| snprintf(config.cfg.LinuxOSSSeqInDev,config.maxstringsize,"%s",o->value()); | |||||
| } | |||||
| void ConfigUI::cb_OSS(Fl_File_Input* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_OSS_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_OSS1_i(Fl_File_Input* o, void*) { | |||||
| snprintf(config.cfg.LinuxOSSWaveOutDev,config.maxstringsize,"%s",o->value()); | |||||
| } | |||||
| void ConfigUI::cb_OSS1(Fl_File_Input* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_OSS1_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Midi_i(Fl_Counter* o, void*) { | |||||
| config.cfg.WindowsMidiInId=(int) o->value(); | |||||
| midiinputnamebox->label(config.winmididevices[config.cfg.WindowsMidiInId].name); | |||||
| } | |||||
| void ConfigUI::cb_Midi(Fl_Counter* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->parent()->parent()->user_data()))->cb_Midi_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_XML_i(Fl_Counter* o, void*) { | |||||
| config.cfg.GzipCompression=(int) o->value(); | |||||
| } | |||||
| void ConfigUI::cb_XML(Fl_Counter* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_XML_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_PADsynth_i(Fl_Choice* o, void*) { | |||||
| config.cfg.Interpolation=(int) o->value(); | |||||
| } | |||||
| void ConfigUI::cb_PADsynth(Fl_Choice* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_PADsynth_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item ConfigUI::menu_PADsynth[] = { | |||||
| {"Linear(fast)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"Cubic(slow)", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void ConfigUI::cb_Virtual_i(Fl_Choice* o, void*) { | |||||
| config.cfg.VirKeybLayout=(int) o->value();; | |||||
| } | |||||
| void ConfigUI::cb_Virtual(Fl_Choice* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Virtual_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item ConfigUI::menu_Virtual[] = { | |||||
| {" ", 0, 0, 0, 1, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"QWERTY", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"Dvorak", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"QWERTZ", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"AZERTY", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void ConfigUI::cb_Ignore_i(Fl_Check_Button* o, void*) { | |||||
| config.cfg.IgnoreProgramChange=(int) o->value(); | |||||
| } | |||||
| void ConfigUI::cb_Ignore(Fl_Check_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Ignore_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_rootsbrowse_i(Fl_Browser* o, void*) { | |||||
| activatebutton_rootdir(o->value()!=0); | |||||
| } | |||||
| void ConfigUI::cb_rootsbrowse(Fl_Browser* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_rootsbrowse_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Add_i(Fl_Button*, void*) { | |||||
| const char *dirname; | |||||
| dirname=fl_dir_chooser("Add a root directory for banks:",NULL,0); | |||||
| if (dirname==NULL) return; | |||||
| rootsbrowse->add(dirname); | |||||
| } | |||||
| void ConfigUI::cb_Add(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Add_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_removerootdirbutton_i(Fl_Button*, void*) { | |||||
| if (rootsbrowse->value()!=0) { | |||||
| rootsbrowse->remove(rootsbrowse->value()); | |||||
| }; | |||||
| activatebutton_rootdir(false); | |||||
| } | |||||
| void ConfigUI::cb_removerootdirbutton(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_removerootdirbutton_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_makedefaultrootdirbutton_i(Fl_Button*, void*) { | |||||
| int n=rootsbrowse->value(); | |||||
| if (n!=0) { | |||||
| rootsbrowse->move(1,n); | |||||
| rootsbrowse->value(1); | |||||
| rootsbrowse->redraw(); | |||||
| }; | |||||
| activatebutton_rootdir(true); | |||||
| } | |||||
| void ConfigUI::cb_makedefaultrootdirbutton(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_makedefaultrootdirbutton_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_presetbrowse_i(Fl_Browser* o, void*) { | |||||
| activatebutton_presetdir(o->value()!=0); | |||||
| } | |||||
| void ConfigUI::cb_presetbrowse(Fl_Browser* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_presetbrowse_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Add1_i(Fl_Button*, void*) { | |||||
| const char *dirname; | |||||
| dirname=fl_dir_chooser("Add a preset directory :",NULL,0); | |||||
| if (dirname==NULL) return; | |||||
| presetbrowse->add(dirname); | |||||
| } | |||||
| void ConfigUI::cb_Add1(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_Add1_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_removepresetbutton_i(Fl_Button*, void*) { | |||||
| if (presetbrowse->value()!=0) { | |||||
| presetbrowse->remove(presetbrowse->value()); | |||||
| }; | |||||
| activatebutton_presetdir(false); | |||||
| } | |||||
| void ConfigUI::cb_removepresetbutton(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_removepresetbutton_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_makedefaultpresetbutton_i(Fl_Button*, void*) { | |||||
| int n=presetbrowse->value(); | |||||
| if (n!=0) { | |||||
| presetbrowse->move(1,n); | |||||
| presetbrowse->value(1); | |||||
| presetbrowse->redraw(); | |||||
| }; | |||||
| activatebutton_presetdir(true); | |||||
| } | |||||
| void ConfigUI::cb_makedefaultpresetbutton(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->parent()->parent()->user_data()))->cb_makedefaultpresetbutton_i(o,v); | |||||
| } | |||||
| void ConfigUI::cb_Close_i(Fl_Button*, void*) { | |||||
| configwindow->hide(); | |||||
| writebankcfg(); | |||||
| writepresetcfg(); | |||||
| } | |||||
| void ConfigUI::cb_Close(Fl_Button* o, void* v) { | |||||
| ((ConfigUI*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| Fl_Double_Window* ConfigUI::make_window() { | |||||
| { configwindow = new Fl_Double_Window(510, 370, "ZynAddSubFX Settings"); | |||||
| configwindow->callback((Fl_Callback*)cb_configwindow, (void*)(this)); | |||||
| { Fl_Tabs* o = new Fl_Tabs(5, 5, 500, 330); | |||||
| { Fl_Group* o = new Fl_Group(5, 25, 500, 310, "Main settings"); | |||||
| { Fl_Group* o = new Fl_Group(15, 45, 165, 30, "Sample Rate"); | |||||
| o->box(FL_ENGRAVED_FRAME); | |||||
| { Fl_Choice* o = new Fl_Choice(20, 50, 85, 20); | |||||
| o->down_box(FL_BORDER_BOX); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_); | |||||
| o->menu(menu_); | |||||
| o->value(getsamplerateorder()); | |||||
| } // Fl_Choice* o | |||||
| { Fl_Int_Input* o = samplerateinput = new Fl_Int_Input(115, 50, 60, 20); | |||||
| samplerateinput->type(2); | |||||
| samplerateinput->textfont(1); | |||||
| samplerateinput->callback((Fl_Callback*)cb_samplerateinput); | |||||
| setsamplerateinput(); | |||||
| if (getsamplerateorder()!=0) o->deactivate(); | |||||
| } // Fl_Int_Input* samplerateinput | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Int_Input* o = new Fl_Int_Input(190, 45, 60, 20, "Buffer Size"); | |||||
| o->tooltip("Internal Sound Buffer Size (samples)"); | |||||
| o->type(2); | |||||
| o->labelsize(11); | |||||
| o->textfont(1); | |||||
| o->callback((Fl_Callback*)cb_Buffer); | |||||
| o->align(Fl_Align(129)); | |||||
| char *tmpbuf=new char[100];o->cut(0,o->maximum_size()); | |||||
| snprintf(tmpbuf,100,"%d",config.cfg.SoundBufferSize);o->insert(tmpbuf); | |||||
| delete []tmpbuf; | |||||
| } // Fl_Int_Input* o | |||||
| { Fl_Light_Button* o = new Fl_Light_Button(20, 80, 85, 20, "Swap Stereo "); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_Swap); | |||||
| o->value(config.cfg.SwapStereo); | |||||
| } // Fl_Light_Button* o | |||||
| { Fl_Choice* o = new Fl_Choice(175, 80, 75, 20, "OscilSize"); | |||||
| o->tooltip("ADSynth Oscillator Size (samples)"); | |||||
| o->down_box(FL_BORDER_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_OscilSize); | |||||
| o->menu(menu_OscilSize); | |||||
| o->value( (int) (log(config.cfg.OscilSize/128.0-1.0)/log(2)) +1); | |||||
| } // Fl_Choice* o | |||||
| { Fl_Box* o = new Fl_Box(10, 300, 235, 30, "Most settings has effect only after ZynAddSubFX is restarted."); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| } // Fl_Box* o | |||||
| { Fl_Box* o = new Fl_Box(10, 280, 240, 15, "Read the Readme.txt for other settings"); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| } // Fl_Box* o | |||||
| { Fl_Group* o = new Fl_Group(15, 125, 230, 85); | |||||
| o->box(FL_ENGRAVED_BOX); | |||||
| { Fl_File_Input* o = new Fl_File_Input(20, 170, 220, 35, "Dump File"); | |||||
| o->callback((Fl_Callback*)cb_Dump); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->insert(config.cfg.DumpFile.c_str()); | |||||
| } // Fl_File_Input* o | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(20, 130, 100, 20, "Dump notes"); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->callback((Fl_Callback*)cb_Dump1); | |||||
| o->value(config.cfg.DumpNotesToFile); | |||||
| } // Fl_Check_Button* o | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(160, 130, 80, 20, "Append"); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->callback((Fl_Callback*)cb_Append); | |||||
| o->value(config.cfg.DumpAppend); | |||||
| } // Fl_Check_Button* o | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = new Fl_Group(255, 45, 245, 260); | |||||
| o->box(FL_ENGRAVED_FRAME); | |||||
| { Fl_Box* o = new Fl_Box(260, 50, 235, 45, "Note: Not all the following settings are used (this depends on the operating \ | |||||
| system, etc..)"); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| } // Fl_Box* o | |||||
| { Fl_Group* o = new Fl_Group(260, 110, 235, 115, "Linux"); | |||||
| o->box(FL_ENGRAVED_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(13); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| { Fl_File_Input* o = new Fl_File_Input(265, 180, 225, 35, "OSS Sequencer Device (/dev/...)"); | |||||
| o->callback((Fl_Callback*)cb_OSS); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->insert(config.cfg.LinuxOSSSeqInDev); | |||||
| } // Fl_File_Input* o | |||||
| { Fl_File_Input* o = new Fl_File_Input(265, 130, 225, 35, "OSS Wave Out Device (/dev/...)"); | |||||
| o->callback((Fl_Callback*)cb_OSS1); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->insert(config.cfg.LinuxOSSWaveOutDev); | |||||
| } // Fl_File_Input* o | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = new Fl_Group(260, 250, 235, 50, "Windows"); | |||||
| o->box(FL_ENGRAVED_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(13); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| { Fl_Counter* o = new Fl_Counter(270, 270, 65, 20, "Midi In Dev"); | |||||
| o->type(1); | |||||
| o->labelsize(11); | |||||
| o->minimum(0); | |||||
| o->maximum(100); | |||||
| o->step(1); | |||||
| o->callback((Fl_Callback*)cb_Midi); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->maximum(config.winmidimax-1); | |||||
| o->value(config.cfg.WindowsMidiInId); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Box* o = midiinputnamebox = new Fl_Box(340, 260, 150, 35, "Midi input device name"); | |||||
| midiinputnamebox->labelfont(1); | |||||
| midiinputnamebox->labelsize(11); | |||||
| midiinputnamebox->align(Fl_Align(196|FL_ALIGN_INSIDE)); | |||||
| o->label(config.winmididevices[config.cfg.WindowsMidiInId].name); | |||||
| } // Fl_Box* midiinputnamebox | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Counter* o = new Fl_Counter(20, 215, 65, 15, "XML compression level"); | |||||
| o->tooltip("gzip compression level (0 - uncompressed)"); | |||||
| o->type(1); | |||||
| o->labelsize(11); | |||||
| o->minimum(0); | |||||
| o->maximum(9); | |||||
| o->step(1); | |||||
| o->callback((Fl_Callback*)cb_XML); | |||||
| o->align(Fl_Align(FL_ALIGN_RIGHT)); | |||||
| o->value(config.cfg.GzipCompression); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Choice* o = new Fl_Choice(175, 105, 75, 15, "PADsynth Interpolation"); | |||||
| o->down_box(FL_BORDER_BOX); | |||||
| o->labelsize(10); | |||||
| o->textsize(11); | |||||
| o->callback((Fl_Callback*)cb_PADsynth); | |||||
| o->menu(menu_PADsynth); | |||||
| o->value(config.cfg.Interpolation); | |||||
| } // Fl_Choice* o | |||||
| { Fl_Choice* o = new Fl_Choice(155, 235, 85, 20, "Virtual Keyboard Layout"); | |||||
| o->down_box(FL_BORDER_BOX); | |||||
| o->labelsize(12); | |||||
| o->textfont(1); | |||||
| o->textsize(11); | |||||
| o->callback((Fl_Callback*)cb_Virtual); | |||||
| o->menu(menu_Virtual); | |||||
| o->value(config.cfg.VirKeybLayout); | |||||
| } // Fl_Choice* o | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(10, 255, 230, 20, "Ignore MIDI Program Change"); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->callback((Fl_Callback*)cb_Ignore); | |||||
| o->value(config.cfg.IgnoreProgramChange); | |||||
| } // Fl_Check_Button* o | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = new Fl_Group(5, 25, 500, 285, "Bank root dirs"); | |||||
| o->hide(); | |||||
| { rootsbrowse = new Fl_Browser(15, 35, 485, 220); | |||||
| rootsbrowse->type(2); | |||||
| rootsbrowse->callback((Fl_Callback*)cb_rootsbrowse); | |||||
| } // Fl_Browser* rootsbrowse | |||||
| { Fl_Button* o = new Fl_Button(15, 265, 80, 35, "Add root directory..."); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Add); | |||||
| o->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = removerootdirbutton = new Fl_Button(105, 265, 80, 35, "Remove root dir..."); | |||||
| removerootdirbutton->box(FL_THIN_UP_BOX); | |||||
| removerootdirbutton->callback((Fl_Callback*)cb_removerootdirbutton); | |||||
| removerootdirbutton->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| o->deactivate(); | |||||
| } // Fl_Button* removerootdirbutton | |||||
| { Fl_Button* o = makedefaultrootdirbutton = new Fl_Button(190, 265, 80, 35, "Make default"); | |||||
| makedefaultrootdirbutton->box(FL_THIN_UP_BOX); | |||||
| makedefaultrootdirbutton->callback((Fl_Callback*)cb_makedefaultrootdirbutton); | |||||
| makedefaultrootdirbutton->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| o->deactivate(); | |||||
| } // Fl_Button* makedefaultrootdirbutton | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = new Fl_Group(5, 25, 500, 285, "Presets dirs"); | |||||
| o->hide(); | |||||
| { presetbrowse = new Fl_Browser(15, 35, 485, 220); | |||||
| presetbrowse->type(2); | |||||
| presetbrowse->callback((Fl_Callback*)cb_presetbrowse); | |||||
| } // Fl_Browser* presetbrowse | |||||
| { Fl_Button* o = new Fl_Button(15, 265, 80, 35, "Add preset directory..."); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Add1); | |||||
| o->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = removepresetbutton = new Fl_Button(105, 265, 80, 35, "Remove preset dir..."); | |||||
| removepresetbutton->box(FL_THIN_UP_BOX); | |||||
| removepresetbutton->callback((Fl_Callback*)cb_removepresetbutton); | |||||
| removepresetbutton->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| o->deactivate(); | |||||
| } // Fl_Button* removepresetbutton | |||||
| { Fl_Button* o = makedefaultpresetbutton = new Fl_Button(190, 265, 80, 35, "Make default"); | |||||
| makedefaultpresetbutton->box(FL_THIN_UP_BOX); | |||||
| makedefaultpresetbutton->callback((Fl_Callback*)cb_makedefaultpresetbutton); | |||||
| makedefaultpresetbutton->align(Fl_Align(FL_ALIGN_WRAP)); | |||||
| o->deactivate(); | |||||
| } // Fl_Button* makedefaultpresetbutton | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| o->end(); | |||||
| } // Fl_Tabs* o | |||||
| { Fl_Button* o = new Fl_Button(200, 345, 105, 20, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| configwindow->end(); | |||||
| } // Fl_Double_Window* configwindow | |||||
| return configwindow; | |||||
| } | |||||
| ConfigUI::ConfigUI() { | |||||
| make_window(); | |||||
| readbankcfg(); | |||||
| readpresetcfg(); | |||||
| } | |||||
| void ConfigUI::activatebutton_rootdir(bool active) { | |||||
| if (active) { | |||||
| removerootdirbutton->activate(); | |||||
| makedefaultrootdirbutton->activate(); | |||||
| }else{ | |||||
| removerootdirbutton->deactivate(); | |||||
| makedefaultrootdirbutton->deactivate(); | |||||
| }; | |||||
| } | |||||
| void ConfigUI::activatebutton_presetdir(bool active) { | |||||
| if (active) { | |||||
| removepresetbutton->activate(); | |||||
| makedefaultpresetbutton->activate(); | |||||
| }else{ | |||||
| removepresetbutton->deactivate(); | |||||
| makedefaultpresetbutton->deactivate(); | |||||
| }; | |||||
| } | |||||
| void ConfigUI::readbankcfg() { | |||||
| rootsbrowse->clear(); | |||||
| for (int i=0;i<MAX_BANK_ROOT_DIRS;i++){ | |||||
| if (!config.cfg.bankRootDirList[i].empty()) | |||||
| rootsbrowse->add(config.cfg.bankRootDirList[i].c_str()); | |||||
| }; | |||||
| } | |||||
| void ConfigUI::writebankcfg() { | |||||
| config.clearbankrootdirlist(); | |||||
| for (int n=0;n<rootsbrowse->size();n++){ | |||||
| config.cfg.bankRootDirList[n] = rootsbrowse->text(n+1); | |||||
| }; | |||||
| } | |||||
| void ConfigUI::readpresetcfg() { | |||||
| presetbrowse->clear(); | |||||
| for(int i=0;i<MAX_BANK_ROOT_DIRS;i++){ | |||||
| if(!config.cfg.presetsDirList[i].empty()) | |||||
| presetbrowse->add(config.cfg.presetsDirList[i].c_str()); | |||||
| }; | |||||
| } | |||||
| void ConfigUI::writepresetcfg() { | |||||
| config.clearpresetsdirlist(); | |||||
| for (int n=0;n<presetbrowse->size();n++) | |||||
| config.cfg.presetsDirList[n] = presetbrowse->text(n+1); | |||||
| } | |||||
| int ConfigUI::getsamplerateorder() { | |||||
| int smpr=config.cfg.SampleRate; | |||||
| int order=0; | |||||
| switch(smpr){ | |||||
| case 16000:order=1;break; | |||||
| case 22050:order=2;break; | |||||
| case 32000:order=3;break; | |||||
| case 44100:order=4;break; | |||||
| case 48000:order=5;break; | |||||
| case 88200:order=6;break; | |||||
| case 96000:order=7;break; | |||||
| default:order=0;break; | |||||
| }; | |||||
| return(order); | |||||
| } | |||||
| void ConfigUI::setsamplerateinput() { | |||||
| char *tmpbuf=new char[100]; | |||||
| samplerateinput->cut(0,samplerateinput->maximum_size()); | |||||
| snprintf(tmpbuf,100,"%d",config.cfg.SampleRate); | |||||
| samplerateinput->insert(tmpbuf); | |||||
| delete []tmpbuf; | |||||
| } | |||||
| void ConfigUI::show() { | |||||
| configwindow->show(); | |||||
| } | |||||
| @@ -0,0 +1,122 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef ConfigUI_h | |||||
| #define ConfigUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdio.h> | |||||
| #include <math.h> | |||||
| #include <stdlib.h> | |||||
| #include <FL/Fl_File_Chooser.H> | |||||
| #include "../globals.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "../Misc/Dump.h" | |||||
| extern Dump dump; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Tabs.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Int_Input.H> | |||||
| #include <FL/Fl_Light_Button.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_File_Input.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Browser.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| class ConfigUI { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *configwindow; | |||||
| private: | |||||
| void cb_configwindow_i(Fl_Double_Window*, void*); | |||||
| static void cb_configwindow(Fl_Double_Window*, void*); | |||||
| void cb__i(Fl_Choice*, void*); | |||||
| static void cb_(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_[]; | |||||
| public: | |||||
| Fl_Int_Input *samplerateinput; | |||||
| private: | |||||
| void cb_samplerateinput_i(Fl_Int_Input*, void*); | |||||
| static void cb_samplerateinput(Fl_Int_Input*, void*); | |||||
| void cb_Buffer_i(Fl_Int_Input*, void*); | |||||
| static void cb_Buffer(Fl_Int_Input*, void*); | |||||
| void cb_Swap_i(Fl_Light_Button*, void*); | |||||
| static void cb_Swap(Fl_Light_Button*, void*); | |||||
| void cb_OscilSize_i(Fl_Choice*, void*); | |||||
| static void cb_OscilSize(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_OscilSize[]; | |||||
| void cb_Dump_i(Fl_File_Input*, void*); | |||||
| static void cb_Dump(Fl_File_Input*, void*); | |||||
| void cb_Dump1_i(Fl_Check_Button*, void*); | |||||
| static void cb_Dump1(Fl_Check_Button*, void*); | |||||
| void cb_Append_i(Fl_Check_Button*, void*); | |||||
| static void cb_Append(Fl_Check_Button*, void*); | |||||
| void cb_OSS_i(Fl_File_Input*, void*); | |||||
| static void cb_OSS(Fl_File_Input*, void*); | |||||
| void cb_OSS1_i(Fl_File_Input*, void*); | |||||
| static void cb_OSS1(Fl_File_Input*, void*); | |||||
| void cb_Midi_i(Fl_Counter*, void*); | |||||
| static void cb_Midi(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Box *midiinputnamebox; | |||||
| private: | |||||
| void cb_XML_i(Fl_Counter*, void*); | |||||
| static void cb_XML(Fl_Counter*, void*); | |||||
| void cb_PADsynth_i(Fl_Choice*, void*); | |||||
| static void cb_PADsynth(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_PADsynth[]; | |||||
| void cb_Virtual_i(Fl_Choice*, void*); | |||||
| static void cb_Virtual(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_Virtual[]; | |||||
| void cb_Ignore_i(Fl_Check_Button*, void*); | |||||
| static void cb_Ignore(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Browser *rootsbrowse; | |||||
| private: | |||||
| void cb_rootsbrowse_i(Fl_Browser*, void*); | |||||
| static void cb_rootsbrowse(Fl_Browser*, void*); | |||||
| void cb_Add_i(Fl_Button*, void*); | |||||
| static void cb_Add(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *removerootdirbutton; | |||||
| private: | |||||
| void cb_removerootdirbutton_i(Fl_Button*, void*); | |||||
| static void cb_removerootdirbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *makedefaultrootdirbutton; | |||||
| private: | |||||
| void cb_makedefaultrootdirbutton_i(Fl_Button*, void*); | |||||
| static void cb_makedefaultrootdirbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Browser *presetbrowse; | |||||
| private: | |||||
| void cb_presetbrowse_i(Fl_Browser*, void*); | |||||
| static void cb_presetbrowse(Fl_Browser*, void*); | |||||
| void cb_Add1_i(Fl_Button*, void*); | |||||
| static void cb_Add1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *removepresetbutton; | |||||
| private: | |||||
| void cb_removepresetbutton_i(Fl_Button*, void*); | |||||
| static void cb_removepresetbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *makedefaultpresetbutton; | |||||
| private: | |||||
| void cb_makedefaultpresetbutton_i(Fl_Button*, void*); | |||||
| static void cb_makedefaultpresetbutton(Fl_Button*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| public: | |||||
| ConfigUI(); | |||||
| void activatebutton_rootdir(bool active); | |||||
| void activatebutton_presetdir(bool active); | |||||
| void readbankcfg(); | |||||
| void writebankcfg(); | |||||
| void readpresetcfg(); | |||||
| void writepresetcfg(); | |||||
| int getsamplerateorder(); | |||||
| void setsamplerateinput(); | |||||
| void show(); | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,820 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef EffUI_h | |||||
| #define EffUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include "../globals.h" | |||||
| #include "WidgetPDial.h" | |||||
| #include "EnvelopeUI.h" | |||||
| #include "FilterUI.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "../Effects/EffectMgr.h" | |||||
| #include "PresetsUI.h" | |||||
| #include "common.H" | |||||
| class EQGraph : public Fl_Box { | |||||
| public: | |||||
| EQGraph(int x,int y, int w, int h, const char *label=0); | |||||
| void init(EffectMgr *eff_); | |||||
| void draw_freq_line(float freq,int type); | |||||
| void draw(); | |||||
| double getresponse(int maxy,float freq); | |||||
| float getfreqx(float x); | |||||
| float getfreqpos(float freq); | |||||
| private: | |||||
| int oldx,oldy; | |||||
| public: | |||||
| float khzval; | |||||
| private: | |||||
| EffectMgr *eff; | |||||
| int maxdB; | |||||
| }; | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| class EffUI : public Fl_Group,public PresetsUI_ { | |||||
| public: | |||||
| EffUI(int x,int y, int w, int h, const char *label=0); | |||||
| ~EffUI(); | |||||
| Fl_Group* make_null_window(); | |||||
| Fl_Group *effnullwindow; | |||||
| Fl_Group* make_reverb_window(); | |||||
| Fl_Group *effreverbwindow; | |||||
| Fl_Choice *revp; | |||||
| private: | |||||
| void cb_revp_i(Fl_Choice*, void*); | |||||
| static void cb_revp(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_revp[]; | |||||
| public: | |||||
| Fl_Choice *revp10; | |||||
| private: | |||||
| void cb_revp10_i(Fl_Choice*, void*); | |||||
| static void cb_revp10(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_revp10[]; | |||||
| public: | |||||
| WidgetPDial *revp0; | |||||
| private: | |||||
| void cb_revp0_i(WidgetPDial*, void*); | |||||
| static void cb_revp0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp1; | |||||
| private: | |||||
| void cb_revp1_i(WidgetPDial*, void*); | |||||
| static void cb_revp1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp2; | |||||
| private: | |||||
| void cb_revp2_i(WidgetPDial*, void*); | |||||
| static void cb_revp2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp3; | |||||
| private: | |||||
| void cb_revp3_i(WidgetPDial*, void*); | |||||
| static void cb_revp3(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp4; | |||||
| private: | |||||
| void cb_revp4_i(WidgetPDial*, void*); | |||||
| static void cb_revp4(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp12; | |||||
| private: | |||||
| void cb_revp12_i(WidgetPDial*, void*); | |||||
| static void cb_revp12(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp6; | |||||
| private: | |||||
| void cb_revp6_i(WidgetPDial*, void*); | |||||
| static void cb_revp6(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp7; | |||||
| private: | |||||
| void cb_revp7_i(WidgetPDial*, void*); | |||||
| static void cb_revp7(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp8; | |||||
| private: | |||||
| void cb_revp8_i(WidgetPDial*, void*); | |||||
| static void cb_revp8(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp9; | |||||
| private: | |||||
| void cb_revp9_i(WidgetPDial*, void*); | |||||
| static void cb_revp9(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp11; | |||||
| private: | |||||
| void cb_revp11_i(WidgetPDial*, void*); | |||||
| static void cb_revp11(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Group* make_echo_window(); | |||||
| Fl_Group *effechowindow; | |||||
| Fl_Choice *echop; | |||||
| private: | |||||
| void cb_echop_i(Fl_Choice*, void*); | |||||
| static void cb_echop(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_echop[]; | |||||
| public: | |||||
| WidgetPDial *echop0; | |||||
| private: | |||||
| void cb_echop0_i(WidgetPDial*, void*); | |||||
| static void cb_echop0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop1; | |||||
| private: | |||||
| void cb_echop1_i(WidgetPDial*, void*); | |||||
| static void cb_echop1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop2; | |||||
| private: | |||||
| void cb_echop2_i(WidgetPDial*, void*); | |||||
| static void cb_echop2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop3; | |||||
| private: | |||||
| void cb_echop3_i(WidgetPDial*, void*); | |||||
| static void cb_echop3(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop4; | |||||
| private: | |||||
| void cb_echop4_i(WidgetPDial*, void*); | |||||
| static void cb_echop4(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop5; | |||||
| private: | |||||
| void cb_echop5_i(WidgetPDial*, void*); | |||||
| static void cb_echop5(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop6; | |||||
| private: | |||||
| void cb_echop6_i(WidgetPDial*, void*); | |||||
| static void cb_echop6(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Group* make_chorus_window(); | |||||
| Fl_Group *effchoruswindow; | |||||
| Fl_Choice *chorusp; | |||||
| private: | |||||
| void cb_chorusp_i(Fl_Choice*, void*); | |||||
| static void cb_chorusp(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_chorusp[]; | |||||
| public: | |||||
| WidgetPDial *chorusp0; | |||||
| private: | |||||
| void cb_chorusp0_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp1; | |||||
| private: | |||||
| void cb_chorusp1_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp2; | |||||
| private: | |||||
| void cb_chorusp2_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp3; | |||||
| private: | |||||
| void cb_chorusp3_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp3(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp5; | |||||
| private: | |||||
| void cb_chorusp5_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp5(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp6; | |||||
| private: | |||||
| void cb_chorusp6_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp6(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp7; | |||||
| private: | |||||
| void cb_chorusp7_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp7(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp8; | |||||
| private: | |||||
| void cb_chorusp8_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp8(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp9; | |||||
| private: | |||||
| void cb_chorusp9_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp9(WidgetPDial*, void*); | |||||
| void cb_Flange_i(Fl_Check_Button*, void*); | |||||
| static void cb_Flange(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *chorusp11; | |||||
| private: | |||||
| void cb_chorusp11_i(Fl_Check_Button*, void*); | |||||
| static void cb_chorusp11(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *chorusp4; | |||||
| private: | |||||
| void cb_chorusp4_i(Fl_Choice*, void*); | |||||
| static void cb_chorusp4(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_chorusp4[]; | |||||
| public: | |||||
| Fl_Group* make_phaser_window(); | |||||
| Fl_Group *effphaserwindow; | |||||
| Fl_Choice *phaserp; | |||||
| private: | |||||
| void cb_phaserp_i(Fl_Choice*, void*); | |||||
| static void cb_phaserp(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_phaserp[]; | |||||
| public: | |||||
| WidgetPDial *phaserp0; | |||||
| private: | |||||
| void cb_phaserp0_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp1; | |||||
| private: | |||||
| void cb_phaserp1_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp2; | |||||
| private: | |||||
| void cb_phaserp2_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp3; | |||||
| private: | |||||
| void cb_phaserp3_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp3(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *phaserp4; | |||||
| private: | |||||
| void cb_phaserp4_i(Fl_Choice*, void*); | |||||
| static void cb_phaserp4(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_phaserp4[]; | |||||
| public: | |||||
| WidgetPDial *phaserp5; | |||||
| private: | |||||
| void cb_phaserp5_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp5(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp6; | |||||
| private: | |||||
| void cb_phaserp6_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp6(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp7; | |||||
| private: | |||||
| void cb_phaserp7_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp7(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *phaserp8; | |||||
| private: | |||||
| void cb_phaserp8_i(Fl_Counter*, void*); | |||||
| static void cb_phaserp8(Fl_Counter*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp9; | |||||
| private: | |||||
| void cb_phaserp9_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp9(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *phaserp10; | |||||
| private: | |||||
| void cb_phaserp10_i(Fl_Check_Button*, void*); | |||||
| static void cb_phaserp10(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp11; | |||||
| private: | |||||
| void cb_phaserp11_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp11(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *phaserp12; | |||||
| private: | |||||
| void cb_phaserp12_i(Fl_Check_Button*, void*); | |||||
| static void cb_phaserp12(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp13; | |||||
| private: | |||||
| void cb_phaserp13_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp13(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *phaserp14; | |||||
| private: | |||||
| void cb_phaserp14_i(Fl_Check_Button*, void*); | |||||
| static void cb_phaserp14(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_alienwah_window(); | |||||
| Fl_Group *effalienwahwindow; | |||||
| Fl_Choice *awp; | |||||
| private: | |||||
| void cb_awp_i(Fl_Choice*, void*); | |||||
| static void cb_awp(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_awp[]; | |||||
| public: | |||||
| WidgetPDial *awp0; | |||||
| private: | |||||
| void cb_awp0_i(WidgetPDial*, void*); | |||||
| static void cb_awp0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp1; | |||||
| private: | |||||
| void cb_awp1_i(WidgetPDial*, void*); | |||||
| static void cb_awp1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp2; | |||||
| private: | |||||
| void cb_awp2_i(WidgetPDial*, void*); | |||||
| static void cb_awp2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp3; | |||||
| private: | |||||
| void cb_awp3_i(WidgetPDial*, void*); | |||||
| static void cb_awp3(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp5; | |||||
| private: | |||||
| void cb_awp5_i(WidgetPDial*, void*); | |||||
| static void cb_awp5(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp6; | |||||
| private: | |||||
| void cb_awp6_i(WidgetPDial*, void*); | |||||
| static void cb_awp6(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp7; | |||||
| private: | |||||
| void cb_awp7_i(WidgetPDial*, void*); | |||||
| static void cb_awp7(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp9; | |||||
| private: | |||||
| void cb_awp9_i(WidgetPDial*, void*); | |||||
| static void cb_awp9(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *awp4; | |||||
| private: | |||||
| void cb_awp4_i(Fl_Choice*, void*); | |||||
| static void cb_awp4(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_awp4[]; | |||||
| public: | |||||
| WidgetPDial *awp10; | |||||
| private: | |||||
| void cb_awp10_i(WidgetPDial*, void*); | |||||
| static void cb_awp10(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *awp8; | |||||
| private: | |||||
| void cb_awp8_i(Fl_Counter*, void*); | |||||
| static void cb_awp8(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group* make_distorsion_window(); | |||||
| Fl_Group *effdistorsionwindow; | |||||
| Fl_Choice *distp; | |||||
| private: | |||||
| void cb_distp_i(Fl_Choice*, void*); | |||||
| static void cb_distp(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_distp[]; | |||||
| public: | |||||
| WidgetPDial *distp0; | |||||
| private: | |||||
| void cb_distp0_i(WidgetPDial*, void*); | |||||
| static void cb_distp0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp1; | |||||
| private: | |||||
| void cb_distp1_i(WidgetPDial*, void*); | |||||
| static void cb_distp1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp2; | |||||
| private: | |||||
| void cb_distp2_i(WidgetPDial*, void*); | |||||
| static void cb_distp2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp3; | |||||
| private: | |||||
| void cb_distp3_i(WidgetPDial*, void*); | |||||
| static void cb_distp3(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp4; | |||||
| private: | |||||
| void cb_distp4_i(WidgetPDial*, void*); | |||||
| static void cb_distp4(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp7; | |||||
| private: | |||||
| void cb_distp7_i(WidgetPDial*, void*); | |||||
| static void cb_distp7(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp8; | |||||
| private: | |||||
| void cb_distp8_i(WidgetPDial*, void*); | |||||
| static void cb_distp8(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *distp5; | |||||
| private: | |||||
| void cb_distp5_i(Fl_Choice*, void*); | |||||
| static void cb_distp5(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_distp5[]; | |||||
| public: | |||||
| Fl_Check_Button *distp6; | |||||
| private: | |||||
| void cb_distp6_i(Fl_Check_Button*, void*); | |||||
| static void cb_distp6(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *distp9; | |||||
| private: | |||||
| void cb_distp9_i(Fl_Check_Button*, void*); | |||||
| static void cb_distp9(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *distp10; | |||||
| private: | |||||
| void cb_distp10_i(Fl_Check_Button*, void*); | |||||
| static void cb_distp10(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_eq_window(); | |||||
| Fl_Group *effeqwindow; | |||||
| WidgetPDial *eqp0; | |||||
| private: | |||||
| void cb_eqp0_i(WidgetPDial*, void*); | |||||
| static void cb_eqp0(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *bandcounter; | |||||
| private: | |||||
| void cb_bandcounter_i(Fl_Counter*, void*); | |||||
| static void cb_bandcounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group *bandgroup; | |||||
| WidgetPDial *freqdial; | |||||
| private: | |||||
| void cb_freqdial_i(WidgetPDial*, void*); | |||||
| static void cb_freqdial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *gaindial; | |||||
| private: | |||||
| void cb_gaindial_i(WidgetPDial*, void*); | |||||
| static void cb_gaindial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *qdial; | |||||
| private: | |||||
| void cb_qdial_i(WidgetPDial*, void*); | |||||
| static void cb_qdial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *stagescounter; | |||||
| private: | |||||
| void cb_stagescounter_i(Fl_Counter*, void*); | |||||
| static void cb_stagescounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *typechoice; | |||||
| private: | |||||
| void cb_typechoice_i(Fl_Choice*, void*); | |||||
| static void cb_typechoice(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_typechoice[]; | |||||
| public: | |||||
| EQGraph *eqgraph; | |||||
| Fl_Group* make_dynamicfilter_window(); | |||||
| Fl_Group *effdynamicfilterwindow; | |||||
| Fl_Choice *dfp; | |||||
| private: | |||||
| void cb_dfp_i(Fl_Choice*, void*); | |||||
| static void cb_dfp(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_dfp[]; | |||||
| public: | |||||
| WidgetPDial *dfp0; | |||||
| private: | |||||
| void cb_dfp0_i(WidgetPDial*, void*); | |||||
| static void cb_dfp0(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp1; | |||||
| private: | |||||
| void cb_dfp1_i(WidgetPDial*, void*); | |||||
| static void cb_dfp1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp2; | |||||
| private: | |||||
| void cb_dfp2_i(WidgetPDial*, void*); | |||||
| static void cb_dfp2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp3; | |||||
| private: | |||||
| void cb_dfp3_i(WidgetPDial*, void*); | |||||
| static void cb_dfp3(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp5; | |||||
| private: | |||||
| void cb_dfp5_i(WidgetPDial*, void*); | |||||
| static void cb_dfp5(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp6; | |||||
| private: | |||||
| void cb_dfp6_i(WidgetPDial*, void*); | |||||
| static void cb_dfp6(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *dfp4; | |||||
| private: | |||||
| void cb_dfp4_i(Fl_Choice*, void*); | |||||
| static void cb_dfp4(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_dfp4[]; | |||||
| void cb_Filter_i(Fl_Button*, void*); | |||||
| static void cb_Filter(Fl_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp7; | |||||
| private: | |||||
| void cb_dfp7_i(WidgetPDial*, void*); | |||||
| static void cb_dfp7(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp9; | |||||
| private: | |||||
| void cb_dfp9_i(WidgetPDial*, void*); | |||||
| static void cb_dfp9(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *dfp8; | |||||
| private: | |||||
| void cb_dfp8_i(Fl_Check_Button*, void*); | |||||
| static void cb_dfp8(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window* make_filter_window(); | |||||
| Fl_Double_Window *filterwindow; | |||||
| private: | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| public: | |||||
| void init(EffectMgr *eff_); | |||||
| void refresh(EffectMgr *eff_); | |||||
| void refresh(); | |||||
| private: | |||||
| EffectMgr *eff; | |||||
| int eqband; | |||||
| }; | |||||
| class SimpleEffUI : public Fl_Group,public PresetsUI_ { | |||||
| public: | |||||
| SimpleEffUI(int x,int y, int w, int h, const char *label=0); | |||||
| ~SimpleEffUI(); | |||||
| Fl_Group* make_null_window(); | |||||
| Fl_Group *effnullwindow; | |||||
| Fl_Group* make_reverb_window(); | |||||
| Fl_Group *effreverbwindow; | |||||
| Fl_Choice *revp; | |||||
| private: | |||||
| void cb_revp5_i(Fl_Choice*, void*); | |||||
| static void cb_revp5(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_revp1[]; | |||||
| public: | |||||
| WidgetPDial *revp0; | |||||
| private: | |||||
| void cb_revp01_i(WidgetPDial*, void*); | |||||
| static void cb_revp01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp2; | |||||
| private: | |||||
| void cb_revp21_i(WidgetPDial*, void*); | |||||
| static void cb_revp21(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp3; | |||||
| private: | |||||
| void cb_revp31_i(WidgetPDial*, void*); | |||||
| static void cb_revp31(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *revp9; | |||||
| private: | |||||
| void cb_revp91_i(WidgetPDial*, void*); | |||||
| static void cb_revp91(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Group* make_echo_window(); | |||||
| Fl_Group *effechowindow; | |||||
| Fl_Choice *echop; | |||||
| private: | |||||
| void cb_echop7_i(Fl_Choice*, void*); | |||||
| static void cb_echop7(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_echop1[]; | |||||
| public: | |||||
| WidgetPDial *echop0; | |||||
| private: | |||||
| void cb_echop01_i(WidgetPDial*, void*); | |||||
| static void cb_echop01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop2; | |||||
| private: | |||||
| void cb_echop21_i(WidgetPDial*, void*); | |||||
| static void cb_echop21(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *echop5; | |||||
| private: | |||||
| void cb_echop51_i(WidgetPDial*, void*); | |||||
| static void cb_echop51(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Group* make_chorus_window(); | |||||
| Fl_Group *effchoruswindow; | |||||
| Fl_Choice *chorusp; | |||||
| private: | |||||
| void cb_choruspa_i(Fl_Choice*, void*); | |||||
| static void cb_choruspa(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_chorusp1[]; | |||||
| public: | |||||
| WidgetPDial *chorusp0; | |||||
| private: | |||||
| void cb_chorusp01_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp2; | |||||
| private: | |||||
| void cb_chorusp21_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp21(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp6; | |||||
| private: | |||||
| void cb_chorusp61_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp61(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp7; | |||||
| private: | |||||
| void cb_chorusp71_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp71(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *chorusp8; | |||||
| private: | |||||
| void cb_chorusp81_i(WidgetPDial*, void*); | |||||
| static void cb_chorusp81(WidgetPDial*, void*); | |||||
| void cb_Flange1_i(Fl_Check_Button*, void*); | |||||
| static void cb_Flange1(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_phaser_window(); | |||||
| Fl_Group *effphaserwindow; | |||||
| Fl_Choice *phaserp; | |||||
| private: | |||||
| void cb_phaserpa_i(Fl_Choice*, void*); | |||||
| static void cb_phaserpa(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_phaserp1[]; | |||||
| public: | |||||
| WidgetPDial *phaserp0; | |||||
| private: | |||||
| void cb_phaserp01_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp2; | |||||
| private: | |||||
| void cb_phaserp21_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp21(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp5; | |||||
| private: | |||||
| void cb_phaserp51_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp51(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp6; | |||||
| private: | |||||
| void cb_phaserp61_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp61(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *phaserp7; | |||||
| private: | |||||
| void cb_phaserp71_i(WidgetPDial*, void*); | |||||
| static void cb_phaserp71(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *phaserp8; | |||||
| private: | |||||
| void cb_phaserp81_i(Fl_Counter*, void*); | |||||
| static void cb_phaserp81(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group* make_alienwah_window(); | |||||
| Fl_Group *effalienwahwindow; | |||||
| Fl_Choice *awp; | |||||
| private: | |||||
| void cb_awpa_i(Fl_Choice*, void*); | |||||
| static void cb_awpa(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_awp1[]; | |||||
| public: | |||||
| WidgetPDial *awp0; | |||||
| private: | |||||
| void cb_awp01_i(WidgetPDial*, void*); | |||||
| static void cb_awp01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp2; | |||||
| private: | |||||
| void cb_awp21_i(WidgetPDial*, void*); | |||||
| static void cb_awp21(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *awp6; | |||||
| private: | |||||
| void cb_awp61_i(WidgetPDial*, void*); | |||||
| static void cb_awp61(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *awp8; | |||||
| private: | |||||
| void cb_awp81_i(Fl_Counter*, void*); | |||||
| static void cb_awp81(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group* make_distorsion_window(); | |||||
| Fl_Group *effdistorsionwindow; | |||||
| Fl_Choice *distp; | |||||
| private: | |||||
| void cb_distpa_i(Fl_Choice*, void*); | |||||
| static void cb_distpa(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_distp1[]; | |||||
| public: | |||||
| WidgetPDial *distp0; | |||||
| private: | |||||
| void cb_distp01_i(WidgetPDial*, void*); | |||||
| static void cb_distp01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp3; | |||||
| private: | |||||
| void cb_distp31_i(WidgetPDial*, void*); | |||||
| static void cb_distp31(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp4; | |||||
| private: | |||||
| void cb_distp41_i(WidgetPDial*, void*); | |||||
| static void cb_distp41(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *distp7; | |||||
| private: | |||||
| void cb_distp71_i(WidgetPDial*, void*); | |||||
| static void cb_distp71(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *distp5; | |||||
| private: | |||||
| void cb_distp51_i(Fl_Choice*, void*); | |||||
| static void cb_distp51(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_distp51[]; | |||||
| public: | |||||
| Fl_Group* make_eq_window(); | |||||
| Fl_Group *effeqwindow; | |||||
| Fl_Counter *bandcounter; | |||||
| private: | |||||
| void cb_bandcounter1_i(Fl_Counter*, void*); | |||||
| static void cb_bandcounter1(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group *bandgroup; | |||||
| WidgetPDial *freqdial; | |||||
| private: | |||||
| void cb_freqdial1_i(WidgetPDial*, void*); | |||||
| static void cb_freqdial1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *gaindial; | |||||
| private: | |||||
| void cb_gaindial1_i(WidgetPDial*, void*); | |||||
| static void cb_gaindial1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *qdial; | |||||
| private: | |||||
| void cb_qdial1_i(WidgetPDial*, void*); | |||||
| static void cb_qdial1(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *stagescounter; | |||||
| private: | |||||
| void cb_stagescounter1_i(Fl_Counter*, void*); | |||||
| static void cb_stagescounter1(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *typechoice; | |||||
| private: | |||||
| void cb_typechoice1_i(Fl_Choice*, void*); | |||||
| static void cb_typechoice1(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_typechoice1[]; | |||||
| public: | |||||
| EQGraph *eqgraph; | |||||
| Fl_Group* make_dynamicfilter_window(); | |||||
| Fl_Group *effdynamicfilterwindow; | |||||
| Fl_Choice *dfp; | |||||
| private: | |||||
| void cb_dfpa_i(Fl_Choice*, void*); | |||||
| static void cb_dfpa(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_dfp1[]; | |||||
| public: | |||||
| WidgetPDial *dfp0; | |||||
| private: | |||||
| void cb_dfp01_i(WidgetPDial*, void*); | |||||
| static void cb_dfp01(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp2; | |||||
| private: | |||||
| void cb_dfp21_i(WidgetPDial*, void*); | |||||
| static void cb_dfp21(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp6; | |||||
| private: | |||||
| void cb_dfp61_i(WidgetPDial*, void*); | |||||
| static void cb_dfp61(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp7; | |||||
| private: | |||||
| void cb_dfp71_i(WidgetPDial*, void*); | |||||
| static void cb_dfp71(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *dfp9; | |||||
| private: | |||||
| void cb_dfp91_i(WidgetPDial*, void*); | |||||
| static void cb_dfp91(WidgetPDial*, void*); | |||||
| public: | |||||
| void init(EffectMgr *eff_); | |||||
| void refresh(EffectMgr *eff_); | |||||
| void refresh(); | |||||
| private: | |||||
| EffectMgr *eff; | |||||
| int eqband; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,281 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef EnvelopeUI_h | |||||
| #define EnvelopeUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include "WidgetPDial.h" | |||||
| #include <stdio.h> | |||||
| #include <stdlib.h> | |||||
| #include "../globals.h" | |||||
| #include <FL/Fl_Group.H> | |||||
| #include "../Params/EnvelopeParams.h" | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/fl_draw.H> | |||||
| #include <FL/fl_ask.H> | |||||
| #include "PresetsUI.h" | |||||
| #include "common.H" | |||||
| class EnvelopeFreeEdit : public Fl_Box { | |||||
| public: | |||||
| EnvelopeFreeEdit(int x,int y, int w, int h, const char *label=0); | |||||
| void init(EnvelopeParams *env_); | |||||
| void setpair(Fl_Box *pair_); | |||||
| int getpointx(int n); | |||||
| int getpointy(int n); | |||||
| int getnearest(int x,int y); | |||||
| private: | |||||
| void draw(); | |||||
| public: | |||||
| int handle(int event); | |||||
| private: | |||||
| Fl_Box *pair; | |||||
| EnvelopeParams *env; | |||||
| int oldx,oldy; | |||||
| int currentpoint,cpx,cpdt; | |||||
| public: | |||||
| int lastpoint; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Light_Button.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| class EnvelopeUI : public Fl_Group,PresetsUI_ { | |||||
| public: | |||||
| EnvelopeUI(int x,int y, int w, int h, const char *label=0); | |||||
| ~EnvelopeUI(); | |||||
| Fl_Double_Window* make_freemode_edit_window(); | |||||
| Fl_Double_Window *freemodeeditwindow; | |||||
| EnvelopeFreeEdit *freeedit; | |||||
| Fl_Button *addpoint; | |||||
| private: | |||||
| void cb_addpoint_i(Fl_Button*, void*); | |||||
| static void cb_addpoint(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *deletepoint; | |||||
| private: | |||||
| void cb_deletepoint_i(Fl_Button*, void*); | |||||
| static void cb_deletepoint(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Light_Button *freemodebutton; | |||||
| private: | |||||
| void cb_freemodebutton_i(Fl_Light_Button*, void*); | |||||
| static void cb_freemodebutton(Fl_Light_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *forcedreleasecheck; | |||||
| private: | |||||
| void cb_forcedreleasecheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_forcedreleasecheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *envstretchdial; | |||||
| private: | |||||
| void cb_envstretchdial_i(WidgetPDial*, void*); | |||||
| static void cb_envstretchdial(WidgetPDial*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *linearenvelopecheck; | |||||
| private: | |||||
| void cb_linearenvelopecheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_linearenvelopecheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *sustaincounter; | |||||
| private: | |||||
| void cb_sustaincounter_i(Fl_Counter*, void*); | |||||
| static void cb_sustaincounter(Fl_Counter*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_ADSR_window(); | |||||
| Fl_Group *envADSR; | |||||
| WidgetPDial *e1adt; | |||||
| private: | |||||
| void cb_e1adt_i(WidgetPDial*, void*); | |||||
| static void cb_e1adt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e1ddt; | |||||
| private: | |||||
| void cb_e1ddt_i(WidgetPDial*, void*); | |||||
| static void cb_e1ddt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e1rdt; | |||||
| private: | |||||
| void cb_e1rdt_i(WidgetPDial*, void*); | |||||
| static void cb_e1rdt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e1sval; | |||||
| private: | |||||
| void cb_e1sval_i(WidgetPDial*, void*); | |||||
| static void cb_e1sval(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *e1forcedrelease; | |||||
| private: | |||||
| void cb_e1forcedrelease_i(Fl_Check_Button*, void*); | |||||
| static void cb_e1forcedrelease(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *e1envstretch; | |||||
| private: | |||||
| void cb_e1envstretch_i(WidgetPDial*, void*); | |||||
| static void cb_e1envstretch(WidgetPDial*, void*); | |||||
| void cb_E_i(Fl_Button*, void*); | |||||
| static void cb_E(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *e1linearenvelope; | |||||
| private: | |||||
| void cb_e1linearenvelope_i(Fl_Check_Button*, void*); | |||||
| static void cb_e1linearenvelope(Fl_Check_Button*, void*); | |||||
| void cb_C1_i(Fl_Button*, void*); | |||||
| static void cb_C1(Fl_Button*, void*); | |||||
| void cb_P1_i(Fl_Button*, void*); | |||||
| static void cb_P1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_ASR_window(); | |||||
| Fl_Group *envASR; | |||||
| WidgetPDial *e2aval; | |||||
| private: | |||||
| void cb_e2aval_i(WidgetPDial*, void*); | |||||
| static void cb_e2aval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e2adt; | |||||
| private: | |||||
| void cb_e2adt_i(WidgetPDial*, void*); | |||||
| static void cb_e2adt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e2rval; | |||||
| private: | |||||
| void cb_e2rval_i(WidgetPDial*, void*); | |||||
| static void cb_e2rval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e2rdt; | |||||
| private: | |||||
| void cb_e2rdt_i(WidgetPDial*, void*); | |||||
| static void cb_e2rdt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e2envstretch; | |||||
| private: | |||||
| void cb_e2envstretch_i(WidgetPDial*, void*); | |||||
| static void cb_e2envstretch(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *e2forcedrelease; | |||||
| private: | |||||
| void cb_e2forcedrelease_i(Fl_Check_Button*, void*); | |||||
| static void cb_e2forcedrelease(Fl_Check_Button*, void*); | |||||
| void cb_C2_i(Fl_Button*, void*); | |||||
| static void cb_C2(Fl_Button*, void*); | |||||
| void cb_P2_i(Fl_Button*, void*); | |||||
| static void cb_P2(Fl_Button*, void*); | |||||
| void cb_E1_i(Fl_Button*, void*); | |||||
| static void cb_E1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_ADSRfilter_window(); | |||||
| Fl_Group *envADSRfilter; | |||||
| WidgetPDial *e3aval; | |||||
| private: | |||||
| void cb_e3aval_i(WidgetPDial*, void*); | |||||
| static void cb_e3aval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e3adt; | |||||
| private: | |||||
| void cb_e3adt_i(WidgetPDial*, void*); | |||||
| static void cb_e3adt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e3dval; | |||||
| private: | |||||
| void cb_e3dval_i(WidgetPDial*, void*); | |||||
| static void cb_e3dval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e3ddt; | |||||
| private: | |||||
| void cb_e3ddt_i(WidgetPDial*, void*); | |||||
| static void cb_e3ddt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e3rdt; | |||||
| private: | |||||
| void cb_e3rdt_i(WidgetPDial*, void*); | |||||
| static void cb_e3rdt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e3rval; | |||||
| private: | |||||
| void cb_e3rval_i(WidgetPDial*, void*); | |||||
| static void cb_e3rval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e3envstretch; | |||||
| private: | |||||
| void cb_e3envstretch_i(WidgetPDial*, void*); | |||||
| static void cb_e3envstretch(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *e3forcedrelease; | |||||
| private: | |||||
| void cb_e3forcedrelease_i(Fl_Check_Button*, void*); | |||||
| static void cb_e3forcedrelease(Fl_Check_Button*, void*); | |||||
| void cb_E2_i(Fl_Button*, void*); | |||||
| static void cb_E2(Fl_Button*, void*); | |||||
| void cb_C3_i(Fl_Button*, void*); | |||||
| static void cb_C3(Fl_Button*, void*); | |||||
| void cb_P3_i(Fl_Button*, void*); | |||||
| static void cb_P3(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_ASRbw_window(); | |||||
| Fl_Group *envASRbw; | |||||
| WidgetPDial *e4aval; | |||||
| private: | |||||
| void cb_e4aval_i(WidgetPDial*, void*); | |||||
| static void cb_e4aval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e4adt; | |||||
| private: | |||||
| void cb_e4adt_i(WidgetPDial*, void*); | |||||
| static void cb_e4adt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e4rval; | |||||
| private: | |||||
| void cb_e4rval_i(WidgetPDial*, void*); | |||||
| static void cb_e4rval(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e4rdt; | |||||
| private: | |||||
| void cb_e4rdt_i(WidgetPDial*, void*); | |||||
| static void cb_e4rdt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *e4envstretch; | |||||
| private: | |||||
| void cb_e4envstretch_i(WidgetPDial*, void*); | |||||
| static void cb_e4envstretch(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *e4forcedrelease; | |||||
| private: | |||||
| void cb_e4forcedrelease_i(Fl_Check_Button*, void*); | |||||
| static void cb_e4forcedrelease(Fl_Check_Button*, void*); | |||||
| void cb_C4_i(Fl_Button*, void*); | |||||
| static void cb_C4(Fl_Button*, void*); | |||||
| void cb_P4_i(Fl_Button*, void*); | |||||
| static void cb_P4(Fl_Button*, void*); | |||||
| void cb_E3_i(Fl_Button*, void*); | |||||
| static void cb_E3(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group* make_free_window(); | |||||
| Fl_Group *envfree; | |||||
| Fl_Group *envfreegroup; | |||||
| EnvelopeFreeEdit *freeeditsmall; | |||||
| private: | |||||
| void cb_freeeditsmall_i(EnvelopeFreeEdit*, void*); | |||||
| static void cb_freeeditsmall(EnvelopeFreeEdit*, void*); | |||||
| void cb_E4_i(Fl_Button*, void*); | |||||
| static void cb_E4(Fl_Button*, void*); | |||||
| void cb_C5_i(Fl_Button*, void*); | |||||
| static void cb_C5(Fl_Button*, void*); | |||||
| void cb_P5_i(Fl_Button*, void*); | |||||
| static void cb_P5(Fl_Button*, void*); | |||||
| public: | |||||
| void init(EnvelopeParams *env_); | |||||
| void reinit(); | |||||
| void refresh(); | |||||
| private: | |||||
| EnvelopeParams *env; | |||||
| Fl_Group *envwindow; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,994 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/FilterUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| #include <cmath> | |||||
| #include <stdio.h> | |||||
| #include <stdlib.h> | |||||
| FormantFilterGraph::FormantFilterGraph(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { | |||||
| pars=NULL; | |||||
| nvowel=NULL; | |||||
| nformant=NULL; | |||||
| graphpoints=NULL; | |||||
| } | |||||
| void FormantFilterGraph::init(FilterParams *pars_,int *nvowel_,int *nformant_) { | |||||
| pars=pars_; | |||||
| nvowel=nvowel_; | |||||
| nformant=nformant_; | |||||
| oldx=-1; | |||||
| graphpoints=new float [w()]; | |||||
| } | |||||
| void FormantFilterGraph::draw_freq_line(float freq,int type) { | |||||
| float freqx=pars->getfreqpos(freq); | |||||
| switch(type){ | |||||
| case 0:fl_line_style(FL_SOLID);break; | |||||
| case 1:fl_line_style(FL_DOT);break; | |||||
| case 2:fl_line_style(FL_DASH);break; | |||||
| }; | |||||
| if ((freqx>0.0)&&(freqx<1.0)) | |||||
| fl_line(x()+(int) (freqx*w()),y(), | |||||
| x()+(int) (freqx*w()),y()+h()); | |||||
| } | |||||
| void FormantFilterGraph::draw() { | |||||
| int maxdB=30; | |||||
| int ox=x(),oy=y(),lx=w(),ly=h(),i,oiy; | |||||
| float freqx; | |||||
| fl_color(FL_BLACK); | |||||
| fl_rectf(ox,oy,lx,ly); | |||||
| //draw the lines | |||||
| fl_color(FL_GRAY); | |||||
| fl_line_style(FL_SOLID); | |||||
| //fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); | |||||
| freqx=pars->getfreqpos(1000.0); | |||||
| if ((freqx>0.0)&&(freqx<1.0)) | |||||
| fl_line(ox+(int) (freqx*lx),oy, | |||||
| ox+(int) (freqx*lx),oy+ly); | |||||
| for (i=1;i<10;i++){ | |||||
| if(i==1){ | |||||
| draw_freq_line(i*100.0,0); | |||||
| draw_freq_line(i*1000.0,0); | |||||
| }else | |||||
| if (i==5){ | |||||
| draw_freq_line(i*100.0,2); | |||||
| draw_freq_line(i*1000.0,2); | |||||
| }else{ | |||||
| draw_freq_line(i*100.0,1); | |||||
| draw_freq_line(i*1000.0,1); | |||||
| }; | |||||
| }; | |||||
| draw_freq_line(10000.0,0); | |||||
| draw_freq_line(20000.0,1); | |||||
| fl_line_style(FL_DOT); | |||||
| int GY=10;if (ly<GY*3) GY=-1; | |||||
| for (i=1;i<GY;i++){ | |||||
| int tmp=(int)(ly/(float)GY*i); | |||||
| fl_line(ox+2,oy+tmp,ox+lx-2,oy+tmp); | |||||
| }; | |||||
| fl_color(FL_YELLOW); | |||||
| fl_font(FL_HELVETICA,10); | |||||
| if (*nformant<pars->Pnumformants){ | |||||
| draw_freq_line(pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq),2); | |||||
| //show some information (like current formant frequency,amplitude) | |||||
| char tmpstr[20]; | |||||
| snprintf(tmpstr,20,"%.2f kHz",pars->getformantfreq(pars->Pvowels[*nvowel].formants[*nformant].freq)*0.001); | |||||
| fl_draw(tmpstr,ox+1,oy+1,40,12,FL_ALIGN_LEFT,NULL,0); | |||||
| snprintf(tmpstr,20,"%d dB",(int)( rap2dB(1e-9 + pars->getformantamp(pars->Pvowels[*nvowel].formants[*nformant].amp)) + pars->getgain() )); | |||||
| fl_draw(tmpstr,ox+1,oy+15,40,12,FL_ALIGN_LEFT,NULL,0); | |||||
| }; | |||||
| //draw the data | |||||
| fl_color(FL_RED); | |||||
| fl_line_style(FL_SOLID); | |||||
| pars->formantfilterH(*nvowel,lx,graphpoints); | |||||
| fl_line_style( FL_SOLID, 2 ); | |||||
| fl_begin_line(); | |||||
| oiy=(int) ((graphpoints[0]/maxdB+1.0)*ly/2.0); | |||||
| for (i=1;i<lx;i++){ | |||||
| double iy= ((graphpoints[i]/maxdB+1.0)*ly/2.0); | |||||
| if ((iy>=0)&&(oiy>=0)&&(iy<ly)&&(oiy<lx)) | |||||
| fl_vertex(ox+i,oy+ly-iy); | |||||
| oiy=iy; | |||||
| }; | |||||
| fl_end_line(); | |||||
| fl_line_style(FL_SOLID,0); | |||||
| } | |||||
| FormantFilterGraph::~FormantFilterGraph() { | |||||
| delete [] graphpoints; | |||||
| } | |||||
| void FilterUI::cb_analogfiltertypechoice_i(Fl_Choice* o, void*) { | |||||
| pars->Ptype=(int)o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_analogfiltertypechoice(Fl_Choice* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_analogfiltertypechoice_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item FilterUI::menu_analogfiltertypechoice[] = { | |||||
| {"LPF1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"HPF1", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"LPF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"HPF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"BPF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"NF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"PkF2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"LSh2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"HSh2", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void FilterUI::cb_svfiltertypechoice_i(Fl_Choice* o, void*) { | |||||
| pars->Ptype=(int)o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_svfiltertypechoice(Fl_Choice* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_svfiltertypechoice_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item FilterUI::menu_svfiltertypechoice[] = { | |||||
| {"1LPF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"1HPF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"1BPF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"1NF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void FilterUI::cb_filtertype_i(Fl_Choice* o, void*) { | |||||
| switchcategory((int)o->value()); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_filtertype(Fl_Choice* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_filtertype_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item FilterUI::menu_filtertype[] = { | |||||
| {"Analog", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"Formant", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"StVarF", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void FilterUI::cb_cfreqdial_i(WidgetPDial* o, void*) { | |||||
| pars->Pfreq=(int)o->value(); | |||||
| } | |||||
| void FilterUI::cb_cfreqdial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_cfreqdial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_qdial_i(WidgetPDial* o, void*) { | |||||
| pars->Pq=(int)o->value(); | |||||
| formantfiltergraph->redraw(); | |||||
| } | |||||
| void FilterUI::cb_qdial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_qdial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_freqtrdial_i(WidgetPDial* o, void*) { | |||||
| pars->Pfreqtrack=(int) o->value(); | |||||
| } | |||||
| void FilterUI::cb_freqtrdial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_freqtrdial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_vsnsadial_i(WidgetPDial* o, void*) { | |||||
| if (velsnsamp!=NULL) *velsnsamp=(int)o->value(); | |||||
| } | |||||
| void FilterUI::cb_vsnsadial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_vsnsadial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_vsnsdial_i(WidgetPDial* o, void*) { | |||||
| if (velsns!=NULL) *velsns=(int)o->value(); | |||||
| } | |||||
| void FilterUI::cb_vsnsdial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_vsnsdial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_gaindial_i(WidgetPDial* o, void*) { | |||||
| pars->Pgain=(int)o->value(); | |||||
| formantfiltergraph->redraw(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_gaindial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_gaindial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_stcounter_i(Fl_Choice* o, void*) { | |||||
| pars->Pstages=(int)o->value(); | |||||
| formantfiltergraph->redraw(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_stcounter(Fl_Choice* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_stcounter_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_editbutton_i(Fl_Button*, void*) { | |||||
| formantparswindow->show(); | |||||
| } | |||||
| void FilterUI::cb_editbutton(Fl_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_editbutton_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_C_i(Fl_Button*, void*) { | |||||
| presetsui->copy(pars); | |||||
| } | |||||
| void FilterUI::cb_C(Fl_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_C_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_P_i(Fl_Button*, void*) { | |||||
| presetsui->paste(pars,this); | |||||
| } | |||||
| void FilterUI::cb_P(Fl_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_P_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_Formant_i(Fl_Counter* o, void*) { | |||||
| nformant=(int) o->value(); | |||||
| update_formant_window(); | |||||
| formantfiltergraph->redraw(); | |||||
| } | |||||
| void FilterUI::cb_Formant(Fl_Counter* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Formant_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_Vowel_i(Fl_Counter* o, void*) { | |||||
| nvowel=(int) o->value(); | |||||
| update_formant_window(); | |||||
| formantfiltergraph->redraw(); | |||||
| } | |||||
| void FilterUI::cb_Vowel(Fl_Counter* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Vowel_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_formant_freq_dial_i(WidgetPDial* o, void*) { | |||||
| pars->Pvowels[nvowel].formants[nformant].freq=(int) o->value(); | |||||
| formantfiltergraph->redraw(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_formant_freq_dial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->parent()->user_data()))->cb_formant_freq_dial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_formant_q_dial_i(WidgetPDial* o, void*) { | |||||
| pars->Pvowels[nvowel].formants[nformant].q=(int) o->value(); | |||||
| formantfiltergraph->redraw(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_formant_q_dial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->parent()->user_data()))->cb_formant_q_dial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_formant_amp_dial_i(WidgetPDial* o, void*) { | |||||
| pars->Pvowels[nvowel].formants[nformant].amp=(int) o->value(); | |||||
| formantfiltergraph->redraw(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_formant_amp_dial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->parent()->user_data()))->cb_formant_amp_dial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_Seq_i(Fl_Counter* o, void*) { | |||||
| pars->Psequencesize=(int) o->value(); | |||||
| update_formant_window(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_Seq(Fl_Counter* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Seq_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_S_i(Fl_Counter* o, void*) { | |||||
| nseqpos=(int) o->value(); | |||||
| update_formant_window(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_S(Fl_Counter* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_S_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_vowel_counter_i(Fl_Counter* o, void*) { | |||||
| pars->Psequence[nseqpos].nvowel=(int) o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_vowel_counter(Fl_Counter* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_vowel_counter_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_Neg_i(Fl_Check_Button* o, void*) { | |||||
| pars->Psequencereversed=(int) o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_Neg(Fl_Check_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_Neg_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_strchdial_i(WidgetPDial* o, void*) { | |||||
| pars->Psequencestretch=(int) o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_strchdial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->parent()->user_data()))->cb_strchdial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_Num_i(Fl_Counter* o, void*) { | |||||
| pars->Pnumformants=(int) o->value(); | |||||
| update_formant_window(); | |||||
| pars->changed=true; | |||||
| formantfiltergraph->redraw(); | |||||
| } | |||||
| void FilterUI::cb_Num(Fl_Counter* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_Num_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_frsldial_i(WidgetPDial* o, void*) { | |||||
| pars->Pformantslowness=(int) o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_frsldial(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_frsldial_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_centerfreqvo_i(Fl_Value_Output* o, void*) { | |||||
| o->value(pars->getcenterfreq()/1000.0); | |||||
| } | |||||
| void FilterUI::cb_centerfreqvo(Fl_Value_Output* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_centerfreqvo_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_octavesfreqvo_i(Fl_Value_Output* o, void*) { | |||||
| o->value(pars->getoctavesfreq()); | |||||
| } | |||||
| void FilterUI::cb_octavesfreqvo(Fl_Value_Output* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_octavesfreqvo_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_cfknob_i(Fl_Slider* o, void*) { | |||||
| pars->Pcenterfreq=(int)o->value(); | |||||
| centerfreqvo->do_callback(); | |||||
| formantfiltergraph->redraw(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_cfknob(Fl_Slider* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_cfknob_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_octknob_i(Fl_Slider* o, void*) { | |||||
| pars->Poctavesfreq=(int)o->value(); | |||||
| octavesfreqvo->do_callback(); | |||||
| formantfiltergraph->redraw(); | |||||
| } | |||||
| void FilterUI::cb_octknob(Fl_Slider* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_octknob_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_wvknob_i(WidgetPDial* o, void*) { | |||||
| pars->Pvowelclearness=(int) o->value(); | |||||
| pars->changed=true; | |||||
| } | |||||
| void FilterUI::cb_wvknob(WidgetPDial* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_wvknob_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_Close_i(Fl_Button*, void*) { | |||||
| formantparswindow->hide(); | |||||
| } | |||||
| void FilterUI::cb_Close(Fl_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_C1_i(Fl_Button*, void*) { | |||||
| presetsui->copy(pars,nvowel); | |||||
| } | |||||
| void FilterUI::cb_C1(Fl_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_C1_i(o,v); | |||||
| } | |||||
| void FilterUI::cb_P1_i(Fl_Button*, void*) { | |||||
| presetsui->paste(pars,this,nvowel); | |||||
| } | |||||
| void FilterUI::cb_P1(Fl_Button* o, void* v) { | |||||
| ((FilterUI*)(o->parent()->user_data()))->cb_P1_i(o,v); | |||||
| } | |||||
| FilterUI::FilterUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { | |||||
| pars=NULL; | |||||
| velsnsamp=NULL; | |||||
| velsns=NULL; | |||||
| nvowel=0;nformant=0;nseqpos=0; | |||||
| } | |||||
| FilterUI::~FilterUI() { | |||||
| filterui->hide(); | |||||
| formantparswindow->hide(); | |||||
| hide(); | |||||
| //delete (filterui); | |||||
| delete (formantparswindow); | |||||
| } | |||||
| Fl_Group* FilterUI::make_window() { | |||||
| { filterui = new Fl_Group(0, 0, 275, 70); | |||||
| filterui->box(FL_FLAT_BOX); | |||||
| filterui->color(FL_LIGHT1); | |||||
| filterui->selection_color(FL_BACKGROUND_COLOR); | |||||
| filterui->labeltype(FL_NO_LABEL); | |||||
| filterui->labelfont(1); | |||||
| filterui->labelsize(14); | |||||
| filterui->labelcolor(FL_FOREGROUND_COLOR); | |||||
| filterui->user_data((void*)(this)); | |||||
| filterui->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| filterui->when(FL_WHEN_RELEASE); | |||||
| { Fl_Group* o = filterparamswindow = new Fl_Group(0, 0, 275, 75, "Filter Parameters"); | |||||
| filterparamswindow->box(FL_UP_FRAME); | |||||
| filterparamswindow->color((Fl_Color)183); | |||||
| filterparamswindow->labeltype(FL_ENGRAVED_LABEL); | |||||
| filterparamswindow->labelsize(10); | |||||
| filterparamswindow->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); | |||||
| { Fl_Choice* o = analogfiltertypechoice = new Fl_Choice(10, 50, 50, 15, "FilterType"); | |||||
| analogfiltertypechoice->tooltip("The Filter type"); | |||||
| analogfiltertypechoice->down_box(FL_BORDER_BOX); | |||||
| analogfiltertypechoice->labelsize(10); | |||||
| analogfiltertypechoice->textsize(10); | |||||
| analogfiltertypechoice->callback((Fl_Callback*)cb_analogfiltertypechoice); | |||||
| analogfiltertypechoice->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| analogfiltertypechoice->menu(menu_analogfiltertypechoice); | |||||
| o->value(pars->Ptype); | |||||
| } // Fl_Choice* analogfiltertypechoice | |||||
| { Fl_Choice* o = svfiltertypechoice = new Fl_Choice(10, 50, 50, 15, "FilterType"); | |||||
| svfiltertypechoice->tooltip("The Filter type"); | |||||
| svfiltertypechoice->down_box(FL_BORDER_BOX); | |||||
| svfiltertypechoice->labelsize(10); | |||||
| svfiltertypechoice->textsize(10); | |||||
| svfiltertypechoice->callback((Fl_Callback*)cb_svfiltertypechoice); | |||||
| svfiltertypechoice->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| svfiltertypechoice->menu(menu_svfiltertypechoice); | |||||
| o->value(pars->Ptype); | |||||
| } // Fl_Choice* svfiltertypechoice | |||||
| { Fl_Choice* o = filtertype = new Fl_Choice(10, 20, 60, 15, "Category"); | |||||
| filtertype->tooltip("The Category of the Filter (Analog/Formantic/etc.)"); | |||||
| filtertype->down_box(FL_BORDER_BOX); | |||||
| filtertype->labelsize(10); | |||||
| filtertype->textsize(10); | |||||
| filtertype->callback((Fl_Callback*)cb_filtertype); | |||||
| filtertype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| filtertype->menu(menu_filtertype); | |||||
| o->value(pars->Pcategory); | |||||
| } // Fl_Choice* filtertype | |||||
| { WidgetPDial* o = cfreqdial = new WidgetPDial(75, 25, 30, 30, "C.Freq"); | |||||
| cfreqdial->tooltip("Center Frequency of the Filter or the base position in the vowel\'s sequence"); | |||||
| cfreqdial->box(FL_ROUND_UP_BOX); | |||||
| cfreqdial->color(FL_BACKGROUND_COLOR); | |||||
| cfreqdial->selection_color(FL_INACTIVE_COLOR); | |||||
| cfreqdial->labeltype(FL_NORMAL_LABEL); | |||||
| cfreqdial->labelfont(0); | |||||
| cfreqdial->labelsize(10); | |||||
| cfreqdial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| cfreqdial->maximum(127); | |||||
| cfreqdial->step(1); | |||||
| cfreqdial->callback((Fl_Callback*)cb_cfreqdial); | |||||
| cfreqdial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| cfreqdial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Pfreq); | |||||
| } // WidgetPDial* cfreqdial | |||||
| { WidgetPDial* o = qdial = new WidgetPDial(110, 25, 30, 30, "Q"); | |||||
| qdial->tooltip("Filter resonance or bandwidth"); | |||||
| qdial->box(FL_ROUND_UP_BOX); | |||||
| qdial->color(FL_BACKGROUND_COLOR); | |||||
| qdial->selection_color(FL_INACTIVE_COLOR); | |||||
| qdial->labeltype(FL_NORMAL_LABEL); | |||||
| qdial->labelfont(0); | |||||
| qdial->labelsize(10); | |||||
| qdial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| qdial->maximum(127); | |||||
| qdial->step(1); | |||||
| qdial->callback((Fl_Callback*)cb_qdial); | |||||
| qdial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| qdial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Pq); | |||||
| } // WidgetPDial* qdial | |||||
| { WidgetPDial* o = freqtrdial = new WidgetPDial(215, 25, 30, 30, "freq.tr."); | |||||
| freqtrdial->tooltip("Filter frequency tracking (left is negative, middle is 0, and right is positi\ | |||||
| ve)"); | |||||
| freqtrdial->box(FL_ROUND_UP_BOX); | |||||
| freqtrdial->color(FL_BACKGROUND_COLOR); | |||||
| freqtrdial->selection_color(FL_INACTIVE_COLOR); | |||||
| freqtrdial->labeltype(FL_NORMAL_LABEL); | |||||
| freqtrdial->labelfont(0); | |||||
| freqtrdial->labelsize(10); | |||||
| freqtrdial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| freqtrdial->maximum(127); | |||||
| freqtrdial->step(1); | |||||
| freqtrdial->callback((Fl_Callback*)cb_freqtrdial); | |||||
| freqtrdial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| freqtrdial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Pfreqtrack); | |||||
| } // WidgetPDial* freqtrdial | |||||
| { vsnsadial = new WidgetPDial(145, 25, 30, 30, "V.SnsA."); | |||||
| vsnsadial->tooltip("Velocity sensing amount of the Filter"); | |||||
| vsnsadial->box(FL_ROUND_UP_BOX); | |||||
| vsnsadial->color(FL_BACKGROUND_COLOR); | |||||
| vsnsadial->selection_color(FL_INACTIVE_COLOR); | |||||
| vsnsadial->labeltype(FL_NORMAL_LABEL); | |||||
| vsnsadial->labelfont(0); | |||||
| vsnsadial->labelsize(10); | |||||
| vsnsadial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| vsnsadial->maximum(127); | |||||
| vsnsadial->step(1); | |||||
| vsnsadial->callback((Fl_Callback*)cb_vsnsadial); | |||||
| vsnsadial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| vsnsadial->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* vsnsadial | |||||
| { vsnsdial = new WidgetPDial(180, 25, 30, 30, "V.Sns."); | |||||
| vsnsdial->tooltip("Velocity Sensing Function of the Filter"); | |||||
| vsnsdial->box(FL_ROUND_UP_BOX); | |||||
| vsnsdial->color(FL_BACKGROUND_COLOR); | |||||
| vsnsdial->selection_color(FL_INACTIVE_COLOR); | |||||
| vsnsdial->labeltype(FL_NORMAL_LABEL); | |||||
| vsnsdial->labelfont(0); | |||||
| vsnsdial->labelsize(10); | |||||
| vsnsdial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| vsnsdial->maximum(127); | |||||
| vsnsdial->step(1); | |||||
| vsnsdial->callback((Fl_Callback*)cb_vsnsdial); | |||||
| vsnsdial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| vsnsdial->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* vsnsdial | |||||
| { WidgetPDial* o = gaindial = new WidgetPDial(250, 35, 20, 20, "gain"); | |||||
| gaindial->tooltip("Filter output gain/damp"); | |||||
| gaindial->box(FL_ROUND_UP_BOX); | |||||
| gaindial->color(FL_BACKGROUND_COLOR); | |||||
| gaindial->selection_color(FL_INACTIVE_COLOR); | |||||
| gaindial->labeltype(FL_NORMAL_LABEL); | |||||
| gaindial->labelfont(0); | |||||
| gaindial->labelsize(10); | |||||
| gaindial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| gaindial->maximum(127); | |||||
| gaindial->step(1); | |||||
| gaindial->callback((Fl_Callback*)cb_gaindial); | |||||
| gaindial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| gaindial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Pgain); | |||||
| } // WidgetPDial* gaindial | |||||
| { Fl_Choice* o = stcounter = new Fl_Choice(235, 5, 35, 15, "St"); | |||||
| stcounter->tooltip("Filter stages (in order to increase dB/oct. value and the order of the filter\ | |||||
| )"); | |||||
| stcounter->down_box(FL_BORDER_BOX); | |||||
| stcounter->labelsize(10); | |||||
| stcounter->textfont(1); | |||||
| stcounter->textsize(10); | |||||
| stcounter->callback((Fl_Callback*)cb_stcounter); | |||||
| for (int i=0;i<MAX_FILTER_STAGES;i++) {char tmp[10];snprintf(tmp,10,"%dx",i+1);o->add(tmp);}; | |||||
| o->value(pars->Pstages); | |||||
| } // Fl_Choice* stcounter | |||||
| set_module_parameters( o ); | |||||
| filterparamswindow->end(); | |||||
| } // Fl_Group* filterparamswindow | |||||
| { editbutton = new Fl_Button(15, 40, 50, 25, "Edit"); | |||||
| editbutton->labelfont(1); | |||||
| editbutton->labelsize(11); | |||||
| editbutton->callback((Fl_Callback*)cb_editbutton); | |||||
| } // Fl_Button* editbutton | |||||
| { Fl_Button* o = new Fl_Button(186, 5, 15, 15, "C"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_C); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(203, 5, 15, 15, "P"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_P); | |||||
| } // Fl_Button* o | |||||
| filterui->end(); | |||||
| } // Fl_Group* filterui | |||||
| return filterui; | |||||
| } | |||||
| Fl_Double_Window* FilterUI::make_formant_window() { | |||||
| { formantparswindow = new Fl_Double_Window(700, 205, "Formant Filter Parameters"); | |||||
| formantparswindow->user_data((void*)(this)); | |||||
| { Fl_Group* o = new Fl_Group(485, 47, 105, 113); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| { Fl_Counter* o = new Fl_Counter(545, 80, 40, 15, "Formant "); | |||||
| o->type(1); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_Formant); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT)); | |||||
| o->bounds(0,FF_MAX_FORMANTS-1); | |||||
| o->value(nformant); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Counter* o = new Fl_Counter(545, 55, 40, 20, "Vowel no."); | |||||
| o->type(1); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->textfont(1); | |||||
| o->textsize(11); | |||||
| o->callback((Fl_Callback*)cb_Vowel); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT)); | |||||
| o->bounds(0,FF_MAX_VOWELS-1); | |||||
| o->value(nvowel); | |||||
| } // Fl_Counter* o | |||||
| { formantparsgroup = new Fl_Group(490, 105, 95, 50); | |||||
| formantparsgroup->box(FL_ENGRAVED_FRAME); | |||||
| { formant_freq_dial = new WidgetPDial(495, 115, 25, 25, "freq"); | |||||
| formant_freq_dial->tooltip("Formant frequency"); | |||||
| formant_freq_dial->box(FL_ROUND_UP_BOX); | |||||
| formant_freq_dial->color(FL_BACKGROUND_COLOR); | |||||
| formant_freq_dial->selection_color(FL_INACTIVE_COLOR); | |||||
| formant_freq_dial->labeltype(FL_NORMAL_LABEL); | |||||
| formant_freq_dial->labelfont(0); | |||||
| formant_freq_dial->labelsize(10); | |||||
| formant_freq_dial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| formant_freq_dial->maximum(127); | |||||
| formant_freq_dial->step(1); | |||||
| formant_freq_dial->callback((Fl_Callback*)cb_formant_freq_dial); | |||||
| formant_freq_dial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| formant_freq_dial->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* formant_freq_dial | |||||
| { formant_q_dial = new WidgetPDial(525, 115, 24, 25, "Q"); | |||||
| formant_q_dial->tooltip("Formant\'s Q"); | |||||
| formant_q_dial->box(FL_ROUND_UP_BOX); | |||||
| formant_q_dial->color(FL_BACKGROUND_COLOR); | |||||
| formant_q_dial->selection_color(FL_INACTIVE_COLOR); | |||||
| formant_q_dial->labeltype(FL_NORMAL_LABEL); | |||||
| formant_q_dial->labelfont(0); | |||||
| formant_q_dial->labelsize(10); | |||||
| formant_q_dial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| formant_q_dial->maximum(127); | |||||
| formant_q_dial->step(1); | |||||
| formant_q_dial->callback((Fl_Callback*)cb_formant_q_dial); | |||||
| formant_q_dial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| formant_q_dial->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* formant_q_dial | |||||
| { formant_amp_dial = new WidgetPDial(555, 115, 24, 25, "amp"); | |||||
| formant_amp_dial->tooltip("Formant amplitude"); | |||||
| formant_amp_dial->box(FL_ROUND_UP_BOX); | |||||
| formant_amp_dial->color(FL_BACKGROUND_COLOR); | |||||
| formant_amp_dial->selection_color(FL_INACTIVE_COLOR); | |||||
| formant_amp_dial->labeltype(FL_NORMAL_LABEL); | |||||
| formant_amp_dial->labelfont(0); | |||||
| formant_amp_dial->labelsize(10); | |||||
| formant_amp_dial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| formant_amp_dial->maximum(127); | |||||
| formant_amp_dial->step(1); | |||||
| formant_amp_dial->callback((Fl_Callback*)cb_formant_amp_dial); | |||||
| formant_amp_dial->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| formant_amp_dial->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* formant_amp_dial | |||||
| formantparsgroup->end(); | |||||
| } // Fl_Group* formantparsgroup | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = new Fl_Group(590, 47, 100, 113); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| { Fl_Counter* o = new Fl_Counter(595, 62, 55, 20, "Seq.Size"); | |||||
| o->type(1); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->textfont(1); | |||||
| o->textsize(11); | |||||
| o->callback((Fl_Callback*)cb_Seq); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->bounds(1,FF_MAX_SEQUENCE-1); | |||||
| o->value(pars->Psequencesize); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Counter* o = new Fl_Counter(595, 97, 40, 15, "S.Pos."); | |||||
| o->tooltip("Current position from the sequence"); | |||||
| o->type(1); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_S); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_RIGHT)); | |||||
| o->bounds(0,FF_MAX_SEQUENCE-2); | |||||
| o->value(nseqpos); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Counter* o = vowel_counter = new Fl_Counter(640, 97, 40, 15, "Vowel"); | |||||
| vowel_counter->type(1); | |||||
| vowel_counter->labelsize(10); | |||||
| vowel_counter->minimum(0); | |||||
| vowel_counter->maximum(127); | |||||
| vowel_counter->step(1); | |||||
| vowel_counter->textsize(10); | |||||
| vowel_counter->callback((Fl_Callback*)cb_vowel_counter); | |||||
| vowel_counter->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->bounds(0,FF_MAX_VOWELS-1); | |||||
| } // Fl_Counter* vowel_counter | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(625, 132, 60, 20, "Neg.Input"); | |||||
| o->tooltip("Negate the input from LFO/envelopes/etc."); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_Neg); | |||||
| o->value(pars->Psequencereversed); | |||||
| } // Fl_Check_Button* o | |||||
| { WidgetPDial* o = strchdial = new WidgetPDial(595, 130, 25, 25, "Strch"); | |||||
| strchdial->tooltip("Sequence Stretch"); | |||||
| strchdial->box(FL_ROUND_UP_BOX); | |||||
| strchdial->color(FL_BACKGROUND_COLOR); | |||||
| strchdial->selection_color(FL_INACTIVE_COLOR); | |||||
| strchdial->labeltype(FL_NORMAL_LABEL); | |||||
| strchdial->labelfont(0); | |||||
| strchdial->labelsize(10); | |||||
| strchdial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| strchdial->maximum(127); | |||||
| strchdial->step(1); | |||||
| strchdial->callback((Fl_Callback*)cb_strchdial); | |||||
| strchdial->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| strchdial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Psequencestretch); | |||||
| } // WidgetPDial* strchdial | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Counter* o = new Fl_Counter(485, 15, 65, 20, "Num.Formants"); | |||||
| o->type(1); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->callback((Fl_Callback*)cb_Num); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->bounds(1,FF_MAX_FORMANTS); | |||||
| o->value(pars->Pnumformants); | |||||
| } // Fl_Counter* o | |||||
| { WidgetPDial* o = frsldial = new WidgetPDial(565, 15, 25, 25, "Fr.Sl."); | |||||
| frsldial->tooltip("Formant\'s Slowness (Morphing)"); | |||||
| frsldial->box(FL_ROUND_UP_BOX); | |||||
| frsldial->color(FL_BACKGROUND_COLOR); | |||||
| frsldial->selection_color(FL_INACTIVE_COLOR); | |||||
| frsldial->labeltype(FL_NORMAL_LABEL); | |||||
| frsldial->labelfont(1); | |||||
| frsldial->labelsize(10); | |||||
| frsldial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| frsldial->maximum(127); | |||||
| frsldial->step(1); | |||||
| frsldial->callback((Fl_Callback*)cb_frsldial); | |||||
| frsldial->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| frsldial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Pformantslowness); | |||||
| } // WidgetPDial* frsldial | |||||
| { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(515, 164, 33, 18, "C.f."); | |||||
| centerfreqvo->tooltip("Center Frequency (kHz)"); | |||||
| centerfreqvo->minimum(1); | |||||
| centerfreqvo->maximum(10); | |||||
| centerfreqvo->step(0.01); | |||||
| centerfreqvo->value(1); | |||||
| centerfreqvo->textfont(1); | |||||
| centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo); | |||||
| centerfreqvo->when(3); | |||||
| o->value(pars->getcenterfreq()/1000.0); | |||||
| } // Fl_Value_Output* centerfreqvo | |||||
| { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(515, 182, 33, 18, "Oct."); | |||||
| octavesfreqvo->tooltip("No. of octaves"); | |||||
| octavesfreqvo->minimum(1); | |||||
| octavesfreqvo->maximum(127); | |||||
| octavesfreqvo->step(1); | |||||
| octavesfreqvo->value(5); | |||||
| octavesfreqvo->textfont(1); | |||||
| octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo); | |||||
| octavesfreqvo->when(3); | |||||
| o->value(pars->getoctavesfreq()); | |||||
| } // Fl_Value_Output* octavesfreqvo | |||||
| { Fl_Slider* o = cfknob = new Fl_Slider(551, 167, 84, 15); | |||||
| cfknob->type(5); | |||||
| cfknob->box(FL_FLAT_BOX); | |||||
| cfknob->maximum(127); | |||||
| cfknob->callback((Fl_Callback*)cb_cfknob); | |||||
| o->value(pars->Pcenterfreq); | |||||
| } // Fl_Slider* cfknob | |||||
| { Fl_Slider* o = octknob = new Fl_Slider(551, 185, 84, 15); | |||||
| octknob->type(5); | |||||
| octknob->box(FL_FLAT_BOX); | |||||
| octknob->maximum(127); | |||||
| octknob->callback((Fl_Callback*)cb_octknob); | |||||
| o->value(pars->Poctavesfreq); | |||||
| } // Fl_Slider* octknob | |||||
| { FormantFilterGraph* o = formantfiltergraph = new FormantFilterGraph(5, 5, 475, 195); | |||||
| formantfiltergraph->box(FL_BORDER_BOX); | |||||
| formantfiltergraph->color(FL_BACKGROUND_COLOR); | |||||
| formantfiltergraph->selection_color(FL_BACKGROUND_COLOR); | |||||
| formantfiltergraph->labeltype(FL_NORMAL_LABEL); | |||||
| formantfiltergraph->labelfont(0); | |||||
| formantfiltergraph->labelsize(14); | |||||
| formantfiltergraph->labelcolor(FL_FOREGROUND_COLOR); | |||||
| formantfiltergraph->align(Fl_Align(FL_ALIGN_CENTER)); | |||||
| formantfiltergraph->when(FL_WHEN_RELEASE); | |||||
| o->init(pars,&nvowel,&nformant); | |||||
| } // FormantFilterGraph* formantfiltergraph | |||||
| { WidgetPDial* o = wvknob = new WidgetPDial(600, 15, 25, 25, "Vw.Cl."); | |||||
| wvknob->tooltip("Vowel \"clearness\" (how the mixed vowels are avoided)"); | |||||
| wvknob->box(FL_ROUND_UP_BOX); | |||||
| wvknob->color(FL_BACKGROUND_COLOR); | |||||
| wvknob->selection_color(FL_INACTIVE_COLOR); | |||||
| wvknob->labeltype(FL_NORMAL_LABEL); | |||||
| wvknob->labelfont(1); | |||||
| wvknob->labelsize(10); | |||||
| wvknob->labelcolor(FL_FOREGROUND_COLOR); | |||||
| wvknob->maximum(127); | |||||
| wvknob->step(1); | |||||
| wvknob->callback((Fl_Callback*)cb_wvknob); | |||||
| wvknob->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| wvknob->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->Pvowelclearness); | |||||
| } // WidgetPDial* wvknob | |||||
| { Fl_Button* o = new Fl_Button(645, 180, 50, 25, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(635, 25, 25, 15, "C"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_C1); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(665, 25, 25, 15, "P"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_P1); | |||||
| } // Fl_Button* o | |||||
| { new Fl_Box(635, 10, 55, 15, "Vowel"); | |||||
| } // Fl_Box* o | |||||
| formantparswindow->end(); | |||||
| } // Fl_Double_Window* formantparswindow | |||||
| return formantparswindow; | |||||
| } | |||||
| void FilterUI::update_formant_window() { | |||||
| formant_freq_dial->value(pars->Pvowels[nvowel].formants[nformant].freq); | |||||
| formant_q_dial->value(pars->Pvowels[nvowel].formants[nformant].q); | |||||
| formant_amp_dial->value(pars->Pvowels[nvowel].formants[nformant].amp); | |||||
| if (nformant<pars->Pnumformants) formantparsgroup->activate(); | |||||
| else formantparsgroup->deactivate(); | |||||
| if (nseqpos<pars->Psequencesize) vowel_counter->activate(); | |||||
| else vowel_counter->deactivate(); | |||||
| vowel_counter->value(pars->Psequence[nseqpos].nvowel); | |||||
| } | |||||
| void FilterUI::refresh() { | |||||
| update_formant_window(); | |||||
| formantfiltergraph->redraw(); | |||||
| if (pars->Pcategory==0) svfiltertypechoice->value(pars->Ptype); | |||||
| if (pars->Pcategory==2) analogfiltertypechoice->value(pars->Ptype); | |||||
| filtertype->value(pars->Pcategory); | |||||
| cfreqdial->value(pars->Pfreq); | |||||
| qdial->value(pars->Pq); | |||||
| freqtrdial->value(pars->Pfreqtrack); | |||||
| gaindial->value(pars->Pgain); | |||||
| stcounter->value(pars->Pstages); | |||||
| int categ=pars->Pcategory; | |||||
| if ((categ==0)||(categ==2)) { | |||||
| if (categ==0) { | |||||
| analogfiltertypechoice->show(); | |||||
| svfiltertypechoice->hide(); | |||||
| } else { | |||||
| svfiltertypechoice->show(); | |||||
| analogfiltertypechoice->hide(); | |||||
| }; | |||||
| editbutton->hide(); | |||||
| formantparswindow->hide(); | |||||
| cfreqdial->label("C.freq"); | |||||
| } else { | |||||
| analogfiltertypechoice->hide(); | |||||
| svfiltertypechoice->hide(); | |||||
| editbutton->show(); | |||||
| cfreqdial->label("BS.pos"); | |||||
| }; | |||||
| filterparamswindow->redraw(); | |||||
| } | |||||
| void FilterUI::init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_) { | |||||
| pars=filterpars_; | |||||
| velsnsamp=velsnsamp_; | |||||
| velsns=velsns_; | |||||
| make_window(); | |||||
| end(); | |||||
| make_formant_window(); | |||||
| filterui->resize(this->x(),this->y(),this->w(),this->h()); | |||||
| if (velsnsamp==NULL){ | |||||
| vsnsadial->deactivate(); | |||||
| vsnsadial->value(127); | |||||
| } else vsnsadial->value(*velsnsamp); | |||||
| if (velsns==NULL){ | |||||
| vsnsdial->deactivate(); | |||||
| vsnsdial->value(127); | |||||
| } else vsnsdial->value(*velsns); | |||||
| switchcategory(pars->Pcategory); | |||||
| formantparswindow->label(this->label()); | |||||
| update_formant_window(); | |||||
| } | |||||
| void FilterUI::switchcategory(int newcat) { | |||||
| if (pars->Pcategory!=newcat){ | |||||
| pars->Pgain=64; | |||||
| gaindial->value(64); | |||||
| analogfiltertypechoice->value(0); | |||||
| analogfiltertypechoice->do_callback(); | |||||
| svfiltertypechoice->value(0); | |||||
| svfiltertypechoice->do_callback(); | |||||
| }; | |||||
| pars->Pcategory=newcat; | |||||
| refresh(); | |||||
| } | |||||
| void FilterUI::use_for_dynamic_filter() { | |||||
| freqtrdial->deactivate(); | |||||
| gaindial->when(0); | |||||
| cfknob->when(FL_WHEN_RELEASE); | |||||
| octknob->when(FL_WHEN_RELEASE); | |||||
| frsldial->when(0); | |||||
| wvknob->when(0); | |||||
| formant_freq_dial->when(0); | |||||
| formant_q_dial->when(0); | |||||
| formant_amp_dial->when(0); | |||||
| strchdial->when(0); | |||||
| } | |||||
| @@ -0,0 +1,197 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef FilterUI_h | |||||
| #define FilterUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include "WidgetPDial.h" | |||||
| #include "../globals.h" | |||||
| #include <FL/Fl_Group.H> | |||||
| #include "../Params/FilterParams.h" | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/fl_draw.H> | |||||
| #include <FL/fl_ask.H> | |||||
| #include "PresetsUI.h" | |||||
| #include "common.H" | |||||
| class FormantFilterGraph : public Fl_Box { | |||||
| public: | |||||
| FormantFilterGraph(int x,int y, int w, int h, const char *label=0); | |||||
| void init(FilterParams *pars_,int *nvowel_,int *nformant_); | |||||
| void draw_freq_line(float freq,int type); | |||||
| void draw(); | |||||
| ~FormantFilterGraph(); | |||||
| private: | |||||
| FilterParams *pars; | |||||
| int oldx,oldy; | |||||
| int *nvowel,*nformant; | |||||
| float *graphpoints; | |||||
| }; | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| class FilterUI : public Fl_Group,PresetsUI_ { | |||||
| public: | |||||
| FilterUI(int x,int y, int w, int h, const char *label=0); | |||||
| ~FilterUI(); | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *filterui; | |||||
| Fl_Group *filterparamswindow; | |||||
| Fl_Choice *analogfiltertypechoice; | |||||
| private: | |||||
| void cb_analogfiltertypechoice_i(Fl_Choice*, void*); | |||||
| static void cb_analogfiltertypechoice(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_analogfiltertypechoice[]; | |||||
| public: | |||||
| Fl_Choice *svfiltertypechoice; | |||||
| private: | |||||
| void cb_svfiltertypechoice_i(Fl_Choice*, void*); | |||||
| static void cb_svfiltertypechoice(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_svfiltertypechoice[]; | |||||
| public: | |||||
| Fl_Choice *filtertype; | |||||
| private: | |||||
| void cb_filtertype_i(Fl_Choice*, void*); | |||||
| static void cb_filtertype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_filtertype[]; | |||||
| public: | |||||
| WidgetPDial *cfreqdial; | |||||
| private: | |||||
| void cb_cfreqdial_i(WidgetPDial*, void*); | |||||
| static void cb_cfreqdial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *qdial; | |||||
| private: | |||||
| void cb_qdial_i(WidgetPDial*, void*); | |||||
| static void cb_qdial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *freqtrdial; | |||||
| private: | |||||
| void cb_freqtrdial_i(WidgetPDial*, void*); | |||||
| static void cb_freqtrdial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *vsnsadial; | |||||
| private: | |||||
| void cb_vsnsadial_i(WidgetPDial*, void*); | |||||
| static void cb_vsnsadial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *vsnsdial; | |||||
| private: | |||||
| void cb_vsnsdial_i(WidgetPDial*, void*); | |||||
| static void cb_vsnsdial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *gaindial; | |||||
| private: | |||||
| void cb_gaindial_i(WidgetPDial*, void*); | |||||
| static void cb_gaindial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *stcounter; | |||||
| private: | |||||
| void cb_stcounter_i(Fl_Choice*, void*); | |||||
| static void cb_stcounter(Fl_Choice*, void*); | |||||
| public: | |||||
| Fl_Button *editbutton; | |||||
| private: | |||||
| void cb_editbutton_i(Fl_Button*, void*); | |||||
| static void cb_editbutton(Fl_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window* make_formant_window(); | |||||
| Fl_Double_Window *formantparswindow; | |||||
| private: | |||||
| void cb_Formant_i(Fl_Counter*, void*); | |||||
| static void cb_Formant(Fl_Counter*, void*); | |||||
| void cb_Vowel_i(Fl_Counter*, void*); | |||||
| static void cb_Vowel(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group *formantparsgroup; | |||||
| WidgetPDial *formant_freq_dial; | |||||
| private: | |||||
| void cb_formant_freq_dial_i(WidgetPDial*, void*); | |||||
| static void cb_formant_freq_dial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *formant_q_dial; | |||||
| private: | |||||
| void cb_formant_q_dial_i(WidgetPDial*, void*); | |||||
| static void cb_formant_q_dial(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *formant_amp_dial; | |||||
| private: | |||||
| void cb_formant_amp_dial_i(WidgetPDial*, void*); | |||||
| static void cb_formant_amp_dial(WidgetPDial*, void*); | |||||
| void cb_Seq_i(Fl_Counter*, void*); | |||||
| static void cb_Seq(Fl_Counter*, void*); | |||||
| void cb_S_i(Fl_Counter*, void*); | |||||
| static void cb_S(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *vowel_counter; | |||||
| private: | |||||
| void cb_vowel_counter_i(Fl_Counter*, void*); | |||||
| static void cb_vowel_counter(Fl_Counter*, void*); | |||||
| void cb_Neg_i(Fl_Check_Button*, void*); | |||||
| static void cb_Neg(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *strchdial; | |||||
| private: | |||||
| void cb_strchdial_i(WidgetPDial*, void*); | |||||
| static void cb_strchdial(WidgetPDial*, void*); | |||||
| void cb_Num_i(Fl_Counter*, void*); | |||||
| static void cb_Num(Fl_Counter*, void*); | |||||
| public: | |||||
| WidgetPDial *frsldial; | |||||
| private: | |||||
| void cb_frsldial_i(WidgetPDial*, void*); | |||||
| static void cb_frsldial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Value_Output *centerfreqvo; | |||||
| private: | |||||
| void cb_centerfreqvo_i(Fl_Value_Output*, void*); | |||||
| static void cb_centerfreqvo(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Value_Output *octavesfreqvo; | |||||
| private: | |||||
| void cb_octavesfreqvo_i(Fl_Value_Output*, void*); | |||||
| static void cb_octavesfreqvo(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Slider *cfknob; | |||||
| private: | |||||
| void cb_cfknob_i(Fl_Slider*, void*); | |||||
| static void cb_cfknob(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Slider *octknob; | |||||
| private: | |||||
| void cb_octknob_i(Fl_Slider*, void*); | |||||
| static void cb_octknob(Fl_Slider*, void*); | |||||
| public: | |||||
| FormantFilterGraph *formantfiltergraph; | |||||
| WidgetPDial *wvknob; | |||||
| private: | |||||
| void cb_wvknob_i(WidgetPDial*, void*); | |||||
| static void cb_wvknob(WidgetPDial*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_C1_i(Fl_Button*, void*); | |||||
| static void cb_C1(Fl_Button*, void*); | |||||
| void cb_P1_i(Fl_Button*, void*); | |||||
| static void cb_P1(Fl_Button*, void*); | |||||
| public: | |||||
| void update_formant_window(); | |||||
| void refresh(); | |||||
| void init(FilterParams *filterpars_,unsigned char *velsnsamp_,unsigned char *velsns_); | |||||
| void switchcategory(int newcat); | |||||
| void use_for_dynamic_filter(); | |||||
| private: | |||||
| FilterParams *pars; | |||||
| unsigned char *velsnsamp,*velsns; | |||||
| int nvowel,nformant,nseqpos; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,290 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/LFOUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| void LFOUI::cb_freq_i(WidgetPDial* o, void*) { | |||||
| pars->Pfreq=o->value(); | |||||
| } | |||||
| void LFOUI::cb_freq(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_freq_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_intensity_i(WidgetPDial* o, void*) { | |||||
| pars->Pintensity=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_intensity(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_intensity_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_delay_i(WidgetPDial* o, void*) { | |||||
| pars->Pdelay=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_delay(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_delay_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_startphase_i(WidgetPDial* o, void*) { | |||||
| pars->Pstartphase=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_startphase(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_startphase_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_randomness_i(WidgetPDial* o, void*) { | |||||
| pars->Prandomness=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_randomness(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_randomness_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_LFOtype_i(Fl_Choice* o, void*) { | |||||
| pars->PLFOtype=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_LFOtype(Fl_Choice* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_LFOtype_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item LFOUI::menu_LFOtype[] = { | |||||
| {"SINE", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"TRI", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"SQR", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"R.up", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"R.dn", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"E1dn", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"E2dn", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void LFOUI::cb_continous_i(Fl_Check_Button* o, void*) { | |||||
| pars->Pcontinous=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_continous(Fl_Check_Button* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_continous_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_freqrand_i(WidgetPDial* o, void*) { | |||||
| pars->Pfreqrand=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_freqrand(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_freqrand_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_stretch_i(WidgetPDial* o, void*) { | |||||
| pars->Pstretch=(int)o->value(); | |||||
| } | |||||
| void LFOUI::cb_stretch(WidgetPDial* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_stretch_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_C_i(Fl_Button*, void*) { | |||||
| presetsui->copy(pars); | |||||
| } | |||||
| void LFOUI::cb_C(Fl_Button* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_C_i(o,v); | |||||
| } | |||||
| void LFOUI::cb_P_i(Fl_Button*, void*) { | |||||
| presetsui->paste(pars,this); | |||||
| } | |||||
| void LFOUI::cb_P(Fl_Button* o, void* v) { | |||||
| ((LFOUI*)(o->parent()->parent()->user_data()))->cb_P_i(o,v); | |||||
| } | |||||
| LFOUI::LFOUI(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { | |||||
| pars=NULL; | |||||
| } | |||||
| LFOUI::~LFOUI() { | |||||
| lfoui->hide(); | |||||
| hide(); | |||||
| //delete (lfoui); | |||||
| } | |||||
| Fl_Group* LFOUI::make_window() { | |||||
| { lfoui = new Fl_Group(0, 0, 230, 70); | |||||
| lfoui->box(FL_FLAT_BOX); | |||||
| lfoui->color(FL_LIGHT1); | |||||
| lfoui->selection_color(FL_BACKGROUND_COLOR); | |||||
| lfoui->labeltype(FL_NO_LABEL); | |||||
| lfoui->labelfont(1); | |||||
| lfoui->labelsize(14); | |||||
| lfoui->labelcolor(FL_FOREGROUND_COLOR); | |||||
| lfoui->user_data((void*)(this)); | |||||
| lfoui->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| lfoui->when(FL_WHEN_RELEASE); | |||||
| { Fl_Group* o = lfoparamswindow = new Fl_Group(0, 0, 230, 70, "LFO"); | |||||
| lfoparamswindow->box(FL_UP_BOX); | |||||
| lfoparamswindow->color(FL_CYAN); | |||||
| lfoparamswindow->labeltype(FL_ENGRAVED_LABEL); | |||||
| lfoparamswindow->labelsize(10); | |||||
| lfoparamswindow->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); | |||||
| { freq = new WidgetPDial(5, 20, 30, 30, "Freq."); | |||||
| freq->tooltip("LFO Frequency"); | |||||
| freq->box(FL_ROUND_UP_BOX); | |||||
| freq->color(FL_BACKGROUND_COLOR); | |||||
| freq->selection_color(FL_INACTIVE_COLOR); | |||||
| freq->labeltype(FL_NORMAL_LABEL); | |||||
| freq->labelfont(0); | |||||
| freq->labelsize(10); | |||||
| freq->labelcolor(FL_FOREGROUND_COLOR); | |||||
| freq->step(1e-05); | |||||
| freq->callback((Fl_Callback*)cb_freq); | |||||
| freq->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| freq->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* freq | |||||
| { intensity = new WidgetPDial(40, 20, 30, 30, "Depth"); | |||||
| intensity->tooltip("LFO Amount"); | |||||
| intensity->box(FL_ROUND_UP_BOX); | |||||
| intensity->color(FL_BACKGROUND_COLOR); | |||||
| intensity->selection_color(FL_INACTIVE_COLOR); | |||||
| intensity->labeltype(FL_NORMAL_LABEL); | |||||
| intensity->labelfont(0); | |||||
| intensity->labelsize(10); | |||||
| intensity->labelcolor(FL_FOREGROUND_COLOR); | |||||
| intensity->maximum(127); | |||||
| intensity->step(1); | |||||
| intensity->callback((Fl_Callback*)cb_intensity); | |||||
| intensity->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| intensity->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* intensity | |||||
| { delay = new WidgetPDial(110, 20, 30, 30, "Delay"); | |||||
| delay->tooltip("LFO delay"); | |||||
| delay->box(FL_ROUND_UP_BOX); | |||||
| delay->color(FL_BACKGROUND_COLOR); | |||||
| delay->selection_color(FL_INACTIVE_COLOR); | |||||
| delay->labeltype(FL_NORMAL_LABEL); | |||||
| delay->labelfont(0); | |||||
| delay->labelsize(10); | |||||
| delay->labelcolor(FL_FOREGROUND_COLOR); | |||||
| delay->maximum(127); | |||||
| delay->step(1); | |||||
| delay->callback((Fl_Callback*)cb_delay); | |||||
| delay->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| delay->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* delay | |||||
| { startphase = new WidgetPDial(75, 20, 30, 30, "Start"); | |||||
| startphase->tooltip("LFO Startphase (leftmost is Random)"); | |||||
| startphase->box(FL_ROUND_UP_BOX); | |||||
| startphase->color(FL_BACKGROUND_COLOR); | |||||
| startphase->selection_color(FL_INACTIVE_COLOR); | |||||
| startphase->labeltype(FL_NORMAL_LABEL); | |||||
| startphase->labelfont(0); | |||||
| startphase->labelsize(10); | |||||
| startphase->labelcolor(FL_FOREGROUND_COLOR); | |||||
| startphase->maximum(127); | |||||
| startphase->step(1); | |||||
| startphase->callback((Fl_Callback*)cb_startphase); | |||||
| startphase->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| startphase->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* startphase | |||||
| { randomness = new WidgetPDial(180, 7, 20, 20, "A.R."); | |||||
| randomness->tooltip("LFO Amplitude Randomness"); | |||||
| randomness->box(FL_ROUND_UP_BOX); | |||||
| randomness->color(FL_BACKGROUND_COLOR); | |||||
| randomness->selection_color(FL_INACTIVE_COLOR); | |||||
| randomness->labeltype(FL_NORMAL_LABEL); | |||||
| randomness->labelfont(0); | |||||
| randomness->labelsize(10); | |||||
| randomness->labelcolor(FL_FOREGROUND_COLOR); | |||||
| randomness->maximum(127); | |||||
| randomness->step(1); | |||||
| randomness->callback((Fl_Callback*)cb_randomness); | |||||
| randomness->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| randomness->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* randomness | |||||
| { LFOtype = new Fl_Choice(180, 40, 45, 15, "Type"); | |||||
| LFOtype->tooltip("LFO function"); | |||||
| LFOtype->down_box(FL_BORDER_BOX); | |||||
| LFOtype->labelsize(10); | |||||
| LFOtype->textsize(8); | |||||
| LFOtype->callback((Fl_Callback*)cb_LFOtype); | |||||
| LFOtype->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| LFOtype->menu(menu_LFOtype); | |||||
| } // Fl_Choice* LFOtype | |||||
| { continous = new Fl_Check_Button(165, 35, 15, 15, "C."); | |||||
| continous->tooltip("Continous LFO"); | |||||
| continous->down_box(FL_DOWN_BOX); | |||||
| continous->labelsize(10); | |||||
| continous->callback((Fl_Callback*)cb_continous); | |||||
| continous->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| } // Fl_Check_Button* continous | |||||
| { freqrand = new WidgetPDial(205, 7, 20, 20, "F.R."); | |||||
| freqrand->tooltip("LFO Frequency Randomness"); | |||||
| freqrand->box(FL_ROUND_UP_BOX); | |||||
| freqrand->color(FL_BACKGROUND_COLOR); | |||||
| freqrand->selection_color(FL_INACTIVE_COLOR); | |||||
| freqrand->labeltype(FL_NORMAL_LABEL); | |||||
| freqrand->labelfont(0); | |||||
| freqrand->labelsize(10); | |||||
| freqrand->labelcolor(FL_FOREGROUND_COLOR); | |||||
| freqrand->maximum(127); | |||||
| freqrand->step(1); | |||||
| freqrand->callback((Fl_Callback*)cb_freqrand); | |||||
| freqrand->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| freqrand->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* freqrand | |||||
| { stretch = new WidgetPDial(144, 30, 20, 20, "Str."); | |||||
| stretch->tooltip("LFO stretch"); | |||||
| stretch->box(FL_ROUND_UP_BOX); | |||||
| stretch->color(FL_BACKGROUND_COLOR); | |||||
| stretch->selection_color(FL_INACTIVE_COLOR); | |||||
| stretch->labeltype(FL_NORMAL_LABEL); | |||||
| stretch->labelfont(0); | |||||
| stretch->labelsize(10); | |||||
| stretch->labelcolor(FL_FOREGROUND_COLOR); | |||||
| stretch->maximum(127); | |||||
| stretch->step(1); | |||||
| stretch->callback((Fl_Callback*)cb_stretch); | |||||
| stretch->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| stretch->when(FL_WHEN_CHANGED); | |||||
| } // WidgetPDial* stretch | |||||
| { Fl_Button* o = new Fl_Button(145, 10, 15, 15, "C"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_C); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(162, 10, 15, 15, "P"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_P); | |||||
| } // Fl_Button* o | |||||
| set_module_parameters(o); | |||||
| lfoparamswindow->end(); | |||||
| } // Fl_Group* lfoparamswindow | |||||
| lfoui->end(); | |||||
| } // Fl_Group* lfoui | |||||
| return lfoui; | |||||
| } | |||||
| void LFOUI::refresh() { | |||||
| freq->value(pars->Pfreq); | |||||
| intensity->value(pars->Pintensity); | |||||
| startphase->value(pars->Pstartphase); | |||||
| delay->value(pars->Pdelay); | |||||
| continous->value(pars->Pcontinous); | |||||
| stretch->value(pars->Pstretch); | |||||
| randomness->value(pars->Prandomness); | |||||
| freqrand->value(pars->Pfreqrand); | |||||
| LFOtype->value(pars->PLFOtype); | |||||
| } | |||||
| void LFOUI::init(LFOParams *lfopars_) { | |||||
| pars=lfopars_; | |||||
| make_window(); | |||||
| end(); | |||||
| refresh(); | |||||
| lfoui->resize(this->x(),this->y(),this->w(),this->h()); | |||||
| lfoparamswindow->label(this->label()); | |||||
| } | |||||
| @@ -0,0 +1,84 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef LFOUI_h | |||||
| #define LFOUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include "WidgetPDial.h" | |||||
| #include <stdio.h> | |||||
| #include <stdlib.h> | |||||
| #include "../globals.h" | |||||
| #include <FL/Fl_Group.H> | |||||
| #include "../Params/LFOParams.h" | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/fl_draw.H> | |||||
| #include <FL/fl_ask.H> | |||||
| #include "PresetsUI.h" | |||||
| #include "common.H" | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| class LFOUI : public Fl_Group, PresetsUI_ { | |||||
| public: | |||||
| LFOUI(int x,int y, int w, int h, const char *label=0); | |||||
| ~LFOUI(); | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *lfoui; | |||||
| Fl_Group *lfoparamswindow; | |||||
| WidgetPDial *freq; | |||||
| private: | |||||
| void cb_freq_i(WidgetPDial*, void*); | |||||
| static void cb_freq(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *intensity; | |||||
| private: | |||||
| void cb_intensity_i(WidgetPDial*, void*); | |||||
| static void cb_intensity(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *delay; | |||||
| private: | |||||
| void cb_delay_i(WidgetPDial*, void*); | |||||
| static void cb_delay(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *startphase; | |||||
| private: | |||||
| void cb_startphase_i(WidgetPDial*, void*); | |||||
| static void cb_startphase(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *randomness; | |||||
| private: | |||||
| void cb_randomness_i(WidgetPDial*, void*); | |||||
| static void cb_randomness(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *LFOtype; | |||||
| private: | |||||
| void cb_LFOtype_i(Fl_Choice*, void*); | |||||
| static void cb_LFOtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_LFOtype[]; | |||||
| public: | |||||
| Fl_Check_Button *continous; | |||||
| private: | |||||
| void cb_continous_i(Fl_Check_Button*, void*); | |||||
| static void cb_continous(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *freqrand; | |||||
| private: | |||||
| void cb_freqrand_i(WidgetPDial*, void*); | |||||
| static void cb_freqrand(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *stretch; | |||||
| private: | |||||
| void cb_stretch_i(WidgetPDial*, void*); | |||||
| static void cb_stretch(WidgetPDial*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| void refresh(); | |||||
| void init(LFOParams *lfopars_); | |||||
| private: | |||||
| LFOParams *pars; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,460 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef MasterUI_h | |||||
| #define MasterUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include "WidgetPDial.h" | |||||
| #include "ADnoteUI.h" | |||||
| #include "SUBnoteUI.h" | |||||
| #include "EffUI.h" | |||||
| #include "VirKeyboard.h" | |||||
| #include "ConfigUI.h" | |||||
| #include "BankUI.h" | |||||
| #include "PartUI.h" | |||||
| #include "MicrotonalUI.h" | |||||
| #include "PresetsUI.h" | |||||
| #include "NioUI.h" | |||||
| #include "../Misc/Master.h" | |||||
| #include "../Misc/Part.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "common.H" | |||||
| #if USE_NSM | |||||
| #include "NSM.H" | |||||
| extern NSM_Client *nsm; | |||||
| #endif | |||||
| #include "../globals.h" | |||||
| class VUMeter : public Fl_Box { | |||||
| public: | |||||
| VUMeter(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Master *master_,int part_); | |||||
| void draw_master(); | |||||
| void draw_part(); | |||||
| void draw(); | |||||
| static void tickdraw(VUMeter *o); | |||||
| static void tick(void *v); | |||||
| int handle(int event); | |||||
| private: | |||||
| Master *master; | |||||
| int npart; | |||||
| float olddbl,olddbr; | |||||
| float oldrmsdbl,oldrmsdbr; | |||||
| }; | |||||
| class SysEffSend : public WidgetPDial { | |||||
| public: | |||||
| SysEffSend(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Master *master_,int neff1_,int neff2_); | |||||
| ~SysEffSend(); | |||||
| int handle(int event); | |||||
| private: | |||||
| Master *master; | |||||
| int neff1; | |||||
| int neff2; | |||||
| }; | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| class Panellistitem : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *panellistitem; | |||||
| Fl_Group *panellistitemgroup; | |||||
| public: | |||||
| Fl_Button *partname; | |||||
| private: | |||||
| void cb_partname_i(Fl_Button*, void*); | |||||
| static void cb_partname(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Slider *partvolume; | |||||
| private: | |||||
| void cb_partvolume_i(Fl_Slider*, void*); | |||||
| static void cb_partvolume(Fl_Slider*, void*); | |||||
| public: | |||||
| WidgetPDial *partpanning; | |||||
| private: | |||||
| void cb_partpanning_i(WidgetPDial*, void*); | |||||
| static void cb_partpanning(WidgetPDial*, void*); | |||||
| void cb_edit_i(Fl_Button*, void*); | |||||
| static void cb_edit(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *partrcv; | |||||
| private: | |||||
| void cb_partrcv_i(Fl_Choice*, void*); | |||||
| static void cb_partrcv(Fl_Choice*, void*); | |||||
| Fl_Check_Button *partenabled; | |||||
| void cb_partenabled_i(Fl_Check_Button*, void*); | |||||
| static void cb_partenabled(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Panellistitem(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Master *master_, int npart_,BankUI *bankui_); | |||||
| void refresh(); | |||||
| ~Panellistitem(); | |||||
| private: | |||||
| int npart; | |||||
| Master *master; | |||||
| BankUI *bankui; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Menu_Bar.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Tabs.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Scroll.H> | |||||
| #include <FL/Fl_Pack.H> | |||||
| class MasterUI { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *masterwindow; | |||||
| private: | |||||
| void cb_masterwindow_i(Fl_Double_Window*, void*); | |||||
| static void cb_masterwindow(Fl_Double_Window*, void*); | |||||
| public: | |||||
| Fl_Menu_Bar *mastermenu; | |||||
| static Fl_Menu_Item menu_mastermenu[]; | |||||
| private: | |||||
| void cb_New_i(Fl_Menu_*, void*); | |||||
| static void cb_New(Fl_Menu_*, void*); | |||||
| void cb_Open_i(Fl_Menu_*, void*); | |||||
| static void cb_Open(Fl_Menu_*, void*); | |||||
| void cb_Save_i(Fl_Menu_*, void*); | |||||
| static void cb_Save(Fl_Menu_*, void*); | |||||
| void cb_Load_i(Fl_Menu_*, void*); | |||||
| static void cb_Load(Fl_Menu_*, void*); | |||||
| void cb_Save1_i(Fl_Menu_*, void*); | |||||
| static void cb_Save1(Fl_Menu_*, void*); | |||||
| void cb_Show_i(Fl_Menu_*, void*); | |||||
| static void cb_Show(Fl_Menu_*, void*); | |||||
| void cb_Settings_i(Fl_Menu_*, void*); | |||||
| static void cb_Settings(Fl_Menu_*, void*); | |||||
| void cb_N_i(Fl_Menu_*, void*); | |||||
| static void cb_N(Fl_Menu_*, void*); | |||||
| void cb_Copyright_i(Fl_Menu_*, void*); | |||||
| static void cb_Copyright(Fl_Menu_*, void*); | |||||
| void cb_E_i(Fl_Menu_*, void*); | |||||
| static void cb_E(Fl_Menu_*, void*); | |||||
| void cb_Clear_i(Fl_Menu_*, void*); | |||||
| static void cb_Clear(Fl_Menu_*, void*); | |||||
| void cb_Open1_i(Fl_Menu_*, void*); | |||||
| static void cb_Open1(Fl_Menu_*, void*); | |||||
| void cb_Save2_i(Fl_Menu_*, void*); | |||||
| static void cb_Save2(Fl_Menu_*, void*); | |||||
| void cb_Show1_i(Fl_Menu_*, void*); | |||||
| static void cb_Show1(Fl_Menu_*, void*); | |||||
| void cb_Virtual_i(Fl_Menu_*, void*); | |||||
| static void cb_Virtual(Fl_Menu_*, void*); | |||||
| public: | |||||
| static Fl_Menu_Item *recordmenu; | |||||
| private: | |||||
| void cb_Choose_i(Fl_Menu_*, void*); | |||||
| static void cb_Choose(Fl_Menu_*, void*); | |||||
| void cb_Switch_i(Fl_Menu_*, void*); | |||||
| static void cb_Switch(Fl_Menu_*, void*); | |||||
| public: | |||||
| WidgetPDial *mastervolumedial; | |||||
| private: | |||||
| void cb_mastervolumedial_i(WidgetPDial*, void*); | |||||
| static void cb_mastervolumedial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *masterkeyshiftcounter; | |||||
| private: | |||||
| void cb_masterkeyshiftcounter_i(Fl_Counter*, void*); | |||||
| static void cb_masterkeyshiftcounter(Fl_Counter*, void*); | |||||
| void cb_Panic_i(Fl_Button*, void*); | |||||
| static void cb_Panic(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group *partuigroup; | |||||
| PartUI *partui; | |||||
| Fl_Counter *syseffnocounter; | |||||
| private: | |||||
| void cb_syseffnocounter_i(Fl_Counter*, void*); | |||||
| static void cb_syseffnocounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *sysefftype; | |||||
| private: | |||||
| void cb_sysefftype_i(Fl_Choice*, void*); | |||||
| static void cb_sysefftype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_sysefftype[]; | |||||
| public: | |||||
| Fl_Group *syseffectuigroup; | |||||
| EffUI *syseffectui; | |||||
| private: | |||||
| void cb_Send_i(Fl_Button*, void*); | |||||
| static void cb_Send(Fl_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *inseffnocounter; | |||||
| private: | |||||
| void cb_inseffnocounter_i(Fl_Counter*, void*); | |||||
| static void cb_inseffnocounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *insefftype; | |||||
| private: | |||||
| void cb_insefftype_i(Fl_Choice*, void*); | |||||
| static void cb_insefftype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_insefftype[]; | |||||
| public: | |||||
| Fl_Group *inseffectuigroup; | |||||
| EffUI *inseffectui; | |||||
| Fl_Choice *inseffpart; | |||||
| private: | |||||
| void cb_inseffpart_i(Fl_Choice*, void*); | |||||
| static void cb_inseffpart(Fl_Choice*, void*); | |||||
| void cb_C1_i(Fl_Button*, void*); | |||||
| static void cb_C1(Fl_Button*, void*); | |||||
| void cb_P1_i(Fl_Button*, void*); | |||||
| static void cb_P1(Fl_Button*, void*); | |||||
| void cb_Scales_i(Fl_Button*, void*); | |||||
| static void cb_Scales(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *recordbutton; | |||||
| private: | |||||
| void cb_recordbutton_i(Fl_Button*, void*); | |||||
| static void cb_recordbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *stopbutton; | |||||
| private: | |||||
| void cb_stopbutton_i(Fl_Button*, void*); | |||||
| static void cb_stopbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *pausebutton; | |||||
| private: | |||||
| void cb_pausebutton_i(Fl_Button*, void*); | |||||
| static void cb_pausebutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Box *pauselabel; | |||||
| Fl_Check_Button *nrpnbutton; | |||||
| private: | |||||
| void cb_nrpnbutton_i(Fl_Check_Button*, void*); | |||||
| static void cb_nrpnbutton(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *npartcounter; | |||||
| private: | |||||
| void cb_npartcounter_i(Fl_Counter*, void*); | |||||
| static void cb_npartcounter(Fl_Counter*, void*); | |||||
| void cb_vK_i(Fl_Button*, void*); | |||||
| static void cb_vK(Fl_Button*, void*); | |||||
| void cb_Reset_i(Fl_Button*, void*); | |||||
| static void cb_Reset(Fl_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *globalfinedetuneslider; | |||||
| private: | |||||
| void cb_globalfinedetuneslider_i(WidgetPDial*, void*); | |||||
| static void cb_globalfinedetuneslider(WidgetPDial*, void*); | |||||
| void cb_Panel_i(Fl_Button*, void*); | |||||
| static void cb_Panel(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *sm_indicator1; | |||||
| Fl_Double_Window *aboutwindow; | |||||
| private: | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *syseffsendwindow; | |||||
| private: | |||||
| void cb_Close1_i(Fl_Button*, void*); | |||||
| static void cb_Close1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *panelwindow; | |||||
| private: | |||||
| void cb_Close2_i(Fl_Button*, void*); | |||||
| static void cb_Close2(Fl_Button*, void*); | |||||
| void cb_Refresh_i(Fl_Button*, void*); | |||||
| static void cb_Refresh(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *simplemasterwindow; | |||||
| private: | |||||
| void cb_simplemasterwindow_i(Fl_Double_Window*, void*); | |||||
| static void cb_simplemasterwindow(Fl_Double_Window*, void*); | |||||
| public: | |||||
| Fl_Menu_Bar *simplemastermenu; | |||||
| static Fl_Menu_Item menu_simplemastermenu[]; | |||||
| private: | |||||
| void cb_New1_i(Fl_Menu_*, void*); | |||||
| static void cb_New1(Fl_Menu_*, void*); | |||||
| void cb_Open2_i(Fl_Menu_*, void*); | |||||
| static void cb_Open2(Fl_Menu_*, void*); | |||||
| void cb_Save3_i(Fl_Menu_*, void*); | |||||
| static void cb_Save3(Fl_Menu_*, void*); | |||||
| void cb_Settings1_i(Fl_Menu_*, void*); | |||||
| static void cb_Settings1(Fl_Menu_*, void*); | |||||
| void cb_Copyright1_i(Fl_Menu_*, void*); | |||||
| static void cb_Copyright1(Fl_Menu_*, void*); | |||||
| void cb_E1_i(Fl_Menu_*, void*); | |||||
| static void cb_E1(Fl_Menu_*, void*); | |||||
| void cb_Open3_i(Fl_Menu_*, void*); | |||||
| static void cb_Open3(Fl_Menu_*, void*); | |||||
| void cb_Show2_i(Fl_Menu_*, void*); | |||||
| static void cb_Show2(Fl_Menu_*, void*); | |||||
| void cb_Switch1_i(Fl_Menu_*, void*); | |||||
| static void cb_Switch1(Fl_Menu_*, void*); | |||||
| Fl_Group *simplelistitemgroup; | |||||
| public: | |||||
| Fl_Button *partname; | |||||
| private: | |||||
| void cb_partname1_i(Fl_Button*, void*); | |||||
| static void cb_partname1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Slider *partpanning; | |||||
| private: | |||||
| void cb_partpanning1_i(Fl_Slider*, void*); | |||||
| static void cb_partpanning1(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Choice *partrcv; | |||||
| private: | |||||
| void cb_partrcv1_i(Fl_Choice*, void*); | |||||
| static void cb_partrcv1(Fl_Choice*, void*); | |||||
| public: | |||||
| WidgetPDial *partvolume; | |||||
| private: | |||||
| void cb_partvolume1_i(WidgetPDial*, void*); | |||||
| static void cb_partvolume1(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *simplepartportamento; | |||||
| private: | |||||
| void cb_simplepartportamento_i(Fl_Check_Button*, void*); | |||||
| static void cb_simplepartportamento(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *simpleminkcounter; | |||||
| private: | |||||
| void cb_simpleminkcounter_i(Fl_Counter*, void*); | |||||
| static void cb_simpleminkcounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *simplemaxkcounter; | |||||
| private: | |||||
| void cb_simplemaxkcounter_i(Fl_Counter*, void*); | |||||
| static void cb_simplemaxkcounter(Fl_Counter*, void*); | |||||
| void cb_m_i(Fl_Button*, void*); | |||||
| static void cb_m(Fl_Button*, void*); | |||||
| void cb_M_i(Fl_Button*, void*); | |||||
| static void cb_M(Fl_Button*, void*); | |||||
| void cb_R_i(Fl_Button*, void*); | |||||
| static void cb_R(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *simplepartkeyshiftcounter; | |||||
| private: | |||||
| void cb_simplepartkeyshiftcounter_i(Fl_Counter*, void*); | |||||
| static void cb_simplepartkeyshiftcounter(Fl_Counter*, void*); | |||||
| public: | |||||
| WidgetPDial *simplesyseffsend; | |||||
| private: | |||||
| void cb_simplesyseffsend_i(WidgetPDial*, void*); | |||||
| static void cb_simplesyseffsend(WidgetPDial*, void*); | |||||
| Fl_Check_Button *partenabled; | |||||
| void cb_partenabled1_i(Fl_Check_Button*, void*); | |||||
| static void cb_partenabled1(Fl_Check_Button*, void*); | |||||
| public: | |||||
| VirKeys *virkeys; | |||||
| Fl_Counter *simplesyseffnocounter; | |||||
| private: | |||||
| void cb_simplesyseffnocounter_i(Fl_Counter*, void*); | |||||
| static void cb_simplesyseffnocounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *simplesysefftype; | |||||
| private: | |||||
| void cb_simplesysefftype_i(Fl_Choice*, void*); | |||||
| static void cb_simplesysefftype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_simplesysefftype[]; | |||||
| public: | |||||
| Fl_Group *simplesyseffectuigroup; | |||||
| SimpleEffUI *simplesyseffectui; | |||||
| private: | |||||
| void cb_Send1_i(Fl_Button*, void*); | |||||
| static void cb_Send1(Fl_Button*, void*); | |||||
| void cb_P2_i(Fl_Button*, void*); | |||||
| static void cb_P2(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *simpleinseffnocounter; | |||||
| private: | |||||
| void cb_simpleinseffnocounter_i(Fl_Counter*, void*); | |||||
| static void cb_simpleinseffnocounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *simpleinsefftype; | |||||
| private: | |||||
| void cb_simpleinsefftype_i(Fl_Choice*, void*); | |||||
| static void cb_simpleinsefftype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_simpleinsefftype[]; | |||||
| public: | |||||
| Fl_Group *simpleinseffectuigroup; | |||||
| SimpleEffUI *simpleinseffectui; | |||||
| Fl_Choice *simpleinseffpart; | |||||
| private: | |||||
| void cb_simpleinseffpart_i(Fl_Choice*, void*); | |||||
| static void cb_simpleinseffpart(Fl_Choice*, void*); | |||||
| void cb_P3_i(Fl_Button*, void*); | |||||
| static void cb_P3(Fl_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *simplemastervolumedial; | |||||
| private: | |||||
| void cb_simplemastervolumedial_i(WidgetPDial*, void*); | |||||
| static void cb_simplemastervolumedial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *simplemasterkeyshiftcounter; | |||||
| private: | |||||
| void cb_simplemasterkeyshiftcounter_i(Fl_Counter*, void*); | |||||
| static void cb_simplemasterkeyshiftcounter(Fl_Counter*, void*); | |||||
| void cb_Stop_i(Fl_Button*, void*); | |||||
| static void cb_Stop(Fl_Button*, void*); | |||||
| void cb_Reset1_i(Fl_Button*, void*); | |||||
| static void cb_Reset1(Fl_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *simpleglobalfinedetuneslider; | |||||
| private: | |||||
| void cb_simpleglobalfinedetuneslider_i(WidgetPDial*, void*); | |||||
| static void cb_simpleglobalfinedetuneslider(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *simplenpartcounter; | |||||
| private: | |||||
| void cb_simplenpartcounter_i(Fl_Counter*, void*); | |||||
| static void cb_simplenpartcounter(Fl_Counter*, void*); | |||||
| void cb_Keyb_i(Fl_Counter*, void*); | |||||
| static void cb_Keyb(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Button *sm_indicator2; | |||||
| Fl_Double_Window *selectuiwindow; | |||||
| private: | |||||
| void cb_selectuiwindow_i(Fl_Double_Window*, void*); | |||||
| static void cb_selectuiwindow(Fl_Double_Window*, void*); | |||||
| void cb_Advanced_i(Fl_Button*, void*); | |||||
| static void cb_Advanced(Fl_Button*, void*); | |||||
| void cb_Beginner_i(Fl_Button*, void*); | |||||
| static void cb_Beginner(Fl_Button*, void*); | |||||
| public: | |||||
| void updatesendwindow(); | |||||
| void updatepanel(); | |||||
| void setfilelabel(const char *filename); | |||||
| MasterUI(Master *master_,int *exitprogram_); | |||||
| ~MasterUI(); | |||||
| void showUI(); | |||||
| void simplerefresh(); | |||||
| void do_new_master_unconditional(); | |||||
| void do_new_master(); | |||||
| int do_load_master_unconditional(const char *filename, const char *display_name); | |||||
| void do_load_master(const char* file = NULL); | |||||
| void do_save_master(const char* file = NULL); | |||||
| void refresh_master_ui(); | |||||
| private: | |||||
| Master *master; | |||||
| MicrotonalUI *microtonalui; | |||||
| BankUI *bankui; | |||||
| int ninseff,npart; | |||||
| int nsyseff; | |||||
| int *exitprogram; | |||||
| SysEffSend *syseffsend[NUM_SYS_EFX][NUM_SYS_EFX]; | |||||
| VirKeyboard *virkeyboard; | |||||
| ConfigUI *configui; | |||||
| int swapefftype; | |||||
| char masterwindowlabel[100]; | |||||
| Panellistitem *panellistitem[NUM_MIDI_PARTS]; | |||||
| NioUI nioui; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,463 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/MicrotonalUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| void MicrotonalUI::cb_Invert_i(Fl_Check_Button* o, void*) { | |||||
| microtonal->Pinvertupdown=(int) o->value(); | |||||
| if (microtonal->Pinvertupdown==0) centerinvertcounter->deactivate(); | |||||
| else centerinvertcounter->activate(); | |||||
| } | |||||
| void MicrotonalUI::cb_Invert(Fl_Check_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Invert_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_centerinvertcounter_i(Fl_Counter* o, void*) { | |||||
| microtonal->Pinvertupdowncenter=(int) o->value(); | |||||
| } | |||||
| void MicrotonalUI::cb_centerinvertcounter(Fl_Counter* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_centerinvertcounter_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_applybutton_i(Fl_Button*, void*) { | |||||
| apply(); | |||||
| } | |||||
| void MicrotonalUI::cb_applybutton(Fl_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_applybutton_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_octavesizeoutput_i(Fl_Value_Output* o, void*) { | |||||
| o->value(microtonal->getoctavesize()); | |||||
| } | |||||
| void MicrotonalUI::cb_octavesizeoutput(Fl_Value_Output* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_octavesizeoutput_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_nameinput_i(Fl_Input* o, void*) { | |||||
| snprintf((char *)microtonal->Pname,MICROTONAL_MAX_NAME_LEN,"%s",o->value()); | |||||
| } | |||||
| void MicrotonalUI::cb_nameinput(Fl_Input* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_nameinput_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_commentinput_i(Fl_Input* o, void*) { | |||||
| snprintf((char *)microtonal->Pcomment,MICROTONAL_MAX_NAME_LEN,"%s",o->value()); | |||||
| } | |||||
| void MicrotonalUI::cb_commentinput(Fl_Input* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_commentinput_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_Shift_i(Fl_Counter* o, void*) { | |||||
| microtonal->Pscaleshift=(int) o->value()+64; | |||||
| } | |||||
| void MicrotonalUI::cb_Shift(Fl_Counter* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Shift_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_Import_i(Fl_Button*, void*) { | |||||
| const char *filename; | |||||
| filename=fl_file_chooser("Open:","(*.scl)",NULL,0); | |||||
| if (filename==NULL) return; | |||||
| int result=microtonal->loadscl(filename); | |||||
| if (result==0) { | |||||
| updateTuningsInput(); | |||||
| nameinput->cut(0,nameinput->maximum_size()); | |||||
| nameinput->insert((char *)microtonal->Pname); | |||||
| nameinput->position(0); | |||||
| commentinput->cut(0,commentinput->maximum_size()); | |||||
| commentinput->insert((char *)microtonal->Pname); | |||||
| commentinput->position(0); | |||||
| tuningsinput->position(0); | |||||
| octavesizeoutput->do_callback(); | |||||
| } else { | |||||
| fl_alert("Error: Could not load the file."); | |||||
| }; | |||||
| } | |||||
| void MicrotonalUI::cb_Import(Fl_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Import_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_firstnotecounter_i(Fl_Counter* o, void*) { | |||||
| microtonal->Pfirstkey=(int) o->value(); | |||||
| } | |||||
| void MicrotonalUI::cb_firstnotecounter(Fl_Counter* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_firstnotecounter_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_lastnotecounter_i(Fl_Counter* o, void*) { | |||||
| microtonal->Plastkey=(int) o->value(); | |||||
| } | |||||
| void MicrotonalUI::cb_lastnotecounter(Fl_Counter* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_lastnotecounter_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_middlenotecounter_i(Fl_Counter* o, void*) { | |||||
| microtonal->Pmiddlenote=(int) o->value(); | |||||
| } | |||||
| void MicrotonalUI::cb_middlenotecounter(Fl_Counter* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_middlenotecounter_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_mapsizeoutput_i(Fl_Value_Output* o, void*) { | |||||
| o->value(microtonal->Pmapsize); | |||||
| } | |||||
| void MicrotonalUI::cb_mapsizeoutput(Fl_Value_Output* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->parent()->user_data()))->cb_mapsizeoutput_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_mappingenabledbutton_i(Fl_Check_Button* o, void*) { | |||||
| int x=(int) o->value(); | |||||
| microtonal->Pmappingenabled=x; | |||||
| if (x==0) keymappinggroup->deactivate(); | |||||
| else keymappinggroup->activate(); | |||||
| o->show(); | |||||
| } | |||||
| void MicrotonalUI::cb_mappingenabledbutton(Fl_Check_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_mappingenabledbutton_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_Import1_i(Fl_Button*, void*) { | |||||
| const char *filename; | |||||
| filename=fl_file_chooser("Open:","(*.kbm)",NULL,0); | |||||
| if (filename==NULL) return; | |||||
| int result=microtonal->loadkbm(filename); | |||||
| if (result==0) { | |||||
| updateMappingInput(); | |||||
| mappinginput->position(0); | |||||
| mapsizeoutput->do_callback(); | |||||
| firstnotecounter->value(microtonal->Pfirstkey); | |||||
| lastnotecounter->value(microtonal->Plastkey); | |||||
| middlenotecounter->value(microtonal->Pmiddlenote); | |||||
| mapsizeoutput->do_callback(); | |||||
| mappingenabledbutton->value(microtonal->Pmappingenabled); | |||||
| mappingenabledbutton->do_callback(); | |||||
| afreqinput->value(microtonal->PAfreq); | |||||
| anotecounter->value(microtonal->PAnote); | |||||
| anotecounter->do_callback(); | |||||
| } else { | |||||
| fl_alert("Error: Could not load the file."); | |||||
| }; | |||||
| } | |||||
| void MicrotonalUI::cb_Import1(Fl_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_Import1_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_anotecounter_i(Fl_Counter* o, void*) { | |||||
| microtonal->PAnote=(int) o->value(); | |||||
| if (microtonal->getnotefreq(microtonal->PAnote,0)<0.0) o->textcolor(FL_RED); | |||||
| else o->textcolor(FL_BLACK); | |||||
| o->redraw(); | |||||
| } | |||||
| void MicrotonalUI::cb_anotecounter(Fl_Counter* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_anotecounter_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_afreqinput_i(Fl_Value_Input* o, void*) { | |||||
| microtonal->PAfreq=o->value(); | |||||
| } | |||||
| void MicrotonalUI::cb_afreqinput(Fl_Value_Input* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->parent()->user_data()))->cb_afreqinput_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_Close_i(Fl_Button*, void*) { | |||||
| microtonaluiwindow->hide(); | |||||
| } | |||||
| void MicrotonalUI::cb_Close(Fl_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| void MicrotonalUI::cb_Enable_i(Fl_Check_Button* o, void*) { | |||||
| microtonal->Penabled=(int) o->value(); | |||||
| if (microtonal->Penabled==0) microtonalgroup->deactivate(); | |||||
| else microtonalgroup->activate(); | |||||
| } | |||||
| void MicrotonalUI::cb_Enable(Fl_Check_Button* o, void* v) { | |||||
| ((MicrotonalUI*)(o->parent()->user_data()))->cb_Enable_i(o,v); | |||||
| } | |||||
| Fl_Double_Window* MicrotonalUI::make_window() { | |||||
| { microtonaluiwindow = new Fl_Double_Window(405, 450, "Scales"); | |||||
| microtonaluiwindow->user_data((void*)(this)); | |||||
| { Fl_Group* o = new Fl_Group(249, 2, 155, 45); | |||||
| o->tooltip("Center where the note\'s freqs. are turned upside-down"); | |||||
| o->box(FL_ENGRAVED_FRAME); | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(254, 13, 55, 30, "Invert keys"); | |||||
| o->tooltip("Turn upside-down the note frequencies"); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_Invert); | |||||
| o->align(Fl_Align(132|FL_ALIGN_INSIDE)); | |||||
| o->value(microtonal->Pinvertupdown); | |||||
| } // Fl_Check_Button* o | |||||
| { Fl_Counter* o = centerinvertcounter = new Fl_Counter(319, 13, 80, 20, "Center"); | |||||
| centerinvertcounter->labelfont(1); | |||||
| centerinvertcounter->labelsize(11); | |||||
| centerinvertcounter->minimum(0); | |||||
| centerinvertcounter->maximum(127); | |||||
| centerinvertcounter->step(1); | |||||
| centerinvertcounter->textfont(1); | |||||
| centerinvertcounter->callback((Fl_Callback*)cb_centerinvertcounter); | |||||
| centerinvertcounter->align(Fl_Align(130)); | |||||
| o->lstep(microtonal->getoctavesize()); | |||||
| o->value(microtonal->Pinvertupdowncenter); | |||||
| if (microtonal->Pinvertupdown==0) o->deactivate(); | |||||
| } // Fl_Counter* centerinvertcounter | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = microtonalgroup = new Fl_Group(3, 49, 402, 398); | |||||
| microtonalgroup->box(FL_ENGRAVED_FRAME); | |||||
| { applybutton = new Fl_Button(8, 413, 107, 28, "Retune"); | |||||
| applybutton->tooltip("Retune the synth accorging to the inputs from \"Tunnings\" and \"Keyboard Map\ | |||||
| pings\""); | |||||
| applybutton->box(FL_THIN_UP_BOX); | |||||
| applybutton->labeltype(FL_EMBOSSED_LABEL); | |||||
| applybutton->labelfont(1); | |||||
| applybutton->labelsize(13); | |||||
| applybutton->callback((Fl_Callback*)cb_applybutton); | |||||
| } // Fl_Button* applybutton | |||||
| { Fl_Value_Output* o = octavesizeoutput = new Fl_Value_Output(150, 423, 35, 17, "nts./oct."); | |||||
| octavesizeoutput->tooltip("Notes/Octave"); | |||||
| octavesizeoutput->labelsize(10); | |||||
| octavesizeoutput->maximum(500); | |||||
| octavesizeoutput->step(1); | |||||
| octavesizeoutput->value(12); | |||||
| octavesizeoutput->textfont(1); | |||||
| octavesizeoutput->callback((Fl_Callback*)cb_octavesizeoutput); | |||||
| octavesizeoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(microtonal->getoctavesize()); | |||||
| } // Fl_Value_Output* octavesizeoutput | |||||
| { Fl_Input* o = nameinput = new Fl_Input(8, 64, 285, 25, "Name:"); | |||||
| nameinput->labelfont(1); | |||||
| nameinput->labelsize(11); | |||||
| nameinput->callback((Fl_Callback*)cb_nameinput); | |||||
| nameinput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->insert((char *)microtonal->Pname); | |||||
| } // Fl_Input* nameinput | |||||
| { tuningsinput = new Fl_Input(8, 144, 182, 264, "Tunings:"); | |||||
| tuningsinput->type(4); | |||||
| tuningsinput->labelfont(1); | |||||
| tuningsinput->labelsize(11); | |||||
| tuningsinput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| tuningsinput->when(FL_WHEN_NEVER); | |||||
| updateTuningsInput(); | |||||
| } // Fl_Input* tuningsinput | |||||
| { Fl_Input* o = commentinput = new Fl_Input(8, 104, 391, 25, "Comment:"); | |||||
| commentinput->labelfont(1); | |||||
| commentinput->labelsize(11); | |||||
| commentinput->callback((Fl_Callback*)cb_commentinput); | |||||
| commentinput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->insert((char *)microtonal->Pcomment); | |||||
| } // Fl_Input* commentinput | |||||
| { Fl_Counter* o = new Fl_Counter(313, 69, 70, 20, "Shift"); | |||||
| o->type(1); | |||||
| o->labelsize(11); | |||||
| o->minimum(-63); | |||||
| o->maximum(64); | |||||
| o->step(1); | |||||
| o->textfont(1); | |||||
| o->callback((Fl_Callback*)cb_Shift); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->value(microtonal->Pscaleshift-64); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Button* o = new Fl_Button(243, 411, 84, 15, "Import .SCL file"); | |||||
| o->tooltip("Inport Scala .scl file (tunnings)"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_Import); | |||||
| } // Fl_Button* o | |||||
| { keymappinggroup = new Fl_Group(193, 144, 206, 264, "Keyboard Mapping"); | |||||
| keymappinggroup->box(FL_ENGRAVED_BOX); | |||||
| keymappinggroup->labelfont(1); | |||||
| keymappinggroup->labelsize(11); | |||||
| { mappinginput = new Fl_Input(250, 147, 146, 258); | |||||
| mappinginput->type(4); | |||||
| mappinginput->labelfont(1); | |||||
| mappinginput->labelsize(11); | |||||
| mappinginput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| mappinginput->when(FL_WHEN_NEVER); | |||||
| updateMappingInput(); | |||||
| } // Fl_Input* mappinginput | |||||
| { Fl_Counter* o = firstnotecounter = new Fl_Counter(199, 195, 42, 18, "First note"); | |||||
| firstnotecounter->tooltip("First MIDI note number"); | |||||
| firstnotecounter->type(1); | |||||
| firstnotecounter->labelsize(10); | |||||
| firstnotecounter->minimum(0); | |||||
| firstnotecounter->maximum(127); | |||||
| firstnotecounter->step(1); | |||||
| firstnotecounter->textfont(1); | |||||
| firstnotecounter->textsize(11); | |||||
| firstnotecounter->callback((Fl_Callback*)cb_firstnotecounter); | |||||
| firstnotecounter->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(microtonal->Pfirstkey); | |||||
| } // Fl_Counter* firstnotecounter | |||||
| { Fl_Counter* o = lastnotecounter = new Fl_Counter(199, 225, 42, 18, "Last note"); | |||||
| lastnotecounter->tooltip("Last MIDI note number"); | |||||
| lastnotecounter->type(1); | |||||
| lastnotecounter->labelsize(10); | |||||
| lastnotecounter->minimum(0); | |||||
| lastnotecounter->maximum(127); | |||||
| lastnotecounter->step(1); | |||||
| lastnotecounter->value(127); | |||||
| lastnotecounter->textfont(1); | |||||
| lastnotecounter->textsize(11); | |||||
| lastnotecounter->callback((Fl_Callback*)cb_lastnotecounter); | |||||
| lastnotecounter->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(microtonal->Plastkey); | |||||
| } // Fl_Counter* lastnotecounter | |||||
| { Fl_Counter* o = middlenotecounter = new Fl_Counter(199, 267, 42, 18, "Midle note"); | |||||
| middlenotecounter->tooltip("Midle note (where scale degree 0 is mapped to)"); | |||||
| middlenotecounter->type(1); | |||||
| middlenotecounter->labelsize(10); | |||||
| middlenotecounter->minimum(0); | |||||
| middlenotecounter->maximum(127); | |||||
| middlenotecounter->step(1); | |||||
| middlenotecounter->value(60); | |||||
| middlenotecounter->textfont(1); | |||||
| middlenotecounter->textsize(11); | |||||
| middlenotecounter->callback((Fl_Callback*)cb_middlenotecounter); | |||||
| middlenotecounter->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(microtonal->Pmiddlenote); | |||||
| } // Fl_Counter* middlenotecounter | |||||
| { Fl_Value_Output* o = mapsizeoutput = new Fl_Value_Output(201, 382, 44, 20, "Map Size"); | |||||
| mapsizeoutput->labelsize(10); | |||||
| mapsizeoutput->maximum(500); | |||||
| mapsizeoutput->step(1); | |||||
| mapsizeoutput->value(12); | |||||
| mapsizeoutput->textfont(1); | |||||
| mapsizeoutput->callback((Fl_Callback*)cb_mapsizeoutput); | |||||
| mapsizeoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(microtonal->Pmapsize); | |||||
| } // Fl_Value_Output* mapsizeoutput | |||||
| keymappinggroup->end(); | |||||
| } // Fl_Group* keymappinggroup | |||||
| { Fl_Check_Button* o = mappingenabledbutton = new Fl_Check_Button(198, 150, 48, 21, "ON"); | |||||
| mappingenabledbutton->tooltip("Enable the Mapping (otherwise the mapping is linear)"); | |||||
| mappingenabledbutton->box(FL_FLAT_BOX); | |||||
| mappingenabledbutton->down_box(FL_DOWN_BOX); | |||||
| mappingenabledbutton->labelfont(1); | |||||
| mappingenabledbutton->callback((Fl_Callback*)cb_mappingenabledbutton); | |||||
| o->value(microtonal->Pmappingenabled); | |||||
| if (microtonal->Pmappingenabled==0) keymappinggroup->deactivate(); | |||||
| } // Fl_Check_Button* mappingenabledbutton | |||||
| { Fl_Button* o = new Fl_Button(243, 428, 84, 16, "Import .kbm file"); | |||||
| o->tooltip("Inport Scala .kbm file (keyboard mapping)"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_Import1); | |||||
| } // Fl_Button* o | |||||
| if (microtonal->Penabled==0) o->deactivate(); | |||||
| microtonalgroup->end(); | |||||
| } // Fl_Group* microtonalgroup | |||||
| { Fl_Group* o = new Fl_Group(108, 2, 140, 45); | |||||
| o->box(FL_ENGRAVED_FRAME); | |||||
| { Fl_Counter* o = anotecounter = new Fl_Counter(173, 17, 65, 20, "\"A\" Note"); | |||||
| anotecounter->tooltip("The \"A\" note (the reference note for which freq. (\"A\" freq) is given)"); | |||||
| anotecounter->labelfont(1); | |||||
| anotecounter->labelsize(10); | |||||
| anotecounter->minimum(0); | |||||
| anotecounter->maximum(127); | |||||
| anotecounter->step(1); | |||||
| anotecounter->value(69); | |||||
| anotecounter->textfont(1); | |||||
| anotecounter->textsize(10); | |||||
| anotecounter->callback((Fl_Callback*)cb_anotecounter); | |||||
| anotecounter->align(Fl_Align(129)); | |||||
| o->lstep(12); | |||||
| o->value(microtonal->PAnote); | |||||
| } // Fl_Counter* anotecounter | |||||
| { Fl_Value_Input* o = afreqinput = new Fl_Value_Input(118, 17, 45, 20, "\"A\" Freq."); | |||||
| afreqinput->tooltip("The freq. of \"A\" note (default=440.0)"); | |||||
| afreqinput->labelfont(1); | |||||
| afreqinput->labelsize(10); | |||||
| afreqinput->minimum(1); | |||||
| afreqinput->maximum(20000); | |||||
| afreqinput->step(0.001); | |||||
| afreqinput->value(440); | |||||
| afreqinput->textfont(1); | |||||
| afreqinput->textsize(10); | |||||
| afreqinput->callback((Fl_Callback*)cb_afreqinput); | |||||
| afreqinput->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->value(microtonal->PAfreq); | |||||
| } // Fl_Value_Input* afreqinput | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Button* o = new Fl_Button(333, 413, 67, 28, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| { Fl_Check_Button* o = new Fl_Check_Button(3, 3, 102, 45, "Enable Microtonal"); | |||||
| o->box(FL_UP_BOX); | |||||
| o->down_box(FL_DOWN_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_Enable); | |||||
| o->align(Fl_Align(132|FL_ALIGN_INSIDE)); | |||||
| o->value(microtonal->Penabled); | |||||
| } // Fl_Check_Button* o | |||||
| microtonaluiwindow->end(); | |||||
| } // Fl_Double_Window* microtonaluiwindow | |||||
| return microtonaluiwindow; | |||||
| } | |||||
| void MicrotonalUI::updateTuningsInput() { | |||||
| char *tmpbuf=new char[100]; | |||||
| tuningsinput->cut(0,tuningsinput->maximum_size()); | |||||
| for (int i=0;i<microtonal->getoctavesize();i++){ | |||||
| if (i!=0) tuningsinput->insert("\n"); | |||||
| microtonal->tuningtoline(i,tmpbuf,100); | |||||
| tuningsinput->insert(tmpbuf); | |||||
| }; | |||||
| delete []tmpbuf; | |||||
| } | |||||
| void MicrotonalUI::updateMappingInput() { | |||||
| char *tmpbuf=new char[100]; | |||||
| mappinginput->cut(0,tuningsinput->maximum_size()); | |||||
| for (int i=0;i<microtonal->Pmapsize;i++){ | |||||
| if (i!=0) mappinginput->insert("\n"); | |||||
| if ((microtonal->Pmapping[i])==-1) | |||||
| snprintf(tmpbuf,100,"x"); | |||||
| else snprintf(tmpbuf,100,"%d",microtonal->Pmapping[i]); | |||||
| mappinginput->insert(tmpbuf); | |||||
| }; | |||||
| delete []tmpbuf; | |||||
| } | |||||
| MicrotonalUI::MicrotonalUI(Microtonal *microtonal_) { | |||||
| microtonal=microtonal_; | |||||
| make_window(); | |||||
| } | |||||
| MicrotonalUI::~MicrotonalUI() { | |||||
| microtonaluiwindow->hide(); | |||||
| delete(microtonaluiwindow); | |||||
| } | |||||
| void MicrotonalUI::show() { | |||||
| microtonaluiwindow->show(); | |||||
| } | |||||
| void MicrotonalUI::apply() { | |||||
| int err=microtonal->texttotunings(tuningsinput->value()); | |||||
| if (err>=0) fl_alert("Parse Error: The input may contain only numbers (like 232.59)\n or divisions (like 121/64)."); | |||||
| if (err==-2) fl_alert("Parse Error: The input is empty."); | |||||
| octavesizeoutput->do_callback(); | |||||
| microtonal->texttomapping(mappinginput->value()); | |||||
| mapsizeoutput->do_callback(); | |||||
| anotecounter->do_callback(); | |||||
| //applybutton->color(FL_GRAY); | |||||
| } | |||||
| @@ -0,0 +1,112 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef MicrotonalUI_h | |||||
| #define MicrotonalUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include <FL/Fl_File_Chooser.H> | |||||
| #include <FL/fl_ask.H> | |||||
| #include "../Misc/Microtonal.h" | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include <FL/Fl_Input.H> | |||||
| #include <FL/Fl_Value_Input.H> | |||||
| class MicrotonalUI { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *microtonaluiwindow; | |||||
| private: | |||||
| void cb_Invert_i(Fl_Check_Button*, void*); | |||||
| static void cb_Invert(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *centerinvertcounter; | |||||
| private: | |||||
| void cb_centerinvertcounter_i(Fl_Counter*, void*); | |||||
| static void cb_centerinvertcounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Group *microtonalgroup; | |||||
| Fl_Button *applybutton; | |||||
| private: | |||||
| void cb_applybutton_i(Fl_Button*, void*); | |||||
| static void cb_applybutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Value_Output *octavesizeoutput; | |||||
| private: | |||||
| void cb_octavesizeoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_octavesizeoutput(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Input *nameinput; | |||||
| private: | |||||
| void cb_nameinput_i(Fl_Input*, void*); | |||||
| static void cb_nameinput(Fl_Input*, void*); | |||||
| public: | |||||
| Fl_Input *tuningsinput; | |||||
| Fl_Input *commentinput; | |||||
| private: | |||||
| void cb_commentinput_i(Fl_Input*, void*); | |||||
| static void cb_commentinput(Fl_Input*, void*); | |||||
| void cb_Shift_i(Fl_Counter*, void*); | |||||
| static void cb_Shift(Fl_Counter*, void*); | |||||
| void cb_Import_i(Fl_Button*, void*); | |||||
| static void cb_Import(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group *keymappinggroup; | |||||
| Fl_Input *mappinginput; | |||||
| Fl_Counter *firstnotecounter; | |||||
| private: | |||||
| void cb_firstnotecounter_i(Fl_Counter*, void*); | |||||
| static void cb_firstnotecounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *lastnotecounter; | |||||
| private: | |||||
| void cb_lastnotecounter_i(Fl_Counter*, void*); | |||||
| static void cb_lastnotecounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *middlenotecounter; | |||||
| private: | |||||
| void cb_middlenotecounter_i(Fl_Counter*, void*); | |||||
| static void cb_middlenotecounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Value_Output *mapsizeoutput; | |||||
| private: | |||||
| void cb_mapsizeoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_mapsizeoutput(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Check_Button *mappingenabledbutton; | |||||
| private: | |||||
| void cb_mappingenabledbutton_i(Fl_Check_Button*, void*); | |||||
| static void cb_mappingenabledbutton(Fl_Check_Button*, void*); | |||||
| void cb_Import1_i(Fl_Button*, void*); | |||||
| static void cb_Import1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *anotecounter; | |||||
| private: | |||||
| void cb_anotecounter_i(Fl_Counter*, void*); | |||||
| static void cb_anotecounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Value_Input *afreqinput; | |||||
| private: | |||||
| void cb_afreqinput_i(Fl_Value_Input*, void*); | |||||
| static void cb_afreqinput(Fl_Value_Input*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_Enable_i(Fl_Check_Button*, void*); | |||||
| static void cb_Enable(Fl_Check_Button*, void*); | |||||
| public: | |||||
| void updateTuningsInput(); | |||||
| void updateMappingInput(); | |||||
| MicrotonalUI(Microtonal *microtonal_); | |||||
| ~MicrotonalUI(); | |||||
| void show(); | |||||
| void apply(); | |||||
| private: | |||||
| Microtonal *microtonal; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,282 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef OscilGenUI_h | |||||
| #define OscilGenUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include "../Synth/OscilGen.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "../Misc/Master.h" | |||||
| #include "ResonanceUI.h" | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include "WidgetPDial.h" | |||||
| #include "EnvelopeUI.h" | |||||
| #include "LFOUI.h" | |||||
| #include "FilterUI.h" | |||||
| #include "PresetsUI.h" | |||||
| #include <FL/fl_draw.H> | |||||
| class OscilSpectrum : public Fl_Box { | |||||
| public: | |||||
| OscilSpectrum(int x,int y, int w, int h, const char *label=0); | |||||
| void init(OscilGen *oscil_,int oscbase_,Master *master_); | |||||
| void draw(); | |||||
| private: | |||||
| OscilGen *oscil; | |||||
| int oscbase; | |||||
| Master *master; | |||||
| }; | |||||
| class PSlider : public Fl_Slider { | |||||
| public: | |||||
| PSlider(int x,int y, int w, int h, const char *label=0); | |||||
| int handle(int event); | |||||
| }; | |||||
| class Oscilloscope : public Fl_Box { | |||||
| public: | |||||
| Oscilloscope(int x,int y, int w, int h, const char *label=0); | |||||
| void init(OscilGen *oscil_,Master *master_); | |||||
| void init(OscilGen *oscil_,int oscbase_,Master *master_); | |||||
| void init(OscilGen *oscil_,int oscbase_,int phase_,Master *master_); | |||||
| void draw(); | |||||
| private: | |||||
| OscilGen *oscil; | |||||
| int oscbase; | |||||
| public: | |||||
| int phase; | |||||
| private: | |||||
| Master *master; | |||||
| }; | |||||
| #include <FL/Fl_Box.H> | |||||
| class Oscilharmonic : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *harmonic; | |||||
| public: | |||||
| PSlider *mag; | |||||
| private: | |||||
| void cb_mag_i(PSlider*, void*); | |||||
| static void cb_mag(PSlider*, void*); | |||||
| public: | |||||
| PSlider *phase; | |||||
| private: | |||||
| void cb_phase_i(PSlider*, void*); | |||||
| static void cb_phase(PSlider*, void*); | |||||
| public: | |||||
| Oscilharmonic(int x,int y, int w, int h, const char *label=0); | |||||
| void init(OscilGen *oscil_,int n_,Fl_Group *display_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *applybutton_, Master *master_); | |||||
| void refresh(); | |||||
| ~Oscilharmonic(); | |||||
| private: | |||||
| OscilGen *oscil; | |||||
| Fl_Group *display; | |||||
| int n; | |||||
| Fl_Widget *oldosc,*cbwidget,*applybutton; | |||||
| Master *master; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Value_Slider.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include <FL/Fl_Light_Button.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include <FL/Fl_Scroll.H> | |||||
| #include <FL/Fl_Pack.H> | |||||
| class OscilEditor : public PresetsUI_ { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *osceditUI; | |||||
| Fl_Button *applybutton; | |||||
| private: | |||||
| void cb_applybutton_i(Fl_Button*, void*); | |||||
| static void cb_applybutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group *oscildisplaygroup; | |||||
| Fl_Value_Slider *rndslider; | |||||
| private: | |||||
| void cb_rndslider_i(Fl_Value_Slider*, void*); | |||||
| static void cb_rndslider(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Choice *hrndtype; | |||||
| private: | |||||
| void cb_hrndtype_i(Fl_Choice*, void*); | |||||
| static void cb_hrndtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_hrndtype[]; | |||||
| public: | |||||
| WidgetPDial *hrnddial; | |||||
| private: | |||||
| void cb_hrnddial_i(WidgetPDial*, void*); | |||||
| static void cb_hrnddial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Group *basefuncdisplaygroup; | |||||
| WidgetPDial *bfslider; | |||||
| private: | |||||
| void cb_bfslider_i(WidgetPDial*, void*); | |||||
| static void cb_bfslider(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *bftype; | |||||
| private: | |||||
| void cb_bftype_i(Fl_Choice*, void*); | |||||
| static void cb_bftype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_bftype[]; | |||||
| public: | |||||
| Fl_Value_Output *bfparval; | |||||
| Fl_Group *basefuncmodulation; | |||||
| Fl_Choice *bfmodtype; | |||||
| private: | |||||
| void cb_bfmodtype_i(Fl_Choice*, void*); | |||||
| static void cb_bfmodtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_bfmodtype[]; | |||||
| public: | |||||
| WidgetPDial *bfmodpar1; | |||||
| private: | |||||
| void cb_bfmodpar1_i(WidgetPDial*, void*); | |||||
| static void cb_bfmodpar1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *bfmodpar2; | |||||
| private: | |||||
| void cb_bfmodpar2_i(WidgetPDial*, void*); | |||||
| static void cb_bfmodpar2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *bfmodpar3; | |||||
| private: | |||||
| void cb_bfmodpar3_i(WidgetPDial*, void*); | |||||
| static void cb_bfmodpar3(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *magtype; | |||||
| private: | |||||
| void cb_magtype_i(Fl_Choice*, void*); | |||||
| static void cb_magtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_magtype[]; | |||||
| void cb_Use_i(Fl_Button*, void*); | |||||
| static void cb_Use(Fl_Button*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_Clear_i(Fl_Button*, void*); | |||||
| static void cb_Clear(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *wshbutton; | |||||
| private: | |||||
| void cb_wshbutton_i(Fl_Choice*, void*); | |||||
| static void cb_wshbutton(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_wshbutton[]; | |||||
| public: | |||||
| WidgetPDial *wshpar; | |||||
| private: | |||||
| void cb_wshpar_i(WidgetPDial*, void*); | |||||
| static void cb_wshpar(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Value_Output *wsparval; | |||||
| Fl_Light_Button *autoclearbutton; | |||||
| Fl_Choice *fltbutton; | |||||
| private: | |||||
| void cb_fltbutton_i(Fl_Choice*, void*); | |||||
| static void cb_fltbutton(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_fltbutton[]; | |||||
| public: | |||||
| WidgetPDial *filtervalue1; | |||||
| private: | |||||
| void cb_filtervalue1_i(WidgetPDial*, void*); | |||||
| static void cb_filtervalue1(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *filterpref; | |||||
| private: | |||||
| void cb_filterpref_i(Fl_Check_Button*, void*); | |||||
| static void cb_filterpref(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *filtervalue2; | |||||
| private: | |||||
| void cb_filtervalue2_i(WidgetPDial*, void*); | |||||
| static void cb_filtervalue2(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *sabutton; | |||||
| private: | |||||
| void cb_sabutton_i(Fl_Choice*, void*); | |||||
| static void cb_sabutton(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_sabutton[]; | |||||
| public: | |||||
| WidgetPDial *sadjpar; | |||||
| private: | |||||
| void cb_sadjpar_i(WidgetPDial*, void*); | |||||
| static void cb_sadjpar(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Counter *harmonicshiftcounter; | |||||
| private: | |||||
| void cb_harmonicshiftcounter_i(Fl_Counter*, void*); | |||||
| static void cb_harmonicshiftcounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Check_Button *harmonicshiftpre; | |||||
| private: | |||||
| void cb_harmonicshiftpre_i(Fl_Check_Button*, void*); | |||||
| static void cb_harmonicshiftpre(Fl_Check_Button*, void*); | |||||
| void cb_R_i(Fl_Button*, void*); | |||||
| static void cb_R(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *adhrtype; | |||||
| private: | |||||
| void cb_adhrtype_i(Fl_Choice*, void*); | |||||
| static void cb_adhrtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_adhrtype[]; | |||||
| public: | |||||
| WidgetPDial *adhrpow; | |||||
| private: | |||||
| void cb_adhrpow_i(WidgetPDial*, void*); | |||||
| static void cb_adhrpow(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *adhrbf; | |||||
| private: | |||||
| void cb_adhrbf_i(WidgetPDial*, void*); | |||||
| static void cb_adhrbf(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Slider *adhrpar; | |||||
| private: | |||||
| void cb_adhrpar_i(Fl_Slider*, void*); | |||||
| static void cb_adhrpar(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Choice *modtype; | |||||
| private: | |||||
| void cb_modtype_i(Fl_Choice*, void*); | |||||
| static void cb_modtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_modtype[]; | |||||
| public: | |||||
| WidgetPDial *modpar1; | |||||
| private: | |||||
| void cb_modpar1_i(WidgetPDial*, void*); | |||||
| static void cb_modpar1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *modpar2; | |||||
| private: | |||||
| void cb_modpar2_i(WidgetPDial*, void*); | |||||
| static void cb_modpar2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *modpar3; | |||||
| private: | |||||
| void cb_modpar3_i(WidgetPDial*, void*); | |||||
| static void cb_modpar3(WidgetPDial*, void*); | |||||
| void cb_Sine_i(Fl_Button*, void*); | |||||
| static void cb_Sine(Fl_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Scroll *_this_has_to_be_the_last; | |||||
| Fl_Pack *harmonics; | |||||
| OscilEditor(OscilGen *oscil_,Fl_Widget *oldosc_,Fl_Widget *cbwidget_,Fl_Widget *cbapplywidget_,Master *master_); | |||||
| ~OscilEditor(); | |||||
| void refresh(); | |||||
| void redrawoscil(); | |||||
| private: | |||||
| OscilGen *oscil; | |||||
| Fl_Widget *oldosc,*cbwidget,*cbapplywidget; | |||||
| Oscilharmonic *h[MAX_AD_HARMONICS]; | |||||
| Master *master; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,305 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef PADnoteUI_h | |||||
| #define PADnoteUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include "../Params/PADnoteParameters.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "../Misc/Master.h" | |||||
| #include "ResonanceUI.h" | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_File_Chooser.H> | |||||
| #include "WidgetPDial.h" | |||||
| #include "EnvelopeUI.h" | |||||
| #include "LFOUI.h" | |||||
| #include "FilterUI.h" | |||||
| #include "OscilGenUI.h" | |||||
| #include "PresetsUI.h" | |||||
| class PADnoteHarmonicProfile : public Fl_Box { | |||||
| public: | |||||
| PADnoteHarmonicProfile(int x,int y, int w, int h, const char *label=0); | |||||
| void init(PADnoteParameters *pars,Master *master_); | |||||
| void draw(); | |||||
| private: | |||||
| Master *master; | |||||
| public: | |||||
| PADnoteParameters *pars; | |||||
| }; | |||||
| class PADnoteOvertonePosition : public Fl_Box { | |||||
| public: | |||||
| PADnoteOvertonePosition(int x,int y, int w, int h, const char *label=0); | |||||
| void init(PADnoteParameters *pars,Master *master_); | |||||
| void draw(); | |||||
| private: | |||||
| Master *master; | |||||
| public: | |||||
| PADnoteParameters *pars; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Tabs.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include <FL/Fl_Value_Slider.H> | |||||
| class PADnoteUI : public PresetsUI_ { | |||||
| public: | |||||
| PADnoteUI(PADnoteParameters *parameters,Master *master_); | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *padnotewindow; | |||||
| private: | |||||
| void cb__i(Fl_Tabs*, void*); | |||||
| static void cb_(Fl_Tabs*, void*); | |||||
| public: | |||||
| Fl_Group *harmonicstructuregroup; | |||||
| Fl_Group *bwprofilegroup; | |||||
| WidgetPDial *hpbasepar1; | |||||
| private: | |||||
| void cb_hpbasepar1_i(WidgetPDial*, void*); | |||||
| static void cb_hpbasepar1(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *hpbasetype; | |||||
| private: | |||||
| void cb_hpbasetype_i(Fl_Choice*, void*); | |||||
| static void cb_hpbasetype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_hpbasetype[]; | |||||
| public: | |||||
| WidgetPDial *hpfreqmult; | |||||
| private: | |||||
| void cb_hpfreqmult_i(WidgetPDial*, void*); | |||||
| static void cb_hpfreqmult(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *hpmpar1; | |||||
| private: | |||||
| void cb_hpmpar1_i(WidgetPDial*, void*); | |||||
| static void cb_hpmpar1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *hpmfreq; | |||||
| private: | |||||
| void cb_hpmfreq_i(WidgetPDial*, void*); | |||||
| static void cb_hpmfreq(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *hpamptype; | |||||
| private: | |||||
| void cb_hpamptype_i(Fl_Choice*, void*); | |||||
| static void cb_hpamptype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_hpamptype[]; | |||||
| public: | |||||
| Fl_Choice *hpampmode; | |||||
| private: | |||||
| void cb_hpampmode_i(Fl_Choice*, void*); | |||||
| static void cb_hpampmode(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_hpampmode[]; | |||||
| public: | |||||
| WidgetPDial *hpamppar1; | |||||
| private: | |||||
| void cb_hpamppar1_i(WidgetPDial*, void*); | |||||
| static void cb_hpamppar1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *hpamppar2; | |||||
| private: | |||||
| void cb_hpamppar2_i(WidgetPDial*, void*); | |||||
| static void cb_hpamppar2(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Check_Button *hpautoscale; | |||||
| private: | |||||
| void cb_hpautoscale_i(Fl_Check_Button*, void*); | |||||
| static void cb_hpautoscale(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *hponehalf; | |||||
| private: | |||||
| void cb_hponehalf_i(Fl_Choice*, void*); | |||||
| static void cb_hponehalf(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_hponehalf[]; | |||||
| public: | |||||
| WidgetPDial *hpwidth; | |||||
| private: | |||||
| void cb_hpwidth_i(WidgetPDial*, void*); | |||||
| static void cb_hpwidth(WidgetPDial*, void*); | |||||
| void cb_Change_i(Fl_Button*, void*); | |||||
| static void cb_Change(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Box *cbwidget; | |||||
| private: | |||||
| void cb_cbwidget_i(Fl_Box*, void*); | |||||
| static void cb_cbwidget(Fl_Box*, void*); | |||||
| void cb_Resonance_i(Fl_Button*, void*); | |||||
| static void cb_Resonance(Fl_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *bwdial; | |||||
| private: | |||||
| void cb_bwdial_i(WidgetPDial*, void*); | |||||
| static void cb_bwdial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Value_Output *bwcents; | |||||
| Fl_Choice *hrpostype; | |||||
| private: | |||||
| void cb_hrpostype_i(Fl_Choice*, void*); | |||||
| static void cb_hrpostype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_hrpostype[]; | |||||
| public: | |||||
| WidgetPDial *hrpospar1; | |||||
| private: | |||||
| void cb_hrpospar1_i(WidgetPDial*, void*); | |||||
| static void cb_hrpospar1(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *hrpospar2; | |||||
| private: | |||||
| void cb_hrpospar2_i(WidgetPDial*, void*); | |||||
| static void cb_hrpospar2(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *hrpospar3; | |||||
| private: | |||||
| void cb_hrpospar3_i(WidgetPDial*, void*); | |||||
| static void cb_hrpospar3(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *bwscale; | |||||
| private: | |||||
| void cb_bwscale_i(Fl_Choice*, void*); | |||||
| static void cb_bwscale(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_bwscale[]; | |||||
| public: | |||||
| Fl_Group *overtonepos; | |||||
| Fl_Choice *qsamplesize; | |||||
| private: | |||||
| void cb_qsamplesize_i(Fl_Choice*, void*); | |||||
| static void cb_qsamplesize(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_qsamplesize[]; | |||||
| public: | |||||
| Fl_Choice *qsmpoct; | |||||
| private: | |||||
| void cb_qsmpoct_i(Fl_Choice*, void*); | |||||
| static void cb_qsmpoct(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_qsmpoct[]; | |||||
| public: | |||||
| Fl_Choice *qoct; | |||||
| private: | |||||
| void cb_qoct_i(Fl_Choice*, void*); | |||||
| static void cb_qoct(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_qoct[]; | |||||
| public: | |||||
| Fl_Choice *qbasenote; | |||||
| private: | |||||
| void cb_qbasenote_i(Fl_Choice*, void*); | |||||
| static void cb_qbasenote(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_qbasenote[]; | |||||
| public: | |||||
| Fl_Group *hprofile; | |||||
| Fl_Choice *spectrummode; | |||||
| private: | |||||
| void cb_spectrummode_i(Fl_Choice*, void*); | |||||
| static void cb_spectrummode(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_spectrummode[]; | |||||
| public: | |||||
| EnvelopeUI *freqenv; | |||||
| Fl_Counter *octave; | |||||
| private: | |||||
| void cb_octave_i(Fl_Counter*, void*); | |||||
| static void cb_octave(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *coarsedet; | |||||
| private: | |||||
| void cb_coarsedet_i(Fl_Counter*, void*); | |||||
| static void cb_coarsedet(Fl_Counter*, void*); | |||||
| public: | |||||
| LFOUI *freqlfo; | |||||
| Fl_Slider *detune; | |||||
| private: | |||||
| void cb_detune_i(Fl_Slider*, void*); | |||||
| static void cb_detune(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Output *detunevalueoutput; | |||||
| private: | |||||
| void cb_detunevalueoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_detunevalueoutput(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Choice *detunetype; | |||||
| private: | |||||
| void cb_detunetype_i(Fl_Choice*, void*); | |||||
| static void cb_detunetype(Fl_Choice*, void*); | |||||
| public: | |||||
| Fl_Check_Button *hz440; | |||||
| private: | |||||
| void cb_hz440_i(Fl_Check_Button*, void*); | |||||
| static void cb_hz440(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *fixedfreqetdial; | |||||
| private: | |||||
| void cb_fixedfreqetdial_i(WidgetPDial*, void*); | |||||
| static void cb_fixedfreqetdial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *volume; | |||||
| private: | |||||
| void cb_volume_i(Fl_Value_Slider*, void*); | |||||
| static void cb_volume(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *vsns; | |||||
| private: | |||||
| void cb_vsns_i(Fl_Value_Slider*, void*); | |||||
| static void cb_vsns(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| WidgetPDial *pan; | |||||
| private: | |||||
| void cb_pan_i(WidgetPDial*, void*); | |||||
| static void cb_pan(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pstr; | |||||
| private: | |||||
| void cb_pstr_i(WidgetPDial*, void*); | |||||
| static void cb_pstr(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pt; | |||||
| private: | |||||
| void cb_pt_i(WidgetPDial*, void*); | |||||
| static void cb_pt(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pstc; | |||||
| private: | |||||
| void cb_pstc_i(WidgetPDial*, void*); | |||||
| static void cb_pstc(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *pvel; | |||||
| private: | |||||
| void cb_pvel_i(WidgetPDial*, void*); | |||||
| static void cb_pvel(WidgetPDial*, void*); | |||||
| public: | |||||
| EnvelopeUI *ampenv; | |||||
| LFOUI *amplfo; | |||||
| Fl_Check_Button *stereo; | |||||
| private: | |||||
| void cb_stereo_i(Fl_Check_Button*, void*); | |||||
| static void cb_stereo(Fl_Check_Button*, void*); | |||||
| public: | |||||
| EnvelopeUI *filterenv; | |||||
| LFOUI *filterlfo; | |||||
| FilterUI *filterui; | |||||
| Fl_Button *applybutton; | |||||
| private: | |||||
| void cb_applybutton_i(Fl_Button*, void*); | |||||
| static void cb_applybutton(Fl_Button*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| void cb_export_i(Fl_Button*, void*); | |||||
| static void cb_export(Fl_Button*, void*); | |||||
| public: | |||||
| void refresh(); | |||||
| ~PADnoteUI(); | |||||
| PADnoteParameters *pars; | |||||
| Master *master; | |||||
| OscilEditor *oscui; | |||||
| Oscilloscope *osc; | |||||
| ResonanceUI *resui; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,333 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef PartUI_h | |||||
| #define PartUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include "WidgetPDial.h" | |||||
| #include "EffUI.h" | |||||
| #include "BankUI.h" | |||||
| #include "ADnoteUI.h" | |||||
| #include "SUBnoteUI.h" | |||||
| #include "PADnoteUI.h" | |||||
| #include "../Misc/Config.h" | |||||
| #include "../Misc/Master.h" | |||||
| #include "../Misc/Part.h" | |||||
| class PartSysEffSend : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *syseffsend; | |||||
| void cb_01_i(WidgetPDial*, void*); | |||||
| static void cb_01(WidgetPDial*, void*); | |||||
| public: | |||||
| PartSysEffSend(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Master *master_,int npart_,int neff_); | |||||
| ~PartSysEffSend(); | |||||
| private: | |||||
| Master *master; | |||||
| int neff; | |||||
| int npart; | |||||
| }; | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| class PartKitItem : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *partkititem; | |||||
| Fl_Group *partkititemgroup; | |||||
| public: | |||||
| Fl_Counter *minkcounter; | |||||
| private: | |||||
| void cb_minkcounter_i(Fl_Counter*, void*); | |||||
| static void cb_minkcounter(Fl_Counter*, void*); | |||||
| void cb_m_i(Fl_Button*, void*); | |||||
| static void cb_m(Fl_Button*, void*); | |||||
| void cb_M_i(Fl_Button*, void*); | |||||
| static void cb_M(Fl_Button*, void*); | |||||
| void cb_R_i(Fl_Button*, void*); | |||||
| static void cb_R(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *adeditbutton; | |||||
| private: | |||||
| void cb_adeditbutton_i(Fl_Button*, void*); | |||||
| static void cb_adeditbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *subeditbutton; | |||||
| private: | |||||
| void cb_subeditbutton_i(Fl_Button*, void*); | |||||
| static void cb_subeditbutton(Fl_Button*, void*); | |||||
| Fl_Check_Button *mutedcheck; | |||||
| void cb_mutedcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_mutedcheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *maxkcounter; | |||||
| private: | |||||
| void cb_maxkcounter_i(Fl_Counter*, void*); | |||||
| static void cb_maxkcounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Button *labelbutton; | |||||
| private: | |||||
| void cb_labelbutton_i(Fl_Button*, void*); | |||||
| static void cb_labelbutton(Fl_Button*, void*); | |||||
| Fl_Check_Button *adcheck; | |||||
| void cb_adcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_adcheck(Fl_Check_Button*, void*); | |||||
| Fl_Check_Button *subcheck; | |||||
| void cb_subcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_subcheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *sendtoeffect; | |||||
| private: | |||||
| void cb_sendtoeffect_i(Fl_Choice*, void*); | |||||
| static void cb_sendtoeffect(Fl_Choice*, void*); | |||||
| public: | |||||
| Fl_Button *padeditbutton; | |||||
| private: | |||||
| void cb_padeditbutton_i(Fl_Button*, void*); | |||||
| static void cb_padeditbutton(Fl_Button*, void*); | |||||
| Fl_Check_Button *padcheck; | |||||
| void cb_padcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_padcheck(Fl_Check_Button*, void*); | |||||
| Fl_Check_Button *enabledcheck; | |||||
| void cb_enabledcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_enabledcheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| PartKitItem(int x,int y, int w, int h, const char *label=0); | |||||
| void refresh(); | |||||
| void init(Part *part_,int n_,Master *master_,class PartUI *partui_); | |||||
| ~PartKitItem(); | |||||
| private: | |||||
| Part *part; | |||||
| int n; | |||||
| Master *master; | |||||
| char label[10]; | |||||
| class PartUI *partui; | |||||
| }; | |||||
| #include <FL/Fl_Scroll.H> | |||||
| #include <FL/Fl_Pack.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Input.H> | |||||
| class PartUI : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| Fl_Group *partgroup; | |||||
| public: | |||||
| Fl_Group *partgroupui; | |||||
| private: | |||||
| void cb_Pan_i(WidgetPDial*, void*); | |||||
| static void cb_Pan(WidgetPDial*, void*); | |||||
| void cb_KeyShift_i(Fl_Counter*, void*); | |||||
| static void cb_KeyShift(Fl_Counter*, void*); | |||||
| void cb_Grand_i(Fl_Button*, void*); | |||||
| static void cb_Grand(Fl_Button*, void*); | |||||
| void cb_NoteOn_i(Fl_Check_Button*, void*); | |||||
| static void cb_NoteOn(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *minkcounter; | |||||
| private: | |||||
| void cb_minkcounter1_i(Fl_Counter*, void*); | |||||
| static void cb_minkcounter1(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *maxkcounter; | |||||
| private: | |||||
| void cb_maxkcounter1_i(Fl_Counter*, void*); | |||||
| static void cb_maxkcounter1(Fl_Counter*, void*); | |||||
| void cb_Volume_i(WidgetPDial*, void*); | |||||
| static void cb_Volume(WidgetPDial*, void*); | |||||
| void cb_Vel_i(WidgetPDial*, void*); | |||||
| static void cb_Vel(WidgetPDial*, void*); | |||||
| void cb_Vel1_i(WidgetPDial*, void*); | |||||
| static void cb_Vel1(WidgetPDial*, void*); | |||||
| void cb_Controllers_i(Fl_Button*, void*); | |||||
| static void cb_Controllers(Fl_Button*, void*); | |||||
| void cb_Portamento_i(Fl_Check_Button*, void*); | |||||
| static void cb_Portamento(Fl_Check_Button*, void*); | |||||
| void cb_Edit_i(Fl_Button*, void*); | |||||
| static void cb_Edit(Fl_Button*, void*); | |||||
| void cb_m1_i(Fl_Button*, void*); | |||||
| static void cb_m1(Fl_Button*, void*); | |||||
| void cb_M1_i(Fl_Button*, void*); | |||||
| static void cb_M1(Fl_Button*, void*); | |||||
| void cb_R1_i(Fl_Button*, void*); | |||||
| static void cb_R1(Fl_Button*, void*); | |||||
| void cb_MIDI_i(Fl_Choice*, void*); | |||||
| static void cb_MIDI(Fl_Choice*, void*); | |||||
| public: | |||||
| Fl_Choice *keylimitlist; | |||||
| private: | |||||
| void cb_keylimitlist_i(Fl_Choice*, void*); | |||||
| static void cb_keylimitlist(Fl_Choice*, void*); | |||||
| void cb_Mode_i(Fl_Choice*, void*); | |||||
| static void cb_Mode(Fl_Choice*, void*); | |||||
| void cb_Enabled_i(Fl_Check_Button*, void*); | |||||
| static void cb_Enabled(Fl_Check_Button*, void*); | |||||
| Fl_Double_Window *ctlwindow; | |||||
| void cb_Expr_i(Fl_Check_Button*, void*); | |||||
| static void cb_Expr(Fl_Check_Button*, void*); | |||||
| void cb_PanDpth_i(WidgetPDial*, void*); | |||||
| static void cb_PanDpth(WidgetPDial*, void*); | |||||
| void cb_FltCut_i(WidgetPDial*, void*); | |||||
| static void cb_FltCut(WidgetPDial*, void*); | |||||
| void cb_FltQ_i(WidgetPDial*, void*); | |||||
| static void cb_FltQ(WidgetPDial*, void*); | |||||
| void cb_BwDpth_i(WidgetPDial*, void*); | |||||
| static void cb_BwDpth(WidgetPDial*, void*); | |||||
| void cb_ModWh_i(WidgetPDial*, void*); | |||||
| static void cb_ModWh(WidgetPDial*, void*); | |||||
| void cb_PWheelB_i(Fl_Counter*, void*); | |||||
| static void cb_PWheelB(Fl_Counter*, void*); | |||||
| void cb_FMamp_i(Fl_Check_Button*, void*); | |||||
| static void cb_FMamp(Fl_Check_Button*, void*); | |||||
| void cb_Vol_i(Fl_Check_Button*, void*); | |||||
| static void cb_Vol(Fl_Check_Button*, void*); | |||||
| void cb_Sustain_i(Fl_Check_Button*, void*); | |||||
| static void cb_Sustain(Fl_Check_Button*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_Reset_i(Fl_Button*, void*); | |||||
| static void cb_Reset(Fl_Button*, void*); | |||||
| void cb_Rcv_i(Fl_Check_Button*, void*); | |||||
| static void cb_Rcv(Fl_Check_Button*, void*); | |||||
| void cb_time_i(WidgetPDial*, void*); | |||||
| static void cb_time(WidgetPDial*, void*); | |||||
| void cb_thresh_i(Fl_Counter*, void*); | |||||
| static void cb_thresh(Fl_Counter*, void*); | |||||
| void cb_th_i(Fl_Check_Button*, void*); | |||||
| static void cb_th(Fl_Check_Button*, void*); | |||||
| void cb_t_i(WidgetPDial*, void*); | |||||
| static void cb_t(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *propta; | |||||
| private: | |||||
| void cb_propta_i(WidgetPDial*, void*); | |||||
| static void cb_propta(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *proptb; | |||||
| private: | |||||
| void cb_proptb_i(WidgetPDial*, void*); | |||||
| static void cb_proptb(WidgetPDial*, void*); | |||||
| void cb_Proprt_i(Fl_Check_Button*, void*); | |||||
| static void cb_Proprt(Fl_Check_Button*, void*); | |||||
| void cb_BWdpth_i(WidgetPDial*, void*); | |||||
| static void cb_BWdpth(WidgetPDial*, void*); | |||||
| void cb_CFdpth_i(WidgetPDial*, void*); | |||||
| static void cb_CFdpth(WidgetPDial*, void*); | |||||
| void cb_Exp_i(Fl_Check_Button*, void*); | |||||
| static void cb_Exp(Fl_Check_Button*, void*); | |||||
| void cb_Exp1_i(Fl_Check_Button*, void*); | |||||
| static void cb_Exp1(Fl_Check_Button*, void*); | |||||
| Fl_Double_Window *partfx; | |||||
| public: | |||||
| Fl_Counter *inseffnocounter; | |||||
| private: | |||||
| void cb_inseffnocounter_i(Fl_Counter*, void*); | |||||
| static void cb_inseffnocounter(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *insefftype; | |||||
| private: | |||||
| void cb_insefftype_i(Fl_Choice*, void*); | |||||
| static void cb_insefftype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_insefftype[]; | |||||
| public: | |||||
| Fl_Group *inseffectuigroup; | |||||
| EffUI *inseffectui; | |||||
| private: | |||||
| void cb_Close1_i(Fl_Button*, void*); | |||||
| static void cb_Close1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Choice *sendtochoice; | |||||
| private: | |||||
| void cb_sendtochoice_i(Fl_Choice*, void*); | |||||
| static void cb_sendtochoice(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_sendtochoice[]; | |||||
| public: | |||||
| Fl_Check_Button *bypasseff; | |||||
| private: | |||||
| void cb_bypasseff_i(Fl_Check_Button*, void*); | |||||
| static void cb_bypasseff(Fl_Check_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *instrumentkitlist; | |||||
| private: | |||||
| void cb_Close2_i(Fl_Button*, void*); | |||||
| static void cb_Close2(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Scroll *kitlist; | |||||
| private: | |||||
| void cb_Mode1_i(Fl_Choice*, void*); | |||||
| static void cb_Mode1(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_Mode[]; | |||||
| void cb_Drum_i(Fl_Check_Button*, void*); | |||||
| static void cb_Drum(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Double_Window *instrumenteditwindow; | |||||
| Fl_Button *padeditbutton; | |||||
| private: | |||||
| void cb_padeditbutton1_i(Fl_Button*, void*); | |||||
| static void cb_padeditbutton1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *padsynenabledcheck; | |||||
| private: | |||||
| void cb_padsynenabledcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_padsynenabledcheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *adsynenabledcheck; | |||||
| private: | |||||
| void cb_adsynenabledcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_adsynenabledcheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Button *adeditbutton; | |||||
| private: | |||||
| void cb_adeditbutton1_i(Fl_Button*, void*); | |||||
| static void cb_adeditbutton1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *subsynenabledcheck; | |||||
| private: | |||||
| void cb_subsynenabledcheck_i(Fl_Check_Button*, void*); | |||||
| static void cb_subsynenabledcheck(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Button *subeditbutton; | |||||
| private: | |||||
| void cb_subeditbutton1_i(Fl_Button*, void*); | |||||
| static void cb_subeditbutton1(Fl_Button*, void*); | |||||
| void cb_Kit_i(Fl_Button*, void*); | |||||
| static void cb_Kit(Fl_Button*, void*); | |||||
| void cb_Effects_i(Fl_Button*, void*); | |||||
| static void cb_Effects(Fl_Button*, void*); | |||||
| void cb_Author_i(Fl_Input*, void*); | |||||
| static void cb_Author(Fl_Input*, void*); | |||||
| void cb_Comments_i(Fl_Input*, void*); | |||||
| static void cb_Comments(Fl_Input*, void*); | |||||
| void cb_Type_i(Fl_Choice*, void*); | |||||
| static void cb_Type(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_Type[]; | |||||
| void cb_Close3_i(Fl_Button*, void*); | |||||
| static void cb_Close3(Fl_Button*, void*); | |||||
| public: | |||||
| PartUI(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Part *part_,Master *master_,int npart_,BankUI *bankui_); | |||||
| void showparameters(int kititem,int engine); | |||||
| ~PartUI(); | |||||
| private: | |||||
| Part *part; | |||||
| Master *master; | |||||
| BankUI *bankui; | |||||
| ADnoteUI *adnoteui; | |||||
| SUBnoteUI *subnoteui; | |||||
| PADnoteUI *padnoteui; | |||||
| PartSysEffSend *psyef[NUM_SYS_EFX]; | |||||
| int npart; | |||||
| int ninseff; | |||||
| int lastkititem; | |||||
| PartKitItem *partkititem[NUM_KIT_ITEMS]; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,274 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/PresetsUI.h" | |||||
| #include "../Params/PresetsArray.h" | |||||
| void PresetsUI_::refresh() { | |||||
| ; | |||||
| } | |||||
| PresetsUI_::~PresetsUI_() { | |||||
| ; | |||||
| } | |||||
| void PresetsUI::cb_copybrowse_i(Fl_Browser* o, void*) { | |||||
| int val=o->value(); | |||||
| if (val!=0){ | |||||
| presetname->cut(0,presetname->maximum_size()); | |||||
| presetname->insert(o->text(val)); | |||||
| }; | |||||
| } | |||||
| void PresetsUI::cb_copybrowse(Fl_Browser* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_copybrowse_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_copypbutton_i(Fl_Button*, void*) { | |||||
| const char *tmp=presetname->value(); | |||||
| if (tmp!=NULL) { | |||||
| if (strlen(tmp)>0){ | |||||
| p->copy(tmp); | |||||
| copywin->hide(); | |||||
| }; | |||||
| }; | |||||
| } | |||||
| void PresetsUI::cb_copypbutton(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_copypbutton_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_copybutton_i(Fl_Button*, void*) { | |||||
| p->copy(NULL); | |||||
| copywin->hide(); | |||||
| } | |||||
| void PresetsUI::cb_copybutton(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_copybutton_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_Cancel_i(Fl_Button*, void*) { | |||||
| copywin->hide(); | |||||
| } | |||||
| void PresetsUI::cb_Cancel(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_Cancel_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_presetname_i(Fl_Input* o, void*) { | |||||
| const char *tmp=o->value(); | |||||
| if (tmp==NULL) tmp=""; | |||||
| if (strlen(tmp)>0) { | |||||
| copybutton->deactivate(); | |||||
| copypbutton->activate(); | |||||
| } else { | |||||
| copybutton->activate(); | |||||
| copypbutton->deactivate(); | |||||
| }; | |||||
| } | |||||
| void PresetsUI::cb_presetname(Fl_Input* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_presetname_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_pastebrowse_i(Fl_Browser* o, void*) { | |||||
| if (o->value()==0) { | |||||
| pastepbutton->deactivate(); | |||||
| deletepbutton->deactivate(); | |||||
| }else{ | |||||
| pastepbutton->activate(); | |||||
| deletepbutton->activate(); | |||||
| }; | |||||
| } | |||||
| void PresetsUI::cb_pastebrowse(Fl_Browser* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_pastebrowse_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_pastepbutton_i(Fl_Button*, void*) { | |||||
| int n=pastebrowse->value(); | |||||
| if (n!=0) p->paste(n); | |||||
| pastewin->hide(); | |||||
| pui->refresh(); | |||||
| } | |||||
| void PresetsUI::cb_pastepbutton(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_pastepbutton_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_pastebutton_i(Fl_Button*, void*) { | |||||
| p->paste(0); | |||||
| pastewin->hide(); | |||||
| pui->refresh(); | |||||
| } | |||||
| void PresetsUI::cb_pastebutton(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_pastebutton_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_Cancel1_i(Fl_Button*, void*) { | |||||
| pastewin->hide(); | |||||
| } | |||||
| void PresetsUI::cb_Cancel1(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_Cancel1_i(o,v); | |||||
| } | |||||
| void PresetsUI::cb_deletepbutton_i(Fl_Button*, void*) { | |||||
| int n=pastebrowse->value(); | |||||
| if (n!=0) p->deletepreset(n); | |||||
| rescan(); | |||||
| } | |||||
| void PresetsUI::cb_deletepbutton(Fl_Button* o, void* v) { | |||||
| ((PresetsUI*)(o->parent()->user_data()))->cb_deletepbutton_i(o,v); | |||||
| } | |||||
| PresetsUI::PresetsUI() { | |||||
| p=NULL; | |||||
| make_window(); | |||||
| } | |||||
| PresetsUI::~PresetsUI() { | |||||
| copywin->hide();delete(copywin); | |||||
| pastewin->hide();delete(pastewin); | |||||
| } | |||||
| Fl_Double_Window* PresetsUI::make_window() { | |||||
| { copywin = new Fl_Double_Window(265, 430, "Copy to Clipboard/Preset"); | |||||
| copywin->box(FL_THIN_UP_BOX); | |||||
| copywin->color((Fl_Color)238); | |||||
| copywin->user_data((void*)(this)); | |||||
| { copybrowse = new Fl_Browser(10, 25, 245, 320); | |||||
| copybrowse->type(1); | |||||
| copybrowse->callback((Fl_Callback*)cb_copybrowse); | |||||
| } // Fl_Browser* copybrowse | |||||
| { copypbutton = new Fl_Button(145, 355, 110, 20, "Copy to Preset"); | |||||
| copypbutton->box(FL_THIN_UP_BOX); | |||||
| copypbutton->callback((Fl_Callback*)cb_copypbutton); | |||||
| } // Fl_Button* copypbutton | |||||
| { copybutton = new Fl_Button(25, 385, 90, 35, "Copy to Clipboard"); | |||||
| copybutton->box(FL_THIN_UP_BOX); | |||||
| copybutton->callback((Fl_Callback*)cb_copybutton); | |||||
| copybutton->align(Fl_Align(192)); | |||||
| } // Fl_Button* copybutton | |||||
| { Fl_Button* o = new Fl_Button(160, 385, 80, 35, "Cancel"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Cancel); | |||||
| o->align(Fl_Align(192)); | |||||
| } // Fl_Button* o | |||||
| { Fl_Box* o = new Fl_Box(10, 5, 40, 15, "Type:"); | |||||
| o->labelsize(11); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); | |||||
| } // Fl_Box* o | |||||
| { copytypetext = new Fl_Box(50, 5, 205, 15); | |||||
| copytypetext->box(FL_FLAT_BOX); | |||||
| copytypetext->color((Fl_Color)238); | |||||
| copytypetext->labelfont(1); | |||||
| copytypetext->labelsize(11); | |||||
| copytypetext->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); | |||||
| } // Fl_Box* copytypetext | |||||
| { presetname = new Fl_Input(10, 355, 130, 20); | |||||
| presetname->callback((Fl_Callback*)cb_presetname); | |||||
| presetname->when(FL_WHEN_CHANGED); | |||||
| } // Fl_Input* presetname | |||||
| copywin->set_modal(); | |||||
| copywin->end(); | |||||
| } // Fl_Double_Window* copywin | |||||
| { pastewin = new Fl_Double_Window(265, 430, "Paste from Clipboard/Preset"); | |||||
| pastewin->box(FL_THIN_UP_BOX); | |||||
| pastewin->color((Fl_Color)238); | |||||
| pastewin->user_data((void*)(this)); | |||||
| { pastebrowse = new Fl_Browser(10, 25, 245, 320); | |||||
| pastebrowse->type(2); | |||||
| pastebrowse->callback((Fl_Callback*)cb_pastebrowse); | |||||
| } // Fl_Browser* pastebrowse | |||||
| { pastepbutton = new Fl_Button(10, 355, 160, 20, "Paste from Preset"); | |||||
| pastepbutton->box(FL_THIN_UP_BOX); | |||||
| pastepbutton->callback((Fl_Callback*)cb_pastepbutton); | |||||
| } // Fl_Button* pastepbutton | |||||
| { pastebutton = new Fl_Button(25, 385, 90, 35, "Paste from Clipboard"); | |||||
| pastebutton->box(FL_THIN_UP_BOX); | |||||
| pastebutton->callback((Fl_Callback*)cb_pastebutton); | |||||
| pastebutton->align(Fl_Align(192)); | |||||
| } // Fl_Button* pastebutton | |||||
| { Fl_Button* o = new Fl_Button(160, 385, 80, 35, "Cancel"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Cancel1); | |||||
| o->align(Fl_Align(192)); | |||||
| } // Fl_Button* o | |||||
| { pastetypetext = new Fl_Box(55, 5, 200, 15); | |||||
| pastetypetext->box(FL_FLAT_BOX); | |||||
| pastetypetext->color((Fl_Color)238); | |||||
| pastetypetext->labelfont(1); | |||||
| pastetypetext->labelsize(11); | |||||
| pastetypetext->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); | |||||
| } // Fl_Box* pastetypetext | |||||
| { Fl_Box* o = new Fl_Box(15, 5, 40, 15, "Type:"); | |||||
| o->labelsize(11); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); | |||||
| } // Fl_Box* o | |||||
| { deletepbutton = new Fl_Button(180, 355, 75, 20, "Delete"); | |||||
| deletepbutton->box(FL_THIN_UP_BOX); | |||||
| deletepbutton->callback((Fl_Callback*)cb_deletepbutton); | |||||
| } // Fl_Button* deletepbutton | |||||
| pastewin->set_modal(); | |||||
| pastewin->end(); | |||||
| } // Fl_Double_Window* pastewin | |||||
| return pastewin; | |||||
| } | |||||
| void PresetsUI::copy(Presets *p) { | |||||
| copybutton->activate(); | |||||
| copypbutton->deactivate(); | |||||
| this->p=p; | |||||
| this->pui=NULL; | |||||
| bool but=(Fl::event_button()!=FL_LEFT_MOUSE); | |||||
| presetname->cut(0,presetname->maximum_size()); | |||||
| if (but) p->copy(NULL); | |||||
| else { | |||||
| rescan(); | |||||
| copytypetext->label(&p->type[1]); | |||||
| copywin->show(); | |||||
| }; | |||||
| } | |||||
| void PresetsUI::paste(Presets *p,PresetsUI_ *pui) { | |||||
| this->p=p; | |||||
| this->pui=pui; | |||||
| bool but=(Fl::event_button()!=FL_LEFT_MOUSE); | |||||
| pastepbutton->deactivate(); | |||||
| deletepbutton->deactivate(); | |||||
| if (but) { | |||||
| p->paste(0); | |||||
| pui->refresh(); | |||||
| } else { | |||||
| rescan(); | |||||
| pastetypetext->label(&p->type[1]); | |||||
| if (p->checkclipboardtype()) pastebutton->activate(); | |||||
| else pastebutton->deactivate(); | |||||
| pastewin->show(); | |||||
| }; | |||||
| } | |||||
| void PresetsUI::copy(Presets *p,int n) { | |||||
| PresetsArray *pre = dynamic_cast<PresetsArray *>(p); | |||||
| if(pre) | |||||
| pre->setelement(n); | |||||
| copy(p); | |||||
| } | |||||
| void PresetsUI::paste(Presets *p,PresetsUI_ *pui,int n) { | |||||
| PresetsArray *pre = dynamic_cast<PresetsArray *>(p); | |||||
| if(pre) | |||||
| pre->setelement(n); | |||||
| paste(p,pui); | |||||
| } | |||||
| void PresetsUI::rescan() { | |||||
| copybrowse->clear(); | |||||
| pastebrowse->clear(); | |||||
| p->rescanforpresets(); | |||||
| for (unsigned int i=0;i<presetsstore.presets.size();i++){ | |||||
| std::string name=presetsstore.presets[i].name; | |||||
| if(name.empty()) | |||||
| continue; | |||||
| copybrowse->add(name.c_str()); | |||||
| pastebrowse->add(name.c_str()); | |||||
| }; | |||||
| } | |||||
| PresetsUI *presetsui; | |||||
| @@ -0,0 +1,84 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef PresetsUI_h | |||||
| #define PresetsUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <FL/fl_ask.H> | |||||
| #include <stdio.h> | |||||
| #include <stdlib.h> | |||||
| #include "../Params/Presets.h" | |||||
| class PresetsUI_ { | |||||
| public: | |||||
| virtual void refresh(); | |||||
| virtual ~PresetsUI_(); | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Browser.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/Fl_Input.H> | |||||
| class PresetsUI { | |||||
| public: | |||||
| PresetsUI(); | |||||
| ~PresetsUI(); | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *copywin; | |||||
| Fl_Browser *copybrowse; | |||||
| private: | |||||
| void cb_copybrowse_i(Fl_Browser*, void*); | |||||
| static void cb_copybrowse(Fl_Browser*, void*); | |||||
| public: | |||||
| Fl_Button *copypbutton; | |||||
| private: | |||||
| void cb_copypbutton_i(Fl_Button*, void*); | |||||
| static void cb_copypbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *copybutton; | |||||
| private: | |||||
| void cb_copybutton_i(Fl_Button*, void*); | |||||
| static void cb_copybutton(Fl_Button*, void*); | |||||
| void cb_Cancel_i(Fl_Button*, void*); | |||||
| static void cb_Cancel(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Box *copytypetext; | |||||
| Fl_Input *presetname; | |||||
| private: | |||||
| void cb_presetname_i(Fl_Input*, void*); | |||||
| static void cb_presetname(Fl_Input*, void*); | |||||
| public: | |||||
| Fl_Double_Window *pastewin; | |||||
| Fl_Browser *pastebrowse; | |||||
| private: | |||||
| void cb_pastebrowse_i(Fl_Browser*, void*); | |||||
| static void cb_pastebrowse(Fl_Browser*, void*); | |||||
| public: | |||||
| Fl_Button *pastepbutton; | |||||
| private: | |||||
| void cb_pastepbutton_i(Fl_Button*, void*); | |||||
| static void cb_pastepbutton(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *pastebutton; | |||||
| private: | |||||
| void cb_pastebutton_i(Fl_Button*, void*); | |||||
| static void cb_pastebutton(Fl_Button*, void*); | |||||
| void cb_Cancel1_i(Fl_Button*, void*); | |||||
| static void cb_Cancel1(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Box *pastetypetext; | |||||
| Fl_Button *deletepbutton; | |||||
| private: | |||||
| void cb_deletepbutton_i(Fl_Button*, void*); | |||||
| static void cb_deletepbutton(Fl_Button*, void*); | |||||
| public: | |||||
| void copy(Presets *p); | |||||
| void paste(Presets *p,PresetsUI_ *pui); | |||||
| void copy(Presets *p,int n); | |||||
| void paste(Presets *p,PresetsUI_ *pui,int n); | |||||
| void rescan(); | |||||
| Presets *p; | |||||
| PresetsUI_ *pui; | |||||
| }; | |||||
| extern PresetsUI *presetsui; | |||||
| #endif | |||||
| @@ -0,0 +1,556 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/ResonanceUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| #include <math.h> | |||||
| #include <stdio.h> | |||||
| #include <stdlib.h> | |||||
| #include <string.h> | |||||
| ResonanceGraph::ResonanceGraph(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { | |||||
| respar=NULL; | |||||
| cbwidget=NULL; | |||||
| applybutton=NULL; | |||||
| } | |||||
| void ResonanceGraph::init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_) { | |||||
| respar=respar_; | |||||
| khzvalue=khzvalue_; | |||||
| dbvalue=dbvalue_; | |||||
| oldx=-1; | |||||
| khzval=-1; | |||||
| } | |||||
| void ResonanceGraph::draw_freq_line(float freq,int type) { | |||||
| float freqx=respar->getfreqpos(freq); | |||||
| switch(type){ | |||||
| case 0:fl_line_style(FL_SOLID);break; | |||||
| case 1:fl_line_style(FL_DOT);break; | |||||
| case 2:fl_line_style(FL_DASH);break; | |||||
| }; | |||||
| if ((freqx>0.0)&&(freqx<1.0)) | |||||
| fl_line(x()+(int) (freqx*w()),y(), | |||||
| x()+(int) (freqx*w()),y()+h()); | |||||
| } | |||||
| void ResonanceGraph::draw() { | |||||
| int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; | |||||
| float freqx; | |||||
| fl_color(FL_DARK1); | |||||
| fl_rectf(ox,oy,lx,ly); | |||||
| //draw the lines | |||||
| fl_color(FL_GRAY); | |||||
| fl_line_style(FL_SOLID); | |||||
| fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); | |||||
| freqx=respar->getfreqpos(1000.0); | |||||
| if ((freqx>0.0)&&(freqx<1.0)) | |||||
| fl_line(ox+(int) (freqx*lx),oy, | |||||
| ox+(int) (freqx*lx),oy+ly); | |||||
| for (i=1;i<10;i++){ | |||||
| if(i==1){ | |||||
| draw_freq_line(i*100.0,0); | |||||
| draw_freq_line(i*1000.0,0); | |||||
| }else | |||||
| if (i==5){ | |||||
| draw_freq_line(i*100.0,2); | |||||
| draw_freq_line(i*1000.0,2); | |||||
| }else{ | |||||
| draw_freq_line(i*100.0,1); | |||||
| draw_freq_line(i*1000.0,1); | |||||
| }; | |||||
| }; | |||||
| draw_freq_line(10000.0,0); | |||||
| draw_freq_line(20000.0,1); | |||||
| fl_line_style(FL_DOT); | |||||
| int GY=10;if (ly<GY*3) GY=-1; | |||||
| for (i=1;i<GY;i++){ | |||||
| int tmp=(int)(ly/(float)GY*i); | |||||
| fl_line(ox+2,oy+tmp,ox+lx-2,oy+tmp); | |||||
| }; | |||||
| //draw the data | |||||
| fl_color(FL_RED); | |||||
| fl_line_style(FL_SOLID,2); | |||||
| fl_begin_line(); | |||||
| oiy=(int)(respar->Prespoints[0]/128.0*ly); | |||||
| for (i=1;i<N_RES_POINTS;i++){ | |||||
| ix=(int)(i*1.0/N_RES_POINTS*lx); | |||||
| iy=(respar->Prespoints[i]/128.0*ly); | |||||
| fl_vertex(ox+ix,oy+ly-oiy); | |||||
| oiy=iy; | |||||
| }; | |||||
| fl_end_line(); | |||||
| fl_line_style(FL_SOLID,0); | |||||
| } | |||||
| int ResonanceGraph::handle(int event) { | |||||
| int x_=Fl::event_x()-x(); | |||||
| int y_=Fl::event_y()-y(); | |||||
| if ( (x_>=0)&&(x_<w()) && (y_>=0)&&(y_<h())){ | |||||
| khzvalue->value(respar->getfreqx(x_*1.0/w())/1000.0); | |||||
| dbvalue->value((1.0-y_*2.0/h())*respar->PmaxdB); | |||||
| }; | |||||
| if ((event==FL_PUSH)||(event==FL_DRAG)){ | |||||
| int leftbutton=1; | |||||
| if (Fl::event_button()==FL_RIGHT_MOUSE) leftbutton=0; | |||||
| if (x_<0) x_=0;if (y_<0) y_=0; | |||||
| if (x_>=w()) x_=w();if (y_>=h()-1) y_=h()-1; | |||||
| if ((oldx<0)||(oldx==x_)){ | |||||
| int sn=(int)(x_*1.0/w()*N_RES_POINTS); | |||||
| int sp=127-(int)(y_*1.0/h()*127); | |||||
| if (leftbutton!=0) respar->setpoint(sn,sp); | |||||
| else respar->setpoint(sn,64); | |||||
| } else { | |||||
| int x1=oldx; | |||||
| int x2=x_; | |||||
| int y1=oldy; | |||||
| int y2=y_; | |||||
| if (oldx>x_){ | |||||
| x1=x_;y1=y_; | |||||
| x2=oldx;y2=oldy; | |||||
| }; | |||||
| for (int i=0;i<x2-x1;i++){ | |||||
| int sn=(int)((i+x1)*1.0/w()*N_RES_POINTS); | |||||
| float yy=(y2-y1)*1.0/(x2-x1)*i; | |||||
| int sp=127-(int)((y1+yy)/h()*127); | |||||
| if (leftbutton!=0) respar->setpoint(sn,sp); | |||||
| else respar->setpoint(sn,64); | |||||
| }; | |||||
| }; | |||||
| oldx=x_;oldy=y_; | |||||
| redraw(); | |||||
| }; | |||||
| if (event==FL_RELEASE) { | |||||
| oldx=-1; | |||||
| if (cbwidget!=NULL) { | |||||
| cbwidget->do_callback(); | |||||
| if (applybutton!=NULL) { | |||||
| applybutton->color(FL_RED); | |||||
| applybutton->redraw(); | |||||
| }; | |||||
| }; | |||||
| }; | |||||
| return(1); | |||||
| } | |||||
| void ResonanceGraph::setcbwidget(Fl_Widget *cbwidget,Fl_Widget *applybutton) { | |||||
| this->cbwidget=cbwidget; | |||||
| this->applybutton=applybutton; | |||||
| } | |||||
| void ResonanceUI::cb_Close_i(Fl_Button*, void*) { | |||||
| resonancewindow->hide(); | |||||
| } | |||||
| void ResonanceUI::cb_Close(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_Zero_i(Fl_Button*, void*) { | |||||
| for (int i=0;i<N_RES_POINTS;i++) | |||||
| respar->setpoint(i,64); | |||||
| resonancewindow->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_Zero(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_Zero_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_Smooth_i(Fl_Button*, void*) { | |||||
| respar->smooth(); | |||||
| resonancewindow->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_Smooth(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_Smooth_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_enabled_i(Fl_Check_Button* o, void*) { | |||||
| respar->Penabled=(int) o->value(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_enabled(Fl_Check_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_enabled_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_maxdb_i(Fl_Roller* o, void*) { | |||||
| maxdbvo->value(o->value()); | |||||
| respar->PmaxdB=(int) o->value(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_maxdb(Fl_Roller* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_maxdb_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_maxdbvo_i(Fl_Value_Output* o, void*) { | |||||
| o->value(respar->PmaxdB); | |||||
| } | |||||
| void ResonanceUI::cb_maxdbvo(Fl_Value_Output* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_maxdbvo_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_centerfreqvo_i(Fl_Value_Output* o, void*) { | |||||
| o->value(respar->getcenterfreq()/1000.0); | |||||
| } | |||||
| void ResonanceUI::cb_centerfreqvo(Fl_Value_Output* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_centerfreqvo_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_octavesfreqvo_i(Fl_Value_Output* o, void*) { | |||||
| o->value(respar->getoctavesfreq()); | |||||
| } | |||||
| void ResonanceUI::cb_octavesfreqvo(Fl_Value_Output* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_octavesfreqvo_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_RND2_i(Fl_Button*, void*) { | |||||
| respar->randomize(1); | |||||
| resonancewindow->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_RND2(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_RND2_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_RND1_i(Fl_Button*, void*) { | |||||
| respar->randomize(0); | |||||
| resonancewindow->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_RND1(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_RND1_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_RND3_i(Fl_Button*, void*) { | |||||
| respar->randomize(2); | |||||
| resonancewindow->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_RND3(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_RND3_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_p1st_i(Fl_Check_Button* o, void*) { | |||||
| respar->Pprotectthefundamental=(int) o->value(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_p1st(Fl_Check_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_p1st_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_InterpP_i(Fl_Button*, void*) { | |||||
| int type; | |||||
| if (Fl::event_button()==FL_LEFT_MOUSE) type=0; | |||||
| else type=1; | |||||
| respar->interpolatepeaks(type); | |||||
| resonancewindow->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_InterpP(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_InterpP_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_centerfreq_i(WidgetPDial* o, void*) { | |||||
| respar->Pcenterfreq=(int)o->value(); | |||||
| centerfreqvo->do_callback(); | |||||
| rg->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_centerfreq(WidgetPDial* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_centerfreq_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_octavesfreq_i(WidgetPDial* o, void*) { | |||||
| respar->Poctavesfreq=(int)o->value(); | |||||
| octavesfreqvo->do_callback(); | |||||
| rg->redraw(); | |||||
| redrawPADnoteApply(); | |||||
| } | |||||
| void ResonanceUI::cb_octavesfreq(WidgetPDial* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_octavesfreq_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_C_i(Fl_Button*, void*) { | |||||
| presetsui->copy(respar); | |||||
| } | |||||
| void ResonanceUI::cb_C(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_C_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_P_i(Fl_Button*, void*) { | |||||
| presetsui->paste(respar,this); | |||||
| } | |||||
| void ResonanceUI::cb_P(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_P_i(o,v); | |||||
| } | |||||
| void ResonanceUI::cb_applybutton_i(Fl_Button*, void*) { | |||||
| applybutton->color(FL_GRAY); | |||||
| applybutton->redraw(); | |||||
| if (cbapplywidget!=NULL) { | |||||
| cbapplywidget->do_callback(); | |||||
| cbapplywidget->color(FL_GRAY); | |||||
| cbapplywidget->redraw(); | |||||
| }; | |||||
| } | |||||
| void ResonanceUI::cb_applybutton(Fl_Button* o, void* v) { | |||||
| ((ResonanceUI*)(o->parent()->user_data()))->cb_applybutton_i(o,v); | |||||
| } | |||||
| Fl_Double_Window* ResonanceUI::make_window() { | |||||
| { resonancewindow = new Fl_Double_Window(780, 305, "Resonance"); | |||||
| resonancewindow->user_data((void*)(this)); | |||||
| { khzvalue = new Fl_Value_Output(415, 264, 45, 18, "kHz"); | |||||
| khzvalue->labelsize(12); | |||||
| khzvalue->minimum(0.001); | |||||
| khzvalue->maximum(48); | |||||
| khzvalue->step(0.01); | |||||
| khzvalue->textfont(1); | |||||
| khzvalue->textsize(12); | |||||
| khzvalue->align(Fl_Align(FL_ALIGN_RIGHT)); | |||||
| //this widget must be before the calling widgets | |||||
| } // Fl_Value_Output* khzvalue | |||||
| { dbvalue = new Fl_Value_Output(415, 282, 45, 18, "dB"); | |||||
| dbvalue->labelsize(12); | |||||
| dbvalue->minimum(-150); | |||||
| dbvalue->maximum(150); | |||||
| dbvalue->step(0.1); | |||||
| dbvalue->textfont(1); | |||||
| dbvalue->textsize(12); | |||||
| dbvalue->align(Fl_Align(FL_ALIGN_RIGHT)); | |||||
| //this widget must be before the calling widgets | |||||
| } // Fl_Value_Output* dbvalue | |||||
| { Fl_Group* o = new Fl_Group(6, 5, 768, 256); | |||||
| o->box(FL_BORDER_BOX); | |||||
| rg=new ResonanceGraph(o->x(),o->y(),o->w(),o->h(),""); | |||||
| rg->init(respar,khzvalue,dbvalue); | |||||
| rg->show(); | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Button* o = new Fl_Button(690, 283, 84, 17, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(491, 264, 66, 15, "Zero"); | |||||
| o->tooltip("Clear the resonance function"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(12); | |||||
| o->callback((Fl_Callback*)cb_Zero); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(491, 282, 66, 18, "Smooth"); | |||||
| o->tooltip("Smooth the resonance function"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(12); | |||||
| o->callback((Fl_Callback*)cb_Smooth); | |||||
| } // Fl_Button* o | |||||
| { Fl_Check_Button* o = enabled = new Fl_Check_Button(6, 270, 78, 27, "Enable"); | |||||
| enabled->box(FL_THIN_UP_BOX); | |||||
| enabled->down_box(FL_DOWN_BOX); | |||||
| enabled->callback((Fl_Callback*)cb_enabled); | |||||
| o->value(respar->Penabled); | |||||
| } // Fl_Check_Button* enabled | |||||
| { maxdb = new Fl_Roller(90, 282, 84, 15); | |||||
| maxdb->type(1); | |||||
| maxdb->minimum(1); | |||||
| maxdb->maximum(90); | |||||
| maxdb->step(1); | |||||
| maxdb->value(30); | |||||
| maxdb->callback((Fl_Callback*)cb_maxdb); | |||||
| } // Fl_Roller* maxdb | |||||
| { Fl_Value_Output* o = maxdbvo = new Fl_Value_Output(126, 264, 24, 18, "Max."); | |||||
| maxdbvo->tooltip("The Maximum amplitude (dB)"); | |||||
| maxdbvo->labelsize(12); | |||||
| maxdbvo->minimum(1); | |||||
| maxdbvo->maximum(127); | |||||
| maxdbvo->step(1); | |||||
| maxdbvo->value(30); | |||||
| maxdbvo->textfont(1); | |||||
| maxdbvo->textsize(12); | |||||
| maxdbvo->callback((Fl_Callback*)cb_maxdbvo); | |||||
| o->value(respar->PmaxdB); | |||||
| } // Fl_Value_Output* maxdbvo | |||||
| { new Fl_Box(150, 264, 24, 18, "dB"); | |||||
| } // Fl_Box* o | |||||
| { Fl_Value_Output* o = centerfreqvo = new Fl_Value_Output(210, 264, 33, 18, "C.f."); | |||||
| centerfreqvo->tooltip("Center Frequency (kHz)"); | |||||
| centerfreqvo->labelsize(12); | |||||
| centerfreqvo->minimum(1); | |||||
| centerfreqvo->maximum(10); | |||||
| centerfreqvo->step(0.01); | |||||
| centerfreqvo->value(1); | |||||
| centerfreqvo->textfont(1); | |||||
| centerfreqvo->textsize(12); | |||||
| centerfreqvo->callback((Fl_Callback*)cb_centerfreqvo); | |||||
| centerfreqvo->when(3); | |||||
| o->value(respar->getcenterfreq()/1000.0); | |||||
| } // Fl_Value_Output* centerfreqvo | |||||
| { Fl_Value_Output* o = octavesfreqvo = new Fl_Value_Output(210, 282, 33, 18, "Oct."); | |||||
| octavesfreqvo->tooltip("No. of octaves"); | |||||
| octavesfreqvo->labelsize(12); | |||||
| octavesfreqvo->minimum(1); | |||||
| octavesfreqvo->maximum(127); | |||||
| octavesfreqvo->step(1); | |||||
| octavesfreqvo->value(30); | |||||
| octavesfreqvo->textfont(1); | |||||
| octavesfreqvo->textsize(12); | |||||
| octavesfreqvo->callback((Fl_Callback*)cb_octavesfreqvo); | |||||
| octavesfreqvo->when(3); | |||||
| o->value(respar->getoctavesfreq()); | |||||
| } // Fl_Value_Output* octavesfreqvo | |||||
| { Fl_Button* o = new Fl_Button(566, 276, 42, 12, "RND2"); | |||||
| o->tooltip("Randomize the resonance function"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_RND2); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(566, 264, 42, 12, "RND1"); | |||||
| o->tooltip("Randomize the resonance function"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_RND1); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(566, 288, 42, 12, "RND3"); | |||||
| o->tooltip("Randomize the resonance function"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_RND3); | |||||
| } // Fl_Button* o | |||||
| { Fl_Check_Button* o = p1st = new Fl_Check_Button(365, 285, 45, 15, "P.1st"); | |||||
| p1st->tooltip("Protect the fundamental frequency (do not damp the first harmonic)"); | |||||
| p1st->down_box(FL_DOWN_BOX); | |||||
| p1st->labelsize(10); | |||||
| p1st->callback((Fl_Callback*)cb_p1st); | |||||
| o->value(respar->Pprotectthefundamental); | |||||
| } // Fl_Check_Button* p1st | |||||
| { Fl_Button* o = new Fl_Button(365, 265, 46, 15, "InterpP"); | |||||
| o->tooltip("Interpolate the peaks"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(10); | |||||
| o->callback((Fl_Callback*)cb_InterpP); | |||||
| } // Fl_Button* o | |||||
| { WidgetPDial* o = centerfreq = new WidgetPDial(245, 265, 30, 30, "C.f."); | |||||
| centerfreq->box(FL_ROUND_UP_BOX); | |||||
| centerfreq->color(FL_BACKGROUND_COLOR); | |||||
| centerfreq->selection_color(FL_INACTIVE_COLOR); | |||||
| centerfreq->labeltype(FL_NORMAL_LABEL); | |||||
| centerfreq->labelfont(0); | |||||
| centerfreq->labelsize(10); | |||||
| centerfreq->labelcolor(FL_FOREGROUND_COLOR); | |||||
| centerfreq->maximum(127); | |||||
| centerfreq->step(1); | |||||
| centerfreq->callback((Fl_Callback*)cb_centerfreq); | |||||
| centerfreq->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| centerfreq->when(FL_WHEN_CHANGED); | |||||
| o->value(respar->Pcenterfreq); | |||||
| } // WidgetPDial* centerfreq | |||||
| { WidgetPDial* o = octavesfreq = new WidgetPDial(280, 265, 30, 30, "Oct."); | |||||
| octavesfreq->box(FL_ROUND_UP_BOX); | |||||
| octavesfreq->color(FL_BACKGROUND_COLOR); | |||||
| octavesfreq->selection_color(FL_INACTIVE_COLOR); | |||||
| octavesfreq->labeltype(FL_NORMAL_LABEL); | |||||
| octavesfreq->labelfont(0); | |||||
| octavesfreq->labelsize(10); | |||||
| octavesfreq->labelcolor(FL_FOREGROUND_COLOR); | |||||
| octavesfreq->maximum(127); | |||||
| octavesfreq->step(1); | |||||
| octavesfreq->callback((Fl_Callback*)cb_octavesfreq); | |||||
| octavesfreq->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| octavesfreq->when(FL_WHEN_CHANGED); | |||||
| o->value(respar->Poctavesfreq); | |||||
| } // WidgetPDial* octavesfreq | |||||
| { Fl_Button* o = new Fl_Button(625, 275, 25, 15, "C"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_C); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(655, 275, 25, 15, "P"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_P); | |||||
| } // Fl_Button* o | |||||
| { applybutton = new Fl_Button(690, 265, 85, 15, "Apply"); | |||||
| applybutton->box(FL_THIN_UP_BOX); | |||||
| applybutton->labelfont(1); | |||||
| applybutton->labelsize(11); | |||||
| applybutton->callback((Fl_Callback*)cb_applybutton); | |||||
| } // Fl_Button* applybutton | |||||
| resonancewindow->end(); | |||||
| } // Fl_Double_Window* resonancewindow | |||||
| return resonancewindow; | |||||
| } | |||||
| ResonanceUI::ResonanceUI(Resonance *respar_) { | |||||
| respar=respar_; | |||||
| cbwidget=NULL; | |||||
| cbapplywidget=NULL; | |||||
| make_window(); | |||||
| applybutton->hide(); | |||||
| } | |||||
| ResonanceUI::~ResonanceUI() { | |||||
| resonancewindow->hide(); | |||||
| } | |||||
| void ResonanceUI::redrawPADnoteApply() { | |||||
| if (cbwidget!=NULL) { | |||||
| cbwidget->do_callback(); | |||||
| applybutton->color(FL_RED); | |||||
| applybutton->redraw(); | |||||
| }; | |||||
| } | |||||
| void ResonanceUI::setcbwidget(Fl_Widget *cbwidget,Fl_Widget *cbapplywidget) { | |||||
| this->cbwidget=cbwidget; | |||||
| this->cbapplywidget=cbapplywidget; | |||||
| rg->setcbwidget(cbwidget,applybutton); | |||||
| applybutton->show(); | |||||
| } | |||||
| void ResonanceUI::refresh() { | |||||
| redrawPADnoteApply(); | |||||
| enabled->value(respar->Penabled); | |||||
| maxdb->value(respar->PmaxdB); | |||||
| maxdbvo->value(respar->PmaxdB); | |||||
| centerfreqvo->value(respar->getcenterfreq()/1000.0); | |||||
| octavesfreqvo->value(respar->getoctavesfreq()); | |||||
| centerfreq->value(respar->Pcenterfreq); | |||||
| octavesfreq->value(respar->Poctavesfreq); | |||||
| p1st->value(respar->Pprotectthefundamental); | |||||
| rg->redraw(); | |||||
| } | |||||
| @@ -0,0 +1,120 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef ResonanceUI_h | |||||
| #define ResonanceUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include <FL/fl_draw.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include "../Synth/Resonance.h" | |||||
| #include "WidgetPDial.h" | |||||
| #include "PresetsUI.h" | |||||
| class ResonanceGraph : public Fl_Box { | |||||
| public: | |||||
| ResonanceGraph(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Resonance *respar_,Fl_Value_Output *khzvalue_,Fl_Value_Output *dbvalue_); | |||||
| void draw_freq_line(float freq,int type); | |||||
| void draw(); | |||||
| int handle(int event); | |||||
| void setcbwidget(Fl_Widget *cbwidget,Fl_Widget *applybutton); | |||||
| private: | |||||
| Fl_Value_Output *khzvalue; | |||||
| Fl_Value_Output *dbvalue; | |||||
| Resonance *respar; | |||||
| int oldx,oldy; | |||||
| public: | |||||
| float khzval; | |||||
| private: | |||||
| Fl_Widget *cbwidget,*applybutton; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Roller.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| class ResonanceUI : PresetsUI_ { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *resonancewindow; | |||||
| Fl_Value_Output *khzvalue; | |||||
| Fl_Value_Output *dbvalue; | |||||
| private: | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_Zero_i(Fl_Button*, void*); | |||||
| static void cb_Zero(Fl_Button*, void*); | |||||
| void cb_Smooth_i(Fl_Button*, void*); | |||||
| static void cb_Smooth(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *enabled; | |||||
| private: | |||||
| void cb_enabled_i(Fl_Check_Button*, void*); | |||||
| static void cb_enabled(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Roller *maxdb; | |||||
| private: | |||||
| void cb_maxdb_i(Fl_Roller*, void*); | |||||
| static void cb_maxdb(Fl_Roller*, void*); | |||||
| public: | |||||
| Fl_Value_Output *maxdbvo; | |||||
| private: | |||||
| void cb_maxdbvo_i(Fl_Value_Output*, void*); | |||||
| static void cb_maxdbvo(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Value_Output *centerfreqvo; | |||||
| private: | |||||
| void cb_centerfreqvo_i(Fl_Value_Output*, void*); | |||||
| static void cb_centerfreqvo(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Value_Output *octavesfreqvo; | |||||
| private: | |||||
| void cb_octavesfreqvo_i(Fl_Value_Output*, void*); | |||||
| static void cb_octavesfreqvo(Fl_Value_Output*, void*); | |||||
| void cb_RND2_i(Fl_Button*, void*); | |||||
| static void cb_RND2(Fl_Button*, void*); | |||||
| void cb_RND1_i(Fl_Button*, void*); | |||||
| static void cb_RND1(Fl_Button*, void*); | |||||
| void cb_RND3_i(Fl_Button*, void*); | |||||
| static void cb_RND3(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Check_Button *p1st; | |||||
| private: | |||||
| void cb_p1st_i(Fl_Check_Button*, void*); | |||||
| static void cb_p1st(Fl_Check_Button*, void*); | |||||
| void cb_InterpP_i(Fl_Button*, void*); | |||||
| static void cb_InterpP(Fl_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *centerfreq; | |||||
| private: | |||||
| void cb_centerfreq_i(WidgetPDial*, void*); | |||||
| static void cb_centerfreq(WidgetPDial*, void*); | |||||
| public: | |||||
| WidgetPDial *octavesfreq; | |||||
| private: | |||||
| void cb_octavesfreq_i(WidgetPDial*, void*); | |||||
| static void cb_octavesfreq(WidgetPDial*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Button *applybutton; | |||||
| private: | |||||
| void cb_applybutton_i(Fl_Button*, void*); | |||||
| static void cb_applybutton(Fl_Button*, void*); | |||||
| public: | |||||
| ResonanceUI(Resonance *respar_); | |||||
| ~ResonanceUI(); | |||||
| void redrawPADnoteApply(); | |||||
| void setcbwidget(Fl_Widget *cbwidget,Fl_Widget *cbapplywidget); | |||||
| void refresh(); | |||||
| Resonance *respar; | |||||
| private: | |||||
| ResonanceGraph *rg; | |||||
| Fl_Widget *cbwidget,*cbapplywidget; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,735 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/SUBnoteUI.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| void SUBnoteharmonic::cb_mag_i(Fl_Slider* o, void*) { | |||||
| int x=0; | |||||
| if (Fl::event_button1()) x=127-(int)o->value(); | |||||
| else o->value(127-x); | |||||
| pars->Phmag[n]=x; | |||||
| if (pars->Phmag[n]==0) o->selection_color(0); | |||||
| else o->selection_color(222); | |||||
| } | |||||
| void SUBnoteharmonic::cb_mag(Fl_Slider* o, void* v) { | |||||
| ((SUBnoteharmonic*)(o->parent()->user_data()))->cb_mag_i(o,v); | |||||
| } | |||||
| void SUBnoteharmonic::cb_bw_i(Fl_Slider* o, void*) { | |||||
| int x=64; | |||||
| if (Fl::event_button1()) x=127-(int)o->value(); | |||||
| else o->value(x); | |||||
| pars->Phrelbw[n]=x; | |||||
| } | |||||
| void SUBnoteharmonic::cb_bw(Fl_Slider* o, void* v) { | |||||
| ((SUBnoteharmonic*)(o->parent()->user_data()))->cb_bw_i(o,v); | |||||
| } | |||||
| Fl_Group* SUBnoteharmonic::make_window() { | |||||
| { harmonic = new Fl_Group(0, 0, 90, 225); | |||||
| harmonic->box(FL_FLAT_BOX); | |||||
| harmonic->color(FL_BACKGROUND_COLOR); | |||||
| harmonic->selection_color(FL_BACKGROUND_COLOR); | |||||
| harmonic->labeltype(FL_NO_LABEL); | |||||
| harmonic->labelfont(0); | |||||
| harmonic->labelsize(14); | |||||
| harmonic->labelcolor(FL_FOREGROUND_COLOR); | |||||
| harmonic->user_data((void*)(this)); | |||||
| harmonic->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| harmonic->when(FL_WHEN_RELEASE); | |||||
| { Fl_Slider* o = mag = new Fl_Slider(0, 15, 10, 115); | |||||
| mag->tooltip("harmonic\'s magnitude"); | |||||
| mag->type(4); | |||||
| mag->box(FL_FLAT_BOX); | |||||
| mag->selection_color((Fl_Color)222); | |||||
| mag->maximum(127); | |||||
| mag->step(1); | |||||
| mag->value(127); | |||||
| mag->callback((Fl_Callback*)cb_mag); | |||||
| o->value(127-pars->Phmag[n]); | |||||
| if (pars->Phmag[n]==0) o->selection_color(0); | |||||
| } // Fl_Slider* mag | |||||
| { Fl_Slider* o = bw = new Fl_Slider(0, 135, 10, 75); | |||||
| bw->tooltip("harmonic\'s bandwidth"); | |||||
| bw->type(4); | |||||
| bw->box(FL_FLAT_BOX); | |||||
| bw->selection_color((Fl_Color)222); | |||||
| bw->maximum(127); | |||||
| bw->step(1); | |||||
| bw->value(64); | |||||
| bw->callback((Fl_Callback*)cb_bw); | |||||
| o->value(127-pars->Phrelbw[n]); | |||||
| } // Fl_Slider* bw | |||||
| { Fl_Box* o = new Fl_Box(10, 170, 5, 5); | |||||
| o->box(FL_FLAT_BOX); | |||||
| o->color(FL_DARK2); | |||||
| if (n+1==MAX_SUB_HARMONICS) o->hide(); | |||||
| } // Fl_Box* o | |||||
| { Fl_Box* o = new Fl_Box(0, 210, 10, 15, "01"); | |||||
| o->labelfont(1); | |||||
| o->labelsize(9); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); | |||||
| char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); | |||||
| } // Fl_Box* o | |||||
| { Fl_Box* o = new Fl_Box(0, 0, 10, 15, "01"); | |||||
| o->labelfont(1); | |||||
| o->labelsize(9); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE)); | |||||
| char tmp[10];snprintf(tmp,10,"%d",n+1);o->label(strdup(tmp)); | |||||
| } // Fl_Box* o | |||||
| harmonic->end(); | |||||
| } // Fl_Group* harmonic | |||||
| return harmonic; | |||||
| } | |||||
| SUBnoteharmonic::SUBnoteharmonic(int x,int y, int w, int h, const char *label):Fl_Group(x,y,w,h,label) { | |||||
| n=0; | |||||
| } | |||||
| void SUBnoteharmonic::init(SUBnoteParameters *pars_,int n_) { | |||||
| pars=pars_; | |||||
| n=n_; | |||||
| make_window(); | |||||
| harmonic->show(); | |||||
| end(); | |||||
| } | |||||
| void SUBnoteharmonic::refresh() { | |||||
| mag->value(127-pars->Phmag[n]); | |||||
| if (pars->Phmag[n]==0) mag->selection_color(0); | |||||
| bw->value(127-pars->Phrelbw[n]); | |||||
| } | |||||
| SUBnoteharmonic::~SUBnoteharmonic() { | |||||
| harmonic->hide(); | |||||
| hide(); | |||||
| //delete(harmonic); | |||||
| } | |||||
| void SUBnoteUI::cb_Close_i(Fl_Button*, void*) { | |||||
| SUBparameters->hide(); | |||||
| } | |||||
| void SUBnoteUI::cb_Close(Fl_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_vol_i(Fl_Value_Slider* o, void*) { | |||||
| pars->PVolume=(int)o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_vol(Fl_Value_Slider* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_vol_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_vsns_i(Fl_Value_Slider* o, void*) { | |||||
| pars->PAmpVelocityScaleFunction=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_vsns(Fl_Value_Slider* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_vsns_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_pan_i(WidgetPDial* o, void*) { | |||||
| pars->PPanning=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_pan(WidgetPDial* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_pan_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_filterstages_i(Fl_Counter* o, void*) { | |||||
| pars->Pnumstages=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_filterstages(Fl_Counter* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_filterstages_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_magtype_i(Fl_Choice* o, void*) { | |||||
| pars->Phmagtype=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_magtype(Fl_Choice* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_magtype_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item SUBnoteUI::menu_magtype[] = { | |||||
| {"Linear", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"-40dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"-60dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"-80dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"-100dB", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void SUBnoteUI::cb_start_i(Fl_Choice* o, void*) { | |||||
| pars->Pstart=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_start(Fl_Choice* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_start_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item SUBnoteUI::menu_start[] = { | |||||
| {"Zero", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"RND", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {"Max.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 11, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void SUBnoteUI::cb_freqee_i(Fl_Check_Button* o, void*) { | |||||
| pars->PFreqEnvelopeEnabled=o->value(); | |||||
| if (o->value()==0) freqenvelopegroup->deactivate(); | |||||
| else freqenvelopegroup->activate(); | |||||
| o->show(); | |||||
| freqsettingsui->redraw(); | |||||
| } | |||||
| void SUBnoteUI::cb_freqee(Fl_Check_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_freqee_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_octave_i(Fl_Counter* o, void*) { | |||||
| int k=(int) o->value(); | |||||
| if (k<0) k+=16; | |||||
| pars->PCoarseDetune = k*1024+ | |||||
| pars->PCoarseDetune%1024; | |||||
| } | |||||
| void SUBnoteUI::cb_octave(Fl_Counter* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_octave_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_coarsedet_i(Fl_Counter* o, void*) { | |||||
| int k=(int) o->value(); | |||||
| if (k<0) k+=1024; | |||||
| pars->PCoarseDetune = k+ | |||||
| (pars->PCoarseDetune/1024)*1024; | |||||
| } | |||||
| void SUBnoteUI::cb_coarsedet(Fl_Counter* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_coarsedet_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_detune_i(Fl_Slider* o, void*) { | |||||
| pars->PDetune=(int)o->value()+8192; | |||||
| detunevalueoutput->do_callback(); | |||||
| } | |||||
| void SUBnoteUI::cb_detune(Fl_Slider* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detune_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_detunevalueoutput_i(Fl_Value_Output* o, void*) { | |||||
| o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); | |||||
| } | |||||
| void SUBnoteUI::cb_detunevalueoutput(Fl_Value_Output* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detunevalueoutput_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_hz440_i(Fl_Check_Button* o, void*) { | |||||
| int x=(int) o->value(); | |||||
| pars->Pfixedfreq=x; | |||||
| if (x==0) fixedfreqetdial->deactivate(); | |||||
| else fixedfreqetdial->activate(); | |||||
| } | |||||
| void SUBnoteUI::cb_hz440(Fl_Check_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_hz440_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_fixedfreqetdial_i(WidgetPDial* o, void*) { | |||||
| pars->PfixedfreqET=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_fixedfreqetdial(WidgetPDial* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_fixedfreqetdial_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_detunetype_i(Fl_Choice* o, void*) { | |||||
| pars->PDetuneType=(int) o->value()+1; | |||||
| detunevalueoutput->do_callback(); | |||||
| } | |||||
| void SUBnoteUI::cb_detunetype(Fl_Choice* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_detunetype_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_stereo_i(Fl_Check_Button* o, void*) { | |||||
| pars->Pstereo=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_stereo(Fl_Check_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->user_data()))->cb_stereo_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_Clear_i(Fl_Button*, void*) { | |||||
| for (int i=0;i<MAX_SUB_HARMONICS;i++){ | |||||
| h[i]->mag->value(127); | |||||
| pars->Phmag[i]=0; | |||||
| h[i]->bw->value(64); | |||||
| pars->Phrelbw[i]=64; | |||||
| }; | |||||
| pars->Phmag[0]=127; | |||||
| h[0]->mag->value(0); | |||||
| SUBparameters->redraw(); | |||||
| } | |||||
| void SUBnoteUI::cb_Clear(Fl_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->user_data()))->cb_Clear_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_bwee_i(Fl_Check_Button* o, void*) { | |||||
| pars->PBandWidthEnvelopeEnabled=o->value(); | |||||
| if (o->value()==0) bandwidthenvelopegroup->deactivate(); | |||||
| else bandwidthenvelopegroup->activate(); | |||||
| o->show(); | |||||
| bandwidthsettingsui->redraw(); | |||||
| } | |||||
| void SUBnoteUI::cb_bwee(Fl_Check_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bwee_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_bandwidth_i(Fl_Value_Slider* o, void*) { | |||||
| pars->Pbandwidth=(int) o->value(); | |||||
| } | |||||
| void SUBnoteUI::cb_bandwidth(Fl_Value_Slider* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bandwidth_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_bwidthscale_i(Fl_Value_Slider* o, void*) { | |||||
| pars->Pbwscale=(int) o->value()+64; | |||||
| } | |||||
| void SUBnoteUI::cb_bwidthscale(Fl_Value_Slider* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->parent()->user_data()))->cb_bwidthscale_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_filtere_i(Fl_Check_Button* o, void*) { | |||||
| pars->PGlobalFilterEnabled=o->value(); | |||||
| if (o->value()==0) globalfiltergroup->deactivate(); | |||||
| else globalfiltergroup->activate(); | |||||
| o->show(); | |||||
| globalfiltergroup->redraw(); | |||||
| } | |||||
| void SUBnoteUI::cb_filtere(Fl_Check_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->user_data()))->cb_filtere_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_C_i(Fl_Button*, void*) { | |||||
| presetsui->copy(pars); | |||||
| } | |||||
| void SUBnoteUI::cb_C(Fl_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->user_data()))->cb_C_i(o,v); | |||||
| } | |||||
| void SUBnoteUI::cb_P_i(Fl_Button*, void*) { | |||||
| presetsui->paste(pars,this); | |||||
| } | |||||
| void SUBnoteUI::cb_P(Fl_Button* o, void* v) { | |||||
| ((SUBnoteUI*)(o->parent()->user_data()))->cb_P_i(o,v); | |||||
| } | |||||
| Fl_Double_Window* SUBnoteUI::make_window() { | |||||
| { SUBparameters = new Fl_Double_Window(735, 390, "SUBsynth Parameters"); | |||||
| SUBparameters->user_data((void*)(this)); | |||||
| { Fl_Scroll* o = new Fl_Scroll(5, 140, 435, 245, "scroll"); | |||||
| o->type(1); | |||||
| o->box(FL_FLAT_BOX); | |||||
| o->labeltype(FL_NO_LABEL); | |||||
| { Fl_Pack* o = harmonics = new Fl_Pack(10, 145, 425, 235); | |||||
| harmonics->type(1); | |||||
| for (int i=0;i<MAX_SUB_HARMONICS;i++){h[i]=new SUBnoteharmonic(0,0,15,o->h(),"");h[i]->init(pars,i);} | |||||
| harmonics->end(); | |||||
| } // Fl_Pack* harmonics | |||||
| o->end(); | |||||
| } // Fl_Scroll* o | |||||
| { Fl_Button* o = new Fl_Button(625, 365, 105, 20, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| { Fl_Group* o = new Fl_Group(5, 5, 215, 135, "AMPLITUDE"); | |||||
| o->box(FL_UP_FRAME); | |||||
| o->labeltype(FL_EMBOSSED_LABEL); | |||||
| o->labelfont(1); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); | |||||
| { Fl_Value_Slider* o = vol = new Fl_Value_Slider(10, 25, 140, 15, "Vol"); | |||||
| vol->tooltip("Volume"); | |||||
| vol->type(5); | |||||
| vol->box(FL_NO_BOX); | |||||
| vol->labelsize(11); | |||||
| vol->maximum(127); | |||||
| vol->step(1); | |||||
| vol->callback((Fl_Callback*)cb_vol); | |||||
| vol->align(Fl_Align(FL_ALIGN_RIGHT)); | |||||
| o->value(pars->PVolume); | |||||
| } // Fl_Value_Slider* vol | |||||
| { Fl_Value_Slider* o = vsns = new Fl_Value_Slider(10, 45, 140, 15, "V.Sns"); | |||||
| vsns->tooltip("Velocity Sensing Function (rightmost to disable)"); | |||||
| vsns->type(5); | |||||
| vsns->box(FL_NO_BOX); | |||||
| vsns->labelsize(11); | |||||
| vsns->maximum(127); | |||||
| vsns->step(1); | |||||
| vsns->callback((Fl_Callback*)cb_vsns); | |||||
| vsns->align(Fl_Align(FL_ALIGN_RIGHT)); | |||||
| o->value(pars->PAmpVelocityScaleFunction); | |||||
| } // Fl_Value_Slider* vsns | |||||
| { WidgetPDial* o = pan = new WidgetPDial(185, 20, 30, 30, "Pan"); | |||||
| pan->tooltip("Panning (leftmost is Random)"); | |||||
| pan->box(FL_ROUND_UP_BOX); | |||||
| pan->color(FL_BACKGROUND_COLOR); | |||||
| pan->selection_color(FL_INACTIVE_COLOR); | |||||
| pan->labeltype(FL_NORMAL_LABEL); | |||||
| pan->labelfont(0); | |||||
| pan->labelsize(10); | |||||
| pan->labelcolor(FL_FOREGROUND_COLOR); | |||||
| pan->maximum(127); | |||||
| pan->step(1); | |||||
| pan->callback((Fl_Callback*)cb_pan); | |||||
| pan->align(Fl_Align(FL_ALIGN_BOTTOM)); | |||||
| pan->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->PPanning); | |||||
| } // WidgetPDial* pan | |||||
| { EnvelopeUI* o = ampenv = new EnvelopeUI(10, 65, 205, 70, "SUBsynth - Amplitude Envelope"); | |||||
| ampenv->box(FL_FLAT_BOX); | |||||
| ampenv->color((Fl_Color)51); | |||||
| ampenv->selection_color(FL_BACKGROUND_COLOR); | |||||
| ampenv->labeltype(FL_NORMAL_LABEL); | |||||
| ampenv->labelfont(0); | |||||
| ampenv->labelsize(14); | |||||
| ampenv->labelcolor(FL_FOREGROUND_COLOR); | |||||
| ampenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); | |||||
| ampenv->when(FL_WHEN_RELEASE); | |||||
| o->init(pars->AmpEnvelope); | |||||
| ampenv->end(); | |||||
| } // EnvelopeUI* ampenv | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { Fl_Group* o = new Fl_Group(495, 325, 235, 35); | |||||
| o->box(FL_UP_FRAME); | |||||
| { Fl_Counter* o = filterstages = new Fl_Counter(515, 340, 45, 15, "Filter Stages"); | |||||
| filterstages->tooltip("How many times the noise is filtered"); | |||||
| filterstages->type(1); | |||||
| filterstages->labelfont(1); | |||||
| filterstages->labelsize(10); | |||||
| filterstages->minimum(1); | |||||
| filterstages->maximum(5); | |||||
| filterstages->step(1); | |||||
| filterstages->textsize(10); | |||||
| filterstages->callback((Fl_Callback*)cb_filterstages); | |||||
| filterstages->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->value(pars->Pnumstages); | |||||
| } // Fl_Counter* filterstages | |||||
| { Fl_Choice* o = magtype = new Fl_Choice(585, 340, 65, 15, "Mag.Type"); | |||||
| magtype->down_box(FL_BORDER_BOX); | |||||
| magtype->labelfont(1); | |||||
| magtype->labelsize(10); | |||||
| magtype->textsize(11); | |||||
| magtype->callback((Fl_Callback*)cb_magtype); | |||||
| magtype->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| magtype->menu(menu_magtype); | |||||
| o->value(pars->Phmagtype); | |||||
| } // Fl_Choice* magtype | |||||
| { Fl_Choice* o = start = new Fl_Choice(670, 340, 50, 15, "Start"); | |||||
| start->down_box(FL_BORDER_BOX); | |||||
| start->labelfont(1); | |||||
| start->labelsize(10); | |||||
| start->textsize(11); | |||||
| start->callback((Fl_Callback*)cb_start); | |||||
| start->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| start->menu(menu_start); | |||||
| o->value(pars->Pstart); | |||||
| } // Fl_Choice* start | |||||
| o->end(); | |||||
| } // Fl_Group* o | |||||
| { freqsettingsui = new Fl_Group(440, 5, 290, 135, "FREQUENCY"); | |||||
| freqsettingsui->box(FL_UP_FRAME); | |||||
| freqsettingsui->labeltype(FL_EMBOSSED_LABEL); | |||||
| freqsettingsui->labelfont(1); | |||||
| freqsettingsui->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); | |||||
| { EnvelopeUI* o = freqenvelopegroup = new EnvelopeUI(445, 65, 205, 70, "SUBsynth - Frequency Envelope"); | |||||
| freqenvelopegroup->box(FL_FLAT_BOX); | |||||
| freqenvelopegroup->color((Fl_Color)51); | |||||
| freqenvelopegroup->selection_color(FL_BACKGROUND_COLOR); | |||||
| freqenvelopegroup->labeltype(FL_NORMAL_LABEL); | |||||
| freqenvelopegroup->labelfont(0); | |||||
| freqenvelopegroup->labelsize(14); | |||||
| freqenvelopegroup->labelcolor(FL_FOREGROUND_COLOR); | |||||
| freqenvelopegroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); | |||||
| freqenvelopegroup->when(FL_WHEN_RELEASE); | |||||
| o->init(pars->FreqEnvelope); | |||||
| if (pars->PFreqEnvelopeEnabled==0) o->deactivate(); | |||||
| freqenvelopegroup->end(); | |||||
| } // EnvelopeUI* freqenvelopegroup | |||||
| { Fl_Check_Button* o = freqee = new Fl_Check_Button(445, 68, 55, 15, "Enabled"); | |||||
| freqee->down_box(FL_DOWN_BOX); | |||||
| freqee->labelfont(1); | |||||
| freqee->labelsize(10); | |||||
| freqee->callback((Fl_Callback*)cb_freqee); | |||||
| o->value(pars->PFreqEnvelopeEnabled); | |||||
| } // Fl_Check_Button* freqee | |||||
| { Fl_Counter* o = octave = new Fl_Counter(670, 50, 45, 15, "Octave"); | |||||
| octave->tooltip("Octave"); | |||||
| octave->type(1); | |||||
| octave->labelsize(10); | |||||
| octave->minimum(-8); | |||||
| octave->maximum(7); | |||||
| octave->step(1); | |||||
| octave->textfont(1); | |||||
| octave->textsize(11); | |||||
| octave->callback((Fl_Callback*)cb_octave); | |||||
| octave->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; | |||||
| o->value(k); | |||||
| } // Fl_Counter* octave | |||||
| { Fl_Counter* o = coarsedet = new Fl_Counter(655, 115, 60, 20, "Coarse Det."); | |||||
| coarsedet->tooltip("Coarse Detune"); | |||||
| coarsedet->labelsize(10); | |||||
| coarsedet->minimum(-64); | |||||
| coarsedet->maximum(63); | |||||
| coarsedet->step(1); | |||||
| coarsedet->textfont(1); | |||||
| coarsedet->textsize(11); | |||||
| coarsedet->callback((Fl_Callback*)cb_coarsedet); | |||||
| coarsedet->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| int k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; | |||||
| o->value(k); | |||||
| o->lstep(10); | |||||
| } // Fl_Counter* coarsedet | |||||
| { Fl_Slider* o = detune = new Fl_Slider(495, 25, 230, 15); | |||||
| detune->tooltip("Fine Detune (cents)"); | |||||
| detune->type(5); | |||||
| detune->box(FL_NO_BOX); | |||||
| detune->minimum(-8192); | |||||
| detune->maximum(8191); | |||||
| detune->step(1); | |||||
| detune->callback((Fl_Callback*)cb_detune); | |||||
| o->value(pars->PDetune-8192); | |||||
| } // Fl_Slider* detune | |||||
| { Fl_Value_Output* o = detunevalueoutput = new Fl_Value_Output(448, 25, 45, 15, "Detune"); | |||||
| detunevalueoutput->labelsize(10); | |||||
| detunevalueoutput->minimum(-5000); | |||||
| detunevalueoutput->maximum(5000); | |||||
| detunevalueoutput->step(0.01); | |||||
| detunevalueoutput->textfont(1); | |||||
| detunevalueoutput->textsize(10); | |||||
| detunevalueoutput->callback((Fl_Callback*)cb_detunevalueoutput); | |||||
| detunevalueoutput->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(getdetune(pars->PDetuneType,0,pars->PDetune)); | |||||
| } // Fl_Value_Output* detunevalueoutput | |||||
| { Fl_Check_Button* o = hz440 = new Fl_Check_Button(555, 45, 50, 15, "440Hz"); | |||||
| hz440->tooltip("set the base frequency to 440Hz"); | |||||
| hz440->down_box(FL_DOWN_BOX); | |||||
| hz440->labelfont(1); | |||||
| hz440->labelsize(10); | |||||
| hz440->callback((Fl_Callback*)cb_hz440); | |||||
| o->value(pars->Pfixedfreq); | |||||
| } // Fl_Check_Button* hz440 | |||||
| { WidgetPDial* o = fixedfreqetdial = new WidgetPDial(610, 45, 15, 15, "Eq.T."); | |||||
| fixedfreqetdial->tooltip("How the frequency varies acording to the keyboard (leftmost for fixed frequen\ | |||||
| cy)"); | |||||
| fixedfreqetdial->box(FL_ROUND_UP_BOX); | |||||
| fixedfreqetdial->color(FL_BACKGROUND_COLOR); | |||||
| fixedfreqetdial->selection_color(FL_INACTIVE_COLOR); | |||||
| fixedfreqetdial->labeltype(FL_NORMAL_LABEL); | |||||
| fixedfreqetdial->labelfont(0); | |||||
| fixedfreqetdial->labelsize(10); | |||||
| fixedfreqetdial->labelcolor(FL_FOREGROUND_COLOR); | |||||
| fixedfreqetdial->maximum(127); | |||||
| fixedfreqetdial->step(1); | |||||
| fixedfreqetdial->callback((Fl_Callback*)cb_fixedfreqetdial); | |||||
| fixedfreqetdial->align(Fl_Align(FL_ALIGN_RIGHT)); | |||||
| fixedfreqetdial->when(FL_WHEN_CHANGED); | |||||
| o->value(pars->PfixedfreqET); | |||||
| if (pars->Pfixedfreq==0) o->deactivate(); | |||||
| } // WidgetPDial* fixedfreqetdial | |||||
| { Fl_Choice* o = detunetype = new Fl_Choice(655, 85, 70, 15, "Detune Type"); | |||||
| detunetype->down_box(FL_BORDER_BOX); | |||||
| detunetype->labelsize(10); | |||||
| detunetype->textfont(1); | |||||
| detunetype->textsize(10); | |||||
| detunetype->callback((Fl_Callback*)cb_detunetype); | |||||
| detunetype->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->add("L35cents");o->add("L10cents");o->add("E100cents");o->add("E1200cents"); | |||||
| o->value(pars->PDetuneType-1); | |||||
| } // Fl_Choice* detunetype | |||||
| freqsettingsui->end(); | |||||
| } // Fl_Group* freqsettingsui | |||||
| { Fl_Check_Button* o = stereo = new Fl_Check_Button(440, 325, 55, 35, "Stereo"); | |||||
| stereo->box(FL_THIN_UP_BOX); | |||||
| stereo->down_box(FL_DOWN_BOX); | |||||
| stereo->labelsize(10); | |||||
| stereo->callback((Fl_Callback*)cb_stereo); | |||||
| o->value(pars->Pstereo); | |||||
| } // Fl_Check_Button* stereo | |||||
| { Fl_Button* o = new Fl_Button(445, 365, 70, 20, "Clear"); | |||||
| o->tooltip("Clear the harmonics"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->callback((Fl_Callback*)cb_Clear); | |||||
| } // Fl_Button* o | |||||
| { bandwidthsettingsui = new Fl_Group(220, 5, 220, 135, "BANDWIDTH"); | |||||
| bandwidthsettingsui->box(FL_UP_FRAME); | |||||
| bandwidthsettingsui->labeltype(FL_EMBOSSED_LABEL); | |||||
| bandwidthsettingsui->labelfont(1); | |||||
| bandwidthsettingsui->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); | |||||
| { EnvelopeUI* o = bandwidthenvelopegroup = new EnvelopeUI(225, 65, 205, 70, "SUBsynth - BandWidth Envelope"); | |||||
| bandwidthenvelopegroup->box(FL_FLAT_BOX); | |||||
| bandwidthenvelopegroup->color((Fl_Color)51); | |||||
| bandwidthenvelopegroup->selection_color(FL_BACKGROUND_COLOR); | |||||
| bandwidthenvelopegroup->labeltype(FL_NORMAL_LABEL); | |||||
| bandwidthenvelopegroup->labelfont(0); | |||||
| bandwidthenvelopegroup->labelsize(14); | |||||
| bandwidthenvelopegroup->labelcolor(FL_FOREGROUND_COLOR); | |||||
| bandwidthenvelopegroup->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); | |||||
| bandwidthenvelopegroup->when(FL_WHEN_RELEASE); | |||||
| o->init(pars->BandWidthEnvelope); | |||||
| if (pars->PBandWidthEnvelopeEnabled==0) o->deactivate(); | |||||
| bandwidthenvelopegroup->end(); | |||||
| } // EnvelopeUI* bandwidthenvelopegroup | |||||
| { Fl_Check_Button* o = bwee = new Fl_Check_Button(225, 67, 55, 15, "Enabled"); | |||||
| bwee->down_box(FL_DOWN_BOX); | |||||
| bwee->labelfont(1); | |||||
| bwee->labelsize(10); | |||||
| bwee->callback((Fl_Callback*)cb_bwee); | |||||
| o->value(pars->PBandWidthEnvelopeEnabled); | |||||
| } // Fl_Check_Button* bwee | |||||
| { Fl_Value_Slider* o = bandwidth = new Fl_Value_Slider(225, 40, 115, 15, "Band Width"); | |||||
| bandwidth->type(5); | |||||
| bandwidth->box(FL_NO_BOX); | |||||
| bandwidth->labelsize(10); | |||||
| bandwidth->maximum(127); | |||||
| bandwidth->step(1); | |||||
| bandwidth->callback((Fl_Callback*)cb_bandwidth); | |||||
| bandwidth->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->value(pars->Pbandwidth); | |||||
| } // Fl_Value_Slider* bandwidth | |||||
| { Fl_Value_Slider* o = bwidthscale = new Fl_Value_Slider(345, 40, 90, 15, "B.Width Scale"); | |||||
| bwidthscale->tooltip("How much I increase the BandWidth according to lower/higher harmonics"); | |||||
| bwidthscale->type(5); | |||||
| bwidthscale->box(FL_NO_BOX); | |||||
| bwidthscale->labelsize(10); | |||||
| bwidthscale->minimum(-64); | |||||
| bwidthscale->maximum(63); | |||||
| bwidthscale->step(1); | |||||
| bwidthscale->callback((Fl_Callback*)cb_bwidthscale); | |||||
| bwidthscale->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| o->value(pars->Pbwscale-64); | |||||
| } // Fl_Value_Slider* bwidthscale | |||||
| bandwidthsettingsui->end(); | |||||
| } // Fl_Group* bandwidthsettingsui | |||||
| { Fl_Group* o = globalfiltergroup = new Fl_Group(440, 140, 290, 185, "FILTER"); | |||||
| globalfiltergroup->box(FL_UP_FRAME); | |||||
| globalfiltergroup->labeltype(FL_EMBOSSED_LABEL); | |||||
| globalfiltergroup->labelfont(1); | |||||
| globalfiltergroup->labelsize(13); | |||||
| globalfiltergroup->align(Fl_Align(FL_ALIGN_TOP|FL_ALIGN_INSIDE)); | |||||
| { EnvelopeUI* o = filterenv = new EnvelopeUI(445, 250, 275, 70, "SUBsynth - Filter Envelope"); | |||||
| filterenv->box(FL_FLAT_BOX); | |||||
| filterenv->color((Fl_Color)51); | |||||
| filterenv->selection_color(FL_BACKGROUND_COLOR); | |||||
| filterenv->labeltype(FL_NORMAL_LABEL); | |||||
| filterenv->labelfont(0); | |||||
| filterenv->labelsize(14); | |||||
| filterenv->labelcolor(FL_FOREGROUND_COLOR); | |||||
| filterenv->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); | |||||
| filterenv->when(FL_WHEN_RELEASE); | |||||
| o->init(pars->GlobalFilterEnvelope); | |||||
| filterenv->end(); | |||||
| } // EnvelopeUI* filterenv | |||||
| { FilterUI* o = filterui = new FilterUI(445, 165, 275, 75, "SUBsynthl - Filter"); | |||||
| filterui->box(FL_FLAT_BOX); | |||||
| filterui->color(FL_LIGHT1); | |||||
| filterui->selection_color(FL_BACKGROUND_COLOR); | |||||
| filterui->labeltype(FL_NORMAL_LABEL); | |||||
| filterui->labelfont(0); | |||||
| filterui->labelsize(14); | |||||
| filterui->labelcolor(FL_FOREGROUND_COLOR); | |||||
| filterui->align(Fl_Align(FL_ALIGN_WRAP|FL_ALIGN_INSIDE)); | |||||
| filterui->when(FL_WHEN_RELEASE); | |||||
| o->init(pars->GlobalFilter,&pars->PGlobalFilterVelocityScale,&pars->PGlobalFilterVelocityScaleFunction); | |||||
| filterui->end(); | |||||
| } // FilterUI* filterui | |||||
| if (pars->PGlobalFilterEnabled==0) o->deactivate(); | |||||
| globalfiltergroup->end(); | |||||
| } // Fl_Group* globalfiltergroup | |||||
| { Fl_Check_Button* o = filtere = new Fl_Check_Button(445, 145, 85, 20, "Enabled"); | |||||
| filtere->down_box(FL_DOWN_BOX); | |||||
| filtere->labelfont(1); | |||||
| filtere->labelsize(11); | |||||
| filtere->callback((Fl_Callback*)cb_filtere); | |||||
| o->value(pars->PGlobalFilterEnabled); | |||||
| } // Fl_Check_Button* filtere | |||||
| { Fl_Button* o = new Fl_Button(540, 370, 25, 15, "C"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_C); | |||||
| } // Fl_Button* o | |||||
| { Fl_Button* o = new Fl_Button(570, 370, 25, 15, "P"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->color((Fl_Color)179); | |||||
| o->labelfont(1); | |||||
| o->labelsize(11); | |||||
| o->labelcolor(FL_BACKGROUND2_COLOR); | |||||
| o->callback((Fl_Callback*)cb_P); | |||||
| } // Fl_Button* o | |||||
| SUBparameters->end(); | |||||
| } // Fl_Double_Window* SUBparameters | |||||
| return SUBparameters; | |||||
| } | |||||
| void SUBnoteUI::refresh() { | |||||
| for (int i=0;i<MAX_SUB_HARMONICS;i++) h[i]->refresh(); | |||||
| vol->value(pars->PVolume); | |||||
| vsns->value(pars->PAmpVelocityScaleFunction); | |||||
| pan->value(pars->PPanning); | |||||
| bandwidth->value(pars->Pbandwidth); | |||||
| bwidthscale->value(pars->Pbwscale-64); | |||||
| bwee->value(pars->PBandWidthEnvelopeEnabled); | |||||
| if (pars->PBandWidthEnvelopeEnabled==0) bandwidthenvelopegroup->deactivate(); | |||||
| else bandwidthenvelopegroup->activate(); | |||||
| bwee->show(); | |||||
| bandwidthsettingsui->redraw(); | |||||
| detunevalueoutput->value(getdetune(pars->PDetuneType,0,pars->PDetune)); | |||||
| freqee->value(pars->PFreqEnvelopeEnabled); | |||||
| if (pars->PFreqEnvelopeEnabled==0) freqenvelopegroup->deactivate(); | |||||
| else freqenvelopegroup->activate(); | |||||
| freqee->show(); | |||||
| freqsettingsui->redraw(); | |||||
| detune->value(pars->PDetune-8192); | |||||
| hz440->value(pars->Pfixedfreq); | |||||
| fixedfreqetdial->value(pars->PfixedfreqET); | |||||
| int k=pars->PCoarseDetune/1024;if (k>=8) k-=16; | |||||
| octave->value(k); | |||||
| detunetype->value(pars->PDetuneType-1); | |||||
| k=pars->PCoarseDetune%1024;if (k>=512) k-=1024; | |||||
| coarsedet->value(k); | |||||
| filtere->value(pars->PGlobalFilterEnabled); | |||||
| if (pars->PGlobalFilterEnabled==0) globalfiltergroup->deactivate(); | |||||
| else globalfiltergroup->activate(); | |||||
| filtere->show(); | |||||
| globalfiltergroup->redraw(); | |||||
| stereo->value(pars->Pstereo); | |||||
| filterstages->value(pars->Pnumstages); | |||||
| magtype->value(pars->Phmagtype); | |||||
| start->value(pars->Pstart); | |||||
| ampenv->refresh(); | |||||
| bandwidthenvelopegroup->refresh(); | |||||
| freqenvelopegroup->refresh(); | |||||
| filterui->refresh(); | |||||
| filterenv->refresh(); | |||||
| } | |||||
| SUBnoteUI::SUBnoteUI(SUBnoteParameters *parameters) { | |||||
| pars=parameters; | |||||
| make_window(); | |||||
| } | |||||
| SUBnoteUI::~SUBnoteUI() { | |||||
| //for (int i=0;i<MAX_SUB_HARMONICS;i++) delete (h[i]); | |||||
| SUBparameters->hide(); | |||||
| delete(SUBparameters); | |||||
| } | |||||
| @@ -0,0 +1,179 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef SUBnoteUI_h | |||||
| #define SUBnoteUI_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <stdio.h> | |||||
| #include <string.h> | |||||
| #include "../globals.h" | |||||
| #include "WidgetPDial.h" | |||||
| #include "EnvelopeUI.h" | |||||
| #include "FilterUI.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "../Params/SUBnoteParameters.h" | |||||
| #include "PresetsUI.h" | |||||
| #include <FL/Fl_Slider.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| class SUBnoteharmonic : public Fl_Group { | |||||
| Fl_Group* make_window(); | |||||
| public: | |||||
| Fl_Group *harmonic; | |||||
| Fl_Slider *mag; | |||||
| private: | |||||
| void cb_mag_i(Fl_Slider*, void*); | |||||
| static void cb_mag(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Slider *bw; | |||||
| private: | |||||
| void cb_bw_i(Fl_Slider*, void*); | |||||
| static void cb_bw(Fl_Slider*, void*); | |||||
| public: | |||||
| SUBnoteharmonic(int x,int y, int w, int h, const char *label=0); | |||||
| void init(SUBnoteParameters *pars_,int n_); | |||||
| void refresh(); | |||||
| ~SUBnoteharmonic(); | |||||
| private: | |||||
| SUBnoteParameters *pars; | |||||
| int n; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Scroll.H> | |||||
| #include <FL/Fl_Pack.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Group.H> | |||||
| #include <FL/Fl_Value_Slider.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Check_Button.H> | |||||
| #include <FL/Fl_Value_Output.H> | |||||
| class SUBnoteUI : public PresetsUI_ { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *SUBparameters; | |||||
| Fl_Pack *harmonics; | |||||
| private: | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *vol; | |||||
| private: | |||||
| void cb_vol_i(Fl_Value_Slider*, void*); | |||||
| static void cb_vol(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *vsns; | |||||
| private: | |||||
| void cb_vsns_i(Fl_Value_Slider*, void*); | |||||
| static void cb_vsns(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| WidgetPDial *pan; | |||||
| private: | |||||
| void cb_pan_i(WidgetPDial*, void*); | |||||
| static void cb_pan(WidgetPDial*, void*); | |||||
| public: | |||||
| EnvelopeUI *ampenv; | |||||
| Fl_Counter *filterstages; | |||||
| private: | |||||
| void cb_filterstages_i(Fl_Counter*, void*); | |||||
| static void cb_filterstages(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Choice *magtype; | |||||
| private: | |||||
| void cb_magtype_i(Fl_Choice*, void*); | |||||
| static void cb_magtype(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_magtype[]; | |||||
| public: | |||||
| Fl_Choice *start; | |||||
| private: | |||||
| void cb_start_i(Fl_Choice*, void*); | |||||
| static void cb_start(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_start[]; | |||||
| public: | |||||
| Fl_Group *freqsettingsui; | |||||
| EnvelopeUI *freqenvelopegroup; | |||||
| Fl_Check_Button *freqee; | |||||
| private: | |||||
| void cb_freqee_i(Fl_Check_Button*, void*); | |||||
| static void cb_freqee(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Counter *octave; | |||||
| private: | |||||
| void cb_octave_i(Fl_Counter*, void*); | |||||
| static void cb_octave(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Counter *coarsedet; | |||||
| private: | |||||
| void cb_coarsedet_i(Fl_Counter*, void*); | |||||
| static void cb_coarsedet(Fl_Counter*, void*); | |||||
| public: | |||||
| Fl_Slider *detune; | |||||
| private: | |||||
| void cb_detune_i(Fl_Slider*, void*); | |||||
| static void cb_detune(Fl_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Output *detunevalueoutput; | |||||
| private: | |||||
| void cb_detunevalueoutput_i(Fl_Value_Output*, void*); | |||||
| static void cb_detunevalueoutput(Fl_Value_Output*, void*); | |||||
| public: | |||||
| Fl_Check_Button *hz440; | |||||
| private: | |||||
| void cb_hz440_i(Fl_Check_Button*, void*); | |||||
| static void cb_hz440(Fl_Check_Button*, void*); | |||||
| public: | |||||
| WidgetPDial *fixedfreqetdial; | |||||
| private: | |||||
| void cb_fixedfreqetdial_i(WidgetPDial*, void*); | |||||
| static void cb_fixedfreqetdial(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *detunetype; | |||||
| private: | |||||
| void cb_detunetype_i(Fl_Choice*, void*); | |||||
| static void cb_detunetype(Fl_Choice*, void*); | |||||
| public: | |||||
| Fl_Check_Button *stereo; | |||||
| private: | |||||
| void cb_stereo_i(Fl_Check_Button*, void*); | |||||
| static void cb_stereo(Fl_Check_Button*, void*); | |||||
| void cb_Clear_i(Fl_Button*, void*); | |||||
| static void cb_Clear(Fl_Button*, void*); | |||||
| public: | |||||
| Fl_Group *bandwidthsettingsui; | |||||
| EnvelopeUI *bandwidthenvelopegroup; | |||||
| Fl_Check_Button *bwee; | |||||
| private: | |||||
| void cb_bwee_i(Fl_Check_Button*, void*); | |||||
| static void cb_bwee(Fl_Check_Button*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *bandwidth; | |||||
| private: | |||||
| void cb_bandwidth_i(Fl_Value_Slider*, void*); | |||||
| static void cb_bandwidth(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Value_Slider *bwidthscale; | |||||
| private: | |||||
| void cb_bwidthscale_i(Fl_Value_Slider*, void*); | |||||
| static void cb_bwidthscale(Fl_Value_Slider*, void*); | |||||
| public: | |||||
| Fl_Group *globalfiltergroup; | |||||
| EnvelopeUI *filterenv; | |||||
| FilterUI *filterui; | |||||
| Fl_Check_Button *filtere; | |||||
| private: | |||||
| void cb_filtere_i(Fl_Check_Button*, void*); | |||||
| static void cb_filtere(Fl_Check_Button*, void*); | |||||
| void cb_C_i(Fl_Button*, void*); | |||||
| static void cb_C(Fl_Button*, void*); | |||||
| void cb_P_i(Fl_Button*, void*); | |||||
| static void cb_P(Fl_Button*, void*); | |||||
| public: | |||||
| void refresh(); | |||||
| SUBnoteUI(SUBnoteParameters *parameters); | |||||
| ~SUBnoteUI(); | |||||
| private: | |||||
| SUBnoteParameters *pars; | |||||
| SUBnoteharmonic *h[MAX_SUB_HARMONICS]; | |||||
| }; | |||||
| #endif | |||||
| @@ -0,0 +1,545 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #include "zynaddsubfx/UI/VirKeyboard.h" | |||||
| //Copyright (c) 2002-2005 Nasca Octavian Paul | |||||
| //License: GNU GPL version 2 or later | |||||
| static const int keyspos[12]={0,-1,1,-2,2,3,-4,4,-5,5,-6,6}; | |||||
| static const int keysoct1qwerty[]={'q','2','w','3','e','r','5','t','6','y','7','u','i','9','o','0','p','[','=',']','\\',FL_Enter,0}; | |||||
| static const int keysoct2qwerty[]={'z','s','x','d','c','v','g','b','h','n','j','m',',','l','.',';','/',0}; | |||||
| static const int keysoct1dw[]={'\'','2',',','3','.','p','5','y','6','f','7','g','c','9','r','0','l','/',']','=','\\',FL_Enter,0}; | |||||
| static const int keysoct2dw[]={';','o','q','e','j','k','i','x','d','b','h','m','w','n','v','s','z',0}; | |||||
| static const int keysoct1qwertz[]={'q','2','w','3','e','r','5','t','6','z','7','u','i','9','o','0','p',252,'\'','+','\\',FL_Enter,0}; | |||||
| static const int keysoct2qwertz[]={'y','s','x','d','c','v','g','b','h','n','j','m',',','l','.',246,'-',0}; | |||||
| static const int keysoct1az[]={'a',233,'z','\"','e','r','(','t','-','y',232,'u','i',231,'o',224,'p',65106,'=','$',0}; | |||||
| static const int keysoct2az[]={'w','s','x','d','c','v','g','b','h','n','j',',',';','l',':','m','!',0}; | |||||
| VirKeys::VirKeys(int x,int y, int w, int h, const char *label):Fl_Box(x,y,w,h,label) { | |||||
| master=NULL; | |||||
| } | |||||
| void VirKeys::init(Master *master_) { | |||||
| master=master_; | |||||
| for (int i=0;i<N_OCT*12+1;i++) pressed[i]=0; | |||||
| midich=0; | |||||
| midivel=100; | |||||
| midioct=2; | |||||
| keyoct1=3; | |||||
| keyoct2=2; | |||||
| rndvelocity=0; | |||||
| } | |||||
| void VirKeys::draw() { | |||||
| int ox=x(),oy=y(),lx=w(),ly=h()-1,i; | |||||
| #ifdef NTK_GUI | |||||
| Fl_Image *white_up = Fl_Shared_Image::get( gUiPixmapPath + "white_key.png" ); | |||||
| Fl_Image *white_down = Fl_Shared_Image::get( gUiPixmapPath + "white_key_pressed.png" ); | |||||
| Fl_Image *black_up = Fl_Shared_Image::get( gUiPixmapPath + "black_key.png" ); | |||||
| Fl_Image *black_down = Fl_Shared_Image::get( gUiPixmapPath + "black_key_pressed.png" ); | |||||
| //On error fetch everything from source directory | |||||
| if(!(white_up&&white_down&&black_up&&black_down)) { | |||||
| white_up = Fl_Shared_Image::get(SOURCE_DIR "/../../pixmaps/white_key.png"); | |||||
| white_down = Fl_Shared_Image::get(SOURCE_DIR "/../../pixmaps/white_key_pressed.png"); | |||||
| black_up = Fl_Shared_Image::get(SOURCE_DIR "/../../pixmaps/black_key.png"); | |||||
| black_down = Fl_Shared_Image::get(SOURCE_DIR "/../../pixmaps/black_key_pressed.png"); | |||||
| } | |||||
| Fl_Image *key; | |||||
| for (i=0;i<N_OCT*12;i++) { | |||||
| int noct=i/12; | |||||
| int kv=keyspos[i%12]; | |||||
| if (kv>=0){//white keys | |||||
| if (pressed[i]==0) | |||||
| key = white_up; | |||||
| else | |||||
| key = white_down; | |||||
| key->draw( ox + (kv + 7 * noct ) * white_up->w() + 3, oy ); | |||||
| } | |||||
| } | |||||
| for (i=0;i<N_OCT*12;i++){ | |||||
| int noct=i/12; | |||||
| int kv=keyspos[i%12]; | |||||
| if ( kv < 0 ) { | |||||
| kv=keyspos[(i+1)%12]; | |||||
| if (pressed[i]==0) | |||||
| key = black_up; | |||||
| else | |||||
| key = black_down; | |||||
| key->draw( ox + (kv + 7 * noct ) * white_up->w() - black_up->w() / 2 + 2, oy ); | |||||
| } | |||||
| } | |||||
| #else | |||||
| if (damage()!=1){ | |||||
| fl_color(250,240,230); | |||||
| fl_rectf(ox,oy,lx,ly); | |||||
| fl_color(FL_BLACK); | |||||
| fl_line(ox,oy,ox+lx,oy); | |||||
| fl_line(ox,oy+ly,ox+lx,oy+ly); | |||||
| for (i=0;i<N_OCT*7+1;i++){ | |||||
| fl_line(ox+i*SIZE_WHITE,oy,ox+i*SIZE_WHITE,oy+ly); | |||||
| int ik=i%7; | |||||
| if ((ik==1)||(ik==2)||(ik==4)||(ik==5)||(ik==6)) | |||||
| fl_rectf(ox+i*SIZE_WHITE-SIZE_BLACK/2,oy, | |||||
| SIZE_BLACK+1,ly*3/5); | |||||
| } | |||||
| } | |||||
| for (i=0;i<N_OCT*12;i++){ | |||||
| // if (pressed[i]==0) continue; | |||||
| int noct=i/12; | |||||
| int kv=keyspos[i%12]; | |||||
| if (kv>=0){//white keys | |||||
| if (pressed[i]==0) fl_color(250,240,230); | |||||
| else fl_color(FL_BLUE); | |||||
| fl_rectf(ox+(kv+7*noct)*SIZE_WHITE+3,oy+ly*3/5+2, | |||||
| SIZE_WHITE-4,ly*2/5-3); | |||||
| } else {//black keys | |||||
| kv=keyspos[(i+1)%12]; | |||||
| if (pressed[i]==0) fl_color(FL_BLACK); | |||||
| else fl_color(FL_BLUE); | |||||
| fl_rectf(ox+(kv+7*noct)*SIZE_WHITE-SIZE_BLACK/2+2,oy+2, | |||||
| SIZE_BLACK-3,ly*3/5-5); | |||||
| } | |||||
| } | |||||
| #endif | |||||
| } | |||||
| int VirKeys::handle(int event) { | |||||
| int i; | |||||
| int ly=h(); | |||||
| int x_=Fl::event_x()-x(); | |||||
| int y_=Fl::event_y()-y(); | |||||
| if ( (x_<0)&&(x_>w()) && (y_<0)&&(y_>h())){ | |||||
| return(0); | |||||
| }; | |||||
| if ((event==FL_PUSH)||(event==FL_DRAG)||(event==FL_RELEASE)){ | |||||
| int kpos=-1; | |||||
| if (y_>ly*3/5){//white keys | |||||
| int pos=x_/SIZE_WHITE; | |||||
| if (pos<0) return(1); | |||||
| for (i=0;i<12;i++) { | |||||
| if (pos%7==keyspos[i]) { | |||||
| kpos=pos/7*12+i; | |||||
| break; | |||||
| }; | |||||
| }; | |||||
| } else {//black keys | |||||
| int pos=(x_+SIZE_WHITE/2)/SIZE_WHITE; | |||||
| if (pos<0) return(1); | |||||
| for (i=1;i<12;i++) { | |||||
| if (pos%7==-keyspos[i]) { | |||||
| kpos=pos/7*12+i; | |||||
| break; | |||||
| }; | |||||
| }; | |||||
| }; | |||||
| if ((kpos!=-1)&&((event==FL_PUSH)||(event==FL_DRAG))&& | |||||
| (Fl::event_shift()==0)) { | |||||
| presskey(kpos,1,1); | |||||
| }; | |||||
| if ((event==FL_PUSH)&&(Fl::event_shift()!=0)) { | |||||
| if (pressed[kpos]==0) presskey(kpos,0,1); | |||||
| else relasekey(kpos,1); | |||||
| }; | |||||
| if ((event==FL_RELEASE)&&(Fl::event_shift()==0)) | |||||
| relaseallkeys(1); | |||||
| take_focus(); | |||||
| }; | |||||
| const int *keysoct1=keysoct1qwerty; | |||||
| const int *keysoct2=keysoct2qwerty; | |||||
| if (config.cfg.VirKeybLayout==2) { | |||||
| keysoct1=keysoct1dw; | |||||
| keysoct2=keysoct2dw; | |||||
| }else if (config.cfg.VirKeybLayout==3) { | |||||
| keysoct1=keysoct1qwertz; | |||||
| keysoct2=keysoct2qwertz; | |||||
| }else if (config.cfg.VirKeybLayout==4) { | |||||
| keysoct1=keysoct1az; | |||||
| keysoct2=keysoct2az; | |||||
| }; | |||||
| if ((event==FL_KEYDOWN)||(event==FL_KEYUP)){ | |||||
| int key=Fl::event_key(); | |||||
| int kpos=-1; | |||||
| for (i=0;keysoct1[i]!=0;i++) if (key==keysoct1[i]) kpos=i+12*keyoct1; | |||||
| for (i=0;keysoct2[i]!=0;i++) if (key==keysoct2[i]) kpos=i+12*keyoct2; | |||||
| if (kpos==-1) return(0); | |||||
| if ((event==FL_KEYUP) && (Fl::event_key(key)==0) && (Fl::get_key(key)!=0)) return(0); | |||||
| if (event==FL_KEYDOWN) presskey(kpos,0,2); | |||||
| else relasekey(kpos,2); | |||||
| }; | |||||
| return(1); | |||||
| } | |||||
| void VirKeys::presskey(int nk,int exclusive,int type) { | |||||
| //Exclusive means that multiple keys can be pressed at once | |||||
| //when the user uses the shift key | |||||
| if (nk>=N_OCT*12) return; | |||||
| if ((nk<0)&&(exclusive==0)) { | |||||
| relaseallkeys(type); | |||||
| return; | |||||
| }; | |||||
| if (nk<0) return; | |||||
| if (pressed[nk]!=0) return;//the key is already pressed | |||||
| if (exclusive!=0) relaseallkeys(type); | |||||
| pressed[nk]=type; | |||||
| damage(1); | |||||
| float vel=midivel; | |||||
| if (rndvelocity!=0){ | |||||
| vel=midivel*(127.0-rndvelocity)/127.0+RND*rndvelocity; | |||||
| }; | |||||
| pthread_mutex_lock(&master->mutex); | |||||
| master->noteOn(midich,nk+midioct*12,(int)vel); | |||||
| pthread_mutex_unlock(&master->mutex); | |||||
| } | |||||
| void VirKeys::relasekey(int nk,int type) { | |||||
| if ((nk<0)||(nk>=N_OCT*12)) return; | |||||
| if (pressed[nk]==0) return;//the key is not pressed | |||||
| if ((type!=0)&&(pressed[nk]!=type)) return; | |||||
| pressed[nk]=0; | |||||
| damage(1); | |||||
| pthread_mutex_lock(&master->mutex); | |||||
| master->noteOff(midich,nk+12*midioct); | |||||
| pthread_mutex_unlock(&master->mutex); | |||||
| } | |||||
| void VirKeys::relaseallkeys(int type) { | |||||
| for (int i=0;i<N_OCT*12;i++) relasekey(i,type); | |||||
| } | |||||
| void VirKeyboard::cb_virkeyboardwindow_i(Fl_Double_Window*, void*) { | |||||
| relaseallkeys(); | |||||
| virkeyboardwindow->hide(); | |||||
| } | |||||
| void VirKeyboard::cb_virkeyboardwindow(Fl_Double_Window* o, void* v) { | |||||
| ((VirKeyboard*)(o->user_data()))->cb_virkeyboardwindow_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_qwer_i(Fl_Counter* o, void*) { | |||||
| relaseallkeys(); | |||||
| virkeys->keyoct1=(int) o->value(); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_qwer(Fl_Counter* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_qwer_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_zxcv_i(Fl_Counter* o, void*) { | |||||
| relaseallkeys(); | |||||
| virkeys->keyoct2=(int) o->value(); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_zxcv(Fl_Counter* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_zxcv_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_Vel_i(Fl_Value_Slider* o, void*) { | |||||
| virkeys->midivel=(int) o->value(); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_Vel(Fl_Value_Slider* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_Vel_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_Oct_i(Fl_Counter* o, void*) { | |||||
| relaseallkeys(); | |||||
| virkeys->midioct=(int) o->value(); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_Oct(Fl_Counter* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_Oct_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_Close_i(Fl_Button*, void*) { | |||||
| relaseallkeys(); | |||||
| virkeyboardwindow->hide(); | |||||
| } | |||||
| void VirKeyboard::cb_Close(Fl_Button* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_Close_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_Cval_i(Fl_Value_Slider* o, void*) { | |||||
| int ctl=midictl; | |||||
| pthread_mutex_lock(&master->mutex); | |||||
| master->setController(virkeys->midich,ctl,(int) o->value()); | |||||
| pthread_mutex_unlock(&master->mutex); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_Cval(Fl_Value_Slider* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_Cval_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_Controller_i(Fl_Choice* o, void*) { | |||||
| switch((int) o->value()+1){ | |||||
| case 1: midictl=C_modwheel; break; | |||||
| case 2: midictl=C_volume; break; | |||||
| case 3: midictl=C_panning; break; | |||||
| case 4: midictl=C_expression; break; | |||||
| case 5: midictl=C_sustain; break; | |||||
| case 6: midictl=C_portamento; break; | |||||
| case 7: midictl=C_filterq; break; | |||||
| case 8: midictl=C_filtercutoff; break; | |||||
| case 9: midictl=C_bandwidth; break; | |||||
| case 10: midictl=C_fmamp; break; | |||||
| case 11: midictl=C_resonance_center; break; | |||||
| case 12: midictl=C_resonance_bandwidth; break; | |||||
| default: midictl=C_NULL; break; | |||||
| }; | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_Controller(Fl_Choice* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_Controller_i(o,v); | |||||
| } | |||||
| Fl_Menu_Item VirKeyboard::menu_Controller[] = { | |||||
| {"01: Mod.Wheel", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"07: Volume", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"10: Panning", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"11: Expression", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"64: Sustain", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"65: Portamento", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"71: Filter Q", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"74: Filter Freq.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"75: Bandwidth", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"76: FM Gain", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"77: Res. c. freq", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {"78: Res. bw.", 0, 0, 0, 0, FL_NORMAL_LABEL, 1, 10, 0}, | |||||
| {0,0,0,0,0,0,0,0,0} | |||||
| }; | |||||
| void VirKeyboard::cb_pitchwheelroller_i(Fl_Roller* o, void*) { | |||||
| pthread_mutex_lock(&master->mutex); | |||||
| master->setController(virkeys->midich,C_pitchwheel,-(int) o->value()); | |||||
| pthread_mutex_unlock(&master->mutex); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_pitchwheelroller(Fl_Roller* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_pitchwheelroller_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_R_i(Fl_Button*, void*) { | |||||
| pitchwheelroller->value(0); | |||||
| pitchwheelroller->do_callback(); | |||||
| } | |||||
| void VirKeyboard::cb_R(Fl_Button* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_R_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_Vrnd_i(WidgetPDial* o, void*) { | |||||
| virkeys->rndvelocity=(int) o->value(); | |||||
| } | |||||
| void VirKeyboard::cb_Vrnd(WidgetPDial* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_Vrnd_i(o,v); | |||||
| } | |||||
| void VirKeyboard::cb_partrcv_i(Fl_Choice* o, void*) { | |||||
| relaseallkeys(); | |||||
| virkeys->midich=(int) o->value(); | |||||
| virkeys->take_focus(); | |||||
| } | |||||
| void VirKeyboard::cb_partrcv(Fl_Choice* o, void* v) { | |||||
| ((VirKeyboard*)(o->parent()->user_data()))->cb_partrcv_i(o,v); | |||||
| } | |||||
| Fl_Double_Window* VirKeyboard::make_window() { | |||||
| { virkeyboardwindow = new Fl_Double_Window(650, 130, "Virtual Keyboard - ZynAddSubFX"); | |||||
| virkeyboardwindow->callback((Fl_Callback*)cb_virkeyboardwindow, (void*)(this)); | |||||
| { VirKeys* o = virkeys = new VirKeys(10, 10, 590, 80, "Keyboard"); | |||||
| virkeys->box(FL_FLAT_BOX); | |||||
| virkeys->color((Fl_Color)17); | |||||
| virkeys->selection_color(FL_BACKGROUND_COLOR); | |||||
| virkeys->labeltype(FL_NORMAL_LABEL); | |||||
| virkeys->labelfont(0); | |||||
| virkeys->labelsize(14); | |||||
| virkeys->labelcolor(FL_FOREGROUND_COLOR); | |||||
| virkeys->align(Fl_Align(FL_ALIGN_CENTER)); | |||||
| virkeys->when(FL_WHEN_RELEASE); | |||||
| o->init(master); | |||||
| } // VirKeys* virkeys | |||||
| { Fl_Counter* o = new Fl_Counter(380, 95, 45, 15, "\"qwer..\" Oct"); | |||||
| o->tooltip("keys \"q2w3er5t6y...\" octave"); | |||||
| o->type(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(5); | |||||
| o->step(1); | |||||
| o->textfont(1); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_qwer); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT)); | |||||
| o->when(FL_WHEN_RELEASE_ALWAYS); | |||||
| o->value(virkeys->keyoct1); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Counter* o = new Fl_Counter(380, 110, 45, 15, "\"zxcv..\" Oct"); | |||||
| o->tooltip("keys \"zsxdcvgbh...\" octave"); | |||||
| o->type(1); | |||||
| o->labelsize(10); | |||||
| o->minimum(0); | |||||
| o->maximum(5); | |||||
| o->step(1); | |||||
| o->textfont(1); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_zxcv); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT)); | |||||
| o->when(FL_WHEN_RELEASE_ALWAYS); | |||||
| o->value(virkeys->keyoct2); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Value_Slider* o = new Fl_Value_Slider(95, 105, 100, 15, "Vel"); | |||||
| o->tooltip("Velocity"); | |||||
| o->type(5); | |||||
| o->box(FL_NO_BOX); | |||||
| o->labelsize(10); | |||||
| o->minimum(1); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->callback((Fl_Callback*)cb_Vel); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->value(virkeys->midivel); | |||||
| } // Fl_Value_Slider* o | |||||
| { Fl_Counter* o = new Fl_Counter(255, 100, 55, 20, "Oct."); | |||||
| o->tooltip("Midi Octave"); | |||||
| o->type(1); | |||||
| o->labelsize(11); | |||||
| o->minimum(0); | |||||
| o->maximum(5); | |||||
| o->step(1); | |||||
| o->textfont(1); | |||||
| o->textsize(11); | |||||
| o->callback((Fl_Callback*)cb_Oct); | |||||
| o->align(Fl_Align(FL_ALIGN_LEFT)); | |||||
| o->when(FL_WHEN_RELEASE_ALWAYS); | |||||
| o->value(virkeys->midioct); | |||||
| } // Fl_Counter* o | |||||
| { Fl_Button* o = new Fl_Button(545, 105, 55, 20, "Close"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->callback((Fl_Callback*)cb_Close); | |||||
| } // Fl_Button* o | |||||
| { Fl_Value_Slider* o = new Fl_Value_Slider(605, 10, 15, 115, "Cval"); | |||||
| o->tooltip("Controller value"); | |||||
| o->type(2); | |||||
| o->box(FL_ENGRAVED_BOX); | |||||
| o->selection_color((Fl_Color)229); | |||||
| o->labelsize(8); | |||||
| o->minimum(127); | |||||
| o->maximum(0); | |||||
| o->step(1); | |||||
| o->value(64); | |||||
| o->textsize(7); | |||||
| o->callback((Fl_Callback*)cb_Cval); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| } // Fl_Value_Slider* o | |||||
| { Fl_Choice* o = new Fl_Choice(435, 105, 100, 15, "Controller"); | |||||
| o->down_box(FL_BORDER_BOX); | |||||
| o->labelsize(10); | |||||
| o->textfont(1); | |||||
| o->textsize(10); | |||||
| o->callback((Fl_Callback*)cb_Controller); | |||||
| o->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| o->when(FL_WHEN_RELEASE_ALWAYS); | |||||
| o->menu(menu_Controller); | |||||
| midictl=C_filtercutoff;o->value(7); | |||||
| } // Fl_Choice* o | |||||
| { pitchwheelroller = new Fl_Roller(625, 10, 20, 95, "Pwh"); | |||||
| pitchwheelroller->tooltip("Pitch Wheel"); | |||||
| pitchwheelroller->labelsize(8); | |||||
| pitchwheelroller->minimum(-8192); | |||||
| pitchwheelroller->maximum(8192); | |||||
| pitchwheelroller->step(64); | |||||
| pitchwheelroller->callback((Fl_Callback*)cb_pitchwheelroller); | |||||
| pitchwheelroller->align(Fl_Align(FL_ALIGN_TOP)); | |||||
| pitchwheelroller->when(3); | |||||
| } // Fl_Roller* pitchwheelroller | |||||
| { Fl_Button* o = new Fl_Button(625, 110, 20, 15, "R"); | |||||
| o->tooltip("Reset Pitch Bend"); | |||||
| o->box(FL_THIN_UP_BOX); | |||||
| o->labelfont(1); | |||||
| o->callback((Fl_Callback*)cb_R); | |||||
| } // Fl_Button* o | |||||
| { WidgetPDial* o = new WidgetPDial(205, 105, 20, 20, "Vrnd"); | |||||
| o->tooltip("Velocity Randomness"); | |||||
| o->box(FL_ROUND_UP_BOX); | |||||
| o->color(FL_BACKGROUND_COLOR); | |||||
| o->selection_color(FL_INACTIVE_COLOR); | |||||
| o->labeltype(FL_NORMAL_LABEL); | |||||
| o->labelfont(0); | |||||
| o->labelsize(10); | |||||
| o->labelcolor(FL_FOREGROUND_COLOR); | |||||
| o->maximum(127); | |||||
| o->step(1); | |||||
| o->callback((Fl_Callback*)cb_Vrnd); | |||||
| o->align(Fl_Align(129)); | |||||
| o->when(FL_WHEN_CHANGED); | |||||
| o->value(virkeys->rndvelocity); | |||||
| } // WidgetPDial* o | |||||
| { Fl_Choice* o = partrcv = new Fl_Choice(20, 105, 65, 20, "MIDI Ch."); | |||||
| partrcv->tooltip("Send to Midi Channel"); | |||||
| partrcv->down_box(FL_BORDER_BOX); | |||||
| partrcv->labelsize(10); | |||||
| partrcv->textfont(1); | |||||
| partrcv->textsize(10); | |||||
| partrcv->callback((Fl_Callback*)cb_partrcv); | |||||
| partrcv->align(Fl_Align(FL_ALIGN_TOP_LEFT)); | |||||
| char nrstr[10]; for(int i=0;i<NUM_MIDI_CHANNELS;i++){sprintf(nrstr,"Chn%d",i+1);if (i!=9) o->add(nrstr); else o->add("Drum10");}; | |||||
| o->value(virkeys->midich); | |||||
| } // Fl_Choice* partrcv | |||||
| virkeyboardwindow->end(); | |||||
| } // Fl_Double_Window* virkeyboardwindow | |||||
| return virkeyboardwindow; | |||||
| } | |||||
| VirKeyboard::VirKeyboard(Master *master_) { | |||||
| master=master_; | |||||
| midictl=75; | |||||
| make_window(); | |||||
| } | |||||
| VirKeyboard::~VirKeyboard() { | |||||
| delete virkeyboardwindow; | |||||
| } | |||||
| void VirKeyboard::show() { | |||||
| virkeyboardwindow->show(); | |||||
| } | |||||
| void VirKeyboard::relaseallkeys() { | |||||
| virkeys->relaseallkeys(0); | |||||
| } | |||||
| @@ -0,0 +1,94 @@ | |||||
| // generated by Fast Light User Interface Designer (fluid) version 1.0300 | |||||
| #ifndef VirKeyboard_h | |||||
| #define VirKeyboard_h | |||||
| #include <FL/Fl.H> | |||||
| #include <stdlib.h> | |||||
| #include <FL/fl_draw.H> | |||||
| #include <FL/Fl_Box.H> | |||||
| #include "../globals.h" | |||||
| #include "../Misc/Master.h" | |||||
| #include "../Misc/Util.h" | |||||
| #include "WidgetPDial.h" | |||||
| #include "common.H" | |||||
| #ifdef NTK_GUI | |||||
| #include "FL/Fl_Shared_Image.H" | |||||
| #endif | |||||
| class VirKeys : public Fl_Box { | |||||
| static const int N_OCT=6; | |||||
| static const int SIZE_WHITE=14; | |||||
| static const int SIZE_BLACK=8; | |||||
| public: | |||||
| VirKeys(int x,int y, int w, int h, const char *label=0); | |||||
| void init(Master *master_); | |||||
| void draw(); | |||||
| int handle(int event); | |||||
| void presskey(int nk,int exclusive,int type); | |||||
| void relasekey(int nk,int type); | |||||
| void relaseallkeys(int type); | |||||
| private: | |||||
| Master *master; | |||||
| int pressed[N_OCT*12+1]; | |||||
| public: | |||||
| unsigned char midich; | |||||
| unsigned char midivel; | |||||
| char midioct,keyoct1,keyoct2; | |||||
| unsigned char rndvelocity; | |||||
| }; | |||||
| #include <FL/Fl_Double_Window.H> | |||||
| #include <FL/Fl_Counter.H> | |||||
| #include <FL/Fl_Value_Slider.H> | |||||
| #include <FL/Fl_Button.H> | |||||
| #include <FL/Fl_Choice.H> | |||||
| #include <FL/Fl_Roller.H> | |||||
| class VirKeyboard { | |||||
| public: | |||||
| Fl_Double_Window* make_window(); | |||||
| Fl_Double_Window *virkeyboardwindow; | |||||
| private: | |||||
| void cb_virkeyboardwindow_i(Fl_Double_Window*, void*); | |||||
| static void cb_virkeyboardwindow(Fl_Double_Window*, void*); | |||||
| public: | |||||
| VirKeys *virkeys; | |||||
| private: | |||||
| void cb_qwer_i(Fl_Counter*, void*); | |||||
| static void cb_qwer(Fl_Counter*, void*); | |||||
| void cb_zxcv_i(Fl_Counter*, void*); | |||||
| static void cb_zxcv(Fl_Counter*, void*); | |||||
| void cb_Vel_i(Fl_Value_Slider*, void*); | |||||
| static void cb_Vel(Fl_Value_Slider*, void*); | |||||
| void cb_Oct_i(Fl_Counter*, void*); | |||||
| static void cb_Oct(Fl_Counter*, void*); | |||||
| void cb_Close_i(Fl_Button*, void*); | |||||
| static void cb_Close(Fl_Button*, void*); | |||||
| void cb_Cval_i(Fl_Value_Slider*, void*); | |||||
| static void cb_Cval(Fl_Value_Slider*, void*); | |||||
| void cb_Controller_i(Fl_Choice*, void*); | |||||
| static void cb_Controller(Fl_Choice*, void*); | |||||
| static Fl_Menu_Item menu_Controller[]; | |||||
| public: | |||||
| Fl_Roller *pitchwheelroller; | |||||
| private: | |||||
| void cb_pitchwheelroller_i(Fl_Roller*, void*); | |||||
| static void cb_pitchwheelroller(Fl_Roller*, void*); | |||||
| void cb_R_i(Fl_Button*, void*); | |||||
| static void cb_R(Fl_Button*, void*); | |||||
| void cb_Vrnd_i(WidgetPDial*, void*); | |||||
| static void cb_Vrnd(WidgetPDial*, void*); | |||||
| public: | |||||
| Fl_Choice *partrcv; | |||||
| private: | |||||
| void cb_partrcv_i(Fl_Choice*, void*); | |||||
| static void cb_partrcv(Fl_Choice*, void*); | |||||
| public: | |||||
| VirKeyboard(Master *master_); | |||||
| ~VirKeyboard(); | |||||
| void show(); | |||||
| void relaseallkeys(); | |||||
| private: | |||||
| Master *master; | |||||
| int midictl; | |||||
| }; | |||||
| #endif | |||||
| @@ -83,14 +83,14 @@ | |||||
| #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 | #define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 | #define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_audio_formats 1 | #define JUCE_MODULE_AVAILABLE_juce_audio_formats 1 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_audio_processors 0 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_audio_processors 1 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_audio_utils 0 | #define JUCE_MODULE_AVAILABLE_juce_audio_utils 0 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_core 1 | #define JUCE_MODULE_AVAILABLE_juce_core 1 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_cryptography 0 | #define JUCE_MODULE_AVAILABLE_juce_cryptography 0 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_data_structures 0 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_data_structures 1 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_events 1 | #define JUCE_MODULE_AVAILABLE_juce_events 1 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_graphics 0 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_gui_basics 0 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_graphics 1 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_gui_basics 1 | |||||
| #define JUCE_MODULE_AVAILABLE_juce_gui_extra 0 | #define JUCE_MODULE_AVAILABLE_juce_gui_extra 0 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_opengl 0 | #define JUCE_MODULE_AVAILABLE_juce_opengl 0 | ||||
| #define JUCE_MODULE_AVAILABLE_juce_video 0 | #define JUCE_MODULE_AVAILABLE_juce_video 0 | ||||
| @@ -27,9 +27,9 @@ QStyle* CarlaStylePlugin::create(const QString& key) | |||||
| return (key.toLower() == "carla") ? new CarlaStyle() : nullptr; | return (key.toLower() == "carla") ? new CarlaStyle() : nullptr; | ||||
| } | } | ||||
| QStringList CarlaStylePlugin::keys() const | |||||
| { | |||||
| return QStringList() << "Carla"; | |||||
| } | |||||
| // QStringList CarlaStylePlugin::keys() const | |||||
| // { | |||||
| // return QStringList() << "Carla"; | |||||
| // } | |||||
| Q_EXPORT_PLUGIN2(Carla, CarlaStylePlugin) | Q_EXPORT_PLUGIN2(Carla, CarlaStylePlugin) | ||||
| @@ -20,7 +20,11 @@ | |||||
| #include "CarlaStyle.hpp" | #include "CarlaStyle.hpp" | ||||
| #include <QtGui/QStylePlugin> | |||||
| #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||||
| # include <QtWidgets/QStylePlugin> | |||||
| #else | |||||
| # include <QtGui/QStylePlugin> | |||||
| #endif | |||||
| class CarlaStylePlugin : public QStylePlugin | class CarlaStylePlugin : public QStylePlugin | ||||
| { | { | ||||
| @@ -29,7 +33,7 @@ class CarlaStylePlugin : public QStylePlugin | |||||
| public: | public: | ||||
| CarlaStylePlugin(QObject* parent = nullptr); | CarlaStylePlugin(QObject* parent = nullptr); | ||||
| QStyle* create(const QString& key) override; | QStyle* create(const QString& key) override; | ||||
| QStringList keys() const override; | |||||
| //QStringList keys() const override; | |||||
| }; | }; | ||||
| #endif // CARLA_STYLE_PLUGIN_HPP_INCLUDED | #endif // CARLA_STYLE_PLUGIN_HPP_INCLUDED | ||||
| @@ -94,8 +94,6 @@ const char* PluginType2Str(const PluginType type) | |||||
| return "PLUGIN_LV2"; | return "PLUGIN_LV2"; | ||||
| case PLUGIN_VST: | case PLUGIN_VST: | ||||
| return "PLUGIN_VST"; | return "PLUGIN_VST"; | ||||
| case PLUGIN_VST3: | |||||
| return "PLUGIN_VST3"; | |||||
| case PLUGIN_AU: | case PLUGIN_AU: | ||||
| return "PLUGIN_AU"; | return "PLUGIN_AU"; | ||||
| case PLUGIN_CSOUND: | case PLUGIN_CSOUND: | ||||
| @@ -443,8 +441,6 @@ const char* getPluginTypeAsString(const PluginType type) | |||||
| return "LV2"; | return "LV2"; | ||||
| case PLUGIN_VST: | case PLUGIN_VST: | ||||
| return "VST"; | return "VST"; | ||||
| case PLUGIN_VST3: | |||||
| return "VST3"; | |||||
| case PLUGIN_AU: | case PLUGIN_AU: | ||||
| return "AU"; | return "AU"; | ||||
| case PLUGIN_CSOUND: | case PLUGIN_CSOUND: | ||||
| @@ -485,8 +481,6 @@ PluginType getPluginTypeFromString(const char* const stype) | |||||
| return PLUGIN_LV2; | return PLUGIN_LV2; | ||||
| if (std::strcmp(stype, "VST") == 0) | if (std::strcmp(stype, "VST") == 0) | ||||
| return PLUGIN_VST; | return PLUGIN_VST; | ||||
| if (std::strcmp(stype, "VST3") == 0) | |||||
| return PLUGIN_VST3; | |||||
| if (std::strcmp(stype, "AU") == 0) | if (std::strcmp(stype, "AU") == 0) | ||||
| return PLUGIN_AU; | return PLUGIN_AU; | ||||
| if (std::strcmp(stype, "CSOUND") == 0) | if (std::strcmp(stype, "CSOUND") == 0) | ||||
| @@ -504,16 +504,12 @@ void fillXmlStringFromSaveState(QString& content, const SaveState& saveState) | |||||
| info += QString(" <Binary>%1</Binary>\n").arg(xmlSafeString(saveState.binary, true)); | info += QString(" <Binary>%1</Binary>\n").arg(xmlSafeString(saveState.binary, true)); | ||||
| info += QString(" <UniqueID>%1</UniqueID>\n").arg(saveState.uniqueID); | info += QString(" <UniqueID>%1</UniqueID>\n").arg(saveState.uniqueID); | ||||
| break; | break; | ||||
| case PLUGIN_VST3: | |||||
| // TODO? | |||||
| info += QString(" <Binary>%1</Binary>\n").arg(xmlSafeString(saveState.binary, true)); | |||||
| info += QString(" <UniqueID>%1</UniqueID>\n").arg(saveState.uniqueID); | |||||
| break; | |||||
| case PLUGIN_AU: | case PLUGIN_AU: | ||||
| // TODO? | // TODO? | ||||
| info += QString(" <Binary>%1</Binary>\n").arg(xmlSafeString(saveState.binary, true)); | info += QString(" <Binary>%1</Binary>\n").arg(xmlSafeString(saveState.binary, true)); | ||||
| info += QString(" <UniqueID>%1</UniqueID>\n").arg(saveState.uniqueID); | info += QString(" <UniqueID>%1</UniqueID>\n").arg(saveState.uniqueID); | ||||
| break; | break; | ||||
| case PLUGIN_CSOUND: | |||||
| case PLUGIN_GIG: | case PLUGIN_GIG: | ||||
| case PLUGIN_SF2: | case PLUGIN_SF2: | ||||
| case PLUGIN_SFZ: | case PLUGIN_SFZ: | ||||