@@ -325,7 +325,7 @@ protected: | |||||
virtual void setCustomData(const char* const key, const char* const value) | virtual void setCustomData(const char* const key, const char* const value) | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | ||||
} | } | ||||
@@ -93,9 +93,9 @@ protected: | |||||
writeMsg("control\n", 8); | writeMsg("control\n", 8); | ||||
std::sprintf(tmpBuf, "%i\n", index); | std::sprintf(tmpBuf, "%i\n", index); | ||||
writeAndFixMsg(tmpBuf); | |||||
writeMsg(tmpBuf); | |||||
std::sprintf(tmpBuf, "%f\n", value); | std::sprintf(tmpBuf, "%f\n", value); | ||||
writeAndFixMsg(tmpBuf); | |||||
writeMsg(tmpBuf); | |||||
} | } | ||||
void uiSetMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) override | void uiSetMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) override | ||||
@@ -106,16 +106,16 @@ protected: | |||||
writeMsg("program\n", 8); | writeMsg("program\n", 8); | ||||
std::sprintf(tmpBuf, "%i\n", channel); | std::sprintf(tmpBuf, "%i\n", channel); | ||||
writeAndFixMsg(tmpBuf); | |||||
writeMsg(tmpBuf); | |||||
std::sprintf(tmpBuf, "%i\n", bank); | std::sprintf(tmpBuf, "%i\n", bank); | ||||
writeAndFixMsg(tmpBuf); | |||||
writeMsg(tmpBuf); | |||||
std::sprintf(tmpBuf, "%i\n", program); | std::sprintf(tmpBuf, "%i\n", program); | ||||
writeAndFixMsg(tmpBuf); | |||||
writeMsg(tmpBuf); | |||||
} | } | ||||
void uiSetCustomData(const char* const key, const char* const value) override | void uiSetCustomData(const char* const key, const char* const value) override | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||||
CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); | |||||
CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | ||||
writeMsg("configure\n", 10); | writeMsg("configure\n", 10); | ||||
@@ -73,8 +73,8 @@ ifneq ($(WIN32),true) | |||||
# External-UI plugins | # External-UI plugins | ||||
OBJS += \ | OBJS += \ | ||||
bigmeter.cpp.o | |||||
# ext-notes.cpp.o | |||||
bigmeter.cpp.o \ | |||||
notes.cpp.o | |||||
endif | endif | ||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
@@ -234,6 +234,9 @@ midi-file.cpp.o: midi-file.cpp midi-base.hpp $(CXXDEPS) | |||||
midi-sequencer.cpp.o: midi-sequencer.cpp midi-base.hpp $(CXXDEPS) | midi-sequencer.cpp.o: midi-sequencer.cpp midi-base.hpp $(CXXDEPS) | ||||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | ||||
notes.cpp.o: notes.cpp $(CXXDEPS) ../CarlaNativeExtUI.hpp | |||||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | |||||
vex-%.cpp.o: vex-%.cpp | vex-%.cpp.o: vex-%.cpp | ||||
$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ | ||||
@@ -85,7 +85,7 @@ void carla_register_all_plugins() | |||||
// External-UI plugins | // External-UI plugins | ||||
carla_register_native_plugin_bigmeter(); | carla_register_native_plugin_bigmeter(); | ||||
//carla_register_native_plugin_notes(); | |||||
carla_register_native_plugin_notes(); | |||||
#endif | #endif | ||||
// DISTRHO plugins | // DISTRHO plugins | ||||
@@ -0,0 +1,128 @@ | |||||
/* | |||||
* Carla Native Plugins | |||||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||||
* | |||||
* This program is free software; you can redistribute it and/or | |||||
* modify it under the terms of the GNU General Public License as | |||||
* published by the Free Software Foundation; either version 2 of | |||||
* the License, or any later version. | |||||
* | |||||
* This program is distributed in the hope that it will be useful, | |||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
* GNU General Public License for more details. | |||||
* | |||||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||||
*/ | |||||
#include "CarlaDefines.h" | |||||
#ifdef CARLA_OS_WIN | |||||
# error This file should not be compiled for Windows | |||||
#endif | |||||
#include "CarlaNativeExtUI.hpp" | |||||
// ----------------------------------------------------------------------- | |||||
class NotesPlugin : public NativePluginAndUiClass | |||||
{ | |||||
public: | |||||
NotesPlugin(const NativeHostDescriptor* const host) | |||||
: NativePluginAndUiClass(host, "/notes-ui"), | |||||
fCurPage(1) | |||||
{ | |||||
} | |||||
protected: | |||||
// ------------------------------------------------------------------- | |||||
// Plugin parameter calls | |||||
uint32_t getParameterCount() const override | |||||
{ | |||||
return 1; | |||||
} | |||||
const NativeParameter* getParameterInfo(const uint32_t index) const override | |||||
{ | |||||
if (index != 0) | |||||
return nullptr; | |||||
static NativeParameter param; | |||||
param.hints = static_cast<NativeParameterHints>(PARAMETER_IS_ENABLED|PARAMETER_IS_AUTOMABLE|PARAMETER_IS_INTEGER); | |||||
param.name = "Page"; | |||||
param.unit = nullptr; | |||||
param.ranges.def = 1.0f; | |||||
param.ranges.min = 1.0f; | |||||
param.ranges.max = 100.0f; | |||||
param.ranges.step = 1.0f; | |||||
param.ranges.stepSmall = 1.0f; | |||||
param.ranges.stepLarge = 1.0f; | |||||
param.scalePointCount = 0; | |||||
param.scalePoints = nullptr; | |||||
return ¶m; | |||||
} | |||||
float getParameterValue(const uint32_t index) const override | |||||
{ | |||||
if (index != 0) | |||||
return 0.0f; | |||||
return static_cast<float>(fCurPage); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Plugin state calls | |||||
void setParameterValue(const uint32_t index, const float value) override | |||||
{ | |||||
if (index != 0) | |||||
return; | |||||
fCurPage = static_cast<int>(value); | |||||
} | |||||
// ------------------------------------------------------------------- | |||||
// Plugin process calls | |||||
void process(float**, float**, const uint32_t, const NativeMidiEvent* const, const uint32_t) override | |||||
{ | |||||
} | |||||
private: | |||||
int fCurPage; | |||||
PluginClassEND(NotesPlugin) | |||||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(NotesPlugin) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
static const NativePluginDescriptor notesDesc = { | |||||
/* category */ PLUGIN_CATEGORY_UTILITY, | |||||
/* hints */ static_cast<NativePluginHints>(PLUGIN_IS_RTSAFE|PLUGIN_HAS_UI), | |||||
/* supports */ static_cast<NativePluginSupports>(0x0), | |||||
/* audioIns */ 0, | |||||
/* audioOuts */ 0, | |||||
/* midiIns */ 0, | |||||
/* midiOuts */ 0, | |||||
/* paramIns */ 1, | |||||
/* paramOuts */ 0, | |||||
/* name */ "Notes", | |||||
/* label */ "notes", | |||||
/* maker */ "falkTX", | |||||
/* copyright */ "GNU GPL v2+", | |||||
PluginDescriptorFILL(NotesPlugin) | |||||
}; | |||||
// ----------------------------------------------------------------------- | |||||
CARLA_EXPORT | |||||
void carla_register_native_plugin_notes() | |||||
{ | |||||
carla_register_native_plugin(¬esDesc); | |||||
} | |||||
// ----------------------------------------------------------------------- |
@@ -85,7 +85,7 @@ class DistrhoUINotes(QWidget, ExternalUI): | |||||
self.showUiIfTesting() | self.showUiIfTesting() | ||||
def saveCurrentTextState(self): | def saveCurrentTextState(self): | ||||
pageKey = "pageText %i" % self.fCurPage | |||||
pageKey = "pageText #%i" % self.fCurPage | |||||
pageValue = self.fTextEdit.toPlainText() | pageValue = self.fTextEdit.toPlainText() | ||||
if pageValue != self.fNotes[self.fCurPage-1]: | if pageValue != self.fNotes[self.fCurPage-1]: | ||||
@@ -434,7 +434,7 @@ public: | |||||
fixedMsg[i] = '\r'; | fixedMsg[i] = '\r'; | ||||
} | } | ||||
if (fixedMsg[size+1] == '\r') | |||||
if (fixedMsg[size-1] == '\r') | |||||
{ | { | ||||
fixedMsg[size-1] = '\n'; | fixedMsg[size-1] = '\n'; | ||||
fixedMsg[size] = '\0'; | fixedMsg[size] = '\0'; | ||||