[DEV] continue removing stl

This commit is contained in:
Edouard DUPIN 2017-08-28 00:06:44 +02:00
parent 564ec02467
commit ad57cdfce5
29 changed files with 154 additions and 154 deletions

View File

@ -5,7 +5,7 @@
*/
#pragma once
#include <string>
#include <etk/String.hpp>
#include <etk/types.hpp>
#include <echrono/echrono.hpp>
#include <echrono/Steady.hpp>

View File

@ -63,17 +63,17 @@ static const char* listValues[] = {
static int32_t listValuesSize = sizeof(listValues)/sizeof(char*);
std::ostream& audio::operator <<(std::ostream& _os, enum audio::channel _obj) {
etk::Stream& audio::operator <<(etk::Stream& _os, enum audio::channel _obj) {
_os << getChannelString(_obj);
return _os;
}
std::string audio::getChannelString(enum audio::channel _value) {
etk::String audio::getChannelString(enum audio::channel _value) {
return listValues[_value];
}
std::string audio::getChannelString(const std::vector<enum audio::channel>& _value) {
std::string out;
etk::String audio::getChannelString(const etk::Vector<enum audio::channel>& _value) {
etk::String out;
for (size_t iii=0; iii<_value.size(); ++iii) {
if (iii != 0) {
out += ";";
@ -84,31 +84,31 @@ std::string audio::getChannelString(const std::vector<enum audio::channel>& _val
}
std::ostream& audio::operator <<(std::ostream& _os, const std::vector<enum audio::channel>& _obj) {
_os << std::string("{");
etk::Stream& audio::operator <<(etk::Stream& _os, const etk::Vector<enum audio::channel>& _obj) {
_os << etk::String("{");
for (size_t iii=0; iii<_obj.size(); ++iii) {
if (iii!=0) {
_os << std::string(";");
_os << etk::String(";");
}
_os << _obj[iii];
}
_os << std::string("}");
_os << etk::String("}");
return _os;
}
std::ostream& audio::operator <<(std::ostream& _os, const std::vector<std::vector<enum audio::channel> >& _obj) {
_os << std::string("{");
etk::Stream& audio::operator <<(etk::Stream& _os, const etk::Vector<etk::Vector<enum audio::channel> >& _obj) {
_os << etk::String("{");
for (size_t iii=0; iii<_obj.size(); ++iii) {
if (iii!=0) {
_os << std::string(";");
_os << etk::String(";");
}
_os << _obj[iii];
}
_os << std::string("}");
_os << etk::String("}");
return _os;
}
enum audio::channel audio::getChannelFromString(const std::string& _value) {
enum audio::channel audio::getChannelFromString(const etk::String& _value) {
for (int32_t iii=0; iii<listValuesSize; ++iii) {
if (_value == listValues[iii]) {
return static_cast<enum audio::channel>(iii);
@ -118,20 +118,20 @@ enum audio::channel audio::getChannelFromString(const std::string& _value) {
return audio::channel_unknow;
}
std::vector<enum audio::channel> audio::getListChannelFromString(const std::string& _value) {
std::vector<enum audio::channel> out;
std::vector<std::string> list = etk::split(_value, ';');
etk::Vector<enum audio::channel> audio::getListChannelFromString(const etk::String& _value) {
etk::Vector<enum audio::channel> out;
etk::Vector<etk::String> list = etk::split(_value, ';');
for (size_t iii=0; iii<list.size(); ++iii) {
out.push_back(getChannelFromString(list[iii]));
out.pushBack(getChannelFromString(list[iii]));
}
return out;
}
namespace etk {
template<> std::string to_string<enum audio::channel>(const enum audio::channel& _variable) {
template<> etk::String toString<enum audio::channel>(const enum audio::channel& _variable) {
return listValues[_variable];
}
template <> bool from_string<enum audio::channel>(enum audio::channel& _variableRet, const std::string& _value) {
template <> bool from_string<enum audio::channel>(enum audio::channel& _variableRet, const etk::String& _value) {
for (int32_t iii=0; iii<listValuesSize; ++iii) {
if (_value == listValues[iii]) {
_variableRet = static_cast<enum audio::channel>(iii);
@ -143,18 +143,18 @@ namespace etk {
}
}
std::vector<uint8_t> audio::convertChannel(const std::vector<enum audio::channel>& _obj) {
std::vector<uint8_t> out;
etk::Vector<uint8_t> audio::convertChannel(const etk::Vector<enum audio::channel>& _obj) {
etk::Vector<uint8_t> out;
for (size_t iii=0; iii<_obj.size(); ++iii) {
out.push_back(static_cast<uint8_t>(_obj[iii]));
out.pushBack(static_cast<uint8_t>(_obj[iii]));
}
return out;
}
std::vector<enum audio::channel> audio::convertChannel(const std::vector<uint8_t>& _obj) {
std::vector<enum audio::channel> out;
etk::Vector<enum audio::channel> audio::convertChannel(const etk::Vector<uint8_t>& _obj) {
etk::Vector<enum audio::channel> out;
for (size_t iii=0; iii<_obj.size(); ++iii) {
out.push_back(static_cast<enum audio::channel>(_obj[iii]));
out.pushBack(static_cast<enum audio::channel>(_obj[iii]));
}
return out;
}

View File

@ -5,8 +5,8 @@
*/
#pragma once
#include <string>
#include <vector>
#include <etk/String.hpp>
#include <etk/Vector.hpp>
#include <etk/types.hpp>
namespace audio {
@ -66,15 +66,15 @@ namespace audio {
channel_aux30,
channel_aux31,
};
std::string getChannelString(enum audio::channel _obj);
std::string getChannelString(const std::vector<enum audio::channel>& _obj);
enum audio::channel getChannelFromString(const std::string& _value);
std::vector<enum audio::channel> getListChannelFromString(const std::string& _value);
std::ostream& operator <<(std::ostream& _os, enum audio::channel _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::channel>& _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<std::vector<enum audio::channel> >& _obj);
etk::String getChannelString(enum audio::channel _obj);
etk::String getChannelString(const etk::Vector<enum audio::channel>& _obj);
enum audio::channel getChannelFromString(const etk::String& _value);
etk::Vector<enum audio::channel> getListChannelFromString(const etk::String& _value);
etk::Stream& operator <<(etk::Stream& _os, enum audio::channel _obj);
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<enum audio::channel>& _obj);
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<etk::Vector<enum audio::channel> >& _obj);
// For ROS Interface:
std::vector<uint8_t> convertChannel(const std::vector<enum audio::channel>& _obj);
std::vector<enum audio::channel> convertChannel(const std::vector<uint8_t>& _obj);
etk::Vector<uint8_t> convertChannel(const etk::Vector<enum audio::channel>& _obj);
etk::Vector<enum audio::channel> convertChannel(const etk::Vector<uint8_t>& _obj);
}

View File

@ -10,7 +10,7 @@
namespace audio {
int32_t getLogId();
};
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
// TODO : Review this problem of multiple intanciation of "etk::Stringbuf sb"
#define AUDIO_BASE(info,data) ELOG_BASE(audio::getLogId(),info,data)
#define AUDIO_PRINT(data) AUDIO_BASE(-1, data)

View File

@ -172,7 +172,7 @@ audio::double_t audio::double_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::double_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":d]";
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::double_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":d]";
return _os;
}

View File

@ -106,5 +106,5 @@ namespace audio {
double_t& operator--();
double_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::double_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::double_t& _obj);
}

View File

@ -171,8 +171,8 @@ audio::float_t audio::float_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::float_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":f]";
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::float_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":f]";
return _os;
}

View File

@ -107,6 +107,6 @@ namespace audio {
float_t& operator--();
float_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::float_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::float_t& _obj);
}

View File

@ -24,29 +24,29 @@ static const char* listValues[] = {
};
static int32_t listValuesSize = sizeof(listValues)/sizeof(char*);
std::ostream& audio::operator <<(std::ostream& _os, enum audio::format _obj) {
etk::Stream& audio::operator <<(etk::Stream& _os, enum audio::format _obj) {
_os << getFormatString(_obj);
return _os;
}
std::ostream& audio::operator <<(std::ostream& _os, const std::vector<enum audio::format>& _obj) {
_os << std::string("{");
etk::Stream& audio::operator <<(etk::Stream& _os, const etk::Vector<enum audio::format>& _obj) {
_os << etk::String("{");
for (size_t iii=0; iii<_obj.size(); ++iii) {
if (iii!=0) {
_os << std::string(";");
_os << etk::String(";");
}
_os << _obj[iii];
}
_os << std::string("}");
_os << etk::String("}");
return _os;
}
std::string audio::getFormatString(enum audio::format _value) {
etk::String audio::getFormatString(enum audio::format _value) {
return listValues[_value];
}
enum audio::format audio::getFormatFromString(const std::string& _value) {
enum audio::format audio::getFormatFromString(const etk::String& _value) {
for (int32_t iii=0; iii<listValuesSize; ++iii) {
if (_value == listValues[iii]) {
return static_cast<enum audio::format>(iii);
@ -55,11 +55,11 @@ enum audio::format audio::getFormatFromString(const std::string& _value) {
return format_unknow;
}
std::vector<enum audio::format> audio::getListFormatFromString(const std::string& _value) {
std::vector<enum audio::format> out;
std::vector<std::string> list = etk::split(_value, ';');
etk::Vector<enum audio::format> audio::getListFormatFromString(const etk::String& _value) {
etk::Vector<enum audio::format> out;
etk::Vector<etk::String> list = etk::split(_value, ';');
for (size_t iii=0; iii<list.size(); ++iii) {
out.push_back(getFormatFromString(list[iii]));
out.pushBack(getFormatFromString(list[iii]));
}
return out;
}
@ -93,10 +93,10 @@ uint32_t audio::getFormatBytes(audio::format _format) {
namespace etk {
template<> std::string to_string<enum audio::format>(const enum audio::format& _variable) {
template<> etk::String toString<enum audio::format>(const enum audio::format& _variable) {
return listValues[_variable];
}
template <> bool from_string<enum audio::format>(enum audio::format& _variableRet, const std::string& _value) {
template <> bool from_string<enum audio::format>(enum audio::format& _variableRet, const etk::String& _value) {
for (int32_t iii=0; iii<listValuesSize; ++iii) {
if (_value == listValues[iii]) {
_variableRet = static_cast<enum audio::format>(iii);
@ -108,18 +108,18 @@ namespace etk {
}
}
std::vector<uint8_t> audio::convertFormat(const std::vector<enum audio::format>& _obj) {
std::vector<uint8_t> out;
etk::Vector<uint8_t> audio::convertFormat(const etk::Vector<enum audio::format>& _obj) {
etk::Vector<uint8_t> out;
for (size_t iii=0; iii<_obj.size(); ++iii) {
out.push_back(static_cast<uint8_t>(_obj[iii]));
out.pushBack(static_cast<uint8_t>(_obj[iii]));
}
return out;
}
std::vector<enum audio::format> audio::convertFormat(const std::vector<uint8_t>& _obj) {
std::vector<enum audio::format> out;
etk::Vector<enum audio::format> audio::convertFormat(const etk::Vector<uint8_t>& _obj) {
etk::Vector<enum audio::format> out;
for (size_t iii=0; iii<_obj.size(); ++iii) {
out.push_back(static_cast<enum audio::format>(_obj[iii]));
out.pushBack(static_cast<enum audio::format>(_obj[iii]));
}
return out;
}

View File

@ -5,7 +5,7 @@
*/
#pragma once
#include <string>
#include <etk/String.hpp>
namespace audio {
enum format {
@ -22,15 +22,15 @@ namespace audio {
format_float, //!< Floating point 32 bits (single precision)
format_double //!< Floating point 64 bits (double precision)
};
std::string getFormatString(enum audio::format _format);
enum audio::format getFormatFromString(const std::string& _value);
std::vector<enum audio::format> getListFormatFromString(const std::string& _value);
std::ostream& operator <<(std::ostream& _os, enum audio::format _obj);
std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::format>& _obj);
etk::String getFormatString(enum audio::format _format);
enum audio::format getFormatFromString(const etk::String& _value);
etk::Vector<enum audio::format> getListFormatFromString(const etk::String& _value);
etk::Stream& operator <<(etk::Stream& _os, enum audio::format _obj);
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<enum audio::format>& _obj);
uint32_t getFormatBytes(enum audio::format _format);
// For ROS Interface:
std::vector<uint8_t> convertFormat(const std::vector<enum audio::format>& _obj);
std::vector<enum audio::format> convertFormat(const std::vector<uint8_t>& _obj);
etk::Vector<uint8_t> convertFormat(const etk::Vector<enum audio::format>& _obj);
etk::Vector<enum audio::format> convertFormat(const etk::Vector<uint8_t>& _obj);
uint8_t convertFormat(enum audio::format _obj);
enum audio::format convertFormat(uint8_t _obj);
}

View File

@ -12,7 +12,7 @@ audio::int16_16_t::int16_16_t(const audio::int8_8_t& _val) {
}
audio::int16_16_t::int16_16_t(const audio::int8_16_t& _val) {
m_data = std::avg(int16_t(INT8_MIN),
m_data = etk::avg(int16_t(INT8_MIN),
_val.get(),
int16_t(INT8_MAX)
) << 7;
@ -23,7 +23,7 @@ audio::int16_16_t::int16_16_t(const audio::int16_16_t& _val) {
}
audio::int16_16_t::int16_16_t(const audio::int16_32_t& _val) {
m_data = int16_t(std::avg(int32_t(INT16_MIN),
m_data = int16_t(etk::avg(int32_t(INT16_MIN),
_val.get() >> 1,
int32_t(INT16_MAX)
)
@ -35,7 +35,7 @@ audio::int16_16_t::int16_16_t(const audio::int24_24_t& _val) {
}
audio::int16_16_t::int16_16_t(const audio::int24_32_t& _val) {
m_data = int16_t(std::avg(int32_t(INT24_MIN),
m_data = int16_t(etk::avg(int32_t(INT24_MIN),
_val.get() >> 1,
int32_t(INT24_MAX)
) >> 8
@ -47,7 +47,7 @@ audio::int16_16_t::int16_16_t(const audio::int32_32_t& _val) {
}
audio::int16_16_t::int16_16_t(const audio::int32_64_t& _val) {
m_data = int16_t(std::avg(int64_t(INT32_MIN),
m_data = int16_t(etk::avg(int64_t(INT32_MIN),
_val.get() >> 1,
int64_t(INT32_MAX)
) >> 16
@ -59,7 +59,7 @@ audio::int16_16_t::int16_16_t(const audio::int64_64_t& _val) {
}
audio::int16_16_t::int16_16_t(const audio::float_t& _val) {
m_data = int16_t(std::avg(-1.0f,
m_data = int16_t(etk::avg(-1.0f,
_val.get(),
0.999969482f
) * (float(INT16_MAX)+1)
@ -67,7 +67,7 @@ audio::int16_16_t::int16_16_t(const audio::float_t& _val) {
}
audio::int16_16_t::int16_16_t(const audio::double_t& _val) {
m_data = int16_t(std::avg(-1.0,
m_data = int16_t(etk::avg(-1.0,
_val.get(),
0.999969482
) * (double(INT16_MAX)+1)
@ -80,7 +80,7 @@ audio::int16_16_t::int16_16_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int16_16_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (15-_flotingPointPosition);
m_data = std::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
m_data = etk::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
}
void audio::int16_16_t::set(int16_t _value) {
@ -196,9 +196,9 @@ audio::int16_16_t audio::int16_16_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int16_16_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":0.15=";
_os << etk::to_string(double(_obj.get())/(double(INT16_MAX)+1));
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int16_16_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":0.15=";
_os << etk::toString(double(_obj.get())/(double(INT16_MAX)+1));
_os << "]";
return _os;
}

View File

@ -113,6 +113,6 @@ namespace audio {
int16_16_t& operator--();
int16_16_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int16_16_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int16_16_t& _obj);
}

View File

@ -37,7 +37,7 @@ audio::int16_32_t::int16_32_t(const audio::int32_32_t& _val) {
}
audio::int16_32_t::int16_32_t(const audio::int32_64_t& _val) {
m_data = int32_t(std::avg(int64_t(INT56_MIN),
m_data = int32_t(etk::avg(int64_t(INT56_MIN),
_val.get(),
int64_t(INT56_MAX)
) >> 16
@ -49,7 +49,7 @@ audio::int16_32_t::int16_32_t(const audio::int64_64_t& _val) {
}
audio::int16_32_t::int16_32_t(const audio::float_t& _val) {
m_data = int32_t(std::avg(float(INT16_MIN),
m_data = int32_t(etk::avg(float(INT16_MIN),
_val.get(),
float(INT16_MAX)
) * (float(INT16_MAX) * 2.0f+1.0f)
@ -57,7 +57,7 @@ audio::int16_32_t::int16_32_t(const audio::float_t& _val) {
}
audio::int16_32_t::int16_32_t(const audio::double_t& _val) {
m_data = int32_t(std::avg(double(INT16_MIN),
m_data = int32_t(etk::avg(double(INT16_MIN),
_val.get(),
double(INT16_MAX)
) * (double(INT16_MAX) * 2.0+1.0)
@ -70,7 +70,7 @@ audio::int16_32_t::int16_32_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int16_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (16-_flotingPointPosition);
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
m_data = etk::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
}
void audio::int16_32_t::set(int32_t _value) {
@ -186,9 +186,9 @@ audio::int16_32_t audio::int16_32_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int16_32_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":7.16=";
_os << etk::to_string(double(_obj.get())/double(INT16_MAX)*0.5);
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int16_32_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":7.16=";
_os << etk::toString(double(_obj.get())/double(INT16_MAX)*0.5);
_os << "]";
return _os;
}

View File

@ -113,5 +113,5 @@ namespace audio {
int16_32_t& operator--();
int16_32_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int16_32_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int16_32_t& _obj);
}

View File

@ -76,7 +76,7 @@ void audio::int24_24_t::set(int64_t _value, int32_t _flotingPointPosition) {
val = _value << (23-_flotingPointPosition);
}
//AUDIO_INFO(" _value=" << _value << " _flotingPointPosition=" << _flotingPointPosition << " val=" << val);
val = std::avg(int64_t(INT24_MIN), val, int64_t(INT24_MAX));
val = etk::avg(int64_t(INT24_MIN), val, int64_t(INT24_MAX));
m_data[0] = (val & 0x00000000000000ffLL);
m_data[1] = (val & 0x000000000000ff00LL) >> 8;
m_data[2] = (val & 0x0000000000ff0000LL) >> 16;
@ -96,9 +96,9 @@ int32_t audio::int24_24_t::get() const {
return val;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int24_24_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":0.23=";
_os << etk::to_string(double(_obj.get())/double(INT24_MAX));
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int24_24_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":0.23=";
_os << etk::toString(double(_obj.get())/double(INT24_MAX));
_os << "]";
return _os;
}

View File

@ -40,6 +40,6 @@ namespace audio {
void set(int32_t _value);
int32_t get() const;
};
std::ostream& operator <<(std::ostream& _os, const audio::int24_24_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int24_24_t& _obj);
}

View File

@ -21,7 +21,7 @@ audio::int24_32_t::int24_32_t(const audio::int16_16_t& _val) {
}
audio::int24_32_t::int24_32_t(const audio::int16_32_t& _val) {
m_data = int32_t(std::avg(int32_t(INT24_MIN),
m_data = int32_t(etk::avg(int32_t(INT24_MIN),
_val.get(),
int32_t(INT24_MAX)
) << 8
@ -41,7 +41,7 @@ audio::int24_32_t::int24_32_t(const audio::int32_32_t& _val) {
}
audio::int24_32_t::int24_32_t(const audio::int32_64_t& _val) {
m_data = int32_t(std::avg(int64_t(INT40_MIN),
m_data = int32_t(etk::avg(int64_t(INT40_MIN),
_val.get(),
int64_t(INT40_MAX)
) >> 8
@ -53,7 +53,7 @@ audio::int24_32_t::int24_32_t(const audio::int64_64_t& _val) {
}
audio::int24_32_t::int24_32_t(const audio::float_t& _val) {
m_data = int32_t(std::avg(float(INT8_MIN),
m_data = int32_t(etk::avg(float(INT8_MIN),
_val.get(),
float(INT8_MAX)
) * (float(INT24_MAX) * 2.0f + 1.0f)
@ -61,7 +61,7 @@ audio::int24_32_t::int24_32_t(const audio::float_t& _val) {
}
audio::int24_32_t::int24_32_t(const audio::double_t& _val) {
m_data = int32_t(std::avg(-1.0,
m_data = int32_t(etk::avg(-1.0,
_val.get(),
1.0
) * (double(INT24_MAX) * 2.0 + 1.0)
@ -74,7 +74,7 @@ audio::int24_32_t::int24_32_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int24_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (24-_flotingPointPosition);
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
m_data = etk::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
}
void audio::int24_32_t::set(int32_t _value) {
@ -190,9 +190,9 @@ audio::int24_32_t audio::int24_32_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int24_32_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":7.24=";
_os << etk::to_string(double(_obj.get())/double(INT24_MAX)*0.5);
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int24_32_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":7.24=";
_os << etk::toString(double(_obj.get())/double(INT24_MAX)*0.5);
_os << "]";
return _os;
}

View File

@ -113,6 +113,6 @@ namespace audio {
int24_32_t& operator--();
int24_32_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int24_32_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int24_32_t& _obj);
}

View File

@ -12,7 +12,7 @@ audio::int32_32_t::int32_32_t(const audio::int8_8_t& _val) {
}
audio::int32_32_t::int32_32_t(const audio::int8_16_t& _val) {
m_data = int32_t(std::avg(int32_t(INT8_MIN),
m_data = int32_t(etk::avg(int32_t(INT8_MIN),
_val.get() >> 1,
int32_t(INT8_MAX)
) << 24
@ -24,7 +24,7 @@ audio::int32_32_t::int32_32_t(const audio::int16_16_t& _val) {
}
audio::int32_32_t::int32_32_t(const audio::int16_32_t& _val) {
m_data = int32_t(std::avg(int32_t(INT16_MIN),
m_data = int32_t(etk::avg(int32_t(INT16_MIN),
_val.get() >> 1,
int32_t(INT16_MAX)
) << 16
@ -36,7 +36,7 @@ audio::int32_32_t::int32_32_t(const audio::int24_24_t& _val) {
}
audio::int32_32_t::int32_32_t(const audio::int24_32_t& _val) {
m_data = int32_t(std::avg(int32_t(INT24_MIN),
m_data = int32_t(etk::avg(int32_t(INT24_MIN),
_val.get() >> 1,
int32_t(INT24_MAX)
) << 8
@ -48,7 +48,7 @@ audio::int32_32_t::int32_32_t(const audio::int32_32_t& _val) {
}
audio::int32_32_t::int32_32_t(const audio::int32_64_t& _val) {
m_data = int32_t(std::avg(int64_t(INT32_MIN),
m_data = int32_t(etk::avg(int64_t(INT32_MIN),
_val.get() >> 1,
int64_t(INT32_MAX)
)
@ -60,7 +60,7 @@ audio::int32_32_t::int32_32_t(const audio::int64_64_t& _val) {
}
audio::int32_32_t::int32_32_t(const audio::float_t& _val) {
m_data = int32_t(std::avg(-1.0f,
m_data = int32_t(etk::avg(-1.0f,
_val.get(),
1.0f
) * float(INT32_MAX)
@ -68,7 +68,7 @@ audio::int32_32_t::int32_32_t(const audio::float_t& _val) {
}
audio::int32_32_t::int32_32_t(const audio::double_t& _val) {
m_data = int32_t(std::avg(-1.0,
m_data = int32_t(etk::avg(-1.0,
_val.get(),
1.0
) * double(INT32_MAX)
@ -81,7 +81,7 @@ audio::int32_32_t::int32_32_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int32_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (31-_flotingPointPosition);
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
m_data = etk::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
}
void audio::int32_32_t::set(int32_t _value) {
@ -197,9 +197,9 @@ audio::int32_32_t audio::int32_32_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int32_32_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":0.31=";
_os << etk::to_string(double(_obj.get())/double(INT16_MAX));
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int32_32_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":0.31=";
_os << etk::toString(double(_obj.get())/double(INT16_MAX));
_os << "]";
return _os;
}

View File

@ -111,6 +111,6 @@ namespace audio {
int32_32_t& operator--();
int32_32_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int32_32_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int32_32_t& _obj);
}

View File

@ -44,7 +44,7 @@ audio::int32_64_t::int32_64_t(const audio::int64_64_t& _val) {
}
audio::int32_64_t::int32_64_t(const audio::float_t& _val) {
m_data = int64_t(std::avg(float(INT32_MIN),
m_data = int64_t(etk::avg(float(INT32_MIN),
_val.get(),
float(INT32_MAX)
) * (float(INT32_MAX) * 2.0f + 1.0f)
@ -52,7 +52,7 @@ audio::int32_64_t::int32_64_t(const audio::float_t& _val) {
}
audio::int32_64_t::int32_64_t(const audio::double_t& _val) {
m_data = int64_t(std::avg(double(INT32_MIN),
m_data = int64_t(etk::avg(double(INT32_MIN),
_val.get(),
double(INT32_MAX)
) * (double(INT32_MAX) * 2.0 + 1.0)
@ -65,7 +65,7 @@ audio::int32_64_t::int32_64_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int32_64_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (32-_flotingPointPosition);
m_data = std::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
m_data = etk::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
}
void audio::int32_64_t::set(int64_t _value) {
@ -181,9 +181,9 @@ audio::int32_64_t audio::int32_64_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int32_64_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":31.32=";
_os << etk::to_string(double(_obj.get())/double(INT32_MAX)*0.5);
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int32_64_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":31.32=";
_os << etk::toString(double(_obj.get())/double(INT32_MAX)*0.5);
_os << "]";
return _os;
}

View File

@ -106,6 +106,6 @@ namespace audio {
int32_64_t& operator--();
int32_64_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int32_64_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int32_64_t& _obj);
}

View File

@ -12,7 +12,7 @@ audio::int64_64_t::int64_64_t(const audio::int8_8_t& _val) {
}
audio::int64_64_t::int64_64_t(const audio::int8_16_t& _val) {
m_data = int64_t(std::avg(int32_t(INT8_MIN),
m_data = int64_t(etk::avg(int32_t(INT8_MIN),
int32_t(_val.get())>>1,
int32_t(INT8_MAX)
)) << 56;
@ -23,7 +23,7 @@ audio::int64_64_t::int64_64_t(const audio::int16_16_t& _val) {
}
audio::int64_64_t::int64_64_t(const audio::int16_32_t& _val) {
m_data = int64_t(std::avg(int32_t(INT16_MIN),
m_data = int64_t(etk::avg(int32_t(INT16_MIN),
_val.get() >> 1,
int32_t(INT16_MAX)
)) << 48;
@ -34,7 +34,7 @@ audio::int64_64_t::int64_64_t(const audio::int24_24_t& _val) {
}
audio::int64_64_t::int64_64_t(const audio::int24_32_t& _val) {
m_data = int64_t(std::avg(int32_t(INT24_MIN),
m_data = int64_t(etk::avg(int32_t(INT24_MIN),
_val.get()>>1,
int32_t(INT24_MAX)
)) << 40;
@ -45,7 +45,7 @@ audio::int64_64_t::int64_64_t(const audio::int32_32_t& _val) {
}
audio::int64_64_t::int64_64_t(const audio::int32_64_t& _val) {
m_data = int64_t(std::avg(int64_t(INT32_MIN),
m_data = int64_t(etk::avg(int64_t(INT32_MIN),
_val.get()>>1,
int64_t(INT32_MAX)
)) << 32;
@ -56,7 +56,7 @@ audio::int64_64_t::int64_64_t(const audio::int64_64_t& _val) {
}
audio::int64_64_t::int64_64_t(const audio::float_t& _val) {
m_data = int64_t(std::avg(-1.0f,
m_data = int64_t(etk::avg(-1.0f,
_val.get(),
1.0f
) * (float(INT64_MAX) + 1.0f)
@ -64,7 +64,7 @@ audio::int64_64_t::int64_64_t(const audio::float_t& _val) {
}
audio::int64_64_t::int64_64_t(const audio::double_t& _val) {
m_data = int64_t(std::avg(-1.0,
m_data = int64_t(etk::avg(-1.0,
_val.get(),
1.0
) * (double(INT64_MAX) + 1.0f)
@ -78,7 +78,7 @@ audio::int64_64_t::int64_64_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int64_64_t::set(int64_t _value, int32_t _flotingPointPosition) {
// TODO: do it better with int128_t elements
int64_t val = _value << (63-_flotingPointPosition);
m_data = std::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
m_data = etk::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
}
void audio::int64_64_t::set(int64_t _value) {
@ -213,9 +213,9 @@ audio::int64_64_t audio::int64_64_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int64_64_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":0.63=";
_os << etk::to_string(double(_obj.get())/double(INT64_MAX));
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int64_64_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":0.63=";
_os << etk::toString(double(_obj.get())/double(INT64_MAX));
_os << "]";
return _os;
}

View File

@ -106,6 +106,6 @@ namespace audio {
int64_64_t& operator--();
int64_64_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int64_64_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int64_64_t& _obj);
}

View File

@ -21,7 +21,7 @@ audio::int8_16_t::int8_16_t(const audio::int16_16_t& _val) {
}
audio::int8_16_t::int8_16_t(const audio::int16_32_t& _val) {
m_data = int16_t(std::avg(int32_t(INT24_MIN),
m_data = int16_t(etk::avg(int32_t(INT24_MIN),
_val.get(),
int32_t(INT24_MAX)
) >> 8
@ -41,7 +41,7 @@ audio::int8_16_t::int8_16_t(const audio::int32_32_t& _val) {
}
audio::int8_16_t::int8_16_t(const audio::int32_64_t& _val) {
m_data = int16_t(std::avg(int64_t(INT40_MIN),
m_data = int16_t(etk::avg(int64_t(INT40_MIN),
_val.get(),
int64_t(INT40_MAX)
) >> 24
@ -53,7 +53,7 @@ audio::int8_16_t::int8_16_t(const audio::int64_64_t& _val) {
}
audio::int8_16_t::int8_16_t(const audio::float_t& _val) {
m_data = int16_t(std::avg(float(INT8_MIN),
m_data = int16_t(etk::avg(float(INT8_MIN),
_val.get(),
float(INT8_MAX)
) * (float(INT8_MAX) * 2.0f + 1.0f)
@ -61,7 +61,7 @@ audio::int8_16_t::int8_16_t(const audio::float_t& _val) {
}
audio::int8_16_t::int8_16_t(const audio::double_t& _val) {
m_data = int16_t(std::avg(double(INT8_MIN),
m_data = int16_t(etk::avg(double(INT8_MIN),
_val.get(),
double(INT8_MAX)
) * (double(INT8_MAX) * 2.0 + 1.0)
@ -74,7 +74,7 @@ audio::int8_16_t::int8_16_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int8_16_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (8-_flotingPointPosition);
m_data = std::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
m_data = etk::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
}
void audio::int8_16_t::set(int16_t _value) {
@ -190,9 +190,9 @@ audio::int8_16_t audio::int8_16_t::operator--(int _unused) {
return result;
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int8_16_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":7.8=";
_os << etk::to_string(double(_obj.get())/double(INT8_MAX)*0.5);
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int8_16_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":7.8=";
_os << etk::toString(double(_obj.get())/double(INT8_MAX)*0.5);
_os << "]";
return _os;
}

View File

@ -113,6 +113,6 @@ namespace audio {
int8_16_t& operator--();
int8_16_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int8_16_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int8_16_t& _obj);
}

View File

@ -13,7 +13,7 @@ audio::int8_8_t::int8_8_t(const audio::int8_8_t& _val) {
}
audio::int8_8_t::int8_8_t(const audio::int8_16_t& _val) {
m_data = int8_t(std::avg(int32_t(INT8_MIN),
m_data = int8_t(etk::avg(int32_t(INT8_MIN),
int32_t(_val.get())>>1,
int32_t(INT8_MAX)
));
@ -24,7 +24,7 @@ audio::int8_8_t::int8_8_t(const audio::int16_16_t& _val) {
}
audio::int8_8_t::int8_8_t(const audio::int16_32_t& _val) {
m_data = int8_t(std::avg(int32_t(INT16_MIN),
m_data = int8_t(etk::avg(int32_t(INT16_MIN),
_val.get()>>1,
int32_t(INT16_MAX)
) >> 8
@ -36,7 +36,7 @@ audio::int8_8_t::int8_8_t(const audio::int24_24_t& _val) {
}
audio::int8_8_t::int8_8_t(const audio::int24_32_t& _val) {
m_data = int8_t(std::avg(int32_t(INT24_MIN),
m_data = int8_t(etk::avg(int32_t(INT24_MIN),
_val.get() >> 1,
int32_t(INT24_MAX)
) >> 16);
@ -47,7 +47,7 @@ audio::int8_8_t::int8_8_t(const audio::int32_32_t& _val) {
}
audio::int8_8_t::int8_8_t(const audio::int32_64_t& _val) {
m_data = int8_t(std::avg(int64_t(INT32_MIN),
m_data = int8_t(etk::avg(int64_t(INT32_MIN),
_val.get() >> 1,
int64_t(INT32_MAX)
) >> 24
@ -59,7 +59,7 @@ audio::int8_8_t::int8_8_t(const audio::int64_64_t& _val) {
}
audio::int8_8_t::int8_8_t(const audio::float_t& _val) {
m_data = int16_t(std::avg(-1.0f,
m_data = int16_t(etk::avg(-1.0f,
_val.get(),
1.0f
) * (float(INT8_MAX) + 1.0f)
@ -67,7 +67,7 @@ audio::int8_8_t::int8_8_t(const audio::float_t& _val) {
}
audio::int8_8_t::int8_8_t(const audio::double_t& _val) {
m_data = int16_t(std::avg(-1.0,
m_data = int16_t(etk::avg(-1.0,
_val.get(),
1.0
) * (double(INT8_MAX) + 1.0)
@ -80,7 +80,7 @@ audio::int8_8_t::int8_8_t(int64_t _value, int32_t _flotingPointPosition) {
void audio::int8_8_t::set(int64_t _value, int32_t _flotingPointPosition) {
int64_t val = _value << (7-_flotingPointPosition);
m_data = std::avg(int64_t(INT8_MIN), val, int64_t(INT8_MAX));
m_data = etk::avg(int64_t(INT8_MIN), val, int64_t(INT8_MAX));
}
void audio::int8_8_t::set(int8_t _value) {
@ -197,9 +197,9 @@ audio::int8_8_t audio::int8_8_t::operator--(int _unused) {
}
std::ostream& audio::operator <<(std::ostream& _os, const audio::int8_8_t& _obj) {
_os << "[" << etk::to_string(_obj.get()) << ":0.7=";
_os << etk::to_string(double(_obj.get())/double(INT8_MAX));
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int8_8_t& _obj) {
_os << "[" << etk::toString(_obj.get()) << ":0.7=";
_os << etk::toString(double(_obj.get())/double(INT8_MAX));
_os << "]";
return _os;
}

View File

@ -111,6 +111,6 @@ namespace audio {
int8_8_t& operator--();
int8_8_t operator--(int _unused);
};
std::ostream& operator <<(std::ostream& _os, const audio::int8_8_t& _obj);
etk::Stream& operator <<(etk::Stream& _os, const audio::int8_8_t& _obj);
}

View File

@ -22,7 +22,7 @@ int main(int _argc, const char** _argv) {
// the only one init for etk:
etk::init(_argc, _argv);
for (int32_t iii=0; iii<_argc ; ++iii) {
std::string data = _argv[iii];
etk::String data = _argv[iii];
if ( data == "-h"
|| data == "--help") {
TEST_INFO("Help : ");