diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp index 8097e7a0b..1465771e0 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.cpp @@ -38,12 +38,22 @@ float MultiSpeaker::get_ideal_clock_rate_in_range(float minimum, float maximum) } void MultiSpeaker::set_computed_output_rate(float cycles_per_second, int buffer_size, bool stereo) { - is_stereo_ = stereo; + stereo_output_ = stereo; for(const auto &speaker: speakers_) { speaker->set_computed_output_rate(cycles_per_second, buffer_size, stereo); } } +bool MultiSpeaker::get_is_stereo() { + // Return as stereo if any subspeaker is stereo. + for(const auto &speaker: speakers_) { + if(speaker->get_is_stereo()) { + return true; + } + } + return false; +} + void MultiSpeaker::set_delegate(Outputs::Speaker::Speaker::Delegate *delegate) { delegate_ = delegate; } @@ -54,7 +64,7 @@ void MultiSpeaker::speaker_did_complete_samples(Speaker *speaker, const std::vec std::lock_guard lock_guard(front_speaker_mutex_); if(speaker != front_speaker_) return; } - did_complete_samples(this, buffer, is_stereo_); + did_complete_samples(this, buffer, stereo_output_); } void MultiSpeaker::speaker_did_change_input_clock(Speaker *speaker) { diff --git a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp index 09f459e05..3c75654db 100644 --- a/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp +++ b/Analyser/Dynamic/MultiMachine/Implementation/MultiSpeaker.hpp @@ -41,6 +41,7 @@ class MultiSpeaker: public Outputs::Speaker::Speaker, Outputs::Speaker::Speaker: float get_ideal_clock_rate_in_range(float minimum, float maximum) override; void set_computed_output_rate(float cycles_per_second, int buffer_size, bool stereo) override; void set_delegate(Outputs::Speaker::Speaker::Delegate *delegate) override; + bool get_is_stereo() override; private: void speaker_did_complete_samples(Speaker *speaker, const std::vector &buffer) final; @@ -52,7 +53,7 @@ class MultiSpeaker: public Outputs::Speaker::Speaker, Outputs::Speaker::Speaker: Outputs::Speaker::Speaker::Delegate *delegate_ = nullptr; std::mutex front_speaker_mutex_; - bool is_stereo_ = false; + bool stereo_output_ = false; }; } diff --git a/Outputs/Speaker/Speaker.hpp b/Outputs/Speaker/Speaker.hpp index c34c28978..f32a5ee5f 100644 --- a/Outputs/Speaker/Speaker.hpp +++ b/Outputs/Speaker/Speaker.hpp @@ -31,7 +31,7 @@ class Speaker { /*! @returns @c true if the device would most ideally output stereo sound; @c false otherwise. */ - virtual bool get_is_stereo() { return false; }; + virtual bool get_is_stereo() = 0; /*! Sets the actual output rate; packets provided to the delegate will conform to these