[DEV] update of external of elog and ethread

This commit is contained in:
Edouard DUPIN 2016-03-08 21:29:34 +01:00
parent 0ba0243081
commit 57952d4060
33 changed files with 122 additions and 122 deletions

View File

@ -21,8 +21,8 @@ audio::drain::Algo::Algo() :
void audio::drain::Algo::init() {
// set notification callback :
m_input.setCallback(std11::bind(&audio::drain::Algo::configurationChangeLocal, this));
m_output.setCallback(std11::bind(&audio::drain::Algo::configurationChangeLocal, this));
m_input.setCallback(std::bind(&audio::drain::Algo::configurationChangeLocal, this));
m_output.setCallback(std::bind(&audio::drain::Algo::configurationChangeLocal, this));
// first configure ==> update the internal parameters
configurationChange();
}

View File

@ -21,8 +21,8 @@
namespace audio {
namespace drain{
typedef std11::function<void (const std::string& _origin, const std::string& _status)> algoStatusFunction;
class Algo : public std11::enable_shared_from_this<Algo> {
typedef std::function<void (const std::string& _origin, const std::string& _status)> algoStatusFunction;
class Algo : public std::enable_shared_from_this<Algo> {
private:
std::string m_name;
public:

View File

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

View File

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

View File

@ -75,7 +75,7 @@ void audio::drain::CircularBuffer::setCapacity(size_t _capacity, size_t _chunkSi
m_write = &m_data[0];
}
void audio::drain::CircularBuffer::setCapacity(std11::chrono::milliseconds _capacity, size_t _chunkSize, uint32_t _frequency) {
void audio::drain::CircularBuffer::setCapacity(std::chrono::milliseconds _capacity, size_t _chunkSize, uint32_t _frequency) {
uint32_t nbSampleNeeded = _frequency*_capacity.count()/1000;
DRAIN_DEBUG("buffer setCapacity(" << _capacity.count() << "ms ," << _chunkSize << ")");
setCapacity(nbSampleNeeded, _chunkSize, _frequency);
@ -212,7 +212,7 @@ size_t audio::drain::CircularBuffer::read(void* _data, size_t _nbChunk, const au
DRAIN_VERBOSE("crop nb sample : m_size=" << m_size << " _nbChunk=" << _nbChunk);
_nbChunk = m_size;
}
m_timeRead += std11::chrono::microseconds(_nbChunk*1000000/m_frequency);
m_timeRead += std::chrono::microseconds(_nbChunk*1000000/m_frequency);
if (usedSizeBeforeEnd >= _nbChunk) {
// all Data will be copy
memcpy(_data, m_read, _nbChunk * m_sizeChunk);

View File

@ -75,9 +75,9 @@ namespace audio {
* @param[in] _chunkSize Size of one chunk.
* @param[in] _frequency Frequency of the buffer
*/
void setCapacity(std11::chrono::milliseconds _capacity, size_t _chunkSize, uint32_t _frequency);
void setCapacity(std11::chrono::microseconds _capacity, size_t _chunkSize, uint32_t _frequency) {
setCapacity(std11::chrono::milliseconds(_capacity.count()/1000), _chunkSize, _frequency);
void setCapacity(std::chrono::milliseconds _capacity, size_t _chunkSize, uint32_t _frequency);
void setCapacity(std::chrono::microseconds _capacity, size_t _chunkSize, uint32_t _frequency) {
setCapacity(std::chrono::milliseconds(_capacity.count()/1000), _chunkSize, _frequency);
}
/**
* @brief get free size of the buffer.

View File

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

View File

@ -10,13 +10,13 @@
namespace audio {
namespace drain {
typedef std11::function<void (void* _data,
typedef std::function<void (void* _data,
const audio::Time& _playTime,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
const std::vector<audio::channel>& _map)> playbackFunction;
typedef std11::function<void (const void* _data,
typedef std::function<void (const void* _data,
const audio::Time& _readTime,
size_t _nbChunk,
enum audio::format _format,
@ -34,8 +34,8 @@ namespace audio {
void init(playbackFunction _callback);
void init(recordFunction _callback);
public:
static std11::shared_ptr<EndPointCallback> create(playbackFunction _callback);
static std11::shared_ptr<EndPointCallback> create(recordFunction _callback);
static std::shared_ptr<EndPointCallback> create(playbackFunction _callback);
static std::shared_ptr<EndPointCallback> create(recordFunction _callback);
/**
* @brief Destructor
*/

View File

@ -20,8 +20,8 @@ void audio::drain::EndPointRead::init() {
m_type = "EndPointRead";
}
std11::shared_ptr<audio::drain::EndPointRead> audio::drain::EndPointRead::create() {
std11::shared_ptr<audio::drain::EndPointRead> tmp(new audio::drain::EndPointRead());
std::shared_ptr<audio::drain::EndPointRead> audio::drain::EndPointRead::create() {
std::shared_ptr<audio::drain::EndPointRead> tmp(new audio::drain::EndPointRead());
tmp->init();
return tmp;
}
@ -45,7 +45,7 @@ void audio::drain::EndPointRead::setBufferSize(size_t _nbChunk) {
DRAIN_TODO("...");
}
void audio::drain::EndPointRead::setBufferSize(const std11::chrono::microseconds& _time) {
void audio::drain::EndPointRead::setBufferSize(const std::chrono::microseconds& _time) {
DRAIN_TODO("...");
}
@ -54,9 +54,9 @@ size_t audio::drain::EndPointRead::getBufferSize() {
return 0;
}
std11::chrono::microseconds audio::drain::EndPointRead::getBufferSizeMicrosecond() {
std::chrono::microseconds audio::drain::EndPointRead::getBufferSizeMicrosecond() {
DRAIN_TODO("...");
return std11::chrono::microseconds(0);
return std::chrono::microseconds(0);
}
size_t audio::drain::EndPointRead::getBufferFillSize() {
@ -64,8 +64,8 @@ size_t audio::drain::EndPointRead::getBufferFillSize() {
return 0;
}
std11::chrono::microseconds audio::drain::EndPointRead::getBufferFillSizeMicrosecond() {
std::chrono::microseconds audio::drain::EndPointRead::getBufferFillSizeMicrosecond() {
DRAIN_TODO("...");
return std11::chrono::microseconds(0);
return std::chrono::microseconds(0);
}

View File

@ -17,7 +17,7 @@ namespace audio {
EndPointRead();
void init();
public:
static std11::shared_ptr<EndPointRead> create();
static std::shared_ptr<EndPointRead> create();
/**
* @brief Destructor
*/
@ -37,7 +37,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs
* @param[in] _time Time in microsecond of the buffer
*/
virtual void setBufferSize(const std11::chrono::microseconds& _time);
virtual void setBufferSize(const std::chrono::microseconds& _time);
/**
* @brief get buffer size in chunk number
* @return Number of chunk that can be written in the buffer
@ -47,7 +47,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs
* @return Time in microsecond that can be written in the buffer
*/
virtual std11::chrono::microseconds getBufferSizeMicrosecond();
virtual std::chrono::microseconds getBufferSizeMicrosecond();
/**
* @brief Get buffer size filled in chunk number
* @return Number of chunk in the buffer (that might be read/write)
@ -57,7 +57,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs
* @return Time in microsecond of the buffer (that might be read/write)
*/
virtual std11::chrono::microseconds getBufferFillSizeMicrosecond();
virtual std::chrono::microseconds getBufferFillSizeMicrosecond();
};
}
}

View File

@ -27,8 +27,8 @@ void audio::drain::EndPointWrite::init() {
}
}
std11::shared_ptr<audio::drain::EndPointWrite> audio::drain::EndPointWrite::create() {
std11::shared_ptr<audio::drain::EndPointWrite> tmp(new audio::drain::EndPointWrite());
std::shared_ptr<audio::drain::EndPointWrite> audio::drain::EndPointWrite::create() {
std::shared_ptr<audio::drain::EndPointWrite> tmp(new audio::drain::EndPointWrite());
tmp->init();
return tmp;
}
@ -38,7 +38,7 @@ void audio::drain::EndPointWrite::configurationChange() {
// update the buffer size ...
if ( audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size() != 0
&& m_output.getFrequency() != 0) {
if (std11::chrono::microseconds(0) != m_bufferSizeMicroseconds) {
if (std::chrono::microseconds(0) != m_bufferSizeMicroseconds) {
m_buffer.setCapacity(m_bufferSizeMicroseconds,
audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size(),
m_output.getFrequency());
@ -71,7 +71,7 @@ bool audio::drain::EndPointWrite::process(audio::Time& _time,
// set output pointer:
_outputNbChunk = m_outputData.size()/(m_formatSize*m_output.getMap().size());
_output = &m_outputData[0];
std11::unique_lock<std11::mutex> lock(m_mutex);
std::unique_lock<std::mutex> lock(m_mutex);
// check if data in the tmpBuffer
if (m_buffer.getSize() == 0) {
DRAIN_WARNING("No data in the user buffer (write null data ... " << _outputNbChunk << " chunks)");
@ -100,7 +100,7 @@ bool audio::drain::EndPointWrite::process(audio::Time& _time,
}
void audio::drain::EndPointWrite::write(const void* _value, size_t _nbChunk) {
std11::unique_lock<std11::mutex> lock(m_mutex);
std::unique_lock<std::mutex> lock(m_mutex);
DRAIN_VERBOSE("[ASYNC] Write data : " << _nbChunk << " chunks" << " ==> " << m_output);
int32_t nbOverflow = m_buffer.write(_value, _nbChunk);
if (nbOverflow > 0) {
@ -109,7 +109,7 @@ void audio::drain::EndPointWrite::write(const void* _value, size_t _nbChunk) {
}
void audio::drain::EndPointWrite::setBufferSize(size_t _nbChunk) {
m_bufferSizeMicroseconds = std11::chrono::microseconds(0);
m_bufferSizeMicroseconds = std::chrono::microseconds(0);
m_bufferSizeChunk = _nbChunk;
if ( audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size() != 0
&& m_output.getFrequency() != 0) {
@ -119,7 +119,7 @@ void audio::drain::EndPointWrite::setBufferSize(size_t _nbChunk) {
}
}
void audio::drain::EndPointWrite::setBufferSize(const std11::chrono::microseconds& _time) {
void audio::drain::EndPointWrite::setBufferSize(const std::chrono::microseconds& _time) {
m_bufferSizeMicroseconds = _time;
m_bufferSizeChunk = 0;
m_buffer.setCapacity(_time,
@ -134,17 +134,17 @@ size_t audio::drain::EndPointWrite::getBufferSize() {
return (int64_t(m_output.getFrequency())*m_bufferSizeMicroseconds.count())/1000000LL;
}
std11::chrono::microseconds audio::drain::EndPointWrite::getBufferSizeMicrosecond() {
if (m_bufferSizeMicroseconds != std11::chrono::microseconds(0) ) {
std::chrono::microseconds audio::drain::EndPointWrite::getBufferSizeMicrosecond() {
if (m_bufferSizeMicroseconds != std::chrono::microseconds(0) ) {
return m_bufferSizeMicroseconds;
}
return std11::chrono::microseconds(m_bufferSizeChunk*1000000LL/int64_t(m_output.getFrequency()));
return std::chrono::microseconds(m_bufferSizeChunk*1000000LL/int64_t(m_output.getFrequency()));
}
size_t audio::drain::EndPointWrite::getBufferFillSize() {
return m_buffer.getSize()/(audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size());
}
std11::chrono::microseconds audio::drain::EndPointWrite::getBufferFillSizeMicrosecond() {
return std11::chrono::microseconds(getBufferFillSize()*1000000LL/int64_t(m_output.getFrequency()));
std::chrono::microseconds audio::drain::EndPointWrite::getBufferFillSizeMicrosecond() {
return std::chrono::microseconds(getBufferFillSize()*1000000LL/int64_t(m_output.getFrequency()));
}

View File

@ -12,7 +12,7 @@
namespace audio {
namespace drain{
typedef std11::function<void (const audio::Time& _time,
typedef std::function<void (const audio::Time& _time,
size_t _nbChunk,
enum audio::format _format,
uint32_t _frequency,
@ -21,7 +21,7 @@ namespace audio {
private:
audio::drain::CircularBuffer m_buffer;
playbackFunctionWrite m_function;
std11::mutex m_mutex;
std::mutex m_mutex;
protected:
/**
* @brief Constructor
@ -29,7 +29,7 @@ namespace audio {
EndPointWrite();
void init();
public:
static std11::shared_ptr<audio::drain::EndPointWrite> create();
static std::shared_ptr<audio::drain::EndPointWrite> create();
/**
* @brief Destructor
*/
@ -45,7 +45,7 @@ namespace audio {
m_function = _function;
}
protected:
std11::chrono::microseconds m_bufferSizeMicroseconds; // 0 if m_bufferSizeChunk != 0
std::chrono::microseconds m_bufferSizeMicroseconds; // 0 if m_bufferSizeChunk != 0
size_t m_bufferSizeChunk; // 0 if m_bufferSizeMicroseconds != 0
public:
/**
@ -57,7 +57,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs
* @param[in] _time Time in microsecond of the buffer
*/
virtual void setBufferSize(const std11::chrono::microseconds& _time);
virtual void setBufferSize(const std::chrono::microseconds& _time);
/**
* @brief get buffer size in chunk number
* @return Number of chunk that can be written in the buffer
@ -67,7 +67,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs
* @return Time in microsecond that can be written in the buffer
*/
virtual std11::chrono::microseconds getBufferSizeMicrosecond();
virtual std::chrono::microseconds getBufferSizeMicrosecond();
/**
* @brief Get buffer size filled in chunk number
* @return Number of chunk in the buffer (that might be read/write)
@ -77,7 +77,7 @@ namespace audio {
* @brief Set buffer size size of the buffer with the stored time in µs
* @return Time in microsecond of the buffer (that might be read/write)
*/
virtual std11::chrono::microseconds getBufferFillSizeMicrosecond();
virtual std::chrono::microseconds getBufferFillSizeMicrosecond();
};
}
}

View File

@ -23,8 +23,8 @@ void audio::drain::Equalizer::init() {
configureBiQuad();
}
std11::shared_ptr<audio::drain::Equalizer> audio::drain::Equalizer::create() {
std11::shared_ptr<audio::drain::Equalizer> tmp(new audio::drain::Equalizer());
std::shared_ptr<audio::drain::Equalizer> audio::drain::Equalizer::create() {
std::shared_ptr<audio::drain::Equalizer> tmp(new audio::drain::Equalizer());
tmp->init();
return tmp;
}
@ -72,7 +72,7 @@ std::string audio::drain::Equalizer::getParameterProperty(const std::string& _pa
return "error";
}
void audio::drain::Equalizer::addBiquad(int32_t _idBiquad, const std11::shared_ptr<const ejson::Object>& _object) {
void audio::drain::Equalizer::addBiquad(int32_t _idBiquad, const std::shared_ptr<const ejson::Object>& _object) {
// get type:
std::string typeString = _object->getStringValue("type", "none");
if (typeString == "direct-value") {
@ -110,11 +110,11 @@ void audio::drain::Equalizer::configureBiQuad() {
return;
}
// check for a global config:
const std11::shared_ptr<const ejson::Array> global = m_config->getArray("global");
const std::shared_ptr<const ejson::Array> global = m_config->getArray("global");
if (global != nullptr) {
// only global configuration get all elements:
for (size_t kkk=0; kkk<global->size(); ++kkk) {
const std11::shared_ptr<const ejson::Object> tmpObject = global->getObject(kkk);
const std::shared_ptr<const ejson::Object> tmpObject = global->getObject(kkk);
if (tmpObject == nullptr) {
DRAIN_ERROR("Parse the configuration error : not a correct parameter:" << kkk);
continue;
@ -126,14 +126,14 @@ void audio::drain::Equalizer::configureBiQuad() {
}
for (size_t iii=0; iii<getOutputFormat().getMap().size(); ++iii) {
std::string channelName = etk::to_string(getOutputFormat().getMap()[iii]);
const std11::shared_ptr<const ejson::Array> channelConfig = m_config->getArray(channelName);
const std::shared_ptr<const ejson::Array> channelConfig = m_config->getArray(channelName);
if (channelConfig == nullptr) {
// no config ... not a problem ...
continue;
}
// only global configuration get all elements:
for (size_t kkk=0; kkk<channelConfig->size(); ++kkk) {
const std11::shared_ptr<const ejson::Object> tmpObject = channelConfig->getObject(kkk);
const std::shared_ptr<const ejson::Object> tmpObject = channelConfig->getObject(kkk);
if (tmpObject == nullptr) {
DRAIN_ERROR("Parse the configuration error : not a correct parameter:" << kkk);
continue;

View File

@ -20,7 +20,7 @@ namespace audio {
Equalizer();
void init();
public:
static std11::shared_ptr<audio::drain::Equalizer> create();
static std::shared_ptr<audio::drain::Equalizer> create();
/**
* @brief Destructor
*/
@ -34,13 +34,13 @@ namespace audio {
void*& _output,
size_t& _outputNbChunk);
protected:
std11::shared_ptr<ejson::Object> m_config; // configuration of the equalizer.
std::shared_ptr<ejson::Object> m_config; // configuration of the equalizer.
public:
virtual bool setParameter(const std::string& _parameter, const std::string& _value);
virtual std::string getParameter(const std::string& _parameter) const;
virtual std::string getParameterProperty(const std::string& _parameter) const;
protected:
void addBiquad(int32_t _idBiquad, const std11::shared_ptr<const ejson::Object>& _object);
void addBiquad(int32_t _idBiquad, const std::shared_ptr<const ejson::Object>& _object);
audio::algo::drain::Equalizer m_algo;
/**
* @brief Configure biquad with the user spec.

View File

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

View File

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

View File

@ -113,7 +113,7 @@ void audio::drain::IOFormatInterface::configurationChange() {
m_ioChangeFunctor();
}
}
void audio::drain::IOFormatInterface::setCallback(const std11::function<void()>& _functor) {
void audio::drain::IOFormatInterface::setCallback(const std::function<void()>& _functor) {
m_ioChangeFunctor = _functor;
}

View File

@ -74,14 +74,14 @@ namespace audio {
*/
int32_t getChunkSize() const;
protected:
std11::function<void()> m_ioChangeFunctor; //!< function pointer on the upper class
std::function<void()> m_ioChangeFunctor; //!< function pointer on the upper class
void configurationChange();
public:
/**
* @brief Set the callback function to be notify when the arameter change.
* @param[in] _functor Function to call.
*/
void setCallback(const std11::function<void()>& _functor);
void setCallback(const std::function<void()>& _functor);
};
std::ostream& operator <<(std::ostream& _os, const audio::drain::IOFormatInterface& _obj);
}

View File

@ -104,15 +104,15 @@ bool audio::drain::Process::process(audio::Time& _time,
return true;
}
void audio::drain::Process::pushBack(const std11::shared_ptr<audio::drain::Algo>& _algo) {
void audio::drain::Process::pushBack(const std::shared_ptr<audio::drain::Algo>& _algo) {
removeAlgoDynamic();
_algo->setStatusFunction(std11::bind(&audio::drain::Process::generateStatus, this, std11::placeholders::_1, std11::placeholders::_2));
_algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.push_back(_algo);
}
void audio::drain::Process::pushFront(const std11::shared_ptr<audio::drain::Algo>& _algo) {
void audio::drain::Process::pushFront(const std::shared_ptr<audio::drain::Algo>& _algo) {
removeAlgoDynamic();
_algo->setStatusFunction(std11::bind(&audio::drain::Process::generateStatus, this, std11::placeholders::_1, std11::placeholders::_2));
_algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.insert(m_listAlgo.begin(), _algo);
}
@ -337,23 +337,23 @@ void audio::drain::Process::updateAlgo(size_t _position) {
if ( out.getFormat() != audio::format_int16
/* && out.getFormat() != format_float */) {
// need add a format Updater
std11::shared_ptr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create();
std::shared_ptr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setFormat(audio::format_int16);
algo->setOutputFormat(out);
algo->setStatusFunction(std11::bind(&audio::drain::Process::generateStatus, this, std11::placeholders::_1, std11::placeholders::_2));
algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
_position++;
}
// need add a resampler
std11::shared_ptr<audio::drain::Resampler> algo = audio::drain::Resampler::create();
std::shared_ptr<audio::drain::Resampler> algo = audio::drain::Resampler::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setFrequency(in.getFrequency());
algo->setOutputFormat(out);
algo->setStatusFunction(std11::bind(&audio::drain::Process::generateStatus, this, std11::placeholders::_1, std11::placeholders::_2));
algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
DRAIN_VERBOSE("convert " << out.getFrequency() << " -> " << in.getFrequency());
out.setFrequency(in.getFrequency());
@ -361,24 +361,24 @@ void audio::drain::Process::updateAlgo(size_t _position) {
}
if (out.getMap() != in.getMap()) {
// need add a channel Reorder
std11::shared_ptr<audio::drain::ChannelReorder> algo = audio::drain::ChannelReorder::create();
std::shared_ptr<audio::drain::ChannelReorder> algo = audio::drain::ChannelReorder::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setMap(in.getMap());
algo->setOutputFormat(out);
algo->setStatusFunction(std11::bind(&audio::drain::Process::generateStatus, this, std11::placeholders::_1, std11::placeholders::_2));
algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
DRAIN_VERBOSE("convert " << out.getMap() << " -> " << in.getMap());
_position++;
}
if (out.getFormat() != in.getFormat()) {
// need add a format Updater
std11::shared_ptr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create();
std::shared_ptr<audio::drain::FormatUpdate> algo = audio::drain::FormatUpdate::create();
algo->setTemporary();
algo->setInputFormat(out);
out.setFormat(in.getFormat());
algo->setOutputFormat(out);
algo->setStatusFunction(std11::bind(&audio::drain::Process::generateStatus, this, std11::placeholders::_1, std11::placeholders::_2));
algo->setStatusFunction(std::bind(&audio::drain::Process::generateStatus, this, std::placeholders::_1, std::placeholders::_2));
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
_position++;

View File

@ -17,7 +17,7 @@
namespace audio {
namespace drain{
typedef std11::function<void (const std::string& _origin, const std::string& _status)> statusFunction;
typedef std::function<void (const std::string& _origin, const std::string& _status)> statusFunction;
class Process {
protected:
std::vector<int8_t> m_data; //!< temporary overlap output buffer (change size of the output data)
@ -94,10 +94,10 @@ namespace audio {
m_outputConfig = _interface;
}
protected:
std::vector<std11::shared_ptr<drain::Algo> > m_listAlgo;
std::vector<std::shared_ptr<drain::Algo> > m_listAlgo;
public:
void pushBack(const std11::shared_ptr<drain::Algo>& _algo);
void pushFront(const std11::shared_ptr<drain::Algo>& _algo);
void pushBack(const std::shared_ptr<drain::Algo>& _algo);
void pushFront(const std::shared_ptr<drain::Algo>& _algo);
void clear() {
m_isConfigured = false;
m_listAlgo.clear();
@ -105,44 +105,44 @@ namespace audio {
size_t size() {
return m_listAlgo.size();
}
std::vector<std11::shared_ptr<drain::Algo> >::iterator begin() {
std::vector<std::shared_ptr<drain::Algo> >::iterator begin() {
return m_listAlgo.begin();
}
std::vector<std11::shared_ptr<drain::Algo> >::iterator end() {
std::vector<std::shared_ptr<drain::Algo> >::iterator end() {
return m_listAlgo.end();
}
std11::shared_ptr<drain::Algo> operator[](int32_t _id) {
std::shared_ptr<drain::Algo> operator[](int32_t _id) {
return m_listAlgo[_id];
}
template<typename T> std11::shared_ptr<T> get(const std::string& _name) {
template<typename T> std::shared_ptr<T> get(const std::string& _name) {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
if (m_listAlgo[iii] == nullptr) {
continue;
}
if (m_listAlgo[iii]->getName() == _name) {
return std11::dynamic_pointer_cast<T>(m_listAlgo[iii]);
return std::dynamic_pointer_cast<T>(m_listAlgo[iii]);
}
}
return std11::shared_ptr<T>();
return std::shared_ptr<T>();
}
template<typename T> std11::shared_ptr<const T> get(const std::string& _name) const {
template<typename T> std::shared_ptr<const T> get(const std::string& _name) const {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
if (m_listAlgo[iii] == nullptr) {
continue;
}
if (m_listAlgo[iii]->getName() == _name) {
return std11::dynamic_pointer_cast<T>(m_listAlgo[iii]);
return std::dynamic_pointer_cast<T>(m_listAlgo[iii]);
}
}
return std11::shared_ptr<const T>();
return std::shared_ptr<const T>();
}
template<typename T> std11::shared_ptr<T> get(int32_t _id) {
return std11::dynamic_pointer_cast<T>(m_listAlgo[_id]);
template<typename T> std::shared_ptr<T> get(int32_t _id) {
return std::dynamic_pointer_cast<T>(m_listAlgo[_id]);
}
template<typename T> void removeIfFirst() {
if (m_listAlgo.size() > 0) {
std11::shared_ptr<T> algoEP = get<T>(0);
std::shared_ptr<T> algoEP = get<T>(0);
if (algoEP != nullptr) {
m_listAlgo.erase(m_listAlgo.begin());
}
@ -150,7 +150,7 @@ namespace audio {
}
template<typename T> void removeIfLast() {
if (m_listAlgo.size() > 0) {
std11::shared_ptr<T> algoEP = get<T>(m_listAlgo.size()-1);
std::shared_ptr<T> algoEP = get<T>(m_listAlgo.size()-1);
if (algoEP != nullptr) {
m_listAlgo.erase(m_listAlgo.begin()+m_listAlgo.size()-1);
}
@ -158,7 +158,7 @@ namespace audio {
}
template<typename T> bool hasType() {
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
std11::shared_ptr<T> tmp = std11::dynamic_pointer_cast<T>(m_listAlgo[iii]);
std::shared_ptr<T> tmp = std::dynamic_pointer_cast<T>(m_listAlgo[iii]);
if (tmp != nullptr) {
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,6 @@
int32_t audio::drain::getLogId() {
static int32_t g_val = etk::log::registerInstance("audio-drain");
static int32_t g_val = elog::registerInstance("audio-drain");
return g_val;
}

View File

@ -7,14 +7,14 @@
#ifndef __AUDIO_DRAIN_DEBUG_H__
#define __AUDIO_DRAIN_DEBUG_H__
#include <etk/log.h>
#include <elog/log.h>
namespace audio {
namespace drain {
int32_t getLogId();
}
}
#define DRAIN_BASE(info,data) TK_LOG_BASE(audio::drain::getLogId(),info,data)
#define DRAIN_BASE(info,data) ELOG_BASE(audio::drain::getLogId(),info,data)
#define DRAIN_CRITICAL(data) DRAIN_BASE(1, data)
#define DRAIN_ERROR(data) DRAIN_BASE(2, data)

View File

@ -91,7 +91,7 @@ void appl::Windows::init() {
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16);
subBind(ewol::widget::Button, "displayFloat", signalPressed, shared_from_this(), &appl::Windows::onCallbackStartFloat);
m_displayer = std11::dynamic_pointer_cast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer"));
m_displayer = std::dynamic_pointer_cast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer"));
onCallbackStart();
}

View File

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

View File

@ -7,12 +7,12 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)

View File

@ -78,7 +78,7 @@ void appl::Windows::init() {
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16);
subBind(ewol::widget::Button, "displayFloat", signalPressed, shared_from_this(), &appl::Windows::onCallbackStartFloat);
m_displayer = std11::dynamic_pointer_cast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer"));
m_displayer = std::dynamic_pointer_cast<appl::widget::DisplayFrequency>(getSubObjectNamed("displayer"));
onCallbackStart();
}
@ -126,12 +126,12 @@ void appl::Windows::onCallbackGain(const float& _value, int32_t _id) {
onCallbackStart();
}
std11::shared_ptr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum audio::format _format) {
std::shared_ptr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum audio::format _format) {
std::vector<audio::channel> map;
map.push_back(audio::channel_frontCenter);
audio::drain::IOFormatInterface format(map, _format, m_sampleRate);
// create equalizer
std11::shared_ptr<audio::drain::Equalizer> out = audio::drain::Equalizer::create();
std::shared_ptr<audio::drain::Equalizer> out = audio::drain::Equalizer::create();
// configure input
out->setInputFormat(format);
// configure output
@ -176,7 +176,7 @@ std11::shared_ptr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum a
void appl::Windows::onCallbackStart() {
APPL_INFO("start ");
std11::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer();
std::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer();
std::vector<std::pair<float,float> > theory = eq->calculateTheory();
m_displayer->clear();
m_displayer->setValue(theory);
@ -185,7 +185,7 @@ void appl::Windows::onCallbackStart() {
void appl::Windows::onCallbackStart16() {
APPL_INFO("start ");
std11::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_int16);
std::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_int16);
std::vector<std::pair<float,float> > pratic;
size_t len = 512;
std::vector<int16_t> data;
@ -226,7 +226,7 @@ void appl::Windows::onCallbackStart16() {
void appl::Windows::onCallbackStartFloat() {
APPL_INFO("start ");
std11::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_float);
std::shared_ptr<audio::drain::Equalizer> eq = appl::Windows::createEqualizer(audio::format_float);
std::vector<std::pair<float,float> > pratic;
size_t len = 512;
std::vector<float> data;

View File

@ -64,7 +64,7 @@ namespace appl {
std::vector<int32_t> m_listSampleRate;
std::vector<float> m_listGain;
std11::shared_ptr<audio::drain::Equalizer> createEqualizer(enum audio::format _format = audio::format_float);
std::shared_ptr<audio::drain::Equalizer> createEqualizer(enum audio::format _format = audio::format_float);
};
}

View File

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

View File

@ -7,12 +7,12 @@
*/
#pragma once
#include <etk/log.h>
#include <elog/log.h>
namespace appl {
int32_t getLogId();
};
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
#define APPL_BASE(info,data) ELOG_BASE(appl::getLogId(),info,data)
#define APPL_CRITICAL(data) APPL_BASE(1, data)
#define APPL_ERROR(data) APPL_BASE(2, data)