[DEV] update of external of elog and ethread
This commit is contained in:
parent
0ba0243081
commit
57952d4060
@ -21,8 +21,8 @@ audio::drain::Algo::Algo() :
|
|||||||
|
|
||||||
void audio::drain::Algo::init() {
|
void audio::drain::Algo::init() {
|
||||||
// set notification callback :
|
// set notification callback :
|
||||||
m_input.setCallback(std11::bind(&audio::drain::Algo::configurationChangeLocal, this));
|
m_input.setCallback(std::bind(&audio::drain::Algo::configurationChangeLocal, this));
|
||||||
m_output.setCallback(std11::bind(&audio::drain::Algo::configurationChangeLocal, this));
|
m_output.setCallback(std::bind(&audio::drain::Algo::configurationChangeLocal, this));
|
||||||
// first configure ==> update the internal parameters
|
// first configure ==> update the internal parameters
|
||||||
configurationChange();
|
configurationChange();
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace drain{
|
namespace drain{
|
||||||
typedef std11::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 std11::enable_shared_from_this<Algo> {
|
class Algo : public std::enable_shared_from_this<Algo> {
|
||||||
private:
|
private:
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
public:
|
public:
|
||||||
|
@ -23,8 +23,8 @@ void audio::drain::ChannelReorder::init() {
|
|||||||
m_type = "ChannelReorder";
|
m_type = "ChannelReorder";
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::ChannelReorder> audio::drain::ChannelReorder::create() {
|
std::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> tmp(new audio::drain::ChannelReorder());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace audio {
|
|||||||
ChannelReorder();
|
ChannelReorder();
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
static std11::shared_ptr<audio::drain::ChannelReorder> create();
|
static std::shared_ptr<audio::drain::ChannelReorder> create();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
|
@ -75,7 +75,7 @@ void audio::drain::CircularBuffer::setCapacity(size_t _capacity, size_t _chunkSi
|
|||||||
m_write = &m_data[0];
|
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;
|
uint32_t nbSampleNeeded = _frequency*_capacity.count()/1000;
|
||||||
DRAIN_DEBUG("buffer setCapacity(" << _capacity.count() << "ms ," << _chunkSize << ")");
|
DRAIN_DEBUG("buffer setCapacity(" << _capacity.count() << "ms ," << _chunkSize << ")");
|
||||||
setCapacity(nbSampleNeeded, _chunkSize, _frequency);
|
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);
|
DRAIN_VERBOSE("crop nb sample : m_size=" << m_size << " _nbChunk=" << _nbChunk);
|
||||||
_nbChunk = m_size;
|
_nbChunk = m_size;
|
||||||
}
|
}
|
||||||
m_timeRead += std11::chrono::microseconds(_nbChunk*1000000/m_frequency);
|
m_timeRead += std::chrono::microseconds(_nbChunk*1000000/m_frequency);
|
||||||
if (usedSizeBeforeEnd >= _nbChunk) {
|
if (usedSizeBeforeEnd >= _nbChunk) {
|
||||||
// all Data will be copy
|
// all Data will be copy
|
||||||
memcpy(_data, m_read, _nbChunk * m_sizeChunk);
|
memcpy(_data, m_read, _nbChunk * m_sizeChunk);
|
||||||
|
@ -75,9 +75,9 @@ namespace audio {
|
|||||||
* @param[in] _chunkSize Size of one chunk.
|
* @param[in] _chunkSize Size of one chunk.
|
||||||
* @param[in] _frequency Frequency of the buffer
|
* @param[in] _frequency Frequency of the buffer
|
||||||
*/
|
*/
|
||||||
void setCapacity(std11::chrono::milliseconds _capacity, size_t _chunkSize, uint32_t _frequency);
|
void setCapacity(std::chrono::milliseconds _capacity, size_t _chunkSize, uint32_t _frequency);
|
||||||
void setCapacity(std11::chrono::microseconds _capacity, size_t _chunkSize, uint32_t _frequency) {
|
void setCapacity(std::chrono::microseconds _capacity, size_t _chunkSize, uint32_t _frequency) {
|
||||||
setCapacity(std11::chrono::milliseconds(_capacity.count()/1000), _chunkSize, _frequency);
|
setCapacity(std::chrono::milliseconds(_capacity.count()/1000), _chunkSize, _frequency);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief get free size of the buffer.
|
* @brief get free size of the buffer.
|
||||||
|
@ -27,14 +27,14 @@ void audio::drain::EndPointCallback::init(recordFunction _callback) {
|
|||||||
m_type = "EndPointCallback";
|
m_type = "EndPointCallback";
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::EndPointCallback> audio::drain::EndPointCallback::create(playbackFunction _callback) {
|
std::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> tmp(new audio::drain::EndPointCallback());
|
||||||
tmp->init(_callback);
|
tmp->init(_callback);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::EndPointCallback> audio::drain::EndPointCallback::create(recordFunction _callback) {
|
std::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> tmp(new audio::drain::EndPointCallback());
|
||||||
tmp->init(_callback);
|
tmp->init(_callback);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace drain {
|
namespace drain {
|
||||||
typedef std11::function<void (void* _data,
|
typedef std::function<void (void* _data,
|
||||||
const audio::Time& _playTime,
|
const audio::Time& _playTime,
|
||||||
size_t _nbChunk,
|
size_t _nbChunk,
|
||||||
enum audio::format _format,
|
enum audio::format _format,
|
||||||
uint32_t _frequency,
|
uint32_t _frequency,
|
||||||
const std::vector<audio::channel>& _map)> playbackFunction;
|
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,
|
const audio::Time& _readTime,
|
||||||
size_t _nbChunk,
|
size_t _nbChunk,
|
||||||
enum audio::format _format,
|
enum audio::format _format,
|
||||||
@ -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 std11::shared_ptr<EndPointCallback> create(playbackFunction _callback);
|
static std::shared_ptr<EndPointCallback> create(playbackFunction _callback);
|
||||||
static std11::shared_ptr<EndPointCallback> create(recordFunction _callback);
|
static std::shared_ptr<EndPointCallback> create(recordFunction _callback);
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
|
@ -20,8 +20,8 @@ void audio::drain::EndPointRead::init() {
|
|||||||
m_type = "EndPointRead";
|
m_type = "EndPointRead";
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::EndPointRead> audio::drain::EndPointRead::create() {
|
std::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> tmp(new audio::drain::EndPointRead());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ void audio::drain::EndPointRead::setBufferSize(size_t _nbChunk) {
|
|||||||
DRAIN_TODO("...");
|
DRAIN_TODO("...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void audio::drain::EndPointRead::setBufferSize(const std11::chrono::microseconds& _time) {
|
void audio::drain::EndPointRead::setBufferSize(const std::chrono::microseconds& _time) {
|
||||||
DRAIN_TODO("...");
|
DRAIN_TODO("...");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,9 +54,9 @@ size_t audio::drain::EndPointRead::getBufferSize() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::chrono::microseconds audio::drain::EndPointRead::getBufferSizeMicrosecond() {
|
std::chrono::microseconds audio::drain::EndPointRead::getBufferSizeMicrosecond() {
|
||||||
DRAIN_TODO("...");
|
DRAIN_TODO("...");
|
||||||
return std11::chrono::microseconds(0);
|
return std::chrono::microseconds(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t audio::drain::EndPointRead::getBufferFillSize() {
|
size_t audio::drain::EndPointRead::getBufferFillSize() {
|
||||||
@ -64,8 +64,8 @@ size_t audio::drain::EndPointRead::getBufferFillSize() {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::chrono::microseconds audio::drain::EndPointRead::getBufferFillSizeMicrosecond() {
|
std::chrono::microseconds audio::drain::EndPointRead::getBufferFillSizeMicrosecond() {
|
||||||
DRAIN_TODO("...");
|
DRAIN_TODO("...");
|
||||||
return std11::chrono::microseconds(0);
|
return std::chrono::microseconds(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace audio {
|
|||||||
EndPointRead();
|
EndPointRead();
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
static std11::shared_ptr<EndPointRead> create();
|
static std::shared_ptr<EndPointRead> create();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
@ -37,7 +37,7 @@ namespace audio {
|
|||||||
* @brief Set buffer size size of the buffer with the stored time in µs
|
* @brief Set buffer size size of the buffer with the stored time in µs
|
||||||
* @param[in] _time Time in microsecond of the buffer
|
* @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
|
* @brief get buffer size in chunk number
|
||||||
* @return Number of chunk that can be written in the buffer
|
* @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
|
* @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
|
* @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
|
* @brief Get buffer size filled in chunk number
|
||||||
* @return Number of chunk in the buffer (that might be read/write)
|
* @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
|
* @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)
|
* @return Time in microsecond of the buffer (that might be read/write)
|
||||||
*/
|
*/
|
||||||
virtual std11::chrono::microseconds getBufferFillSizeMicrosecond();
|
virtual std::chrono::microseconds getBufferFillSizeMicrosecond();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ void audio::drain::EndPointWrite::init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::EndPointWrite> audio::drain::EndPointWrite::create() {
|
std::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> tmp(new audio::drain::EndPointWrite());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ void audio::drain::EndPointWrite::configurationChange() {
|
|||||||
// update the buffer size ...
|
// update the buffer size ...
|
||||||
if ( audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size() != 0
|
if ( audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size() != 0
|
||||||
&& m_output.getFrequency() != 0) {
|
&& m_output.getFrequency() != 0) {
|
||||||
if (std11::chrono::microseconds(0) != m_bufferSizeMicroseconds) {
|
if (std::chrono::microseconds(0) != m_bufferSizeMicroseconds) {
|
||||||
m_buffer.setCapacity(m_bufferSizeMicroseconds,
|
m_buffer.setCapacity(m_bufferSizeMicroseconds,
|
||||||
audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size(),
|
audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size(),
|
||||||
m_output.getFrequency());
|
m_output.getFrequency());
|
||||||
@ -71,7 +71,7 @@ bool audio::drain::EndPointWrite::process(audio::Time& _time,
|
|||||||
// set output pointer:
|
// set output pointer:
|
||||||
_outputNbChunk = m_outputData.size()/(m_formatSize*m_output.getMap().size());
|
_outputNbChunk = m_outputData.size()/(m_formatSize*m_output.getMap().size());
|
||||||
_output = &m_outputData[0];
|
_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
|
// check if data in the tmpBuffer
|
||||||
if (m_buffer.getSize() == 0) {
|
if (m_buffer.getSize() == 0) {
|
||||||
DRAIN_WARNING("No data in the user buffer (write null data ... " << _outputNbChunk << " chunks)");
|
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) {
|
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);
|
DRAIN_VERBOSE("[ASYNC] Write data : " << _nbChunk << " chunks" << " ==> " << m_output);
|
||||||
int32_t nbOverflow = m_buffer.write(_value, _nbChunk);
|
int32_t nbOverflow = m_buffer.write(_value, _nbChunk);
|
||||||
if (nbOverflow > 0) {
|
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) {
|
void audio::drain::EndPointWrite::setBufferSize(size_t _nbChunk) {
|
||||||
m_bufferSizeMicroseconds = std11::chrono::microseconds(0);
|
m_bufferSizeMicroseconds = std::chrono::microseconds(0);
|
||||||
m_bufferSizeChunk = _nbChunk;
|
m_bufferSizeChunk = _nbChunk;
|
||||||
if ( audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size() != 0
|
if ( audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size() != 0
|
||||||
&& m_output.getFrequency() != 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_bufferSizeMicroseconds = _time;
|
||||||
m_bufferSizeChunk = 0;
|
m_bufferSizeChunk = 0;
|
||||||
m_buffer.setCapacity(_time,
|
m_buffer.setCapacity(_time,
|
||||||
@ -134,17 +134,17 @@ size_t audio::drain::EndPointWrite::getBufferSize() {
|
|||||||
return (int64_t(m_output.getFrequency())*m_bufferSizeMicroseconds.count())/1000000LL;
|
return (int64_t(m_output.getFrequency())*m_bufferSizeMicroseconds.count())/1000000LL;
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::chrono::microseconds audio::drain::EndPointWrite::getBufferSizeMicrosecond() {
|
std::chrono::microseconds audio::drain::EndPointWrite::getBufferSizeMicrosecond() {
|
||||||
if (m_bufferSizeMicroseconds != std11::chrono::microseconds(0) ) {
|
if (m_bufferSizeMicroseconds != std::chrono::microseconds(0) ) {
|
||||||
return m_bufferSizeMicroseconds;
|
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() {
|
size_t audio::drain::EndPointWrite::getBufferFillSize() {
|
||||||
return m_buffer.getSize()/(audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size());
|
return m_buffer.getSize()/(audio::getFormatBytes(m_output.getFormat())*m_output.getMap().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::chrono::microseconds audio::drain::EndPointWrite::getBufferFillSizeMicrosecond() {
|
std::chrono::microseconds audio::drain::EndPointWrite::getBufferFillSizeMicrosecond() {
|
||||||
return std11::chrono::microseconds(getBufferFillSize()*1000000LL/int64_t(m_output.getFrequency()));
|
return std::chrono::microseconds(getBufferFillSize()*1000000LL/int64_t(m_output.getFrequency()));
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace drain{
|
namespace drain{
|
||||||
typedef std11::function<void (const audio::Time& _time,
|
typedef std::function<void (const audio::Time& _time,
|
||||||
size_t _nbChunk,
|
size_t _nbChunk,
|
||||||
enum audio::format _format,
|
enum audio::format _format,
|
||||||
uint32_t _frequency,
|
uint32_t _frequency,
|
||||||
@ -21,7 +21,7 @@ namespace audio {
|
|||||||
private:
|
private:
|
||||||
audio::drain::CircularBuffer m_buffer;
|
audio::drain::CircularBuffer m_buffer;
|
||||||
playbackFunctionWrite m_function;
|
playbackFunctionWrite m_function;
|
||||||
std11::mutex m_mutex;
|
std::mutex m_mutex;
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
@ -29,7 +29,7 @@ namespace audio {
|
|||||||
EndPointWrite();
|
EndPointWrite();
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
static std11::shared_ptr<audio::drain::EndPointWrite> create();
|
static std::shared_ptr<audio::drain::EndPointWrite> create();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@ namespace audio {
|
|||||||
m_function = _function;
|
m_function = _function;
|
||||||
}
|
}
|
||||||
protected:
|
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
|
size_t m_bufferSizeChunk; // 0 if m_bufferSizeMicroseconds != 0
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -57,7 +57,7 @@ namespace audio {
|
|||||||
* @brief Set buffer size size of the buffer with the stored time in µs
|
* @brief Set buffer size size of the buffer with the stored time in µs
|
||||||
* @param[in] _time Time in microsecond of the buffer
|
* @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
|
* @brief get buffer size in chunk number
|
||||||
* @return Number of chunk that can be written in the buffer
|
* @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
|
* @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
|
* @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
|
* @brief Get buffer size filled in chunk number
|
||||||
* @return Number of chunk in the buffer (that might be read/write)
|
* @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
|
* @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)
|
* @return Time in microsecond of the buffer (that might be read/write)
|
||||||
*/
|
*/
|
||||||
virtual std11::chrono::microseconds getBufferFillSizeMicrosecond();
|
virtual std::chrono::microseconds getBufferFillSizeMicrosecond();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ void audio::drain::Equalizer::init() {
|
|||||||
configureBiQuad();
|
configureBiQuad();
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::Equalizer> audio::drain::Equalizer::create() {
|
std::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> tmp(new audio::drain::Equalizer());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ std::string audio::drain::Equalizer::getParameterProperty(const std::string& _pa
|
|||||||
return "error";
|
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:
|
// get type:
|
||||||
std::string typeString = _object->getStringValue("type", "none");
|
std::string typeString = _object->getStringValue("type", "none");
|
||||||
if (typeString == "direct-value") {
|
if (typeString == "direct-value") {
|
||||||
@ -110,11 +110,11 @@ void audio::drain::Equalizer::configureBiQuad() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// check for a global config:
|
// 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) {
|
if (global != nullptr) {
|
||||||
// only global configuration get all elements:
|
// only global configuration get all elements:
|
||||||
for (size_t kkk=0; kkk<global->size(); ++kkk) {
|
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) {
|
if (tmpObject == nullptr) {
|
||||||
DRAIN_ERROR("Parse the configuration error : not a correct parameter:" << kkk);
|
DRAIN_ERROR("Parse the configuration error : not a correct parameter:" << kkk);
|
||||||
continue;
|
continue;
|
||||||
@ -126,14 +126,14 @@ void audio::drain::Equalizer::configureBiQuad() {
|
|||||||
}
|
}
|
||||||
for (size_t iii=0; iii<getOutputFormat().getMap().size(); ++iii) {
|
for (size_t iii=0; iii<getOutputFormat().getMap().size(); ++iii) {
|
||||||
std::string channelName = etk::to_string(getOutputFormat().getMap()[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) {
|
if (channelConfig == nullptr) {
|
||||||
// no config ... not a problem ...
|
// no config ... not a problem ...
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// only global configuration get all elements:
|
// only global configuration get all elements:
|
||||||
for (size_t kkk=0; kkk<channelConfig->size(); ++kkk) {
|
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) {
|
if (tmpObject == nullptr) {
|
||||||
DRAIN_ERROR("Parse the configuration error : not a correct parameter:" << kkk);
|
DRAIN_ERROR("Parse the configuration error : not a correct parameter:" << kkk);
|
||||||
continue;
|
continue;
|
||||||
|
@ -20,7 +20,7 @@ namespace audio {
|
|||||||
Equalizer();
|
Equalizer();
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
static std11::shared_ptr<audio::drain::Equalizer> create();
|
static std::shared_ptr<audio::drain::Equalizer> create();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
@ -34,13 +34,13 @@ namespace audio {
|
|||||||
void*& _output,
|
void*& _output,
|
||||||
size_t& _outputNbChunk);
|
size_t& _outputNbChunk);
|
||||||
protected:
|
protected:
|
||||||
std11::shared_ptr<ejson::Object> m_config; // configuration of the equalizer.
|
std::shared_ptr<ejson::Object> m_config; // configuration of the equalizer.
|
||||||
public:
|
public:
|
||||||
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;
|
||||||
protected:
|
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;
|
audio::algo::drain::Equalizer m_algo;
|
||||||
/**
|
/**
|
||||||
* @brief Configure biquad with the user spec.
|
* @brief Configure biquad with the user spec.
|
||||||
|
@ -136,8 +136,8 @@ void audio::drain::FormatUpdate::init() {
|
|||||||
m_type = "FormatUpdate";
|
m_type = "FormatUpdate";
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::FormatUpdate> audio::drain::FormatUpdate::create() {
|
std::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> tmp(new audio::drain::FormatUpdate());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace audio {
|
|||||||
FormatUpdate();
|
FormatUpdate();
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
static std11::shared_ptr<audio::drain::FormatUpdate> create();
|
static std::shared_ptr<audio::drain::FormatUpdate> create();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
|
@ -113,7 +113,7 @@ void audio::drain::IOFormatInterface::configurationChange() {
|
|||||||
m_ioChangeFunctor();
|
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;
|
m_ioChangeFunctor = _functor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,14 +74,14 @@ namespace audio {
|
|||||||
*/
|
*/
|
||||||
int32_t getChunkSize() const;
|
int32_t getChunkSize() const;
|
||||||
protected:
|
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();
|
void configurationChange();
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Set the callback function to be notify when the arameter change.
|
* @brief Set the callback function to be notify when the arameter change.
|
||||||
* @param[in] _functor Function to call.
|
* @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);
|
std::ostream& operator <<(std::ostream& _os, const audio::drain::IOFormatInterface& _obj);
|
||||||
}
|
}
|
||||||
|
@ -104,15 +104,15 @@ bool audio::drain::Process::process(audio::Time& _time,
|
|||||||
return true;
|
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();
|
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);
|
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();
|
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);
|
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
|
if ( out.getFormat() != audio::format_int16
|
||||||
/* && out.getFormat() != format_float */) {
|
/* && out.getFormat() != format_float */) {
|
||||||
// need add a format Updater
|
// 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->setTemporary();
|
||||||
algo->setInputFormat(out);
|
algo->setInputFormat(out);
|
||||||
out.setFormat(audio::format_int16);
|
out.setFormat(audio::format_int16);
|
||||||
algo->setOutputFormat(out);
|
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);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
|
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
// need add a resampler
|
// 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->setTemporary();
|
||||||
algo->setInputFormat(out);
|
algo->setInputFormat(out);
|
||||||
out.setFrequency(in.getFrequency());
|
out.setFrequency(in.getFrequency());
|
||||||
algo->setOutputFormat(out);
|
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);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_VERBOSE("convert " << out.getFrequency() << " -> " << in.getFrequency());
|
DRAIN_VERBOSE("convert " << out.getFrequency() << " -> " << in.getFrequency());
|
||||||
out.setFrequency(in.getFrequency());
|
out.setFrequency(in.getFrequency());
|
||||||
@ -361,24 +361,24 @@ 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
|
||||||
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->setTemporary();
|
||||||
algo->setInputFormat(out);
|
algo->setInputFormat(out);
|
||||||
out.setMap(in.getMap());
|
out.setMap(in.getMap());
|
||||||
algo->setOutputFormat(out);
|
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);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_VERBOSE("convert " << out.getMap() << " -> " << in.getMap());
|
DRAIN_VERBOSE("convert " << out.getMap() << " -> " << in.getMap());
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
if (out.getFormat() != in.getFormat()) {
|
if (out.getFormat() != in.getFormat()) {
|
||||||
// need add a format Updater
|
// 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->setTemporary();
|
||||||
algo->setInputFormat(out);
|
algo->setInputFormat(out);
|
||||||
out.setFormat(in.getFormat());
|
out.setFormat(in.getFormat());
|
||||||
algo->setOutputFormat(out);
|
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);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
|
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
|
||||||
_position++;
|
_position++;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace drain{
|
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 {
|
class Process {
|
||||||
protected:
|
protected:
|
||||||
std::vector<int8_t> m_data; //!< temporary overlap output buffer (change size of the output data)
|
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;
|
m_outputConfig = _interface;
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
std::vector<std11::shared_ptr<drain::Algo> > m_listAlgo;
|
std::vector<std::shared_ptr<drain::Algo> > m_listAlgo;
|
||||||
public:
|
public:
|
||||||
void pushBack(const std11::shared_ptr<drain::Algo>& _algo);
|
void pushBack(const std::shared_ptr<drain::Algo>& _algo);
|
||||||
void pushFront(const std11::shared_ptr<drain::Algo>& _algo);
|
void pushFront(const std::shared_ptr<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<std11::shared_ptr<drain::Algo> >::iterator begin() {
|
std::vector<std::shared_ptr<drain::Algo> >::iterator begin() {
|
||||||
return m_listAlgo.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();
|
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];
|
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) {
|
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 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) {
|
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 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) {
|
template<typename T> std::shared_ptr<T> get(int32_t _id) {
|
||||||
return std11::dynamic_pointer_cast<T>(m_listAlgo[_id]);
|
return std::dynamic_pointer_cast<T>(m_listAlgo[_id]);
|
||||||
}
|
}
|
||||||
template<typename T> void removeIfFirst() {
|
template<typename T> void removeIfFirst() {
|
||||||
if (m_listAlgo.size() > 0) {
|
if (m_listAlgo.size() > 0) {
|
||||||
std11::shared_ptr<T> algoEP = get<T>(0);
|
std::shared_ptr<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) {
|
||||||
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) {
|
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) {
|
||||||
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) {
|
if (tmp != nullptr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,8 @@ void audio::drain::Resampler::init() {
|
|||||||
m_residualTimeInResampler = audio::Duration(0);
|
m_residualTimeInResampler = audio::Duration(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::Resampler> audio::drain::Resampler::create() {
|
std::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> tmp(new audio::drain::Resampler());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace audio {
|
|||||||
Resampler();
|
Resampler();
|
||||||
void init();
|
void init();
|
||||||
public:
|
public:
|
||||||
static std11::shared_ptr<audio::drain::Resampler> create();
|
static std::shared_ptr<audio::drain::Resampler> create();
|
||||||
/**
|
/**
|
||||||
* @brief Destructor
|
* @brief Destructor
|
||||||
*/
|
*/
|
||||||
|
@ -25,8 +25,8 @@ void audio::drain::Volume::init() {
|
|||||||
m_supportedFormat.push_back(audio::format_int16_on_int32);
|
m_supportedFormat.push_back(audio::format_int16_on_int32);
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<audio::drain::Volume> audio::drain::Volume::create() {
|
std::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> tmp(new audio::drain::Volume());
|
||||||
tmp->init();
|
tmp->init();
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@ -344,7 +344,7 @@ bool audio::drain::Volume::process(audio::Time& _time,
|
|||||||
return true;
|
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) {
|
if (_volume == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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<std11::shared_ptr<drain::VolumeElement> > m_volumeList;
|
std::vector<std::shared_ptr<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 std11::shared_ptr<Volume> create();
|
static std::shared_ptr<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 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 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;
|
||||||
|
@ -8,6 +8,6 @@
|
|||||||
|
|
||||||
|
|
||||||
int32_t audio::drain::getLogId() {
|
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;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
#ifndef __AUDIO_DRAIN_DEBUG_H__
|
#ifndef __AUDIO_DRAIN_DEBUG_H__
|
||||||
#define __AUDIO_DRAIN_DEBUG_H__
|
#define __AUDIO_DRAIN_DEBUG_H__
|
||||||
|
|
||||||
#include <etk/log.h>
|
#include <elog/log.h>
|
||||||
|
|
||||||
namespace audio {
|
namespace audio {
|
||||||
namespace drain {
|
namespace drain {
|
||||||
int32_t getLogId();
|
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_CRITICAL(data) DRAIN_BASE(1, data)
|
||||||
#define DRAIN_ERROR(data) DRAIN_BASE(2, data)
|
#define DRAIN_ERROR(data) DRAIN_BASE(2, data)
|
||||||
|
@ -91,7 +91,7 @@ void appl::Windows::init() {
|
|||||||
|
|
||||||
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16);
|
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16);
|
||||||
subBind(ewol::widget::Button, "displayFloat", signalPressed, shared_from_this(), &appl::Windows::onCallbackStartFloat);
|
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();
|
onCallbackStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
|
|
||||||
int32_t appl::getLogId() {
|
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;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/log.h>
|
#include <elog/log.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
int32_t getLogId();
|
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_CRITICAL(data) APPL_BASE(1, data)
|
||||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||||
|
@ -78,7 +78,7 @@ void appl::Windows::init() {
|
|||||||
|
|
||||||
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16);
|
subBind(ewol::widget::Button, "display16", signalPressed, shared_from_this(), &appl::Windows::onCallbackStart16);
|
||||||
subBind(ewol::widget::Button, "displayFloat", signalPressed, shared_from_this(), &appl::Windows::onCallbackStartFloat);
|
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();
|
onCallbackStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,12 +126,12 @@ void appl::Windows::onCallbackGain(const float& _value, int32_t _id) {
|
|||||||
onCallbackStart();
|
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;
|
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
|
||||||
std11::shared_ptr<audio::drain::Equalizer> out = audio::drain::Equalizer::create();
|
std::shared_ptr<audio::drain::Equalizer> out = audio::drain::Equalizer::create();
|
||||||
// configure input
|
// configure input
|
||||||
out->setInputFormat(format);
|
out->setInputFormat(format);
|
||||||
// configure output
|
// configure output
|
||||||
@ -176,7 +176,7 @@ std11::shared_ptr<audio::drain::Equalizer> appl::Windows::createEqualizer(enum a
|
|||||||
|
|
||||||
void appl::Windows::onCallbackStart() {
|
void appl::Windows::onCallbackStart() {
|
||||||
APPL_INFO("start ");
|
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();
|
std::vector<std::pair<float,float> > theory = eq->calculateTheory();
|
||||||
m_displayer->clear();
|
m_displayer->clear();
|
||||||
m_displayer->setValue(theory);
|
m_displayer->setValue(theory);
|
||||||
@ -185,7 +185,7 @@ void appl::Windows::onCallbackStart() {
|
|||||||
|
|
||||||
void appl::Windows::onCallbackStart16() {
|
void appl::Windows::onCallbackStart16() {
|
||||||
APPL_INFO("start ");
|
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;
|
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;
|
||||||
@ -226,7 +226,7 @@ void appl::Windows::onCallbackStart16() {
|
|||||||
|
|
||||||
void appl::Windows::onCallbackStartFloat() {
|
void appl::Windows::onCallbackStartFloat() {
|
||||||
APPL_INFO("start ");
|
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;
|
std::vector<std::pair<float,float> > pratic;
|
||||||
size_t len = 512;
|
size_t len = 512;
|
||||||
std::vector<float> data;
|
std::vector<float> data;
|
||||||
|
@ -64,7 +64,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;
|
||||||
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);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,6 @@
|
|||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
|
|
||||||
int32_t appl::getLogId() {
|
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;
|
return g_val;
|
||||||
}
|
}
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <etk/log.h>
|
#include <elog/log.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
int32_t getLogId();
|
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_CRITICAL(data) APPL_BASE(1, data)
|
||||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user