[DEBUG] build is back

This commit is contained in:
Edouard DUPIN 2017-11-07 13:38:04 +01:00
parent be4f6217d0
commit 9a21d57c1f
21 changed files with 221 additions and 126 deletions

View File

@ -96,7 +96,7 @@ ememory::SharedPtr<audio::river::Interface> audio::river::Interface::create(floa
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>(ETK_NEW(audio::river::Interface()));
ememory::SharedPtr<audio::river::Interface> out = ememory::SharedPtr<audio::river::Interface>(ETK_NEW(audio::river::Interface));
out->init(_freq, _map, _format, _node, _config);
return out;
}

View File

@ -26,7 +26,7 @@ ememory::SharedPtr<audio::river::Manager> audio::river::Manager::create(const et
}
}
// create a new one:
ememory::SharedPtr<audio::river::Manager> out = ememory::SharedPtr<audio::river::Manager>(ETK_NEW(audio::river::Manager(_applicationUniqueId)));
ememory::SharedPtr<audio::river::Manager> out = ememory::SharedPtr<audio::river::Manager>(ETK_NEW(audio::river::Manager, _applicationUniqueId));
// add it at the list:
for (size_t iii=0; iii<g_listOfAllManager.size() ; ++iii) {
if (g_listOfAllManager[iii].expired() == true) {

View File

@ -26,7 +26,16 @@ def get_maintainer():
def configure(target, my_module):
my_module.add_src_file([
'test/main.cpp'
'test/main.cpp',
'test/testAEC.cpp',
'test/testEchoDelay.cpp',
'test/testFormat.cpp',
'test/testMuxer.cpp',
'test/testPlaybackCallback.cpp',
'test/testPlaybackWrite.cpp',
'test/testRecordCallback.cpp',
'test/testRecordRead.cpp',
'test/testVolume.cpp',
])
my_module.add_depend([
'audio-river',

View File

@ -35,7 +35,7 @@ static const etk::String configurationRiver =
class MainApplication : public ewol::context::Application {
public:
bool init(ewol::Context& _context, size_t _initId) {
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
APPL_INFO("==> Init APPL (START) [" << gale::getBoardType() << "] (" << gale::getCompilationMode() << ")");
audio::river::initString(configurationRiver);

View File

@ -30,6 +30,7 @@ def configure(target, my_module):
])
my_module.add_depend([
'audio-river',
'test-debug',
'etk'
])
return True

View File

@ -13,6 +13,8 @@
#include <etk/os/FSNode.hpp>
#include <etk/etk.hpp>
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include <test-debug/debug.hpp>
@ -89,7 +91,7 @@ int main(int _argc, const char **_argv) {
etk::String data = _argv[iii];
if ( data == "-h"
|| data == "--help") {
TEST_PRINT("Help : ")
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");
@ -136,7 +138,7 @@ int main(int _argc, const char **_argv) {
}
//! [audio_river_sample_set_callback]
// set callback mode ...
interface->setInputCallback([=](const void* _data,
interface->setInputCallback([&](const void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,

View File

@ -30,6 +30,7 @@ def configure(target, my_module):
])
my_module.add_depend([
'audio-river',
'test-debug',
'etk'
])
return True

View File

@ -11,6 +11,8 @@
#include <audio/river/Interface.hpp>
#include <etk/etk.hpp>
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include <test-debug/debug.hpp>
//! [audio_river_sample_write_config_file]
@ -92,7 +94,7 @@ int main(int _argc, const char **_argv) {
//! [audio_river_sample_create_write_interface]
//! [audio_river_sample_set_callback]
// set callback mode ...
interface->setOutputCallback([=](const void* _data,
interface->setOutputCallback([=](void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,

View File

@ -38,21 +38,9 @@ extern "C" {
}
#include <ethread/Thread.hpp>
#include "testAEC.hpp"
#include "testEchoDelay.hpp"
#include "testFormat.hpp"
#include "testMuxer.hpp"
#include "testPlaybackCallback.hpp"
#include "testPlaybackWrite.hpp"
#include "testRecordCallback.hpp"
#include "testRecordRead.hpp"
#include "testVolume.hpp"
int main(int _argc, const char** _argv) {
// init Google test :
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
// the only one init for etk:
etk::init(_argc, _argv);
etest::init(_argc, _argv);
for (int32_t iii=0; iii<_argc ; ++iii) {
etk::String data = _argv[iii];
if ( data == "-h"

View File

@ -3,9 +3,21 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
#include "main.hpp"
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
namespace river_test_aec {

View File

@ -3,9 +3,21 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_echo_delay {
class TestClass {
@ -49,7 +61,7 @@ namespace river_test_echo_delay {
return;
}
// set callback mode ...
m_interfaceOut->setOutputCallback([=](const void* _data,
m_interfaceOut->setOutputCallback([=](void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,
@ -127,7 +139,7 @@ namespace river_test_echo_delay {
}
if (m_nextTick == audio::Time()) {
m_nextTick = _time + m_delayBetweenEvent;
m_nextSampleCount = m_delayBetweenEvent.count()*int64_t(_frequency)/1000;
m_nextSampleCount = m_delayBetweenEvent.get()*int64_t(_frequency)/1000;
m_phase = -1;
}
//TEST_INFO("sample : " << m_nextSampleCount);
@ -136,7 +148,7 @@ namespace river_test_echo_delay {
m_nextSampleCount--;
} else {
m_phase = 0;
m_nextSampleCount = m_delayBetweenEvent.count()*int64_t(_frequency)/1000;
m_nextSampleCount = m_delayBetweenEvent.get()*int64_t(_frequency)/1000;
m_currentTick = m_nextTick;
m_nextTick += m_delayBetweenEvent;
}
@ -216,7 +228,7 @@ namespace river_test_echo_delay {
TEST_VERBOSE("FB: 1 position -1: " << iii-1 << " " << data[(iii-1)*_map.size() + jjj]);
TEST_VERBOSE("FB: 1 position 0: " << iii << " " << data[iii*_map.size() + jjj]);
TEST_WARNING("FB: 1 time detected: " << time << " delay = " << float((time-m_currentTick).count())/1000.0f << "µs");
TEST_WARNING("FB: 1 time detected: " << time << " delay = " << float((time-m_currentTick).get())/1000.0f << "µs");
}
} else if (m_stateFB == 2) {
// inverse phase
@ -226,7 +238,7 @@ namespace river_test_echo_delay {
audio::Time time = getInterpolateTime(_time, iii-1, data[(iii-1)*_map.size() + jjj], data[iii*_map.size() + jjj], _frequency);
TEST_VERBOSE("FB: 2 position -1: " << iii-1 << " " << data[(iii-1)*_map.size() + jjj]);
TEST_VERBOSE("FB: 2 position 0: " << iii << " " << data[iii*_map.size() + jjj]);
TEST_WARNING("FB: 2 time detected: " << time << " delay = " << float((time-m_currentTick).count())/1000.0f << "µs");
TEST_WARNING("FB: 2 time detected: " << time << " delay = " << float((time-m_currentTick).get())/1000.0f << "µs");
}
} else if (m_stateFB == 3) {
// TODO : Detect the pic ...
@ -318,9 +330,9 @@ namespace river_test_echo_delay {
TEST_VERBOSE("MIC: 1 position -1: " << iii-1 << " " << data[(iii-1)*_map.size() + jjj]);
TEST_VERBOSE("MIC: 1 position 0: " << iii << " " << data[iii*_map.size() + jjj]);
audio::Duration delay = time-m_currentTick;
int32_t sampleDalay = (delay.count()*_frequency)/1000000000LL;
TEST_WARNING("MIC: 1 time detected: " << time << " delay = " << float(delay.count())/1000.0f << "µs samples=" << sampleDalay);
m_delayListMic.pushBack(delay.count());
int32_t sampleDalay = (delay.get()*_frequency)/1000000000LL;
TEST_WARNING("MIC: 1 time detected: " << time << " delay = " << float(delay.get())/1000.0f << "µs samples=" << sampleDalay);
m_delayListMic.pushBack(delay.get());
}
} else if (m_stateMic == 2) {
// inverse phase
@ -331,9 +343,9 @@ namespace river_test_echo_delay {
TEST_VERBOSE("MIC: 2 position -1: " << iii-1 << " " << data[(iii-1)*_map.size() + jjj]);
TEST_VERBOSE("MIC: 2 position 0: " << iii << " " << data[iii*_map.size() + jjj]);
audio::Duration delay = time-m_currentTick;
int32_t sampleDalay = (delay.count()*_frequency)/1000000000LL;
TEST_WARNING("MIC: 2 time detected: " << time << " delay = " << float(delay.count())/1000.0f << "µs samples=" << sampleDalay);
m_delayListMic.pushBack(delay.count());
int32_t sampleDalay = (delay.get()*_frequency)/1000000000LL;
TEST_WARNING("MIC: 2 time detected: " << time << " delay = " << float(delay.get())/1000.0f << "µs samples=" << sampleDalay);
m_delayListMic.pushBack(delay.get());
}
} else if (m_stateMic == 3) {
// TODO : Detect the pic ...

View File

@ -3,7 +3,21 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_format {
static const etk::String configurationRiver =
@ -66,7 +80,7 @@ namespace river_test_format {
return;
}
// set callback mode ...
m_interface->setOutputCallback([=](const void* _data,
m_interface->setOutputCallback([=](void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,
@ -141,89 +155,59 @@ namespace river_test_format {
ethread::sleepMilliSeconds((100));
}
};
etk::Vector<float> listFreq = {4000, 8000, 16000, 32000, 48000, 48001, 64000, 96000, 11250, 2250, 44100, 88200};
etk::Vector<int32_t> listChannel = {1, 2, 4};
etk::Vector<audio::format> listFormat = {audio::format_int16, audio::format_int16_on_int32, audio::format_int32, audio::format_float};
class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) {
TEST(testResampling, base) {
audio::river::initString(configurationRiver);
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
for (auto itFrequency: listFreq) {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, itFrequency, 2, audio::format_int16);
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
}
audio::river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
testResampling,
::testing::Values(4000, 8000, 16000, 32000, 48000, 48001, 64000, 96000, 11250, 2250, 44100, 88200));
class testFormat : public ::testing::TestWithParam<audio::format> {};
TEST_P(testFormat, base) {
TEST(testFormat, base) {
audio::river::initString(configurationRiver);
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
for (auto itFormat: listFormat) {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, 2, itFormat);
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
}
audio::river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
testFormat,
::testing::Values(audio::format_int16, audio::format_int16_on_int32, audio::format_int32, audio::format_float));
class testChannels : public ::testing::TestWithParam<int32_t> {};
TEST_P(testChannels, base) {
TEST(testChannels, base) {
audio::river::initString(configurationRiver);
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
for (auto itChannel: listChannel) {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, itChannel, audio::format_int16);
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
}
audio::river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
testChannels,
::testing::Values(1,2,4));
TEST(TestALL, testChannelsFormatResampling) {
audio::river::initString(configurationRiver);
ememory::SharedPtr<audio::river::Manager> manager;
manager = audio::river::Manager::create("testApplication");
TEST_INFO("test convert flaot to output (callback mode)");
etk::Vector<float> listFreq;
listFreq.pushBack(4000);
listFreq.pushBack(8000);
listFreq.pushBack(16000);
listFreq.pushBack(32000);
listFreq.pushBack(48000);
listFreq.pushBack(48001);
listFreq.pushBack(64000);
listFreq.pushBack(96000);
listFreq.pushBack(11250);
listFreq.pushBack(2250);
listFreq.pushBack(44100);
listFreq.pushBack(88200);
etk::Vector<int32_t> listChannel;
listChannel.pushBack(1);
listChannel.pushBack(2);
listChannel.pushBack(4);
etk::Vector<audio::format> listFormat;
listFormat.pushBack(audio::format_int16);
listFormat.pushBack(audio::format_int16_on_int32);
listFormat.pushBack(audio::format_int32);
listFormat.pushBack(audio::format_float);
for (size_t fff=0; fff<listFreq.size(); ++fff) {
for (size_t ccc=0; ccc<listChannel.size(); ++ccc) {
for (size_t iii=0; iii<listFormat.size(); ++iii) {
TEST_INFO("freq=" << listFreq[fff] << " channel=" << listChannel[ccc] << " format=" << getFormatString(listFormat[iii]));
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]);
for (auto itFrequency: listFreq) {
for (auto itChannel: listChannel) {
for (auto itFormat: listFormat) {
TEST_INFO("freq=" << itFrequency << " channel=" << listChannel << " format=" << audio::getFormatString(itFormat));
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, itFrequency, itChannel, itFormat);
process->run();
process.reset();
ethread::sleepMilliSeconds((500));
@ -232,6 +216,6 @@ namespace river_test_format {
}
audio::river::unInit();
}
};
}

View File

@ -3,9 +3,20 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_muxer {
class TestClass {
@ -30,7 +41,7 @@ namespace river_test_muxer {
return;
}
// set callback mode ...
m_interfaceOut->setOutputCallback([=](const void* _data,
m_interfaceOut->setOutputCallback([=](void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,

View File

@ -3,7 +3,21 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_playback_callback {
@ -29,14 +43,14 @@ namespace river_test_playback_callback {
return;
}
// set callback mode ...
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->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);
});
}
void onDataNeeded(void* _data,
const audio::Time& _time,

View File

@ -3,7 +3,21 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_playback_write {
static const etk::String configurationRiver =

View File

@ -3,9 +3,20 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_record_callback {
static const etk::String configurationRiver =

24
test/testRecordRead.cpp Normal file
View File

@ -0,0 +1,24 @@
/** @file
* @author Edouard DUPIN
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include "main.hpp"
namespace river_test_record_read {
};

View File

@ -1,11 +0,0 @@
/** @file
* @author Edouard DUPIN
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
namespace river_test_record_read {
};

View File

@ -3,7 +3,21 @@
* @copyright 2015, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
#pragma once
#include <test-debug/debug.hpp>
#include <audio/river/river.hpp>
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etest/etest.hpp>
#include <etk/etk.hpp>
#include <etk/os/FSNode.hpp>
extern "C" {
#include <math.h>
}
#include <ethread/Thread.hpp>
#include <ethread/tools.hpp>
#include "main.hpp"
namespace river_test_volume {
static const etk::String configurationRiver =
@ -44,7 +58,7 @@ namespace river_test_volume {
return;
}
// set callback mode ...
m_interface->setOutputCallback([=](const void* _data,
m_interface->setOutputCallback([=](void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,

View File

@ -7,6 +7,7 @@
#include <audio/river/widget/debug.hpp>
#include <audio/river/widget/TemporalViewer.hpp>
#include <etk/tool.hpp>
#include <ewol/object/Manager.hpp>
static const int32_t nbSecond = 3;
@ -70,7 +71,7 @@ void audio::river::widget::TemporalViewer::recordToggle() {
return;
}
// set callback mode ...
m_interface->setInputCallback([=](const void* _data,
m_interface->setInputCallback([&](const void* _data,
const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,
@ -80,11 +81,11 @@ void audio::river::widget::TemporalViewer::recordToggle() {
});
// start the stream
m_interface->start();
periodicCallEnable();
m_PCH = getObjectManager().periodicCall.connect(this, &audio::river::widget::TemporalViewer::periodicCall);
} else {
m_interface->stop();
m_interface.reset();
periodicCallDisable();
m_PCH.disconnect();
}
}

View File

@ -41,6 +41,12 @@ namespace audio {
public: // herited function
virtual void onDraw();
virtual void onRegenerateDisplay();
protected:
esignal::Connection m_PCH; //!< Periodic Call Handle to remove it when needed
/**
* @brief Periodic call to update grapgic display
* @param[in] _event Time generic event
*/
virtual void periodicCall(const ewol::event::Time& _event);
private:
ememory::SharedPtr<audio::river::Manager> m_manager;