@@ -14,7 +14,7 @@ ifeq ($(ARCH), lin) | |||||
LDFLAGS += -rdynamic \ | LDFLAGS += -rdynamic \ | ||||
-lpthread -lGL -ldl \ | -lpthread -lGL -ldl \ | ||||
$(shell pkg-config --libs gtk+-2.0) \ | $(shell pkg-config --libs gtk+-2.0) \ | ||||
-Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl | |||||
-Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl -lossia | |||||
TARGET = Rack | TARGET = Rack | ||||
endif | endif | ||||
@@ -23,7 +23,7 @@ ifeq ($(ARCH), mac) | |||||
CXXFLAGS += -DAPPLE -stdlib=libc++ | CXXFLAGS += -DAPPLE -stdlib=libc++ | ||||
LDFLAGS += -stdlib=libc++ -lpthread -ldl \ | LDFLAGS += -stdlib=libc++ -lpthread -ldl \ | ||||
-framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \ | -framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo \ | ||||
-Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl | |||||
-Ldep/lib -lGLEW -lglfw -ljansson -lspeexdsp -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl -lossia | |||||
TARGET = Rack | TARGET = Rack | ||||
BUNDLE = dist/$(TARGET).app | BUNDLE = dist/$(TARGET).app | ||||
endif | endif | ||||
@@ -34,7 +34,7 @@ ifeq ($(ARCH), win) | |||||
-Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \ | -Wl,--export-all-symbols,--out-implib,libRack.a -mwindows \ | ||||
-lgdi32 -lopengl32 -lcomdlg32 -lole32 \ | -lgdi32 -lopengl32 -lcomdlg32 -lole32 \ | ||||
-Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl \ | -Ldep/lib -lglew32 -lglfw3dll -lcurl -lzip -lrtaudio -lrtmidi -lcrypto -lssl \ | ||||
-Wl,-Bstatic -ljansson -lspeexdsp | |||||
-Wl,-Bstatic -ljansson -lspeexdsp -lossia | |||||
TARGET = Rack.exe | TARGET = Rack.exe | ||||
OBJECTS = Rack.res | OBJECTS = Rack.res | ||||
endif | endif | ||||
@@ -11,7 +11,7 @@ FLAGS += -Wall -Wextra -Wno-unused-parameter | |||||
ifneq ($(ARCH), mac) | ifneq ($(ARCH), mac) | ||||
CXXFLAGS += -Wsuggest-override | CXXFLAGS += -Wsuggest-override | ||||
endif | endif | ||||
CXXFLAGS += -std=c++11 | |||||
CXXFLAGS += -std=c++14 | |||||
ifeq ($(ARCH), lin) | ifeq ($(ARCH), lin) | ||||
@@ -3,20 +3,14 @@ LOCAL = $(shell pwd) | |||||
# Arch-specifics | # Arch-specifics | ||||
include ../arch.mk | include ../arch.mk | ||||
FLAGS += -g -O3 -march=nocona | |||||
ifeq ($(ARCH),mac) | ifeq ($(ARCH),mac) | ||||
FLAGS += -mmacosx-version-min=10.7 -stdlib=libc++ | |||||
LDFLAGS += -mmacosx-version-min=10.7 -stdlib=libc++ | |||||
MACOS_FLAGS = -mmacosx-version-min=10.7 -stdlib=libc++ | |||||
export CFLAGS = $(MACOS_FLAGS) | |||||
export CXXFLAGS = $(MACOS_FLAGS) | |||||
export CPPFLAGS = $(MACOS_FLAGS) | |||||
export LDFLAGS = $(MACOS_FLAGS) | |||||
endif | endif | ||||
CFLAGS += $(FLAGS) | |||||
CXXFLAGS += $(FLAGS) | |||||
export CFLAGS | |||||
export CXXFLAGS | |||||
export LDFLAGS | |||||
# Commands | # Commands | ||||
WGET = wget -nc | WGET = wget -nc | ||||
UNTAR = tar xf | UNTAR = tar xf | ||||
@@ -38,6 +32,7 @@ ifeq ($(ARCH),lin) | |||||
rtmidi = lib/librtmidi.so | rtmidi = lib/librtmidi.so | ||||
rtaudio = lib/librtaudio.so | rtaudio = lib/librtaudio.so | ||||
openssl = lib/libssl.so | openssl = lib/libssl.so | ||||
ossia = lib/libossia.so | |||||
endif | endif | ||||
ifeq ($(ARCH),mac) | ifeq ($(ARCH),mac) | ||||
@@ -50,6 +45,7 @@ ifeq ($(ARCH),mac) | |||||
rtmidi = lib/librtmidi.dylib | rtmidi = lib/librtmidi.dylib | ||||
rtaudio = lib/librtaudio.dylib | rtaudio = lib/librtaudio.dylib | ||||
openssl = lib/libssl.dylib | openssl = lib/libssl.dylib | ||||
ossia = lib/libossia.so | |||||
endif | endif | ||||
ifeq ($(ARCH),win) | ifeq ($(ARCH),win) | ||||
@@ -62,6 +58,7 @@ ifeq ($(ARCH),win) | |||||
rtmidi = bin/librtmidi-4.dll | rtmidi = bin/librtmidi-4.dll | ||||
rtaudio = bin/librtaudio.dll | rtaudio = bin/librtaudio.dll | ||||
openssl = bin/libssl-1_1-x64.dll | openssl = bin/libssl-1_1-x64.dll | ||||
ossia = bin/ossia.dll | |||||
endif | endif | ||||
# Library configuration | # Library configuration | ||||
@@ -80,7 +77,7 @@ endif | |||||
.NOTPARALLEL: | .NOTPARALLEL: | ||||
all: $(glew) $(glfw) $(jansson) $(libspeexdsp) $(libcurl) $(libzip) $(rtmidi) $(rtaudio) | |||||
all: $(glew) $(glfw) $(jansson) $(libspeexdsp) $(libcurl) $(libzip) $(rtmidi) $(rtaudio) $(ossia) | |||||
@echo "" | @echo "" | ||||
@echo "#######################################" | @echo "#######################################" | ||||
@echo "# Built all dependencies successfully #" | @echo "# Built all dependencies successfully #" | ||||
@@ -151,5 +148,14 @@ $(rtaudio): | |||||
$(MAKE) -C rtaudio/cmakebuild | $(MAKE) -C rtaudio/cmakebuild | ||||
$(MAKE) -C rtaudio/cmakebuild install | $(MAKE) -C rtaudio/cmakebuild install | ||||
$(ossia): | |||||
git clone https://github.com/OSSIA/libossia --depth=1 | |||||
mkdir -p build-libossia && cd build-libossia && $(CMAKE) \ | |||||
-DCMAKE_INSTALL_PREFIX="$(LOCAL)" -DOSSIA_PD=OFF \ | |||||
-DOSSIA_COTIRE=OFF -DOSSIA_PROTOCOL_MIDI=OFF \ | |||||
-DOSSIA_EDITOR=OFF -DBUILD_TYPE=Release ../libossia && \ | |||||
$(MAKE) -j4 && \ | |||||
$(MAKE) install | |||||
clean: | clean: | ||||
git clean -ffdx | git clean -ffdx |
@@ -3,12 +3,17 @@ | |||||
#include "util.hpp" | #include "util.hpp" | ||||
#include <jansson.h> | #include <jansson.h> | ||||
#include <ossia/network/network.hpp> | |||||
#include <ossia/network/oscquery/oscquery_server.hpp> | |||||
namespace rack { | namespace rack { | ||||
extern ossia::net::generic_device& root_dev(); | |||||
struct Param { | struct Param { | ||||
float value = 0.0; | float value = 0.0; | ||||
std::string name = "param.1"; | |||||
ossia::net::parameter_base* ossia_param; | |||||
}; | }; | ||||
struct Light { | struct Light { | ||||
@@ -41,7 +46,6 @@ struct Output { | |||||
Light plugLights[2]; | Light plugLights[2]; | ||||
}; | }; | ||||
struct Module { | struct Module { | ||||
std::vector<Param> params; | std::vector<Param> params; | ||||
std::vector<Input> inputs; | std::vector<Input> inputs; | ||||
@@ -49,6 +53,8 @@ struct Module { | |||||
std::vector<Light> lights; | std::vector<Light> lights; | ||||
/** For CPU usage meter */ | /** For CPU usage meter */ | ||||
float cpuTime = 0.0; | float cpuTime = 0.0; | ||||
ossia::net::node_base* node{}; | |||||
/** Deprecated, use constructor below this one */ | /** Deprecated, use constructor below this one */ | ||||
Module() DEPRECATED {} | Module() DEPRECATED {} | ||||
@@ -58,6 +64,8 @@ struct Module { | |||||
inputs.resize(numInputs); | inputs.resize(numInputs); | ||||
outputs.resize(numOutputs); | outputs.resize(numOutputs); | ||||
lights.resize(numLights); | lights.resize(numLights); | ||||
node = &ossia::net::create_node(rack::root_dev(),"module"); | |||||
} | } | ||||
virtual ~Module() {} | virtual ~Module() {} | ||||
@@ -3,6 +3,7 @@ | |||||
#include <list> | #include <list> | ||||
#include "tags.hpp" | #include "tags.hpp" | ||||
#include <ossia/network/network.hpp> | |||||
namespace rack { | namespace rack { | ||||
@@ -55,6 +56,8 @@ struct Model { | |||||
virtual ~Model() {} | virtual ~Model() {} | ||||
virtual ModuleWidget *createModuleWidget() { return NULL; } | virtual ModuleWidget *createModuleWidget() { return NULL; } | ||||
ossia::net::node_base* node; | |||||
}; | }; | ||||
void pluginInit(); | void pluginInit(); | ||||
@@ -8,7 +8,8 @@ | |||||
#include "gui.hpp" | #include "gui.hpp" | ||||
#include "app.hpp" | #include "app.hpp" | ||||
#include "components.hpp" | #include "components.hpp" | ||||
#include <iostream> | |||||
#include <sstream> | |||||
namespace rack { | namespace rack { | ||||
@@ -24,6 +25,8 @@ Model *createModel(std::string manufacturer, std::string slug, std::string name, | |||||
ModuleWidget *createModuleWidget() override { | ModuleWidget *createModuleWidget() override { | ||||
ModuleWidget *moduleWidget = new TModuleWidget(); | ModuleWidget *moduleWidget = new TModuleWidget(); | ||||
moduleWidget->model = this; | moduleWidget->model = this; | ||||
moduleWidget->module->node->set_name(name); | |||||
return moduleWidget; | return moduleWidget; | ||||
} | } | ||||
}; | }; | ||||
@@ -43,13 +46,38 @@ Widget *createScrew(Vec pos) { | |||||
} | } | ||||
template <class TParamWidget> | template <class TParamWidget> | ||||
ParamWidget *createParam(Vec pos, Module *module, int paramId, float minValue, float maxValue, float defaultValue) { | |||||
ParamWidget *createParam(Vec pos, Module *module, int paramId, float minValue, float maxValue, float defaultValue, std::string name = std::string("")) { | |||||
ParamWidget *param = new TParamWidget(); | ParamWidget *param = new TParamWidget(); | ||||
param->box.pos = pos; | param->box.pos = pos; | ||||
param->module = module; | param->module = module; | ||||
param->paramId = paramId; | param->paramId = paramId; | ||||
param->setLimits(minValue, maxValue); | |||||
auto& p = module->params[paramId]; | |||||
if (name == "") | |||||
{ | |||||
std::stringstream ss; | |||||
ss << "param." << paramId; | |||||
name = ss.str(); | |||||
} | |||||
auto& p_node = ossia::net::create_node(*module->node, name); | |||||
p.ossia_param = p_node.create_parameter(ossia::val_type::FLOAT); | |||||
p.ossia_param->set_domain(ossia::make_domain(minValue,maxValue)); | |||||
p.ossia_param->set_bounding(ossia::bounding_mode::CLIP); | |||||
p.ossia_param->push_value(defaultValue); | |||||
p.ossia_param->set_default_value(defaultValue); | |||||
p.ossia_param->add_callback([param] (const ossia::value& v) { | |||||
auto& p = param->module->params[param->paramId]; | |||||
param->value = v.get<float>(); | |||||
p.value = param->value; | |||||
if ( auto fbw = dynamic_cast<FramebufferWidget*>(param)) | |||||
fbw->dirty = true; | |||||
}); | |||||
param->setLimits(minValue, maxValue); | |||||
param->setDefaultValue(defaultValue); | param->setDefaultValue(defaultValue); | ||||
return param; | return param; | ||||
} | } | ||||
@@ -1,5 +1,7 @@ | |||||
#include "app.hpp" | #include "app.hpp" | ||||
#include <ossia/network/network.hpp> | |||||
#include <ossia/network/oscquery/oscquery_server.hpp> | |||||
namespace rack { | namespace rack { | ||||
@@ -28,5 +30,12 @@ void sceneDestroy() { | |||||
gScene = NULL; | gScene = NULL; | ||||
} | } | ||||
ossia::net::generic_device& root_dev(){ | |||||
static ossia::net::generic_device dev{ | |||||
std::make_unique<ossia::oscquery::oscquery_server_protocol>(1234, 5678), | |||||
"VCV-Rack"}; | |||||
return dev; | |||||
} | |||||
} // namespace rack | } // namespace rack |
@@ -11,7 +11,6 @@ | |||||
#include "engine.hpp" | #include "engine.hpp" | ||||
#include "util.hpp" | #include "util.hpp" | ||||
namespace rack { | namespace rack { | ||||
float sampleRate; | float sampleRate; | ||||
@@ -33,7 +32,6 @@ static Module *smoothModule = NULL; | |||||
static int smoothParamId; | static int smoothParamId; | ||||
static float smoothValue; | static float smoothValue; | ||||
float Light::getBrightness() { | float Light::getBrightness() { | ||||
return sqrtf(fmaxf(0.0, value)); | return sqrtf(fmaxf(0.0, value)); | ||||
} | } | ||||
@@ -76,11 +74,13 @@ static void engineStep() { | |||||
float delta = smoothValue - value; | float delta = smoothValue - value; | ||||
if (fabsf(delta) < snap) { | if (fabsf(delta) < snap) { | ||||
smoothModule->params[smoothParamId].value = smoothValue; | smoothModule->params[smoothParamId].value = smoothValue; | ||||
smoothModule->params[smoothParamId].ossia_param->push_value(smoothValue); | |||||
smoothModule = NULL; | smoothModule = NULL; | ||||
} | } | ||||
else { | else { | ||||
value += delta * lambda * sampleTime; | value += delta * lambda * sampleTime; | ||||
smoothModule->params[smoothParamId].value = value; | smoothModule->params[smoothParamId].value = value; | ||||
smoothModule->params[smoothParamId].ossia_param->push_value(value); | |||||
} | } | ||||
} | } | ||||
@@ -240,6 +240,7 @@ void engineRemoveWire(Wire *wire) { | |||||
void engineSetParam(Module *module, int paramId, float value) { | void engineSetParam(Module *module, int paramId, float value) { | ||||
module->params[paramId].value = value; | module->params[paramId].value = value; | ||||
module->params[paramId].ossia_param->push_value(value); | |||||
} | } | ||||
void engineSetParamSmooth(Module *module, int paramId, float value) { | void engineSetParamSmooth(Module *module, int paramId, float value) { | ||||
@@ -248,10 +249,12 @@ void engineSetParamSmooth(Module *module, int paramId, float value) { | |||||
// Since only one param can be smoothed at a time, if another param is currently being smoothed, skip to its final state | // Since only one param can be smoothed at a time, if another param is currently being smoothed, skip to its final state | ||||
if (smoothModule && !(smoothModule == module && smoothParamId == paramId)) { | if (smoothModule && !(smoothModule == module && smoothParamId == paramId)) { | ||||
smoothModule->params[smoothParamId].value = smoothValue; | smoothModule->params[smoothParamId].value = smoothValue; | ||||
smoothModule->params[smoothParamId].ossia_param->push_value(smoothValue); | |||||
} | } | ||||
smoothModule = module; | smoothModule = module; | ||||
smoothParamId = paramId; | smoothParamId = paramId; | ||||
smoothValue = value; | smoothValue = value; | ||||
module->params[paramId].ossia_param->push_value(smoothValue); | |||||
} | } | ||||
void engineSetSampleRate(float newSampleRate) { | void engineSetSampleRate(float newSampleRate) { | ||||