[DEV] Add mute in volume manager
This commit is contained in:
parent
3ce856c1c6
commit
c329af6863
@ -124,11 +124,29 @@ std::pair<float,float> audio::river::Manager::getVolumeRange(const std::string&
|
||||
return manager->getVolumeRange(_volumeName);
|
||||
}
|
||||
|
||||
void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute) {
|
||||
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
return;
|
||||
}
|
||||
manager->setMute(_volumeName, _mute);
|
||||
}
|
||||
|
||||
bool audio::river::Manager::getMute(const std::string& _volumeName) const {
|
||||
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
return false;
|
||||
}
|
||||
return manager->getMute(_volumeName);
|
||||
}
|
||||
|
||||
std11::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
const std::vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
// get global hardware interface:
|
||||
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
@ -156,10 +174,10 @@ std11::shared_ptr<audio::river::Interface> audio::river::Manager::createOutput(f
|
||||
}
|
||||
|
||||
std11::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
const std::vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
// get global hardware interface:
|
||||
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
@ -188,10 +206,10 @@ std11::shared_ptr<audio::river::Interface> audio::river::Manager::createInput(fl
|
||||
|
||||
|
||||
std11::shared_ptr<audio::river::Interface> audio::river::Manager::createFeedback(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
const std::vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
// get global hardware interface:
|
||||
std11::shared_ptr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
|
@ -78,6 +78,7 @@ namespace audio {
|
||||
* @example ret = getVolume("MASTER"); can return something like ret = -3.0f
|
||||
*/
|
||||
virtual float getVolume(const std::string& _volumeName) const;
|
||||
|
||||
/**
|
||||
* @brief Get a parameter value
|
||||
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
||||
@ -85,6 +86,18 @@ namespace audio {
|
||||
* @example ret = getVolumeRange("MASTER"); can return something like ret=(-120.0f,0.0f)
|
||||
*/
|
||||
virtual std::pair<float,float> getVolumeRange(const std::string& _volumeName) const;
|
||||
/**
|
||||
* @brief Set a Mute for a specific volume group
|
||||
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
||||
* @param[in] _mute Mute enable or disable.
|
||||
*/
|
||||
virtual void setMute(const std::string& _volumeName, bool _mute);
|
||||
/**
|
||||
* @brief Get a volume value
|
||||
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
||||
* @return The Mute of the volume volume.
|
||||
*/
|
||||
virtual bool getMute(const std::string& _volumeName) const;
|
||||
|
||||
/**
|
||||
* @brief Create output Interface
|
||||
|
@ -317,6 +317,32 @@ std::pair<float,float> audio::river::io::Manager::getVolumeRange(const std::stri
|
||||
return std::make_pair<float,float>(-300, 300);
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mute) {
|
||||
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||
std11::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
|
||||
return;
|
||||
}
|
||||
volume->setMute(_mute);
|
||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||
std11::shared_ptr<audio::river::io::Node> val = m_list[iii].lock();
|
||||
if (val != nullptr) {
|
||||
val->volumeChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool audio::river::io::Manager::getMute(const std::string& _volumeName) {
|
||||
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||
std11::shared_ptr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
|
||||
return false;
|
||||
}
|
||||
return volume->getMute();
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::generateDot(const std::string& _filename) {
|
||||
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||
etk::FSNode node(_filename);
|
||||
|
@ -122,6 +122,18 @@ namespace audio {
|
||||
* @example ret = getVolumeRange("MASTER"); can return something like ret=(-120.0f,0.0f)
|
||||
*/
|
||||
std::pair<float,float> getVolumeRange(const std::string& _volumeName) const;
|
||||
/**
|
||||
* @brief Set a Mute for a specific volume group
|
||||
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
||||
* @param[in] _mute Mute enable or disable.
|
||||
*/
|
||||
void setMute(const std::string& _volumeName, bool _mute);
|
||||
/**
|
||||
* @brief Get a volume value
|
||||
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
||||
* @return The Mute of the volume volume.
|
||||
*/
|
||||
bool getMute(const std::string& _volumeName);
|
||||
/**
|
||||
* @brief Generate the dot file corresponding at the actif nodes.
|
||||
* @param[in] _filename Name of the file to write data.
|
||||
|
Loading…
x
Reference in New Issue
Block a user