2015-01-25 22:17:06 +01:00
|
|
|
/** @file
|
|
|
|
* @author Edouard DUPIN
|
|
|
|
* @copyright 2015, Edouard DUPIN, all right reserved
|
|
|
|
* @license APACHE v2.0 (see license file)
|
|
|
|
*/
|
|
|
|
|
2015-02-05 21:33:12 +01:00
|
|
|
#ifndef __RIVER_IO_MANAGER_H__
|
|
|
|
#define __RIVER_IO_MANAGER_H__
|
2015-01-25 22:17:06 +01:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <list>
|
|
|
|
#include <stdint.h>
|
2015-01-26 22:04:29 +01:00
|
|
|
#include <chrono>
|
|
|
|
#include <functional>
|
2015-02-04 22:39:05 +01:00
|
|
|
#include <audio/format.h>
|
|
|
|
#include <audio/channel.h>
|
2015-02-03 21:29:23 +01:00
|
|
|
#include <ejson/ejson.h>
|
2015-01-26 22:04:29 +01:00
|
|
|
#include <memory>
|
2015-02-05 19:10:53 +01:00
|
|
|
#include <drain/Volume.h>
|
2015-01-25 22:17:06 +01:00
|
|
|
|
2015-02-05 19:10:53 +01:00
|
|
|
namespace river {
|
2015-01-25 22:17:06 +01:00
|
|
|
namespace io {
|
|
|
|
class Node;
|
|
|
|
class Manager {
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* @brief Constructor
|
|
|
|
*/
|
2015-02-03 21:29:23 +01:00
|
|
|
Manager();
|
2015-01-25 22:17:06 +01:00
|
|
|
public:
|
|
|
|
static std::shared_ptr<Manager> getInstance();
|
|
|
|
/**
|
|
|
|
* @brief Destructor
|
|
|
|
*/
|
|
|
|
virtual ~Manager() {};
|
|
|
|
private:
|
2015-02-03 21:29:23 +01:00
|
|
|
ejson::Document m_config; // harware configuration
|
2015-02-05 19:10:53 +01:00
|
|
|
std::vector<std::shared_ptr<river::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone time
|
|
|
|
std::vector<std::weak_ptr<river::io::Node> > m_list; //!< List of all IO node
|
2015-01-25 22:17:06 +01:00
|
|
|
public:
|
2015-02-05 19:10:53 +01:00
|
|
|
std::shared_ptr<river::io::Node> getNode(const std::string& _name);
|
2015-02-03 21:29:23 +01:00
|
|
|
private:
|
2015-02-05 19:10:53 +01:00
|
|
|
std::vector<std::shared_ptr<drain::VolumeElement>> m_volumeGroup;
|
2015-02-03 21:29:23 +01:00
|
|
|
public:
|
2015-02-05 19:10:53 +01:00
|
|
|
std::shared_ptr<drain::VolumeElement> getVolumeGroup(const std::string& _name);
|
2015-02-04 21:08:06 +01:00
|
|
|
|
2015-02-03 23:29:34 +01:00
|
|
|
/**
|
2015-02-04 21:08:06 +01:00
|
|
|
* @brief Set a volume for a specific group
|
|
|
|
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
|
|
|
* @param[in] _value Volume in dB to set.
|
2015-02-03 23:29:34 +01:00
|
|
|
* @return true set done
|
|
|
|
* @return false An error occured
|
2015-02-04 21:08:06 +01:00
|
|
|
* @example : setVolume("MASTER", -3.0f);
|
2015-02-03 23:29:34 +01:00
|
|
|
*/
|
2015-02-04 21:08:06 +01:00
|
|
|
virtual bool setVolume(const std::string& _volumeName, float _valuedB);
|
2015-02-03 23:29:34 +01:00
|
|
|
/**
|
2015-02-04 21:08:06 +01:00
|
|
|
* @brief Get a volume value
|
|
|
|
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
|
|
|
* @return The Volume value in dB.
|
|
|
|
* @example ret = getVolume("MASTER"); can return something like ret = -3.0f
|
2015-02-03 23:29:34 +01:00
|
|
|
*/
|
2015-02-04 21:08:06 +01:00
|
|
|
virtual float getVolume(const std::string& _volumeName);
|
2015-02-03 23:29:34 +01:00
|
|
|
/**
|
|
|
|
* @brief Get a parameter value
|
2015-02-04 21:08:06 +01:00
|
|
|
* @param[in] _volumeName Name of the volume (MASTER, MATER_BT ...)
|
|
|
|
* @return The requested value Range.
|
|
|
|
* @example ret = getVolumeRange("MASTER"); can return something like ret=(-120.0f,0.0f)
|
2015-02-03 23:29:34 +01:00
|
|
|
*/
|
2015-02-04 21:08:06 +01:00
|
|
|
virtual std::pair<float,float> getVolumeRange(const std::string& _volumeName) const;
|
2015-01-25 22:17:06 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|