From 4bc3ff2f1a4dc90238ee9cb03a04f2b8666c94ca Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 14 Sep 2017 00:59:21 +0200 Subject: [PATCH] [DEV] continue removing STL --- audio/orchestra/api/Alsa.cpp | 20 +++++++++---------- .../orchestra/api/AndroidNativeInterface.cpp | 8 ++++---- audio/orchestra/api/Asio.cpp | 4 ++-- audio/orchestra/api/Core.cpp | 4 ++-- audio/orchestra/api/Jack.cpp | 2 +- audio/orchestra/api/Pulse.cpp | 2 +- audio/orchestra/base.hpp | 2 +- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/audio/orchestra/api/Alsa.cpp b/audio/orchestra/api/Alsa.cpp index 27a03e4..b341d45 100644 --- a/audio/orchestra/api/Alsa.cpp +++ b/audio/orchestra/api/Alsa.cpp @@ -875,7 +875,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::startStream() { ATA_ERROR("the stream is already running!"); return audio::orchestra::error_warning; } - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); int32_t result = 0; snd_pcm_state_t state; if (m_private->handle == nullptr) { @@ -909,7 +909,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::stopStream() { return audio::orchestra::error_warning; } m_state = audio::orchestra::state::stopped; - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); int32_t result = 0; if (m_mode == audio::orchestra::mode_output) { result = snd_pcm_drain(m_private->handle); @@ -936,7 +936,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::abortStream() { return audio::orchestra::error_warning; } m_state = audio::orchestra::state::stopped; - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); int32_t result = 0; result = snd_pcm_drop(m_private->handle); if (result < 0) { @@ -979,7 +979,7 @@ static int32_t wait_for_poll(snd_pcm_t* _handle, struct pollfd* _ufds, unsigned void audio::orchestra::api::Alsa::callbackEvent() { // Lock while the system is not started ... if (m_state == audio::orchestra::state::stopped) { - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); while (!m_private->runnable) { m_private->runnable_cv.wait(lck); } @@ -1121,7 +1121,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() { // !!! goto unlock; } - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); // Setup parameters. if (m_doConvertBuffer[1]) { buffer = m_deviceBuffer; @@ -1167,7 +1167,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() { } } else { ATA_ERROR("audio read error, " << snd_strerror(result) << "."); - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + ethread::sleepMilliSeconds((10)); } // TODO : Notify application ... audio::orchestra::error_warning; goto noInput; @@ -1258,7 +1258,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() { abortStream(); return; } - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); // Setup parameters and do buffer conversion if necessary. if (m_doConvertBuffer[0]) { buffer = m_deviceBuffer; @@ -1365,7 +1365,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() { return; } { - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); // Setup parameters and do buffer conversion if necessary. if (m_doConvertBuffer[0]) { buffer = m_deviceBuffer; @@ -1474,7 +1474,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() { goto unlock; } { - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); // Setup parameters. if (m_doConvertBuffer[1]) { buffer = m_deviceBuffer; @@ -1521,7 +1521,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() { } } else { ATA_ERROR("audio read error, " << snd_strerror(result) << "."); - std::this_thread::sleep_for(std::chrono::milliseconds(10)); + ethread::sleepMilliSeconds((10)); } // TODO : Notify application ... audio::orchestra::error_warning; goto noInput; diff --git a/audio/orchestra/api/AndroidNativeInterface.cpp b/audio/orchestra/api/AndroidNativeInterface.cpp index 7cc02e0..5e33c6c 100644 --- a/audio/orchestra/api/AndroidNativeInterface.cpp +++ b/audio/orchestra/api/AndroidNativeInterface.cpp @@ -461,7 +461,7 @@ extern "C" { void Java_org_musicdsp_orchestra_OrchestraNative_NNsetJavaManager(JNIEnv* _env, jclass _classBase, jobject _objCallback) { - std::unique_lock lock(jvm_basics::getMutexJavaVM()); + ethread::UniqueLock lock(jvm_basics::getMutexJavaVM()); ATA_INFO("*******************************************"); ATA_INFO("** Creating Orchestra context **"); ATA_INFO("*******************************************"); @@ -477,7 +477,7 @@ extern "C" { } void Java_org_musicdsp_orchestra_OrchestraNative_NNsetJavaManagerRemove(JNIEnv* _env, jclass _cls) { - std::unique_lock lock(jvm_basics::getMutexJavaVM()); + ethread::UniqueLock lock(jvm_basics::getMutexJavaVM()); ATA_INFO("*******************************************"); ATA_INFO("** remove Orchestra Pointer **"); ATA_INFO("*******************************************"); @@ -495,7 +495,7 @@ extern "C" { jint _id, jshortArray _location, jint _nbChunk) { - std::unique_lock lock(jvm_basics::getMutexJavaVM()); + ethread::UniqueLock lock(jvm_basics::getMutexJavaVM()); if (s_localContext == nullptr) { ATA_ERROR("Call audio with no more Low level interface"); return; @@ -518,7 +518,7 @@ extern "C" { jint _id, jshortArray _location, jint _nbChunk) { - std::unique_lock lock(jvm_basics::getMutexJavaVM()); + ethread::UniqueLock lock(jvm_basics::getMutexJavaVM()); if (s_localContext == nullptr) { ATA_ERROR("Call audio with no more Low level interface"); return; diff --git a/audio/orchestra/api/Asio.cpp b/audio/orchestra/api/Asio.cpp index 682bcb8..b000702 100644 --- a/audio/orchestra/api/Asio.cpp +++ b/audio/orchestra/api/Asio.cpp @@ -378,10 +378,10 @@ bool audio::orchestra::api::Asio::open(uint32_t _device, log2_of_max_size = i; } } - long min_delta = std::abs((long)*_bufferSize - ((long)1 << log2_of_min_size)); + long min_delta = etk::abs((long)*_bufferSize - ((long)1 << log2_of_min_size)); int32_t min_delta_num = log2_of_min_size; for (int32_t i = log2_of_min_size + 1; i <= log2_of_max_size; i++) { - long current_delta = std::abs((long)*_bufferSize - ((long)1 << i)); + long current_delta = etk::abs((long)*_bufferSize - ((long)1 << i)); if (current_delta < min_delta) { min_delta = current_delta; min_delta_num = i; diff --git a/audio/orchestra/api/Core.cpp b/audio/orchestra/api/Core.cpp index ea6b220..454be04 100644 --- a/audio/orchestra/api/Core.cpp +++ b/audio/orchestra/api/Core.cpp @@ -635,7 +635,7 @@ bool audio::orchestra::api::Core::open(uint32_t _device, if (microCounter > 5000000) { break; } - std::this_thread::sleep_for(std::chrono::milliseconds(5)); + ethread::sleepMilliSeconds((5)); } // Remove the property listener. AudioObjectRemovePropertyListener(id, &tmp, &rateListener, (void *) &reportedRate); @@ -967,7 +967,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::stopStream() { if ( m_mode == audio::orchestra::mode_output || m_mode == audio::orchestra::mode_duplex) { if (m_private->drainCounter == 0) { - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); m_private->drainCounter = 2; m_private->condition.wait(lck); } diff --git a/audio/orchestra/api/Jack.cpp b/audio/orchestra/api/Jack.cpp index 74bcc94..f2f112d 100644 --- a/audio/orchestra/api/Jack.cpp +++ b/audio/orchestra/api/Jack.cpp @@ -597,7 +597,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::stopStream() { || m_mode == audio::orchestra::mode_duplex) { if (m_private->drainCounter == 0) { m_private->drainCounter = 2; - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); m_private->condition.wait(lck); } } diff --git a/audio/orchestra/api/Pulse.cpp b/audio/orchestra/api/Pulse.cpp index e437ee1..18e84be 100644 --- a/audio/orchestra/api/Pulse.cpp +++ b/audio/orchestra/api/Pulse.cpp @@ -131,7 +131,7 @@ enum audio::orchestra::error audio::orchestra::api::Pulse::closeStream() { void audio::orchestra::api::Pulse::callbackEventOneCycle() { if (m_state == audio::orchestra::state::stopped) { - std::unique_lock lck(m_mutex); + ethread::UniqueLock lck(m_mutex); while (!m_private->runnable) { m_private->runnable_cv.wait(lck); } diff --git a/audio/orchestra/base.hpp b/audio/orchestra/base.hpp index e9791a4..ee9ec22 100644 --- a/audio/orchestra/base.hpp +++ b/audio/orchestra/base.hpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include