From 66f273c8c46cd4544972eb05e9c2591deba03912 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 01:19:02 +0000 Subject: [PATCH 01/66] Correct output bus width after 128 ch update --- .../src/binaural_monitoring_plugin_processor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index 429e61026..495a8c99e 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -222,7 +222,7 @@ EarBinauralMonitoringAudioProcessor::_getBusProperties() { "Input", AudioChannelSet::discreteChannels(MAX_DAW_CHANNELS), true); ret = ret.withOutput("Left Ear", AudioChannelSet::mono(), true); ret = ret.withOutput("Right Ear", AudioChannelSet::mono(), true); - ret = ret.withOutput("(Unused)", AudioChannelSet::discreteChannels(62), true); + ret = ret.withOutput("(Unused)", AudioChannelSet::discreteChannels(MAX_DAW_CHANNELS-2), true); return ret; } From 3be260751a4735fa68f6513f17995c0df6c70cf2 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Mon, 8 Jan 2024 14:53:10 +0000 Subject: [PATCH 02/66] Correct isBusesLayoutSupported after 128ch update --- .../src/binaural_monitoring_plugin_processor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index 495a8c99e..cc8c5131d 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -336,7 +336,8 @@ bool EarBinauralMonitoringAudioProcessor::isBusesLayoutSupported( return false; if(layouts.outputBuses[1] != AudioChannelSet::mono()) return false; - if(layouts.outputBuses[2] != AudioChannelSet::discreteChannels(62)) + if (layouts.outputBuses[2] != + AudioChannelSet::discreteChannels(MAX_DAW_CHANNELS - 2)) return false; return true; From 11488c3be2f90be68183f276a8f573deb3f83d23 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 01:29:51 +0000 Subject: [PATCH 03/66] Fix missing default return in updateChannelCounts --- .../lib/src/binaural_monitoring_audio_processor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp b/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp index 9b5384ffe..791aca59a 100644 --- a/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp +++ b/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp @@ -218,6 +218,7 @@ bool BinauralMonitoringAudioProcessor::updateChannelCounts( // Do immediate update bearRenderer->set_config_blocking(bearConfig); } + return true; } } // namespace plugin From 0ac8bc1de3724163b2709344a025c1b18bad5c7c Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Tue, 9 Jan 2024 16:33:29 +0000 Subject: [PATCH 04/66] canClearSelection in EarComboBox --- shared/components/ear_combo_box.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/shared/components/ear_combo_box.hpp b/shared/components/ear_combo_box.hpp index 3490b9a5b..7759db7ed 100644 --- a/shared/components/ear_combo_box.hpp +++ b/shared/components/ear_combo_box.hpp @@ -366,11 +366,17 @@ class EarComboBox : public Component, void openPopup(); void closePopup(); + void setCanClearSelection(bool opt) { + canClearSelection = opt; + } + virtual bool keyPressed(const KeyPress& key) override { - if (key == KeyPress::deleteKey || key == KeyPress::backspaceKey) { - selectEntry(-1, sendNotificationAsync); - repaint(); - return true; + if (canClearSelection) { + if (key == KeyPress::deleteKey || key == KeyPress::backspaceKey) { + selectEntry(-1, sendNotificationAsync); + repaint(); + return true; + } } return false; } @@ -438,6 +444,7 @@ class EarComboBox : public Component, String defaultText_; ListenerList listeners_; std::unique_ptr popup_; + bool canClearSelection{ true }; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(EarComboBox) }; // namespace ui From 25b60c171b4c8cfde764271f5b4f2cafca2f92f1 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Tue, 9 Jan 2024 22:53:10 +0000 Subject: [PATCH 05/66] EarComboBoxEntry ID's can be variant type (using juce::var) --- .../direct_speakers_frontend_connector.cpp | 3 +- .../hoa/src/hoa_frontend_connector.cpp | 3 +- .../scene/src/programmes_container.cpp | 2 +- shared/components/ear_combo_box.cpp | 16 +++---- shared/components/ear_combo_box.hpp | 42 ++++++++++--------- 5 files changed, 36 insertions(+), 30 deletions(-) diff --git a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp index 277c15e40..1d82740d1 100644 --- a/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp +++ b/ear-production-suite-plugins/plugins/direct_speakers/src/direct_speakers_frontend_connector.cpp @@ -287,7 +287,8 @@ void DirectSpeakersJuceFrontendConnector::comboBoxChanged( EarComboBox* comboBox) { if (auto speakerSetupsComboBox = lockIfSame(speakerSetupsComboBox_, comboBox)) { if (speakerSetupsComboBox->hasSelection()) { - *(p_->getPackFormatIdValue()) = speakerSetupsComboBox->getSelectedId(); + juce::var id = speakerSetupsComboBox->getSelectedId(); + *(p_->getPackFormatIdValue()) = static_cast(id); } else { *(p_->getPackFormatIdValue()) = 0; } diff --git a/ear-production-suite-plugins/plugins/hoa/src/hoa_frontend_connector.cpp b/ear-production-suite-plugins/plugins/hoa/src/hoa_frontend_connector.cpp index 7b4f47cdf..7cd9e0d94 100644 --- a/ear-production-suite-plugins/plugins/hoa/src/hoa_frontend_connector.cpp +++ b/ear-production-suite-plugins/plugins/hoa/src/hoa_frontend_connector.cpp @@ -245,7 +245,8 @@ void HoaJuceFrontendConnector::trackPropertiesChanged( void HoaJuceFrontendConnector::comboBoxChanged(EarComboBox* comboBox) { if(auto hoaTypeComboBox = lockIfSame(hoaTypeComboBox_, comboBox)) { if(hoaTypeComboBox->hasSelection()) { - *(p_->getPackFormatIdValue()) = hoaTypeComboBox->getSelectedId(); + juce::var id = hoaTypeComboBox->getSelectedId(); + *(p_->getPackFormatIdValue()) = static_cast(id); } else { *(p_->getPackFormatIdValue()) = 0; } diff --git a/ear-production-suite-plugins/plugins/scene/src/programmes_container.cpp b/ear-production-suite-plugins/plugins/scene/src/programmes_container.cpp index 2c53ff794..c7bbb0037 100644 --- a/ear-production-suite-plugins/plugins/scene/src/programmes_container.cpp +++ b/ear-production-suite-plugins/plugins/scene/src/programmes_container.cpp @@ -220,7 +220,7 @@ void ProgrammesContainer::setProgrammeViewLanguage(const ProgrammeInternalId& pr const std::optional& language) { for(auto programme : programmes_) { if(programme->getProgrammeId() == progId) { - auto languageIndex = language? getLanguageIndex(*language) : -1; + int languageIndex = language? getLanguageIndex(*language) : -1; programme->getLanguageComboBox()->setSelectedId(languageIndex, NotificationType::dontSendNotification); } } diff --git a/shared/components/ear_combo_box.cpp b/shared/components/ear_combo_box.cpp index af64dd868..b2961c3f4 100644 --- a/shared/components/ear_combo_box.cpp +++ b/shared/components/ear_combo_box.cpp @@ -11,7 +11,7 @@ namespace ear { namespace plugin { namespace ui { -EarComboBoxEntry::EarComboBoxEntry(int id) : id_{ id } { +EarComboBoxEntry::EarComboBoxEntry(const juce::var& id) : id_{ id } { setColour(backgroundColourId, EarColours::Transparent); setColour(selectedColourId, EarColours::ComboBoxPopupBackground); setColour(highlightColourId, EarColours::Area04dp); @@ -32,7 +32,7 @@ void EarComboBoxEntry::setHighlighted(bool highlighted) { highlighted_ = highlighted; } -int EarComboBoxEntry::getId() { return id_; } +juce::var EarComboBoxEntry::getId() { return id_; } void EarComboBoxEntry::paint(Graphics& g) { EarComboBoxPopup* popup = findParentComponentOfClass(); @@ -50,7 +50,7 @@ void EarComboBoxEntry::paint(Graphics& g) { } } -EarComboBoxTextEntry::EarComboBoxTextEntry(const String& text, int id) +EarComboBoxTextEntry::EarComboBoxTextEntry(const String& text, const juce::var& id) : EarComboBoxEntry(id), text_(text) { setColour(textColourId, EarColours::ComboBoxText); // only necessary to set height -> width will be overwritten @@ -93,7 +93,7 @@ void EarComboBoxTextEntry::drawEntryInButton(Graphics& g, Justification::left); } -EarComboBoxSectionEntry::EarComboBoxSectionEntry(const String& text, int id) +EarComboBoxSectionEntry::EarComboBoxSectionEntry(const String& text, const juce::var& id) : EarComboBoxEntry(id), text_(text) { setColour(textColourId, EarColours::ComboBoxText); isSelectable_ = false; @@ -119,7 +119,7 @@ void EarComboBoxSectionEntry::drawEntryInButton(Graphics& g, drawEntryInList(g, area); } -EarComboBoxColourEntry::EarComboBoxColourEntry(Colour colour, int id) +EarComboBoxColourEntry::EarComboBoxColourEntry(Colour colour, const juce::var& id) : EarComboBoxEntry(id), colour_(colour) { setColour(backgroundColourId, EarColours::Transparent); setColour(highlightColourId, EarColours::Area04dp); @@ -519,21 +519,21 @@ EarComboBoxEntry* EarComboBox::addEntry(std::unique_ptr entry) return rawptr; } -EarComboBoxTextEntry* EarComboBox::addTextEntry(const String& text, int id) { +EarComboBoxTextEntry* EarComboBox::addTextEntry(const String& text, const juce::var& id) { auto uptr = std::make_unique(text, id); auto rawptr = uptr.get(); addEntry(std::move(uptr)); return rawptr; } -EarComboBoxColourEntry* EarComboBox::addColourEntry(const Colour& colour, int id) { +EarComboBoxColourEntry* EarComboBox::addColourEntry(const Colour& colour, const juce::var& id) { auto uptr = std::make_unique(colour, id); auto rawptr = uptr.get(); addEntry(std::move(uptr)); return rawptr; } -EarComboBoxSectionEntry* EarComboBox::addSectionEntry(const String& text, int id) { +EarComboBoxSectionEntry* EarComboBox::addSectionEntry(const String& text, const juce::var& id) { auto uptr = std::make_unique(text, id); auto rawptr = uptr.get(); addEntry(std::move(uptr)); diff --git a/shared/components/ear_combo_box.hpp b/shared/components/ear_combo_box.hpp index 7759db7ed..9e043b581 100644 --- a/shared/components/ear_combo_box.hpp +++ b/shared/components/ear_combo_box.hpp @@ -15,7 +15,7 @@ class EarComboBox; class EarComboBoxEntry : public Component { public: - EarComboBoxEntry(int id = 0); + EarComboBoxEntry(const juce::var& id = 0); bool isSelected() const; void setSelected(bool selected); @@ -24,7 +24,7 @@ class EarComboBoxEntry : public Component { bool isHighlighted() const; void setHighlighted(bool highlighted); - int getId(); + juce::var getId(); String getSearchString() { return searchString_; } @@ -42,7 +42,7 @@ class EarComboBoxEntry : public Component { protected: bool isSelectable_ = true; String searchString_ = ""; - int id_; + juce::var id_; private: juce::Point mouseXyRelative_; @@ -52,7 +52,7 @@ class EarComboBoxEntry : public Component { class EarComboBoxTextEntry : public EarComboBoxEntry { public: - EarComboBoxTextEntry(const String& text = "", int id = 0); + EarComboBoxTextEntry(const String& text = "", const juce::var& id = juce::var()); void setText(const String& text); String getText() const; @@ -73,7 +73,7 @@ class EarComboBoxTextEntry : public EarComboBoxEntry { class EarComboBoxColourEntry : public EarComboBoxEntry { public: - EarComboBoxColourEntry(Colour colour = Colour{}, int id = 0); + EarComboBoxColourEntry(Colour colour = Colour{}, const juce::var& id = juce::var()); void setEntryColour(const Colour& colour); Colour getEntryColour() const; @@ -88,7 +88,7 @@ class EarComboBoxColourEntry : public EarComboBoxEntry { class EarComboBoxSectionEntry : public EarComboBoxEntry { public: - EarComboBoxSectionEntry(const String& text = "", int id = 0); + EarComboBoxSectionEntry(const String& text = "", const juce::var& id = juce::var()); void setText(const String& text); String getText() const; @@ -161,19 +161,23 @@ class EarComboBoxPopup : public Component { return -1; } - int getEntryIndexById(int id) { - for (int i = 0; i < entries_.size(); ++i) { - if (entries_.at(i)->getId() == id) { - return i; + int getEntryIndexById(const juce::var& id) { + if (!id.isVoid()) { + for (int i = 0; i < entries_.size(); ++i) { + if (entries_.at(i)->getId().equalsWithSameType(id)) { + return i; + } } } return -1; } - EarComboBoxEntry* getEntryById(int id) { - for (int i = 0; i < entries_.size(); ++i) { - if (entries_.at(i)->getId() == id) { - return entries_.at(i).get(); + EarComboBoxEntry* getEntryById(const juce::var& id) { + if (!id.isVoid()) { + for (int i = 0; i < entries_.size(); ++i) { + if (entries_.at(i)->getId().equalsWithSameType(id)) { + return entries_.at(i).get(); + } } } return nullptr; @@ -325,9 +329,9 @@ class EarComboBox : public Component, String getDefaultText() const; EarComboBoxEntry* addEntry(std::unique_ptr entry); - EarComboBoxTextEntry* addTextEntry(const String& text, int id = 0); - EarComboBoxColourEntry* addColourEntry(const Colour& colour, int id = 0); - EarComboBoxSectionEntry* addSectionEntry(const String& text, int id = 0); + EarComboBoxTextEntry* addTextEntry(const String& text, const juce::var& id = juce::var()); + EarComboBoxColourEntry* addColourEntry(const Colour& colour, const juce::var& id = juce::var()); + EarComboBoxSectionEntry* addSectionEntry(const String& text, const juce::var& id = juce::var()); void selectEntry(int newIndex, NotificationType notification) { if (newIndex != currentSelectedIndex_) { @@ -349,13 +353,13 @@ class EarComboBox : public Component, bool hasSelection() { return getSelectedEntryIndex() >= 0; } - bool setSelectedId(int id, NotificationType notification) { + bool setSelectedId(const juce::var& id, NotificationType notification) { auto index = popup_->getEntryIndexById(id); if (index < 0) return false; selectEntry(index, notification); return true; } - int getSelectedId() { + juce::var getSelectedId() { auto selectedEntry = getSelectedEntry(); assert(selectedEntry); return selectedEntry->getId(); From 358de81398faf422258d14bfee519ba61a8e2a54 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Thu, 4 Jan 2024 01:16:10 +0000 Subject: [PATCH 06/66] getBearDataFileDirectory function --- .../binaural_monitoring_plugin_processor.cpp | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index cc8c5131d..af8b38b38 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -35,6 +35,17 @@ struct BufferTraits> { } }; +juce::File getBearDataFileDirectory(){ + auto vstPath = juce::File::getSpecialLocation( + juce::File::SpecialLocationType::currentExecutableFile); + vstPath = vstPath.getParentDirectory(); +#ifdef __APPLE__ + vstPath = vstPath.getParentDirectory(); + vstPath = vstPath.getChildFile("Resources"); +#endif + return vstPath; +}; + } // namespace plugin } // namespace ear @@ -128,15 +139,10 @@ EarBinauralMonitoringAudioProcessor::EarBinauralMonitoringAudioProcessor() connector_->parameterValueChanged(11, oscInvertQuatY_->get()); connector_->parameterValueChanged(12, oscInvertQuatZ_->get()); - auto vstPath = juce::File::getSpecialLocation( - juce::File::SpecialLocationType::currentExecutableFile); - vstPath = vstPath.getParentDirectory(); -#ifdef __APPLE__ - vstPath = vstPath.getParentDirectory(); - vstPath = vstPath.getChildFile("Resources"); -#endif - vstPath = vstPath.getChildFile(BEAR_DATA_FILE); - bearDataFilePath = vstPath.getFullPathName().toStdString(); + bearDataFilePath = getBearDataFileDirectory() + .getChildFile(BEAR_DATA_FILE) + .getFullPathName() + .toStdString(); oscReceiver.onReceiveEuler = [this](ListenerOrientation::Euler euler) { connector_->setEuler(euler); From 5848d46bb192667e60194eb82bdc55b89d3713b3 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 01:20:04 +0000 Subject: [PATCH 07/66] bearDataFileDir prop saves parsing to a juce::File each time we need to use it --- .../src/binaural_monitoring_plugin_processor.cpp | 4 ++-- .../src/binaural_monitoring_plugin_processor.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index af8b38b38..e69bd2a00 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -139,8 +139,8 @@ EarBinauralMonitoringAudioProcessor::EarBinauralMonitoringAudioProcessor() connector_->parameterValueChanged(11, oscInvertQuatY_->get()); connector_->parameterValueChanged(12, oscInvertQuatZ_->get()); - bearDataFilePath = getBearDataFileDirectory() - .getChildFile(BEAR_DATA_FILE) + bearDataFileDir = getBearDataFileDirectory(); + bearDataFilePath = bearDataFileDir.getChildFile(BEAR_DATA_FILE) .getFullPathName() .toStdString(); diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp index 8b17f928b..b5657d61a 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp @@ -115,6 +115,7 @@ class EarBinauralMonitoringAudioProcessor std::mutex processorMutex_; // used to prevent access during (re)construction std::unique_ptr processor_; std::string bearDataFilePath; + juce::File bearDataFileDir; int samplerate_; int blocksize_; From c84f90bf82c656f15a79019dff04901901322145 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 01:20:23 +0000 Subject: [PATCH 08/66] getCustomBearDataFiles func --- .../binaural_monitoring_plugin_processor.cpp | 17 +++++++++++++++-- .../binaural_monitoring_plugin_processor.hpp | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index e69bd2a00..5e6c4ca62 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -232,8 +232,21 @@ EarBinauralMonitoringAudioProcessor::_getBusProperties() { return ret; } -bool EarBinauralMonitoringAudioProcessor::readConfigFile() -{ +std::vector +EarBinauralMonitoringAudioProcessor::getCustomBearDataFiles() { + std::vector bearDataFiles; + auto tfFiles = bearDataFileDir.findChildFiles( + juce::File::TypesOfFileToFind::findFiles, false, "*.tf"); + for (auto const& file : tfFiles) { + auto fn = file.getFileName().toStdString(); + if (fn != BEAR_DATA_FILE) { + bearDataFiles.push_back(fn); + } + } + return bearDataFiles; +} + +bool EarBinauralMonitoringAudioProcessor::readConfigFile() { configRestoreState = ConfigRestoreState::IN_PROGRESS; PropertiesFile props(configFileOptions); // reload() check alone isn't sufficient - returns true if file didn't exist diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp index b5657d61a..54c04c85d 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp @@ -116,6 +116,7 @@ class EarBinauralMonitoringAudioProcessor std::unique_ptr processor_; std::string bearDataFilePath; juce::File bearDataFileDir; + std::vector getCustomBearDataFiles(); int samplerate_; int blocksize_; From 801daa7ad6b3d16d71edbcbd0f81e1c9b05540df Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 01:29:32 +0000 Subject: [PATCH 09/66] BearStatus to track startup of bear and log error --- .../binaural_monitoring_audio_processor.hpp | 18 ++++++++++++++++++ .../binaural_monitoring_audio_processor.cpp | 11 +++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp b/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp index 3817499b8..e77d919c2 100644 --- a/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp +++ b/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include <../src/dynamic_renderer.hpp> #include "variable_block_adapter.hpp" #include @@ -9,6 +10,20 @@ namespace ear { namespace plugin { +enum BearStatusStates { + NOT_ATTEMPTED = 0, + FAILED, + SUCCEEDED +}; + +struct BearStatus { + bear::Config startupConfig; + BearStatusStates startupSuccess{NOT_ATTEMPTED}; + std::string startupErrorDesc; + BearStatusStates listenerDataSetSuccess{NOT_ATTEMPTED}; + std::string listenerDataSetErrorDesc; +}; + /** * @brief Binaural monitoring plugin dsp implementation * @@ -47,6 +62,8 @@ class BinauralMonitoringAudioProcessor { BinauralMonitoringAudioProcessor& operator=( BinauralMonitoringAudioProcessor&&) = delete; + BearStatus getBearStatus() { return bearStatus; } + template void process(const InBuffer& in, OutBuffer& out) { using InTraits = BufferTraits; @@ -84,6 +101,7 @@ class BinauralMonitoringAudioProcessor { std::shared_ptr bearRenderer; // TODO - why shared? std::mutex bearListenerMutex_; bear::Listener bearListener; + BearStatus bearStatus; bool listenerQuatsDirty{false}; std::array listenerQuats{1.0, 0.0, 0.0, 0.0}; diff --git a/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp b/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp index 791aca59a..b9d20b29a 100644 --- a/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp +++ b/ear-production-suite-plugins/lib/src/binaural_monitoring_audio_processor.cpp @@ -37,19 +37,26 @@ BinauralMonitoringAudioProcessor::BinauralMonitoringAudioProcessor( bearListener.set_position_cart(std::array{0.0, 0.0, 0.0}); + bearStatus.startupConfig = bearConfig; try { bearRenderer = std::make_shared( blockSize, std::max(std::max(maxObjChannels, maxDsChannels), maxHoaChannels)); + bearRenderer->set_config_blocking(bearConfig); + bearStatus.startupSuccess = BearStatusStates::SUCCEEDED; try { bearRenderer->set_listener(bearListener); + bearStatus.listenerDataSetSuccess = BearStatusStates::SUCCEEDED; } catch (std::exception &e) { + bearStatus.listenerDataSetSuccess = BearStatusStates::FAILED; + bearStatus.listenerDataSetErrorDesc = e.what(); bearRenderer.reset(); - assert(false); + assert(false); // we're not feeding back this yet, so assert so we notice it } } catch (std::exception &e) { + bearStatus.startupSuccess = BearStatusStates::FAILED; + bearStatus.startupErrorDesc = e.what(); bearRenderer.reset(); - assert(false); } } From a331d424e972bc9a901004e3dc7b518956167a95 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 23:39:56 +0000 Subject: [PATCH 10/66] statusLabel in UI footer --- .../src/binaural_monitoring_plugin_editor.cpp | 14 +++++++++++--- .../src/binaural_monitoring_plugin_editor.hpp | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.cpp index b1b295d26..53c078958 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.cpp @@ -68,6 +68,13 @@ EarBinauralMonitoringAudioProcessorEditor:: configureVersionLabel(versionLabel); addAndMakeVisible(versionLabel); + statusLabel.setColour(juce::Label::textColourId, ear::plugin::ui::EarColours::Version); + statusLabel.setText("Status", juce::NotificationType::dontSendNotification); + statusLabel.setFont(ear::plugin::ui::EarFontsSingleton::instance().Version); + statusLabel.setJustificationType(juce::Justification::left); + statusLabel.setEditable(false); + addAndMakeVisible(statusLabel); + /* clang-format off */ p->getFrontendConnector()->setYawView(orientationValueBox->getYawControl()); p->getFrontendConnector()->setPitchView(orientationValueBox->getPitchControl()); @@ -134,7 +141,7 @@ void EarBinauralMonitoringAudioProcessorEditor::resized() { onBoardingOverlay_->setBounds(area); errorOverlay_->setBounds(area); auto p = static_cast(p_); - errorOverlay_->setVisible(p->rendererError()); + //errorOverlay_->setVisible(p->rendererError()); area.reduce(5, 5); auto headingArea = area.removeFromTop(55); onBoardingButton_->setBounds( @@ -161,8 +168,9 @@ void EarBinauralMonitoringAudioProcessorEditor::resized() { orientationValueBox->setBounds(rightColumn.removeFromTop(300).reduced(5, 5)); oscValueBox->setBounds(rightColumn.reduced(5, 5)); - auto bottomLabelsArea = area.removeFromTop(30); - versionLabel.setBounds(bottomLabelsArea); + auto footerArea = area.removeFromTop(30); + versionLabel.setBounds(footerArea.removeFromRight(150)); + statusLabel.setBounds(footerArea); } void EarBinauralMonitoringAudioProcessorEditor::endButtonClicked( diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.hpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.hpp index ccde9958b..7dbb7db5f 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.hpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_editor.hpp @@ -45,6 +45,7 @@ class EarBinauralMonitoringAudioProcessorEditor std::unique_ptr propertiesFile_; Label versionLabel; + Label statusLabel; // --- Onboarding::Listener void endButtonClicked(ear::plugin::ui::Onboarding* onboarding) override; From 77302ba102153aa8c4245846a7838c8cd525b058 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Fri, 5 Jan 2024 23:40:12 +0000 Subject: [PATCH 11/66] Initial text colours for different states --- shared/components/look_and_feel/colours.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/shared/components/look_and_feel/colours.hpp b/shared/components/look_and_feel/colours.hpp index 6b88c1d2a..b8dde34c4 100644 --- a/shared/components/look_and_feel/colours.hpp +++ b/shared/components/look_and_feel/colours.hpp @@ -24,6 +24,9 @@ static const Colour Primary = Colour(26, 93, 159); static const Colour PrimaryVariant = Colour(0, 128, 255); static const Colour PrimaryHighlight = Colour(207, 102, 121); static const Colour Error = Colour(207, 102, 121); +static const Colour StatusGood = Colour(207, 102, 121); +static const Colour StatusWarning = Colour(222, 139, 31); +static const Colour StatusBad = Colour(102, 207, 121); static const Colour Area01dp = Colour(255, 255, 255).withAlpha(0.05f); static const Colour Area02dp = Colour(255, 255, 255).withAlpha(0.07f); From 9f8a3e76e94c54198425f6b90c342386c1cf5f2a Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Sat, 6 Jan 2024 23:43:00 +0000 Subject: [PATCH 12/66] rn rendererError to rendererStarted better description of what it actually does. for error status and retrieval, we'll use BearStatus --- .../lib/include/binaural_monitoring_audio_processor.hpp | 2 +- .../src/binaural_monitoring_plugin_processor.cpp | 8 ++++---- .../src/binaural_monitoring_plugin_processor.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp b/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp index e77d919c2..e070bca84 100644 --- a/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp +++ b/ear-production-suite-plugins/lib/include/binaural_monitoring_audio_processor.hpp @@ -84,7 +84,7 @@ class BinauralMonitoringAudioProcessor { void setListenerOrientation(float quatW, float quatX, float quatY, float quatZ); - bool rendererError() { return !bearRenderer; } + bool rendererStarted() { return !bearRenderer; } void setIsPlaying(bool state) { isPlaying = state; } bool getIsPlaying() { return isPlaying; } diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index 5e6c4ca62..aa20fa383 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -180,9 +180,9 @@ EarBinauralMonitoringAudioProcessor::EarBinauralMonitoringAudioProcessor() EarBinauralMonitoringAudioProcessor::~EarBinauralMonitoringAudioProcessor() {} -bool EarBinauralMonitoringAudioProcessor::rendererError() { +bool EarBinauralMonitoringAudioProcessor::rendererStarted() { std::lock_guard lock(processorMutex_); - return (!processor_ || processor_->rendererError()); + return (!processor_ || processor_->rendererStarted()); } void EarBinauralMonitoringAudioProcessor::parameterValueChanged( @@ -400,8 +400,8 @@ void EarBinauralMonitoringAudioProcessor::processBlock( size_t numObj = backend_->getTotalObjectChannels(); size_t numDs = backend_->getTotalDirectSpeakersChannels(); - // Ensure BEAR has enough channels configured and is not erroring - if(!processor_ || processor_->rendererError()) return; + // Check BEAR has started and ensure enough channels configured + if(!processor_ || processor_->rendererStarted()) return; if(!processor_->updateChannelCounts(numObj, numDs, numHoa)) { assert(false); return; diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp index 54c04c85d..7b8cb06a8 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.hpp @@ -83,7 +83,7 @@ class EarBinauralMonitoringAudioProcessor return connector_.get(); } - bool rendererError(); + bool rendererStarted(); protected: void parameterValueChanged(int parameterIndex, float newValue) override; From 12000ee45e252fd5b6761557d661b0a7b56b8da2 Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Mon, 8 Jan 2024 14:50:01 +0000 Subject: [PATCH 13/66] Pass BearStatus to frontend connector --- ...binaural_monitoring_frontend_connector.cpp | 6 ++++++ ...binaural_monitoring_frontend_connector.hpp | 5 +++++ .../binaural_monitoring_plugin_processor.cpp | 21 ++++++++++++------- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp index 662f835a8..697ebf191 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp @@ -280,6 +280,12 @@ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatZ(bool invert) { cachedOscInvertQuatZ_ = invert; } +void BinauralMonitoringJuceFrontendConnector::setRendererStatus( + const ear::plugin::BearStatus& bearStatus) { + //TODO: Update UI + cachedBearStatus_ = bearStatus; +} + void BinauralMonitoringJuceFrontendConnector::orientationChange( ear::plugin::ListenerOrientation::Euler euler) { // ListenerOrientation callback from backend diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.hpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.hpp index e5ceb4316..d7656de73 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.hpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.hpp @@ -9,6 +9,7 @@ #include "helper/multi_async_updater.h" #include "binaural_monitoring_plugin_processor.hpp" +#include "binaural_monitoring_audio_processor.hpp" #include namespace ear { @@ -72,6 +73,9 @@ class BinauralMonitoringJuceFrontendConnector void setOscInvertQuatY(bool invert); void setOscInvertQuatZ(bool invert); + // Renderer Status update + void setRendererStatus(const ear::plugin::BearStatus& bearStatus); + protected: // Orientation::Listener void orientationValueChanged(ear::plugin::ui::OrientationView* view) override; @@ -122,6 +126,7 @@ class BinauralMonitoringJuceFrontendConnector bool cachedOscInvertQuatX_; bool cachedOscInvertQuatY_; bool cachedOscInvertQuatZ_; + ear::plugin::BearStatus cachedBearStatus_; /// Listener Orientation Object std::shared_ptr listenerOrientation; diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp index aa20fa383..69c36eb30 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_plugin_processor.cpp @@ -163,13 +163,17 @@ EarBinauralMonitoringAudioProcessor::EarBinauralMonitoringAudioProcessor() oscInvertQuatY_->addListener(this); oscInvertQuatZ_->addListener(this); - std::lock_guard lock(processorMutex_); - processor_ = std::make_unique( - MAX_DAW_CHANNELS, MAX_DAW_CHANNELS, MAX_DAW_CHANNELS, 48000, 512, - bearDataFilePath); // Used to verify if BEAR can be initialised - can't - // get SR and block size in ctor. Made assumption - - // prepareToPlay will be called with correct values - // when required + { + std::lock_guard lock(processorMutex_); + processor_ = + std::make_unique( + MAX_DAW_CHANNELS, MAX_DAW_CHANNELS, MAX_DAW_CHANNELS, 48000, 512, + bearDataFilePath); // Used to verify if BEAR can be initialised - + // can't get SR and block size in ctor. Made + // assumption - prepareToPlay will be called + // with correct values when required + connector_->setRendererStatus(processor_->getBearStatus()); + } configFileOptions.applicationName = ProjectInfo::projectName; configFileOptions.filenameSuffix = ".settings"; @@ -330,6 +334,9 @@ void EarBinauralMonitoringAudioProcessor::prepareToPlay(double sampleRate, MAX_DAW_CHANNELS, MAX_DAW_CHANNELS, MAX_DAW_CHANNELS, sampleRate, samplesPerBlock, bearDataFilePath); + if (connector_) { + connector_->setRendererStatus(processor_->getBearStatus()); + } } } From 95f7963f4e0edd9eb65e66a532ff5e1cf34df08c Mon Sep 17 00:00:00 2001 From: Matt Firth Date: Mon, 8 Jan 2024 16:02:23 +0000 Subject: [PATCH 14/66] Frontend Connector gets access to status UI label --- .../binaural_monitoring_frontend_connector.cpp | 15 ++++++++++++++- .../binaural_monitoring_frontend_connector.hpp | 6 ++++++ .../src/binaural_monitoring_plugin_editor.cpp | 15 ++++++++------- .../src/binaural_monitoring_plugin_editor.hpp | 2 +- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp index 697ebf191..a393520da 100644 --- a/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp +++ b/ear-production-suite-plugins/plugins/binaural_monitoring/src/binaural_monitoring_frontend_connector.cpp @@ -172,6 +172,12 @@ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatZButton( setOscInvertQuatZ(cachedOscInvertQuatZ_); } +void BinauralMonitoringJuceFrontendConnector::setRendererStatusLabel( + std::shared_ptr