summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/Makefile.am1
-rw-r--r--plugingui/maintab.cc17
-rw-r--r--plugingui/maintab.h4
-rw-r--r--plugingui/resamplingframecontent.cc92
-rw-r--r--plugingui/resamplingframecontent.h66
-rw-r--r--plugingui/statusframecontent.cc42
-rw-r--r--plugingui/statusframecontent.h8
7 files changed, 180 insertions, 50 deletions
diff --git a/plugingui/Makefile.am b/plugingui/Makefile.am
index a7ee485..a9da1db 100644
--- a/plugingui/Makefile.am
+++ b/plugingui/Makefile.am
@@ -79,6 +79,7 @@ nodist_libdggui_la_SOURCES = \
pluginconfig.cc \
powerbutton.cc \
progressbar.cc \
+ resamplingframecontent.cc \
resource.cc \
resource_data.cc \
scrollbar.cc \
diff --git a/plugingui/maintab.cc b/plugingui/maintab.cc
index 3458a72..503a0a1 100644
--- a/plugingui/maintab.cc
+++ b/plugingui/maintab.cc
@@ -38,6 +38,7 @@ MainTab::MainTab(Widget* parent,
, statusframe_content{this, settings_notifier}
, humanizerframe_content{this, settings, settings_notifier}
, diskstreamingframe_content{this, settings, settings_notifier}
+ , resamplingframe_content{this, settings, settings_notifier}
, settings(settings)
, settings_notifier(settings_notifier)
{
@@ -48,36 +49,47 @@ MainTab::MainTab(Widget* parent,
layout.addItem(&status_frame);
layout.addItem(&humanizer_frame);
layout.addItem(&diskstreaming_frame);
+ layout.addItem(&resampling_frame);
auto h1 = 20;
auto h2 = 22;
auto h3 = 13;
auto h4 = 11;
+ auto h5 = 14;
auto drumkit_range = GridLayout::GridRange{0, 1, 0, h1};
auto status_range = GridLayout::GridRange{0, 1, h1, h1 + h2};
auto humanizer_range = GridLayout::GridRange{1, 2, 0, h3};
auto diskstreaming_range = GridLayout::GridRange{1, 2, h3, h3 + h4};
+ auto resampling_range = GridLayout::GridRange{1, 2, h3 + h4, h3 + h4 + h5};
layout.setPosition(&drumkit_frame, drumkit_range);
layout.setPosition(&status_frame, status_range);
layout.setPosition(&humanizer_frame, humanizer_range);
layout.setPosition(&diskstreaming_frame, diskstreaming_range);
+ layout.setPosition(&resampling_frame, resampling_range);
drumkit_frame.setTitle("Drumkit");
status_frame.setTitle("Status");
humanizer_frame.setTitle("Humanizer");
diskstreaming_frame.setTitle("Disk streaming");
+ resampling_frame.setTitle("Resampling");
drumkit_frame.setContent(&drumkitframe_content);
status_frame.setContent(&statusframe_content);
humanizer_frame.setContent(&humanizerframe_content);
diskstreaming_frame.setContent(&diskstreamingframe_content);
+ resampling_frame.setContent(&resamplingframe_content);
humanizer_frame.setOnSwitch(settings.enable_velocity_modifier);
+ resampling_frame.setOnSwitch(settings.enable_resampling);
CONNECT(this, settings_notifier.enable_velocity_modifier,
&humanizer_frame, &FrameWidget::setOnSwitch);
+ CONNECT(this, settings_notifier.enable_resampling,
+ &resampling_frame, &FrameWidget::setOnSwitch);
CONNECT(&humanizer_frame, onSwitchChangeNotifier,
this, &MainTab::humanizerOnChange);
+ CONNECT(&resampling_frame, onSwitchChangeNotifier,
+ this, &MainTab::resamplingOnChange);
}
void MainTab::resize(std::size_t width, std::size_t height)
@@ -95,4 +107,9 @@ void MainTab::humanizerOnChange(bool on)
settings.enable_velocity_modifier.store(on);
}
+void MainTab::resamplingOnChange(bool on)
+{
+ settings.enable_resampling.store(on);
+}
+
} // GUI::
diff --git a/plugingui/maintab.h b/plugingui/maintab.h
index 62b3f82..ab7e760 100644
--- a/plugingui/maintab.h
+++ b/plugingui/maintab.h
@@ -33,6 +33,7 @@
#include "statusframecontent.h"
#include "humanizerframecontent.h"
#include "diskstreamingframecontent.h"
+#include "resamplingframecontent.h"
struct Settings;
class SettingsNotifier;
@@ -55,6 +56,7 @@ public:
private:
void humanizerOnChange(bool on);
+ void resamplingOnChange(bool on);
Image logo{":resources/logo.png"};
@@ -64,11 +66,13 @@ private:
FrameWidget status_frame{this, false};
FrameWidget humanizer_frame{this, true};
FrameWidget diskstreaming_frame{this, false};
+ FrameWidget resampling_frame{this, true};
DrumkitframeContent drumkitframe_content;
StatusframeContent statusframe_content;
HumanizerframeContent humanizerframe_content;
DiskstreamingframeContent diskstreamingframe_content;
+ ResamplingframeContent resamplingframe_content;
Settings& settings;
SettingsNotifier& settings_notifier;
diff --git a/plugingui/resamplingframecontent.cc b/plugingui/resamplingframecontent.cc
new file mode 100644
index 0000000..1f752d3
--- /dev/null
+++ b/plugingui/resamplingframecontent.cc
@@ -0,0 +1,92 @@
+/* -*- Mode: c++ -*- */
+/***************************************************************************
+ * resamplingframecontent.cc
+ *
+ * Fri May 5 23:43:28 CEST 2017
+ * Copyright 2017 André Nusser
+ * andre.nusser@googlemail.com
+ ****************************************************************************/
+
+/*
+ * This file is part of DrumGizmo.
+ *
+ * DrumGizmo is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DrumGizmo 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with DrumGizmo; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#include "resamplingframecontent.h"
+
+#include <settings.h>
+
+namespace GUI
+{
+
+ResamplingframeContent::ResamplingframeContent(
+ Widget* parent, Settings& settings, SettingsNotifier& settings_notifier)
+ : Widget(parent)
+ , settings(settings)
+ , settings_notifier(settings_notifier)
+{
+ CONNECT(this, settings_notifier.drumkit_samplerate,
+ this, &ResamplingframeContent::updateDrumkitSamplerate);
+ CONNECT(this, settings_notifier.samplerate,
+ this, &ResamplingframeContent::updateSessionSamplerate);
+ CONNECT(this, settings_notifier.resamplig_recommended,
+ this, &ResamplingframeContent::updateResamplingRecommended);
+
+ text_field.move(0, 0);
+ text_field.setReadOnly(true);
+
+ updateContent();
+ text_field.show();
+}
+
+void ResamplingframeContent::resize(std::size_t width, std::size_t height)
+{
+ Widget::resize(width, height);
+ text_field.resize(width, height);
+}
+
+void ResamplingframeContent::updateContent()
+{
+ text_field.setText(
+ "Session samplerate: " + session_samplerate + "\n"
+ "Drumkit samplerate: " + drumkit_samplerate + "\n"
+ "Resampling recommended: " + resamplig_recommended + "\n"
+ );
+}
+
+void ResamplingframeContent::updateDrumkitSamplerate(std::size_t drumkit_samplerate)
+{
+ this->drumkit_samplerate = drumkit_samplerate == 0
+ ? ""
+ : std::to_string(drumkit_samplerate);
+
+ updateContent();
+}
+
+void ResamplingframeContent::updateSessionSamplerate(double samplerate)
+{
+ this->session_samplerate = std::to_string((std::size_t)samplerate);
+
+ updateContent();
+}
+
+void ResamplingframeContent::updateResamplingRecommended(bool resamplig_recommended)
+{
+ this->resamplig_recommended = resamplig_recommended ? "Yes" : "No";
+
+ updateContent();
+}
+
+} // GUI::
diff --git a/plugingui/resamplingframecontent.h b/plugingui/resamplingframecontent.h
new file mode 100644
index 0000000..e98e09b
--- /dev/null
+++ b/plugingui/resamplingframecontent.h
@@ -0,0 +1,66 @@
+/* -*- Mode: c++ -*- */
+/***************************************************************************
+ * resamplingframecontent.h
+ *
+ * Fri May 5 23:43:28 CEST 2017
+ * Copyright 2017 André Nusser
+ * andre.nusser@googlemail.com
+ ****************************************************************************/
+
+/*
+ * This file is part of DrumGizmo.
+ *
+ * DrumGizmo is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * DrumGizmo 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with DrumGizmo; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ */
+#pragma once
+
+#include "widget.h"
+#include "textedit.h"
+
+struct Settings;
+class SettingsNotifier;
+
+namespace GUI
+{
+
+class ResamplingframeContent
+ : public Widget
+{
+public:
+ ResamplingframeContent(Widget* parent,
+ Settings& settings,
+ SettingsNotifier& settings_notifier);
+
+ // From Widget
+ virtual void resize(std::size_t width, std::size_t height) override;
+
+ void updateContent();
+
+ void updateDrumkitSamplerate(std::size_t drumkit_samplerate);
+ void updateSessionSamplerate(double samplerate);
+ void updateResamplingRecommended(bool resamplig_recommended);
+
+private:
+ TextEdit text_field{this};
+
+ Settings& settings;
+ SettingsNotifier& settings_notifier;
+
+ std::string drumkit_samplerate;
+ std::string session_samplerate;
+ std::string resamplig_recommended;
+};
+
+} // GUI::
diff --git a/plugingui/statusframecontent.cc b/plugingui/statusframecontent.cc
index e160da0..34903e8 100644
--- a/plugingui/statusframecontent.cc
+++ b/plugingui/statusframecontent.cc
@@ -41,18 +41,10 @@ StatusframeContent::StatusframeContent(
this, &StatusframeContent::updateDrumkitDescription);
CONNECT(this, settings_notifier.drumkit_version,
this, &StatusframeContent::updateDrumkitVersion);
- CONNECT(this, settings_notifier.drumkit_samplerate,
- this, &StatusframeContent::updateDrumkitSamplerate);
CONNECT(this, settings_notifier.midimap_load_status,
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,
- this, &StatusframeContent::updateResamplingActive);
CONNECT(this, settings_notifier.number_of_underruns,
this, &StatusframeContent::updateNumberOfUnderruns);
@@ -77,11 +69,7 @@ void StatusframeContent::updateContent()
"Drumkit name: " + drumkit_name + "\n"
"Drumkit description: " + drumkit_description + "\n"
// "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"
);
}
@@ -128,15 +116,6 @@ void StatusframeContent::updateDrumkitVersion(std::string const& drumkit_version
updateContent();
}
-void StatusframeContent::updateDrumkitSamplerate(std::size_t drumkit_samplerate)
-{
- this->drumkit_samplerate = drumkit_samplerate == 0
- ? ""
- : std::to_string(drumkit_samplerate);
-
- updateContent();
-}
-
void StatusframeContent::updateMidimapLoadStatus(LoadStatus load_status)
{
switch(load_status)
@@ -158,13 +137,6 @@ void StatusframeContent::updateMidimapLoadStatus(LoadStatus load_status)
updateContent();
}
-void StatusframeContent::updateSamplerate(double samplerate)
-{
- this->samplerate = std::to_string((std::size_t)samplerate);
-
- updateContent();
-}
-
void StatusframeContent::updateBufferSize(std::size_t buffer_size)
{
this->buffer_size = std::to_string(buffer_size);
@@ -172,20 +144,6 @@ void StatusframeContent::updateBufferSize(std::size_t buffer_size)
updateContent();
}
-void StatusframeContent::updateResamplingEnabled(bool enable_resampling)
-{
- this->resampling_enabled = enable_resampling ? "Yes" : "No";
-
- updateContent();
-}
-
-void StatusframeContent::updateResamplingActive(bool resampling_active)
-{
- this->resampling_active = resampling_active ? "Yes" : "No";
-
- updateContent();
-}
-
void StatusframeContent::updateNumberOfUnderruns(std::size_t number_of_underruns)
{
this->number_of_underruns = std::to_string(number_of_underruns);
diff --git a/plugingui/statusframecontent.h b/plugingui/statusframecontent.h
index c5fb8c4..4ca4f63 100644
--- a/plugingui/statusframecontent.h
+++ b/plugingui/statusframecontent.h
@@ -49,12 +49,8 @@ public:
void updateDrumkitName(std::string const& drumkit_name);
void updateDrumkitDescription(std::string const& drumkit_description);
void updateDrumkitVersion(std::string const& drumkit_version);
- 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);
private:
@@ -66,12 +62,8 @@ private:
std::string drumkit_name;
std::string drumkit_description;
std::string drumkit_version;
- 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;
};