diff --git a/river/io/NodeAEC.cpp b/river/io/NodeAEC.cpp index a125eaf..3f3f52d 100644 --- a/river/io/NodeAEC.cpp +++ b/river/io/NodeAEC.cpp @@ -181,29 +181,21 @@ river::io::NodeAEC::NodeAEC(const std::string& _name, const std11::shared_ptrsetInputCallback(std11::bind(&river::io::NodeAEC::onDataReceivedFeedBack, this, -#if __cplusplus >= 201103L std11::placeholders::_1, std11::placeholders::_2, std11::placeholders::_3, std11::placeholders::_4, std11::placeholders::_5, std11::placeholders::_6)); -#else - _1, _2, _3, _4, _5, _6)); -#endif // set callback mode ... m_interfaceMicrophone->setInputCallback(std11::bind(&river::io::NodeAEC::onDataReceivedMicrophone, this, -#if __cplusplus >= 201103L std11::placeholders::_1, std11::placeholders::_2, std11::placeholders::_3, std11::placeholders::_4, std11::placeholders::_5, std11::placeholders::_6)); -#else - _1, _2, _3, _4, _5, _6)); -#endif m_bufferMicrophone.setCapacity(std11::chrono::milliseconds(1000), audio::getFormatBytes(hardwareFormat.getFormat())*hardwareFormat.getMap().size(), diff --git a/river/io/NodeAirTAudio.cpp b/river/io/NodeAirTAudio.cpp index be82d78..676e3fd 100644 --- a/river/io/NodeAirTAudio.cpp +++ b/river/io/NodeAirTAudio.cpp @@ -220,28 +220,20 @@ river::io::NodeAirTAudio::NodeAirTAudio(const std::string& _name, const std11::s hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, std11::bind(&river::io::NodeAirTAudio::recordCallback, this, - #if __cplusplus >= 201103L - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_5, - std::placeholders::_6) - #else - _1, _2, _5, _6) - #endif + std11::placeholders::_1, + std11::placeholders::_2, + std11::placeholders::_5, + std11::placeholders::_6) ); } else { err = m_adac.openStream(¶ms, nullptr, hardwareFormat.getFormat(), hardwareFormat.getFrequency(), &m_rtaudioFrameSize, std11::bind(&river::io::NodeAirTAudio::playbackCallback, this, - #if __cplusplus >= 201103L - std::placeholders::_3, - std::placeholders::_4, - std::placeholders::_5, - std::placeholders::_6) - #else - _3, _4, _5, _6) - #endif + std11::placeholders::_3, + std11::placeholders::_4, + std11::placeholders::_5, + std11::placeholders::_6) ); } if (err != airtaudio::error_none) { diff --git a/river/io/NodePortAudio.cpp b/river/io/NodePortAudio.cpp index ddc3f3f..b313611 100644 --- a/river/io/NodePortAudio.cpp +++ b/river/io/NodePortAudio.cpp @@ -4,7 +4,7 @@ * @license APACHE v2.0 (see license file) */ -#ifdef __PORTTAUDIO_INFERFACE__ +#ifdef __PORTAUDIO_INFERFACE__ #include #include @@ -30,7 +30,7 @@ static std::string asString(const std11::chrono::system_clock::time_point& tp) { namespace std { static std::ostream& operator <<(std::ostream& _os, const std11::chrono::system_clock::time_point& _obj) { - std11::chrono::microseconds us = std11::chrono::duration_cast(_obj.time_since_epoch()); + std11::chrono::microseconds us = std11::chrono::duration_cast(_obj.time_since_epoch()); _os << us.count(); return _os; } @@ -45,10 +45,10 @@ static int portAudioStreamCallback(const void *_input, river::io::NodePortAudio* myClass = reinterpret_cast(_userData); int64_t sec = int64_t(_timeInfo->inputBufferAdcTime); int64_t nsec = (_timeInfo->inputBufferAdcTime-double(sec))*1000000000LL; - std11::chrono::system_clock::time_point timeInput = std11::chrono::system_clock::from_time_t(sec) + std::chrono::nanoseconds(nsec); + std11::chrono::system_clock::time_point timeInput = std11::chrono::system_clock::from_time_t(sec) + std11::chrono::nanoseconds(nsec); sec = int64_t(_timeInfo->outputBufferDacTime); nsec = (_timeInfo->outputBufferDacTime-double(sec))*1000000000LL; - std11::chrono::system_clock::time_point timeOutput = std11::chrono::system_clock::from_time_t(sec) + std::chrono::nanoseconds(nsec); + std11::chrono::system_clock::time_point timeOutput = std11::chrono::system_clock::from_time_t(sec) + std11::chrono::nanoseconds(nsec); return myClass->duplexCallback(_input, timeInput, _output, diff --git a/river/io/NodePortAudio.h b/river/io/NodePortAudio.h index 56d550e..a29eb00 100644 --- a/river/io/NodePortAudio.h +++ b/river/io/NodePortAudio.h @@ -7,7 +7,7 @@ #ifndef __RIVER_IO_NODE_PORTAUDIO_H__ #define __RIVER_IO_NODE_PORTAUDIO_H__ -#ifdef __PORTTAUDIO_INFERFACE__ +#ifdef __PORTAUDIO_INFERFACE__ #include #include diff --git a/test/main.cpp b/test/main.cpp index 2c7b92f..737b5ae 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -12,9 +12,14 @@ #include #include -#include #include +#if __cplusplus >= 201103L + #include +#else + #include +#endif + #undef __class__ #define __class__ "test" @@ -78,13 +83,12 @@ TEST(TestALL, testOutputWrite) { manager = river::Manager::create("testApplication"); APPL_INFO("test output (write mode)"); - std11::shared_ptr process = std::make_shared(manager); + std11::shared_ptr process = std11::make_shared(manager); process->run(); process.reset(); usleep(500000); } - class testOutWriteCallback { private: std11::shared_ptr m_manager; @@ -104,13 +108,13 @@ class testOutWriteCallback { "speaker", "WriteMode+Callback"); m_interface->setReadwrite(); - m_interface->setWriteCallback(std::bind(&testOutWriteCallback::onDataNeeded, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3, - std::placeholders::_4, - std::placeholders::_5)); + m_interface->setWriteCallback(std11::bind(&testOutWriteCallback::onDataNeeded, + this, + std11::placeholders::_1, + std11::placeholders::_2, + std11::placeholders::_3, + std11::placeholders::_4, + std11::placeholders::_5)); } void onDataNeeded(const std11::chrono::system_clock::time_point& _time, size_t _nbChunk, @@ -147,7 +151,7 @@ TEST(TestALL, testOutputWriteWithCallback) { manager = river::Manager::create("testApplication"); APPL_INFO("test output (write with callback event mode)"); - std11::shared_ptr process = std::make_shared(manager); + std11::shared_ptr process = std11::make_shared(manager); process->run(); process.reset(); usleep(500000); @@ -173,14 +177,14 @@ class testOutCallback { _io, "WriteModeCallback"); // set callback mode ... - m_interface->setOutputCallback(std::bind(&testOutCallback::onDataNeeded, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3, - std::placeholders::_4, - std::placeholders::_5, - std::placeholders::_6)); + m_interface->setOutputCallback(std11::bind(&testOutCallback::onDataNeeded, + this, + std11::placeholders::_1, + std11::placeholders::_2, + std11::placeholders::_3, + std11::placeholders::_4, + std11::placeholders::_5, + std11::placeholders::_6)); } void onDataNeeded(void* _data, const std11::chrono::system_clock::time_point& _time, @@ -216,7 +220,7 @@ TEST(TestALL, testOutputCallBack) { manager = river::Manager::create("testApplication"); APPL_INFO("test output (callback mode)"); - std11::shared_ptr process = std::make_shared(manager, "speaker"); + std11::shared_ptr process = std11::make_shared(manager, "speaker"); process->run(); process.reset(); usleep(500000); @@ -227,7 +231,7 @@ TEST(TestALL, testOutputCallBackPulse) { manager = river::Manager::create("testApplication"); APPL_INFO("test output (callback mode)"); - std11::shared_ptr process = std::make_shared(manager, "speaker-pulse"); + std11::shared_ptr process = std11::make_shared(manager, "speaker-pulse"); process->run(); process.reset(); usleep(500000); @@ -238,7 +242,7 @@ TEST(TestALL, testOutputCallBackJack) { manager = river::Manager::create("testApplication"); APPL_INFO("test output (callback mode)"); - std11::shared_ptr process = std::make_shared(manager, "speaker-jack"); + std11::shared_ptr process = std11::make_shared(manager, "speaker-jack"); process->run(); process.reset(); usleep(500000); @@ -283,7 +287,7 @@ TEST(TestALL, testInputCallBack) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); APPL_INFO("test input (callback mode)"); - std11::shared_ptr process = std::make_shared(manager); + std11::shared_ptr process = std11::make_shared(manager); process->run(); process.reset(); usleep(500000); @@ -309,14 +313,14 @@ class testInCallback { _input, "WriteModeCallback"); // set callback mode ... - m_interface->setInputCallback(std::bind(&testInCallback::onDataReceived, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3, - std::placeholders::_4, - std::placeholders::_5, - std::placeholders::_6)); + m_interface->setInputCallback(std11::bind(&testInCallback::onDataReceived, + this, + std11::placeholders::_1, + std11::placeholders::_2, + std11::placeholders::_3, + std11::placeholders::_4, + std11::placeholders::_5, + std11::placeholders::_6)); } void onDataReceived(const void* _data, const std11::chrono::system_clock::time_point& _time, @@ -349,7 +353,7 @@ TEST(TestALL, testInputCallBack) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); APPL_INFO("test input (callback mode)"); - std11::shared_ptr process = std::make_shared(manager); + std11::shared_ptr process = std11::make_shared(manager); process->run(); process.reset(); usleep(500000); @@ -398,14 +402,14 @@ class testOutCallbackType { "speaker", "WriteModeCallbackType"); // set callback mode ... - m_interface->setOutputCallback(std::bind(&testOutCallbackType::onDataNeeded, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3, - std::placeholders::_4, - std::placeholders::_5, - std::placeholders::_6)); + m_interface->setOutputCallback(std11::bind(&testOutCallbackType::onDataNeeded, + this, + std11::placeholders::_1, + std11::placeholders::_2, + std11::placeholders::_3, + std11::placeholders::_4, + std11::placeholders::_5, + std11::placeholders::_6)); } void onDataNeeded(void* _data, const std11::chrono::system_clock::time_point& _time, @@ -479,7 +483,7 @@ class testResampling : public ::testing::TestWithParam {}; TEST_P(testResampling, base) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); - std11::shared_ptr process = std::make_shared(manager, GetParam(), 2, audio::format_int16); + std11::shared_ptr process = std11::make_shared(manager, GetParam(), 2, audio::format_int16); process->run(); process.reset(); usleep(500000); @@ -494,7 +498,7 @@ class testFormat : public ::testing::TestWithParam {}; TEST_P(testFormat, base) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); - std11::shared_ptr process = std::make_shared(manager, 48000, 2, GetParam()); + std11::shared_ptr process = std11::make_shared(manager, 48000, 2, GetParam()); process->run(); process.reset(); usleep(500000); @@ -508,7 +512,7 @@ class testChannels : public ::testing::TestWithParam {}; TEST_P(testChannels, base) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); - std11::shared_ptr process = std::make_shared(manager, 48000, GetParam(), audio::format_int16); + std11::shared_ptr process = std11::make_shared(manager, 48000, GetParam(), audio::format_int16); process->run(); process.reset(); usleep(500000); @@ -538,14 +542,14 @@ class testCallbackVolume { "speaker", "WriteModeCallback"); // set callback mode ... - m_interface->setOutputCallback(std::bind(&testCallbackVolume::onDataNeeded, - this, - std::placeholders::_1, - std::placeholders::_2, - std::placeholders::_3, - std::placeholders::_4, - std::placeholders::_5, - std::placeholders::_6)); + m_interface->setOutputCallback(std11::bind(&testCallbackVolume::onDataNeeded, + this, + std11::placeholders::_1, + std11::placeholders::_2, + std11::placeholders::_3, + std11::placeholders::_4, + std11::placeholders::_5, + std11::placeholders::_6)); m_interface->addVolumeGroup("MEDIA"); m_interface->addVolumeGroup("FLOW"); } @@ -610,7 +614,7 @@ class testCallbackVolume { void threadVolume(void* _userData) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); - std11::shared_ptr process = std::make_shared(manager); + std11::shared_ptr process = std11::make_shared(manager); process->run(); process.reset(); usleep(500000); @@ -623,7 +627,7 @@ TEST(TestALL, testInputCallBackMicClean) { usleep(100000); APPL_INFO("test input (callback mode)"); - std11::shared_ptr process = std::make_shared(manager, "microphone-clean"); + std11::shared_ptr process = std11::make_shared(manager, "microphone-clean"); process->run(); process.reset(); usleep(500000); @@ -634,7 +638,7 @@ TEST(TestALL, testInputCallBackMicClean) { TEST(TestALL, testVolume) { std11::shared_ptr manager; manager = river::Manager::create("testApplication"); - std11::shared_ptr process = std::make_shared(manager); + std11::shared_ptr process = std11::make_shared(manager); process->run(); process.reset(); usleep(500000); @@ -666,11 +670,11 @@ TEST(TestALL, testChannelsFormatResampling) { listFormat.push_back(audio::format_int16_on_int32); listFormat.push_back(audio::format_int32); listFormat.push_back(audio::format_float); - for (auto &itFreq : listFreq) { - for (auto &itChannel : listChannel) { - for (auto &itFormat : listFormat) { - APPL_INFO("freq=" << itFreq << " channel=" << itChannel << " format=" << getFormatString(itFormat)); - std11::shared_ptr process = std::make_shared(manager, itFreq, itChannel, itFormat); + for (size_t fff=0; fff