[DEV] update of external of elog and ethread

This commit is contained in:
Edouard DUPIN 2016-03-08 21:29:34 +01:00
parent b5bdb4e2db
commit e7511a0b92
17 changed files with 58 additions and 58 deletions

View File

@ -58,7 +58,7 @@ audio::orchestra::Api::~Api() {
enum audio::orchestra::error audio::orchestra::Api::startStream() { enum audio::orchestra::error audio::orchestra::Api::startStream() {
ATA_VERBOSE("Start Stream"); ATA_VERBOSE("Start Stream");
m_startTime = audio::Time::now(); m_startTime = audio::Time::now();
m_duration = std11::chrono::microseconds(0); m_duration = std::chrono::microseconds(0);
return audio::orchestra::error_none; return audio::orchestra::error_none;
} }

View File

@ -27,7 +27,7 @@ namespace audio {
* @param _nbChunk The number of chunk of input or output chunk in the buffer (same size). * @param _nbChunk The number of chunk of input or output chunk in the buffer (same size).
* @param _status List of error that occured in the laps of time. * @param _status List of error that occured in the laps of time.
*/ */
typedef std11::function<int32_t (const void* _inputBuffer, typedef std::function<int32_t (const void* _inputBuffer,
const audio::Time& _timeInput, const audio::Time& _timeInput,
void* _outputBuffer, void* _outputBuffer,
const audio::Time& _timeOutput, const audio::Time& _timeOutput,
@ -85,7 +85,7 @@ namespace audio {
} }
protected: protected:
mutable std11::mutex m_mutex; mutable std::mutex m_mutex;
audio::orchestra::AirTAudioCallback m_callback; audio::orchestra::AirTAudioCallback m_callback;
uint32_t m_device[2]; // Playback and record, respectively. uint32_t m_device[2]; // Playback and record, respectively.
enum audio::orchestra::mode m_mode; // audio::orchestra::mode_output, audio::orchestra::mode_input, or audio::orchestra::mode_duplex. enum audio::orchestra::mode m_mode; // audio::orchestra::mode_output, audio::orchestra::mode_input, or audio::orchestra::mode_duplex.
@ -166,7 +166,7 @@ namespace audio {
uint32_t _firstChannel); uint32_t _firstChannel);
public: public:
virtual bool isMasterOf(std11::shared_ptr<audio::orchestra::Api> _api) { virtual bool isMasterOf(std::shared_ptr<audio::orchestra::Api> _api) {
return false; return false;
}; };
}; };

View File

@ -13,7 +13,7 @@
#include <audio/orchestra/Interface.h> #include <audio/orchestra/Interface.h>
#include <audio/orchestra/debug.h> #include <audio/orchestra/debug.h>
#include <etk/stdTools.h> #include <etk/stdTools.h>
#include <etk/thread/tools.h> #include <ethread/tools.h>
#include <limits.h> #include <limits.h>
#include <audio/orchestra/api/Alsa.h> #include <audio/orchestra/api/Alsa.h>
extern "C" { extern "C" {
@ -41,9 +41,9 @@ namespace audio {
public: public:
snd_pcm_t *handle; snd_pcm_t *handle;
bool xrun[2]; bool xrun[2];
std11::condition_variable runnable_cv; std::condition_variable runnable_cv;
bool runnable; bool runnable;
std11::thread* thread; std::thread* thread;
bool threadRunning; bool threadRunning;
bool mmapInterface; //!< enable or disable mmap mode... bool mmapInterface; //!< enable or disable mmap mode...
enum timestampMode timeMode; //!< the timestamp of the flow came from the harware. enum timestampMode timeMode; //!< the timestamp of the flow came from the harware.
@ -804,13 +804,13 @@ bool audio::orchestra::api::Alsa::openName(const std::string& _deviceName,
// Setup callback thread. // Setup callback thread.
m_private->threadRunning = true; m_private->threadRunning = true;
ATA_INFO("create thread ..."); ATA_INFO("create thread ...");
m_private->thread = new std11::thread(&audio::orchestra::api::Alsa::alsaCallbackEvent, this); m_private->thread = new std::thread(&audio::orchestra::api::Alsa::alsaCallbackEvent, this);
if (m_private->thread == nullptr) { if (m_private->thread == nullptr) {
m_private->threadRunning = false; m_private->threadRunning = false;
ATA_ERROR("creating callback thread!"); ATA_ERROR("creating callback thread!");
goto error; goto error;
} }
etk::thread::setPriority(*m_private->thread, -6); ethread::setPriority(*m_private->thread, -6);
return true; return true;
error: error:
if (m_private->handle) { if (m_private->handle) {
@ -876,7 +876,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;
} }
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> 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) {
@ -910,7 +910,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;
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> 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);
@ -937,7 +937,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;
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> 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) {
@ -980,7 +980,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) {
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> lck(m_mutex);
while (!m_private->runnable) { while (!m_private->runnable) {
m_private->runnable_cv.wait(lck); m_private->runnable_cv.wait(lck);
} }
@ -988,7 +988,7 @@ void audio::orchestra::api::Alsa::callbackEvent() {
return; return;
} }
} }
etk::thread::setName("Alsa IO-" + m_name); ethread::setName("Alsa IO-" + m_name);
//Wait data with poll //Wait data with poll
std::vector<struct pollfd> ufds; std::vector<struct pollfd> ufds;
signed short *ptr; signed short *ptr;
@ -1121,7 +1121,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleRead() {
// !!! goto unlock; // !!! goto unlock;
} }
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> lck(m_mutex);
// Setup parameters. // Setup parameters.
if (m_doConvertBuffer[1]) { if (m_doConvertBuffer[1]) {
buffer = m_deviceBuffer; buffer = m_deviceBuffer;
@ -1257,7 +1257,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleWrite() {
abortStream(); abortStream();
return; return;
} }
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> 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;
@ -1364,7 +1364,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPWrite() {
return; return;
} }
{ {
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> 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;
@ -1472,7 +1472,7 @@ void audio::orchestra::api::Alsa::callbackEventOneCycleMMAPRead() {
goto unlock; goto unlock;
} }
{ {
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> lck(m_mutex);
// Setup parameters. // Setup parameters.
if (m_doConvertBuffer[1]) { if (m_doConvertBuffer[1]) {
buffer = m_deviceBuffer; buffer = m_deviceBuffer;
@ -1566,8 +1566,8 @@ unlock:
} }
bool audio::orchestra::api::Alsa::isMasterOf(std11::shared_ptr<audio::orchestra::Api> _api) { bool audio::orchestra::api::Alsa::isMasterOf(std::shared_ptr<audio::orchestra::Api> _api) {
std11::shared_ptr<audio::orchestra::api::Alsa> slave = std::dynamic_pointer_cast<audio::orchestra::api::Alsa>(_api); std::shared_ptr<audio::orchestra::api::Alsa> slave = std::dynamic_pointer_cast<audio::orchestra::api::Alsa>(_api);
if (slave == nullptr) { if (slave == nullptr) {
ATA_ERROR("NULL ptr API (not ALSA ...)"); ATA_ERROR("NULL ptr API (not ALSA ...)");
return false; return false;

View File

@ -50,7 +50,7 @@ namespace audio {
private: private:
static void alsaCallbackEvent(void* _userData); static void alsaCallbackEvent(void* _userData);
private: private:
std11::shared_ptr<AlsaPrivate> m_private; std::shared_ptr<AlsaPrivate> m_private;
std::vector<audio::orchestra::DeviceInfo> m_devices; std::vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo(); void saveDeviceInfo();
bool open(uint32_t _device, bool open(uint32_t _device,
@ -72,7 +72,7 @@ namespace audio {
const audio::orchestra::StreamOptions& _options); const audio::orchestra::StreamOptions& _options);
virtual audio::Time getStreamTime(); virtual audio::Time getStreamTime();
public: public:
bool isMasterOf(std11::shared_ptr<audio::orchestra::Api> _api); bool isMasterOf(std::shared_ptr<audio::orchestra::Api> _api);
}; };
} }
} }

View File

@ -148,7 +148,7 @@ bool audio::orchestra::api::Android::open(uint32_t _device,
m_userFormat = _format; m_userFormat = _format;
m_nUserChannels[modeToIdTable(m_mode)] = _channels; m_nUserChannels[modeToIdTable(m_mode)] = _channels;
m_uid = audio::orchestra::api::android::open(_device, m_mode, _channels, _firstChannel, _sampleRate, _format, _bufferSize, _options, std11::static_pointer_cast<audio::orchestra::api::Android>(shared_from_this())); m_uid = audio::orchestra::api::android::open(_device, m_mode, _channels, _firstChannel, _sampleRate, _format, _bufferSize, _options, std::static_pointer_cast<audio::orchestra::api::Android>(shared_from_this()));
if (m_uid < 0) { if (m_uid < 0) {
ret = false; ret = false;
} else { } else {

View File

@ -253,7 +253,7 @@ class AndroidOrchestraContext {
} else { } else {
info.input = true; info.input = true;
} }
std11::shared_ptr<const ejson::Array> list = doc.getArray("sample-rate"); std::shared_ptr<const ejson::Array> list = doc.getArray("sample-rate");
if (list != nullptr) { if (list != nullptr) {
for (size_t iii=0; iii<list->size(); ++iii) { for (size_t iii=0; iii<list->size(); ++iii) {
info.sampleRates.push_back(int32_t(list->getNumberValue(iii, 48000))); info.sampleRates.push_back(int32_t(list->getNumberValue(iii, 48000)));
@ -276,7 +276,7 @@ class AndroidOrchestraContext {
return info; return info;
} }
private: private:
std::vector<std11::weak_ptr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ... std::vector<std::weak_ptr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ...
//AndroidAudioCallback m_audioCallBack; //AndroidAudioCallback m_audioCallBack;
//void* m_audioCallBackUserData; //void* m_audioCallBackUserData;
public: public:
@ -288,7 +288,7 @@ class AndroidOrchestraContext {
audio::format _format, audio::format _format,
uint32_t *_bufferSize, uint32_t *_bufferSize,
const audio::orchestra::StreamOptions& _options, const audio::orchestra::StreamOptions& _options,
std11::shared_ptr<audio::orchestra::api::Android> _instance) { std::shared_ptr<audio::orchestra::api::Android> _instance) {
ATA_DEBUG("C->java : audio open device"); ATA_DEBUG("C->java : audio open device");
int status; int status;
if(!java_attach_current_thread(&status)) { if(!java_attach_current_thread(&status)) {
@ -422,7 +422,7 @@ int32_t audio::orchestra::api::android::open(uint32_t _device,
audio::format _format, audio::format _format,
uint32_t *_bufferSize, uint32_t *_bufferSize,
const audio::orchestra::StreamOptions& _options, const audio::orchestra::StreamOptions& _options,
std11::shared_ptr<audio::orchestra::api::Android> _instance) { std::shared_ptr<audio::orchestra::api::Android> _instance) {
if (s_localContext == nullptr) { if (s_localContext == nullptr) {
return -1; return -1;
} }

View File

@ -29,7 +29,7 @@ namespace audio {
audio::format _format, audio::format _format,
uint32_t *_bufferSize, uint32_t *_bufferSize,
const audio::orchestra::StreamOptions& _options, const audio::orchestra::StreamOptions& _options,
std11::shared_ptr<audio::orchestra::api::Android> _instance); std::shared_ptr<audio::orchestra::api::Android> _instance);
enum audio::orchestra::error closeStream(int32_t _id); enum audio::orchestra::error closeStream(int32_t _id);
enum audio::orchestra::error startStream(int32_t _id); enum audio::orchestra::error startStream(int32_t _id);
enum audio::orchestra::error stopStream(int32_t _id); enum audio::orchestra::error stopStream(int32_t _id);

View File

@ -17,7 +17,7 @@
#include <audio/orchestra/Interface.h> #include <audio/orchestra/Interface.h>
#include <audio/orchestra/debug.h> #include <audio/orchestra/debug.h>
#include <thread> #include <thread>
#include <etk/thread/tools.h> #include <ethread/tools.h>
#include <audio/orchestra/api/Core.h> #include <audio/orchestra/api/Core.h>
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Core::create() { std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Core::create() {
@ -40,7 +40,7 @@ namespace audio {
uint32_t nStreams[2]; // number of streams to use uint32_t nStreams[2]; // number of streams to use
bool xrun[2]; bool xrun[2];
char *deviceBuffer; char *deviceBuffer;
std11::condition_variable condition; std::condition_variable condition;
int32_t drainCounter; // Tracks callback counts when draining int32_t drainCounter; // Tracks callback counts when draining
bool internalDrain; // Indicates if stop is initiated from callback or not. bool internalDrain; // Indicates if stop is initiated from callback or not.
CorePrivate() : CorePrivate() :
@ -970,7 +970,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) {
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> lck(m_mutex);
m_private->drainCounter = 2; m_private->drainCounter = 2;
m_private->condition.wait(lck); m_private->condition.wait(lck);
} }
@ -1016,7 +1016,7 @@ enum audio::orchestra::error audio::orchestra::api::Core::abortStream() {
// callbackEvent() function probably should return before the AudioDeviceStop() // callbackEvent() function probably should return before the AudioDeviceStop()
// function is called. // function is called.
void audio::orchestra::api::Core::coreStopStream(void *_userData) { void audio::orchestra::api::Core::coreStopStream(void *_userData) {
etk::thread::setName("CoreAudio_stopStream"); ethread::setName("CoreAudio_stopStream");
audio::orchestra::api::Core* myClass = reinterpret_cast<audio::orchestra::api::Core*>(_userData); audio::orchestra::api::Core* myClass = reinterpret_cast<audio::orchestra::api::Core*>(_userData);
myClass->stopStream(); myClass->stopStream();
} }
@ -1039,7 +1039,7 @@ bool audio::orchestra::api::Core::callbackEvent(AudioDeviceID _deviceId,
m_state = audio::orchestra::state_stopping; m_state = audio::orchestra::state_stopping;
ATA_VERBOSE("Set state as stopping"); ATA_VERBOSE("Set state as stopping");
if (m_private->internalDrain == true) { if (m_private->internalDrain == true) {
new std11::thread(&audio::orchestra::api::Core::coreStopStream, this); new std::thread(&audio::orchestra::api::Core::coreStopStream, this);
} else { } else {
// external call to stopStream() // external call to stopStream()
m_private->condition.notify_one(); m_private->condition.notify_one();

View File

@ -47,7 +47,7 @@ namespace audio {
int32_t _nbChunk, int32_t _nbChunk,
const audio::Time& _time); const audio::Time& _time);
public: public:
std11::shared_ptr<CoreIosPrivate> m_private; std::shared_ptr<CoreIosPrivate> m_private;
}; };
} }
} }

View File

@ -9,7 +9,7 @@
#if defined(ORCHESTRA_BUILD_DS) #if defined(ORCHESTRA_BUILD_DS)
#include <audio/orchestra/Interface.h> #include <audio/orchestra/Interface.h>
#include <audio/orchestra/debug.h> #include <audio/orchestra/debug.h>
#include <etk/thread/tools.h> #include <ethread/tools.h>
#include <audio/orchestra/api/Ds.h> #include <audio/orchestra/api/Ds.h>
#undef __class__ #undef __class__
@ -75,7 +75,7 @@ namespace audio {
namespace api { namespace api {
class DsPrivate { class DsPrivate {
public: public:
std11::shared_ptr<std11::thread> thread; std::shared_ptr<std::thread> thread;
bool threadRunning; bool threadRunning;
uint32_t drainCounter; // Tracks callback counts when draining uint32_t drainCounter; // Tracks callback counts when draining
bool internalDrain; // Indicates if stop is initiated from callback or not. bool internalDrain; // Indicates if stop is initiated from callback or not.
@ -765,7 +765,7 @@ bool audio::orchestra::api::Ds::open(uint32_t _device,
// Setup the callback thread. // Setup the callback thread.
if (m_private->threadRunning == false) { if (m_private->threadRunning == false) {
m_private->threadRunning = true; m_private->threadRunning = true;
std11::shared_ptr<std11::thread> tmpThread(new std11::thread(&audio::orchestra::api::Ds::dsCallbackEvent, this)); std::shared_ptr<std::thread> tmpThread(new std::thread(&audio::orchestra::api::Ds::dsCallbackEvent, this));
m_private->thread = std::move(tmpThread); m_private->thread = std::move(tmpThread);
if (m_private->thread == nullptr) { if (m_private->thread == nullptr) {
ATA_ERROR("error creating callback thread!"); ATA_ERROR("error creating callback thread!");
@ -988,7 +988,7 @@ enum audio::orchestra::error audio::orchestra::api::Ds::abortStream() {
} }
void audio::orchestra::api::Ds::callbackEvent() { void audio::orchestra::api::Ds::callbackEvent() {
etk::thread::setName("DS IO-" + m_name); ethread::setName("DS IO-" + m_name);
if (m_state == audio::orchestra::state_stopped || m_state == audio::orchestra::state_stopping) { if (m_state == audio::orchestra::state_stopped || m_state == audio::orchestra::state_stopping) {
Sleep(50); // sleep 50 milliseconds Sleep(50); // sleep 50 milliseconds
return; return;

View File

@ -34,7 +34,7 @@ namespace audio {
void callbackEvent(); void callbackEvent();
private: private:
static void dsCallbackEvent(void *_userData); static void dsCallbackEvent(void *_userData);
std11::shared_ptr<DsPrivate> m_private; std::shared_ptr<DsPrivate> m_private;
bool m_coInitialized; bool m_coInitialized;
bool m_buffersRolling; bool m_buffersRolling;
long m_duplexPrerollBytes; long m_duplexPrerollBytes;

View File

@ -13,7 +13,7 @@
#include <audio/orchestra/Interface.h> #include <audio/orchestra/Interface.h>
#include <audio/orchestra/debug.h> #include <audio/orchestra/debug.h>
#include <string.h> #include <string.h>
#include <etk/thread/tools.h> #include <ethread/tools.h>
#include <audio/orchestra/api/Jack.h> #include <audio/orchestra/api/Jack.h>
#undef __class__ #undef __class__
@ -68,7 +68,7 @@ namespace audio {
jack_port_t **ports[2]; jack_port_t **ports[2];
std::string deviceName[2]; std::string deviceName[2];
bool xrun[2]; bool xrun[2];
std11::condition_variable condition; std::condition_variable condition;
int32_t drainCounter; // Tracks callback counts when draining int32_t drainCounter; // Tracks callback counts when draining
bool internalDrain; // Indicates if stop is initiated from callback or not. bool internalDrain; // Indicates if stop is initiated from callback or not.
@ -231,7 +231,7 @@ int32_t audio::orchestra::api::Jack::jackCallbackHandler(jack_nframes_t _nframes
// it this way because the jackShutdown() function must return before // it this way because the jackShutdown() function must return before
// the jack_deactivate() function (in closeStream()) will return. // the jack_deactivate() function (in closeStream()) will return.
void audio::orchestra::api::Jack::jackCloseStream(void* _userData) { void audio::orchestra::api::Jack::jackCloseStream(void* _userData) {
etk::thread::setName("Jack_closeStream"); ethread::setName("Jack_closeStream");
audio::orchestra::api::Jack* myClass = reinterpret_cast<audio::orchestra::api::Jack*>(_userData); audio::orchestra::api::Jack* myClass = reinterpret_cast<audio::orchestra::api::Jack*>(_userData);
myClass->closeStream(); myClass->closeStream();
} }
@ -246,7 +246,7 @@ void audio::orchestra::api::Jack::jackShutdown(void* _userData) {
if (myClass->isStreamRunning() == false) { if (myClass->isStreamRunning() == false) {
return; return;
} }
new std11::thread(&audio::orchestra::api::Jack::jackCloseStream, _userData); new std::thread(&audio::orchestra::api::Jack::jackCloseStream, _userData);
ATA_ERROR("The Jack server is shutting down this client ... stream stopped and closed!!"); ATA_ERROR("The Jack server is shutting down this client ... stream stopped and closed!!");
} }
@ -600,7 +600,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;
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> lck(m_mutex);
m_private->condition.wait(lck); m_private->condition.wait(lck);
} }
} }
@ -627,7 +627,7 @@ enum audio::orchestra::error audio::orchestra::api::Jack::abortStream() {
// callbackEvent() function must return before the jack_deactivate() // callbackEvent() function must return before the jack_deactivate()
// function will return. // function will return.
static void jackStopStream(void* _userData) { static void jackStopStream(void* _userData) {
etk::thread::setName("Jack_stopStream"); ethread::setName("Jack_stopStream");
audio::orchestra::api::Jack* myClass = reinterpret_cast<audio::orchestra::api::Jack*>(_userData); audio::orchestra::api::Jack* myClass = reinterpret_cast<audio::orchestra::api::Jack*>(_userData);
myClass->stopStream(); myClass->stopStream();
} }
@ -649,7 +649,7 @@ bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
if (m_private->drainCounter > 3) { if (m_private->drainCounter > 3) {
m_state = audio::orchestra::state_stopping; m_state = audio::orchestra::state_stopping;
if (m_private->internalDrain == true) { if (m_private->internalDrain == true) {
new std11::thread(jackStopStream, this); new std::thread(jackStopStream, this);
} else { } else {
m_private->condition.notify_one(); m_private->condition.notify_one();
} }
@ -676,7 +676,7 @@ bool audio::orchestra::api::Jack::callbackEvent(uint64_t _nframes) {
if (cbReturnValue == 2) { if (cbReturnValue == 2) {
m_state = audio::orchestra::state_stopping; m_state = audio::orchestra::state_stopping;
m_private->drainCounter = 2; m_private->drainCounter = 2;
new std11::thread(jackStopStream, this); new std::thread(jackStopStream, this);
return true; return true;
} }
else if (cbReturnValue == 1) { else if (cbReturnValue == 1) {

View File

@ -40,7 +40,7 @@ namespace audio {
static void jackShutdown(void* _userData); static void jackShutdown(void* _userData);
static int32_t jackCallbackHandler(jack_nframes_t _nframes, void* _userData); static int32_t jackCallbackHandler(jack_nframes_t _nframes, void* _userData);
private: private:
std11::shared_ptr<JackPrivate> m_private; std::shared_ptr<JackPrivate> m_private;
bool open(uint32_t _device, bool open(uint32_t _device,
audio::orchestra::mode _mode, audio::orchestra::mode _mode,
uint32_t _channels, uint32_t _channels,

View File

@ -15,7 +15,7 @@
#include <pulse/error.h> #include <pulse/error.h>
#include <pulse/simple.h> #include <pulse/simple.h>
#include <cstdio> #include <cstdio>
#include <etk/thread/tools.h> #include <ethread/tools.h>
#include <audio/orchestra/api/PulseDeviceList.h> #include <audio/orchestra/api/PulseDeviceList.h>
#include <audio/orchestra/api/Pulse.h> #include <audio/orchestra/api/Pulse.h>
@ -56,9 +56,9 @@ namespace audio {
class PulsePrivate { class PulsePrivate {
public: public:
pa_simple* handle; pa_simple* handle;
std11::shared_ptr<std11::thread> thread; std::shared_ptr<std::thread> thread;
bool threadRunning; bool threadRunning;
std11::condition_variable runnable_cv; std::condition_variable runnable_cv;
bool runnable; bool runnable;
PulsePrivate() : PulsePrivate() :
handle(0), handle(0),
@ -105,7 +105,7 @@ static void pulseaudio_callback(void* _userData) {
} }
void audio::orchestra::api::Pulse::callbackEvent() { void audio::orchestra::api::Pulse::callbackEvent() {
etk::thread::setName("Pulse IO-" + m_name); ethread::setName("Pulse IO-" + m_name);
while (m_private->threadRunning == true) { while (m_private->threadRunning == true) {
callbackEventOneCycle(); callbackEventOneCycle();
} }
@ -134,7 +134,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) {
std11::unique_lock<std11::mutex> lck(m_mutex); std::unique_lock<std::mutex> lck(m_mutex);
while (!m_private->runnable) { while (!m_private->runnable) {
m_private->runnable_cv.wait(lck); m_private->runnable_cv.wait(lck);
} }
@ -396,7 +396,7 @@ bool audio::orchestra::api::Pulse::open(uint32_t _device,
} }
if (m_private->threadRunning == false) { if (m_private->threadRunning == false) {
m_private->threadRunning = true; m_private->threadRunning = true;
m_private->thread = std11::make_shared<std11::thread>(&pulseaudio_callback, this); m_private->thread = std::make_shared<std::thread>(&pulseaudio_callback, this);
if (m_private->thread == nullptr) { if (m_private->thread == nullptr) {
ATA_ERROR("error creating thread."); ATA_ERROR("error creating thread.");
goto error; goto error;

View File

@ -33,7 +33,7 @@ namespace audio {
void callbackEventOneCycle(); void callbackEventOneCycle();
void callbackEvent(); void callbackEvent();
private: private:
std11::shared_ptr<PulsePrivate> m_private; std::shared_ptr<PulsePrivate> m_private;
std::vector<audio::orchestra::DeviceInfo> m_devices; std::vector<audio::orchestra::DeviceInfo> m_devices;
void saveDeviceInfo(); void saveDeviceInfo();
bool open(uint32_t _device, bool open(uint32_t _device,

View File

@ -8,6 +8,6 @@
#include <audio/orchestra/debug.h> #include <audio/orchestra/debug.h>
int32_t audio::orchestra::getLogId() { int32_t audio::orchestra::getLogId() {
static int32_t g_val = etk::log::registerInstance("audio-orchestra"); static int32_t g_val = elog::registerInstance("audio-orchestra");
return g_val; return g_val;
} }

View File

@ -6,14 +6,14 @@
*/ */
#pragma once #pragma once
#include <etk/log.h> #include <elog/log.h>
namespace audio { namespace audio {
namespace orchestra { namespace orchestra {
int32_t getLogId(); int32_t getLogId();
} }
} }
#define ATA_BASE(info,data) TK_LOG_BASE(audio::orchestra::getLogId(),info,data) #define ATA_BASE(info,data) ELOG_BASE(audio::orchestra::getLogId(),info,data)
#define ATA_PRINT(data) ATA_BASE(-1, data) #define ATA_PRINT(data) ATA_BASE(-1, data)
#define ATA_CRITICAL(data) ATA_BASE(1, data) #define ATA_CRITICAL(data) ATA_BASE(1, data)