[DEV] remove dependency of unistd.h

This commit is contained in:
Edouard DUPIN 2016-10-13 21:29:18 +02:00
parent abc2ce6a49
commit a5ca43b7dd
11 changed files with 42 additions and 40 deletions

View File

@ -252,7 +252,7 @@ std::vector<int16_t> audio::river::Interface::read(size_t _nbChunk) {
int32_t nbChunkBuffer = m_circularBuffer.size() / m_map.size();
m_mutex.unlock();
while (nbChunkBuffer < _nbChunk) {
usleep(1000);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
nbChunkBuffer = m_circularBuffer.size() / m_map.size();
}
m_mutex.lock();

View File

@ -12,7 +12,8 @@
//! [audio_river_sample_include]
#include <etk/os/FSNode.hpp>
#include <etk/etk.hpp>
#include <unistd.h>
#include <thread>
//! [audio_river_sample_read_config_file]
@ -148,7 +149,7 @@ int main(int _argc, const char **_argv) {
// start the stream
interface->start();
// wait 10 second ...
sleep(10);
std::this_thread::sleep_for(std::chrono::seconds(10));
// stop the stream
interface->stop();
//! [audio_river_sample_read_start_stop]

View File

@ -10,7 +10,8 @@
#include <audio/river/Manager.hpp>
#include <audio/river/Interface.hpp>
#include <etk/etk.hpp>
#include <unistd.h>
#include <thread>
//! [audio_river_sample_write_config_file]
static const std::string configurationRiver =
@ -102,7 +103,7 @@ int main(int _argc, const char **_argv) {
// start the stream
interface->start();
// wait 10 second ...
sleep(10);
std::this_thread::sleep_for(std::chrono::seconds(10));
// stop the stream
interface->stop();
// remove interface and manager.

View File

@ -35,7 +35,7 @@
#include <etk/os/FSNode.hpp>
#include <cmath>
#include <sstream>
#include <unistd.h>
#include <thread>
#include "testAEC.hpp"
#include "testEchoDelay.hpp"

View File

@ -360,9 +360,9 @@ namespace river_test_echo_delay {
m_interfaceIn->start();
//m_interfaceFB->start();
while (m_estimateVolumeInput == true) {
usleep(10000);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
usleep(10000000);
std::this_thread::sleep_for(std::chrono::seconds(10));
//m_interfaceFB->stop();
m_interfaceIn->stop();
m_interfaceOut->stop();
@ -418,7 +418,7 @@ namespace river_test_echo_delay {
ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
};

View File

@ -136,9 +136,9 @@ namespace river_test_format {
}
m_interface->start();
// wait 2 second ...
usleep(1000000);
std::this_thread::sleep_for(std::chrono::seconds(1));
m_interface->stop();
usleep(100000);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
};
@ -151,7 +151,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, GetParam(), 2, audio::format_int16);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
@ -168,7 +168,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, 2, GetParam());
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
@ -184,7 +184,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, 48000, GetParam(), audio::format_int16);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
INSTANTIATE_TEST_CASE_P(InstantiationName,
@ -226,7 +226,7 @@ namespace river_test_format {
ememory::SharedPtr<testOutCallbackType> process = ememory::makeShared<testOutCallbackType>(manager, listFreq[fff], listChannel[ccc], listFormat[iii]);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
}
}
}

View File

@ -103,7 +103,7 @@ namespace river_test_muxer {
}
m_interfaceOut->start();
m_interfaceIn->start();
usleep(10000000);
std::this_thread::sleep_for(std::chrono::seconds(10));
m_interfaceIn->stop();
m_interfaceOut->stop();
}
@ -168,7 +168,7 @@ namespace river_test_muxer {
ememory::SharedPtr<TestClass> process = ememory::makeShared<TestClass>(manager);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
};

View File

@ -66,7 +66,7 @@ namespace river_test_playback_callback {
}
m_interface->start();
// wait 2 second ...
usleep(2000000);
std::this_thread::sleep_for(std::chrono::seconds(2));
m_interface->stop();
}
};
@ -97,7 +97,7 @@ namespace river_test_playback_callback {
ASSERT_NE(process, nullptr);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
@ -110,7 +110,7 @@ namespace river_test_playback_callback {
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-pulse");
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
@ -123,7 +123,7 @@ namespace river_test_playback_callback {
ememory::SharedPtr<testOutCallback> process = ememory::makeShared<testOutCallback>(manager, "speaker-jack");
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
};

View File

@ -78,7 +78,7 @@ namespace river_test_playback_write {
}
m_interface->write(&data[0], data.size()/m_channelMap.size());
// TODO : Add a function to get number of time we need to wait enought time ...
usleep(15000);
std::this_thread::sleep_for(std::chrono::milliseconds(15));
}
m_interface->stop();
}
@ -93,7 +93,7 @@ namespace river_test_playback_write {
ememory::SharedPtr<testOutWrite> process = ememory::makeShared<testOutWrite>(manager);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}
@ -156,7 +156,7 @@ namespace river_test_playback_write {
return;
}
m_interface->start();
usleep(1000000);
std::this_thread::sleep_for(std::chrono::seconds(1));
m_interface->stop();
}
};
@ -170,7 +170,7 @@ namespace river_test_playback_write {
ememory::SharedPtr<testOutWriteCallback> process = ememory::makeShared<testOutWriteCallback>(manager);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}

View File

@ -75,7 +75,7 @@ namespace river_test_record_callback {
}
m_interface->start();
// wait 2 second ...
usleep(20000000);
std::this_thread::sleep_for(std::chrono::seconds(20));
m_interface->stop();
}
};
@ -88,7 +88,7 @@ namespace river_test_record_callback {
ememory::SharedPtr<testInCallback> process = ememory::makeShared<testInCallback>(manager);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}

View File

@ -79,40 +79,40 @@ namespace river_test_volume {
return;
}
m_interface->start();
usleep(1000000);
std::this_thread::sleep_for(std::chrono::seconds(1));
m_interface->setParameter("volume", "FLOW", "-3dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "-6dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "-9dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "-12dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "-3dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "3dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "6dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "9dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_interface->setParameter("volume", "FLOW", "0dB");
TEST_INFO(" get volume : " << m_interface->getParameter("volume", "FLOW") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_manager->setVolume("MASTER", -3.0f);
TEST_INFO("get volume MASTER: " << m_manager->getVolume("MASTER") );
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
m_manager->setVolume("MEDIA", -3.0f);
TEST_INFO("get volume MEDIA: " << m_manager->getVolume("MEDIA") );
usleep(1000000);
std::this_thread::sleep_for(std::chrono::seconds(1));
m_interface->stop();
}
};
@ -124,7 +124,7 @@ namespace river_test_volume {
ememory::SharedPtr<testCallbackVolume> process = ememory::makeShared<testCallbackVolume>(manager);
process->run();
process.reset();
usleep(500000);
std::this_thread::sleep_for(std::chrono::milliseconds(500));
audio::river::unInit();
}