[DEV] add The interface of the hardware link

This commit is contained in:
Edouard DUPIN 2015-02-27 22:21:54 +01:00
parent 7a75911770
commit 76bc3c9322
5 changed files with 43 additions and 5 deletions

View File

@ -10,7 +10,10 @@
# name of the interface
# name:"default",
name:"hw:0,0",
timestamp-mode:"hardware",
},
# lik hardware ti the specified IO name :
hw-link:"speaker",
# frequency to open device
frequency:48000,
# mapping of the harware device (mapping is not get under)
@ -29,6 +32,7 @@
interface:"alsa",
#name:"default",
name:"hw:0,0",
timestamp-mode:"hardware",
},
frequency:48000,
channel-map:[

View File

@ -93,6 +93,19 @@ river::io::Node::Node(const std::string& _name, const std11::shared_ptr<const ej
m_process.setInputConfig(interfaceFormat);
}
//m_process.updateInterAlgo();
std::string linkWith = m_config->getStringValue("hw-link", "");
if (linkWith != "") {
std11::shared_ptr<Manager> mng = river::io::Manager::getInstance();
if (mng == nullptr) {
return;
}
m_link = mng->getNode(linkWith);
if (m_link == nullptr) {
RIVER_ERROR("can not link 2 interfaces ...");
} else {
RIVER_INFO("******** REQUEST LINK interface ************");
}
}
}
river::io::Node::~Node() {

View File

@ -63,7 +63,8 @@ namespace river {
protected:
std11::shared_ptr<drain::VolumeElement> m_volume; //!< if a volume is set it is set here ...
std11::shared_ptr<river::io::Node> m_link;
protected:
std::vector<std11::weak_ptr<river::Interface> > m_listAvaillable; //!< List of all interface that exist on this Node
std::vector<std11::shared_ptr<river::Interface> > m_list;

View File

@ -217,6 +217,9 @@ river::io::NodeAirTAudio::NodeAirTAudio(const std::string& _name, const std11::s
m_info.outputChannels = 2;
params.nChannels = 2;
}
airtaudio::StreamOptions option;
etk::from_string(option.mode, m_config->getStringValue("timestamp-mode", "soft"));
m_rtaudioFrameSize = nbChunk;
RIVER_INFO("Open output stream nbChannels=" << params.nChannels);
@ -229,7 +232,8 @@ river::io::NodeAirTAudio::NodeAirTAudio(const std::string& _name, const std11::s
std11::placeholders::_1,
std11::placeholders::_2,
std11::placeholders::_5,
std11::placeholders::_6)
std11::placeholders::_6),
option
);
} else {
err = m_adac.openStream(&params, nullptr,
@ -239,13 +243,26 @@ river::io::NodeAirTAudio::NodeAirTAudio(const std::string& _name, const std11::s
std11::placeholders::_3,
std11::placeholders::_4,
std11::placeholders::_5,
std11::placeholders::_6)
std11::placeholders::_6),
option
);
}
if (err != airtaudio::error_none) {
RIVER_ERROR("Create stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not create stream " << err);
}
m_process.updateInterAlgo();
// manage Link Between Nodes :
if (m_link != nullptr) {
RIVER_INFO("******** START LINK ************");
std11::shared_ptr<river::io::NodeAirTAudio> link = std11::dynamic_pointer_cast<river::io::NodeAirTAudio>(m_link);
if (link == nullptr) {
RIVER_ERROR("Can not link 2 Interface with not the same type (reserved for HW interface)");
return;
}
link->m_adac.isMasterOf(m_adac);
// TODO : Add return ...
RIVER_INFO("******** LINK might be done ************");
}
}
river::io::NodeAirTAudio::~NodeAirTAudio() {

View File

@ -609,6 +609,7 @@ static void threadVolume() {
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::shared_ptr<testCallbackVolume> process = std11::make_shared<testCallbackVolume>(manager);
usleep(100000);
process->run();
process.reset();
usleep(500000);
@ -617,12 +618,14 @@ static void threadVolume() {
TEST(TestALL, testInputCallBackMicClean) {
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std11::thread tmpThread(std11::bind(&threadVolume));
usleep(100000);
std11::thread tmpThread(std11::bind(&threadVolume));
usleep(30000);
APPL_INFO("test input (callback mode)");
std11::shared_ptr<testInCallback> process = std11::make_shared<testInCallback>(manager, "microphone-clean");
process->run();
usleep(100000);
process.reset();
usleep(500000);
tmpThread.join();