[DEV] update new ETK
This commit is contained in:
parent
c3d78cf387
commit
0c57614b64
@ -4,9 +4,9 @@
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include "debug.hpp"
|
||||
#include "Interface.hpp"
|
||||
#include "io/Node.hpp"
|
||||
#include <audio/river/debug.hpp>
|
||||
#include <audio/river/Interface.hpp>
|
||||
#include <audio/river/io/Node.hpp>
|
||||
#include <audio/drain/EndPointCallback.hpp>
|
||||
#include <audio/drain/EndPointWrite.hpp>
|
||||
#include <audio/drain/EndPointRead.hpp>
|
||||
@ -92,10 +92,10 @@ bool audio::river::Interface::init(float _freq,
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::Interface> audio::river::Interface::create(float _freq,
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const ememory::SharedPtr<audio::river::io::Node>& _node,
|
||||
const ejson::Object& _config) {
|
||||
const etk::Vector<audio::channel>& _map,
|
||||
audio::format _format,
|
||||
const ememory::SharedPtr<audio::river::io::Node>& _node,
|
||||
const ejson::Object& _config) {
|
||||
ememory::SharedPtr<audio::river::Interface> out = ememory::SharedPtr<audio::river::Interface>(new audio::river::Interface());
|
||||
out->init(_freq, _map, _format, _node, _config);
|
||||
return out;
|
||||
@ -103,7 +103,7 @@ ememory::SharedPtr<audio::river::Interface> audio::river::Interface::create(floa
|
||||
|
||||
audio::river::Interface::~Interface() {
|
||||
//stop(true, true);
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
//m_node->interfaceRemove(sharedFromThis());
|
||||
}
|
||||
/*
|
||||
@ -112,12 +112,13 @@ bool audio::river::Interface::hasEndPoint() {
|
||||
}
|
||||
*/
|
||||
void audio::river::Interface::setReadwrite() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
m_process.removeAlgoDynamic();
|
||||
if (m_process.hasType<audio::drain::EndPoint>() ) {
|
||||
RIVER_ERROR("Endpoint is already present ==> can not change");
|
||||
return;
|
||||
}
|
||||
RIVER_WARNING("Add output ReadWrite");
|
||||
if (m_node->isInput() == true) {
|
||||
m_process.removeIfLast<audio::drain::EndPoint>();
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = audio::drain::EndPointRead::create();
|
||||
@ -130,11 +131,12 @@ void audio::river::Interface::setReadwrite() {
|
||||
}
|
||||
|
||||
void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _function) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_mode != audio::river::modeInterface_output) {
|
||||
RIVER_ERROR("Can not set output endpoint on other than a output IO");
|
||||
return;
|
||||
}
|
||||
RIVER_WARNING("Add output callback");
|
||||
m_process.removeAlgoDynamic();
|
||||
m_process.removeIfFirst<audio::drain::EndPoint>();
|
||||
ememory::SharedPtr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
|
||||
@ -142,11 +144,12 @@ void audio::river::Interface::setOutputCallback(audio::drain::playbackFunction _
|
||||
}
|
||||
|
||||
void audio::river::Interface::setInputCallback(audio::drain::recordFunction _function) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_mode == audio::river::modeInterface_output) {
|
||||
RIVER_ERROR("Can not set output endpoint on other than a input or feedback IO");
|
||||
return;
|
||||
}
|
||||
RIVER_WARNING("Add input callback");
|
||||
m_process.removeAlgoDynamic();
|
||||
m_process.removeIfLast<audio::drain::EndPoint>();
|
||||
ememory::SharedPtr<audio::drain::Algo> algo = audio::drain::EndPointCallback::create(_function);
|
||||
@ -154,11 +157,12 @@ void audio::river::Interface::setInputCallback(audio::drain::recordFunction _fun
|
||||
}
|
||||
|
||||
void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWrite _function) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_mode != audio::river::modeInterface_output) {
|
||||
RIVER_ERROR("Can not set output endpoint on other than a output IO");
|
||||
return;
|
||||
}
|
||||
RIVER_WARNING("Add output Write");
|
||||
m_process.removeAlgoDynamic();
|
||||
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
|
||||
if (algo == nullptr) {
|
||||
@ -168,7 +172,7 @@ void audio::river::Interface::setWriteCallback(audio::drain::playbackFunctionWri
|
||||
}
|
||||
|
||||
void audio::river::Interface::start(const audio::Time& _time) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
RIVER_DEBUG("start [BEGIN]");
|
||||
m_process.updateInterAlgo();
|
||||
m_node->interfaceAdd(sharedFromThis());
|
||||
@ -176,14 +180,14 @@ void audio::river::Interface::start(const audio::Time& _time) {
|
||||
}
|
||||
|
||||
void audio::river::Interface::stop(bool _fast, bool _abort) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
RIVER_DEBUG("stop [BEGIN]");
|
||||
m_node->interfaceRemove(sharedFromThis());
|
||||
RIVER_DEBUG("stop [ END]");
|
||||
}
|
||||
|
||||
void audio::river::Interface::abort() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
RIVER_DEBUG("abort [BEGIN]");
|
||||
// TODO :...
|
||||
RIVER_DEBUG("abort [ END ]");
|
||||
@ -232,7 +236,7 @@ etk::String audio::river::Interface::getParameterProperty(const etk::String& _fi
|
||||
}
|
||||
|
||||
void audio::river::Interface::write(const void* _value, size_t _nbChunk) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
m_process.updateInterAlgo();
|
||||
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
|
||||
if (algo == nullptr) {
|
||||
@ -267,14 +271,14 @@ etk::Vector<int16_t> audio::river::Interface::read(size_t _nbChunk) {
|
||||
#endif
|
||||
|
||||
void audio::river::Interface::read(void* _value, size_t _nbChunk) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
m_process.updateInterAlgo();
|
||||
// TODO :...
|
||||
|
||||
}
|
||||
|
||||
size_t audio::river::Interface::size() const {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
// TODO :...
|
||||
return 0;
|
||||
}
|
||||
@ -284,7 +288,7 @@ size_t audio::river::Interface::size() const {
|
||||
|
||||
|
||||
void audio::river::Interface::setBufferSize(size_t _nbChunk) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_node->isInput() == true) {
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
|
||||
if (algo == nullptr) {
|
||||
@ -302,8 +306,8 @@ void audio::river::Interface::setBufferSize(size_t _nbChunk) {
|
||||
algo->setBufferSize(_nbChunk);
|
||||
}
|
||||
|
||||
void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _time) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
void audio::river::Interface::setBufferSize(const echrono::microseconds& _time) {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_node->isInput() == true) {
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
|
||||
if (algo == nullptr) {
|
||||
@ -322,7 +326,7 @@ void audio::river::Interface::setBufferSize(const std::chrono::microseconds& _ti
|
||||
}
|
||||
|
||||
size_t audio::river::Interface::getBufferSize() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_node->isInput() == true) {
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
|
||||
if (algo == nullptr) {
|
||||
@ -339,26 +343,26 @@ size_t audio::river::Interface::getBufferSize() {
|
||||
return algo->getBufferSize();
|
||||
}
|
||||
|
||||
std::chrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
echrono::microseconds audio::river::Interface::getBufferSizeMicrosecond() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_node->isInput() == true) {
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
|
||||
if (algo == nullptr) {
|
||||
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
|
||||
return std::chrono::microseconds(0);
|
||||
return echrono::microseconds(0);
|
||||
}
|
||||
return algo->getBufferSizeMicrosecond();
|
||||
}
|
||||
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
|
||||
if (algo == nullptr) {
|
||||
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
|
||||
return std::chrono::microseconds(0);
|
||||
return echrono::microseconds(0);
|
||||
}
|
||||
return algo->getBufferSizeMicrosecond();
|
||||
}
|
||||
|
||||
size_t audio::river::Interface::getBufferFillSize() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_node->isInput() == true) {
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
|
||||
if (algo == nullptr) {
|
||||
@ -376,20 +380,20 @@ size_t audio::river::Interface::getBufferFillSize() {
|
||||
|
||||
}
|
||||
|
||||
std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
echrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond() {
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (m_node->isInput() == true) {
|
||||
ememory::SharedPtr<audio::drain::EndPointRead> algo = m_process.get<audio::drain::EndPointRead>(m_process.size()-1);
|
||||
if (algo == nullptr) {
|
||||
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
|
||||
return std::chrono::microseconds(0);
|
||||
return echrono::microseconds(0);
|
||||
}
|
||||
return algo->getBufferFillSizeMicrosecond();
|
||||
}
|
||||
ememory::SharedPtr<audio::drain::EndPointWrite> algo = m_process.get<audio::drain::EndPointWrite>(0);
|
||||
if (algo == nullptr) {
|
||||
RIVER_ERROR("Request get buffer size for Interface that is not READ or WRITE mode ...");
|
||||
return std::chrono::microseconds(0);
|
||||
return echrono::microseconds(0);
|
||||
}
|
||||
return algo->getBufferFillSizeMicrosecond();
|
||||
}
|
||||
@ -397,21 +401,21 @@ std::chrono::microseconds audio::river::Interface::getBufferFillSizeMicrosecond(
|
||||
|
||||
|
||||
void audio::river::Interface::clearInternalBuffer() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
m_process.updateInterAlgo();
|
||||
// TODO :...
|
||||
|
||||
}
|
||||
|
||||
audio::Time audio::river::Interface::getCurrentTime() const {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
// TODO :...
|
||||
return audio::Time();
|
||||
return audio::Time::now();
|
||||
}
|
||||
|
||||
void audio::river::Interface::addVolumeGroup(const etk::String& _name) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
RIVER_DEBUG("addVolumeGroup(" << _name << ")");
|
||||
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
|
||||
if (algo == nullptr) {
|
||||
@ -436,19 +440,19 @@ void audio::river::Interface::addVolumeGroup(const etk::String& _name) {
|
||||
}
|
||||
|
||||
void audio::river::Interface::systemNewInputData(audio::Time _time, const void* _data, size_t _nbChunk) {
|
||||
Ethread::RecursiveLock lockProcess(m_mutex);
|
||||
ethread::RecursiveLock lockProcess(m_mutex);
|
||||
void * tmpData = const_cast<void*>(_data);
|
||||
m_process.push(_time, tmpData, _nbChunk);
|
||||
}
|
||||
|
||||
void audio::river::Interface::systemNeedOutputData(audio::Time _time, void* _data, size_t _nbChunk, size_t _chunkSize) {
|
||||
Ethread::RecursiveLock lockProcess(m_mutex);
|
||||
ethread::RecursiveLock lockProcess(m_mutex);
|
||||
//RIVER_INFO("time : " << _time);
|
||||
m_process.pull(_time, _data, _nbChunk, _chunkSize);
|
||||
}
|
||||
|
||||
void audio::river::Interface::systemVolumeChange() {
|
||||
Ethread::RecursiveLock lockProcess(m_mutex);
|
||||
ethread::RecursiveLock lockProcess(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::Volume> algo = m_process.get<audio::drain::Volume>("volume");
|
||||
if (algo == nullptr) {
|
||||
return;
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <cstdint>
|
||||
#include <ethread/Mutex.hpp>
|
||||
#include <chrono>
|
||||
#include <ethread/MutexRecursive.hpp>
|
||||
#include <echrono/echrono.hpp>
|
||||
#include <etk/Function.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <audio/format.hpp>
|
||||
@ -88,7 +88,7 @@ namespace audio {
|
||||
*/
|
||||
virtual ~Interface();
|
||||
protected:
|
||||
mutable std::recursive_mutex m_mutex; //!< Local mutex to protect data
|
||||
mutable ethread::MutexRecursive m_mutex; //!< Local mutex to protect data
|
||||
ejson::Object m_config; //!< configuration set by the user.
|
||||
protected:
|
||||
enum modeInterface m_mode; //!< interface type (input/output/feedback)
|
||||
@ -245,7 +245,7 @@ namespace audio {
|
||||
* @brief Set buffer size size of the buffer with the stored time in µs
|
||||
* @param[in] _time Time in microsecond of the buffer
|
||||
*/
|
||||
virtual void setBufferSize(const std::chrono::microseconds& _time);
|
||||
virtual void setBufferSize(const echrono::microseconds& _time);
|
||||
/**
|
||||
* @brief get buffer size in chunk number
|
||||
* @return Number of chunk that can be written in the buffer
|
||||
@ -255,7 +255,7 @@ namespace audio {
|
||||
* @brief Set buffer size size of the buffer with the stored time in µs
|
||||
* @return Time in microsecond that can be written in the buffer
|
||||
*/
|
||||
virtual std::chrono::microseconds getBufferSizeMicrosecond();
|
||||
virtual echrono::microseconds getBufferSizeMicrosecond();
|
||||
/**
|
||||
* @brief Get buffer size filled in chunk number
|
||||
* @return Number of chunk in the buffer (that might be read/write)
|
||||
@ -265,7 +265,7 @@ namespace audio {
|
||||
* @brief Set buffer size size of the buffer with the stored time in µs
|
||||
* @return Time in microsecond of the buffer (that might be read/write)
|
||||
*/
|
||||
virtual std::chrono::microseconds getBufferFillSizeMicrosecond();
|
||||
virtual echrono::microseconds getBufferFillSizeMicrosecond();
|
||||
/**
|
||||
* @brief Remove internal Buffer
|
||||
*/
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
#include "Manager.hpp"
|
||||
#include "Interface.hpp"
|
||||
#include <stdexcept>
|
||||
|
||||
#include "io/Manager.hpp"
|
||||
#include "io/Node.hpp"
|
||||
#include "debug.hpp"
|
||||
|
@ -6,7 +6,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <etk/String.hpp>
|
||||
#include <cstdint>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <audio/river/Interface.hpp>
|
||||
#include <audio/format.hpp>
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
#include <audio/river/io/Group.hpp>
|
||||
#include <audio/river/debug.hpp>
|
||||
#include "Node.hpp"
|
||||
#include "NodeAEC.hpp"
|
||||
#include "NodeOrchestra.hpp"
|
||||
#include "NodePortAudio.hpp"
|
||||
#include "Node.hpp"
|
||||
#include <audio/river/io/Node.hpp>
|
||||
#include <audio/river/io/NodeAEC.hpp>
|
||||
#include <audio/river/io/NodeOrchestra.hpp>
|
||||
#include <audio/river/io/NodePortAudio.hpp>
|
||||
#include <audio/river/io/Node.hpp>
|
||||
|
||||
void audio::river::io::Group::createFrom(const ejson::Document& _obj, const etk::String& _name) {
|
||||
RIVER_INFO("Create Group[" << _name << "] (START) ___________________________");
|
||||
|
@ -15,10 +15,11 @@
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <etk/types.hpp>
|
||||
#include <utility>
|
||||
|
||||
#ifdef AUDIO_RIVER_BUILD_PORTAUDIO
|
||||
#include <portaudio/portaudio.h>
|
||||
extern "C" {
|
||||
#include <portaudio/portaudio.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
static etk::String basicAutoConfig =
|
||||
@ -68,7 +69,7 @@ audio::river::io::Manager::Manager() {
|
||||
|
||||
void audio::river::io::Manager::init(const etk::String& _filename) {
|
||||
RIVER_ERROR("kjqsdhfkjqshdfkjqhsdskjdfhfkqjshqhskdjfhqsdfqsdqsdfqsdqsdfqsdfqsdfqsdfqsdfqsd");
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (_filename == "") {
|
||||
if (m_config.load(pathToTheRiverConfigInHome) == false) {
|
||||
RIVER_INFO("Load default config");
|
||||
@ -82,12 +83,12 @@ void audio::river::io::Manager::init(const etk::String& _filename) {
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::initString(const etk::String& _data) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
m_config.parse(_data);
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::unInit() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
// TODO : ...
|
||||
}
|
||||
|
||||
@ -110,7 +111,7 @@ ememory::SharedPtr<audio::river::io::Manager> audio::river::io::Manager::getInst
|
||||
|
||||
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStreamInput() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
@ -127,7 +128,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStreamInput() {
|
||||
}
|
||||
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStreamOutput() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
@ -144,7 +145,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStreamOutput() {
|
||||
}
|
||||
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStreamVirtual() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
@ -164,7 +165,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStreamVirtual() {
|
||||
}
|
||||
|
||||
etk::Vector<etk::String> audio::river::io::Manager::getListStream() {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
etk::Vector<etk::String> output;
|
||||
etk::Vector<etk::String> keys = m_config.getKeys();
|
||||
for (auto &it : keys) {
|
||||
@ -180,7 +181,7 @@ etk::Vector<etk::String> audio::river::io::Manager::getListStream() {
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(const etk::String& _name) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
RIVER_WARNING("Get node : " << _name);
|
||||
// search in the standalone list :
|
||||
for (size_t iii=0; iii<m_list.size(); ++iii) {
|
||||
@ -193,7 +194,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
}
|
||||
// search in the group list:
|
||||
{
|
||||
for (etk::Map<etk::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) {
|
||||
@ -267,7 +268,7 @@ ememory::SharedPtr<audio::river::io::Node> audio::river::io::Manager::getNode(co
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVolumeGroup(const etk::String& _name) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
if (_name == "") {
|
||||
RIVER_ERROR("Try to create an audio group with no name ...");
|
||||
return ememory::SharedPtr<audio::drain::VolumeElement>();
|
||||
@ -287,7 +288,7 @@ ememory::SharedPtr<audio::drain::VolumeElement> audio::river::io::Manager::getVo
|
||||
}
|
||||
|
||||
bool audio::river::io::Manager::setVolume(const etk::String& _volumeName, float _valuedB) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
|
||||
@ -309,7 +310,7 @@ bool audio::river::io::Manager::setVolume(const etk::String& _volumeName, float
|
||||
}
|
||||
|
||||
float audio::river::io::Manager::getVolume(const etk::String& _volumeName) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
|
||||
@ -323,7 +324,7 @@ etk::Pair<float,float> audio::river::io::Manager::getVolumeRange(const etk::Stri
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::setMute(const etk::String& _volumeName, bool _mute) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not set volume ... : '" << _volumeName << "'");
|
||||
@ -339,7 +340,7 @@ void audio::river::io::Manager::setMute(const etk::String& _volumeName, bool _mu
|
||||
}
|
||||
|
||||
bool audio::river::io::Manager::getMute(const etk::String& _volumeName) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ememory::SharedPtr<audio::drain::VolumeElement> volume = getVolumeGroup(_volumeName);
|
||||
if (volume == nullptr) {
|
||||
RIVER_ERROR("Can not get volume ... : '" << _volumeName << "'");
|
||||
@ -349,7 +350,7 @@ bool audio::river::io::Manager::getMute(const etk::String& _volumeName) {
|
||||
}
|
||||
|
||||
void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
etk::FSNode node(_filename);
|
||||
RIVER_INFO("Generate the DOT files: " << node);
|
||||
if (node.fileOpenWrite() == false) {
|
||||
@ -369,7 +370,7 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (etk::Map<etk::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 +389,7 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (etk::Map<etk::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) {
|
||||
@ -403,16 +404,15 @@ void audio::river::io::Manager::generateDot(const etk::String& _filename) {
|
||||
}
|
||||
|
||||
ememory::SharedPtr<audio::river::io::Group> audio::river::io::Manager::getGroup(const etk::String& _name) {
|
||||
Ethread::RecursiveLock lock(m_mutex);
|
||||
ethread::RecursiveLock lock(m_mutex);
|
||||
ememory::SharedPtr<audio::river::io::Group> out;
|
||||
etk::Map<etk::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);
|
||||
etk::Pair<etk::String, ememory::SharedPtr<audio::river::io::Group> > plop(etk::String(_name), out);
|
||||
m_listGroup.insert(plop);
|
||||
m_listGroup.add(_name, out);
|
||||
RIVER_INFO("Create a new group: " << _name << " ( END )");
|
||||
} else {
|
||||
RIVER_ERROR("Can not create new group: " << _name << " ( END )");
|
||||
|
@ -8,10 +8,7 @@
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/Map.hpp>
|
||||
#include <list>
|
||||
#include <cstdint>
|
||||
#include <ethread/Mutex.hpp>
|
||||
#include <chrono>
|
||||
#include <etk/Function.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <audio/format.hpp>
|
||||
@ -19,6 +16,7 @@
|
||||
#include <ejson/ejson.hpp>
|
||||
#include <audio/drain/Volume.hpp>
|
||||
#include <audio/river/io/Group.hpp>
|
||||
#include <ethread/MutexRecursive.hpp>
|
||||
|
||||
namespace audio {
|
||||
namespace river {
|
||||
@ -30,7 +28,7 @@ namespace audio {
|
||||
*/
|
||||
class Manager : public ememory::EnableSharedFromThis<Manager> {
|
||||
private:
|
||||
mutable std::recursive_mutex m_mutex; //!< prevent multiple access
|
||||
mutable ethread::MutexRecursive m_mutex; //!< prevent multiple access
|
||||
private:
|
||||
/**
|
||||
* @brief Constructor
|
||||
|
@ -122,7 +122,7 @@ size_t audio::river::io::Node::getNumberOfInterface(enum audio::river::modeInter
|
||||
size_t audio::river::io::Node::getNumberOfInterfaceAvaillable(enum audio::river::modeInterface _interfaceType) {
|
||||
size_t out = 0;
|
||||
for (size_t iii=0; iii<m_listAvaillable.size(); ++iii) {
|
||||
ememory::SharedPtr<audio::river::Interface> element = m_listAvaillable[iii].lock();
|
||||
auto element = m_listAvaillable[iii].lock();
|
||||
if (element == nullptr) {
|
||||
continue;
|
||||
}
|
||||
@ -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) {
|
||||
etk::Vector<ememory::WeakPtr<audio::river::Interface> >::iterator it = m_listAvaillable.begin();
|
||||
auto it = m_listAvaillable.begin();
|
||||
while (it != m_listAvaillable.end()) {
|
||||
if (it->expired() == true) {
|
||||
it = m_listAvaillable.erase(it);
|
||||
@ -181,7 +181,7 @@ void audio::river::io::Node::interfaceRemove(const ememory::SharedPtr<audio::riv
|
||||
|
||||
void audio::river::io::Node::volumeChange() {
|
||||
for (size_t iii=0; iii< m_listAvaillable.size(); ++iii) {
|
||||
ememory::SharedPtr<audio::river::Interface> node = m_listAvaillable[iii].lock();
|
||||
auto node = m_listAvaillable[iii].lock();
|
||||
if (node != nullptr) {
|
||||
node->systemVolumeChange();
|
||||
}
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <list>
|
||||
#include <cstdint>
|
||||
#include <chrono>
|
||||
#include <etk/Function.hpp>
|
||||
#include <ememory/memory.hpp>
|
||||
#include <audio/format.hpp>
|
||||
|
@ -103,28 +103,27 @@ audio::river::io::NodeAEC::NodeAEC(const etk::String& _name, const ejson::Object
|
||||
}
|
||||
|
||||
// set callback mode ...
|
||||
m_interfaceFeedBack->setInputCallback(std::bind(&audio::river::io::NodeAEC::onDataReceivedFeedBack,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceFeedBack->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceivedFeedBack(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
// set callback mode ...
|
||||
m_interfaceMicrophone->setInputCallback(std::bind(&audio::river::io::NodeAEC::onDataReceivedMicrophone,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
|
||||
m_bufferMicrophone.setCapacity(std::chrono::milliseconds(1000),
|
||||
m_interfaceMicrophone->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceivedMicrophone(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
m_bufferMicrophone.setCapacity(echrono::milliseconds(1000),
|
||||
audio::getFormatBytes(hardwareFormat.getFormat())*hardwareFormat.getMap().size(),
|
||||
hardwareFormat.getFrequency());
|
||||
m_bufferFeedBack.setCapacity(std::chrono::milliseconds(1000),
|
||||
m_bufferFeedBack.setCapacity(echrono::milliseconds(1000),
|
||||
audio::getFormatBytes(hardwareFormat.getFormat()), // only one channel ...
|
||||
hardwareFormat.getFrequency());
|
||||
|
||||
@ -212,7 +211,7 @@ void audio::river::io::NodeAEC::process() {
|
||||
delta = MicTime - fbTime;
|
||||
}
|
||||
|
||||
RIVER_INFO("check delta " << delta.count() << " > " << m_sampleTime.count());
|
||||
RIVER_INFO("check delta " << delta << " > " << m_sampleTime);
|
||||
if (delta > m_sampleTime) {
|
||||
// Synchronize if possible
|
||||
if (MicTime < fbTime) {
|
||||
@ -238,7 +237,7 @@ void audio::river::io::NodeAEC::process() {
|
||||
fbTime = m_bufferFeedBack.getReadTimeStamp();
|
||||
|
||||
if (MicTime-fbTime > m_sampleTime) {
|
||||
RIVER_ERROR("Can not synchronize flow ... : " << MicTime << " != " << fbTime << " delta = " << (MicTime-fbTime).count()/1000 << " µs");
|
||||
RIVER_ERROR("Can not synchronize flow ... : " << MicTime << " != " << fbTime << " delta = " << (MicTime-fbTime));
|
||||
return;
|
||||
}
|
||||
etk::Vector<uint8_t> dataMic;
|
||||
@ -248,7 +247,7 @@ void audio::river::io::NodeAEC::process() {
|
||||
while (true) {
|
||||
MicTime = m_bufferMicrophone.getReadTimeStamp();
|
||||
fbTime = m_bufferFeedBack.getReadTimeStamp();
|
||||
RIVER_INFO(" process 256 samples ... micTime=" << MicTime << " fbTime=" << fbTime << " delta = " << (MicTime-fbTime).count());
|
||||
RIVER_INFO(" process 256 samples ... micTime=" << MicTime << " fbTime=" << fbTime << " delta = " << (MicTime-fbTime));
|
||||
m_bufferMicrophone.read(&dataMic[0], m_nbChunk);
|
||||
m_bufferFeedBack.read(&dataFB[0], m_nbChunk);
|
||||
RIVER_SAVE_FILE_MACRO(int16_t, "REC_Microphone_sync.raw", &dataMic[0], m_nbChunk*getHarwareFormat().getMap().size());
|
||||
|
@ -197,28 +197,40 @@ audio::river::io::NodeFile::NodeFile(const etk::String& _name, const ejson::Obje
|
||||
if (m_isInput == true) {
|
||||
m_process.setInputConfig(hardwareFormat);
|
||||
m_process.setOutputConfig(interfaceFormat);
|
||||
err = m_interface.openStream(nullptr, ¶ms,
|
||||
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
|
||||
std::bind(&audio::river::io::NodeFile::recordCallback,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6),
|
||||
option
|
||||
);
|
||||
err = m_interface.openStream(nullptr,
|
||||
¶ms,
|
||||
hardwareFormat.getFormat(),
|
||||
hardwareFormat.getFrequency(),
|
||||
&m_rtaudioFrameSize,
|
||||
[=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map
|
||||
) {
|
||||
recordCallback(_data, _time, _nbChunk, _map);
|
||||
},
|
||||
option
|
||||
);
|
||||
} else {
|
||||
m_process.setInputConfig(interfaceFormat);
|
||||
m_process.setOutputConfig(hardwareFormat);
|
||||
err = m_interface.openStream(¶ms, nullptr,
|
||||
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
|
||||
std::bind(&audio::river::io::NodeFile::playbackCallback,
|
||||
this,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6),
|
||||
option
|
||||
err = m_interface.openStream(¶ms,
|
||||
nullptr,
|
||||
hardwareFormat.getFormat(),
|
||||
hardwareFormat.getFrequency(),
|
||||
&m_rtaudioFrameSize,
|
||||
[=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map
|
||||
) {
|
||||
playbackCallback(_data, _time, _nbChunk, _map);
|
||||
},
|
||||
option
|
||||
);
|
||||
}
|
||||
if (err != audio::orchestra::error_none) {
|
||||
|
@ -42,7 +42,7 @@ namespace audio {
|
||||
audio::format m_format; //!< Format of the file
|
||||
etk::Vector<audio::channel> m_map; //!< Map of the file
|
||||
ememory::SharedPtr<ethread::Thread> m_thread; //!< playing thread of the flow
|
||||
std::atomic<bool> m_alive; //!< thread is active
|
||||
bool m_alive; //!< thread is active
|
||||
protected:
|
||||
virtual void start();
|
||||
virtual void stop();
|
||||
|
@ -128,28 +128,28 @@ audio::river::io::NodeMuxer::NodeMuxer(const etk::String& _name, const ejson::Ob
|
||||
}
|
||||
|
||||
// set callback mode ...
|
||||
m_interfaceInput1->setInputCallback(std::bind(&audio::river::io::NodeMuxer::onDataReceivedInput1,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceInput1->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceivedInput1(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
// set callback mode ...
|
||||
m_interfaceInput2->setInputCallback(std::bind(&audio::river::io::NodeMuxer::onDataReceivedInput2,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceInput2->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceivedInput2(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
|
||||
m_bufferInput1.setCapacity(std::chrono::milliseconds(1000),
|
||||
m_bufferInput1.setCapacity(echrono::milliseconds(1000),
|
||||
audio::getFormatBytes(hardwareFormat.getFormat())*m_mapInput1.size(),
|
||||
hardwareFormat.getFrequency());
|
||||
m_bufferInput2.setCapacity(std::chrono::milliseconds(1000),
|
||||
m_bufferInput2.setCapacity(echrono::milliseconds(1000),
|
||||
audio::getFormatBytes(hardwareFormat.getFormat())*m_mapInput2.size(),
|
||||
hardwareFormat.getFrequency());
|
||||
|
||||
@ -243,7 +243,7 @@ void audio::river::io::NodeMuxer::process() {
|
||||
} else {
|
||||
delta = in1Time - in2Time;
|
||||
}
|
||||
RIVER_VERBOSE("check delta " << delta.count() << " > " << m_sampleTime.count());
|
||||
RIVER_VERBOSE("check delta " << delta << " > " << m_sampleTime);
|
||||
if (delta > m_sampleTime) {
|
||||
// Synchronize if possible
|
||||
if (in1Time < in2Time) {
|
||||
@ -271,7 +271,7 @@ void audio::river::io::NodeMuxer::process() {
|
||||
in2Time = m_bufferInput2.getReadTimeStamp();
|
||||
|
||||
if (in1Time-in2Time > m_sampleTime) {
|
||||
RIVER_ERROR("Can not synchronize flow ... : " << in1Time << " != " << in2Time << " delta = " << (in1Time-in2Time).count()/1000 << " µs");
|
||||
RIVER_ERROR("Can not synchronize flow ... : " << in1Time << " != " << in2Time << " delta = " << (in1Time-in2Time));
|
||||
return;
|
||||
}
|
||||
etk::Vector<uint8_t> dataIn1;
|
||||
@ -282,7 +282,7 @@ void audio::river::io::NodeMuxer::process() {
|
||||
while (true) {
|
||||
in1Time = m_bufferInput1.getReadTimeStamp();
|
||||
in2Time = m_bufferInput2.getReadTimeStamp();
|
||||
//RIVER_INFO(" process 256 samples ... in1Time=" << in1Time << " in2Time=" << in2Time << " delta = " << (in1Time-in2Time).count());
|
||||
//RIVER_INFO(" process 256 samples ... in1Time=" << in1Time << " in2Time=" << in2Time << " delta = " << (in1Time-in2Time));
|
||||
m_bufferInput1.read(&dataIn1[0], 256);
|
||||
m_bufferInput2.read(&dataIn2[0], 256);
|
||||
//RIVER_SAVE_FILE_MACRO(int16_t, "REC_muxer_output_1.raw", &dataIn1[0], 256 * m_mapInput1.size());
|
||||
|
@ -198,29 +198,39 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const etk::String& _name, const e
|
||||
if (m_isInput == true) {
|
||||
m_process.setInputConfig(hardwareFormat);
|
||||
m_process.setOutputConfig(interfaceFormat);
|
||||
err = m_interface.openStream(nullptr, ¶ms,
|
||||
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
|
||||
std::bind(&audio::river::io::NodeOrchestra::recordCallback,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6),
|
||||
option
|
||||
);
|
||||
err = m_interface.openStream(nullptr,
|
||||
¶ms,
|
||||
hardwareFormat.getFormat(),
|
||||
hardwareFormat.getFrequency(),
|
||||
&m_rtaudioFrameSize,
|
||||
[=] (const void* _inputBuffer,
|
||||
const audio::Time& _timeInput,
|
||||
void* _outputBuffer,
|
||||
const audio::Time& _timeOutput,
|
||||
uint32_t _nbChunk,
|
||||
const etk::Vector<audio::orchestra::status>& _status) {
|
||||
return recordCallback(_inputBuffer, _timeInput, _nbChunk, _status);
|
||||
},
|
||||
option
|
||||
);
|
||||
} else {
|
||||
m_process.setInputConfig(interfaceFormat);
|
||||
m_process.setOutputConfig(hardwareFormat);
|
||||
err = m_interface.openStream(¶ms, nullptr,
|
||||
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
|
||||
std::bind(&audio::river::io::NodeOrchestra::playbackCallback,
|
||||
this,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6),
|
||||
option
|
||||
);
|
||||
err = m_interface.openStream(¶ms,
|
||||
nullptr,
|
||||
hardwareFormat.getFormat(),
|
||||
hardwareFormat.getFrequency(),
|
||||
&m_rtaudioFrameSize,
|
||||
[=] (const void* _inputBuffer,
|
||||
const audio::Time& _timeInput,
|
||||
void* _outputBuffer,
|
||||
const audio::Time& _timeOutput,
|
||||
uint32_t _nbChunk,
|
||||
const etk::Vector<audio::orchestra::status>& _status) {
|
||||
return playbackCallback(_outputBuffer, _timeOutput, _nbChunk, _status);
|
||||
},
|
||||
option
|
||||
);
|
||||
}
|
||||
if (err != audio::orchestra::error_none) {
|
||||
RIVER_ERROR("Create stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not create stream " << err);
|
||||
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <etk/String.hpp>
|
||||
/**
|
||||
* @brief Audio library namespace
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@ What change:
|
||||
```{.cpp}
|
||||
//Get the generic feedback on speaker:
|
||||
interface = manager->createFeedback(48000,
|
||||
std::vector<audio::channel>(),
|
||||
etk::Vector<audio::channel>(),
|
||||
audio::format_int16,
|
||||
"speaker");
|
||||
```
|
||||
|
@ -45,7 +45,7 @@ void onDataReceived(const void* _data,
|
||||
etk::FSNode* _outputNode) {
|
||||
if ( _format != audio::format_int16
|
||||
&& _format != audio::format_float) {
|
||||
std::cout << "[ERROR] call wrong type ... (need int16_t.float)" << std::endl;
|
||||
TEST_ERROR("Call wrong type ... (need int16_t.float)");
|
||||
return;
|
||||
}
|
||||
//! [audio_river_sample_callback_implement]
|
||||
@ -58,7 +58,7 @@ void onDataReceived(const void* _data,
|
||||
value += etk::abs(data[iii]);
|
||||
}
|
||||
value /= (_nbChunk*_map.size());
|
||||
std::cout << "Get data ... average=" << int32_t(value) << std::endl;
|
||||
TEST_PRINT("Get data ... average=" << int32_t(value));
|
||||
} else {
|
||||
// get the curent power of the signal.
|
||||
const float* data = static_cast<const float*>(_data);
|
||||
@ -67,11 +67,11 @@ void onDataReceived(const void* _data,
|
||||
value += etk::abs(data[iii]);
|
||||
}
|
||||
value /= (_nbChunk*_map.size());
|
||||
std::cout << "Get data ... average=" << float(value) << std::endl;
|
||||
TEST_PRINT("Get data ... average=" << float(value));
|
||||
}
|
||||
} else {
|
||||
// just write data
|
||||
//std::cout << "Get data ... chunks=" << _nbChunk << " time=" << _time << std::endl;
|
||||
TEST_VERBOSE("Get data ... chunks=" << _nbChunk << " time=" << _time);
|
||||
_outputNode->fileWrite(_data, _map.size()*audio::getFormatBytes(_format), _nbChunk);
|
||||
}
|
||||
}
|
||||
@ -89,20 +89,20 @@ int main(int _argc, const char **_argv) {
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
std::cout << "Help : " << std::endl;
|
||||
std::cout << " --conf=xxx.json Input/output configuration" << std::endl;
|
||||
std::cout << " --io=xxx name configuration input" << std::endl;
|
||||
std::cout << " --file=yyy.raw File name to store data" << std::endl;
|
||||
TEST_PRINT("Help : ")
|
||||
TEST_PRINT(" --conf=xxx.json Input/output configuration");
|
||||
TEST_PRINT(" --io=xxx name configuration input");
|
||||
TEST_PRINT(" --file=yyy.raw File name to store data");
|
||||
exit(0);
|
||||
} else if (etk::start_with(data, "--conf=") == true) {
|
||||
configFile = etk::String(data.begin()+7, data.end());
|
||||
std::cout << "Select config: " << configFile << std::endl;
|
||||
TEST_PRINT("Select config: " << configFile);
|
||||
} else if (etk::start_with(data, "--io=") == true) {
|
||||
ioName = etk::String(data.begin()+5, data.end());
|
||||
std::cout << "Select io: " << ioName << std::endl;
|
||||
TEST_PRINT("Select io: " << ioName);
|
||||
} else if (etk::start_with(data, "--file=") == true) {
|
||||
outputFileName = etk::String(data.begin()+7, data.end());
|
||||
std::cout << "Select output file name: " << outputFileName << std::endl;
|
||||
TEST_PRINT("Select output file name: " << outputFileName);
|
||||
}
|
||||
}
|
||||
// initialize river interface
|
||||
@ -124,7 +124,7 @@ int main(int _argc, const char **_argv) {
|
||||
audio::format_int16,
|
||||
ioName);
|
||||
if(interface == nullptr) {
|
||||
std::cout << "nullptr interface" << std::endl;
|
||||
TEST_ERROR("nullptr interface");
|
||||
return -1;
|
||||
}
|
||||
//! [audio_river_sample_create_read_interface]
|
||||
@ -136,20 +136,20 @@ int main(int _argc, const char **_argv) {
|
||||
}
|
||||
//! [audio_river_sample_set_callback]
|
||||
// set callback mode ...
|
||||
interface->setInputCallback(std::bind(&onDataReceived,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6,
|
||||
&outputNode));
|
||||
interface->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map, &outputNode);
|
||||
});
|
||||
//! [audio_river_sample_set_callback]
|
||||
//! [audio_river_sample_read_start_stop]
|
||||
// start the stream
|
||||
interface->start();
|
||||
// wait 10 second ...
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(10));
|
||||
ethread::sleepMilliSeconds(1000*(10));
|
||||
// stop the stream
|
||||
interface->stop();
|
||||
//! [audio_river_sample_read_start_stop]
|
||||
|
@ -44,9 +44,9 @@ void onDataNeeded(void* _data,
|
||||
static double phase[8] = {0,0,0,0,0,0,0,0};
|
||||
|
||||
if (_format != audio::format_int16) {
|
||||
std::cout << "[ERROR] call wrong type ... (need int16_t)" << std::endl;
|
||||
TEST_ERROR("Call wrong type ... (need int16_t)");
|
||||
}
|
||||
//std::cout << "Map " << _map << std::endl;
|
||||
//TEST_VERBOSE("Map " << _map);
|
||||
int16_t* data = static_cast<int16_t*>(_data);
|
||||
double baseCycle = 2.0*M_PI/double(48000) * double(440);
|
||||
for (int32_t iii=0; iii<_nbChunk; iii++) {
|
||||
@ -68,8 +68,8 @@ int main(int _argc, const char **_argv) {
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
std::cout << "Help : " << std::endl;
|
||||
std::cout << " ./xxx ---" << std::endl;
|
||||
TEST_PRINT("Help:");
|
||||
TEST_PRINT(" ./xxx ---");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
@ -86,24 +86,25 @@ int main(int _argc, const char **_argv) {
|
||||
audio::format_int16,
|
||||
"speaker");
|
||||
if(interface == nullptr) {
|
||||
std::cout << "nullptr interface" << std::endl;
|
||||
TEST_ERROR("nullptr interface");
|
||||
return -1;
|
||||
}
|
||||
//! [audio_river_sample_create_write_interface]
|
||||
//! [audio_river_sample_set_callback]
|
||||
// set callback mode ...
|
||||
interface->setOutputCallback(std::bind(&onDataNeeded,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
interface->setOutputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
//! [audio_river_sample_set_callback]
|
||||
// start the stream
|
||||
interface->start();
|
||||
// wait 10 second ...
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(10));
|
||||
ethread::sleepMilliSeconds(1000*(10));
|
||||
// stop the stream
|
||||
interface->stop();
|
||||
// remove interface and manager.
|
||||
|
@ -33,8 +33,9 @@
|
||||
#include <etest/etest.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
extern "C" {
|
||||
#include <math.h>
|
||||
}
|
||||
|
||||
#include <ethread/Thread.hpp>
|
||||
#include "testAEC.hpp"
|
||||
|
@ -26,7 +26,7 @@ namespace river_test_aec {
|
||||
channelMap.pushBack(audio::channel_frontLeft);
|
||||
channelMap.pushBack(audio::channel_frontRight);
|
||||
}
|
||||
m_buffer.setCapacity(std::chrono::milliseconds(2000), sizeof(int16_t)*channelMap.size(), 48000);
|
||||
m_buffer.setCapacity(echrono::milliseconds(2000), sizeof(int16_t)*channelMap.size(), 48000);
|
||||
|
||||
m_interfaceOut = m_manager->createOutput(48000,
|
||||
channelMap,
|
||||
@ -37,14 +37,14 @@ namespace river_test_aec {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceOut->setOutputCallback(std::bind(&Linker::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceOut->setOutputCallback([=](void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
m_interfaceOut->addVolumeGroup("FLOW");
|
||||
if ("speaker" == _output) {
|
||||
m_interfaceOut->setParameter("volume", "FLOW", "0dB");
|
||||
@ -59,14 +59,14 @@ namespace river_test_aec {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceIn->setInputCallback(std::bind(&Linker::onDataReceived,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceIn->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
|
||||
}
|
||||
void onDataNeeded(void* _data,
|
||||
@ -203,7 +203,7 @@ namespace river_test_aec {
|
||||
ememory::SharedPtr<Linker> processLink2 = ememory::makeShared<Linker>(manager, "microphone", "speaker-test");
|
||||
processLink1->start();
|
||||
processLink2->start();
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(20));
|
||||
ethread::sleepMilliSeconds(1000*(20));
|
||||
processLink1->stop();
|
||||
processLink2->stop();
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace river_test_echo_delay {
|
||||
double m_phase;
|
||||
double m_freq;
|
||||
int32_t m_nextSampleCount;
|
||||
std::chrono::milliseconds m_delayBetweenEvent;
|
||||
echrono::milliseconds m_delayBetweenEvent;
|
||||
audio::Time m_nextTick;
|
||||
audio::Time m_currentTick;
|
||||
int32_t m_stateFB;
|
||||
@ -49,14 +49,14 @@ namespace river_test_echo_delay {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceOut->setOutputCallback(std::bind(&TestClass::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceOut->setOutputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
m_interfaceOut->addVolumeGroup("FLOW");
|
||||
m_interfaceOut->setParameter("volume", "FLOW", etk::toString(m_gain) + "dB");
|
||||
|
||||
@ -69,14 +69,14 @@ namespace river_test_echo_delay {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceIn->setInputCallback(std::bind(&TestClass::onDataReceived,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceIn->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
|
||||
m_interfaceFB = m_manager->createFeedback(48000,
|
||||
channelMap,
|
||||
@ -87,14 +87,14 @@ namespace river_test_echo_delay {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceFB->setInputCallback(std::bind(&TestClass::onDataReceivedFeedBack,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceFB->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceivedFeedBack(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
|
||||
m_manager->generateDotAll("activeProcess.dot");
|
||||
}
|
||||
@ -362,7 +362,7 @@ namespace river_test_echo_delay {
|
||||
while (m_estimateVolumeInput == true) {
|
||||
ethread::sleepMilliSeconds((10));
|
||||
}
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(10));
|
||||
ethread::sleepMilliSeconds(1000*(10));
|
||||
//m_interfaceFB->stop();
|
||||
m_interfaceIn->stop();
|
||||
m_interfaceOut->stop();
|
||||
|
@ -66,14 +66,14 @@ namespace river_test_format {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interface->setOutputCallback(std::bind(&testOutCallbackType::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interface->setOutputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
}
|
||||
void onDataNeeded(void* _data,
|
||||
const audio::Time& _time,
|
||||
@ -136,7 +136,7 @@ namespace river_test_format {
|
||||
}
|
||||
m_interface->start();
|
||||
// wait 2 second ...
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(1));
|
||||
ethread::sleepMilliSeconds(1000*(1));
|
||||
m_interface->stop();
|
||||
ethread::sleepMilliSeconds((100));
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ namespace river_test_muxer {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceOut->setOutputCallback(std::bind(&TestClass::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceOut->setOutputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
m_interfaceOut->addVolumeGroup("FLOW");
|
||||
//m_interfaceOut->setParameter("volume", "FLOW", "-6dB");
|
||||
|
||||
@ -51,14 +51,14 @@ namespace river_test_muxer {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interfaceIn->setInputCallback(std::bind(&TestClass::onDataReceived,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interfaceIn->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
m_manager->generateDotAll("activeProcess.dot");
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ namespace river_test_muxer {
|
||||
}
|
||||
m_interfaceOut->start();
|
||||
m_interfaceIn->start();
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(10));
|
||||
ethread::sleepMilliSeconds(1000*(10));
|
||||
m_interfaceIn->stop();
|
||||
m_interfaceOut->stop();
|
||||
}
|
||||
|
@ -29,14 +29,14 @@ namespace river_test_playback_callback {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interface->setOutputCallback(std::bind(&testOutCallback::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interface->setOutputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
}
|
||||
void onDataNeeded(void* _data,
|
||||
const audio::Time& _time,
|
||||
@ -66,7 +66,7 @@ namespace river_test_playback_callback {
|
||||
}
|
||||
m_interface->start();
|
||||
// wait 2 second ...
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(2));
|
||||
ethread::sleepMilliSeconds(1000*(2));
|
||||
m_interface->stop();
|
||||
}
|
||||
};
|
||||
|
@ -119,13 +119,13 @@ namespace river_test_playback_write {
|
||||
return;
|
||||
}
|
||||
m_interface->setReadwrite();
|
||||
m_interface->setWriteCallback(std::bind(&testOutWriteCallback::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5));
|
||||
m_interface->setWriteCallback([=](const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
}
|
||||
void onDataNeeded(const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
@ -156,7 +156,7 @@ namespace river_test_playback_write {
|
||||
return;
|
||||
}
|
||||
m_interface->start();
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(1));
|
||||
ethread::sleepMilliSeconds(1000*(1));
|
||||
m_interface->stop();
|
||||
}
|
||||
};
|
||||
|
@ -41,14 +41,14 @@ namespace river_test_record_callback {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interface->setInputCallback(std::bind(&testInCallback::onDataReceived,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interface->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
}
|
||||
void onDataReceived(const void* _data,
|
||||
const audio::Time& _time,
|
||||
@ -75,7 +75,7 @@ namespace river_test_record_callback {
|
||||
}
|
||||
m_interface->start();
|
||||
// wait 2 second ...
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(20));
|
||||
ethread::sleepMilliSeconds(1000*(20));
|
||||
m_interface->stop();
|
||||
}
|
||||
};
|
||||
|
@ -44,14 +44,14 @@ namespace river_test_volume {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interface->setOutputCallback(std::bind(&testCallbackVolume::onDataNeeded,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interface->setOutputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataNeeded(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
m_interface->addVolumeGroup("MEDIA");
|
||||
m_interface->addVolumeGroup("FLOW");
|
||||
}
|
||||
@ -79,7 +79,7 @@ namespace river_test_volume {
|
||||
return;
|
||||
}
|
||||
m_interface->start();
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(1));
|
||||
ethread::sleepMilliSeconds(1000*(1));
|
||||
m_interface->setParameter("volume", "FLOW", "-3dB");
|
||||
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
|
||||
ethread::sleepMilliSeconds((500));
|
||||
@ -112,7 +112,7 @@ namespace river_test_volume {
|
||||
ethread::sleepMilliSeconds((500));
|
||||
m_manager->setVolume("MEDIA", -3.0f);
|
||||
TEST_INFO("get volume MEDIA: " << m_manager->getVolume("MEDIA") );
|
||||
ethread::sleepMilliSeconds(std::chrono::seconds(1));
|
||||
ethread::sleepMilliSeconds(1000*(1));
|
||||
m_interface->stop();
|
||||
}
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ void audio::river::widget::TemporalViewer::onDataReceived(const void* _data,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
ethread::UniqueLock lock(m_mutex);
|
||||
if (_format != audio::format_float) {
|
||||
std::cout << "[ERROR] call wrong type ... (need int16_t)" << std::endl;
|
||||
ARW_ERROR("call wrong type ... (need int16_t)");
|
||||
}
|
||||
// get the curent power of the signal.
|
||||
const float* data = static_cast<const float*>(_data);
|
||||
@ -70,14 +70,14 @@ void audio::river::widget::TemporalViewer::recordToggle() {
|
||||
return;
|
||||
}
|
||||
// set callback mode ...
|
||||
m_interface->setInputCallback(std::bind(&audio::river::widget::TemporalViewer::onDataReceived,
|
||||
this,
|
||||
std::placeholders::_1,
|
||||
std::placeholders::_2,
|
||||
std::placeholders::_3,
|
||||
std::placeholders::_4,
|
||||
std::placeholders::_5,
|
||||
std::placeholders::_6));
|
||||
m_interface->setInputCallback([=](const void* _data,
|
||||
const audio::Time& _time,
|
||||
size_t _nbChunk,
|
||||
enum audio::format _format,
|
||||
uint32_t _frequency,
|
||||
const etk::Vector<audio::channel>& _map) {
|
||||
onDataReceived(_data, _time, _nbChunk, _format, _frequency, _map);
|
||||
});
|
||||
// start the stream
|
||||
m_interface->start();
|
||||
periodicCallEnable();
|
||||
|
Loading…
x
Reference in New Issue
Block a user