diff options
author | André Nusser <andre.nusser@googlemail.com> | 2017-04-22 13:09:42 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-22 13:17:42 +0200 |
commit | cc0f25cd2b9fc5856f16b71a412ce8c17edc39a7 (patch) | |
tree | 8054bd08a5c19b5265d790106906532884c9bb13 | |
parent | d4e2178776342e046886f9426d752fa6a7808350 (diff) |
Include new information into the status frame.
-rw-r--r-- | plugingui/statusframecontent.cc | 52 | ||||
-rw-r--r-- | plugingui/statusframecontent.h | 10 | ||||
-rw-r--r-- | src/drumkit.cc | 5 | ||||
-rw-r--r-- | src/drumkit.h | 1 | ||||
-rw-r--r-- | src/drumkitloader.cc | 8 | ||||
-rw-r--r-- | src/settings.h | 25 |
6 files changed, 100 insertions, 1 deletions
diff --git a/plugingui/statusframecontent.cc b/plugingui/statusframecontent.cc index 196c0d3..928aeaa 100644 --- a/plugingui/statusframecontent.cc +++ b/plugingui/statusframecontent.cc @@ -35,12 +35,22 @@ StatusframeContent::StatusframeContent( { CONNECT(this, settings_notifier.drumkit_load_status, this, &StatusframeContent::updateDrumkitLoadStatus); + CONNECT(this, settings_notifier.drumkit_name, + this, &StatusframeContent::updateDrumkitName); + CONNECT(this, settings_notifier.drumkit_description, + 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.enable_resampling, this, &StatusframeContent::updateResamplingEnabled); + CONNECT(this, settings_notifier.resampling_active, + this, &StatusframeContent::updateResamplingActive); CONNECT(this, settings_notifier.number_of_underruns, this, &StatusframeContent::updateNumberOfUnderruns); @@ -62,8 +72,13 @@ void StatusframeContent::updateContent() text_field.setText( "Drumkit load status: " + drumkit_load_status + "\n" "Midimap load status: " + midimap_load_status + "\n" + "Drumkit name: " + drumkit_name + "\n" + "Drumkit description: " + drumkit_description + "\n" + "Drumkit version: " + drumkit_version + "\n" + "Drumkit samplerate: " + drumkit_samplerate + "\n" "Samplerate: " + samplerate + "\n" "Resampling enabled: " + resampling_enabled + "\n" + "Resampling active: " + resampling_active + "\n" "Number of underruns: " + number_of_underruns + "\n" ); } @@ -89,6 +104,36 @@ void StatusframeContent::updateDrumkitLoadStatus(LoadStatus load_status) updateContent(); } +void StatusframeContent::updateDrumkitName(std::string const& drumkit_name) +{ + this->drumkit_name = drumkit_name; + + updateContent(); +} + +void StatusframeContent::updateDrumkitDescription(std::string const& drumkit_description) +{ + this->drumkit_description = drumkit_description; + + updateContent(); +} + +void StatusframeContent::updateDrumkitVersion(std::string const& drumkit_version) +{ + this->drumkit_version = 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) @@ -124,6 +169,13 @@ void StatusframeContent::updateResamplingEnabled(bool enable_resampling) updateContent(); } +void StatusframeContent::updateResamplingActive(bool resampling_active) +{ + this->resampling_active = resampling_active ? "yes" : "no"; + + updateContent(); +} + void StatusframeContent::updateNumberOfUnderruns( std::size_t number_of_underruns) { diff --git a/plugingui/statusframecontent.h b/plugingui/statusframecontent.h index 0ca5bfe..20fbfd9 100644 --- a/plugingui/statusframecontent.h +++ b/plugingui/statusframecontent.h @@ -46,9 +46,14 @@ public: void updateContent(); void updateDrumkitLoadStatus(LoadStatus load_status); + 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 updateResamplingEnabled(bool enable_resampling); + void updateResamplingActive(bool resampling_active); void updateNumberOfUnderruns(std::size_t number_of_underruns); private: @@ -57,9 +62,14 @@ private: SettingsNotifier& settings_notifier; std::string drumkit_load_status; + 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 resampling_enabled; + std::string resampling_active; std::string number_of_underruns; }; diff --git a/src/drumkit.cc b/src/drumkit.cc index abef1b8..e557de1 100644 --- a/src/drumkit.cc +++ b/src/drumkit.cc @@ -68,6 +68,11 @@ std::string DrumKit::getDescription() const return _description; } +VersionStr DrumKit::getVersion() const +{ + return _version; +} + std::size_t DrumKit::getSamplerate() const { return _samplerate; diff --git a/src/drumkit.h b/src/drumkit.h index f646b22..682dbff 100644 --- a/src/drumkit.h +++ b/src/drumkit.h @@ -44,6 +44,7 @@ public: std::string getName() const; std::string getDescription() const; + VersionStr getVersion() const; Instruments instruments; Channels channels; diff --git a/src/drumkitloader.cc b/src/drumkitloader.cc index e4d34f2..eed5a33 100644 --- a/src/drumkitloader.cc +++ b/src/drumkitloader.cc @@ -125,12 +125,18 @@ bool DrumKitLoader::loadkit(const std::string& file) "Trying to load it anyway...\n"); } + // Put some information about the kit into the settings + settings.drumkit_name = kit.getName(); + settings.drumkit_description = kit.getDescription(); + settings.drumkit_version = kit.getVersion(); + settings.drumkit_samplerate = kit.getSamplerate(); + loadKit(&kit); #ifdef WITH_RESAMPLER resamplers.setup(kit.getSamplerate(), settings.samplerate.load()); #endif/*WITH_RESAMPLER*/ - + settings.resampling_active.store(resamplers.isActive()); DEBUG(loadkit, "loadkit: Success\n"); diff --git a/src/settings.h b/src/settings.h index 3f9f9ae..61f92e7 100644 --- a/src/settings.h +++ b/src/settings.h @@ -48,6 +48,10 @@ struct Settings { Atomic<std::string> drumkit_file{""}; Atomic<LoadStatus> drumkit_load_status{LoadStatus::Idle}; + Atomic<std::string> drumkit_name{""}; + Atomic<std::string> drumkit_description{""}; + Atomic<std::string> drumkit_version{""}; + Atomic<std::size_t> drumkit_samplerate{0}; //! The maximum amount of memory in bytes that the AudioCache //! is allowed to use for preloading. Default is 1GB. @@ -76,6 +80,7 @@ struct Settings Atomic<double> samplerate{44100.0}; Atomic<bool> enable_resampling{true}; + Atomic<bool> resampling_active{false}; Atomic<std::size_t> number_of_files{0}; Atomic<std::size_t> number_of_files_loaded{0}; @@ -87,6 +92,10 @@ struct SettingsGetter { SettingRef<std::string> drumkit_file; SettingRef<LoadStatus> drumkit_load_status; + SettingRef<std::string> drumkit_name; + SettingRef<std::string> drumkit_description; + SettingRef<std::string> drumkit_version; + SettingRef<std::size_t> drumkit_samplerate; SettingRef<std::size_t> disk_cache_upper_limit; SettingRef<std::size_t> disk_cache_chunk_size; @@ -107,6 +116,7 @@ struct SettingsGetter SettingRef<double> samplerate; SettingRef<bool> enable_resampling; + SettingRef<bool> resampling_active; SettingRef<std::size_t> number_of_files; SettingRef<std::size_t> number_of_files_loaded; @@ -115,6 +125,10 @@ struct SettingsGetter SettingsGetter(Settings& settings) : drumkit_file(settings.drumkit_file) , drumkit_load_status(settings.drumkit_load_status) + , drumkit_name(settings.drumkit_name) + , drumkit_description(settings.drumkit_description) + , drumkit_version(settings.drumkit_version) + , drumkit_samplerate(settings.drumkit_samplerate) , disk_cache_upper_limit(settings.disk_cache_upper_limit) , disk_cache_chunk_size(settings.disk_cache_chunk_size) , disk_cache_enable(settings.disk_cache_enable) @@ -129,6 +143,7 @@ struct SettingsGetter , velocity_randomiser_weight{settings.velocity_randomiser_weight} , samplerate{settings.samplerate} , enable_resampling{settings.enable_resampling} + , resampling_active{settings.resampling_active} , number_of_files{settings.number_of_files} , number_of_files_loaded{settings.number_of_files_loaded} , current_file{settings.current_file} @@ -142,6 +157,10 @@ class SettingsNotifier public: Notifier<std::string> drumkit_file; Notifier<LoadStatus> drumkit_load_status; + Notifier<std::string> drumkit_name; + Notifier<std::string> drumkit_description; + Notifier<std::string> drumkit_version; + Notifier<std::size_t> drumkit_samplerate; Notifier<std::size_t> disk_cache_upper_limit; Notifier<std::size_t> disk_cache_chunk_size; @@ -162,6 +181,7 @@ public: Notifier<double> samplerate; Notifier<bool> enable_resampling; + Notifier<bool> resampling_active; Notifier<std::size_t> number_of_files; Notifier<std::size_t> number_of_files_loaded; @@ -173,6 +193,10 @@ public: EVAL(drumkit_file); EVAL(drumkit_load_status); + EVAL(drumkit_name); + EVAL(drumkit_description); + EVAL(drumkit_version); + EVAL(drumkit_samplerate); EVAL(disk_cache_upper_limit); EVAL(disk_cache_chunk_size); @@ -193,6 +217,7 @@ public: EVAL(samplerate); EVAL(enable_resampling); + EVAL(resampling_active); EVAL(number_of_files); EVAL(number_of_files_loaded); |