From 3a4982d788a445151d780aec348ad37977549868 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 9 Mar 2015 22:41:57 +0000 Subject: [PATCH] [TEST] try work on Nao --- data/hardwareLinux.json | 5 +- data/hardwareNao.json | 107 ++++++++++++++++++++++++++++++++++++++ data/virtual.json | 4 +- lutin_river_test.py | 3 +- river/io/NodeMuxer.cpp | 4 +- test/testEchoDelay.h | 2 - test/testMuxer.h | 4 +- test/testRecordCallback.h | 5 +- 8 files changed, 122 insertions(+), 12 deletions(-) create mode 100644 data/hardwareNao.json diff --git a/data/hardwareLinux.json b/data/hardwareLinux.json index 24dd103..949d6d4 100644 --- a/data/hardwareLinux.json +++ b/data/hardwareLinux.json @@ -4,7 +4,8 @@ map-on:{ interface:"alsa", #name:"default", - name:"hw:0,0", + #name:"hw:0,0", + name:"default", timestamp-mode:"trigered", }, group:"baseIOSynchrone", @@ -131,4 +132,4 @@ type:"int16", mux-demux-type:"int16", }, -} \ No newline at end of file +} diff --git a/data/hardwareNao.json b/data/hardwareNao.json new file mode 100644 index 0000000..e37c9e1 --- /dev/null +++ b/data/hardwareNao.json @@ -0,0 +1,107 @@ +{ + speaker:{ + io:"output", + map-on:{ + interface:"alsa", + name:"hw:0,0", + #name:"default", + timestamp-mode:"trigered", + }, + group:"baseIOSynchrone", + frequency:48000, + channel-map:[ + "front-left", "front-right", + ], + type:"int16", + nb-chunk:1024, + #volume-name:"MASTER", + mux-demux-type:"int16-on-int32", + }, + microphone-front:{ + io:"input", + map-on:{ + interface:"alsa", + name:"hw:0,0,0", + #name:"AD1989A_inputs", + #name:"default", + timestamp-mode:"trigered", + }, + group:"baseIOSynchrone", + frequency:48000, + channel-map:[ + "front-left", "front-right" + #, "rear-left", "rear-right" + ], + type:"int16", + nb-chunk:1024, #16384, + mux-demux-type:"int16", + }, + microphone-rear:{ + io:"input", + map-on:{ + interface:"alsa", + name:"hw:0,0,1", + timestamp-mode:"trigered", + }, + #group:"baseIOSynchrone", + frequency:48000, + channel-map:[ + "rear-left", "rear-right" + ], + type:"int16", + nb-chunk:1024, + mux-demux-type:"int16", + }, + # virtual Nodes : + microphone-clean:{ + io:"aec", + # connect in input mode + map-on-microphone:{ + # generic virtual definition + io:"input", + map-on:"microphone-muxed", + resampling-type:"speexdsp", + resampling-option:"quality=10" + }, + # connect in feedback mode + map-on-feedback:{ + io:"feedback", + map-on:"speaker", + resampling-type:"speexdsp", + resampling-option:"quality=10", + }, + #classical format configuration: + frequency:16000, + channel-map:[ + "front-left", "front-right", "rear-left", "rear-right" + ], + type:"int16", + # AEC algo definition + algo:"river-remover", + algo-mode:"cutter", + feedback-delay:10000, # in nanosecond + mux-demux-type:"int16", + }, + microphone-muxed:{ + io:"muxer", + map-on-input-1:{ + # generic virtual definition + io:"input", + map-on:"microphone-front", + resampling-type:"speexdsp", + resampling-option:"quality=10" + }, + map-on-input-2:{ + io:"input", + map-on:"microphone-rear", + resampling-type:"speexdsp", + resampling-option:"quality=10", + }, + frequency:48000, + channel-map:[ + "front-left", "front-right", "rear-left", "rear-right" + ], + type:"int16", + mux-demux-type:"int16", + }, +} diff --git a/data/virtual.json b/data/virtual.json index eba6eee..f5d3623 100644 --- a/data/virtual.json +++ b/data/virtual.json @@ -4,7 +4,7 @@ # input or output io:"input", # name of the harware device - map-on:"microphone", + map-on:"microphone-front", # name of the resampler resampling-type:"speexdsp", # some option to the resampler @@ -35,4 +35,4 @@ resampling-type:"speexdsp", resampling-option:"quality=10" }, -} \ No newline at end of file +} diff --git a/lutin_river_test.py b/lutin_river_test.py index f92d696..64fed8f 100644 --- a/lutin_river_test.py +++ b/lutin_river_test.py @@ -18,7 +18,8 @@ def create(target): if target.name=="Windows": myModule.copy_file('data/hardwareWindows.json', 'hardware.json') elif target.name=="Linux": - myModule.copy_file('data/hardwareLinux.json', 'hardware.json') + #myModule.copy_file('data/hardwareLinux.json', 'hardware.json') + myModule.copy_file('data/hardwareNao.json', 'hardware.json') elif target.name=="MacOs": myModule.copy_file('data/hardwareMacOs.json', 'hardware.json') elif target.name=="IOs": diff --git a/river/io/NodeMuxer.cpp b/river/io/NodeMuxer.cpp index 253188b..e945159 100644 --- a/river/io/NodeMuxer.cpp +++ b/river/io/NodeMuxer.cpp @@ -198,6 +198,7 @@ void river::io::NodeMuxer::onDataReceivedInput1(const void* _data, if (_format != audio::format_int16) { RIVER_ERROR("call wrong type ... (need int16_t)"); } + RIVER_SAVE_FILE_MACRO(int16_t, "REC_input1.raw", _data, _nbChunk*_map.size()); // push data synchronize std11::unique_lock lock(m_mutex); m_bufferInput1.write(_data, _nbChunk, _time); @@ -216,6 +217,7 @@ void river::io::NodeMuxer::onDataReceivedInput2(const void* _data, if (_format != audio::format_int16) { RIVER_ERROR("call wrong type ... (need int16_t)"); } + RIVER_SAVE_FILE_MACRO(int16_t, "REC_input2.raw", _data, _nbChunk*_map.size()); // push data synchronize std11::unique_lock lock(m_mutex); m_bufferInput2.write(_data, _nbChunk, _time); @@ -480,4 +482,4 @@ void river::io::NodeMuxer::generateDot(etk::FSNode& _node) { } } _node << "\n"; -} \ No newline at end of file +} diff --git a/test/testEchoDelay.h b/test/testEchoDelay.h index e4443f9..24b888b 100644 --- a/test/testEchoDelay.h +++ b/test/testEchoDelay.h @@ -45,8 +45,6 @@ namespace river_test_echo_delay { m_gain(-40) { //Set stereo output: std::vector channelMap; - channelMap.push_back(audio::channel_frontLeft); - channelMap.push_back(audio::channel_frontRight); m_interfaceOut = m_manager->createOutput(48000, channelMap, audio::format_int16, diff --git a/test/testMuxer.h b/test/testMuxer.h index 9ce91ac..f79c7ca 100644 --- a/test/testMuxer.h +++ b/test/testMuxer.h @@ -41,7 +41,7 @@ namespace river_test_muxer { std11::placeholders::_5, std11::placeholders::_6)); m_interfaceOut->addVolumeGroup("FLOW"); - m_interfaceOut->setParameter("volume", "FLOW", "-6dB"); + // m_interfaceOut->setParameter("volume", "FLOW", "-6dB"); //Set stereo output: m_interfaceIn = m_manager->createInput(48000, @@ -71,7 +71,7 @@ namespace river_test_muxer { double baseCycle = 2.0*M_PI/(double)48000 * 440; for (int32_t iii=0; iii<_nbChunk; iii++) { for (int32_t jjj=0; jjj<_map.size(); jjj++) { - data[_map.size()*iii+jjj] = sin(m_phase) * 30000; + data[_map.size()*iii+jjj] = sin(m_phase) * 7000; } m_phase += baseCycle; if (m_phase >= 2*M_PI) { diff --git a/test/testRecordCallback.h b/test/testRecordCallback.h index d5de46a..ae8f525 100644 --- a/test/testRecordCallback.h +++ b/test/testRecordCallback.h @@ -7,6 +7,8 @@ #ifndef __RIVER_TEST_RECORD_CALLBACK_H__ #define __RIVER_TEST_RECORD_CALLBACK_H__ +#include + #undef __class__ #define __class__ "test_record_callback" @@ -20,8 +22,6 @@ namespace river_test_record_callback { m_manager(_manager) { //Set stereo output: std::vector channelMap; - channelMap.push_back(audio::channel_frontLeft); - channelMap.push_back(audio::channel_frontRight); m_interface = m_manager->createInput(48000, channelMap, audio::format_int16, @@ -46,6 +46,7 @@ namespace river_test_record_callback { if (_format != audio::format_int16) { APPL_ERROR("call wrong type ... (need int16_t)"); } + RIVER_SAVE_FILE_MACRO(int16_t, "REC_INPUT.raw", _data, _nbChunk * _map.size()); const int16_t* data = static_cast(_data); int64_t value = 0; for (size_t iii=0; iii<_nbChunk*_map.size(); ++iii) {