[DEBUG] build is back

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

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,