[DEV] continue removing STL

This commit is contained in:
Edouard DUPIN 2017-09-14 00:59:21 +02:00
parent dfc867db87
commit 4bc3ff2f1a
7 changed files with 21 additions and 21 deletions

View File

@ -875,7 +875,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::startStream() {
ATA_ERROR("the stream is already running!"); ATA_ERROR("the stream is already running!");
return audio::orchestra::error_warning; return audio::orchestra::error_warning;
} }
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
int32_t result = 0; int32_t result = 0;
snd_pcm_state_t state; snd_pcm_state_t state;
if (m_private->handle == nullptr) { if (m_private->handle == nullptr) {
@ -909,7 +909,7 @@ enum audio::orchestra::error audio::orchestra::api::Alsa::stopStream() {
return audio::orchestra::error_warning; return audio::orchestra::error_warning;
} }
m_state = audio::orchestra::state::stopped; m_state = audio::orchestra::state::stopped;
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
int32_t result = 0; int32_t result = 0;
if (m_mode == audio::orchestra::mode_output) { if (m_mode == audio::orchestra::mode_output) {
result = snd_pcm_drain(m_private->handle); 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; return audio::orchestra::error_warning;
} }
m_state = audio::orchestra::state::stopped; m_state = audio::orchestra::state::stopped;
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
int32_t result = 0; int32_t result = 0;
result = snd_pcm_drop(m_private->handle); result = snd_pcm_drop(m_private->handle);
if (result < 0) { 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() { void audio::orchestra::api::Alsa::callbackEvent() {
// Lock while the system is not started ... // Lock while the system is not started ...
if (m_state == audio::orchestra::state::stopped) { if (m_state == audio::orchestra::state::stopped) {
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
while (!m_private->runnable) { while (!m_private->runnable) {
m_private->runnable_cv.wait(lck); m_private->runnable_cv.wait(lck);
} }
@ -1121,7 +1121,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
// !!! goto unlock; // !!! goto unlock;
} }
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
// Setup parameters. // Setup parameters.
if (m_doConvertBuffer[1]) { if (m_doConvertBuffer[1]) {
buffer = m_deviceBuffer; buffer = m_deviceBuffer;
@ -1167,7 +1167,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
} }
} else { } else {
ATA_ERROR("audio read error, " << snd_strerror(result) << "."); 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; // TODO : Notify application ... audio::orchestra::error_warning;
goto noInput; goto noInput;
@ -1258,7 +1258,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
abortStream(); abortStream();
return; return;
} }
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
// Setup parameters and do buffer conversion if necessary. // Setup parameters and do buffer conversion if necessary.
if (m_doConvertBuffer[0]) { if (m_doConvertBuffer[0]) {
buffer = m_deviceBuffer; buffer = m_deviceBuffer;
@ -1365,7 +1365,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
return; return;
} }
{ {
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
// Setup parameters and do buffer conversion if necessary. // Setup parameters and do buffer conversion if necessary.
if (m_doConvertBuffer[0]) { if (m_doConvertBuffer[0]) {
buffer = m_deviceBuffer; buffer = m_deviceBuffer;
@ -1474,7 +1474,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
goto unlock; goto unlock;
} }
{ {
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
// Setup parameters. // Setup parameters.
if (m_doConvertBuffer[1]) { if (m_doConvertBuffer[1]) {
buffer = m_deviceBuffer; buffer = m_deviceBuffer;
@ -1521,7 +1521,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
} }
} else { } else {
ATA_ERROR("audio read error, " << snd_strerror(result) << "."); 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; // TODO : Notify application ... audio::orchestra::error_warning;
goto noInput; goto noInput;

View File

@ -461,7 +461,7 @@ extern "C" {
void Java_org_musicdsp_orchestra_OrchestraNative_NNsetJavaManager(JNIEnv* _env, void Java_org_musicdsp_orchestra_OrchestraNative_NNsetJavaManager(JNIEnv* _env,
jclass _classBase, jclass _classBase,
jobject _objCallback) { jobject _objCallback) {
std::unique_lock<ethread::Mutex> lock(jvm_basics::getMutexJavaVM()); ethread::UniqueLock lock(jvm_basics::getMutexJavaVM());
ATA_INFO("*******************************************"); ATA_INFO("*******************************************");
ATA_INFO("** Creating Orchestra context **"); ATA_INFO("** Creating Orchestra context **");
ATA_INFO("*******************************************"); ATA_INFO("*******************************************");
@ -477,7 +477,7 @@ extern "C" {
} }
void Java_org_musicdsp_orchestra_OrchestraNative_NNsetJavaManagerRemove(JNIEnv* _env, jclass _cls) { void Java_org_musicdsp_orchestra_OrchestraNative_NNsetJavaManagerRemove(JNIEnv* _env, jclass _cls) {
std::unique_lock<ethread::Mutex> lock(jvm_basics::getMutexJavaVM()); ethread::UniqueLock lock(jvm_basics::getMutexJavaVM());
ATA_INFO("*******************************************"); ATA_INFO("*******************************************");
ATA_INFO("** remove Orchestra Pointer **"); ATA_INFO("** remove Orchestra Pointer **");
ATA_INFO("*******************************************"); ATA_INFO("*******************************************");
@ -495,7 +495,7 @@ extern "C" {
jint _id, jint _id,
jshortArray _location, jshortArray _location,
jint _nbChunk) { jint _nbChunk) {
std::unique_lock<ethread::Mutex> lock(jvm_basics::getMutexJavaVM()); ethread::UniqueLock lock(jvm_basics::getMutexJavaVM());
if (s_localContext == nullptr) { if (s_localContext == nullptr) {
ATA_ERROR("Call audio with no more Low level interface"); ATA_ERROR("Call audio with no more Low level interface");
return; return;
@ -518,7 +518,7 @@ extern "C" {
jint _id, jint _id,
jshortArray _location, jshortArray _location,
jint _nbChunk) { jint _nbChunk) {
std::unique_lock<ethread::Mutex> lock(jvm_basics::getMutexJavaVM()); ethread::UniqueLock lock(jvm_basics::getMutexJavaVM());
if (s_localContext == nullptr) { if (s_localContext == nullptr) {
ATA_ERROR("Call audio with no more Low level interface"); ATA_ERROR("Call audio with no more Low level interface");
return; return;

View File

@ -378,10 +378,10 @@ bool audio::orchestra::api::Asio::open(uint32_t _device,
log2_of_max_size = i; 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; int32_t min_delta_num = log2_of_min_size;
for (int32_t i = log2_of_min_size + 1; i <= log2_of_max_size; i++) { 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) { if (current_delta < min_delta) {
min_delta = current_delta; min_delta = current_delta;
min_delta_num = i; min_delta_num = i;

View File

@ -635,7 +635,7 @@ bool audio::orchestra::api::Core::open(uint32_t _device,
if (microCounter > 5000000) { if (microCounter > 5000000) {
break; break;
} }
std::this_thread::sleep_for(std::chrono::milliseconds(5)); ethread::sleepMilliSeconds((5));
} }
// Remove the property listener. // Remove the property listener.
AudioObjectRemovePropertyListener(id, &tmp, &rateListener, (void *) &reportedRate); 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 if ( m_mode == audio::orchestra::mode_output
|| m_mode == audio::orchestra::mode_duplex) { || m_mode == audio::orchestra::mode_duplex) {
if (m_private->drainCounter == 0) { if (m_private->drainCounter == 0) {
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
m_private->drainCounter = 2; m_private->drainCounter = 2;
m_private->condition.wait(lck); m_private->condition.wait(lck);
} }

View File

@ -597,7 +597,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::stopStream() {
|| m_mode == audio::orchestra::mode_duplex) { || m_mode == audio::orchestra::mode_duplex) {
if (m_private->drainCounter == 0) { if (m_private->drainCounter == 0) {
m_private->drainCounter = 2; m_private->drainCounter = 2;
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
m_private->condition.wait(lck); m_private->condition.wait(lck);
} }
} }

View File

@ -131,7 +131,7 @@ enum audio::orchestra::error audio::orchestra::api::Pulse::closeStream() {
void audio::orchestra::api::Pulse::callbackEventOneCycle() { void audio::orchestra::api::Pulse::callbackEventOneCycle() {
if (m_state == audio::orchestra::state::stopped) { if (m_state == audio::orchestra::state::stopped) {
std::unique_lock<ethread::Mutex> lck(m_mutex); ethread::UniqueLock lck(m_mutex);
while (!m_private->runnable) { while (!m_private->runnable) {
m_private->runnable_cv.wait(lck); m_private->runnable_cv.wait(lck);
} }

View File

@ -10,7 +10,7 @@
#include <condition_variable> #include <condition_variable>
#include <ethread/Mutex.hpp> #include <ethread/Mutex.hpp>
#include <chrono> #include <chrono>
#include <functional> #include <etk/Function.hpp>
#include <ememory/memory.hpp> #include <ememory/memory.hpp>
#include <audio/channel.hpp> #include <audio/channel.hpp>
#include <audio/format.hpp> #include <audio/format.hpp>