[DEV] update new etk Uri API
This commit is contained in:
parent
965df2ee2f
commit
1773297dab
@ -12,9 +12,7 @@
|
|||||||
#include <audio/drain/EndPointRead.hpp>
|
#include <audio/drain/EndPointRead.hpp>
|
||||||
#include <audio/drain/Volume.hpp>
|
#include <audio/drain/Volume.hpp>
|
||||||
|
|
||||||
audio::river::Interface::Interface(void) :
|
audio::river::Interface::Interface(void) {
|
||||||
m_node(),
|
|
||||||
m_name("") {
|
|
||||||
static uint32_t uid = 0;
|
static uint32_t uid = 0;
|
||||||
m_uid = uid++;
|
m_uid = uid++;
|
||||||
|
|
||||||
@ -460,19 +458,19 @@ void audio::river::Interface::systemVolumeChange() {
|
|||||||
algo->volumeChange();
|
algo->volumeChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const etk::String& _second, bool _isLink=true) {
|
static void link(ememory::SharedPtr<etk::io::Interface>& _io, const etk::String& _first, const etk::String& _op, const etk::String& _second, bool _isLink=true) {
|
||||||
if (_op == "->") {
|
if (_op == "->") {
|
||||||
if (_isLink) {
|
if (_isLink) {
|
||||||
_node << " " << _first << " -> " << _second << ";\n";
|
*_io << " " << _first << " -> " << _second << ";\n";
|
||||||
} else {
|
} else {
|
||||||
_node << " " << _first << " -> " << _second << " [style=dashed];\n";
|
*_io << " " << _first << " -> " << _second << " [style=dashed];\n";
|
||||||
}
|
}
|
||||||
} else if (_op == "<-") {
|
} else if (_op == "<-") {
|
||||||
_node << " " << _first << " -> " <<_second<< " [color=transparent];\n";
|
*_io << " " << _first << " -> " <<_second<< " [color=transparent];\n";
|
||||||
if (_isLink) {
|
if (_isLink) {
|
||||||
_node << " " << _second << " -> " << _first << " [constraint=false];\n";
|
*_io << " " << _second << " -> " << _first << " [constraint=false];\n";
|
||||||
} else {
|
} else {
|
||||||
_node << " " << _second << " -> " << _first << " [constraint=false, style=dashed];\n";
|
*_io << " " << _second << " -> " << _first << " [constraint=false, style=dashed];\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -488,37 +486,37 @@ etk::String audio::river::Interface::getDotNodeName() const {
|
|||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::river::Interface::generateDot(etk::FSNode& _node, const etk::String& _nameIO, bool _isLink) {
|
void audio::river::Interface::generateDot(ememory::SharedPtr<etk::io::Interface>& _io, const etk::String& _nameIO, bool _isLink) {
|
||||||
_node << " subgraph clusterInterface_" << m_uid << " {\n";
|
*_io << " subgraph clusterInterface_" << m_uid << " {\n";
|
||||||
_node << " color=orange;\n";
|
*_io << " color=orange;\n";
|
||||||
_node << " label=\"[" << m_uid << "] Interface : " << m_name << "\";\n";
|
*_io << " label=\"[" << m_uid << "] Interface : " << m_name << "\";\n";
|
||||||
etk::String nameIn;
|
etk::String nameIn;
|
||||||
etk::String nameOut;
|
etk::String nameOut;
|
||||||
if ( m_mode == audio::river::modeInterface_input
|
if ( m_mode == audio::river::modeInterface_input
|
||||||
|| m_mode == audio::river::modeInterface_feedback) {
|
|| m_mode == audio::river::modeInterface_feedback) {
|
||||||
m_process.generateDot(_node, 3, 10000+m_uid, nameIn, nameOut, false);
|
m_process.generateDot(_io, 3, 10000+m_uid, nameIn, nameOut, false);
|
||||||
} else {
|
} else {
|
||||||
m_process.generateDot(_node, 3, 10000+m_uid, nameOut, nameIn, true);
|
m_process.generateDot(_io, 3, 10000+m_uid, nameOut, nameIn, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ( m_mode == audio::river::modeInterface_input
|
if ( m_mode == audio::river::modeInterface_input
|
||||||
|| m_mode == audio::river::modeInterface_feedback) {
|
|| m_mode == audio::river::modeInterface_feedback) {
|
||||||
link(_node, _nameIO, "->", nameIn, _isLink);
|
link(_io, _nameIO, "->", nameIn, _isLink);
|
||||||
} else {
|
} else {
|
||||||
link(_node, _nameIO, "<-", nameOut, _isLink);
|
link(_io, _nameIO, "<-", nameOut, _isLink);
|
||||||
}
|
}
|
||||||
_node << " node [shape=Mdiamond];\n";
|
*_io << " node [shape=Mdiamond];\n";
|
||||||
if (m_mode == audio::river::modeInterface_input) {
|
if (m_mode == audio::river::modeInterface_input) {
|
||||||
_node << " " << getDotNodeName() << " [ label=\"API\\nINPUT\" ];\n";
|
*_io << " " << getDotNodeName() << " [ label=\"API\\nINPUT\" ];\n";
|
||||||
link(_node, nameOut, "->", getDotNodeName());
|
link(_io, nameOut, "->", getDotNodeName());
|
||||||
} else if (m_mode == audio::river::modeInterface_feedback) {
|
} else if (m_mode == audio::river::modeInterface_feedback) {
|
||||||
_node << " " << getDotNodeName() << " [ label=\"API\\nFEEDBACK\" ];\n";
|
*_io << " " << getDotNodeName() << " [ label=\"API\\nFEEDBACK\" ];\n";
|
||||||
link(_node, nameOut, "->", getDotNodeName());
|
link(_io, nameOut, "->", getDotNodeName());
|
||||||
} else if (m_mode == audio::river::modeInterface_output) {
|
} else if (m_mode == audio::river::modeInterface_output) {
|
||||||
_node << " " << getDotNodeName() << " [ label=\"API\\nOUTPUT\" ];\n";
|
*_io << " " << getDotNodeName() << " [ label=\"API\\nOUTPUT\" ];\n";
|
||||||
link(_node, nameIn, "<-", getDotNodeName());
|
link(_io, nameIn, "<-", getDotNodeName());
|
||||||
}
|
}
|
||||||
_node << " }\n \n";
|
*_io << " }\n \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include <audio/drain/EndPointCallback.hpp>
|
#include <audio/drain/EndPointCallback.hpp>
|
||||||
#include <audio/drain/EndPointWrite.hpp>
|
#include <audio/drain/EndPointWrite.hpp>
|
||||||
#include <ejson/ejson.hpp>
|
#include <ejson/ejson.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
#include <audio/Time.hpp>
|
#include <audio/Time.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
@ -298,11 +297,11 @@ namespace audio {
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Create the dot in the FileNode stream.
|
* @brief Create the dot in the FileNode stream.
|
||||||
* @param[in,out] _node File node to write data.
|
* @param[in,out] _io File interafce to write data.
|
||||||
* @param[in] _nameIO Name to link the interface node
|
* @param[in] _nameIO Name to link the interface node
|
||||||
* @param[in] _isLink True if the node is connected on the current interface.
|
* @param[in] _isLink True if the node is connected on the current interface.
|
||||||
*/
|
*/
|
||||||
virtual void generateDot(etk::FSNode& _node, const etk::String& _nameIO, bool _isLink=true);
|
virtual void generateDot(ememory::SharedPtr<etk::io::Interface>& _io, const etk::String& _nameIO, bool _isLink=true);
|
||||||
/**
|
/**
|
||||||
* @brief Get the current 'dot' name of the interface
|
* @brief Get the current 'dot' name of the interface
|
||||||
* @return The anme requested.
|
* @return The anme requested.
|
||||||
|
@ -130,11 +130,11 @@ void audio::river::io::Group::stop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::river::io::Group::generateDot(etk::FSNode& _node, bool _hardwareNode) {
|
void audio::river::io::Group::generateDot(ememory::SharedPtr<etk::io::Interface>& _io, bool _hardwareNode) {
|
||||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||||
if (m_list[iii] != null) {
|
if (m_list[iii] != null) {
|
||||||
if (m_list[iii]->isHarwareNode() == _hardwareNode) {
|
if (m_list[iii]->isHarwareNode() == _hardwareNode) {
|
||||||
m_list[iii]->generateDot(_node);
|
m_list[iii]->generateDot(_io);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include <etk/String.hpp>
|
#include <etk/String.hpp>
|
||||||
#include <etk/Vector.hpp>
|
#include <etk/Vector.hpp>
|
||||||
#include <ejson/ejson.hpp>
|
#include <ejson/ejson.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <etk/io/Interface.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace river {
|
namespace river {
|
||||||
@ -65,7 +65,7 @@ namespace audio {
|
|||||||
* @param[in] _hardwareNode true if user want only display the hardware
|
* @param[in] _hardwareNode true if user want only display the hardware
|
||||||
* node and not the software node. false The oposite.
|
* node and not the software node. false The oposite.
|
||||||
*/
|
*/
|
||||||
void generateDot(etk::FSNode& _node, bool _hardwareNode);
|
void generateDot(ememory::SharedPtr<etk::io::Interface>& _node, bool _hardwareNode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,10 @@
|
|||||||
#include <audio/river/io/NodeMuxer.hpp>
|
#include <audio/river/io/NodeMuxer.hpp>
|
||||||
#include <audio/river/io/NodeOrchestra.hpp>
|
#include <audio/river/io/NodeOrchestra.hpp>
|
||||||
#include <audio/river/io/NodePortAudio.hpp>
|
#include <audio/river/io/NodePortAudio.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
#include <ememory/memory.hpp>
|
#include <ememory/memory.hpp>
|
||||||
#include <etk/types.hpp>
|
#include <etk/types.hpp>
|
||||||
|
#include <etk/path/fileSystem.hpp>
|
||||||
|
#include <etk/uri/uri.hpp>
|
||||||
|
|
||||||
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -56,7 +57,7 @@ static etk::String basicAutoConfig =
|
|||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
|
|
||||||
static etk::String pathToTheRiverConfigInHome("HOME:.local/share/audio-river/config.json");
|
static etk::Uri pathToTheRiverConfigInHome(etk::path::getHomePath() / ".local" / "share" / "audio-river" / "config.json");
|
||||||
|
|
||||||
audio::river::io::Manager::Manager() {
|
audio::river::io::Manager::Manager() {
|
||||||
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
||||||
@ -67,18 +68,18 @@ audio::river::io::Manager::Manager() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::river::io::Manager::init(const etk::String& _filename) {
|
void audio::river::io::Manager::init(const etk::Uri& _uri) {
|
||||||
RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd");
|
RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd");
|
||||||
ethread::RecursiveLock lock(m_mutex);
|
ethread::RecursiveLock lock(m_mutex);
|
||||||
if (_filename == "") {
|
if (_uri.isEmpty() == true) {
|
||||||
if (m_config.load(pathToTheRiverConfigInHome) == false) {
|
if (m_config.load(pathToTheRiverConfigInHome) == false) {
|
||||||
RIVER_INFO("Load default config");
|
RIVER_INFO("Load default config");
|
||||||
m_config.parse(basicAutoConfig);
|
m_config.parse(basicAutoConfig);
|
||||||
} else {
|
} else {
|
||||||
RIVER_INFO("Load default user configuration: " << pathToTheRiverConfigInHome);
|
RIVER_INFO("Load default user configuration: " << pathToTheRiverConfigInHome);
|
||||||
}
|
}
|
||||||
} else if (m_config.load(_filename) == false) {
|
} else if (m_config.load(_uri) == false) {
|
||||||
RIVER_ERROR("you must set a basic configuration file for harware configuration: '" << _filename << "'");
|
RIVER_ERROR("you must set a basic configuration file for harware configuration: " << _uri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,16 +350,16 @@ bool audio::river::io::Manager::getMute(const etk::String& _volumeName) {
|
|||||||
return volume->getMute();
|
return volume->getMute();
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
void audio::river::io::Manager::generateDot(const etk::Uri& _uri) {
|
||||||
ethread::RecursiveLock lock(m_mutex);
|
ethread::RecursiveLock lock(m_mutex);
|
||||||
etk::FSNode node(_filename);
|
ememory::SharedPtr<etk::io::Interface> ioFile = etk::uri::get(_uri);
|
||||||
RIVER_INFO("Generate the DOT files: " << node);
|
RIVER_INFO("Generate the DOT files: " << _uri);
|
||||||
if (node.fileOpenWrite() == false) {
|
if (ioFile->open(etk::io::OpenMode::Write) == false) {
|
||||||
RIVER_ERROR("Can not Write the dot file (fail to open) : " << node);
|
RIVER_ERROR("Can not Write the dot file (fail to open) : " << _uri);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
node << "digraph G {" << "\n";
|
*ioFile << "digraph G {" << "\n";
|
||||||
node << " rankdir=\"LR\";\n";
|
*ioFile << " rankdir=\"LR\";\n";
|
||||||
// First Step : Create all HW interface:
|
// First Step : Create all HW interface:
|
||||||
{
|
{
|
||||||
// standalone
|
// standalone
|
||||||
@ -366,7 +367,7 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
|||||||
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
|
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
if (val->isHarwareNode() == true) {
|
if (val->isHarwareNode() == true) {
|
||||||
val->generateDot(node);
|
val->generateDot(ioFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,7 +375,7 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
|||||||
it != m_listGroup.end();
|
it != m_listGroup.end();
|
||||||
++it) {
|
++it) {
|
||||||
if (it->second != null) {
|
if (it->second != null) {
|
||||||
it->second->generateDot(node, true);
|
it->second->generateDot(ioFile, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,7 +386,7 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
|||||||
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
|
ememory::SharedPtr<audio::river::io::Node> val = m_list[iii].lock();
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
if (val->isHarwareNode() == false) {
|
if (val->isHarwareNode() == false) {
|
||||||
val->generateDot(node);
|
val->generateDot(ioFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -393,14 +394,14 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
|||||||
it != m_listGroup.end();
|
it != m_listGroup.end();
|
||||||
++it) {
|
++it) {
|
||||||
if (it->second != null) {
|
if (it->second != null) {
|
||||||
it->second->generateDot(node, false);
|
it->second->generateDot(ioFile, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
node << "}" << "\n";
|
*ioFile << "}" << "\n";
|
||||||
node.fileClose();
|
ioFile->close();
|
||||||
RIVER_INFO("Generate the DOT files: " << node << " (DONE)");
|
RIVER_INFO("Generate the DOT files: " << _uri << " (DONE)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const etk::String& _name) {
|
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const etk::String& _name) {
|
||||||
|
@ -42,9 +42,9 @@ namespace audio {
|
|||||||
~Manager();
|
~Manager();
|
||||||
/**
|
/**
|
||||||
* @brief Called by audio::river::init() to set the hardware configuration file.
|
* @brief Called by audio::river::init() to set the hardware configuration file.
|
||||||
* @param[in] _filename Name of the file to initialize.
|
* @param[in] _uri Uri file to initialize.
|
||||||
*/
|
*/
|
||||||
void init(const etk::String& _filename);
|
void init(const etk::Uri& _uri);
|
||||||
/**
|
/**
|
||||||
* @brief Called by audio::river::initString() to set the hardware configuration string.
|
* @brief Called by audio::river::initString() to set the hardware configuration string.
|
||||||
* @param[in] _data json configuration string.
|
* @param[in] _data json configuration string.
|
||||||
@ -132,9 +132,9 @@ namespace audio {
|
|||||||
bool getMute(const etk::String& _volumeName);
|
bool getMute(const etk::String& _volumeName);
|
||||||
/**
|
/**
|
||||||
* @brief Generate the dot file corresponding at the actif nodes.
|
* @brief Generate the dot file corresponding at the actif nodes.
|
||||||
* @param[in] _filename Name of the file to write data.
|
* @param[in] _uri Uri of the file to write data.
|
||||||
*/
|
*/
|
||||||
void generateDot(const etk::String& _filename);
|
void generateDot(const etk::Uri& _uri);
|
||||||
private:
|
private:
|
||||||
etk::Map<etk::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
|
||||||
/**
|
/**
|
||||||
|
@ -391,63 +391,63 @@ void audio::river::io::Node::newOutput(void* _outputBuffer,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void link(etk::FSNode& _node, const etk::String& _first, const etk::String& _op, const etk::String& _second) {
|
static void link(ememory::SharedPtr<etk::io::Interface>& _io, const etk::String& _first, const etk::String& _op, const etk::String& _second) {
|
||||||
if (_op == "->") {
|
if (_op == "->") {
|
||||||
_node << " " << _first << " -> " << _second << ";\n";
|
*_io << " " << _first << " -> " << _second << ";\n";
|
||||||
} else if (_op == "<-") {
|
} else if (_op == "<-") {
|
||||||
_node << " " << _first << " -> " <<_second<< " [color=transparent];\n";
|
*_io << " " << _first << " -> " <<_second<< " [color=transparent];\n";
|
||||||
_node << " " << _second << " -> " << _first << " [constraint=false];\n";
|
*_io << " " << _second << " -> " << _first << " [constraint=false];\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void audio::river::io::Node::generateDot(etk::FSNode& _node) {
|
void audio::river::io::Node::generateDot(ememory::SharedPtr<etk::io::Interface>& _io) {
|
||||||
_node << " subgraph clusterNode_" << m_uid << " {\n";
|
*_io << " subgraph clusterNode_" << m_uid << " {\n";
|
||||||
_node << " color=blue;\n";
|
*_io << " color=blue;\n";
|
||||||
_node << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
*_io << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
||||||
if (m_isInput == true) {
|
if (m_isInput == true) {
|
||||||
_node << " node [shape=rarrow];\n";
|
*_io << " node [shape=rarrow];\n";
|
||||||
_node << " NODE_" << m_uid << "_HW_interface [ label=\"HW interface\\n interface=ALSA\\n stream=" << m_name << "\\n type=input\" ];\n";
|
*_io << " NODE_" << m_uid << "_HW_interface [ label=\"HW interface\\n interface=ALSA\\n stream=" << m_name << "\\n type=input\" ];\n";
|
||||||
etk::String nameIn;
|
etk::String nameIn;
|
||||||
etk::String nameOut;
|
etk::String nameOut;
|
||||||
m_process.generateDotProcess(_node, 3, m_uid, nameIn, nameOut, false);
|
m_process.generateDotProcess(_io, 3, m_uid, nameIn, nameOut, false);
|
||||||
_node << " node [shape=square];\n";
|
*_io << " node [shape=square];\n";
|
||||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||||
// Link all nodes :
|
// Link all nodes :
|
||||||
_node << " NODE_" << m_uid << "_HW_interface -> " << nameIn << " [arrowhead=\"open\"];\n";
|
*_io << " NODE_" << m_uid << "_HW_interface -> " << nameIn << " [arrowhead=\"open\"];\n";
|
||||||
_node << " " << nameOut << " -> NODE_" << m_uid << "_demuxer [arrowhead=\"open\"];\n";
|
*_io << " " << nameOut << " -> NODE_" << m_uid << "_demuxer [arrowhead=\"open\"];\n";
|
||||||
} else {
|
} else {
|
||||||
size_t nbOutput = getNumberOfInterfaceAvaillable(audio::river::modeInterface_output);
|
size_t nbOutput = getNumberOfInterfaceAvaillable(audio::river::modeInterface_output);
|
||||||
size_t nbfeedback = getNumberOfInterfaceAvaillable(audio::river::modeInterface_feedback);
|
size_t nbfeedback = getNumberOfInterfaceAvaillable(audio::river::modeInterface_feedback);
|
||||||
_node << " node [shape=larrow];\n";
|
*_io << " node [shape=larrow];\n";
|
||||||
_node << " NODE_" << m_uid << "_HW_interface [ label=\"HW interface\\n interface=ALSA\\n stream=" << m_name << "\\n type=output\" ];\n";
|
*_io << " NODE_" << m_uid << "_HW_interface [ label=\"HW interface\\n interface=ALSA\\n stream=" << m_name << "\\n type=output\" ];\n";
|
||||||
etk::String nameIn;
|
etk::String nameIn;
|
||||||
etk::String nameOut;
|
etk::String nameOut;
|
||||||
if (nbOutput>0) {
|
if (nbOutput>0) {
|
||||||
m_process.generateDotProcess(_node, 3, m_uid, nameIn, nameOut, true);
|
m_process.generateDotProcess(_io, 3, m_uid, nameIn, nameOut, true);
|
||||||
}
|
}
|
||||||
_node << " node [shape=square];\n";
|
*_io << " node [shape=square];\n";
|
||||||
if (nbOutput>0) {
|
if (nbOutput>0) {
|
||||||
_node << " NODE_" << m_uid << "_muxer [ label=\"MUXER\\n format=" << etk::toString(m_process.getInputConfig().getFormat()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_muxer [ label=\"MUXER\\n format=" << etk::toString(m_process.getInputConfig().getFormat()) << "\" ];\n";
|
||||||
}
|
}
|
||||||
if (nbfeedback>0) {
|
if (nbfeedback>0) {
|
||||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||||
}
|
}
|
||||||
// Link all nodes :
|
// Link all nodes :
|
||||||
if (nbOutput>0) {
|
if (nbOutput>0) {
|
||||||
link(_node, "NODE_" + etk::toString(m_uid) + "_HW_interface", "<-", nameOut);
|
link(_io, "NODE_" + etk::toString(m_uid) + "_HW_interface", "<-", nameOut);
|
||||||
link(_node, nameIn, "<-", "NODE_" + etk::toString(m_uid) + "_muxer");
|
link(_io, nameIn, "<-", "NODE_" + etk::toString(m_uid) + "_muxer");
|
||||||
}
|
}
|
||||||
if (nbfeedback>0) {
|
if (nbfeedback>0) {
|
||||||
_node << " NODE_" << m_uid << "_HW_interface -> NODE_" << m_uid << "_demuxer [arrowhead=\"open\"];\n";
|
*_io << " NODE_" << m_uid << "_HW_interface -> NODE_" << m_uid << "_demuxer [arrowhead=\"open\"];\n";
|
||||||
}
|
}
|
||||||
if ( nbOutput>0
|
if ( nbOutput>0
|
||||||
&& nbfeedback>0) {
|
&& nbfeedback>0) {
|
||||||
_node << " { rank=same; NODE_" << m_uid << "_demuxer; NODE_" << m_uid << "_muxer }\n";
|
*_io << " { rank=same; NODE_" << m_uid << "_demuxer; NODE_" << m_uid << "_muxer }\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_node << " }\n \n";
|
*_io << " }\n \n";
|
||||||
|
|
||||||
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
||||||
if (m_listAvaillable[iii].expired() == true) {
|
if (m_listAvaillable[iii].expired() == true) {
|
||||||
@ -465,11 +465,11 @@ void audio::river::io::Node::generateDot(etk::FSNode& _node) {
|
|||||||
}
|
}
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if (element->getMode() == modeInterface_input) {
|
if (element->getMode() == modeInterface_input) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||||
} else if (element->getMode() == modeInterface_output) {
|
} else if (element->getMode() == modeInterface_output) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
||||||
} else if (element->getMode() == modeInterface_feedback) {
|
} else if (element->getMode() == modeInterface_feedback) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <audio/drain/IOFormatInterface.hpp>
|
#include <audio/drain/IOFormatInterface.hpp>
|
||||||
#include <audio/drain/Volume.hpp>
|
#include <audio/drain/Volume.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <etk/io/Interface.hpp>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace river {
|
namespace river {
|
||||||
@ -209,9 +209,9 @@ namespace audio {
|
|||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Generate the node dot file section
|
* @brief Generate the node dot file section
|
||||||
* @param[in] _node File node to generate the data.
|
* @param[in] _io File interface to dump data.
|
||||||
*/
|
*/
|
||||||
virtual void generateDot(etk::FSNode& _node);
|
virtual void generateDot(ememory::SharedPtr<etk::io::Interface>& _io);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,27 +316,27 @@ void audio::river::io::NodeAEC::processAEC(void* _dataMic, void* _dataFB, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void audio::river::io::NodeAEC::generateDot(etk::FSNode& _node) {
|
void audio::river::io::NodeAEC::generateDot(ememory::SharedPtr<etk::io::Interface>& _io) {
|
||||||
_node << " subgraph clusterNode_" << m_uid << " {\n";
|
*_io << " subgraph clusterNode_" << m_uid << " {\n";
|
||||||
_node << " color=blue;\n";
|
*_io << " color=blue;\n";
|
||||||
_node << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
*_io << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
||||||
_node << " NODE_" << m_uid << "_HW_AEC [ label=\"AEC\\n channelMap=" << etk::toString(getInterfaceFormat().getMap()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_HW_AEC [ label=\"AEC\\n channelMap=" << etk::toString(getInterfaceFormat().getMap()) << "\" ];\n";
|
||||||
etk::String nameIn;
|
etk::String nameIn;
|
||||||
etk::String nameOut;
|
etk::String nameOut;
|
||||||
m_process.generateDot(_node, 3, m_uid, nameIn, nameOut, false);
|
m_process.generateDot(_io, 3, m_uid, nameIn, nameOut, false);
|
||||||
_node << " node [shape=square];\n";
|
*_io << " node [shape=square];\n";
|
||||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||||
// Link all nodes :
|
// Link all nodes :
|
||||||
_node << " NODE_" << m_uid << "_HW_AEC -> " << nameIn << ";\n";
|
*_io << " NODE_" << m_uid << "_HW_AEC -> " << nameIn << ";\n";
|
||||||
_node << " " << nameOut << " -> NODE_" << m_uid << "_demuxer;\n";
|
*_io << " " << nameOut << " -> NODE_" << m_uid << "_demuxer;\n";
|
||||||
_node << " }\n";
|
*_io << " }\n";
|
||||||
if (m_interfaceMicrophone != null) {
|
if (m_interfaceMicrophone != null) {
|
||||||
_node << " " << m_interfaceMicrophone->getDotNodeName() << " -> NODE_" << m_uid << "_HW_AEC;\n";
|
*_io << " " << m_interfaceMicrophone->getDotNodeName() << " -> NODE_" << m_uid << "_HW_AEC;\n";
|
||||||
}
|
}
|
||||||
if (m_interfaceFeedBack != null) {
|
if (m_interfaceFeedBack != null) {
|
||||||
_node << " " << m_interfaceFeedBack->getDotNodeName() << " -> NODE_" << m_uid << "_HW_AEC;\n";
|
*_io << " " << m_interfaceFeedBack->getDotNodeName() << " -> NODE_" << m_uid << "_HW_AEC;\n";
|
||||||
}
|
}
|
||||||
_node << " \n";
|
*_io << " \n";
|
||||||
|
|
||||||
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
||||||
if (m_listAvaillable[iii].expired() == true) {
|
if (m_listAvaillable[iii].expired() == true) {
|
||||||
@ -354,11 +354,11 @@ void audio::river::io::NodeAEC::generateDot(etk::FSNode& _node) {
|
|||||||
}
|
}
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if (element->getMode() == modeInterface_input) {
|
if (element->getMode() == modeInterface_input) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||||
} else if (element->getMode() == modeInterface_output) {
|
} else if (element->getMode() == modeInterface_output) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
||||||
} else if (element->getMode() == modeInterface_feedback) {
|
} else if (element->getMode() == modeInterface_feedback) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ namespace audio {
|
|||||||
*/
|
*/
|
||||||
void processAEC(void* _dataMic, void* _dataFB, uint32_t _nbChunk, const audio::Time& _time);
|
void processAEC(void* _dataMic, void* _dataFB, uint32_t _nbChunk, const audio::Time& _time);
|
||||||
public:
|
public:
|
||||||
virtual void generateDot(etk::FSNode& _node);
|
virtual void generateDot(ememory::SharedPtr<etk::io::Interface>& _io);
|
||||||
private:
|
private:
|
||||||
int32_t m_nbChunk;
|
int32_t m_nbChunk;
|
||||||
int32_t m_gainValue;
|
int32_t m_gainValue;
|
||||||
|
@ -34,12 +34,12 @@ int32_t audio::river::io::NodeFile::playbackCallback(void* _outputBuffer,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
ememory::SharedPtr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const etk::String& _name, const ejson::Object& _config) {
|
ememory::SharedPtr<audio::river::io::NodeFile> audio::river::io::NodeFile::create(const etk::Path& _path, const ejson::Object& _config) {
|
||||||
return ememory::SharedPtr<audio::river::io::NodeFile>(ETK_NEW(audio::river::io::NodeFile, _name, _config));
|
return ememory::SharedPtr<audio::river::io::NodeFile>(ETK_NEW(audio::river::io::NodeFile, _path, _config));
|
||||||
}
|
}
|
||||||
|
|
||||||
audio::river::io::NodeFile::NodeFile(const etk::String& _name, const ejson::Object& _config) :
|
audio::river::io::NodeFile::NodeFile(const etk::Path& _path, const ejson::Object& _config) :
|
||||||
Node(_name, _config) {
|
Node(_path.getString(), _config) {
|
||||||
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
|
audio::drain::IOFormatInterface interfaceFormat = getInterfaceFormat();
|
||||||
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
audio::drain::IOFormatInterface hardwareFormat = getHarwareFormat();
|
||||||
/**
|
/**
|
||||||
|
@ -24,9 +24,9 @@ namespace audio {
|
|||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
*/
|
*/
|
||||||
NodeFile(const etk::String& _name, const ejson::Object& _config);
|
NodeFile(const etk::Path& _path, const ejson::Object& _config);
|
||||||
public:
|
public:
|
||||||
static ememory::SharedPtr<NodeFile> create(const etk::String& _name, const ejson::Object& _config);
|
static ememory::SharedPtr<NodeFile> create(const etk::Path& _path, const ejson::Object& _config);
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
@ -36,7 +36,7 @@ namespace audio {
|
|||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
audio::Time m_time; //!< time of the flow
|
audio::Time m_time; //!< time of the flow
|
||||||
etk::FSNode m_file; //!< File interface
|
ememory::SharedPtr<etk::io::Interface>& m_file; //!< File interface
|
||||||
bool m_restartAtEnd; //!< The read is done in loop
|
bool m_restartAtEnd; //!< The read is done in loop
|
||||||
uint32_t m_sampleRate; //!< Sample Rate of the Raw file
|
uint32_t m_sampleRate; //!< Sample Rate of the Raw file
|
||||||
audio::format m_format; //!< Format of the file
|
audio::format m_format; //!< Format of the file
|
||||||
|
@ -433,30 +433,30 @@ void audio::river::io::NodeMuxer::processMuxer(void* _dataIn1, void* _dataIn2, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void audio::river::io::NodeMuxer::generateDot(etk::FSNode& _node) {
|
void audio::river::io::NodeMuxer::generateDot(ememory::SharedPtr<etk::io::Interface>& _io) {
|
||||||
_node << " subgraph clusterNode_" << m_uid << " {\n";
|
*_io << " subgraph clusterNode_" << m_uid << " {\n";
|
||||||
_node << " color=blue;\n";
|
*_io << " color=blue;\n";
|
||||||
_node << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
*_io << " label=\"[" << m_uid << "] IO::Node : " << m_name << "\";\n";
|
||||||
|
|
||||||
_node << " node [shape=box];\n";
|
*_io << " node [shape=box];\n";
|
||||||
// TODO : Create a structure ...
|
// TODO : Create a structure ...
|
||||||
_node << " NODE_" << m_uid << "_HW_MUXER [ label=\"Muxer\\n channelMap=" << etk::toString(getInterfaceFormat().getMap()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_HW_MUXER [ label=\"Muxer\\n channelMap=" << etk::toString(getInterfaceFormat().getMap()) << "\" ];\n";
|
||||||
etk::String nameIn;
|
etk::String nameIn;
|
||||||
etk::String nameOut;
|
etk::String nameOut;
|
||||||
m_process.generateDot(_node, 3, m_uid, nameIn, nameOut, false);
|
m_process.generateDot(_io, 3, m_uid, nameIn, nameOut, false);
|
||||||
_node << " node [shape=square];\n";
|
*_io << " node [shape=square];\n";
|
||||||
_node << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
*_io << " NODE_" << m_uid << "_demuxer [ label=\"DEMUXER\\n format=" << etk::toString(m_process.getOutputConfig().getFormat()) << "\" ];\n";
|
||||||
// Link all nodes :
|
// Link all nodes :
|
||||||
_node << " NODE_" << m_uid << "_HW_MUXER -> " << nameIn << ";\n";
|
*_io << " NODE_" << m_uid << "_HW_MUXER -> " << nameIn << ";\n";
|
||||||
_node << " " << nameOut << " -> NODE_" << m_uid << "_demuxer;\n";
|
*_io << " " << nameOut << " -> NODE_" << m_uid << "_demuxer;\n";
|
||||||
_node << " }\n";
|
*_io << " }\n";
|
||||||
if (m_interfaceInput2 != null) {
|
if (m_interfaceInput2 != null) {
|
||||||
_node << " " << m_interfaceInput2->getDotNodeName() << " -> NODE_" << m_uid << "_HW_MUXER;\n";
|
*_io << " " << m_interfaceInput2->getDotNodeName() << " -> NODE_" << m_uid << "_HW_MUXER;\n";
|
||||||
}
|
}
|
||||||
if (m_interfaceInput1 != null) {
|
if (m_interfaceInput1 != null) {
|
||||||
_node << " " << m_interfaceInput1->getDotNodeName() << " -> NODE_" << m_uid << "_HW_MUXER;\n";
|
*_io << " " << m_interfaceInput1->getDotNodeName() << " -> NODE_" << m_uid << "_HW_MUXER;\n";
|
||||||
}
|
}
|
||||||
_node << " \n";
|
*_io << " \n";
|
||||||
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
||||||
if (m_listAvaillable[iii].expired() == true) {
|
if (m_listAvaillable[iii].expired() == true) {
|
||||||
continue;
|
continue;
|
||||||
@ -473,15 +473,15 @@ void audio::river::io::NodeMuxer::generateDot(etk::FSNode& _node) {
|
|||||||
}
|
}
|
||||||
if (element != null) {
|
if (element != null) {
|
||||||
if (element->getMode() == modeInterface_input) {
|
if (element->getMode() == modeInterface_input) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||||
} else if (element->getMode() == modeInterface_output) {
|
} else if (element->getMode() == modeInterface_output) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_muxer", isLink);
|
||||||
} else if (element->getMode() == modeInterface_feedback) {
|
} else if (element->getMode() == modeInterface_feedback) {
|
||||||
element->generateDot(_node, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
element->generateDot(_io, "NODE_" + etk::toString(m_uid) + "_demuxer", isLink);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_node << "\n";
|
*_io << "\n";
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ namespace audio {
|
|||||||
void processMuxer(void* _dataMic, void* _dataFB, uint32_t _nbChunk, const audio::Time& _time);
|
void processMuxer(void* _dataMic, void* _dataFB, uint32_t _nbChunk, const audio::Time& _time);
|
||||||
etk::Vector<uint8_t> m_data;
|
etk::Vector<uint8_t> m_data;
|
||||||
public:
|
public:
|
||||||
virtual void generateDot(etk::FSNode& _node);
|
virtual void generateDot(ememory::SharedPtr<etk::io::Interface>& _io);
|
||||||
private:
|
private:
|
||||||
void reorder(void* _output, uint32_t _nbChunk, void* _input, const etk::Vector<audio::channel>& _mapInput);
|
void reorder(void* _output, uint32_t _nbChunk, void* _input, const etk::Vector<audio::channel>& _mapInput);
|
||||||
};
|
};
|
||||||
|
@ -31,7 +31,7 @@ With a file:
|
|||||||
|
|
||||||
```{.cpp}
|
```{.cpp}
|
||||||
// initialize river interface
|
// initialize river interface
|
||||||
river::init("DATA:configFileName.json");
|
river::init("DATA:///configFileName.json");
|
||||||
```
|
```
|
||||||
|
|
||||||
With a json string:
|
With a json string:
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
#include <audio/river/Manager.hpp>
|
#include <audio/river/Manager.hpp>
|
||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
//! [audio_river_sample_include]
|
//! [audio_river_sample_include]
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include <test-debug/debug.hpp>
|
#include <test-debug/debug.hpp>
|
||||||
|
#include <etk/uri/uri.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -44,14 +44,14 @@ void onDataReceived(const void* _data,
|
|||||||
enum audio::format _format,
|
enum audio::format _format,
|
||||||
uint32_t _frequency,
|
uint32_t _frequency,
|
||||||
const etk::Vector<audio::channel>& _map,
|
const etk::Vector<audio::channel>& _map,
|
||||||
etk::FSNode* _outputNode) {
|
ememory::SharedPtr<etk::io::Interface> _fileIO) {
|
||||||
if ( _format != audio::format_int16
|
if ( _format != audio::format_int16
|
||||||
&& _format != audio::format_float) {
|
&& _format != audio::format_float) {
|
||||||
TEST_ERROR("Call wrong type ... (need int16_t.float)");
|
TEST_ERROR("Call wrong type ... (need int16_t.float)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//! [audio_river_sample_callback_implement]
|
//! [audio_river_sample_callback_implement]
|
||||||
if (_outputNode->fileIsOpen() == false) {
|
if (_fileIO->isOpen() == false) {
|
||||||
if (_format != audio::format_int16) {
|
if (_format != audio::format_int16) {
|
||||||
// get the curent power of the signal.
|
// get the curent power of the signal.
|
||||||
const int16_t* data = static_cast<const int16_t*>(_data);
|
const int16_t* data = static_cast<const int16_t*>(_data);
|
||||||
@ -74,7 +74,7 @@ void onDataReceived(const void* _data,
|
|||||||
} else {
|
} else {
|
||||||
// just write data
|
// just write data
|
||||||
TEST_VERBOSE("Get data ... chunks=" << _nbChunk << " time=" << _time);
|
TEST_VERBOSE("Get data ... chunks=" << _nbChunk << " time=" << _time);
|
||||||
_outputNode->fileWrite(_data, _map.size()*audio::getFormatBytes(_format), _nbChunk);
|
_fileIO->write(_data, _map.size()*audio::getFormatBytes(_format), _nbChunk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ int main(int _argc, const char **_argv) {
|
|||||||
// local parameter:
|
// local parameter:
|
||||||
etk::String configFile;
|
etk::String configFile;
|
||||||
etk::String ioName="microphone";
|
etk::String ioName="microphone";
|
||||||
etk::String outputFileName = "";
|
etk::Path outputFileName = "";
|
||||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||||
etk::String data = _argv[iii];
|
etk::String data = _argv[iii];
|
||||||
if ( data == "-h"
|
if ( data == "-h"
|
||||||
@ -130,11 +130,10 @@ int main(int _argc, const char **_argv) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//! [audio_river_sample_create_read_interface]
|
//! [audio_river_sample_create_read_interface]
|
||||||
etk::FSNode outputNode;
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(outputFileName);
|
||||||
// open output file if needed:
|
// open output file if needed:
|
||||||
if (outputFileName != "") {
|
if (outputFileName.isEmpty() == false) {
|
||||||
outputNode.setName(outputFileName);
|
fileIO->open(etk::io::OpenMode::Write);
|
||||||
outputNode.fileOpenWrite();
|
|
||||||
}
|
}
|
||||||
//! [audio_river_sample_set_callback]
|
//! [audio_river_sample_set_callback]
|
||||||
// set callback mode ...
|
// set callback mode ...
|
||||||
@ -144,7 +143,7 @@ int main(int _argc, const char **_argv) {
|
|||||||
enum audio::format _format,
|
enum audio::format _format,
|
||||||
uint32_t _frequency,
|
uint32_t _frequency,
|
||||||
const etk::Vector<audio::channel>& _map) {
|
const etk::Vector<audio::channel>& _map) {
|
||||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map, &outputNode);
|
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map, fileIO);
|
||||||
});
|
});
|
||||||
//! [audio_river_sample_set_callback]
|
//! [audio_river_sample_set_callback]
|
||||||
//! [audio_river_sample_read_start_stop]
|
//! [audio_river_sample_read_start_stop]
|
||||||
@ -162,7 +161,7 @@ int main(int _argc, const char **_argv) {
|
|||||||
//! [audio_river_sample_read_reset]
|
//! [audio_river_sample_read_reset]
|
||||||
// close the output file
|
// close the output file
|
||||||
if (outputFileName != "") {
|
if (outputFileName != "") {
|
||||||
outputNode.fileClose();
|
fileIO->close();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,6 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
#include "main.hpp"
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_echo_delay {
|
namespace river_test_echo_delay {
|
||||||
class TestClass {
|
class TestClass {
|
||||||
@ -202,7 +200,7 @@ namespace river_test_echo_delay {
|
|||||||
if (_format != audio::format_int16) {
|
if (_format != audio::format_int16) {
|
||||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||||
}
|
}
|
||||||
TEST_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size());
|
//TEST_SAVE_FILE_MACRO(int16_t, "REC_FeedBack.raw", _data, _nbChunk*_map.size());
|
||||||
if (m_estimateVolumeInput == true) {
|
if (m_estimateVolumeInput == true) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
} else {
|
} else {
|
||||||
@ -257,7 +255,7 @@ namespace river_test_echo_delay {
|
|||||||
if (_format != audio::format_int16) {
|
if (_format != audio::format_int16) {
|
||||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||||
}
|
}
|
||||||
TEST_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size());
|
//TEST_SAVE_FILE_MACRO(int16_t, "REC_Microphone.raw", _data, _nbChunk*_map.size());
|
||||||
const int16_t* data = static_cast<const int16_t*>(_data);
|
const int16_t* data = static_cast<const int16_t*>(_data);
|
||||||
if (m_estimateVolumeInput == true) {
|
if (m_estimateVolumeInput == true) {
|
||||||
m_stateMic ++;
|
m_stateMic ++;
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_format {
|
namespace river_test_format {
|
||||||
static const etk::String configurationRiver =
|
static const etk::String configurationRiver =
|
||||||
|
@ -9,14 +9,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_muxer {
|
namespace river_test_muxer {
|
||||||
class TestClass {
|
class TestClass {
|
||||||
@ -100,7 +98,7 @@ namespace river_test_muxer {
|
|||||||
if (_format != audio::format_int16) {
|
if (_format != audio::format_int16) {
|
||||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||||
}
|
}
|
||||||
TEST_SAVE_FILE_MACRO(int16_t, "REC_MicrophoneMuxed.raw", _data, _nbChunk*_map.size());
|
//TEST_SAVE_FILE_MACRO(int16_t, "REC_MicrophoneMuxed.raw", _data, _nbChunk*_map.size());
|
||||||
TEST_ERROR("Receive data ... " << _nbChunk << " map=" << _map);
|
TEST_ERROR("Receive data ... " << _nbChunk << " map=" << _map);
|
||||||
}
|
}
|
||||||
void run() {
|
void run() {
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_playback_callback {
|
namespace river_test_playback_callback {
|
||||||
|
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_playback_write {
|
namespace river_test_playback_write {
|
||||||
static const etk::String configurationRiver =
|
static const etk::String configurationRiver =
|
||||||
|
@ -9,14 +9,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_record_callback {
|
namespace river_test_record_callback {
|
||||||
static const etk::String configurationRiver =
|
static const etk::String configurationRiver =
|
||||||
@ -70,7 +68,7 @@ namespace river_test_record_callback {
|
|||||||
if (_format != audio::format_int16) {
|
if (_format != audio::format_int16) {
|
||||||
TEST_ERROR("call wrong type ... (need int16_t)");
|
TEST_ERROR("call wrong type ... (need int16_t)");
|
||||||
}
|
}
|
||||||
TEST_SAVE_FILE_MACRO(int16_t, "REC_INPUT.raw", _data, _nbChunk * _map.size());
|
//TEST_SAVE_FILE_MACRO(int16_t, "REC_INPUT.raw", _data, _nbChunk * _map.size());
|
||||||
const int16_t* data = static_cast<const int16_t*>(_data);
|
const int16_t* data = static_cast<const int16_t*>(_data);
|
||||||
int64_t value = 0;
|
int64_t value = 0;
|
||||||
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
|
for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {
|
||||||
|
@ -10,13 +10,11 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_record_read {
|
namespace river_test_record_read {
|
||||||
|
|
||||||
|
@ -10,14 +10,12 @@
|
|||||||
#include <audio/river/Interface.hpp>
|
#include <audio/river/Interface.hpp>
|
||||||
#include <etest/etest.hpp>
|
#include <etest/etest.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <ethread/Thread.hpp>
|
#include <ethread/Thread.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
#include "main.hpp"
|
|
||||||
|
|
||||||
namespace river_test_volume {
|
namespace river_test_volume {
|
||||||
static const etk::String configurationRiver =
|
static const etk::String configurationRiver =
|
||||||
|
Loading…
Reference in New Issue
Block a user