summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-05-01 19:34:07 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2017-05-01 19:34:07 +0200
commitca5cf0102d2617f1a701e7a0a011ef4b02b14d0b (patch)
tree635f6422aa732b2c13ce38b49fadae94ed62c815
parenta9256048bf2d9ec3ff6004a6dd6bf9e3a3f88294 (diff)
Show buffer size in status area.
-rw-r--r--plugingui/statusframecontent.cc10
-rw-r--r--plugingui/statusframecontent.h2
-rw-r--r--src/drumgizmo.cc2
-rw-r--r--src/settings.h5
4 files changed, 19 insertions, 0 deletions
diff --git a/plugingui/statusframecontent.cc b/plugingui/statusframecontent.cc
index d988c2c..e160da0 100644
--- a/plugingui/statusframecontent.cc
+++ b/plugingui/statusframecontent.cc
@@ -47,6 +47,8 @@ StatusframeContent::StatusframeContent(
this, &StatusframeContent::updateMidimapLoadStatus);
CONNECT(this, settings_notifier.samplerate,
this, &StatusframeContent::updateSamplerate);
+ CONNECT(this, settings_notifier.buffer_size,
+ this, &StatusframeContent::updateBufferSize);
CONNECT(this, settings_notifier.enable_resampling,
this, &StatusframeContent::updateResamplingEnabled);
CONNECT(this, settings_notifier.resampling_active,
@@ -77,6 +79,7 @@ void StatusframeContent::updateContent()
// "Drumkit version: " + drumkit_version + "\n"
"Drumkit samplerate: " + drumkit_samplerate + "\n"
"Session samplerate: " + samplerate + "\n"
+ "Session buffer size: " + buffer_size + "\n"
// "Resampling enabled: " + resampling_enabled + "\n"
"Resampling active: " + resampling_active + "\n"
"Number of underruns: " + number_of_underruns + "\n"
@@ -162,6 +165,13 @@ void StatusframeContent::updateSamplerate(double samplerate)
updateContent();
}
+void StatusframeContent::updateBufferSize(std::size_t buffer_size)
+{
+ this->buffer_size = std::to_string(buffer_size);
+
+ updateContent();
+}
+
void StatusframeContent::updateResamplingEnabled(bool enable_resampling)
{
this->resampling_enabled = enable_resampling ? "Yes" : "No";
diff --git a/plugingui/statusframecontent.h b/plugingui/statusframecontent.h
index 20fbfd9..c5fb8c4 100644
--- a/plugingui/statusframecontent.h
+++ b/plugingui/statusframecontent.h
@@ -52,6 +52,7 @@ public:
void updateDrumkitSamplerate(std::size_t drumkit_samplerate);
void updateMidimapLoadStatus(LoadStatus load_status);
void updateSamplerate(double samplerate);
+ void updateBufferSize(std::size_t buffer_size);
void updateResamplingEnabled(bool enable_resampling);
void updateResamplingActive(bool resampling_active);
void updateNumberOfUnderruns(std::size_t number_of_underruns);
@@ -68,6 +69,7 @@ private:
std::string drumkit_samplerate;
std::string midimap_load_status;
std::string samplerate;
+ std::string buffer_size;
std::string resampling_enabled;
std::string resampling_active;
std::string number_of_underruns;
diff --git a/src/drumgizmo.cc b/src/drumgizmo.cc
index 592fa20..e55acf6 100644
--- a/src/drumgizmo.cc
+++ b/src/drumgizmo.cc
@@ -77,6 +77,8 @@ bool DrumGizmo::init()
void DrumGizmo::setFrameSize(size_t framesize)
{
+ settings.buffer_size.store(framesize);
+
// If we are resampling override the frame size.
if(resamplers.isActive())
{
diff --git a/src/settings.h b/src/settings.h
index 61f92e7..76662c2 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -78,6 +78,7 @@ struct Settings
Atomic<float> velocity_randomiser_weight{0.1f};
Atomic<double> samplerate{44100.0};
+ Atomic<std::size_t> buffer_size{1024}; // Only used to show in the UI.
Atomic<bool> enable_resampling{true};
Atomic<bool> resampling_active{false};
@@ -114,6 +115,7 @@ struct SettingsGetter
SettingRef<float> velocity_randomiser_weight;
SettingRef<double> samplerate;
+ SettingRef<std::size_t> buffer_size;
SettingRef<bool> enable_resampling;
SettingRef<bool> resampling_active;
@@ -142,6 +144,7 @@ struct SettingsGetter
, enable_velocity_randomiser{settings.enable_velocity_randomiser}
, velocity_randomiser_weight{settings.velocity_randomiser_weight}
, samplerate{settings.samplerate}
+ , buffer_size(settings.buffer_size)
, enable_resampling{settings.enable_resampling}
, resampling_active{settings.resampling_active}
, number_of_files{settings.number_of_files}
@@ -179,6 +182,7 @@ public:
Notifier<float> velocity_randomiser_weight;
Notifier<double> samplerate;
+ Notifier<std::size_t> buffer_size;
Notifier<bool> enable_resampling;
Notifier<bool> resampling_active;
@@ -215,6 +219,7 @@ public:
EVAL(velocity_randomiser_weight);
EVAL(samplerate);
+ EVAL(buffer_size);
EVAL(enable_resampling);
EVAL(resampling_active);