more work

This commit is contained in:
AlexandreRouma 2023-08-20 21:06:36 +02:00
parent 03c30f202e
commit cbf1d6703e
2 changed files with 13 additions and 13 deletions

View File

@ -33,7 +33,7 @@ SinkEntry::SinkEntry(StreamManager* manager, AudioStream* parentStream, const st
setType(type); setType(type);
} }
std::string SinkEntry::getType() { std::string SinkEntry::getType() const {
std::lock_guard<std::recursive_mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
return type; return type;
} }
@ -67,7 +67,7 @@ SinkID SinkEntry::getID() const {
return id; return id;
} }
float SinkEntry::getVolume() { float SinkEntry::getVolume() const {
std::lock_guard<std::recursive_mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
return volume; return volume;
} }
@ -79,7 +79,7 @@ void SinkEntry::setVolume(float volume) {
onVolumeChanged(volume); onVolumeChanged(volume);
} }
bool SinkEntry::getMuted() { bool SinkEntry::getMuted() const {
std::lock_guard<std::recursive_mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
return muted; return muted;
} }
@ -91,7 +91,7 @@ void SinkEntry::setMuted(bool muted) {
onMutedChanged(muted); onMutedChanged(muted);
} }
float SinkEntry::getPanning() { float SinkEntry::getPanning() const {
std::lock_guard<std::recursive_mutex> lck(mtx); std::lock_guard<std::recursive_mutex> lck(mtx);
return panning; return panning;
} }
@ -118,7 +118,7 @@ void SinkEntry::stopSink() {
sink->stop(); sink->stop();
} }
std::lock_guard<std::recursive_mutex> SinkEntry::getLock() { std::lock_guard<std::recursive_mutex> SinkEntry::getLock() const {
return std::lock_guard<std::recursive_mutex>(mtx); return std::lock_guard<std::recursive_mutex>(mtx);
} }
@ -152,7 +152,7 @@ void SinkEntry::setInputSamplerate(double samplerate) {
resamp.setInSamplerate(samplerate); resamp.setInSamplerate(samplerate);
} }
std::string SinkEntry::getStringID() { std::string SinkEntry::getStringID() const {
return stringId; return stringId;
} }

View File

@ -71,7 +71,7 @@ public:
* Get the type of the sink. * Get the type of the sink.
* @return Type of the sink. * @return Type of the sink.
*/ */
std::string getType(); std::string getType() const;
/** /**
* Change the type of the sink. * Change the type of the sink.
@ -89,7 +89,7 @@ public:
* Get sink volume. * Get sink volume.
* @return Volume as value between 0.0 and 1.0. * @return Volume as value between 0.0 and 1.0.
*/ */
float getVolume(); float getVolume() const;
/** /**
* Set sink volume. * Set sink volume.
@ -101,7 +101,7 @@ public:
* Check if the sink is muted. * Check if the sink is muted.
* @return True if muted, false if not. * @return True if muted, false if not.
*/ */
bool getMuted(); bool getMuted() const;
/** /**
* Set wether or not the sink is muted * Set wether or not the sink is muted
@ -113,7 +113,7 @@ public:
* Get sink panning. * Get sink panning.
* @return Panning as value between -1.0 and 1.0 meaning panning to the left and right respectively. * @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. * 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. * Get the string form ID unique to both the sink and stream. Be used to reference settings.
* @return Unique string ID. * @return Unique string ID.
*/ */
std::string getStringID(); std::string getStringID() const;
// Emitted when the type of the sink was changed // Emitted when the type of the sink was changed
NewEvent<const std::string&> onTypeChanged; NewEvent<const std::string&> onTypeChanged;
@ -143,7 +143,7 @@ public:
// TODO: Need to allow the sink to change the entry samplerate and start/stop the DSP // 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. // 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<std::recursive_mutex> getLock(); std::lock_guard<std::recursive_mutex> getLock() const;
void startDSP(); void startDSP();
void stopDSP(); void stopDSP();
void setSamplerate(double samplerate); void setSamplerate(double samplerate);
@ -155,7 +155,7 @@ private:
void destroy(bool forgetSettings); void destroy(bool forgetSettings);
void setInputSamplerate(double samplerate); void setInputSamplerate(double samplerate);
std::recursive_mutex mtx; mutable std::recursive_mutex mtx;
dsp::stream<dsp::stereo_t> input; dsp::stream<dsp::stereo_t> input;
dsp::multirate::RationalResampler<dsp::stereo_t> resamp; dsp::multirate::RationalResampler<dsp::stereo_t> resamp;
dsp::audio::Volume volumeAdjust; dsp::audio::Volume volumeAdjust;