diff --git a/core/src/signal_path/stream.cpp b/core/src/signal_path/stream.cpp index 8a969269..8255fb0a 100644 --- a/core/src/signal_path/stream.cpp +++ b/core/src/signal_path/stream.cpp @@ -33,7 +33,7 @@ SinkEntry::SinkEntry(StreamManager* manager, AudioStream* parentStream, const st setType(type); } -std::string SinkEntry::getType() { +std::string SinkEntry::getType() const { std::lock_guard lck(mtx); return type; } @@ -67,7 +67,7 @@ SinkID SinkEntry::getID() const { return id; } -float SinkEntry::getVolume() { +float SinkEntry::getVolume() const { std::lock_guard lck(mtx); return volume; } @@ -79,7 +79,7 @@ void SinkEntry::setVolume(float volume) { onVolumeChanged(volume); } -bool SinkEntry::getMuted() { +bool SinkEntry::getMuted() const { std::lock_guard lck(mtx); return muted; } @@ -91,7 +91,7 @@ void SinkEntry::setMuted(bool muted) { onMutedChanged(muted); } -float SinkEntry::getPanning() { +float SinkEntry::getPanning() const { std::lock_guard lck(mtx); return panning; } @@ -118,7 +118,7 @@ void SinkEntry::stopSink() { sink->stop(); } -std::lock_guard SinkEntry::getLock() { +std::lock_guard SinkEntry::getLock() const { return std::lock_guard(mtx); } @@ -152,7 +152,7 @@ void SinkEntry::setInputSamplerate(double samplerate) { resamp.setInSamplerate(samplerate); } -std::string SinkEntry::getStringID() { +std::string SinkEntry::getStringID() const { return stringId; } diff --git a/core/src/signal_path/stream.h b/core/src/signal_path/stream.h index 6821e2df..839f5f63 100644 --- a/core/src/signal_path/stream.h +++ b/core/src/signal_path/stream.h @@ -71,7 +71,7 @@ public: * Get the type of the sink. * @return Type of the sink. */ - std::string getType(); + std::string getType() const; /** * Change the type of the sink. @@ -89,7 +89,7 @@ public: * Get sink volume. * @return Volume as value between 0.0 and 1.0. */ - float getVolume(); + float getVolume() const; /** * Set sink volume. @@ -101,7 +101,7 @@ public: * Check if the sink is muted. * @return True if muted, false if not. */ - bool getMuted(); + bool getMuted() const; /** * Set wether or not the sink is muted @@ -113,7 +113,7 @@ public: * Get sink panning. * @return Panning as value between -1.0 and 1.0 meaning panning to the left and right respectively. */ - float getPanning(); + float getPanning() const; /** * Set sink panning. @@ -130,7 +130,7 @@ public: * Get the string form ID unique to both the sink and stream. Be used to reference settings. * @return Unique string ID. */ - std::string getStringID(); + std::string getStringID() const; // Emitted when the type of the sink was changed NewEvent onTypeChanged; @@ -143,7 +143,7 @@ public: // TODO: Need to allow the sink to change the entry samplerate and start/stop the DSP // This will also require allowing it to get a lock on the sink so others don't attempt to mess with it. - std::lock_guard getLock(); + std::lock_guard getLock() const; void startDSP(); void stopDSP(); void setSamplerate(double samplerate); @@ -155,7 +155,7 @@ private: void destroy(bool forgetSettings); void setInputSamplerate(double samplerate); - std::recursive_mutex mtx; + mutable std::recursive_mutex mtx; dsp::stream input; dsp::multirate::RationalResampler resamp; dsp::audio::Volume volumeAdjust;