[DEV] WORK on a port for BOOST

This commit is contained in:
2015-02-24 22:20:11 +01:00
parent 62cb1ef639
commit 0b50032cab
17 changed files with 436 additions and 381 deletions

View File

@@ -21,10 +21,10 @@
class testOutWrite {
private:
std::vector<audio::channel> m_channelMap;
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
public:
testOutWrite(std::shared_ptr<river::Manager> _manager) :
testOutWrite(std11::shared_ptr<river::Manager> _manager) :
m_manager(_manager) {
//Set stereo output:
m_channelMap.push_back(audio::channel_frontLeft);
@@ -74,11 +74,11 @@ class testOutWrite {
};
TEST(TestALL, testOutputWrite) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test output (write mode)");
std::shared_ptr<testOutWrite> process = std::make_shared<testOutWrite>(manager);
std11::shared_ptr<testOutWrite> process = std::make_shared<testOutWrite>(manager);
process->run();
process.reset();
usleep(500000);
@@ -87,11 +87,11 @@ TEST(TestALL, testOutputWrite) {
class testOutWriteCallback {
private:
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
double m_phase;
public:
testOutWriteCallback(std::shared_ptr<river::Manager> _manager) :
testOutWriteCallback(std11::shared_ptr<river::Manager> _manager) :
m_manager(_manager),
m_phase(0) {
std::vector<audio::channel> channelMap;
@@ -112,7 +112,7 @@ class testOutWriteCallback {
std::placeholders::_4,
std::placeholders::_5));
}
void onDataNeeded(const std::chrono::system_clock::time_point& _time,
void onDataNeeded(const std11::chrono::system_clock::time_point& _time,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
@@ -143,11 +143,11 @@ class testOutWriteCallback {
};
TEST(TestALL, testOutputWriteWithCallback) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test output (write with callback event mode)");
std::shared_ptr<testOutWriteCallback> process = std::make_shared<testOutWriteCallback>(manager);
std11::shared_ptr<testOutWriteCallback> process = std::make_shared<testOutWriteCallback>(manager);
process->run();
process.reset();
usleep(500000);
@@ -156,11 +156,11 @@ TEST(TestALL, testOutputWriteWithCallback) {
class testOutCallback {
private:
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
double m_phase;
public:
testOutCallback(std::shared_ptr<river::Manager> _manager, const std::string& _io="speaker") :
testOutCallback(std11::shared_ptr<river::Manager> _manager, const std::string& _io="speaker") :
m_manager(_manager),
m_phase(0) {
//Set stereo output:
@@ -183,7 +183,7 @@ class testOutCallback {
std::placeholders::_6));
}
void onDataNeeded(void* _data,
const std::chrono::system_clock::time_point& _time,
const std11::chrono::system_clock::time_point& _time,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
@@ -212,33 +212,33 @@ class testOutCallback {
};
TEST(TestALL, testOutputCallBack) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker");
std11::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker");
process->run();
process.reset();
usleep(500000);
}
TEST(TestALL, testOutputCallBackPulse) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-pulse");
std11::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-pulse");
process->run();
process.reset();
usleep(500000);
}
TEST(TestALL, testOutputCallBackJack) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test output (callback mode)");
std::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-jack");
std11::shared_ptr<testOutCallback> process = std::make_shared<testOutCallback>(manager, "speaker-jack");
process->run();
process.reset();
usleep(500000);
@@ -248,10 +248,10 @@ TEST(TestALL, testOutputCallBackJack) {
class testInRead {
private:
std::vector<audio::channel> m_channelMap;
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
public:
testInRead(std::shared_ptr<river::Manager> _manager) :
testInRead(std11::shared_ptr<river::Manager> _manager) :
m_manager(_manager){
//Set stereo output:
m_channelMap.push_back(audio::channel_frontLeft);
@@ -280,10 +280,10 @@ class testInRead {
};
TEST(TestALL, testInputCallBack) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test input (callback mode)");
std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
std11::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
process->run();
process.reset();
usleep(500000);
@@ -292,11 +292,11 @@ TEST(TestALL, testInputCallBack) {
class testInCallback {
private:
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
double m_phase;
public:
testInCallback(std::shared_ptr<river::Manager> _manager, const std::string& _input="microphone") :
testInCallback(std11::shared_ptr<river::Manager> _manager, const std::string& _input="microphone") :
m_manager(_manager),
m_phase(0) {
//Set stereo output:
@@ -319,7 +319,7 @@ class testInCallback {
std::placeholders::_6));
}
void onDataReceived(const void* _data,
const std::chrono::system_clock::time_point& _time,
const std11::chrono::system_clock::time_point& _time,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
@@ -346,10 +346,10 @@ class testInCallback {
};
TEST(TestALL, testInputCallBack) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test input (callback mode)");
std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
std11::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager);
process->run();
process.reset();
usleep(500000);
@@ -359,15 +359,15 @@ TEST(TestALL, testInputCallBack) {
class testOutCallbackType {
private:
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
double m_phase;
float m_freq;
int32_t m_nbChannels;
float m_generateFreq;
public:
testOutCallbackType(const std::shared_ptr<river::Manager>& _manager,
testOutCallbackType(const std11::shared_ptr<river::Manager>& _manager,
float _freq=48000.0f,
int32_t _nbChannels=2,
audio::format _format=audio::format_int16) :
@@ -408,7 +408,7 @@ class testOutCallbackType {
std::placeholders::_6));
}
void onDataNeeded(void* _data,
const std::chrono::system_clock::time_point& _time,
const std11::chrono::system_clock::time_point& _time,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
@@ -477,9 +477,9 @@ class testOutCallbackType {
class testResampling : public ::testing::TestWithParam<float> {};
TEST_P(testResampling, base) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
std11::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run();
process.reset();
usleep(500000);
@@ -492,9 +492,9 @@ INSTANTIATE_TEST_CASE_P(InstantiationName,
class testFormat : public ::testing::TestWithParam<audio::format> {};
TEST_P(testFormat, base) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, 2, GetParam());
std11::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run();
process.reset();
usleep(500000);
@@ -506,9 +506,9 @@ INSTANTIATE_TEST_CASE_P(InstantiationName,
class testChannels : public ::testing::TestWithParam<int32_t> {};
TEST_P(testChannels, base) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
std11::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run();
process.reset();
usleep(500000);
@@ -521,11 +521,11 @@ INSTANTIATE_TEST_CASE_P(InstantiationName,
class testCallbackVolume {
private:
std::shared_ptr<river::Manager> m_manager;
std::shared_ptr<river::Interface> m_interface;
std11::shared_ptr<river::Manager> m_manager;
std11::shared_ptr<river::Interface> m_interface;
double m_phase;
public:
testCallbackVolume(std::shared_ptr<river::Manager> _manager) :
testCallbackVolume(std11::shared_ptr<river::Manager> _manager) :
m_manager(_manager),
m_phase(0) {
//Set stereo output:
@@ -550,7 +550,7 @@ class testCallbackVolume {
m_interface->addVolumeGroup("FLOW");
}
void onDataNeeded(void* _data,
const std::chrono::system_clock::time_point& _time,
const std11::chrono::system_clock::time_point& _time,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
@@ -608,22 +608,22 @@ class testCallbackVolume {
};
void threadVolume(void* _userData) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
std11::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
process->run();
process.reset();
usleep(500000);
}
TEST(TestALL, testInputCallBackMicClean) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std::thread tmpThread(&threadVolume, nullptr);
std11::thread tmpThread(&threadVolume, nullptr);
usleep(100000);
APPL_INFO("test input (callback mode)");
std::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager, "microphone-clean");
std11::shared_ptr<testInCallback> process = std::make_shared<testInCallback>(manager, "microphone-clean");
process->run();
process.reset();
usleep(500000);
@@ -632,16 +632,16 @@ TEST(TestALL, testInputCallBackMicClean) {
TEST(TestALL, testVolume) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
std::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
std11::shared_ptr<testCallbackVolume> process = std::make_shared<testCallbackVolume>(manager);
process->run();
process.reset();
usleep(500000);
}
TEST(TestALL, testChannelsFormatResampling) {
std::shared_ptr<river::Manager> manager;
std11::shared_ptr<river::Manager> manager;
manager = river::Manager::create("testApplication");
APPL_INFO("test convert flaot to output (callback mode)");
std::vector<float> listFreq;
@@ -670,7 +670,7 @@ TEST(TestALL, testChannelsFormatResampling) {
for (auto &itChannel : listChannel) {
for (auto &itFormat : listFormat) {
APPL_INFO("freq=" << itFreq << " channel=" << itChannel << " format=" << getFormatString(itFormat));
std::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, itFreq, itChannel, itFormat);
std11::shared_ptr<testOutCallbackType> process = std::make_shared<testOutCallbackType>(manager, itFreq, itChannel, itFormat);
process->run();
process.reset();
usleep(500000);