[DEV] update sharedPtr

This commit is contained in:
Edouard DUPIN 2016-07-19 21:43:58 +02:00
parent a4a021277a
commit 6f6ee330ac
26 changed files with 100 additions and 100 deletions

View File

@ -12,7 +12,7 @@
#include <audio/channel.h> #include <audio/channel.h>
#include <chrono> #include <chrono>
#include <functional> #include <functional>
#include <memory> #include <ememory/memory.h>
#include "AutoLogInOut.h" #include "AutoLogInOut.h"
#include "IOFormatInterface.h" #include "IOFormatInterface.h"
#include <audio/Time.h> #include <audio/Time.h>
@ -22,7 +22,7 @@
namespace audio { namespace audio {
namespace drain{ namespace drain{
typedef std::function<void (const std::string& _origin, const std::string& _status)> algoStatusFunction; typedef std::function<void (const std::string& _origin, const std::string& _status)> algoStatusFunction;
class Algo : public std::enable_shared_from_this<Algo> { class Algo : public ememory::EnableSharedFromThis<Algo> {
private: private:
std::string m_name; std::string m_name;
public: public:

View File

@ -20,8 +20,8 @@ void audio::drain::ChannelReorder::init() {
m_type = "ChannelReorder"; m_type = "ChannelReorder";
} }
std::shared_ptr<audio::drain::ChannelReorder> audio::drain::ChannelReorder::create() { ememory::SharedPtr<audio::drain::ChannelReorder> audio::drain::ChannelReorder::create() {
std::shared_ptr<audio::drain::ChannelReorder> tmp(new audio::drain::ChannelReorder()); ememory::SharedPtr<audio::drain::ChannelReorder> tmp(new audio::drain::ChannelReorder());
tmp->init(); tmp->init();
return tmp; return tmp;
} }

View File

@ -17,7 +17,7 @@ namespace audio {
ChannelReorder(); ChannelReorder();
void init(); void init();
public: public:
static std::shared_ptr<audio::drain::ChannelReorder> create(); static ememory::SharedPtr<audio::drain::ChannelReorder> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -25,14 +25,14 @@ void audio::drain::EndPointCallback::init(recordFunction _callback) {
m_type = "EndPointCallback"; m_type = "EndPointCallback";
} }
std::shared_ptr<audio::drain::EndPointCallback> audio::drain::EndPointCallback::create(playbackFunction _callback) { ememory::SharedPtr<audio::drain::EndPointCallback> audio::drain::EndPointCallback::create(playbackFunction _callback) {
std::shared_ptr<audio::drain::EndPointCallback> tmp(new audio::drain::EndPointCallback()); ememory::SharedPtr<audio::drain::EndPointCallback> tmp(new audio::drain::EndPointCallback());
tmp->init(_callback); tmp->init(_callback);
return tmp; return tmp;
} }
std::shared_ptr<audio::drain::EndPointCallback> audio::drain::EndPointCallback::create(recordFunction _callback) { ememory::SharedPtr<audio::drain::EndPointCallback> audio::drain::EndPointCallback::create(recordFunction _callback) {
std::shared_ptr<audio::drain::EndPointCallback> tmp(new audio::drain::EndPointCallback()); ememory::SharedPtr<audio::drain::EndPointCallback> tmp(new audio::drain::EndPointCallback());
tmp->init(_callback); tmp->init(_callback);
return tmp; return tmp;
} }

View File

@ -34,8 +34,8 @@ namespace audio {
void init(playbackFunction _callback); void init(playbackFunction _callback);
void init(recordFunction _callback); void init(recordFunction _callback);
public: public:
static std::shared_ptr<EndPointCallback> create(playbackFunction _callback); static ememory::SharedPtr<EndPointCallback> create(playbackFunction _callback);
static std::shared_ptr<EndPointCallback> create(recordFunction _callback); static ememory::SharedPtr<EndPointCallback> create(recordFunction _callback);
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -18,8 +18,8 @@ void audio::drain::EndPointRead::init() {
m_type = "EndPointRead"; m_type = "EndPointRead";
} }
std::shared_ptr<audio::drain::EndPointRead> audio::drain::EndPointRead::create() { ememory::SharedPtr<audio::drain::EndPointRead> audio::drain::EndPointRead::create() {
std::shared_ptr<audio::drain::EndPointRead> tmp(new audio::drain::EndPointRead()); ememory::SharedPtr<audio::drain::EndPointRead> tmp(new audio::drain::EndPointRead());
tmp->init(); tmp->init();
return tmp; return tmp;
} }

View File

@ -17,7 +17,7 @@ namespace audio {
EndPointRead(); EndPointRead();
void init(); void init();
public: public:
static std::shared_ptr<EndPointRead> create(); static ememory::SharedPtr<EndPointRead> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -24,8 +24,8 @@ void audio::drain::EndPointWrite::init() {
} }
} }
std::shared_ptr<audio::drain::EndPointWrite> audio::drain::EndPointWrite::create() { ememory::SharedPtr<audio::drain::EndPointWrite> audio::drain::EndPointWrite::create() {
std::shared_ptr<audio::drain::EndPointWrite> tmp(new audio::drain::EndPointWrite()); ememory::SharedPtr<audio::drain::EndPointWrite> tmp(new audio::drain::EndPointWrite());
tmp->init(); tmp->init();
return tmp; return tmp;
} }

View File

@ -29,7 +29,7 @@ namespace audio {
EndPointWrite(); EndPointWrite();
void init(); void init();
public: public:
static std::shared_ptr<audio::drain::EndPointWrite> create(); static ememory::SharedPtr<audio::drain::EndPointWrite> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -23,8 +23,8 @@ void audio::drain::Equalizer::init() {
configureBiQuad(); configureBiQuad();
} }
std::shared_ptr<audio::drain::Equalizer> audio::drain::Equalizer::create() { ememory::SharedPtr<audio::drain::Equalizer> audio::drain::Equalizer::create() {
std::shared_ptr<audio::drain::Equalizer> tmp(new audio::drain::Equalizer()); ememory::SharedPtr<audio::drain::Equalizer> tmp(new audio::drain::Equalizer());
tmp->init(); tmp->init();
return tmp; return tmp;
} }

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
#include <audio/drain/Algo.h> #include <audio/drain/Algo.h>
#include <memory> #include <ememory/memory.h>
#include <ejson/Object.h> #include <ejson/Object.h>
#include <audio/algo/drain/Equalizer.h> #include <audio/algo/drain/Equalizer.h>
@ -20,7 +20,7 @@ namespace audio {
Equalizer(); Equalizer();
void init(); void init();
public: public:
static std::shared_ptr<audio::drain::Equalizer> create(); static ememory::SharedPtr<audio::drain::Equalizer> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -133,8 +133,8 @@ void audio::drain::FormatUpdate::init() {
m_type = "FormatUpdate"; m_type = "FormatUpdate";
} }
std::shared_ptr<audio::drain::FormatUpdate> audio::drain::FormatUpdate::create() { ememory::SharedPtr<audio::drain::FormatUpdate> audio::drain::FormatUpdate::create() {
std::shared_ptr<audio::drain::FormatUpdate> tmp(new audio::drain::FormatUpdate()); ememory::SharedPtr<audio::drain::FormatUpdate> tmp(new audio::drain::FormatUpdate());
tmp->init(); tmp->init();
return tmp; return tmp;
} }

View File

@ -17,7 +17,7 @@ namespace audio {
FormatUpdate(); FormatUpdate();
void init(); void init();
public: public:
static std::shared_ptr<audio::drain::FormatUpdate> create(); static ememory::SharedPtr<audio::drain::FormatUpdate> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -12,7 +12,7 @@
#include <audio/channel.h> #include <audio/channel.h>
#include <chrono> #include <chrono>
#include <functional> #include <functional>
#include <memory> #include <ememory/memory.h>
#include "AutoLogInOut.h" #include "AutoLogInOut.h"
#include "debug.h" #include "debug.h"

View File

@ -101,13 +101,13 @@ bool audio::drain::Process::process(audio::Time& _time,
return true; return true;
} }
void audio::drain::Process::pushBack(const std::shared_ptr<audio::drain::Algo>& _algo) { void audio::drain::Process::pushBack(ememory::SharedPtr<audio::drain::Algo> _algo) {
removeAlgoDynamic(); removeAlgoDynamic();
_algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2)); _algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.push_back(_algo); m_listAlgo.push_back(_algo);
} }
void audio::drain::Process::pushFront(const std::shared_ptr<audio::drain::Algo>& _algo) { void audio::drain::Process::pushFront(ememory::SharedPtr<audio::drain::Algo> _algo) {
removeAlgoDynamic(); removeAlgoDynamic();
_algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2)); _algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.insert(m_listAlgo.begin(), _algo); m_listAlgo.insert(m_listAlgo.begin(), _algo);
@ -334,7 +334,7 @@ void audio::drain::Process::updateAlgo(size_t _position) {
if ( out.getFormat() != audio::format_int16 if ( out.getFormat() != audio::format_int16
/* && out.getFormat() != format_float */) { /* && out.getFormat() != format_float */) {
// need add a format Updater // need add a format Updater
std::shared_ptr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create(); ememory::SharedPtr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create();
algo->setTemporary(); algo->setTemporary();
algo->setInputFormat(out); algo->setInputFormat(out);
out.setFormat(audio::format_int16); out.setFormat(audio::format_int16);
@ -345,7 +345,7 @@ void audio::drain::Process::updateAlgo(size_t _position) {
_position++; _position++;
} }
// need add a resampler // need add a resampler
std::shared_ptr<audio::drain::Resampler> algo = audio::drain::Resampler::create(); ememory::SharedPtr<audio::drain::Resampler> algo = audio::drain::Resampler::create();
algo->setTemporary(); algo->setTemporary();
algo->setInputFormat(out); algo->setInputFormat(out);
out.setFrequency(in.getFrequency()); out.setFrequency(in.getFrequency());
@ -358,7 +358,7 @@ void audio::drain::Process::updateAlgo(size_t _position) {
} }
if (out.getMap() != in.getMap()) { if (out.getMap() != in.getMap()) {
// need add a channel Reorder // need add a channel Reorder
std::shared_ptr<audio::drain::ChannelReorder> algo = audio::drain::ChannelReorder::create(); ememory::SharedPtr<audio::drain::ChannelReorder> algo = audio::drain::ChannelReorder::create();
algo->setTemporary(); algo->setTemporary();
algo->setInputFormat(out); algo->setInputFormat(out);
out.setMap(in.getMap()); out.setMap(in.getMap());
@ -370,7 +370,7 @@ void audio::drain::Process::updateAlgo(size_t _position) {
} }
if (out.getFormat() != in.getFormat()) { if (out.getFormat() != in.getFormat()) {
// need add a format Updater // need add a format Updater
std::shared_ptr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create(); ememory::SharedPtr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create();
algo->setTemporary(); algo->setTemporary();
algo->setInputFormat(out); algo->setInputFormat(out);
out.setFormat(in.getFormat()); out.setFormat(in.getFormat());

View File

@ -12,7 +12,7 @@
#include <audio/channel.h> #include <audio/channel.h>
#include <audio/drain/Algo.h> #include <audio/drain/Algo.h>
#include <chrono> #include <chrono>
#include <memory> #include <ememory/memory.h>
#include <etk/os/FSNode.h> #include <etk/os/FSNode.h>
namespace audio { namespace audio {
@ -94,10 +94,10 @@ namespace audio {
m_outputConfig = _interface; m_outputConfig = _interface;
} }
protected: protected:
std::vector<std::shared_ptr<drain::Algo> > m_listAlgo; std::vector<ememory::SharedPtr<drain::Algo> > m_listAlgo;
public: public:
void pushBack(const std::shared_ptr<drain::Algo>& _algo); void pushBack(ememory::SharedPtr<drain::Algo> _algo);
void pushFront(const std::shared_ptr<drain::Algo>& _algo); void pushFront(ememory::SharedPtr<drain::Algo> _algo);
void clear() { void clear() {
m_isConfigured = false; m_isConfigured = false;
m_listAlgo.clear(); m_listAlgo.clear();
@ -105,44 +105,44 @@ namespace audio {
size_t size() { size_t size() {
return m_listAlgo.size(); return m_listAlgo.size();
} }
std::vector<std::shared_ptr<drain::Algo> >::iterator begin() { std::vector<ememory::SharedPtr<drain::Algo> >::iterator begin() {
return m_listAlgo.begin(); return m_listAlgo.begin();
} }
std::vector<std::shared_ptr<drain::Algo> >::iterator end() { std::vector<ememory::SharedPtr<drain::Algo> >::iterator end() {
return m_listAlgo.end(); return m_listAlgo.end();
} }
std::shared_ptr<drain::Algo> operator[](int32_t _id) { ememory::SharedPtr<drain::Algo> operator[](int32_t _id) {
return m_listAlgo[_id]; return m_listAlgo[_id];
} }
template<typename T> std::shared_ptr<T> get(const std::string& _name) { template<typename T> ememory::SharedPtr<T> get(const std::string& _name) {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) { for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
if (m_listAlgo[iii] == nullptr) { if (m_listAlgo[iii] == nullptr) {
continue; continue;
} }
if (m_listAlgo[iii]->getName() == _name) { if (m_listAlgo[iii]->getName() == _name) {
return std::dynamic_pointer_cast<T>(m_listAlgo[iii]); return ememory::dynamicPointerCast<T>(m_listAlgo[iii]);
} }
} }
return std::shared_ptr<T>(); return ememory::SharedPtr<T>();
} }
template<typename T> std::shared_ptr<const T> get(const std::string& _name) const { template<typename T> ememory::SharedPtr<const T> get(const std::string& _name) const {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) { for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
if (m_listAlgo[iii] == nullptr) { if (m_listAlgo[iii] == nullptr) {
continue; continue;
} }
if (m_listAlgo[iii]->getName() == _name) { if (m_listAlgo[iii]->getName() == _name) {
return std::dynamic_pointer_cast<T>(m_listAlgo[iii]); return ememory::dynamicPointerCast<T>(m_listAlgo[iii]);
} }
} }
return std::shared_ptr<const T>(); return ememory::SharedPtr<const T>();
} }
template<typename T> std::shared_ptr<T> get(int32_t _id) { template<typename T> ememory::SharedPtr<T> get(int32_t _id) {
return std::dynamic_pointer_cast<T>(m_listAlgo[_id]); return ememory::dynamicPointerCast<T>(m_listAlgo[_id]);
} }
template<typename T> void removeIfFirst() { template<typename T> void removeIfFirst() {
if (m_listAlgo.size() > 0) { if (m_listAlgo.size() > 0) {
std::shared_ptr<T> algoEP = get<T>(0); ememory::SharedPtr<T> algoEP = get<T>(0);
if (algoEP != nullptr) { if (algoEP != nullptr) {
m_listAlgo.erase(m_listAlgo.begin()); m_listAlgo.erase(m_listAlgo.begin());
} }
@ -150,7 +150,7 @@ namespace audio {
} }
template<typename T> void removeIfLast() { template<typename T> void removeIfLast() {
if (m_listAlgo.size() > 0) { if (m_listAlgo.size() > 0) {
std::shared_ptr<T> algoEP = get<T>(m_listAlgo.size()-1); ememory::SharedPtr<T> algoEP = get<T>(m_listAlgo.size()-1);
if (algoEP != nullptr) { if (algoEP != nullptr) {
m_listAlgo.erase(m_listAlgo.begin()+m_listAlgo.size()-1); m_listAlgo.erase(m_listAlgo.begin()+m_listAlgo.size()-1);
} }
@ -158,7 +158,7 @@ namespace audio {
} }
template<typename T> bool hasType() { template<typename T> bool hasType() {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) { for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
std::shared_ptr<T> tmp = std::dynamic_pointer_cast<T>(m_listAlgo[iii]); ememory::SharedPtr<T> tmp = ememory::dynamicPointerCast<T>(m_listAlgo[iii]);
if (tmp != nullptr) { if (tmp != nullptr) {
return true; return true;
} }

View File

@ -24,8 +24,8 @@ void audio::drain::Resampler::init() {
m_residualTimeInResampler = audio::Duration(0); m_residualTimeInResampler = audio::Duration(0);
} }
std::shared_ptr<audio::drain::Resampler> audio::drain::Resampler::create() { ememory::SharedPtr<audio::drain::Resampler> audio::drain::Resampler::create() {
std::shared_ptr<audio::drain::Resampler> tmp(new audio::drain::Resampler()); ememory::SharedPtr<audio::drain::Resampler> tmp(new audio::drain::Resampler());
tmp->init(); tmp->init();
return tmp; return tmp;
} }

View File

@ -9,7 +9,7 @@
#ifdef HAVE_SPEEX_DSP_RESAMPLE #ifdef HAVE_SPEEX_DSP_RESAMPLE
#include <speex/speex_resampler.h> #include <speex/speex_resampler.h>
#endif #endif
#include <memory> #include <ememory/memory.h>
namespace audio { namespace audio {
namespace drain { namespace drain {
@ -29,7 +29,7 @@ namespace audio {
Resampler(); Resampler();
void init(); void init();
public: public:
static std::shared_ptr<audio::drain::Resampler> create(); static ememory::SharedPtr<audio::drain::Resampler> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */

View File

@ -22,8 +22,8 @@ void audio::drain::Volume::init() {
m_supportedFormat.push_back(audio::format_int16_on_int32); m_supportedFormat.push_back(audio::format_int16_on_int32);
} }
std::shared_ptr<audio::drain::Volume> audio::drain::Volume::create() { ememory::SharedPtr<audio::drain::Volume> audio::drain::Volume::create() {
std::shared_ptr<audio::drain::Volume> tmp(new audio::drain::Volume()); ememory::SharedPtr<audio::drain::Volume> tmp(new audio::drain::Volume());
tmp->init(); tmp->init();
return tmp; return tmp;
} }
@ -341,7 +341,7 @@ bool audio::drain::Volume::process(audio::Time& _time,
return true; return true;
} }
void audio::drain::Volume::addVolumeStage(const std::shared_ptr<audio::drain::VolumeElement>& _volume) { void audio::drain::Volume::addVolumeStage(const ememory::SharedPtr<audio::drain::VolumeElement>& _volume) {
if (_volume == nullptr) { if (_volume == nullptr) {
return; return;
} }

View File

@ -9,7 +9,7 @@
#ifdef HAVE_SPEEX_DSP_RESAMPLE #ifdef HAVE_SPEEX_DSP_RESAMPLE
#include <speex/speex_resampler.h> #include <speex/speex_resampler.h>
#endif #endif
#include <memory> #include <ememory/memory.h>
namespace audio { namespace audio {
namespace drain { namespace drain {
@ -54,7 +54,7 @@ namespace audio {
// TODO: Manage set volume // TODO: Manage set volume
class Volume : public audio::drain::Algo { class Volume : public audio::drain::Algo {
private: private:
std::vector<std::shared_ptr<drain::VolumeElement> > m_volumeList; std::vector<ememory::SharedPtr<drain::VolumeElement> > m_volumeList;
// for float input : // for float input :
float m_volumeAppli; float m_volumeAppli;
// for integer input : // for integer input :
@ -69,7 +69,7 @@ namespace audio {
Volume(); Volume();
void init(); void init();
public: public:
static std::shared_ptr<Volume> create(); static ememory::SharedPtr<Volume> create();
/** /**
* @brief Destructor * @brief Destructor
*/ */
@ -86,7 +86,7 @@ namespace audio {
virtual std::vector<audio::format> getFormatSupportedInput(); virtual std::vector<audio::format> getFormatSupportedInput();
virtual std::vector<audio::format> getFormatSupportedOutput(); virtual std::vector<audio::format> getFormatSupportedOutput();
public: public:
virtual void addVolumeStage(const std::shared_ptr<drain::VolumeElement>& _volume); virtual void addVolumeStage(const ememory::SharedPtr<drain::VolumeElement>& _volume);
virtual bool setParameter(const std::string& _parameter, const std::string& _value); virtual bool setParameter(const std::string& _parameter, const std::string& _value);
virtual std::string getParameter(const std::string& _parameter) const; virtual std::string getParameter(const std::string& _parameter) const;
virtual std::string getParameterProperty(const std::string& _parameter) const; virtual std::string getParameterProperty(const std::string& _parameter) const;

View File

@ -70,23 +70,23 @@ void appl::Windows::init() {
if (m_gui != nullptr) { if (m_gui != nullptr) {
setSubWidget(m_gui); setSubWidget(m_gui);
} }
subBind(ewol::widget::Button, "sample-rate-low", signalPressed, shared_from_this(), &appl::Windows::onCallbackSampleRateLow); subBind(ewol::widget::Button, "sample-rate-low", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSampleRateLow);
subBind(ewol::widget::Button, "sample-rate-up", signalPressed, shared_from_this(), &appl::Windows::onCallbackSampleRateUp); subBind(ewol::widget::Button, "sample-rate-up", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSampleRateUp);
subBind(ewol::widget::Button, "type-low", signalPressed, shared_from_this(), &appl::Windows::onCallbackTypeLow); subBind(ewol::widget::Button, "type-low", signalPressed, sharedFromThis(), &appl::Windows::onCallbackTypeLow);
subBind(ewol::widget::Button, "type-up", signalPressed, shared_from_this(), &appl::Windows::onCallbackTypeUp); subBind(ewol::widget::Button, "type-up", signalPressed, sharedFromThis(), &appl::Windows::onCallbackTypeUp);
subBind(ewol::widget::Entry, "gain", signalModify, shared_from_this(), &appl::Windows::onCallbackGain); subBind(ewol::widget::Entry, "gain", signalModify, sharedFromThis(), &appl::Windows::onCallbackGain);
subBind(ewol::widget::Slider, "gain-slider", signalChange, shared_from_this(), &appl::Windows::onCallbackGainSlider); subBind(ewol::widget::Slider, "gain-slider", signalChange, sharedFromThis(), &appl::Windows::onCallbackGainSlider);
subBind(ewol::widget::Entry, "frequency", signalModify, shared_from_this(), &appl::Windows::onCallbackFrequency); subBind(ewol::widget::Entry, "frequency", signalModify, sharedFromThis(), &appl::Windows::onCallbackFrequency);
subBind(ewol::widget::Slider, "frequency-slider", signalChange, shared_from_this(), &appl::Windows::onCallbackFrequencySlider); subBind(ewol::widget::Slider, "frequency-slider", signalChange, sharedFromThis(), &appl::Windows::onCallbackFrequencySlider);
subBind(ewol::widget::Entry, "quality", signalModify, shared_from_this(), &appl::Windows::onCallbackQuality); subBind(ewol::widget::Entry, "quality", signalModify, sharedFromThis(), &appl::Windows::onCallbackQuality);
subBind(ewol::widget::Slider, "quality-slider", signalChange, shared_from_this(), &appl::Windows::onCallbackQualitySlider); subBind(ewol::widget::Slider, "quality-slider", signalChange, sharedFromThis(), &appl::Windows::onCallbackQualitySlider);
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16); subBind(ewol::widget::Button, "display16", signalPressed, sharedFromThis(), &appl::Windows::onCallbackStart16);
subBind(ewol::widget::Button, "displayFloat", signalPressed, shared_from_this(), &appl::Windows::onCallbackStartFloat); subBind(ewol::widget::Button, "displayFloat", signalPressed, sharedFromThis(), &appl::Windows::onCallbackStartFloat);
m_displayer = std::dynamic_pointer_cast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer")); m_displayer = ememory::dynamicPointerCast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer"));
onCallbackStart(); onCallbackStart();
} }

View File

@ -19,8 +19,8 @@ namespace appl {
public: public:
DECLARE_FACTORY(Windows); DECLARE_FACTORY(Windows);
protected: protected:
std::shared_ptr<ewol::widget::Composer> m_gui; ememory::SharedPtr<ewol::widget::Composer> m_gui;
std::shared_ptr<appl::widget::DisplayFrequency> m_displayer; ememory::SharedPtr<appl::widget::DisplayFrequency> m_displayer;
void onCallbackSampleRateLow(); void onCallbackSampleRateLow();
void onCallbackSampleRateUp(); void onCallbackSampleRateUp();
void onCallbackTypeUp(); void onCallbackTypeUp();

View File

@ -32,7 +32,7 @@ class MainApplication : public ewol::context::Application {
// add local widget list: // add local widget list:
appl::widget::DisplayFrequency::createManagerWidget(_context.getWidgetManager()); appl::widget::DisplayFrequency::createManagerWidget(_context.getWidgetManager());
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)"); APPL_INFO("==> Init APPL (END)");

View File

@ -57,23 +57,23 @@ void appl::Windows::init() {
if (m_gui != nullptr) { if (m_gui != nullptr) {
setSubWidget(m_gui); setSubWidget(m_gui);
} }
subBind(ewol::widget::Button, "sample-rate-low", signalPressed, shared_from_this(), &appl::Windows::onCallbackSampleRateLow); subBind(ewol::widget::Button, "sample-rate-low", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSampleRateLow);
subBind(ewol::widget::Button, "sample-rate-up", signalPressed, shared_from_this(), &appl::Windows::onCallbackSampleRateUp); subBind(ewol::widget::Button, "sample-rate-up", signalPressed, sharedFromThis(), &appl::Windows::onCallbackSampleRateUp);
subBind(ewol::widget::Slider, "gain-0", signalChange, shared_from_this(), &appl::Windows::onCallbackGain0); subBind(ewol::widget::Slider, "gain-0", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain0);
subBind(ewol::widget::Slider, "gain-1", signalChange, shared_from_this(), &appl::Windows::onCallbackGain1); subBind(ewol::widget::Slider, "gain-1", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain1);
subBind(ewol::widget::Slider, "gain-2", signalChange, shared_from_this(), &appl::Windows::onCallbackGain2); subBind(ewol::widget::Slider, "gain-2", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain2);
subBind(ewol::widget::Slider, "gain-3", signalChange, shared_from_this(), &appl::Windows::onCallbackGain3); subBind(ewol::widget::Slider, "gain-3", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain3);
subBind(ewol::widget::Slider, "gain-4", signalChange, shared_from_this(), &appl::Windows::onCallbackGain4); subBind(ewol::widget::Slider, "gain-4", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain4);
subBind(ewol::widget::Slider, "gain-5", signalChange, shared_from_this(), &appl::Windows::onCallbackGain5); subBind(ewol::widget::Slider, "gain-5", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain5);
subBind(ewol::widget::Slider, "gain-6", signalChange, shared_from_this(), &appl::Windows::onCallbackGain6); subBind(ewol::widget::Slider, "gain-6", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain6);
subBind(ewol::widget::Slider, "gain-7", signalChange, shared_from_this(), &appl::Windows::onCallbackGain7); subBind(ewol::widget::Slider, "gain-7", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain7);
subBind(ewol::widget::Slider, "gain-8", signalChange, shared_from_this(), &appl::Windows::onCallbackGain8); subBind(ewol::widget::Slider, "gain-8", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain8);
subBind(ewol::widget::Slider, "gain-9", signalChange, shared_from_this(), &appl::Windows::onCallbackGain9); subBind(ewol::widget::Slider, "gain-9", signalChange, sharedFromThis(), &appl::Windows::onCallbackGain9);
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16); subBind(ewol::widget::Button, "display16", signalPressed, sharedFromThis(), &appl::Windows::onCallbackStart16);
subBind(ewol::widget::Button, "displayFloat", signalPressed, shared_from_this(), &appl::Windows::onCallbackStartFloat); subBind(ewol::widget::Button, "displayFloat", signalPressed, sharedFromThis(), &appl::Windows::onCallbackStartFloat);
m_displayer = std::dynamic_pointer_cast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer")); m_displayer = ememory::dynamicPointerCast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer"));
onCallbackStart(); onCallbackStart();
} }
@ -121,12 +121,12 @@ void appl::Windows::onCallbackGain(const float& _value, int32_t _id) {
onCallbackStart(); onCallbackStart();
} }
std::shared_ptr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum audio::format _format) { ememory::SharedPtr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum audio::format _format) {
std::vector<audio::channel> map; std::vector<audio::channel> map;
map.push_back(audio::channel_frontCenter); map.push_back(audio::channel_frontCenter);
audio::drain::IOFormatInterface format(map, _format, m_sampleRate); audio::drain::IOFormatInterface format(map, _format, m_sampleRate);
// create equalizer // create equalizer
std::shared_ptr<audio::drain::Equalizer> out = audio::drain::Equalizer::create(); ememory::SharedPtr<audio::drain::Equalizer> out = audio::drain::Equalizer::create();
// configure input // configure input
out->setInputFormat(format); out->setInputFormat(format);
// configure output // configure output
@ -171,7 +171,7 @@ std::shared_ptr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum aud
void appl::Windows::onCallbackStart() { void appl::Windows::onCallbackStart() {
APPL_INFO("start "); APPL_INFO("start ");
std::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(); ememory::SharedPtr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer();
std::vector<std::pair<float,float> > theory = eq->calculateTheory(); std::vector<std::pair<float,float> > theory = eq->calculateTheory();
m_displayer->clear(); m_displayer->clear();
m_displayer->setValue(theory); m_displayer->setValue(theory);
@ -180,7 +180,7 @@ void appl::Windows::onCallbackStart() {
void appl::Windows::onCallbackStart16() { void appl::Windows::onCallbackStart16() {
APPL_INFO("start "); APPL_INFO("start ");
std::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_int16); ememory::SharedPtr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_int16);
std::vector<std::pair<float,float> > pratic; std::vector<std::pair<float,float> > pratic;
size_t len = 512; size_t len = 512;
std::vector<int16_t> data; std::vector<int16_t> data;
@ -221,7 +221,7 @@ void appl::Windows::onCallbackStart16() {
void appl::Windows::onCallbackStartFloat() { void appl::Windows::onCallbackStartFloat() {
APPL_INFO("start "); APPL_INFO("start ");
std::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_float); ememory::SharedPtr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_float);
std::vector<std::pair<float,float> > pratic; std::vector<std::pair<float,float> > pratic;
size_t len = 512; size_t len = 512;
std::vector<float> data; std::vector<float> data;

View File

@ -19,8 +19,8 @@ namespace appl {
public: public:
DECLARE_FACTORY(Windows); DECLARE_FACTORY(Windows);
protected: protected:
std::shared_ptr<ewol::widget::Composer> m_gui; ememory::SharedPtr<ewol::widget::Composer> m_gui;
std::shared_ptr<appl::widget::DisplayFrequency> m_displayer; ememory::SharedPtr<appl::widget::DisplayFrequency> m_displayer;
void onCallbackSampleRateLow(); void onCallbackSampleRateLow();
void onCallbackSampleRateUp(); void onCallbackSampleRateUp();
void onCallbackGain0(const float& _value) { void onCallbackGain0(const float& _value) {
@ -62,7 +62,7 @@ namespace appl {
std::vector<int32_t> m_listSampleRate; std::vector<int32_t> m_listSampleRate;
std::vector<float> m_listGain; std::vector<float> m_listGain;
std::shared_ptr<audio::drain::Equalizer> createEqualizer(enum audio::format _format = audio::format_float); ememory::SharedPtr<audio::drain::Equalizer> createEqualizer(enum audio::format _format = audio::format_float);
}; };
} }

View File

@ -32,7 +32,7 @@ class MainApplication : public ewol::context::Application {
// add local widget list: // add local widget list:
appl::widget::DisplayFrequency::createManagerWidget(_context.getWidgetManager()); appl::widget::DisplayFrequency::createManagerWidget(_context.getWidgetManager());
std::shared_ptr<ewol::widget::Windows> basicWindows = appl::Windows::create(); ememory::SharedPtr<ewol::widget::Windows> basicWindows = appl::Windows::create();
// create the specific windows // create the specific windows
_context.setWindows(basicWindows); _context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)"); APPL_INFO("==> Init APPL (END)");