[DEV] update sharedPtr
This commit is contained in:
parent
151a3ddcf4
commit
db89c092be
@ -13,7 +13,7 @@
|
|||||||
#include <audio/orchestra/mode.h>
|
#include <audio/orchestra/mode.h>
|
||||||
#include <audio/Time.h>
|
#include <audio/Time.h>
|
||||||
#include <audio/Duration.h>
|
#include <audio/Duration.h>
|
||||||
#include <memory>
|
#include <ememory/memory.h>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
@ -45,7 +45,7 @@ namespace audio {
|
|||||||
std::vector<int> outOffset;
|
std::vector<int> outOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Api : public std::enable_shared_from_this<Api>{
|
class Api : public ememory::EnableSharedFromThis<Api>{
|
||||||
protected:
|
protected:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
public:
|
public:
|
||||||
@ -166,7 +166,7 @@ namespace audio {
|
|||||||
uint32_t _firstChannel);
|
uint32_t _firstChannel);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool isMasterOf(std::shared_ptr<audio::orchestra::Api> _api) {
|
virtual bool isMasterOf(ememory::SharedPtr<audio::orchestra::Api> _api) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -80,8 +80,8 @@ audio::orchestra::Interface::Interface() :
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::orchestra::Interface::addInterface(const std::string& _api, std::shared_ptr<Api> (*_callbackCreate)()) {
|
void audio::orchestra::Interface::addInterface(const std::string& _api, ememory::SharedPtr<Api> (*_callbackCreate)()) {
|
||||||
m_apiAvaillable.push_back(std::pair<std::string, std::shared_ptr<Api> (*)()>(_api, _callbackCreate));
|
m_apiAvaillable.push_back(std::pair<std::string, ememory::SharedPtr<Api> (*)()>(_api, _callbackCreate));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum audio::orchestra::error audio::orchestra::Interface::clear() {
|
enum audio::orchestra::error audio::orchestra::Interface::clear() {
|
||||||
|
@ -26,9 +26,9 @@ namespace audio {
|
|||||||
*/
|
*/
|
||||||
class Interface {
|
class Interface {
|
||||||
protected:
|
protected:
|
||||||
std::vector<std::pair<std::string, std::shared_ptr<Api> (*)()> > m_apiAvaillable;
|
std::vector<std::pair<std::string, ememory::SharedPtr<Api> (*)()> > m_apiAvaillable;
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<audio::orchestra::Api> m_api;
|
ememory::SharedPtr<audio::orchestra::Api> m_api;
|
||||||
public:
|
public:
|
||||||
void setName(const std::string& _name) {
|
void setName(const std::string& _name) {
|
||||||
if (m_api == nullptr) {
|
if (m_api == nullptr) {
|
||||||
@ -46,7 +46,7 @@ namespace audio {
|
|||||||
* @param[in] _api Type of the interface.
|
* @param[in] _api Type of the interface.
|
||||||
* @param[in] _callbackCreate API creation callback.
|
* @param[in] _callbackCreate API creation callback.
|
||||||
*/
|
*/
|
||||||
void addInterface(const std::string& _api, std::shared_ptr<Api> (*_callbackCreate)());
|
void addInterface(const std::string& _api, ememory::SharedPtr<Api> (*_callbackCreate)());
|
||||||
/**
|
/**
|
||||||
* @brief The class constructor.
|
* @brief The class constructor.
|
||||||
* @note the creating of the basic instance is done by Instanciate
|
* @note the creating of the basic instance is done by Instanciate
|
||||||
|
@ -28,8 +28,8 @@ extern "C" {
|
|||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Alsa::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Alsa::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Alsa());
|
return ememory::SharedPtr<audio::orchestra::api::Alsa>(new audio::orchestra::api::Alsa());
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
@ -63,7 +63,7 @@ namespace audio {
|
|||||||
}
|
}
|
||||||
|
|
||||||
audio::orchestra::api::Alsa::Alsa() :
|
audio::orchestra::api::Alsa::Alsa() :
|
||||||
m_private(std::make_shared<audio::orchestra::api::AlsaPrivate>()) {
|
m_private(ememory::makeShared<audio::orchestra::api::AlsaPrivate>()) {
|
||||||
// Nothing to do here.
|
// Nothing to do here.
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1564,8 +1564,8 @@ unlock:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool audio::orchestra::api::Alsa::isMasterOf(std::shared_ptr<audio::orchestra::Api> _api) {
|
bool audio::orchestra::api::Alsa::isMasterOf(ememory::SharedPtr<audio::orchestra::Api> _api) {
|
||||||
std::shared_ptr<audio::orchestra::api::Alsa> slave = std::dynamic_pointer_cast<audio::orchestra::api::Alsa>(_api);
|
ememory::SharedPtr<audio::orchestra::api::Alsa> slave = ememory::dynamicPointerCast<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;
|
||||||
|
@ -14,7 +14,7 @@ namespace audio {
|
|||||||
class AlsaPrivate;
|
class AlsaPrivate;
|
||||||
class Alsa: public audio::orchestra::Api {
|
class Alsa: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Alsa();
|
Alsa();
|
||||||
virtual ~Alsa();
|
virtual ~Alsa();
|
||||||
@ -50,7 +50,7 @@ namespace audio {
|
|||||||
private:
|
private:
|
||||||
static void alsaCallbackEvent(void* _userData);
|
static void alsaCallbackEvent(void* _userData);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<AlsaPrivate> m_private;
|
ememory::SharedPtr<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(std::shared_ptr<audio::orchestra::Api> _api);
|
bool isMasterOf(ememory::SharedPtr<audio::orchestra::Api> _api);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
#include <audio/orchestra/api/Android.h>
|
#include <audio/orchestra/api/Android.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Android::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Android::create() {
|
||||||
ATA_INFO("Create Android device ... ");
|
ATA_INFO("Create Android device ... ");
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Android());
|
return ememory::SharedPtr<audio::orchestra::api::Android>(new audio::orchestra::api::Android());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,7 +145,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, std::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, ememory::staticPointerCast<audio::orchestra::api::Android>(sharedFromThis()));
|
||||||
if (m_uid < 0) {
|
if (m_uid < 0) {
|
||||||
ret = false;
|
ret = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,7 +14,7 @@ namespace audio {
|
|||||||
namespace api {
|
namespace api {
|
||||||
class Android: public audio::orchestra::Api {
|
class Android: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Android();
|
Android();
|
||||||
virtual ~Android();
|
virtual ~Android();
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
/* include auto generated file */
|
/* include auto generated file */
|
||||||
#include <org_musicdsp_orchestra_OrchestraConstants.h>
|
#include <org_musicdsp_orchestra_OrchestraConstants.h>
|
||||||
#include <jvm-basics/jvm-basics.h>
|
#include <jvm-basics/jvm-basics.h>
|
||||||
#include <memory>
|
#include <ememory/memory.h>
|
||||||
#include <ejson/ejson.h>
|
#include <ejson/ejson.h>
|
||||||
|
|
||||||
class AndroidOrchestraContext {
|
class AndroidOrchestraContext {
|
||||||
@ -253,7 +253,7 @@ class AndroidOrchestraContext {
|
|||||||
} else {
|
} else {
|
||||||
info.input = true;
|
info.input = true;
|
||||||
}
|
}
|
||||||
std::shared_ptr<const ejson::Array> list = doc.getArray("sample-rate");
|
ememory::SharedPtr<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<std::weak_ptr<audio::orchestra::api::Android> > m_instanceList; // list of connected handle ...
|
std::vector<ememory::WeakPtr<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,
|
||||||
std::shared_ptr<audio::orchestra::api::Android> _instance) {
|
ememory::SharedPtr<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)) {
|
||||||
@ -395,7 +395,7 @@ class AndroidOrchestraContext {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::shared_ptr<AndroidOrchestraContext> s_localContext;
|
static ememory::SharedPtr<AndroidOrchestraContext> s_localContext;
|
||||||
static int32_t s_nbContextRequested(0);
|
static int32_t s_nbContextRequested(0);
|
||||||
|
|
||||||
|
|
||||||
@ -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,
|
||||||
std::shared_ptr<audio::orchestra::api::Android> _instance) {
|
ememory::SharedPtr<audio::orchestra::api::Android> _instance) {
|
||||||
if (s_localContext == nullptr) {
|
if (s_localContext == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -468,7 +468,7 @@ extern "C" {
|
|||||||
if (s_localContext != nullptr) {
|
if (s_localContext != nullptr) {
|
||||||
s_nbContextRequested++;
|
s_nbContextRequested++;
|
||||||
}
|
}
|
||||||
s_localContext = std::make_shared<AndroidOrchestraContext>(_env, _classBase, _objCallback);
|
s_localContext = ememory::makeShared<AndroidOrchestraContext>(_env, _classBase, _objCallback);
|
||||||
if (s_localContext == nullptr) {
|
if (s_localContext == nullptr) {
|
||||||
ATA_ERROR("Can not allocate the orchestra main context instance");
|
ATA_ERROR("Can not allocate the orchestra main context instance");
|
||||||
return;
|
return;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <audio/orchestra/error.h>
|
#include <audio/orchestra/error.h>
|
||||||
#include <audio/orchestra/StreamOptions.h>
|
#include <audio/orchestra/StreamOptions.h>
|
||||||
#include <audio/format.h>
|
#include <audio/format.h>
|
||||||
#include <memory>
|
#include <ememory/memory.h>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace orchestra {
|
namespace orchestra {
|
||||||
@ -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,
|
||||||
std::shared_ptr<audio::orchestra::api::Android> _instance);
|
ememory::SharedPtr<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);
|
||||||
|
@ -11,8 +11,8 @@
|
|||||||
#include <audio/orchestra/Interface.h>
|
#include <audio/orchestra/Interface.h>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Asio::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Asio::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Asio());
|
return ememory::SharedPtr<audio::orchestra::api::Asio>(new audio::orchestra::api::Asio());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ namespace audio {
|
|||||||
class AsioPrivate:
|
class AsioPrivate:
|
||||||
class Asio: public audio::orchestra::Api {
|
class Asio: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Asio();
|
Asio();
|
||||||
virtual ~Asio();
|
virtual ~Asio();
|
||||||
@ -33,7 +33,7 @@ namespace audio {
|
|||||||
// will most likely produce highly undesireable results!
|
// will most likely produce highly undesireable results!
|
||||||
bool callbackEvent(long _bufferIndex);
|
bool callbackEvent(long _bufferIndex);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<AsioPrivate> m_private;
|
ememory::SharedPtr<AsioPrivate> m_private;
|
||||||
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
std::vector<audio::orchestra::DeviceInfo> m_devices;
|
||||||
void saveDeviceInfo();
|
void saveDeviceInfo();
|
||||||
bool m_coInitialized;
|
bool m_coInitialized;
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include <ethread/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() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Core::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Core());
|
return ememory::SharedPtr<audio::orchestra::api::Core>(new audio::orchestra::api::Core());
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
|
@ -16,7 +16,7 @@ namespace audio {
|
|||||||
class CorePrivate;
|
class CorePrivate;
|
||||||
class Core: public audio::orchestra::Api {
|
class Core: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Core();
|
Core();
|
||||||
virtual ~Core();
|
virtual ~Core();
|
||||||
@ -46,7 +46,7 @@ namespace audio {
|
|||||||
void* _infoPointer);
|
void* _infoPointer);
|
||||||
static void coreStopStream(void *_userData);
|
static void coreStopStream(void *_userData);
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<CorePrivate> m_private;
|
ememory::SharedPtr<CorePrivate> 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,
|
||||||
|
@ -13,7 +13,7 @@ namespace audio {
|
|||||||
class CoreIosPrivate;
|
class CoreIosPrivate;
|
||||||
class CoreIos: public audio::orchestra::Api {
|
class CoreIos: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
CoreIos();
|
CoreIos();
|
||||||
virtual ~CoreIos();
|
virtual ~CoreIos();
|
||||||
@ -47,7 +47,7 @@ namespace audio {
|
|||||||
int32_t _nbChunk,
|
int32_t _nbChunk,
|
||||||
const audio::Time& _time);
|
const audio::Time& _time);
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<CoreIosPrivate> m_private;
|
ememory::SharedPtr<CoreIosPrivate> m_private;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <audio/orchestra/api/CoreIos.h>
|
#include <audio/orchestra/api/CoreIos.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::CoreIos::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::CoreIos::create() {
|
||||||
ATA_INFO("Create CoreIos device ... ");
|
ATA_INFO("Create CoreIos device ... ");
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::CoreIos());
|
return ememory::SharedPtr<audio::orchestra::api::CoreIos>(new audio::orchestra::api::CoreIos());
|
||||||
}
|
}
|
||||||
|
|
||||||
#define kOutputBus 0
|
#define kOutputBus 0
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
#include <ethread/tools.h>
|
#include <ethread/tools.h>
|
||||||
#include <audio/orchestra/api/Ds.h>
|
#include <audio/orchestra/api/Ds.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Ds::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Ds::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Ds());
|
return ememory::SharedPtr<audio::orchestra::api::Ds>(new audio::orchestra::api::Ds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ namespace audio {
|
|||||||
namespace api {
|
namespace api {
|
||||||
class DsPrivate {
|
class DsPrivate {
|
||||||
public:
|
public:
|
||||||
std::shared_ptr<std::thread> thread;
|
ememory::SharedPtr<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.
|
||||||
@ -762,7 +762,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;
|
||||||
std::shared_ptr<std::thread> tmpThread(new std::thread(&audio::orchestra::api::Ds::dsCallbackEvent, this));
|
ememory::SharedPtr<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!");
|
||||||
|
@ -13,7 +13,7 @@ namespace audio {
|
|||||||
class DsPrivate;
|
class DsPrivate;
|
||||||
class Ds: public audio::orchestra::Api {
|
class Ds: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Ds();
|
Ds();
|
||||||
virtual ~Ds();
|
virtual ~Ds();
|
||||||
@ -34,7 +34,7 @@ namespace audio {
|
|||||||
void callbackEvent();
|
void callbackEvent();
|
||||||
private:
|
private:
|
||||||
static void dsCallbackEvent(void *_userData);
|
static void dsCallbackEvent(void *_userData);
|
||||||
std::shared_ptr<DsPrivate> m_private;
|
ememory::SharedPtr<DsPrivate> m_private;
|
||||||
bool m_coInitialized;
|
bool m_coInitialized;
|
||||||
bool m_buffersRolling;
|
bool m_buffersRolling;
|
||||||
long m_duplexPrerollBytes;
|
long m_duplexPrerollBytes;
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
#include <audio/orchestra/api/Dummy.h>
|
#include <audio/orchestra/api/Dummy.h>
|
||||||
#include <audio/orchestra/debug.h>
|
#include <audio/orchestra/debug.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Dummy::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Dummy::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Dummy());
|
return ememory::SharedPtr<audio::orchestra::api::Dummy>(new audio::orchestra::api::Dummy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace audio {
|
|||||||
namespace api {
|
namespace api {
|
||||||
class Dummy: public audio::orchestra::Api {
|
class Dummy: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Dummy();
|
Dummy();
|
||||||
const std::string& getCurrentApi() {
|
const std::string& getCurrentApi() {
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
#include <ethread/tools.h>
|
#include <ethread/tools.h>
|
||||||
#include <audio/orchestra/api/Jack.h>
|
#include <audio/orchestra/api/Jack.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Jack::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Jack::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Jack());
|
return ememory::SharedPtr<audio::orchestra::api::Jack>(new audio::orchestra::api::Jack());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace audio {
|
|||||||
class JackPrivate;
|
class JackPrivate;
|
||||||
class Jack: public audio::orchestra::Api {
|
class Jack: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Jack();
|
Jack();
|
||||||
virtual ~Jack();
|
virtual ~Jack();
|
||||||
@ -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:
|
||||||
std::shared_ptr<JackPrivate> m_private;
|
ememory::SharedPtr<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,
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include <audio/orchestra/api/PulseDeviceList.h>
|
#include <audio/orchestra/api/PulseDeviceList.h>
|
||||||
#include <audio/orchestra/api/Pulse.h>
|
#include <audio/orchestra/api/Pulse.h>
|
||||||
|
|
||||||
std::shared_ptr<audio::orchestra::Api> audio::orchestra::api::Pulse::create() {
|
ememory::SharedPtr<audio::orchestra::Api> audio::orchestra::api::Pulse::create() {
|
||||||
return std::shared_ptr<audio::orchestra::Api>(new audio::orchestra::api::Pulse());
|
return ememory::SharedPtr<audio::orchestra::api::Pulse>(new audio::orchestra::api::Pulse());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ namespace audio {
|
|||||||
class PulsePrivate {
|
class PulsePrivate {
|
||||||
public:
|
public:
|
||||||
pa_simple* handle;
|
pa_simple* handle;
|
||||||
std::shared_ptr<std::thread> thread;
|
ememory::SharedPtr<std::thread> thread;
|
||||||
bool threadRunning;
|
bool threadRunning;
|
||||||
std::condition_variable runnable_cv;
|
std::condition_variable runnable_cv;
|
||||||
bool runnable;
|
bool runnable;
|
||||||
@ -393,7 +393,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 = std::make_shared<std::thread>(&pulseaudio_callback, this);
|
m_private->thread = ememory::makeShared<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;
|
||||||
|
@ -13,7 +13,7 @@ namespace audio {
|
|||||||
class PulsePrivate;
|
class PulsePrivate;
|
||||||
class Pulse: public audio::orchestra::Api {
|
class Pulse: public audio::orchestra::Api {
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<audio::orchestra::Api> create();
|
static ememory::SharedPtr<audio::orchestra::Api> create();
|
||||||
public:
|
public:
|
||||||
Pulse();
|
Pulse();
|
||||||
virtual ~Pulse();
|
virtual ~Pulse();
|
||||||
@ -33,7 +33,7 @@ namespace audio {
|
|||||||
void callbackEventOneCycle();
|
void callbackEventOneCycle();
|
||||||
void callbackEvent();
|
void callbackEvent();
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<PulsePrivate> m_private;
|
ememory::SharedPtr<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,
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <ememory/memory.h>
|
||||||
#include <audio/channel.h>
|
#include <audio/channel.h>
|
||||||
#include <audio/format.h>
|
#include <audio/format.h>
|
||||||
#include <audio/orchestra/error.h>
|
#include <audio/orchestra/error.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user