[DEV] some basic update

This commit is contained in:
Edouard DUPIN 2015-06-11 22:17:17 +02:00
parent 2071cf1c46
commit 63fb66d045
3 changed files with 33 additions and 25 deletions

View File

@ -65,8 +65,8 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
int32_t nbChunk = m_config->getNumberValue("nb-chunk", 1024); int32_t nbChunk = m_config->getNumberValue("nb-chunk", 1024);
// intanciate specific API ... // intanciate specific API ...
m_adac.instanciate(typeInterface); m_interface.instanciate(typeInterface);
m_adac.setName(_name); m_interface.setName(_name);
// TODO : Check return ... // TODO : Check return ...
std::string type = m_config->getStringValue("type", "int16"); std::string type = m_config->getStringValue("type", "int16");
if (streamName == "") { if (streamName == "") {
@ -81,23 +81,25 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
RIVER_INFO(" m_format=" << hardwareFormat.getFormat()); RIVER_INFO(" m_format=" << hardwareFormat.getFormat());
RIVER_INFO(" m_isInput=" << m_isInput); RIVER_INFO(" m_isInput=" << m_isInput);
int32_t deviceId = -1; int32_t deviceId = -1;
/*
// TODO : Remove this from here (create an extern interface ...) // TODO : Remove this from here (create an extern interface ...)
RIVER_INFO("Device list:"); RIVER_INFO("Device list:");
for (int32_t iii=0; iii<m_adac.getDeviceCount(); ++iii) { for (int32_t iii=0; iii<m_interface.getDeviceCount(); ++iii) {
m_info = m_adac.getDeviceInfo(iii); m_info = m_interface.getDeviceInfo(iii);
RIVER_INFO(" " << iii << " name :" << m_info.name); RIVER_INFO(" " << iii << " name :" << m_info.name);
m_info.display(2); m_info.display(2);
} }
*/
// special case for default IO: // special case for default IO:
if (streamName == "default") { if (streamName == "default") {
if (m_isInput == true) { if (m_isInput == true) {
deviceId = m_adac.getDefaultInputDevice(); deviceId = m_interface.getDefaultInputDevice();
} else { } else {
deviceId = m_adac.getDefaultOutputDevice(); deviceId = m_interface.getDefaultOutputDevice();
} }
} else { } else {
for (int32_t iii=0; iii<m_adac.getDeviceCount(); ++iii) { for (int32_t iii=0; iii<m_interface.getDeviceCount(); ++iii) {
m_info = m_adac.getDeviceInfo(iii); m_info = m_interface.getDeviceInfo(iii);
if (m_info.name == streamName) { if (m_info.name == streamName) {
RIVER_INFO(" Select ... id =" << iii); RIVER_INFO(" Select ... id =" << iii);
deviceId = iii; deviceId = iii;
@ -114,9 +116,9 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
// Open specific ID : // Open specific ID :
if (deviceId == -1) { if (deviceId == -1) {
m_info = m_adac.getDeviceInfo(streamName); m_info = m_interface.getDeviceInfo(streamName);
} else { } else {
m_info = m_adac.getDeviceInfo(deviceId); m_info = m_interface.getDeviceInfo(deviceId);
} }
// display property : // display property :
{ {
@ -202,7 +204,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
if (m_isInput == true) { if (m_isInput == true) {
m_process.setInputConfig(hardwareFormat); m_process.setInputConfig(hardwareFormat);
m_process.setOutputConfig(interfaceFormat); m_process.setOutputConfig(interfaceFormat);
err = m_adac.openStream(nullptr, &params, err = m_interface.openStream(nullptr, &params,
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std11::bind(&audio::river::io::NodeOrchestra::recordCallback, std11::bind(&audio::river::io::NodeOrchestra::recordCallback,
this, this,
@ -215,7 +217,7 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
} else { } else {
m_process.setInputConfig(interfaceFormat); m_process.setInputConfig(interfaceFormat);
m_process.setOutputConfig(hardwareFormat); m_process.setOutputConfig(hardwareFormat);
err = m_adac.openStream(&params, nullptr, err = m_interface.openStream(&params, nullptr,
hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize,
std11::bind(&audio::river::io::NodeOrchestra::playbackCallback, std11::bind(&audio::river::io::NodeOrchestra::playbackCallback,
this, this,
@ -235,15 +237,15 @@ audio::river::io::NodeOrchestra::NodeOrchestra(const std::string& _name, const s
audio::river::io::NodeOrchestra::~NodeOrchestra() { audio::river::io::NodeOrchestra::~NodeOrchestra() {
std11::unique_lock<std11::mutex> lock(m_mutex); std11::unique_lock<std11::mutex> lock(m_mutex);
RIVER_INFO("close input stream"); RIVER_INFO("close input stream");
if (m_adac.isStreamOpen() ) { if (m_interface.isStreamOpen() ) {
m_adac.closeStream(); m_interface.closeStream();
} }
}; };
void audio::river::io::NodeOrchestra::start() { void audio::river::io::NodeOrchestra::start() {
std11::unique_lock<std11::mutex> lock(m_mutex); std11::unique_lock<std11::mutex> lock(m_mutex);
RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum audio::orchestra::error err = m_adac.startStream(); enum audio::orchestra::error err = m_interface.startStream();
if (err != audio::orchestra::error_none) { if (err != audio::orchestra::error_none) {
RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not start stream ... " << err); RIVER_ERROR("Start stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") << " can not start stream ... " << err);
} }
@ -252,7 +254,7 @@ void audio::river::io::NodeOrchestra::start() {
void audio::river::io::NodeOrchestra::stop() { void audio::river::io::NodeOrchestra::stop() {
std11::unique_lock<std11::mutex> lock(m_mutex); std11::unique_lock<std11::mutex> lock(m_mutex);
RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") ); RIVER_INFO("Stop stream : '" << m_name << "' mode=" << (m_isInput?"input":"output") );
enum audio::orchestra::error err = m_adac.stopStream(); enum audio::orchestra::error err = m_interface.stopStream();
if (err != audio::orchestra::error_none) { if (err != audio::orchestra::error_none) {
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);
} }

View File

@ -37,7 +37,7 @@ namespace audio {
return true; return true;
}; };
protected: protected:
audio::orchestra::Interface m_adac; //!< Real airtaudio interface audio::orchestra::Interface m_interface; //!< Real airtaudio interface
audio::orchestra::DeviceInfo m_info; //!< information on the stream. audio::orchestra::DeviceInfo m_info; //!< information on the stream.
unsigned int m_rtaudioFrameSize; // DEPRECATED soon... unsigned int m_rtaudioFrameSize; // DEPRECATED soon...
public: public:

View File

@ -3,23 +3,27 @@
io:"output", io:"output",
map-on:{ map-on:{
interface:"alsa", interface:"alsa",
name:"AD1989A_outputs", name:"hw:0,0",
#name:"default",
#name:"AD1989A_outputs",
timestamp-mode:"trigered", timestamp-mode:"trigered",
}, },
#group:"baseIOSynchrone",
frequency:48000, frequency:48000,
channel-map:[ channel-map:[
"front-left", "front-right", "front-left", "front-right",
], ],
type:"int16", type:"int16",
nb-chunk:6000, nb-chunk:6000,
volume-name:"MASTER", #volume-name:"MASTER",
mux-demux-type:"int16-on-int32", mux-demux-type:"int16-on-int32",
}, },
microphone:{ microphone-virtual-alsa:{
io:"input", io:"input",
map-on:{ map-on:{
interface:"alsa", interface:"alsa",
name:"AD1989A_inputs", name:"AD1989A_inputs",
#name:"hw:0,0",
timestamp-mode:"trigered", timestamp-mode:"trigered",
}, },
frequency:48000, frequency:48000,
@ -52,26 +56,28 @@
io:"input", io:"input",
map-on:{ map-on:{
interface:"alsa", interface:"alsa",
name:"hw:0,0,0", name:"hw:0,0,1",
#name:"AD1989A_inputs",
#name:"default",
timestamp-mode:"trigered", timestamp-mode:"trigered",
}, },
group:"baseIOSynchrone", #group:"baseIOSynchrone",
frequency:48000, frequency:48000,
channel-map:[ channel-map:[
"front-left", "front-right" "front-left", "front-right"
], ],
type:"int16", type:"int16",
nb-chunk:1024, nb-chunk:128,
mux-demux-type:"int16", mux-demux-type:"int16",
}, },
microphone-rear:{ microphone-rear:{
io:"input", io:"input",
map-on:{ map-on:{
interface:"alsa", interface:"alsa",
name:"hw:0,0,1", name:"hw:0,0,0",
timestamp-mode:"trigered", timestamp-mode:"trigered",
}, },
group:"baseIOSynchrone", #group:"baseIOSynchrone",
frequency:48000, frequency:48000,
channel-map:[ channel-map:[
"rear-left", "rear-right" "rear-left", "rear-right"