summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSander Vocke <sandervocke@gmail.com>2024-07-28 15:30:28 +0200
committerSander Vocke <sandervocke@gmail.com>2024-07-28 15:30:28 +0200
commit7e4886d67673e2f9543dd0f81a41734721c16e29 (patch)
tree840339da6ba1c3b1fd5d2c519011969252b4f53e /src
parentfaaaf5d328429fd2c3f38131f7a874d056761f3f (diff)
Experimental changes, kind of works
Diffstat (limited to 'src')
-rw-r--r--src/dgxmlparser.cc8
-rw-r--r--src/domloader.cc3
-rw-r--r--src/inputprocessor.cc9
-rw-r--r--src/instrument.cc4
-rw-r--r--src/midimapper.cc3
5 files changed, 21 insertions, 6 deletions
diff --git a/src/dgxmlparser.cc b/src/dgxmlparser.cc
index 180d4cd..e3650c7 100644
--- a/src/dgxmlparser.cc
+++ b/src/dgxmlparser.cc
@@ -334,6 +334,14 @@ bool parseInstrumentFile(const std::string& filename, InstrumentDOM& dom, LogFun
res &= attrcpy(dom.version, instrument, "version", logger, filename, true);
res &= attrcpy(dom.description, instrument, "description", logger, filename, true);
+ if(pugi::xml_node maybe_node = instrument.child("openness_choke_threshold"))
+ {
+ if(pugi::xml_text maybe_text = maybe_node.text())
+ {
+ dom.openness_choke_threshold = atof_nol(maybe_text.get());
+ }
+ }
+
pugi::xml_node channels = instrument.child("channels");
for(pugi::xml_node channel : channels.children("channel"))
{
diff --git a/src/domloader.cc b/src/domloader.cc
index c972f08..be51155 100644
--- a/src/domloader.cc
+++ b/src/domloader.cc
@@ -37,6 +37,8 @@
#include "cpp11fix.h"
+#include <iostream>
+
struct channel_attribute_t
{
std::string cname;
@@ -89,6 +91,7 @@ bool DOMLoader::loadDom(const std::string& basepath,
continue;
}
+ std::cout << "Instrument: " << instrumentdom.name << ", openness threshold: " << instrumentdom.openness_choke_threshold << std::endl;
auto instrument = std::make_unique<Instrument>(settings, random, instrumentdom.openness_choke_threshold);
instrument->setGroup(instrumentref.group);
instrument->_name = instrumentdom.name;
diff --git a/src/inputprocessor.cc b/src/inputprocessor.cc
index 6e5d205..213c31c 100644
--- a/src/inputprocessor.cc
+++ b/src/inputprocessor.cc
@@ -38,6 +38,8 @@
#include "velocityfilter.h"
#include "cpp11fix.h"
+#include <iostream>
+
class VelocityStorer
: public InputFilter
{
@@ -236,10 +238,11 @@ bool InputProcessor::processOpennessChange(event_t& event, Instrument &inst, flo
{
auto &state = instrument_states[event.instrument]; // Constructs if necessary
auto threshold = inst.getOpennessChokeThreshold();
+ std::cout << "openness: " << openness << " threshold: " << threshold << "\n";
- if(threshold > 0.0f &&
- state.openness > threshold && openness <= threshold)
+ if(threshold > 0.0f && openness <= threshold)
{
+ std::cout << "A\n";
// We crossed the openness threshold and should choke all running samples that have
// higher openness.
for(const auto& ch : kit.channels)
@@ -251,10 +254,12 @@ bool InputProcessor::processOpennessChange(event_t& event, Instrument &inst, flo
for(auto& event_sample : events_ds.iterateOver<SampleEvent>(ch.num))
{
+ std::cout << "B\n";
if(event_sample.instrument_id == event.instrument && // Only applies to self
event_sample.openness > threshold && // Only samples that are more open than the threshold
event_sample.rampdown_count == -1) // Only if not already ramping
{
+ std::cout << "C\n";
// Fixed group rampdown time of 68ms, independent of samplerate
applyChoke(settings, event_sample, 68, event.offset, pos);
}
diff --git a/src/instrument.cc b/src/instrument.cc
index 6556fb1..90665dd 100644
--- a/src/instrument.cc
+++ b/src/instrument.cc
@@ -31,10 +31,10 @@
#include "sample.h"
Instrument::Instrument(Settings& settings, Random& rand, float openness_choke_threshold)
- : settings(settings)
+ : openness_choke_threshold(openness_choke_threshold)
+ , settings(settings)
, rand(rand)
, sample_selection(settings, rand, powerlist)
- , openness_choke_threshold(openness_choke_threshold)
{
DEBUG(instrument, "new %p\n", this);
mod = 1.0;
diff --git a/src/midimapper.cc b/src/midimapper.cc
index b4de580..a61df47 100644
--- a/src/midimapper.cc
+++ b/src/midimapper.cc
@@ -32,8 +32,7 @@ MidimapEntry::MidimapEntry(MapFrom from_kind,
int from_id,
MapTo to_kind,
std::string instrument_name,
- InstrumentStateKind maybe_instrument_state_kind
- ) :
+ InstrumentStateKind maybe_instrument_state_kind) :
from_kind(from_kind)
, from_id(from_id)
, to_kind(to_kind)