[DEV] continue removing stl
This commit is contained in:
parent
c3b5ba2bdd
commit
0e175ad23c
@ -21,17 +21,17 @@ audio::river::Interface::Interface(void) :
|
||||
}
|
||||
|
||||
bool audio::river::Interface::init(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
ememory::SharedPtr<audio::river::io::Node> _node,
|
||||
const ejson::Object& _config) {
|
||||
std::vector<audio::channel> map(_map);
|
||||
etk::Vector<audio::channel> map(_map);
|
||||
m_node = _node;
|
||||
m_config = _config;
|
||||
m_mode = audio::river::modeInterface_unknow;
|
||||
std::string type = m_config["io"].toString().get("error");
|
||||
etk::String type = m_config["io"].toString().get("error");
|
||||
static int32_t uid=0;
|
||||
m_name = _node->getName() + "__" + (_node->isInput()==true?"input":"output") + "__" + type + "__" + etk::to_string(uid++);
|
||||
m_name = _node->getName() + "__" + (_node->isInput()==true?"input":"output") + "__" + type + "__" + etk::toString(uid++);
|
||||
if (type == "output") {
|
||||
m_mode = audio::river::modeInterface_output;
|
||||
} else if (type == "input") {
|
||||
@ -92,7 +92,7 @@ bool audio::river::Interface::init(float _freq,
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::Interface::create(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const ememory::SharedPtr<audio::river::io::Node>& _node,
|
||||
const ejson::Object& _config) {
|
||||
@ -189,7 +189,7 @@ void audio::river::Interface::abort() {
|
||||
RIVER_DEBUG("abort [ END ]");
|
||||
}
|
||||
|
||||
bool audio::river::Interface::setParameter(const std::string& _filter, const std::string& _parameter, const std::string& _value) {
|
||||
bool audio::river::Interface::setParameter(const etk::String& _filter, const etk::String& _parameter, const std::string& _value) {
|
||||
RIVER_DEBUG("setParameter [BEGIN] : '" << _filter << "':'" << _parameter << "':'" << _value << "'");
|
||||
bool out = false;
|
||||
if ( _filter == "volume"
|
||||
@ -206,9 +206,9 @@ bool audio::river::Interface::setParameter(const std::string& _filter, const std
|
||||
RIVER_DEBUG("setParameter [ END ] : '" << out << "'");
|
||||
return out;
|
||||
}
|
||||
std::string audio::river::Interface::getParameter(const std::string& _filter, const std::string& _parameter) const {
|
||||
etk::String audio::river::Interface::getParameter(const etk::String& _filter, const std::string& _parameter) const {
|
||||
RIVER_DEBUG("getParameter [BEGIN] : '" << _filter << "':'" << _parameter << "'");
|
||||
std::string out;
|
||||
etk::String out;
|
||||
ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
|
||||
if (algo == nullptr) {
|
||||
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
|
||||
@ -218,9 +218,9 @@ std::string audio::river::Interface::getParameter(const std::string& _filter, co
|
||||
RIVER_DEBUG("getParameter [ END ] : '" << out << "'");
|
||||
return out;
|
||||
}
|
||||
std::string audio::river::Interface::getParameterProperty(const std::string& _filter, const std::string& _parameter) const {
|
||||
etk::String audio::river::Interface::getParameterProperty(const etk::String& _filter, const std::string& _parameter) const {
|
||||
RIVER_DEBUG("getParameterProperty [BEGIN] : '" << _filter << "':'" << _parameter << "'");
|
||||
std::string out;
|
||||
etk::String out;
|
||||
ememory::SharedPtr<const audio::drain::Algo> algo = m_process.get<const audio::drain::Algo>(_filter);
|
||||
if (algo == nullptr) {
|
||||
RIVER_ERROR("setParameter(" << _filter << ") ==> no filter named like this ...");
|
||||
@ -243,9 +243,9 @@ void audio::river::Interface::write(const void* _value, size_t _nbChunk) {
|
||||
|
||||
#if 0
|
||||
// TODO : add API aCCess mutex for Read and write...
|
||||
std::vector<int16_t> audio::river::Interface::read(size_t _nbChunk) {
|
||||
etk::Vector<int16_t> audio::river::Interface::read(size_t _nbChunk) {
|
||||
// TODO :...
|
||||
std::vector<int16_t> data;
|
||||
etk::Vector<int16_t> data;
|
||||
/*
|
||||
data.resize(_nbChunk*m_map.size(), 0);
|
||||
m_mutex.lock();
|
||||
@ -410,7 +410,7 @@ audio::Time audio::river::Interface::getCurrentTime() const {
|
||||
return audio::Time::now();
|
||||
}
|
||||
|
||||
void audio::river::Interface::addVolumeGroup(const std::string& _name) {
|
||||
void audio::river::Interface::addVolumeGroup(const etk::String& _name) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
RIVER_DEBUG("addVolumeGroup(" << _name << ")");
|
||||
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
|
||||
@ -456,7 +456,7 @@ void audio::river::Interface::systemVolumeChange() {
|
||||
algo->volumeChange();
|
||||
}
|
||||
|
||||
static void link(etk::FSNode& _node, const std::string& _first, const std::string& _op, const std::string& _second, bool _isLink=true) {
|
||||
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const std::string& _second, bool _isLink=true) {
|
||||
if (_op == "->") {
|
||||
if (_isLink) {
|
||||
_node << " " << _first << " -> " << _second << ";\n";
|
||||
@ -473,23 +473,23 @@ static void link(etk::FSNode& _node, const std::string& _first, const std::strin
|
||||
}
|
||||
}
|
||||
|
||||
std::string audio::river::Interface::getDotNodeName() const {
|
||||
etk::String audio::river::Interface::getDotNodeName() const {
|
||||
if (m_mode == audio::river::modeInterface_input) {
|
||||
return "API_" + etk::to_string(m_uid) + "_input";
|
||||
return "API_" + etk::toString(m_uid) + "_input";
|
||||
} else if (m_mode == audio::river::modeInterface_feedback) {
|
||||
return "API_" + etk::to_string(m_uid) + "_feedback";
|
||||
return "API_" + etk::toString(m_uid) + "_feedback";
|
||||
} else if (m_mode == audio::river::modeInterface_output) {
|
||||
return "API_" + etk::to_string(m_uid) + "_output";
|
||||
return "API_" + etk::toString(m_uid) + "_output";
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
void audio::river::Interface::generateDot(etk::FSNode& _node, const std::string& _nameIO, bool _isLink) {
|
||||
void audio::river::Interface::generateDot(etk::FSNode& _node, const etk::String& _nameIO, bool _isLink) {
|
||||
_node << " subgraph clusterInterface_" << m_uid << " {\n";
|
||||
_node << " color=orange;\n";
|
||||
_node << " label=\"[" << m_uid << "] Interface : " << m_name << "\";\n";
|
||||
std::string nameIn;
|
||||
std::string nameOut;
|
||||
etk::String nameIn;
|
||||
etk::String nameOut;
|
||||
if ( m_mode == audio::river::modeInterface_input
|
||||
|| m_mode == audio::river::modeInterface_feedback) {
|
||||
m_process.generateDot(_node, 3, 10000+m_uid, nameIn, nameOut, false);
|
||||
|
@ -5,8 +5,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
#include <chrono>
|
||||
@ -63,7 +63,7 @@ namespace audio {
|
||||
* @return false the configuration has an error.
|
||||
*/
|
||||
bool init(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
ememory::SharedPtr<audio::river::io::Node> _node,
|
||||
const ejson::Object& _config);
|
||||
@ -78,7 +78,7 @@ namespace audio {
|
||||
* @return pointer The interface has been corectly created.
|
||||
*/
|
||||
static ememory::SharedPtr<Interface> create(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const ememory::SharedPtr<audio::river::io::Node>& _node,
|
||||
const ejson::Object& _config);
|
||||
@ -118,20 +118,20 @@ namespace audio {
|
||||
protected:
|
||||
ememory::SharedPtr<audio::river::io::Node> m_node; //!< Hardware interface to/from stream audio flow.
|
||||
protected:
|
||||
std::string m_name; //!< Name of the interface.
|
||||
etk::String m_name; //!< Name of the interface.
|
||||
public:
|
||||
/**
|
||||
* @brief Get interface name.
|
||||
* @return The current name.
|
||||
*/
|
||||
virtual std::string getName() {
|
||||
virtual etk::String getName() {
|
||||
return m_name;
|
||||
};
|
||||
/**
|
||||
* @brief Set the interface name
|
||||
* @param[in] _name new name of the interface
|
||||
*/
|
||||
virtual void setName(const std::string& _name) {
|
||||
virtual void setName(const etk::String& _name) {
|
||||
m_name = _name;
|
||||
};
|
||||
/**
|
||||
@ -169,7 +169,7 @@ namespace audio {
|
||||
* - NOTIFICATION for urgent notification volume control.
|
||||
* - NOISE for small noise volume control.
|
||||
*/
|
||||
virtual void addVolumeGroup(const std::string& _name);
|
||||
virtual void addVolumeGroup(const etk::String& _name);
|
||||
public:
|
||||
/**
|
||||
* @brief Start the Audio interface flow.
|
||||
@ -198,7 +198,7 @@ namespace audio {
|
||||
* @example : setParameter("volume", "FLOW", "-3dB");
|
||||
* @example : setParameter("LowPassFilter", "cutFrequency", "1000Hz");
|
||||
*/
|
||||
virtual bool setParameter(const std::string& _filter, const std::string& _parameter, const std::string& _value);
|
||||
virtual bool setParameter(const etk::String& _filter, const etk::String& _parameter, const std::string& _value);
|
||||
/**
|
||||
* @brief Get a parameter value
|
||||
* @param[in] _filter name of the filter (if you added some personels)
|
||||
@ -207,7 +207,7 @@ namespace audio {
|
||||
* @example : getParameter("volume", "FLOW"); can return something like "-3dB"
|
||||
* @example : getParameter("LowPassFilter", "cutFrequency"); can return something like "[-120..0]dB"
|
||||
*/
|
||||
virtual std::string getParameter(const std::string& _filter, const std::string& _parameter) const;
|
||||
virtual etk::String getParameter(const etk::String& _filter, const std::string& _parameter) const;
|
||||
/**
|
||||
* @brief Get a parameter value
|
||||
* @param[in] _filter name of the filter (if you added some personels)
|
||||
@ -216,7 +216,7 @@ namespace audio {
|
||||
* @example : getParameter("volume", "FLOW"); can return something like "[-120..0]dB"
|
||||
* @example : getParameter("LowPassFilter", "cutFreqiency"); can return something like "]100..10000]Hz"
|
||||
*/
|
||||
virtual std::string getParameterProperty(const std::string& _filter, const std::string& _parameter) const;
|
||||
virtual etk::String getParameterProperty(const etk::String& _filter, const std::string& _parameter) const;
|
||||
/**
|
||||
* @brief write some audio sample in the speakers
|
||||
* @param[in] _value Data To write on output
|
||||
@ -302,19 +302,19 @@ namespace audio {
|
||||
* @param[in] _nameIO Name to link the interface node
|
||||
* @param[in] _isLink True if the node is connected on the current interface.
|
||||
*/
|
||||
virtual void generateDot(etk::FSNode& _node, const std::string& _nameIO, bool _isLink=true);
|
||||
virtual void generateDot(etk::FSNode& _node, const etk::String& _nameIO, bool _isLink=true);
|
||||
/**
|
||||
* @brief Get the current 'dot' name of the interface
|
||||
* @return The anme requested.
|
||||
*/
|
||||
virtual std::string getDotNodeName() const;
|
||||
virtual etk::String getDotNodeName() const;
|
||||
protected:
|
||||
/**
|
||||
* @brief Interfanel generate of status
|
||||
* @param[in] _origin status source
|
||||
* @param[in] _status Event status
|
||||
*/
|
||||
void generateStatus(const std::string& _origin, const std::string& _status) {
|
||||
void generateStatus(const etk::String& _origin, const etk::String& _status) {
|
||||
m_process.generateStatus(_origin, _status);
|
||||
}
|
||||
public:
|
||||
|
@ -14,9 +14,9 @@
|
||||
#include <ejson/ejson.hpp>
|
||||
|
||||
static std::mutex g_mutex;
|
||||
static std::vector<ememory::WeakPtr<audio::river::Manager> > g_listOfAllManager;
|
||||
static etk::Vector<ememory::WeakPtr<audio::river::Manager> > g_listOfAllManager;
|
||||
|
||||
ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const std::string& _applicationUniqueId) {
|
||||
ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const etk::String& _applicationUniqueId) {
|
||||
std::unique_lock<std::mutex> lock(g_mutex);
|
||||
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
|
||||
ememory::SharedPtr<audio::river::Manager> tmp = g_listOfAllManager[iii].lock();
|
||||
@ -36,11 +36,11 @@ ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const st
|
||||
return out;
|
||||
}
|
||||
}
|
||||
g_listOfAllManager.push_back(out);
|
||||
g_listOfAllManager.pushBack(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
audio::river::Manager::Manager(const std::string& _applicationUniqueId) :
|
||||
audio::river::Manager::Manager(const etk::String& _applicationUniqueId) :
|
||||
m_applicationUniqueId(_applicationUniqueId),
|
||||
m_listOpenInterface() {
|
||||
|
||||
@ -51,8 +51,8 @@ audio::river::Manager::~Manager() {
|
||||
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::Manager::getListStreamInput() {
|
||||
std::vector<std::string> output;
|
||||
etk::Vector<etk::String> audio::river::Manager::getListStreamInput() {
|
||||
etk::Vector<etk::String> output;
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -62,8 +62,8 @@ std::vector<std::string> audio::river::Manager::getListStreamInput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::Manager::getListStreamOutput() {
|
||||
std::vector<std::string> output;
|
||||
etk::Vector<etk::String> audio::river::Manager::getListStreamOutput() {
|
||||
etk::Vector<etk::String> output;
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -73,8 +73,8 @@ std::vector<std::string> audio::river::Manager::getListStreamOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::Manager::getListStreamVirtual() {
|
||||
std::vector<std::string> output;
|
||||
etk::Vector<etk::String> audio::river::Manager::getListStreamVirtual() {
|
||||
etk::Vector<etk::String> output;
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -84,8 +84,8 @@ std::vector<std::string> audio::river::Manager::getListStreamVirtual() {
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::Manager::getListStream() {
|
||||
std::vector<std::string> output;
|
||||
etk::Vector<etk::String> audio::river::Manager::getListStream() {
|
||||
etk::Vector<etk::String> output;
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -95,7 +95,7 @@ std::vector<std::string> audio::river::Manager::getListStream() {
|
||||
return output;
|
||||
}
|
||||
|
||||
bool audio::river::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
|
||||
bool audio::river::Manager::setVolume(const etk::String& _volumeName, float _valuedB) {
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -104,7 +104,7 @@ bool audio::river::Manager::setVolume(const std::string& _volumeName, float _val
|
||||
return manager->setVolume(_volumeName, _valuedB);
|
||||
}
|
||||
|
||||
float audio::river::Manager::getVolume(const std::string& _volumeName) const {
|
||||
float audio::river::Manager::getVolume(const etk::String& _volumeName) const {
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -113,16 +113,16 @@ float audio::river::Manager::getVolume(const std::string& _volumeName) const {
|
||||
return manager->getVolume(_volumeName);
|
||||
}
|
||||
|
||||
std::pair<float,float> audio::river::Manager::getVolumeRange(const std::string& _volumeName) const {
|
||||
etk::Pair<float,float> audio::river::Manager::getVolumeRange(const etk::String& _volumeName) const {
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
return std::make_pair<float,float>(0.0f,0.0f);
|
||||
return etk::makePair<float,float>(0.0f,0.0f);
|
||||
}
|
||||
return manager->getVolumeRange(_volumeName);
|
||||
}
|
||||
|
||||
void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute) {
|
||||
void audio::river::Manager::setMute(const etk::String& _volumeName, bool _mute) {
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -131,7 +131,7 @@ void audio::river::Manager::setMute(const std::string& _volumeName, bool _mute)
|
||||
manager->setMute(_volumeName, _mute);
|
||||
}
|
||||
|
||||
bool audio::river::Manager::getMute(const std::string& _volumeName) const {
|
||||
bool audio::river::Manager::getMute(const etk::String& _volumeName) const {
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
RIVER_ERROR("Unable to load harware IO manager ... ");
|
||||
@ -141,10 +141,10 @@ bool audio::river::Manager::getMute(const std::string& _volumeName) const {
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createOutput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
const etk::String& _streamName,
|
||||
const etk::String& _options) {
|
||||
// get global hardware interface:
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
@ -167,15 +167,15 @@ ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createOutput(
|
||||
tmpOption.add("io", ejson::String("output"));
|
||||
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
|
||||
// store it in a list (needed to apply some parameters).
|
||||
m_listOpenInterface.push_back(interface);
|
||||
m_listOpenInterface.pushBack(interface);
|
||||
return interface;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createInput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
const etk::String& _streamName,
|
||||
const etk::String& _options) {
|
||||
// get global hardware interface:
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
@ -198,16 +198,16 @@ ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createInput(f
|
||||
tmpOption.add("io", ejson::String("input"));
|
||||
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
|
||||
// store it in a list (needed to apply some parameters).
|
||||
m_listOpenInterface.push_back(interface);
|
||||
m_listOpenInterface.pushBack(interface);
|
||||
return interface;
|
||||
}
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createFeedback(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _options) {
|
||||
const etk::String& _streamName,
|
||||
const etk::String& _options) {
|
||||
// get global hardware interface:
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
@ -230,11 +230,11 @@ ememory::SharedPtr<audio::river::Interface> audio::river::Manager::createFeedbac
|
||||
tmpOption.add("io", ejson::String("feedback"));
|
||||
interface = audio::river::Interface::create(_freq, _map, _format, node, tmpOption);
|
||||
// store it in a list (needed to apply some parameters).
|
||||
m_listOpenInterface.push_back(interface);
|
||||
m_listOpenInterface.pushBack(interface);
|
||||
return interface;
|
||||
}
|
||||
|
||||
void audio::river::Manager::generateDotAll(const std::string& _filename) {
|
||||
void audio::river::Manager::generateDotAll(const etk::String& _filename) {
|
||||
// get global hardware interface:
|
||||
ememory::SharedPtr<audio::river::io::Manager> manager = audio::river::io::Manager::getInstance();
|
||||
if (manager == nullptr) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <etk/String.hpp>
|
||||
#include <cstdint>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <audio/river/Interface.hpp>
|
||||
@ -20,20 +20,20 @@ namespace audio {
|
||||
*/
|
||||
class Manager : public ememory::EnableSharedFromThis<Manager> {
|
||||
private:
|
||||
const std::string& m_applicationUniqueId; //!< name of the application that open the Audio Interface.
|
||||
std::vector<ememory::WeakPtr<audio::river::Interface> > m_listOpenInterface; //!< List of all open Stream.
|
||||
const etk::String& m_applicationUniqueId; //!< name of the application that open the Audio Interface.
|
||||
etk::Vector<ememory::WeakPtr<audio::river::Interface> > m_listOpenInterface; //!< List of all open Stream.
|
||||
protected:
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
Manager(const std::string& _applicationUniqueId);
|
||||
Manager(const etk::String& _applicationUniqueId);
|
||||
public:
|
||||
/**
|
||||
* @brief factory of the manager. Every Application will have only one maager for all his flow. this permit to manage all of it
|
||||
* @param[in] _applicationUniqueId Unique name of the application
|
||||
* @return Pointer on the manager or nullptr if an error occured
|
||||
*/
|
||||
static ememory::SharedPtr<audio::river::Manager> create(const std::string& _applicationUniqueId);
|
||||
static ememory::SharedPtr<audio::river::Manager> create(const etk::String& _applicationUniqueId);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -43,22 +43,22 @@ namespace audio {
|
||||
* @brief Get all input audio stream.
|
||||
* @return a list of all availlables input stream name
|
||||
*/
|
||||
std::vector<std::string> getListStreamInput();
|
||||
etk::Vector<etk::String> getListStreamInput();
|
||||
/**
|
||||
* @brief Get all output audio stream.
|
||||
* @return a list of all availlables output stream name
|
||||
*/
|
||||
std::vector<std::string> getListStreamOutput();
|
||||
etk::Vector<etk::String> getListStreamOutput();
|
||||
/**
|
||||
* @brief Get all audio virtual stream.
|
||||
* @return a list of all availlables virtual stream name
|
||||
*/
|
||||
std::vector<std::string> getListStreamVirtual();
|
||||
etk::Vector<etk::String> getListStreamVirtual();
|
||||
/**
|
||||
* @brief Get all audio stream.
|
||||
* @return a list of all availlables stream name
|
||||
*/
|
||||
std::vector<std::string> getListStream();
|
||||
etk::Vector<etk::String> getListStream();
|
||||
|
||||
/**
|
||||
* @brief Set a volume for a specific group
|
||||
@ -68,14 +68,14 @@ namespace audio {
|
||||
* @return false An error occured
|
||||
* @example : setVolume("MASTER", -3.0f);
|
||||
*/
|
||||
virtual bool setVolume(const std::string& _volumeName, float _valuedB);
|
||||
virtual bool setVolume(const etk::String& _volumeName, float _valuedB);
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
virtual float getVolume(const std::string& _volumeName) const;
|
||||
virtual float getVolume(const etk::String& _volumeName) const;
|
||||
|
||||
/**
|
||||
* @brief Get a parameter value
|
||||
@ -83,19 +83,19 @@ namespace audio {
|
||||
* @return The requested value Range.
|
||||
* @example ret = getVolumeRange("MASTER"); can return something like ret=(-120.0f,0.0f)
|
||||
*/
|
||||
virtual std::pair<float,float> getVolumeRange(const std::string& _volumeName) const;
|
||||
virtual etk::Pair<float,float> getVolumeRange(const etk::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);
|
||||
virtual void setMute(const etk::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;
|
||||
virtual bool getMute(const etk::String& _volumeName) const;
|
||||
|
||||
/**
|
||||
* @brief Create output Interface
|
||||
@ -107,10 +107,10 @@ namespace audio {
|
||||
* @return a pointer on the interface
|
||||
*/
|
||||
virtual ememory::SharedPtr<Interface> createOutput(float _freq = 48000,
|
||||
const std::vector<audio::channel>& _map = std::vector<audio::channel>(),
|
||||
const etk::Vector<audio::channel>& _map = etk::Vector<audio::channel>(),
|
||||
audio::format _format = audio::format_int16,
|
||||
const std::string& _streamName = "",
|
||||
const std::string& _options = "");
|
||||
const etk::String& _streamName = "",
|
||||
const etk::String& _options = "");
|
||||
/**
|
||||
* @brief Create input Interface
|
||||
* @param[in] _freq Frequency to open Interface [8,16,22,32,48] kHz
|
||||
@ -121,10 +121,10 @@ namespace audio {
|
||||
* @return a pointer on the interface
|
||||
*/
|
||||
virtual ememory::SharedPtr<Interface> createInput(float _freq = 48000,
|
||||
const std::vector<audio::channel>& _map = std::vector<audio::channel>(),
|
||||
const etk::Vector<audio::channel>& _map = etk::Vector<audio::channel>(),
|
||||
audio::format _format = audio::format_int16,
|
||||
const std::string& _streamName = "",
|
||||
const std::string& _options = "");
|
||||
const etk::String& _streamName = "",
|
||||
const etk::String& _options = "");
|
||||
/**
|
||||
* @brief Create input Feedback Interface
|
||||
* @param[in] _freq Frequency to open Interface [8,16,22,32,48] kHz
|
||||
@ -135,15 +135,15 @@ namespace audio {
|
||||
* @return a pointer on the interface
|
||||
*/
|
||||
virtual ememory::SharedPtr<Interface> createFeedback(float _freq = 48000,
|
||||
const std::vector<audio::channel>& _map = std::vector<audio::channel>(),
|
||||
const etk::Vector<audio::channel>& _map = etk::Vector<audio::channel>(),
|
||||
audio::format _format = audio::format_int16,
|
||||
const std::string& _streamName = "",
|
||||
const std::string& _options = "");
|
||||
const etk::String& _streamName = "",
|
||||
const etk::String& _options = "");
|
||||
/**
|
||||
* @brief Generate the dot file corresponding at all the actif nodes.
|
||||
* @param[in] _filename Name of the file to write data.
|
||||
*/
|
||||
virtual void generateDotAll(const std::string& _filename);
|
||||
virtual void generateDotAll(const etk::String& _filename);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -12,24 +12,24 @@
|
||||
#include "NodePortAudio.hpp"
|
||||
#include "Node.hpp"
|
||||
|
||||
void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std::string& _name) {
|
||||
void audio::river::io::Group::createFrom(const ejson::Document& _obj, const etk::String& _name) {
|
||||
RIVER_INFO("Create Group[" << _name << "] (START) ___________________________");
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
const ejson::Object tmpObject = _obj[iii].toObject();
|
||||
if (tmpObject.exist() == false) {
|
||||
continue;
|
||||
}
|
||||
std::string groupName = tmpObject["group"].toString().get();
|
||||
etk::String groupName = tmpObject["group"].toString().get();
|
||||
if (groupName == _name) {
|
||||
RIVER_INFO("Add element in Group[" << _name << "]: " << _obj.getKey(iii));
|
||||
// get type : io
|
||||
std::string ioType = tmpObject["io"].toString().get("error");
|
||||
etk::String ioType = tmpObject["io"].toString().get("error");
|
||||
#ifdef AUDIO_RIVER_BUILD_ORCHESTRA
|
||||
if ( ioType == "input"
|
||||
|| ioType == "output") {
|
||||
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_obj.getKey(iii), tmpObject);
|
||||
tmp->setGroup(sharedFromThis());
|
||||
m_list.push_back(tmp);
|
||||
m_list.pushBack(tmp);
|
||||
}
|
||||
#endif
|
||||
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
||||
@ -37,7 +37,7 @@ void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std:
|
||||
|| ioType == "PAoutput") {
|
||||
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_obj.getKey(iii), tmpObject);
|
||||
tmp->setGroup(sharedFromThis());
|
||||
m_list.push_back(tmp);
|
||||
m_list.pushBack(tmp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -79,7 +79,7 @@ void audio::river::io::Group::createFrom(const ejson::Document& _obj, const std:
|
||||
}
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Group::getNode(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Group::getNode(const etk::String& _name) {
|
||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||
if (m_list[iii] != nullptr) {
|
||||
if (m_list[iii]->getName() == _name) {
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <ejson/ejson.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
|
||||
@ -34,21 +34,21 @@ namespace audio {
|
||||
*/
|
||||
~Group() = default;
|
||||
private:
|
||||
std::vector< ememory::SharedPtr<Node> > m_list; //!< List of all node in the group
|
||||
etk::Vector< ememory::SharedPtr<Node> > m_list; //!< List of all node in the group
|
||||
public:
|
||||
/**
|
||||
* @brief Create a group with all node needed to syncronize together
|
||||
* @param[in] _obj json document to create all the node in the group named _name
|
||||
* @param[in] _name Name of the group to create
|
||||
*/
|
||||
void createFrom(const ejson::Document& _obj, const std::string& _name);
|
||||
void createFrom(const ejson::Document& _obj, const etk::String& _name);
|
||||
/**
|
||||
* @brief Get a node in the group (if the node is not in the group nothing append).
|
||||
* @param[in] _name Name of the node requested.
|
||||
* @return nullptr The node named _name was not found.
|
||||
* @return pointer The node was find in this group.
|
||||
*/
|
||||
ememory::SharedPtr<audio::river::io::Node> getNode(const std::string& _name);
|
||||
ememory::SharedPtr<audio::river::io::Node> getNode(const etk::String& _name);
|
||||
/**
|
||||
* @brief Start the group.
|
||||
* @note all sub-node will be started.
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <portaudio/portaudio.h>
|
||||
#endif
|
||||
|
||||
static std::string basicAutoConfig =
|
||||
static etk::String basicAutoConfig =
|
||||
"{\n"
|
||||
" microphone:{\n"
|
||||
" io:'input',\n"
|
||||
@ -55,7 +55,7 @@ static std::string basicAutoConfig =
|
||||
"}\n";
|
||||
|
||||
|
||||
static std::string pathToTheRiverConfigInHome("HOME:.local/share/audio-river/config.json");
|
||||
static etk::String pathToTheRiverConfigInHome("HOME:.local/share/audio-river/config.json");
|
||||
|
||||
audio::river::io::Manager::Manager() {
|
||||
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
||||
@ -66,7 +66,7 @@ audio::river::io::Manager::Manager() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::init(const std::string& _filename) {
|
||||
void audio::river::io::Manager::init(const etk::String& _filename) {
|
||||
RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd");
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
if (_filename == "") {
|
||||
@ -81,7 +81,7 @@ void audio::river::io::Manager::init(const std::string& _filename) {
|
||||
}
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::initString(const std::string& _data) {
|
||||
void audio::river::io::Manager::initString(const etk::String& _data) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
m_config.parse(_data);
|
||||
}
|
||||
@ -109,77 +109,77 @@ ememory::SharedPtr<audio::river::io::Manager> audio::river::io::Manager::getInst
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::string> audio::river::io::Manager::getListStreamInput() {
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStreamInput() {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
std::vector<std::string> output;
|
||||
std::vector<std::string> keys = m_config.getKeys();
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
const ejson::Object tmppp = m_config[it].toObject();
|
||||
if (tmppp.exist() == true) {
|
||||
std::string type = tmppp["io"].toString().get("error");
|
||||
etk::String type = tmppp["io"].toString().get("error");
|
||||
if ( type == "input"
|
||||
|| type == "PAinput") {
|
||||
output.push_back(it);
|
||||
output.pushBack(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::io::Manager::getListStreamOutput() {
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStreamOutput() {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
std::vector<std::string> output;
|
||||
std::vector<std::string> keys = m_config.getKeys();
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
const ejson::Object tmppp = m_config[it].toObject();
|
||||
if (tmppp.exist() == true) {
|
||||
std::string type = tmppp["io"].toString().get("error");
|
||||
etk::String type = tmppp["io"].toString().get("error");
|
||||
if ( type == "output"
|
||||
|| type == "PAoutput") {
|
||||
output.push_back(it);
|
||||
output.pushBack(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::io::Manager::getListStreamVirtual() {
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStreamVirtual() {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
std::vector<std::string> output;
|
||||
std::vector<std::string> keys = m_config.getKeys();
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
const ejson::Object tmppp = m_config[it].toObject();
|
||||
if (tmppp.exist() == true) {
|
||||
std::string type = tmppp["io"].toString().get("error");
|
||||
etk::String type = tmppp["io"].toString().get("error");
|
||||
if ( type != "input"
|
||||
&& type != "PAinput"
|
||||
&& type != "output"
|
||||
&& type != "PAoutput"
|
||||
&& type != "error") {
|
||||
output.push_back(it);
|
||||
output.pushBack(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
std::vector<std::string> audio::river::io::Manager::getListStream() {
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStream() {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
std::vector<std::string> output;
|
||||
std::vector<std::string> keys = m_config.getKeys();
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
const ejson::Object tmppp = m_config[it].toObject();
|
||||
if (tmppp.exist() == true) {
|
||||
std::string type = tmppp["io"].toString().get("error");
|
||||
etk::String type = tmppp["io"].toString().get("error");
|
||||
if (type != "error") {
|
||||
output.push_back(it);
|
||||
output.pushBack(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(const etk::String& _name) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
RIVER_WARNING("Get node : " << _name);
|
||||
// search in the standalone list :
|
||||
@ -193,7 +193,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
}
|
||||
// search in the group list:
|
||||
{
|
||||
for (std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
|
||||
for (etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
|
||||
it != m_listGroup.end();
|
||||
++it) {
|
||||
if (it->second != nullptr) {
|
||||
@ -210,9 +210,9 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
const ejson::Object tmpObject = m_config[_name].toObject();
|
||||
if (tmpObject.exist() == true) {
|
||||
//Check if it is in a group:
|
||||
std::string groupName = tmpObject["group"].toString().get();
|
||||
etk::String groupName = tmpObject["group"].toString().get();
|
||||
// get type : io
|
||||
std::string ioType = tmpObject["io"].toString().get("error");
|
||||
etk::String ioType = tmpObject["io"].toString().get("error");
|
||||
if ( groupName != ""
|
||||
&& ( ioType == "input"
|
||||
|| ioType == "output"
|
||||
@ -234,7 +234,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
|| ioType == "output") {
|
||||
#ifdef AUDIO_RIVER_BUILD_ORCHESTRA
|
||||
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeOrchestra::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
m_list.pushBack(tmp);
|
||||
return tmp;
|
||||
#else
|
||||
RIVER_WARNING("not present interface");
|
||||
@ -244,7 +244,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
|| ioType == "PAoutput") {
|
||||
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
||||
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodePortAudio::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
m_list.pushBack(tmp);
|
||||
return tmp;
|
||||
#else
|
||||
RIVER_WARNING("not present interface");
|
||||
@ -252,12 +252,12 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
}
|
||||
if (ioType == "aec") {
|
||||
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeAEC::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
m_list.pushBack(tmp);
|
||||
return tmp;
|
||||
}
|
||||
if (ioType == "muxer") {
|
||||
ememory::SharedPtr<audio::river::io::Node> tmp = audio::river::io::NodeMuxer::create(_name, tmpObject);
|
||||
m_list.push_back(tmp);
|
||||
m_list.pushBack(tmp);
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
@ -266,7 +266,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
return ememory::SharedPtr<audio::river::io::Node>();
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const etk::String& _name) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
if (_name == "") {
|
||||
RIVER_ERROR("Try to create an audio group with no name ...");
|
||||
@ -282,11 +282,11 @@ ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVo
|
||||
}
|
||||
RIVER_DEBUG("Add a new volume group : '" << _name << "'");
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> tmpVolume = ememory::makeShared<audio::drain::VolumeElement>(_name);
|
||||
m_volumeGroup.push_back(tmpVolume);
|
||||
m_volumeGroup.pushBack(tmpVolume);
|
||||
return tmpVolume;
|
||||
}
|
||||
|
||||
bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float _valuedB) {
|
||||
bool audio::river::io::Manager::setVolume(const etk::String& _volumeName, float _valuedB) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
@ -308,7 +308,7 @@ bool audio::river::io::Manager::setVolume(const std::string& _volumeName, float
|
||||
return true;
|
||||
}
|
||||
|
||||
float audio::river::io::Manager::getVolume(const std::string& _volumeName) {
|
||||
float audio::river::io::Manager::getVolume(const etk::String& _volumeName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
@ -318,11 +318,11 @@ float audio::river::io::Manager::getVolume(const std::string& _volumeName) {
|
||||
return volume->getVolume();
|
||||
}
|
||||
|
||||
std::pair<float,float> audio::river::io::Manager::getVolumeRange(const std::string& _volumeName) const {
|
||||
return std::make_pair<float,float>(-300, 300);
|
||||
etk::Pair<float,float> audio::river::io::Manager::getVolumeRange(const etk::String& _volumeName) const {
|
||||
return etk::makePair<float,float>(-300, 300);
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mute) {
|
||||
void audio::river::io::Manager::setMute(const etk::String& _volumeName, bool _mute) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
@ -338,7 +338,7 @@ void audio::river::io::Manager::setMute(const std::string& _volumeName, bool _mu
|
||||
}
|
||||
}
|
||||
|
||||
bool audio::river::io::Manager::getMute(const std::string& _volumeName) {
|
||||
bool audio::river::io::Manager::getMute(const etk::String& _volumeName) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
@ -348,7 +348,7 @@ bool audio::river::io::Manager::getMute(const std::string& _volumeName) {
|
||||
return volume->getMute();
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::generateDot(const std::string& _filename) {
|
||||
void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
etk::FSNode node(_filename);
|
||||
RIVER_INFO("Generate the DOT files: " << node);
|
||||
@ -369,7 +369,7 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
|
||||
for (etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
|
||||
it != m_listGroup.end();
|
||||
++it) {
|
||||
if (it->second != nullptr) {
|
||||
@ -388,7 +388,7 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
|
||||
for (etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> >::iterator it(m_listGroup.begin());
|
||||
it != m_listGroup.end();
|
||||
++it) {
|
||||
if (it->second != nullptr) {
|
||||
@ -402,16 +402,16 @@ void audio::river::io::Manager::generateDot(const std::string& _filename) {
|
||||
RIVER_INFO("Generate the DOT files: " << node << " (DONE)");
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const std::string& _name) {
|
||||
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const etk::String& _name) {
|
||||
std::unique_lock<std::recursive_mutex> lock(m_mutex);
|
||||
ememory::SharedPtr<audio::river::io::Group> out;
|
||||
std::map<std::string, ememory::SharedPtr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name);
|
||||
etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> >::iterator it = m_listGroup.find(_name);
|
||||
if (it == m_listGroup.end()) {
|
||||
RIVER_INFO("Create a new group: " << _name << " (START)");
|
||||
out = ememory::makeShared<audio::river::io::Group>();
|
||||
if (out != nullptr) {
|
||||
out->createFrom(m_config, _name);
|
||||
std::pair<std::string, ememory::SharedPtr<audio::river::io::Group> > plop(std::string(_name), out);
|
||||
etk::Pair<etk::String, ememory::SharedPtr<audio::river::io::Group> > plop(etk::String(_name), out);
|
||||
m_listGroup.insert(plop);
|
||||
RIVER_INFO("Create a new group: " << _name << " ( END )");
|
||||
} else {
|
||||
|
@ -5,9 +5,9 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/Map.hpp>
|
||||
#include <list>
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
@ -46,56 +46,56 @@ namespace audio {
|
||||
* @brief Called by audio::river::init() to set the hardware configuration file.
|
||||
* @param[in] _filename Name of the file to initialize.
|
||||
*/
|
||||
void init(const std::string& _filename);
|
||||
void init(const etk::String& _filename);
|
||||
/**
|
||||
* @brief Called by audio::river::initString() to set the hardware configuration string.
|
||||
* @param[in] _data json configuration string.
|
||||
*/
|
||||
void initString(const std::string& _data);
|
||||
void initString(const etk::String& _data);
|
||||
/**
|
||||
* @brief Called by audio::river::inInit() to uninitialize all the low level interface.
|
||||
*/
|
||||
void unInit();
|
||||
private:
|
||||
ejson::Document m_config; //!< harware configuration
|
||||
std::vector<ememory::SharedPtr<audio::river::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone/all time
|
||||
std::vector<ememory::WeakPtr<audio::river::io::Node> > m_list; //!< List of all IO node
|
||||
etk::Vector<ememory::SharedPtr<audio::river::io::Node> > m_listKeepAlive; //!< list of all Node that might be keep alive sone/all time
|
||||
etk::Vector<ememory::WeakPtr<audio::river::io::Node> > m_list; //!< List of all IO node
|
||||
public:
|
||||
/**
|
||||
* @brief Get a node with his name (the name is set in the description file.
|
||||
* @param[in] _name Name of the node
|
||||
* @return Pointer on the noe or a nullptr if the node does not exist in the file or an error occured.
|
||||
*/
|
||||
ememory::SharedPtr<audio::river::io::Node> getNode(const std::string& _name);
|
||||
ememory::SharedPtr<audio::river::io::Node> getNode(const etk::String& _name);
|
||||
private:
|
||||
std::vector<ememory::SharedPtr<audio::drain::VolumeElement> > m_volumeGroup; //!< List of All global volume in the Low level interface.
|
||||
etk::Vector<ememory::SharedPtr<audio::drain::VolumeElement> > m_volumeGroup; //!< List of All global volume in the Low level interface.
|
||||
public:
|
||||
/**
|
||||
* @brief Get a volume in the global list of vilume
|
||||
* @param[in] _name Name of the volume.
|
||||
* @return pointer on the requested volume (create it if does not exist). nullptr if the name is empty.
|
||||
*/
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> getVolumeGroup(const std::string& _name);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> getVolumeGroup(const etk::String& _name);
|
||||
/**
|
||||
* @brief Get all input audio stream.
|
||||
* @return a list of all availlables input stream name
|
||||
*/
|
||||
std::vector<std::string> getListStreamInput();
|
||||
etk::Vector<etk::String> getListStreamInput();
|
||||
/**
|
||||
* @brief Get all output audio stream.
|
||||
* @return a list of all availlables output stream name
|
||||
*/
|
||||
std::vector<std::string> getListStreamOutput();
|
||||
etk::Vector<etk::String> getListStreamOutput();
|
||||
/**
|
||||
* @brief Get all audio virtual stream.
|
||||
* @return a list of all availlables virtual stream name
|
||||
*/
|
||||
std::vector<std::string> getListStreamVirtual();
|
||||
etk::Vector<etk::String> getListStreamVirtual();
|
||||
/**
|
||||
* @brief Get all audio stream.
|
||||
* @return a list of all availlables stream name
|
||||
*/
|
||||
std::vector<std::string> getListStream();
|
||||
etk::Vector<etk::String> getListStream();
|
||||
|
||||
/**
|
||||
* @brief Set a volume for a specific group
|
||||
@ -105,46 +105,46 @@ namespace audio {
|
||||
* @return false An error occured
|
||||
* @example : setVolume("MASTER", -3.0f);
|
||||
*/
|
||||
bool setVolume(const std::string& _volumeName, float _valuedB);
|
||||
bool setVolume(const etk::String& _volumeName, float _valuedB);
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
float getVolume(const std::string& _volumeName);
|
||||
float getVolume(const etk::String& _volumeName);
|
||||
/**
|
||||
* @brief Get a parameter value
|
||||
* @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)
|
||||
*/
|
||||
std::pair<float,float> getVolumeRange(const std::string& _volumeName) const;
|
||||
etk::Pair<float,float> getVolumeRange(const etk::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);
|
||||
void setMute(const etk::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);
|
||||
bool getMute(const etk::String& _volumeName);
|
||||
/**
|
||||
* @brief Generate the dot file corresponding at the actif nodes.
|
||||
* @param[in] _filename Name of the file to write data.
|
||||
*/
|
||||
void generateDot(const std::string& _filename);
|
||||
void generateDot(const etk::String& _filename);
|
||||
private:
|
||||
std::map<std::string, ememory::SharedPtr<audio::river::io::Group> > m_listGroup; //!< List of all groups
|
||||
etk::Map<etk::String, ememory::SharedPtr<audio::river::io::Group> > m_listGroup; //!< List of all groups
|
||||
/**
|
||||
* @brief get a low level interface group.
|
||||
* @param[in] _name Name of the group.
|
||||
* @return Pointer on the requested group or nullptr if the group does not existed.
|
||||
*/
|
||||
ememory::SharedPtr<audio::river::io::Group> getGroup(const std::string& _name);
|
||||
ememory::SharedPtr<audio::river::io::Group> getGroup(const etk::String& _name);
|
||||
|
||||
};
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "Node.hpp"
|
||||
#include <audio/river/debug.hpp>
|
||||
|
||||
audio::river::io::Node::Node(const std::string& _name, const ejson::Object& _config) :
|
||||
audio::river::io::Node::Node(const etk::String& _name, const ejson::Object& _config) :
|
||||
m_config(_config),
|
||||
m_name(_name),
|
||||
m_isInput(false) {
|
||||
@ -30,7 +30,7 @@ audio::river::io::Node::Node(const std::string& _name, const ejson::Object& _con
|
||||
# muxer/demuxer format type (int8-on-int16, int16-on-int32, int24-on-int32, int32-on-int64, float)
|
||||
mux-demux-type:"int16_on_int32",
|
||||
*/
|
||||
std::string interfaceType = m_config["io"].toString().get();
|
||||
etk::String interfaceType = m_config["io"].toString().get();
|
||||
RIVER_INFO("interfaceType=" << interfaceType);
|
||||
if ( interfaceType == "input"
|
||||
|| interfaceType == "PAinput"
|
||||
@ -43,33 +43,33 @@ audio::river::io::Node::Node(const std::string& _name, const ejson::Object& _con
|
||||
|
||||
int32_t frequency = m_config["frequency"].toNumber().get(1);
|
||||
// Get audio format type:
|
||||
std::string type = m_config["type"].toString().get("int16");
|
||||
etk::String type = m_config["type"].toString().get("int16");
|
||||
enum audio::format formatType = audio::getFormatFromString(type);
|
||||
// Get volume stage :
|
||||
std::string volumeName = m_config["volume-name"].toString().get();
|
||||
etk::String volumeName = m_config["volume-name"].toString().get();
|
||||
if (volumeName != "") {
|
||||
RIVER_INFO("add node volume stage : '" << volumeName << "'");
|
||||
// use global manager for volume ...
|
||||
m_volume = audio::river::io::Manager::getInstance()->getVolumeGroup(volumeName);
|
||||
}
|
||||
// Get map type :
|
||||
std::vector<audio::channel> map;
|
||||
etk::Vector<audio::channel> map;
|
||||
const ejson::Array listChannelMap = m_config["channel-map"].toArray();
|
||||
if ( listChannelMap.exist() == false
|
||||
|| listChannelMap.size() == 0) {
|
||||
// set default channel property:
|
||||
map.push_back(audio::channel_frontLeft);
|
||||
map.push_back(audio::channel_frontRight);
|
||||
map.pushBack(audio::channel_frontLeft);
|
||||
map.pushBack(audio::channel_frontRight);
|
||||
} else {
|
||||
for (auto it : listChannelMap) {
|
||||
std::string value = it.toString().get();
|
||||
map.push_back(audio::getChannelFromString(value));
|
||||
etk::String value = it.toString().get();
|
||||
map.pushBack(audio::getChannelFromString(value));
|
||||
}
|
||||
}
|
||||
hardwareFormat.set(map, formatType, frequency);
|
||||
|
||||
|
||||
std::string muxerDemuxerConfig;
|
||||
etk::String muxerDemuxerConfig;
|
||||
if (m_isInput == true) {
|
||||
muxerDemuxerConfig = m_config["mux-demux-type"].toString().get("int16");
|
||||
} else {
|
||||
@ -134,7 +134,7 @@ size_t audio::river::io::Node::getNumberOfInterfaceAvaillable(enum audio::river:
|
||||
}
|
||||
|
||||
void audio::river::io::Node::registerAsRemote(const ememory::SharedPtr<audio::river::Interface>& _interface) {
|
||||
std::vector<ememory::WeakPtr<audio::river::Interface> >::iterator it = m_listAvaillable.begin();
|
||||
etk::Vector<ememory::WeakPtr<audio::river::Interface> >::iterator it = m_listAvaillable.begin();
|
||||
while (it != m_listAvaillable.end()) {
|
||||
if (it->expired() == true) {
|
||||
it = m_listAvaillable.erase(it);
|
||||
@ -142,7 +142,7 @@ void audio::river::io::Node::registerAsRemote(const ememory::SharedPtr<audio::ri
|
||||
}
|
||||
++it;
|
||||
}
|
||||
m_listAvaillable.push_back(_interface);
|
||||
m_listAvaillable.pushBack(_interface);
|
||||
}
|
||||
|
||||
void audio::river::io::Node::interfaceAdd(const ememory::SharedPtr<audio::river::Interface>& _interface) {
|
||||
@ -154,7 +154,7 @@ void audio::river::io::Node::interfaceAdd(const ememory::SharedPtr<audio::river:
|
||||
}
|
||||
}
|
||||
RIVER_INFO("ADD interface for stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
|
||||
m_list.push_back(_interface);
|
||||
m_list.pushBack(_interface);
|
||||
}
|
||||
if (m_list.size() == 1) {
|
||||
startInGroup();
|
||||
@ -215,7 +215,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
return;
|
||||
}
|
||||
enum audio::format muxerFormatType = m_process.getInputConfig().getFormat();
|
||||
std::vector<uint8_t> outputTmp2;
|
||||
etk::Vector<uint8_t> outputTmp2;
|
||||
uint32_t nbByteTmpBuffer = audio::getFormatBytes(muxerFormatType)*m_process.getInputConfig().getMap().size()*_nbChunk;
|
||||
RIVER_VERBOSE("resize=" << nbByteTmpBuffer);
|
||||
outputTmp2.resize(nbByteTmpBuffer);
|
||||
@ -225,7 +225,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
// process 16 bits
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// $$$$ change the int16
|
||||
std::vector<int16_t> output;
|
||||
etk::Vector<int16_t> output;
|
||||
RIVER_VERBOSE("resize=" << _nbChunk*m_process.getInputConfig().getMap().size());
|
||||
output.resize(_nbChunk*m_process.getInputConfig().getMap().size(), 0);
|
||||
// $$$$ change the int16
|
||||
@ -258,7 +258,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// process 32 bits
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::vector<int32_t> output;
|
||||
etk::Vector<int32_t> output;
|
||||
RIVER_VERBOSE("resize=" << _nbChunk*m_process.getInputConfig().getMap().size());
|
||||
output.resize(_nbChunk*m_process.getInputConfig().getMap().size(), 0);
|
||||
const int32_t* outputTmp = nullptr;
|
||||
@ -288,7 +288,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// process 64 bits
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::vector<int64_t> output;
|
||||
etk::Vector<int64_t> output;
|
||||
RIVER_VERBOSE("resize=" << _nbChunk*m_process.getInputConfig().getMap().size());
|
||||
output.resize(_nbChunk*m_process.getInputConfig().getMap().size(), 0);
|
||||
const int64_t* outputTmp = nullptr;
|
||||
@ -318,7 +318,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// process 32 bits FLOAT
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::vector<float> output;
|
||||
etk::Vector<float> output;
|
||||
RIVER_VERBOSE("resize=" << _nbChunk*m_process.getInputConfig().getMap().size());
|
||||
output.resize(_nbChunk*m_process.getInputConfig().getMap().size(), 0);
|
||||
const float* outputTmp = nullptr;
|
||||
@ -347,7 +347,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// process 64 bits FLOAT
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
std::vector<double> output;
|
||||
etk::Vector<double> output;
|
||||
RIVER_VERBOSE("resize=" << _nbChunk*m_process.getInputConfig().getMap().size());
|
||||
output.resize(_nbChunk*m_process.getInputConfig().getMap().size(), 0);
|
||||
const double* outputTmp = nullptr;
|
||||
@ -392,7 +392,7 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
||||
return;
|
||||
}
|
||||
|
||||
static void link(etk::FSNode& _node, const std::string& _first, const std::string& _op, const std::string& _second) {
|
||||
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const std::string& _second) {
|
||||
if (_op == "->") {
|
||||
_node << " " << _first << " -> " << _second << ";\n";
|
||||
} else if (_op == "<-") {
|
||||
@ -409,11 +409,11 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
|
||||
if (m_isInput == true) {
|
||||
_node << " node [shape=rarrow];\n";
|
||||
_node << " NODE_" << m_uid << "_HW_interface [ label=\"HW interface\\n interface=ALSA\\n stream=" << m_name << "\\n type=input\" ];\n";
|
||||
std::string nameIn;
|
||||
std::string nameOut;
|
||||
etk::String nameIn;
|
||||
etk::String nameOut;
|
||||
m_process.generateDotProcess(_node, 3, m_uid, nameIn, nameOut, false);
|
||||
_node << " node [shape=square];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::to_string(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
// Link all nodes :
|
||||
_node << " NODE_" << m_uid << "_HW_interface -> " << nameIn << " [arrowhead=\"open\"];\n";
|
||||
_node << " " << nameOut << " -> NODE_" << m_uid << "_demuxer [arrowhead=\"open\"];\n";
|
||||
@ -422,22 +422,22 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
|
||||
size_t nbfeedback = getNumberOfInterfaceAvaillable(audio::river::modeInterface_feedback);
|
||||
_node << " node [shape=larrow];\n";
|
||||
_node << " NODE_" << m_uid << "_HW_interface [ label=\"HW interface\\n interface=ALSA\\n stream=" << m_name << "\\n type=output\" ];\n";
|
||||
std::string nameIn;
|
||||
std::string nameOut;
|
||||
etk::String nameIn;
|
||||
etk::String nameOut;
|
||||
if (nbOutput>0) {
|
||||
m_process.generateDotProcess(_node, 3, m_uid, nameIn, nameOut, true);
|
||||
}
|
||||
_node << " node [shape=square];\n";
|
||||
if (nbOutput>0) {
|
||||
_node << " NODE_" << m_uid << "_muxer [ label=\"MUXER\\n format=" << etk::to_string(m_process.getInputConfig().getFormat()) << "\" ];\n";
|
||||
_node << " NODE_" << m_uid << "_muxer [ label=\"MUXER\\n format=" << etk::toString(m_process.getInputConfig().getFormat()) << "\" ];\n";
|
||||
}
|
||||
if (nbfeedback>0) {
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::to_string(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
}
|
||||
// Link all nodes :
|
||||
if (nbOutput>0) {
|
||||
link(_node, "NODE_" + etk::to_string(m_uid) + "_HW_interface", "<-", nameOut);
|
||||
link(_node, nameIn, "<-", "NODE_" + etk::to_string(m_uid) + "_muxer");
|
||||
link(_node, "NODE_" + etk::toString(m_uid) + "_HW_interface", "<-", nameOut);
|
||||
link(_node, nameIn, "<-", "NODE_" + etk::toString(m_uid) + "_muxer");
|
||||
}
|
||||
if (nbfeedback>0) {
|
||||
_node << " NODE_" << m_uid << "_HW_interface -> NODE_" << m_uid << "_demuxer [arrowhead=\"open\"];\n";
|
||||
@ -466,11 +466,11 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
|
||||
}
|
||||
if (element != nullptr) {
|
||||
if (element->getMode() == modeInterface_input) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_demuxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||
} else if (element->getMode() == modeInterface_output) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_muxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
||||
} else if (element->getMode() == modeInterface_feedback) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_demuxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,8 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <list>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
@ -39,7 +39,7 @@ namespace audio {
|
||||
* @param[in] _name Name of the node.
|
||||
* @param[in] _config Configuration of the node.
|
||||
*/
|
||||
Node(const std::string& _name, const ejson::Object& _config);
|
||||
Node(const etk::String& _name, const ejson::Object& _config);
|
||||
public:
|
||||
/**
|
||||
* @brief Destructor
|
||||
@ -84,8 +84,8 @@ namespace audio {
|
||||
protected:
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> m_volume; //!< if a volume is set it is set here ... for hardware interface only.
|
||||
protected:
|
||||
std::vector<ememory::WeakPtr<audio::river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
|
||||
std::vector<ememory::SharedPtr<audio::river::Interface> > m_list; //!< List of all connected interface at this node.
|
||||
etk::Vector<ememory::WeakPtr<audio::river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
|
||||
etk::Vector<ememory::SharedPtr<audio::river::Interface> > m_list; //!< List of all connected interface at this node.
|
||||
/**
|
||||
* @brief Get the number of interface with a specific type.
|
||||
* @param[in] _interfaceType Type of the interface.
|
||||
@ -124,13 +124,13 @@ namespace audio {
|
||||
*/
|
||||
void interfaceRemove(const ememory::SharedPtr<audio::river::Interface>& _interface);
|
||||
protected:
|
||||
std::string m_name; //!< Name of the interface
|
||||
etk::String m_name; //!< Name of the interface
|
||||
public:
|
||||
/**
|
||||
* @brief Get the interface name.
|
||||
* @return Current name.
|
||||
*/
|
||||
const std::string& getName() {
|
||||
const etk::String& getName() {
|
||||
return m_name;
|
||||
}
|
||||
protected:
|
||||
|
@ -10,26 +10,26 @@
|
||||
#include <ememory/memory.hpp>
|
||||
#include <functional>
|
||||
|
||||
ememory::SharedPtr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const std::string& _name, const ejson::Object& _config) {
|
||||
ememory::SharedPtr<audio::river::io::NodeAEC> audio::river::io::NodeAEC::create(const etk::String& _name, const ejson::Object& _config) {
|
||||
return ememory::SharedPtr<audio::river::io::NodeAEC>(new audio::river::io::NodeAEC(_name, _config));
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::io::NodeAEC::createInput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _objectName,
|
||||
const std::string& _name) {
|
||||
const etk::String& _objectName,
|
||||
const etk::String& _name) {
|
||||
// check if the output exist
|
||||
const ejson::Object tmppp = m_config[_objectName].toObject();
|
||||
if (tmppp.exist() == false) {
|
||||
RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config.getKeys());
|
||||
return ememory::SharedPtr<audio::river::Interface>();
|
||||
}
|
||||
std::string streamName = tmppp["map-on"].toString().get("error");
|
||||
etk::String streamName = tmppp["map-on"].toString().get("error");
|
||||
|
||||
m_nbChunk = m_config["nb-chunk"].toNumber().get(1024);
|
||||
// check if it is an Output:
|
||||
std::string type = tmppp["io"].toString().get("error");
|
||||
etk::String type = tmppp["io"].toString().get("error");
|
||||
if ( type != "input"
|
||||
&& type != "feedback") {
|
||||
RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type);
|
||||
@ -49,7 +49,7 @@ ememory::SharedPtr<audio::river::Interface> audio::river::io::NodeAEC::createInp
|
||||
}
|
||||
|
||||
|
||||
audio::river::io::NodeAEC::NodeAEC(const std::string& _name, const ejson::Object& _config) :
|
||||
audio::river::io::NodeAEC::NodeAEC(const etk::String& _name, const ejson::Object& _config) :
|
||||
Node(_name, _config),
|
||||
m_P_attaqueTime(1),
|
||||
m_P_releaseTime(100),
|
||||
@ -79,8 +79,8 @@ audio::river::io::NodeAEC::NodeAEC(const std::string& _name, const ejson::Object
|
||||
algo:"river-remover",
|
||||
algo-mode:"cutter",
|
||||
*/
|
||||
std::vector<audio::channel> feedbackMap;
|
||||
feedbackMap.push_back(audio::channel_frontCenter);
|
||||
etk::Vector<audio::channel> feedbackMap;
|
||||
feedbackMap.pushBack(audio::channel_frontCenter);
|
||||
RIVER_INFO("Create FEEDBACK : ");
|
||||
m_interfaceFeedBack = createInput(hardwareFormat.getFrequency(),
|
||||
feedbackMap,
|
||||
@ -167,7 +167,7 @@ void audio::river::io::NodeAEC::onDataReceivedMicrophone(const void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
RIVER_DEBUG("Microphone Time=" << _time << " _nbChunk=" << _nbChunk << " _map=" << _map << " _format=" << _format << " freq=" << _frequency);
|
||||
RIVER_DEBUG(" next=" << _time + audio::Duration(0, _nbChunk*1000000000LL/int64_t(_frequency)) );
|
||||
if (_format != audio::format_int16) {
|
||||
@ -185,7 +185,7 @@ void audio::river::io::NodeAEC::onDataReceivedFeedBack(const void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
RIVER_DEBUG("FeedBack Time=" << _time << " _nbChunk=" << _nbChunk << " _map=" << _map << " _format=" << _format << " freq=" << _frequency);
|
||||
RIVER_DEBUG(" next=" << _time + audio::Duration(0, _nbChunk*1000000000LL/int64_t(_frequency)) );
|
||||
if (_format != audio::format_int16) {
|
||||
@ -241,8 +241,8 @@ void audio::river::io::NodeAEC::process() {
|
||||
RIVER_ERROR("Can not synchronize flow ... : " << MicTime << " != " << fbTime << " delta = " << (MicTime-fbTime).count()/1000 << " µs");
|
||||
return;
|
||||
}
|
||||
std::vector<uint8_t> dataMic;
|
||||
std::vector<uint8_t> dataFB;
|
||||
etk::Vector<uint8_t> dataMic;
|
||||
etk::Vector<uint8_t> dataFB;
|
||||
dataMic.resize(m_nbChunk*sizeof(int16_t)*2, 0);
|
||||
dataFB.resize(m_nbChunk*sizeof(int16_t), 0);
|
||||
while (true) {
|
||||
@ -266,12 +266,12 @@ void audio::river::io::NodeAEC::process() {
|
||||
void audio::river::io::NodeAEC::processAEC(void* _dataMic, void* _dataFB, uint32_t _nbChunk, const audio::Time& _time) {
|
||||
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
||||
// TODO : Set all these parameter in the parameter configuration section ...
|
||||
int32_t attaqueTime = std::min(std::max(0,m_P_attaqueTime),1000);
|
||||
int32_t releaseTime = std::min(std::max(0,m_P_releaseTime),1000);
|
||||
int32_t min_gain = 32767 * std::min(std::max(0,m_P_minimumGain),1000) / 1000;
|
||||
int32_t threshold = 32767 * std::min(std::max(0,m_P_threshold),1000) / 1000;
|
||||
int32_t attaqueTime = etk::min(etk::max(0,m_P_attaqueTime),1000);
|
||||
int32_t releaseTime = etk::min(etk::max(0,m_P_releaseTime),1000);
|
||||
int32_t min_gain = 32767 * etk::min(etk::max(0,m_P_minimumGain),1000) / 1000;
|
||||
int32_t threshold = 32767 * etk::min(etk::max(0,m_P_threshold),1000) / 1000;
|
||||
|
||||
int32_t latencyTime = std::min(std::max(0,m_P_latencyTime),1000);
|
||||
int32_t latencyTime = etk::min(etk::max(0,m_P_latencyTime),1000);
|
||||
int32_t nb_sample_latency = (hardwareFormat.getFrequency()/1000)*latencyTime;
|
||||
|
||||
int32_t increaseSample = 32767;
|
||||
@ -321,12 +321,12 @@ void audio::river::io::NodeAEC::generateDot(etk::FSNode& _node) {
|
||||
_node << " subgraph clusterNode_" << m_uid << " {\n";
|
||||
_node << " color=blue;\n";
|
||||
_node << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
||||
_node << " NODE_" << m_uid << "_HW_AEC [ label=\"AEC\\n channelMap=" << etk::to_string(getInterfaceFormat().getMap()) << "\" ];\n";
|
||||
std::string nameIn;
|
||||
std::string nameOut;
|
||||
_node << " NODE_" << m_uid << "_HW_AEC [ label=\"AEC\\n channelMap=" << etk::toString(getInterfaceFormat().getMap()) << "\" ];\n";
|
||||
etk::String nameIn;
|
||||
etk::String nameOut;
|
||||
m_process.generateDot(_node, 3, m_uid, nameIn, nameOut, false);
|
||||
_node << " node [shape=square];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::to_string(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
// Link all nodes :
|
||||
_node << " NODE_" << m_uid << "_HW_AEC -> " << nameIn << ";\n";
|
||||
_node << " " << nameOut << " -> NODE_" << m_uid << "_demuxer;\n";
|
||||
@ -355,11 +355,11 @@ void audio::river::io::NodeAEC::generateDot(etk::FSNode& _node) {
|
||||
}
|
||||
if (element != nullptr) {
|
||||
if (element->getMode() == modeInterface_input) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_demuxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||
} else if (element->getMode() == modeInterface_output) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_muxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
||||
} else if (element->getMode() == modeInterface_feedback) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_demuxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -18,14 +18,14 @@ namespace audio {
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
NodeAEC(const std::string& _name, const ejson::Object& _config);
|
||||
NodeAEC(const etk::String& _name, const ejson::Object& _config);
|
||||
public:
|
||||
/**
|
||||
* @brief Factory of this Virtual Node.
|
||||
* @param[in] _name Name of the node.
|
||||
* @param[in] _config Configuration of the node.
|
||||
*/
|
||||
static ememory::SharedPtr<NodeAEC> create(const std::string& _name, const ejson::Object& _config);
|
||||
static ememory::SharedPtr<NodeAEC> create(const etk::String& _name, const ejson::Object& _config);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -45,10 +45,10 @@ namespace audio {
|
||||
* @return Interfae Pointer.
|
||||
*/
|
||||
ememory::SharedPtr<audio::river::Interface> createInput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _name);
|
||||
const etk::String& _streamName,
|
||||
const etk::String& _name);
|
||||
/**
|
||||
* @brief Stream data input callback
|
||||
* @todo : copy doc ..
|
||||
@ -58,7 +58,7 @@ namespace audio {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map);
|
||||
const etk::Vector<audio::channel>& _map);
|
||||
/**
|
||||
* @brief Stream data input callback
|
||||
* @todo : copy doc ..
|
||||
@ -68,7 +68,7 @@ namespace audio {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map);
|
||||
const etk::Vector<audio::channel>& _map);
|
||||
protected:
|
||||
audio::drain::CircularBuffer m_bufferMicrophone; //!< temporary buffer to synchronize data.
|
||||
audio::drain::CircularBuffer m_bufferFeedBack; //!< temporary buffer to synchronize data.
|
||||
|
@ -13,7 +13,7 @@
|
||||
int32_t audio::river::io::NodeFile::recordCallback(const void* _inputBuffer,
|
||||
const audio::Time& _timeInput,
|
||||
uint32_t _nbChunk,
|
||||
const std::vector<audio::orchestra::status>& _status) {
|
||||
const etk::Vector<audio::orchestra::status>& _status) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
// TODO : Manage status ...
|
||||
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
|
||||
@ -24,7 +24,7 @@ int32_t audio::river::io::NodeFile::recordCallback(const void* _inputBuffer,
|
||||
int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
|
||||
const audio::Time& _timeOutput,
|
||||
uint32_t _nbChunk,
|
||||
const std::vector<audio::orchestra::status>& _status) {
|
||||
const etk::Vector<audio::orchestra::status>& _status) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
// TODO : Manage status ...
|
||||
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
|
||||
@ -34,11 +34,11 @@ int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
|
||||
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const std::string& _name, const ejson::Object& _config) {
|
||||
ememory::SharedPtr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const etk::String& _name, const ejson::Object& _config) {
|
||||
return ememory::SharedPtr<audio::river::io::NodeFile>(new audio::river::io::NodeFile(_name, _config));
|
||||
}
|
||||
|
||||
audio::river::io::NodeFile::NodeFile(const std::string& _name, const ejson::Object& _config) :
|
||||
audio::river::io::NodeFile::NodeFile(const etk::String& _name, const ejson::Object& _config) :
|
||||
Node(_name, _config) {
|
||||
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
|
||||
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
||||
@ -49,8 +49,8 @@ audio::river::io::NodeFile::NodeFile(const std::string& _name, const ejson::Obje
|
||||
},
|
||||
nb-chunk:1024 # number of chunk to open device (create the latency anf the frequency to call user)
|
||||
*/
|
||||
std::string typeInterface = audio::orchestra::type::undefined;
|
||||
std::string streamName = "default";
|
||||
etk::String typeInterface = audio::orchestra::type::undefined;
|
||||
etk::String streamName = "default";
|
||||
const ejson::Object tmpObject = m_config["map-on"].toObject();
|
||||
if (tmpObject.exist() == false) {
|
||||
RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'");
|
||||
@ -67,7 +67,7 @@ audio::river::io::NodeFile::NodeFile(const std::string& _name, const ejson::Obje
|
||||
m_interface.instanciate(typeInterface);
|
||||
m_interface.setName(_name);
|
||||
// TODO : Check return ...
|
||||
std::string type = m_config.getStringValue("type", "int16");
|
||||
etk::String type = m_config.getStringValue("type", "int16");
|
||||
if (streamName == "") {
|
||||
streamName = "default";
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ namespace audio {
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
NodeFile(const std::string& _name, const ejson::Object& _config);
|
||||
NodeFile(const etk::String& _name, const ejson::Object& _config);
|
||||
public:
|
||||
static ememory::SharedPtr<NodeFile> create(const std::string& _name, const ejson::Object& _config);
|
||||
static ememory::SharedPtr<NodeFile> create(const etk::String& _name, const ejson::Object& _config);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -40,7 +40,7 @@ namespace audio {
|
||||
bool m_restartAtEnd; //!< The read is done in loop
|
||||
uint32_t m_sampleRate; //!< Sample Rate of the Raw file
|
||||
audio::format m_format; //!< Format of the file
|
||||
std::vector<audio::channel> m_map; //!< Map of the file
|
||||
etk::Vector<audio::channel> m_map; //!< Map of the file
|
||||
ememory::SharedPtr<std::thread> m_thread; //!< playing thread of the flow
|
||||
std::atomic<bool> m_alive; //!< thread is active
|
||||
protected:
|
||||
|
@ -10,26 +10,26 @@
|
||||
#include <ememory/memory.hpp>
|
||||
#include <functional>
|
||||
|
||||
ememory::SharedPtr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const std::string& _name, const ejson::Object& _config) {
|
||||
ememory::SharedPtr<audio::river::io::NodeMuxer> audio::river::io::NodeMuxer::create(const etk::String& _name, const ejson::Object& _config) {
|
||||
return ememory::SharedPtr<audio::river::io::NodeMuxer>(new audio::river::io::NodeMuxer(_name, _config));
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::io::NodeMuxer::createInput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _objectName,
|
||||
const std::string& _name) {
|
||||
const etk::String& _objectName,
|
||||
const etk::String& _name) {
|
||||
// check if the output exist
|
||||
const ejson::Object tmppp = m_config[_objectName].toObject();
|
||||
if (tmppp.exist() == false) {
|
||||
RIVER_ERROR("can not open a non existance virtual interface: '" << _objectName << "' not present in : " << m_config.getKeys());
|
||||
return ememory::SharedPtr<audio::river::Interface>();
|
||||
}
|
||||
std::string streamName = tmppp["map-on"].toString().get("error");
|
||||
etk::String streamName = tmppp["map-on"].toString().get("error");
|
||||
|
||||
|
||||
// check if it is an Output:
|
||||
std::string type = tmppp["io"].toString().get("error");
|
||||
etk::String type = tmppp["io"].toString().get("error");
|
||||
if ( type != "input"
|
||||
&& type != "feedback") {
|
||||
RIVER_ERROR("can not open in output a virtual interface: '" << streamName << "' configured has : " << type);
|
||||
@ -49,7 +49,7 @@ ememory::SharedPtr<audio::river::Interface> audio::river::io::NodeMuxer::createI
|
||||
}
|
||||
|
||||
|
||||
audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const ejson::Object& _config) :
|
||||
audio::river::io::NodeMuxer::NodeMuxer(const etk::String& _name, const ejson::Object& _config) :
|
||||
Node(_name, _config) {
|
||||
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
|
||||
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
||||
@ -77,7 +77,7 @@ audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const ejson::Ob
|
||||
*/
|
||||
RIVER_INFO("Create IN 1 : ");
|
||||
m_interfaceInput1 = createInput(hardwareFormat.getFrequency(),
|
||||
std::vector<audio::channel>(),
|
||||
etk::Vector<audio::channel>(),
|
||||
hardwareFormat.getFormat(),
|
||||
"map-on-input-1",
|
||||
_name + "-muxer-in1");
|
||||
@ -92,8 +92,8 @@ audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const ejson::Ob
|
||||
} else {
|
||||
m_mapInput1.clear();
|
||||
for (const auto it : listChannelMap) {
|
||||
std::string value = it.toString().get();
|
||||
m_mapInput1.push_back(audio::getChannelFromString(value));
|
||||
etk::String value = it.toString().get();
|
||||
m_mapInput1.pushBack(audio::getChannelFromString(value));
|
||||
}
|
||||
if (m_mapInput1.size() != m_interfaceInput1->getInterfaceFormat().getMap().size()) {
|
||||
RIVER_ERROR("Request remap of the Input 1 the 2 size is wrong ... request=");
|
||||
@ -103,7 +103,7 @@ audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const ejson::Ob
|
||||
|
||||
RIVER_INFO("Create IN 2 : ");
|
||||
m_interfaceInput2 = createInput(hardwareFormat.getFrequency(),
|
||||
std::vector<audio::channel>(),
|
||||
etk::Vector<audio::channel>(),
|
||||
hardwareFormat.getFormat(),
|
||||
"map-on-input-2",
|
||||
_name + "-muxer-in2");
|
||||
@ -118,8 +118,8 @@ audio::river::io::NodeMuxer::NodeMuxer(const std::string& _name, const ejson::Ob
|
||||
} else {
|
||||
m_mapInput2.clear();
|
||||
for (const auto it : listChannelMap2) {
|
||||
std::string value = it.toString().get();
|
||||
m_mapInput2.push_back(audio::getChannelFromString(value));
|
||||
etk::String value = it.toString().get();
|
||||
m_mapInput2.pushBack(audio::getChannelFromString(value));
|
||||
}
|
||||
if (m_mapInput2.size() != m_interfaceInput2->getInterfaceFormat().getMap().size()) {
|
||||
RIVER_ERROR("Request remap of the Input 2 the 2 size is wrong ... request=");
|
||||
@ -192,7 +192,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput1(const void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
RIVER_PRINT("Input-1 Time=" << _time << " _nbChunk=" << _nbChunk << " _map=" << _map << " _format=" << _format << " freq=" << _frequency);
|
||||
RIVER_DEBUG(" next=" << _time + audio::Duration(0, _nbChunk*1000000000LL/int64_t(_frequency)) );
|
||||
/*
|
||||
@ -212,7 +212,7 @@ void audio::river::io::NodeMuxer::onDataReceivedInput2(const void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
RIVER_PRINT("Input-2 Time=" << _time << " _nbChunk=" << _nbChunk << " _map=" << _map << " _format=" << _format << " freq=" << _frequency);
|
||||
RIVER_DEBUG(" next=" << _time + audio::Duration(0, _nbChunk*1000000000LL/int64_t(_frequency)) );
|
||||
/*
|
||||
@ -274,8 +274,8 @@ void audio::river::io::NodeMuxer::process() {
|
||||
RIVER_ERROR("Can not synchronize flow ... : " << in1Time << " != " << in2Time << " delta = " << (in1Time-in2Time).count()/1000 << " µs");
|
||||
return;
|
||||
}
|
||||
std::vector<uint8_t> dataIn1;
|
||||
std::vector<uint8_t> dataIn2;
|
||||
etk::Vector<uint8_t> dataIn1;
|
||||
etk::Vector<uint8_t> dataIn2;
|
||||
dataIn1.resize(256*audio::getFormatBytes(getInterfaceFormat().getFormat())*m_mapInput1.size(), 0);
|
||||
dataIn2.resize(256*audio::getFormatBytes(getInterfaceFormat().getFormat())*m_mapInput2.size(), 0);
|
||||
m_data.resize(256*audio::getFormatBytes(getInterfaceFormat().getFormat())*getInterfaceFormat().getMap().size(), 0);
|
||||
@ -297,7 +297,7 @@ void audio::river::io::NodeMuxer::process() {
|
||||
}
|
||||
|
||||
|
||||
void audio::river::io::NodeMuxer::reorder(void* _output, uint32_t _nbChunk, void* _input, const std::vector<audio::channel>& _mapInput) {
|
||||
void audio::river::io::NodeMuxer::reorder(void* _output, uint32_t _nbChunk, void* _input, const etk::Vector<audio::channel>& _mapInput) {
|
||||
// real process: (only depend of data size):
|
||||
switch (getInterfaceFormat().getFormat()) {
|
||||
case audio::format_int8:
|
||||
@ -440,12 +440,12 @@ void audio::river::io::NodeMuxer::generateDot(etk::FSNode& _node) {
|
||||
|
||||
_node << " node [shape=box];\n";
|
||||
// TODO : Create a structure ...
|
||||
_node << " NODE_" << m_uid << "_HW_MUXER [ label=\"Muxer\\n channelMap=" << etk::to_string(getInterfaceFormat().getMap()) << "\" ];\n";
|
||||
std::string nameIn;
|
||||
std::string nameOut;
|
||||
_node << " NODE_" << m_uid << "_HW_MUXER [ label=\"Muxer\\n channelMap=" << etk::toString(getInterfaceFormat().getMap()) << "\" ];\n";
|
||||
etk::String nameIn;
|
||||
etk::String nameOut;
|
||||
m_process.generateDot(_node, 3, m_uid, nameIn, nameOut, false);
|
||||
_node << " node [shape=square];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::to_string(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||
// Link all nodes :
|
||||
_node << " NODE_" << m_uid << "_HW_MUXER -> " << nameIn << ";\n";
|
||||
_node << " " << nameOut << " -> NODE_" << m_uid << "_demuxer;\n";
|
||||
@ -473,11 +473,11 @@ void audio::river::io::NodeMuxer::generateDot(etk::FSNode& _node) {
|
||||
}
|
||||
if (element != nullptr) {
|
||||
if (element->getMode() == modeInterface_input) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_demuxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||
} else if (element->getMode() == modeInterface_output) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_muxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
||||
} else if (element->getMode() == modeInterface_feedback) {
|
||||
element->generateDot(_node, "NODE_" + etk::to_string(m_uid) + "_demuxer", isLink);
|
||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||
} else {
|
||||
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ namespace audio {
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
NodeMuxer(const std::string& _name, const ejson::Object& _config);
|
||||
NodeMuxer(const etk::String& _name, const ejson::Object& _config);
|
||||
public:
|
||||
static ememory::SharedPtr<NodeMuxer> create(const std::string& _name, const ejson::Object& _config);
|
||||
static ememory::SharedPtr<NodeMuxer> create(const etk::String& _name, const ejson::Object& _config);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -31,34 +31,34 @@ namespace audio {
|
||||
ememory::SharedPtr<audio::river::Interface> m_interfaceInput1;
|
||||
ememory::SharedPtr<audio::river::Interface> m_interfaceInput2;
|
||||
ememory::SharedPtr<audio::river::Interface> createInput(float _freq,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const std::string& _streamName,
|
||||
const std::string& _name);
|
||||
const etk::String& _streamName,
|
||||
const etk::String& _name);
|
||||
void onDataReceivedInput1(const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map);
|
||||
const etk::Vector<audio::channel>& _map);
|
||||
void onDataReceivedInput2(const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map);
|
||||
std::vector<audio::channel> m_mapInput1;
|
||||
std::vector<audio::channel> m_mapInput2;
|
||||
const etk::Vector<audio::channel>& _map);
|
||||
etk::Vector<audio::channel> m_mapInput1;
|
||||
etk::Vector<audio::channel> m_mapInput2;
|
||||
audio::drain::CircularBuffer m_bufferInput1;
|
||||
audio::drain::CircularBuffer m_bufferInput2;
|
||||
audio::Duration m_sampleTime; //!< represent the sample time at the specify frequency.
|
||||
void process();
|
||||
void processMuxer(void* _dataMic, void* _dataFB, uint32_t _nbChunk, const audio::Time& _time);
|
||||
std::vector<uint8_t> m_data;
|
||||
etk::Vector<uint8_t> m_data;
|
||||
public:
|
||||
virtual void generateDot(etk::FSNode& _node);
|
||||
private:
|
||||
void reorder(void* _output, uint32_t _nbChunk, void* _input, const std::vector<audio::channel>& _mapInput);
|
||||
void reorder(void* _output, uint32_t _nbChunk, void* _input, const etk::Vector<audio::channel>& _mapInput);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
int32_t audio::river::io::NodeOrchestra::recordCallback(const void* _inputBuffer,
|
||||
const audio::Time& _timeInput,
|
||||
uint32_t _nbChunk,
|
||||
const std::vector<audio::orchestra::status>& _status) {
|
||||
const etk::Vector<audio::orchestra::status>& _status) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
// TODO : Manage status ...
|
||||
RIVER_VERBOSE("data Input size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size());
|
||||
@ -24,7 +24,7 @@ int32_t audio::river::io::NodeOrchestra::recordCallback(const void* _inputBuffer
|
||||
int32_t audio::river::io::NodeOrchestra::playbackCallback(void* _outputBuffer,
|
||||
const audio::Time& _timeOutput,
|
||||
uint32_t _nbChunk,
|
||||
const std::vector<audio::orchestra::status>& _status) {
|
||||
const etk::Vector<audio::orchestra::status>& _status) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
// TODO : Manage status ...
|
||||
RIVER_VERBOSE("data Output size request :" << _nbChunk << " [BEGIN] status=" << _status << " nbIO=" << m_list.size() << " data=" << uint64_t(_outputBuffer));
|
||||
@ -34,11 +34,11 @@ int32_t audio::river::io::NodeOrchestra::playbackCallback(void* _outputBuffer,
|
||||
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::river::io::NodeOrchestra> audio::river::io::NodeOrchestra::create(const std::string& _name, const ejson::Object& _config) {
|
||||
ememory::SharedPtr<audio::river::io::NodeOrchestra> audio::river::io::NodeOrchestra::create(const etk::String& _name, const ejson::Object& _config) {
|
||||
return ememory::SharedPtr<audio::river::io::NodeOrchestra>(new audio::river::io::NodeOrchestra(_name, _config));
|
||||
}
|
||||
|
||||
audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const ejson::Object& _config) :
|
||||
audio::river::io::NodeOrchestra::NodeOrchestra(const etk::String& _name, const ejson::Object& _config) :
|
||||
Node(_name, _config) {
|
||||
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
|
||||
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
||||
@ -49,8 +49,8 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const e
|
||||
},
|
||||
nb-chunk:1024 # number of chunk to open device (create the latency anf the frequency to call user)
|
||||
*/
|
||||
std::string typeInterface = audio::orchestra::typeUndefined;
|
||||
std::string streamName = "default";
|
||||
etk::String typeInterface = audio::orchestra::typeUndefined;
|
||||
etk::String streamName = "default";
|
||||
const ejson::Object tmpObject = m_config["map-on"].toObject();
|
||||
if (tmpObject.exist() == false) {
|
||||
RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'");
|
||||
@ -67,7 +67,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const e
|
||||
m_interface.instanciate(typeInterface);
|
||||
m_interface.setName(_name);
|
||||
// TODO : Check return ...
|
||||
std::string type = m_config["type"].toString().get("int16");
|
||||
etk::String type = m_config["type"].toString().get("int16");
|
||||
if (streamName == "") {
|
||||
streamName = "default";
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ namespace audio {
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
NodeOrchestra(const std::string& _name, const ejson::Object& _config);
|
||||
NodeOrchestra(const etk::String& _name, const ejson::Object& _config);
|
||||
public:
|
||||
static ememory::SharedPtr<NodeOrchestra> create(const std::string& _name, const ejson::Object& _config);
|
||||
static ememory::SharedPtr<NodeOrchestra> create(const etk::String& _name, const ejson::Object& _config);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
@ -50,7 +50,7 @@ namespace audio {
|
||||
int32_t recordCallback(const void* _inputBuffer,
|
||||
const audio::Time& _timeInput,
|
||||
uint32_t _nbChunk,
|
||||
const std::vector<audio::orchestra::status>& _status);
|
||||
const etk::Vector<audio::orchestra::status>& _status);
|
||||
/**
|
||||
* @brief Playback callback. Request new data on output
|
||||
* @param[in,out] _outputBuffer Pointer on the buffer to fill data.
|
||||
@ -62,7 +62,7 @@ namespace audio {
|
||||
int32_t playbackCallback(void* _outputBuffer,
|
||||
const audio::Time& _timeOutput,
|
||||
uint32_t _nbChunk,
|
||||
const std::vector<audio::orchestra::status>& _status);
|
||||
const etk::Vector<audio::orchestra::status>& _status);
|
||||
protected:
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
|
@ -53,11 +53,11 @@ int32_t audio::river::io::NodePortAudio::duplexCallback(const void* _inputBuffer
|
||||
}
|
||||
|
||||
|
||||
ememory::SharedPtr<audio::river::io::NodePortAudio> audio::river::io::NodePortAudio::create(const std::string& _name, const ejson::Object& _config) {
|
||||
ememory::SharedPtr<audio::river::io::NodePortAudio> audio::river::io::NodePortAudio::create(const etk::String& _name, const ejson::Object& _config) {
|
||||
return ememory::SharedPtr<audio::river::io::NodePortAudio>(new audio::river::io::NodePortAudio(_name, _config));
|
||||
}
|
||||
|
||||
audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const ejson::Object& _config) :
|
||||
audio::river::io::NodePortAudio::NodePortAudio(const etk::String& _name, const ejson::Object& _config) :
|
||||
Node(_name, _config) {
|
||||
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
|
||||
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
||||
@ -68,12 +68,12 @@ audio::river::io::NodePortAudio::NodePortAudio(const std::string& _name, const e
|
||||
},
|
||||
nb-chunk:1024 # number of chunk to open device (create the latency anf the frequency to call user)
|
||||
*/
|
||||
std::string streamName = "default";
|
||||
etk::String streamName = "default";
|
||||
const ejson::Object tmpObject = m_config["map-on"].toObject();
|
||||
if (tmpObject.exist() == false) {
|
||||
RIVER_WARNING("missing node : 'map-on' ==> auto map : 'auto:default'");
|
||||
} else {
|
||||
std::string value = tmpObject.getStringValue("interface", "default");
|
||||
etk::String value = tmpObject.getStringValue("interface", "default");
|
||||
streamName = tmpObject.getStringValue("name", "default");
|
||||
}
|
||||
int32_t nbChunk = m_config.getNumberValue("nb-chunk", 1024);
|
||||
|
@ -21,9 +21,9 @@ namespace audio {
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
NodePortAudio(const std::string& _name, const ejson::Object& _config);
|
||||
NodePortAudio(const etk::String& _name, const ejson::Object& _config);
|
||||
public:
|
||||
static ememory::SharedPtr<NodePortAudio> create(const std::string& _name, const ejson::Object& _config);
|
||||
static ememory::SharedPtr<NodePortAudio> create(const etk::String& _name, const ejson::Object& _config);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
|
@ -9,11 +9,11 @@
|
||||
#include <audio/river/io/Manager.hpp>
|
||||
|
||||
static bool river_isInit = false;
|
||||
static std::string river_configFile = "";
|
||||
static etk::String river_configFile = "";
|
||||
|
||||
|
||||
|
||||
void audio::river::init(const std::string& _filename) {
|
||||
void audio::river::init(const etk::String& _filename) {
|
||||
if (river_isInit == false) {
|
||||
river_isInit = true;
|
||||
river_configFile = _filename;
|
||||
@ -27,7 +27,7 @@ void audio::river::init(const std::string& _filename) {
|
||||
}
|
||||
}
|
||||
|
||||
void audio::river::initString(const std::string& _config) {
|
||||
void audio::river::initString(const etk::String& _config) {
|
||||
if (river_isInit == false) {
|
||||
river_isInit = true;
|
||||
river_configFile = _config;
|
||||
|
@ -18,12 +18,12 @@ namespace audio {
|
||||
* @brief Initialize the River Library
|
||||
* @param[in] _filename Name of the configuration file (if "" ==> default config file)
|
||||
*/
|
||||
void init(const std::string& _filename = "");
|
||||
void init(const etk::String& _filename = "");
|
||||
/**
|
||||
* @brief Initialize the River Library with a json data string
|
||||
* @param[in] _config json sting data
|
||||
*/
|
||||
void initString(const std::string& _config);
|
||||
void initString(const etk::String& _config);
|
||||
/**
|
||||
* @brief Un-initialize the River Library
|
||||
* @note this close all stream of all interfaces.
|
||||
|
@ -20,7 +20,7 @@ appl::Windows::Windows() :
|
||||
|
||||
void appl::Windows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
std::string composition = std::string("");
|
||||
etk::String composition = etk::String("");
|
||||
composition += "<sizer mode='vert'>\n";
|
||||
composition += " <sizer mode='hori' lock='true' min-size='10,10%'>\n";
|
||||
composition += " <button name='bt-record' expend='true' fill='true'>\n";
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <ewol/context/Context.hpp>
|
||||
#include <audio/river/widget/TemporalViewer.hpp>
|
||||
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" microphone:{\n"
|
||||
" io:'input',\n"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
//! [audio_river_sample_read_config_file]
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" microphone:{\n"
|
||||
" io:'input',\n"
|
||||
@ -41,7 +41,7 @@ void onDataReceived(const void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
etk::FSNode* _outputNode) {
|
||||
if ( _format != audio::format_int16
|
||||
&& _format != audio::format_float) {
|
||||
@ -82,11 +82,11 @@ int main(int _argc, const char **_argv) {
|
||||
etk::init(_argc, _argv);
|
||||
//! [audio_river_sample_init]
|
||||
// local parameter:
|
||||
std::string configFile;
|
||||
std::string ioName="microphone";
|
||||
std::string outputFileName = "";
|
||||
etk::String configFile;
|
||||
etk::String ioName="microphone";
|
||||
etk::String outputFileName = "";
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
std::cout << "Help : " << std::endl;
|
||||
@ -95,13 +95,13 @@ int main(int _argc, const char **_argv) {
|
||||
std::cout << " --file=yyy.raw File name to store data" << std::endl;
|
||||
exit(0);
|
||||
} else if (etk::start_with(data, "--conf=") == true) {
|
||||
configFile = std::string(data.begin()+7, data.end());
|
||||
configFile = etk::String(data.begin()+7, data.end());
|
||||
std::cout << "Select config: " << configFile << std::endl;
|
||||
} else if (etk::start_with(data, "--io=") == true) {
|
||||
ioName = std::string(data.begin()+5, data.end());
|
||||
ioName = etk::String(data.begin()+5, data.end());
|
||||
std::cout << "Select io: " << ioName << std::endl;
|
||||
} else if (etk::start_with(data, "--file=") == true) {
|
||||
outputFileName = std::string(data.begin()+7, data.end());
|
||||
outputFileName = etk::String(data.begin()+7, data.end());
|
||||
std::cout << "Select output file name: " << outputFileName << std::endl;
|
||||
}
|
||||
}
|
||||
@ -120,7 +120,7 @@ int main(int _argc, const char **_argv) {
|
||||
ememory::SharedPtr<audio::river::Interface> interface;
|
||||
//Get the generic input:
|
||||
interface = manager->createInput(48000,
|
||||
std::vector<audio::channel>(),
|
||||
etk::Vector<audio::channel>(),
|
||||
audio::format_int16,
|
||||
ioName);
|
||||
if(interface == nullptr) {
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
//! [audio_river_sample_write_config_file]
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
@ -40,7 +40,7 @@ void onDataNeeded(void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _sampleRate,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
static double phase[8] = {0,0,0,0,0,0,0,0};
|
||||
|
||||
if (_format != audio::format_int16) {
|
||||
@ -65,7 +65,7 @@ int main(int _argc, const char **_argv) {
|
||||
// the only one init for etk:
|
||||
etk::init(_argc, _argv);
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
std::cout << "Help : " << std::endl;
|
||||
@ -82,7 +82,7 @@ int main(int _argc, const char **_argv) {
|
||||
ememory::SharedPtr<audio::river::Interface> interface;
|
||||
//Get the generic input:
|
||||
interface = manager->createOutput(48000,
|
||||
std::vector<audio::channel>(),
|
||||
etk::Vector<audio::channel>(),
|
||||
audio::format_int16,
|
||||
"speaker");
|
||||
if(interface == nullptr) {
|
||||
|
@ -53,7 +53,7 @@ int main(int _argc, const char** _argv) {
|
||||
// the only one init for etk:
|
||||
etk::init(_argc, _argv);
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
TEST_PRINT("Help : ");
|
||||
|
@ -16,15 +16,15 @@ namespace river_test_aec {
|
||||
ememory::SharedPtr<audio::river::Interface> m_interfaceIn;
|
||||
audio::drain::CircularBuffer m_buffer;
|
||||
public:
|
||||
Linker(ememory::SharedPtr<audio::river::Manager> _manager, const std::string& _input, const std::string& _output) :
|
||||
Linker(ememory::SharedPtr<audio::river::Manager> _manager, const etk::String& _input, const etk::String& _output) :
|
||||
m_manager(_manager) {
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
if (false) { //"speaker" == _output) {
|
||||
channelMap.push_back(audio::channel_frontCenter);
|
||||
channelMap.pushBack(audio::channel_frontCenter);
|
||||
} else {
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
}
|
||||
m_buffer.setCapacity(std::chrono::milliseconds(2000), sizeof(int16_t)*channelMap.size(), 48000);
|
||||
|
||||
@ -74,7 +74,7 @@ namespace river_test_aec {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
@ -85,7 +85,7 @@ namespace river_test_aec {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
@ -118,7 +118,7 @@ namespace river_test_aec {
|
||||
}
|
||||
};
|
||||
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
|
@ -22,7 +22,7 @@ namespace river_test_echo_delay {
|
||||
audio::Time m_currentTick;
|
||||
int32_t m_stateFB;
|
||||
int32_t m_stateMic;
|
||||
std::vector<uint64_t> m_delayListMic;
|
||||
etk::Vector<uint64_t> m_delayListMic;
|
||||
bool m_estimateVolumeInput;
|
||||
int16_t m_volumeInputMax;
|
||||
int16_t m_volumeInputMin;
|
||||
@ -39,7 +39,7 @@ namespace river_test_echo_delay {
|
||||
m_estimateVolumeInput(true),
|
||||
m_gain(-40) {
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
m_interfaceOut = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
@ -58,7 +58,7 @@ namespace river_test_echo_delay {
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceOut->addVolumeGroup("FLOW");
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::to_string(m_gain) + "dB");
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::toString(m_gain) + "dB");
|
||||
|
||||
m_interfaceIn = m_manager->createInput(48000,
|
||||
channelMap,
|
||||
@ -103,7 +103,7 @@ namespace river_test_echo_delay {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
int16_t* data = static_cast<int16_t*>(_data);
|
||||
double baseCycle = 2.0*M_PI/(double)48000 * m_freq;
|
||||
if (m_estimateVolumeInput == true) {
|
||||
@ -186,7 +186,7 @@ namespace river_test_echo_delay {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
@ -241,7 +241,7 @@ namespace river_test_echo_delay {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
@ -253,8 +253,8 @@ namespace river_test_echo_delay {
|
||||
if (m_stateMic <= 40) {
|
||||
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
|
||||
//TEST_INFO("value=" << data[iii]);
|
||||
m_volumeInputMax = std::max(int16_t(data[iii]), m_volumeInputMax);
|
||||
m_volumeInputMin = std::min(int16_t(data[iii]), m_volumeInputMin);
|
||||
m_volumeInputMax = etk::max(int16_t(data[iii]), m_volumeInputMax);
|
||||
m_volumeInputMin = etk::min(int16_t(data[iii]), m_volumeInputMin);
|
||||
}
|
||||
if (m_stateMic == 40) {
|
||||
m_volumeInputMax *= 2;
|
||||
@ -265,8 +265,8 @@ namespace river_test_echo_delay {
|
||||
int16_t valueMin = 0;
|
||||
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
|
||||
//TEST_INFO("value=" << data[iii]);
|
||||
valueMax = std::max(int16_t(data[iii]), valueMax);
|
||||
valueMin = std::min(int16_t(data[iii]), valueMin);
|
||||
valueMax = etk::max(int16_t(data[iii]), valueMax);
|
||||
valueMin = etk::min(int16_t(data[iii]), valueMin);
|
||||
}
|
||||
if ( valueMax > m_volumeInputMax
|
||||
&& valueMin < m_volumeInputMin
|
||||
@ -277,8 +277,8 @@ namespace river_test_echo_delay {
|
||||
)
|
||||
) {
|
||||
m_gain += 3.0f;
|
||||
m_gain = std::min(m_gain, 0.0f);
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::to_string(m_gain) + "dB");
|
||||
m_gain = etk::min(m_gain, 0.0f);
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::toString(m_gain) + "dB");
|
||||
TEST_INFO("Set detection volume : " << m_gain << " m_stateMic=" << m_stateMic);
|
||||
m_stateMic = 3;
|
||||
m_phase = -1;
|
||||
@ -291,8 +291,8 @@ namespace river_test_echo_delay {
|
||||
}
|
||||
// just update volume
|
||||
m_gain += 1.0f;
|
||||
m_gain = std::min(m_gain, 0.0f);
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::to_string(m_gain) + "dB");
|
||||
m_gain = etk::min(m_gain, 0.0f);
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::toString(m_gain) + "dB");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -320,7 +320,7 @@ namespace river_test_echo_delay {
|
||||
audio::Duration delay = time-m_currentTick;
|
||||
int32_t sampleDalay = (delay.count()*_frequency)/1000000000LL;
|
||||
TEST_WARNING("MIC: 1 time detected: " << time << " delay = " << float(delay.count())/1000.0f << "µs samples=" << sampleDalay);
|
||||
m_delayListMic.push_back(delay.count());
|
||||
m_delayListMic.pushBack(delay.count());
|
||||
}
|
||||
} else if (m_stateMic == 2) {
|
||||
// inverse phase
|
||||
@ -333,7 +333,7 @@ namespace river_test_echo_delay {
|
||||
audio::Duration delay = time-m_currentTick;
|
||||
int32_t sampleDalay = (delay.count()*_frequency)/1000000000LL;
|
||||
TEST_WARNING("MIC: 2 time detected: " << time << " delay = " << float(delay.count())/1000.0f << "µs samples=" << sampleDalay);
|
||||
m_delayListMic.push_back(delay.count());
|
||||
m_delayListMic.pushBack(delay.count());
|
||||
}
|
||||
} else if (m_stateMic == 3) {
|
||||
// TODO : Detect the pic ...
|
||||
@ -379,7 +379,7 @@ namespace river_test_echo_delay {
|
||||
}
|
||||
};
|
||||
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace river_test_format {
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
@ -41,17 +41,17 @@ namespace river_test_format {
|
||||
m_nbChannels(_nbChannels),
|
||||
m_generateFreq(550.0f) {
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
if (m_nbChannels == 1) {
|
||||
channelMap.push_back(audio::channel_frontCenter);
|
||||
channelMap.pushBack(audio::channel_frontCenter);
|
||||
} else if (m_nbChannels == 2) {
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
} else if (m_nbChannels == 4) {
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
channelMap.push_back(audio::channel_rearLeft);
|
||||
channelMap.push_back(audio::channel_rearRight);
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
channelMap.pushBack(audio::channel_rearLeft);
|
||||
channelMap.pushBack(audio::channel_rearRight);
|
||||
} else {
|
||||
TEST_ERROR("Can not generate with channel != 1,2,4");
|
||||
return;
|
||||
@ -80,7 +80,7 @@ namespace river_test_format {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
//TEST_DEBUG("Get data ... " << _format << " map=" << _map << " chunk=" << _nbChunk);
|
||||
double baseCycle = 2.0*M_PI/double(m_freq) * double(m_generateFreq);
|
||||
if (_format == audio::format_int16) {
|
||||
@ -197,28 +197,28 @@ namespace river_test_format {
|
||||
ememory::SharedPtr<audio::river::Manager> manager;
|
||||
manager = audio::river::Manager::create("testApplication");
|
||||
TEST_INFO("test convert flaot to output (callback mode)");
|
||||
std::vector<float> listFreq;
|
||||
listFreq.push_back(4000);
|
||||
listFreq.push_back(8000);
|
||||
listFreq.push_back(16000);
|
||||
listFreq.push_back(32000);
|
||||
listFreq.push_back(48000);
|
||||
listFreq.push_back(48001);
|
||||
listFreq.push_back(64000);
|
||||
listFreq.push_back(96000);
|
||||
listFreq.push_back(11250);
|
||||
listFreq.push_back(2250);
|
||||
listFreq.push_back(44100);
|
||||
listFreq.push_back(88200);
|
||||
std::vector<int32_t> listChannel;
|
||||
listChannel.push_back(1);
|
||||
listChannel.push_back(2);
|
||||
listChannel.push_back(4);
|
||||
std::vector<audio::format> listFormat;
|
||||
listFormat.push_back(audio::format_int16);
|
||||
listFormat.push_back(audio::format_int16_on_int32);
|
||||
listFormat.push_back(audio::format_int32);
|
||||
listFormat.push_back(audio::format_float);
|
||||
etk::Vector<float> listFreq;
|
||||
listFreq.pushBack(4000);
|
||||
listFreq.pushBack(8000);
|
||||
listFreq.pushBack(16000);
|
||||
listFreq.pushBack(32000);
|
||||
listFreq.pushBack(48000);
|
||||
listFreq.pushBack(48001);
|
||||
listFreq.pushBack(64000);
|
||||
listFreq.pushBack(96000);
|
||||
listFreq.pushBack(11250);
|
||||
listFreq.pushBack(2250);
|
||||
listFreq.pushBack(44100);
|
||||
listFreq.pushBack(88200);
|
||||
etk::Vector<int32_t> listChannel;
|
||||
listChannel.pushBack(1);
|
||||
listChannel.pushBack(2);
|
||||
listChannel.pushBack(4);
|
||||
etk::Vector<audio::format> listFormat;
|
||||
listFormat.pushBack(audio::format_int16);
|
||||
listFormat.pushBack(audio::format_int16_on_int32);
|
||||
listFormat.pushBack(audio::format_int32);
|
||||
listFormat.pushBack(audio::format_float);
|
||||
for (size_t fff=0; fff<listFreq.size(); ++fff) {
|
||||
for (size_t ccc=0; ccc<listChannel.size(); ++ccc) {
|
||||
for (size_t iii=0; iii<listFormat.size(); ++iii) {
|
||||
|
@ -18,9 +18,9 @@ namespace river_test_muxer {
|
||||
TestClass(ememory::SharedPtr<audio::river::Manager> _manager) :
|
||||
m_manager(_manager),
|
||||
m_phase(0) {
|
||||
std::vector<audio::channel> channelMap;
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
m_interfaceOut = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
@ -43,7 +43,7 @@ namespace river_test_muxer {
|
||||
|
||||
//Set stereo output:
|
||||
m_interfaceIn = m_manager->createInput(48000,
|
||||
std::vector<audio::channel>(),
|
||||
etk::Vector<audio::channel>(),
|
||||
audio::format_int16,
|
||||
"microphone-muxed");
|
||||
if(m_interfaceIn == nullptr) {
|
||||
@ -67,7 +67,7 @@ namespace river_test_muxer {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
int16_t* data = static_cast<int16_t*>(_data);
|
||||
double baseCycle = 2.0*M_PI/(double)48000 * 440;
|
||||
for (int32_t iii=0; iii<_nbChunk; iii++) {
|
||||
@ -85,7 +85,7 @@ namespace river_test_muxer {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
@ -109,7 +109,7 @@ namespace river_test_muxer {
|
||||
}
|
||||
};
|
||||
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
|
@ -13,13 +13,13 @@ namespace river_test_playback_callback {
|
||||
ememory::SharedPtr<audio::river::Interface> m_interface;
|
||||
double m_phase;
|
||||
public:
|
||||
testOutCallback(ememory::SharedPtr<audio::river::Manager> _manager, const std::string& _io="speaker") :
|
||||
testOutCallback(ememory::SharedPtr<audio::river::Manager> _manager, const etk::String& _io="speaker") :
|
||||
m_manager(_manager),
|
||||
m_phase(0) {
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
m_interface = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
@ -43,7 +43,7 @@ namespace river_test_playback_callback {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
@ -71,7 +71,7 @@ namespace river_test_playback_callback {
|
||||
}
|
||||
};
|
||||
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace river_test_playback_write {
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
@ -24,15 +24,15 @@ namespace river_test_playback_write {
|
||||
|
||||
class testOutWrite {
|
||||
public:
|
||||
std::vector<audio::channel> m_channelMap;
|
||||
etk::Vector<audio::channel> m_channelMap;
|
||||
ememory::SharedPtr<audio::river::Manager> m_manager;
|
||||
ememory::SharedPtr<audio::river::Interface> m_interface;
|
||||
public:
|
||||
testOutWrite(ememory::SharedPtr<audio::river::Manager> _manager) :
|
||||
m_manager(_manager) {
|
||||
//Set stereo output:
|
||||
m_channelMap.push_back(audio::channel_frontLeft);
|
||||
m_channelMap.push_back(audio::channel_frontRight);
|
||||
m_channelMap.pushBack(audio::channel_frontLeft);
|
||||
m_channelMap.pushBack(audio::channel_frontRight);
|
||||
m_interface = m_manager->createOutput(48000,
|
||||
m_channelMap,
|
||||
audio::format_int16,
|
||||
@ -49,7 +49,7 @@ namespace river_test_playback_write {
|
||||
return;
|
||||
}
|
||||
double phase=0;
|
||||
std::vector<int16_t> data;
|
||||
etk::Vector<int16_t> data;
|
||||
data.resize(1024*m_channelMap.size());
|
||||
double baseCycle = 2.0*M_PI/48000.0 * 440.0;
|
||||
// start fill buffer
|
||||
@ -106,10 +106,10 @@ namespace river_test_playback_write {
|
||||
testOutWriteCallback(ememory::SharedPtr<audio::river::Manager> _manager) :
|
||||
m_manager(_manager),
|
||||
m_phase(0) {
|
||||
std::vector<audio::channel> channelMap;
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
//Set stereo output:
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
m_interface = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
@ -131,11 +131,11 @@ namespace river_test_playback_write {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
std::vector<int16_t> data;
|
||||
etk::Vector<int16_t> data;
|
||||
data.resize(1024*_map.size());
|
||||
double baseCycle = 2.0*M_PI/48000.0 * 440.0;
|
||||
// start fill buffer
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <test-debug/debug.hpp>
|
||||
|
||||
namespace river_test_record_callback {
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" microphone:{\n"
|
||||
" io:'input',\n"
|
||||
@ -28,10 +28,10 @@ namespace river_test_record_callback {
|
||||
ememory::SharedPtr<audio::river::Manager> m_manager;
|
||||
ememory::SharedPtr<audio::river::Interface> m_interface;
|
||||
public:
|
||||
testInCallback(ememory::SharedPtr<audio::river::Manager> _manager, const std::string& _input="microphone") :
|
||||
testInCallback(ememory::SharedPtr<audio::river::Manager> _manager, const etk::String& _input="microphone") :
|
||||
m_manager(_manager) {
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
m_interface = m_manager->createInput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
@ -55,7 +55,7 @@ namespace river_test_record_callback {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
if (_format != audio::format_int16) {
|
||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace river_test_volume {
|
||||
static const std::string configurationRiver =
|
||||
static const etk::String configurationRiver =
|
||||
"{\n"
|
||||
" speaker:{\n"
|
||||
" io:'output',\n"
|
||||
@ -32,9 +32,9 @@ namespace river_test_volume {
|
||||
m_manager(_manager),
|
||||
m_phase(0) {
|
||||
//Set stereo output:
|
||||
std::vector<audio::channel> channelMap;
|
||||
channelMap.push_back(audio::channel_frontLeft);
|
||||
channelMap.push_back(audio::channel_frontRight);
|
||||
etk::Vector<audio::channel> channelMap;
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
m_interface = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
audio::format_int16,
|
||||
@ -60,7 +60,7 @@ namespace river_test_volume {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
int16_t* data = static_cast<int16_t*>(_data);
|
||||
double baseCycle = 2.0*M_PI/(double)48000 * (double)550;
|
||||
for (int32_t iii=0; iii<_nbChunk; iii++) {
|
||||
|
@ -37,7 +37,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map) {
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
if (_format != audio::format_float) {
|
||||
std::cout << "[ERROR] call wrong type ... (need int16_t)" << std::endl;
|
||||
@ -45,7 +45,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
|
||||
// get the curent power of the signal.
|
||||
const float* data = static_cast<const float*>(_data);
|
||||
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
|
||||
m_data.push_back(data[iii]);
|
||||
m_data.pushBack(data[iii]);
|
||||
}
|
||||
/*
|
||||
if (m_data.size()>m_sampleRate*nbSecond*10) {
|
||||
@ -59,8 +59,8 @@ void audio::river::widget::TemporalViewer::recordToggle() {
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
if (m_interface == nullptr) {
|
||||
//Get the generic input:
|
||||
std::vector<audio::channel> channel;
|
||||
channel.push_back(audio::channel_frontLeft);
|
||||
etk::Vector<audio::channel> channel;
|
||||
channel.pushBack(audio::channel_frontLeft);
|
||||
m_interface = m_manager->createInput(m_sampleRate,
|
||||
channel,
|
||||
audio::format_float,
|
||||
@ -111,7 +111,7 @@ void audio::river::widget::TemporalViewer::onRegenerateDisplay() {
|
||||
// create n section for display:
|
||||
int32_t nbSlot = m_size.x();
|
||||
int32_t sizeSlot = m_size.x()/nbSlot;
|
||||
std::vector<float> list;
|
||||
etk::Vector<float> list;
|
||||
//ARW_INFO("nbSlot : " << nbSlot << " sizeSlot=" << sizeSlot << " m_size=" << m_size);
|
||||
list.resize(nbSlot,0.0f);
|
||||
int32_t step = m_sampleRate*nbSecond/nbSlot;
|
||||
@ -119,7 +119,7 @@ void audio::river::widget::TemporalViewer::onRegenerateDisplay() {
|
||||
int32_t id = kkk/step;
|
||||
if (id < list.size()) {
|
||||
if (kkk < m_data.size()) {
|
||||
list[id] = std::max(list[id],m_data[kkk]);
|
||||
list[id] = etk::max(list[id],m_data[kkk]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace audio {
|
||||
// ...
|
||||
}
|
||||
private:
|
||||
std::vector<float> m_data;
|
||||
etk::Vector<float> m_data;
|
||||
private:
|
||||
float m_minVal; //!< display minimum value
|
||||
float m_maxVal; //!< display maximum value
|
||||
@ -50,7 +50,7 @@ namespace audio {
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const std::vector<audio::channel>& _map);
|
||||
const etk::Vector<audio::channel>& _map);
|
||||
int32_t m_sampleRate;
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user