summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openness_crocellkit/Midimap_tiny_openness.xml2
-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
-rw-r--r--test/Makefile.am1
7 files changed, 23 insertions, 7 deletions
diff --git a/openness_crocellkit/Midimap_tiny_openness.xml b/openness_crocellkit/Midimap_tiny_openness.xml
index f347c72..8be9023 100644
--- a/openness_crocellkit/Midimap_tiny_openness.xml
+++ b/openness_crocellkit/Midimap_tiny_openness.xml
@@ -15,5 +15,5 @@
<map note="46" instr="HihatContinuous"/>
<map note="22" instr="HihatContinuous"/>
<map note="26" instr="HihatContinuous"/>
- <map cc="4" instr="HihatContinuous" control="openness" min="90" max="0"/>
+ <map cc="4" instr="HihatContinuous" control="openness"/>
</midimap>
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)
diff --git a/test/Makefile.am b/test/Makefile.am
index 0827cae..663d21f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -313,6 +313,7 @@ midimapparsertest_CXXFLAGS = \
midimapparsertest_LDFLAGS =
midimapparsertest_SOURCES = \
$(top_srcdir)/hugin/hugin.c \
+ $(top_srcdir)/src/midimapper.cc \
$(top_srcdir)/src/midimapparser.cc \
$(top_srcdir)/pugixml/src/pugixml.cpp \
scopedfile.cc \