Skip to content

Commit

Permalink
rework config into PresetParser, start ControlElementHost
Browse files Browse the repository at this point in the history
YAML config encapsulated in PresetParser
removed show-names config option (always show names)
removed auto-connect config option (always autoconnect)
renamed type knob -> float
start ControlElementHost implementation
truncate log file on every run
  • Loading branch information
drlight-code committed Feb 29, 2020
1 parent ae8c279 commit 05faa29
Show file tree
Hide file tree
Showing 17 changed files with 375 additions and 170 deletions.
15 changes: 6 additions & 9 deletions Presets/etudes/sinusoids.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@ network:
host: 127.0.0.1
port: 8888

interface:
show-names: true

controls:
- name: frequency
message: /sinusoids/sinusoids/freq
type: float
range: [0, 10]
default: 0.1
type: knob
message: /sinusoids/sinusoids/freq

- name: lambda
message: /sinusoids/sinusoids/lambda
type: float
range: [0, 10]
default: 0.1
type: knob
message: /sinusoids/sinusoids/lambda

- name: stroke width
message: /sinusoids/sinusoids/stroke-width
type: float
range: [0, 1]
default: 0.5
type: knob
message: /sinusoids/sinusoids/stroke-width
47 changes: 22 additions & 25 deletions Presets/panoramix-track-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,57 @@ network:
host: 127.0.0.1
port: 6789

interface:
show-names: true

controls:
- name: azimuth
message: /track/1/azim
type: float
range: [-180, 180]
default: 0
type: knob
message: /track/1/azim

- name: distance
message: /track/1/dist
type: float
range: [1, 100]
default: 1
type: knob
message: /track/1/dist

- name: gain-A
message: /track/1/bus/A/gain
message-mute: /track/1/bus/A/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/1/bus/A/gain
message-mute: /track/1/bus/A/mute

- name: gain-B
message: /track/1/bus/B/gain
message-mute: /track/1/bus/B/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/1/bus/B/gain
message-mute: /track/1/bus/B/mute

- name: gain-C
message: /track/1/bus/C/gain
message-mute: /track/1/bus/C/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/1/bus/C/gain
message-mute: /track/1/bus/C/mute

- name: gain-D
message: /track/1/bus/D/gain
message-mute: /track/1/bus/D/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/1/bus/D/gain
message-mute: /track/1/bus/D/mute

- name: gain-E
message: /track/1/bus/E/gain
message-mute: /track/1/bus/E/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/1/bus/E/gain
message-mute: /track/1/bus/E/mute

- name: gain-F
message: /track/1/bus/F/gain
message-mute: /track/1/bus/F/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/1/bus/F/gain
message-mute: /track/1/bus/F/mute
47 changes: 22 additions & 25 deletions Presets/panoramix-track-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,57 @@ network:
host: 127.0.0.1
port: 6789

interface:
show-names: true

controls:
- name: azimuth
message: /track/2/azim
type: float
range: [-180, 180]
default: 0
type: knob
message: /track/2/azim

- name: distance
message: /track/2/dist
type: float
range: [1, 100]
default: 1
type: knob
message: /track/2/dist

- name: gain-A
message: /track/2/bus/A/gain
message-mute: /track/2/bus/A/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/2/bus/A/gain
message-mute: /track/2/bus/A/mute

- name: gain-B
message: /track/2/bus/B/gain
message-mute: /track/2/bus/B/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/2/bus/B/gain
message-mute: /track/2/bus/B/mute

- name: gain-C
message: /track/2/bus/C/gain
message-mute: /track/2/bus/C/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/2/bus/C/gain
message-mute: /track/2/bus/C/mute

- name: gain-D
message: /track/2/bus/D/gain
message-mute: /track/2/bus/D/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/2/bus/D/gain
message-mute: /track/2/bus/D/mute

- name: gain-E
message: /track/2/bus/E/gain
message-mute: /track/2/bus/E/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/2/bus/E/gain
message-mute: /track/2/bus/E/mute

- name: gain-F
message: /track/2/bus/F/gain
message-mute: /track/2/bus/F/mute
type: float
range: [-24, 6]
default: -6
type: knob
message: /track/2/bus/F/gain
message-mute: /track/2/bus/F/mute
8 changes: 5 additions & 3 deletions Source/ControlContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ class ControlContainer :
public Component
{
public:
void resized() override;

std::list<ControlElementUIUniq> & getElementList();
void resized() override;

OSCSender & getOSCSender();

std::list<ControlElementUIUniq> & getElementList();

private:
std::list<ControlElementUIUniq> listControlElements;

OSCSender oscSender;
std::list<ControlElementUIUniq> listControlElements;
};
using ControlContainerUniq = std::unique_ptr<ControlContainer>;
12 changes: 9 additions & 3 deletions Source/ControlElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@
class ControlElement
{
public:

enum class Type {
Float,
Bool
};

struct CreateInfo {
std::string name;
Type type;

std::pair<float, float> range;
float defaultValue;

std::string name;
std::string message;
std::string messageMute;

bool showNames;
};

ControlElement
Expand Down
30 changes: 3 additions & 27 deletions Source/ControlElementFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,11 @@ ControlElementFactory
std::unique_ptr<ControlElementUI>
ControlElementFactory::
createControlElementUI
(YAML::Node configElement, YAML::Node configInterface)
(const ControlElement::CreateInfo & createInfo)
{
ControlElement::CreateInfo info;

auto name = configElement["name"].as<std::string>();
auto type = configElement["type"].as<std::string>();

if(!configInterface.IsNull()) {
auto showNames = configInterface["show-names"];
info.showNames =
showNames.IsScalar() ? showNames.as<bool>() : false;
}

std::unique_ptr<ControlElementUI> product;
if(type == "knob") {

auto range = configElement["range"];
info.range = std::make_pair(range[0].as<float>(),
range[1].as<float>());
info.defaultValue = configElement["default"].as<float>();

info.name = configElement["name"].as<std::string>();
info.message = configElement["message"].as<std::string>();

auto messageMute = configElement["message-mute"];
info.messageMute =
messageMute.IsScalar() ? messageMute.as<std::string>() : "";

product = std::make_unique<ControlElementKnob>(info, oscSender);
if(createInfo.type == ControlElement::Type::Float) {
product = std::make_unique<ControlElementKnob>(createInfo, oscSender);
product->registerSendValue();
}

Expand Down
5 changes: 1 addition & 4 deletions Source/ControlElementFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include <memory>

#include <yaml-cpp/yaml.h>

#include <JuceHeader.h>

class OscsendvstAudioProcessor;
Expand All @@ -37,8 +35,7 @@ class ControlElementFactory {

std::unique_ptr<ControlElementUI>
createControlElementUI
(YAML::Node configElement,
YAML::Node configInterface);
(const ControlElement::CreateInfo & createInfo);

private:
OSCSender & oscSender;
Expand Down
30 changes: 30 additions & 0 deletions Source/ControlElementHost.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
oscsend-vst - An audio plugin that speaks OSC.
Copyright (C) 2020 Patric Schmitz
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 3 of the License, or
(at your option) 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "ControlElementHost.h"


ControlElementHost::
ControlElementHost
(const CreateInfo & info,
OSCSender & oscSender) :
ControlElement(info, oscSender)
{
}
33 changes: 33 additions & 0 deletions Source/ControlElementHost.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
oscsend-vst - An audio plugin that speaks OSC.
Copyright (C) 2020 Patric Schmitz
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 3 of the License, or
(at your option) 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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "ControlElement.h"

class ControlElementHost :
public ControlElement
{
public:
ControlElementHost
(const CreateInfo & info,
OSCSender & oscSender);

};
Loading

0 comments on commit 05faa29

Please sign in to comment.