[DEV] add dynamic dependency of airtaudio and portaudio

This commit is contained in:
Edouard DUPIN 2015-02-23 22:14:48 +01:00
parent 7d6e1e0bf6
commit 62cb1ef639
6 changed files with 25 additions and 13 deletions

View File

@ -21,16 +21,8 @@ def create(target):
'river/io/NodeAEC.cpp', 'river/io/NodeAEC.cpp',
'river/io/Manager.cpp' 'river/io/Manager.cpp'
]) ])
if False: myModule.add_optionnal_module_depend('airtaudio', "__AIRTAUDIO_INFERFACE__")
myModule.add_optionnal_module_depend('airtaudio', "__AIRTAUDIO_INFERFACE__") myModule.add_optionnal_module_depend('portaudio', "__PORTAUDIO_INFERFACE__")
myModule.add_optionnal_module_depend('portaudio', "__PORTAUDIO_INFERFACE__")
else:
myModule.compile_flags_CC([
'-D__AIRTAUDIO_INFERFACE__',
'-D__PORTAUDIO_INFERFACE__'
])
myModule.add_module_depend(['airtaudio', 'portaudio'])
myModule.add_module_depend(['audio', 'drain', 'ejson']) myModule.add_module_depend(['audio', 'drain', 'ejson'])
myModule.add_export_path(tools.get_current_path(__file__)) myModule.add_export_path(tools.get_current_path(__file__))

View File

@ -99,17 +99,23 @@ std::shared_ptr<river::io::Node> river::io::Manager::getNode(const std::string&
if (tmpObject != nullptr) { if (tmpObject != nullptr) {
// get type : io // get type : io
std::string ioType = tmpObject->getStringValue("io", "error"); std::string ioType = tmpObject->getStringValue("io", "error");
#ifdef __AIRTAUDIO_INFERFACE__
if ( ioType == "input" if ( ioType == "input"
|| ioType == "output") { || ioType == "output") {
std::shared_ptr<river::io::Node> tmp = river::io::NodeAirTAudio::create(_name, tmpObject); std::shared_ptr<river::io::Node> tmp = river::io::NodeAirTAudio::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
} else if ( ioType == "PAinput" } else
|| ioType == "PAoutput") { #endif
#ifdef __PORTAUDIO_INFERFACE__
if ( ioType == "PAinput"
|| ioType == "PAoutput") {
std::shared_ptr<river::io::Node> tmp = river::io::NodePortAudio::create(_name, tmpObject); std::shared_ptr<river::io::Node> tmp = river::io::NodePortAudio::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;
} else if (ioType == "aec") { } else
#endif
if (ioType == "aec") {
std::shared_ptr<river::io::Node> tmp = river::io::NodeAEC::create(_name, tmpObject); std::shared_ptr<river::io::Node> tmp = river::io::NodeAEC::create(_name, tmpObject);
m_list.push_back(tmp); m_list.push_back(tmp);
return tmp; return tmp;

View File

@ -4,6 +4,8 @@
* @license APACHE v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
#ifdef __AIRTAUDIO_INFERFACE__
#include <river/io/NodeAirTAudio.h> #include <river/io/NodeAirTAudio.h>
#include <river/debug.h> #include <river/debug.h>
@ -261,3 +263,5 @@ void river::io::NodeAirTAudio::stop() {
RIVER_ERROR("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not stop stream ... " << err); RIVER_ERROR("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not stop stream ... " << err);
} }
} }
#endif

View File

@ -7,6 +7,8 @@
#ifndef __RIVER_IO_NODE_AIRTAUDIO_H__ #ifndef __RIVER_IO_NODE_AIRTAUDIO_H__
#define __RIVER_IO_NODE_AIRTAUDIO_H__ #define __RIVER_IO_NODE_AIRTAUDIO_H__
#ifdef __AIRTAUDIO_INFERFACE__
#include <river/io/Node.h> #include <river/io/Node.h>
namespace river { namespace river {
@ -49,6 +51,7 @@ namespace river {
}; };
} }
} }
#endif
#endif #endif

View File

@ -4,6 +4,8 @@
* @license APACHE v2.0 (see license file) * @license APACHE v2.0 (see license file)
*/ */
#ifdef __PORTTAUDIO_INFERFACE__
#include <river/io/NodePortAudio.h> #include <river/io/NodePortAudio.h>
#include <river/debug.h> #include <river/debug.h>
@ -150,3 +152,5 @@ void river::io::NodePortAudio::stop() {
RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not stop stream ... " << Pa_GetErrorText(err)); RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not stop stream ... " << Pa_GetErrorText(err));
} }
} }
#endif

View File

@ -7,6 +7,8 @@
#ifndef __RIVER_IO_NODE_PORTAUDIO_H__ #ifndef __RIVER_IO_NODE_PORTAUDIO_H__
#define __RIVER_IO_NODE_PORTAUDIO_H__ #define __RIVER_IO_NODE_PORTAUDIO_H__
#ifdef __PORTTAUDIO_INFERFACE__
#include <river/Interface.h> #include <river/Interface.h>
#include <river/io/Node.h> #include <river/io/Node.h>
#include <portaudio.h> #include <portaudio.h>
@ -41,6 +43,7 @@ namespace river {
}; };
} }
} }
#endif
#endif #endif