[DEV] work on create a basic abstraction on typing
This commit is contained in:
parent
d5c9c3b1ff
commit
fbca37b344
@ -8,3 +8,60 @@
|
||||
#include <audio/double_t.h>
|
||||
|
||||
|
||||
audio::double_t::double_t(const audio::int8_8_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT8_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int8_16_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT8_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int16_16_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT16_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int16_32_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT16_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int24_24_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT24_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int24_32_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT24_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int32_32_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT32_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int32_64_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT32_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::int64_64_t& _val) {
|
||||
m_data = double(_val.get()) / double(INT64_MAX);
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::float_t& _val) {
|
||||
m_data = double(_val.get());
|
||||
}
|
||||
|
||||
audio::double_t::double_t(const audio::double_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::double_t::double_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::double_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
m_data = double(_value << (32-_flotingPointPosition)) / double(INT32_MAX);
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::double_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":d]";
|
||||
return _os;
|
||||
}
|
||||
|
150
audio/double_t.h
150
audio/double_t.h
@ -14,10 +14,160 @@ namespace audio {
|
||||
private:
|
||||
double m_data;
|
||||
public:
|
||||
double_t() {}
|
||||
double_t(double _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
double_t(const audio::int8_8_t& _val);
|
||||
double_t(const audio::int8_16_t& _val);
|
||||
double_t(const audio::int16_16_t& _val);
|
||||
double_t(const audio::int16_32_t& _val);
|
||||
double_t(const audio::int24_24_t& _val);
|
||||
double_t(const audio::int24_32_t& _val);
|
||||
double_t(const audio::int32_32_t& _val);
|
||||
double_t(const audio::int32_64_t& _val);
|
||||
double_t(const audio::int64_64_t& _val);
|
||||
double_t(const audio::float_t& _val);
|
||||
double_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
double_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(double _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
double get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const double_t& operator= (const double_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const double_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const double_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::double_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::double_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::double_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::double_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const double_t& operator+= (const double_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
double_t operator+ (const double_t& _obj) const {
|
||||
double_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const double_t& operator-= (const double_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
double_t operator- (const double_t& _obj) const {
|
||||
double_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const double_t& operator*= (const double_t& _obj) {
|
||||
m_data *= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
double_t operator* (const double_t& _obj) const {
|
||||
double_t tmpp(m_data);
|
||||
tmpp.m_data *= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const double_t& operator/= (const double_t& _obj) {
|
||||
m_data /= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
double_t operator/ (const double_t& _obj) const{
|
||||
double_t tmpp(m_data);
|
||||
tmpp.m_data /= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
double_t& operator++() {
|
||||
m_data += 1.0f;
|
||||
return *this;
|
||||
}
|
||||
double_t operator++(int _unused) {
|
||||
double_t result(m_data);
|
||||
result.m_data += 1.0f;
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
double_t& operator--() {
|
||||
m_data -= 1.0f;
|
||||
return *this;
|
||||
}
|
||||
double_t operator--(int _unused) {
|
||||
double_t result(m_data);
|
||||
result.m_data -= 1.0f;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::double_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,3 +8,60 @@
|
||||
#include <audio/float_t.h>
|
||||
|
||||
|
||||
audio::float_t::float_t(const audio::int8_8_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT8_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int8_16_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT8_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int16_16_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT16_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int16_32_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT16_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int24_24_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT24_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int24_32_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT24_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int32_32_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT32_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int32_64_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT32_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::int64_64_t& _val) {
|
||||
m_data = float(_val.get()) / float(INT64_MAX);
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::float_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::float_t::float_t(const audio::double_t& _val) {
|
||||
m_data = float(_val.get());
|
||||
}
|
||||
|
||||
audio::float_t::float_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::float_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
m_data = float(_value << (32-_flotingPointPosition)) / float(INT32_MAX);
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::float_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":f]";
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
150
audio/float_t.h
150
audio/float_t.h
@ -14,10 +14,160 @@ namespace audio {
|
||||
private:
|
||||
float m_data;
|
||||
public:
|
||||
float_t() {}
|
||||
float_t(float _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
float_t(const audio::int8_8_t& _val);
|
||||
float_t(const audio::int8_16_t& _val);
|
||||
float_t(const audio::int16_16_t& _val);
|
||||
float_t(const audio::int16_32_t& _val);
|
||||
float_t(const audio::int24_24_t& _val);
|
||||
float_t(const audio::int24_32_t& _val);
|
||||
float_t(const audio::int32_32_t& _val);
|
||||
float_t(const audio::int32_64_t& _val);
|
||||
float_t(const audio::int64_64_t& _val);
|
||||
float_t(const audio::float_t& _val);
|
||||
float_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
float_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(float _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
float get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const float_t& operator= (const float_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const float_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const float_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::float_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::float_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::float_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::float_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const float_t& operator+= (const float_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
float_t operator+ (const float_t& _obj) const {
|
||||
float_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const float_t& operator-= (const float_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
float_t operator- (const float_t& _obj) const {
|
||||
float_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const float_t& operator*= (const float_t& _obj) {
|
||||
m_data *= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
float_t operator* (const float_t& _obj) const {
|
||||
float_t tmpp(m_data);
|
||||
tmpp.m_data *= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const float_t& operator/= (const float_t& _obj) {
|
||||
m_data /= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
float_t operator/ (const float_t& _obj) const{
|
||||
float_t tmpp(m_data);
|
||||
tmpp.m_data /= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
float_t& operator++() {
|
||||
m_data += 1.0f;
|
||||
return *this;
|
||||
}
|
||||
float_t operator++(int _unused) {
|
||||
float_t result(m_data);
|
||||
result.m_data += 1.0f;
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
float_t& operator--() {
|
||||
m_data -= 1.0f;
|
||||
return *this;
|
||||
}
|
||||
float_t operator--(int _unused) {
|
||||
float_t result(m_data);
|
||||
result.m_data -= 1.0f;
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::float_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -14,6 +14,7 @@ static const char* listValues[] = {
|
||||
"int16",
|
||||
"int16-on-int32",
|
||||
"int24",
|
||||
"int24-on-int32",
|
||||
"int32",
|
||||
"int32-on-int64",
|
||||
"int64",
|
||||
|
@ -64,7 +64,7 @@ audio::int16_16_t::int16_16_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * 32767.0f
|
||||
) * float(INT16_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
@ -72,15 +72,23 @@ audio::int16_16_t::int16_16_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * 32767.0
|
||||
) * double(INT16_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(int32_t _value, int32_t _flotingPointPosition) {
|
||||
audio::int16_16_t::int16_16_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::int16_16_t::set(int32_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (16-_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));
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int16_16_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.16=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT16_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,17 @@
|
||||
#ifndef __AUDIO_TYPE_INT16_16_T_H__
|
||||
#define __AUDIO_TYPE_INT16_16_T_H__
|
||||
|
||||
#include <audio/debug.h>
|
||||
|
||||
namespace audio {
|
||||
class int16_16_t{
|
||||
private:
|
||||
int16_t m_data;
|
||||
public:
|
||||
int16_16_t() {}
|
||||
int16_16_t(int16_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int16_16_t(const audio::int8_8_t& _val);
|
||||
int16_16_t(const audio::int8_16_t& _val);
|
||||
@ -28,13 +33,148 @@ namespace audio {
|
||||
int16_16_t(const audio::float_t& _val);
|
||||
int16_16_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int16_16_t(int32_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value, int32_t _flotingPointPosition);
|
||||
int16_16_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int16_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int16_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int16_16_t& operator= (const int16_16_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int16_16_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int16_16_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int16_16_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int16_16_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int16_16_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int16_16_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int16_16_t& operator+= (const int16_16_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int16_16_t operator+ (const int16_16_t& _obj) const {
|
||||
int16_16_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int16_16_t& operator-= (const int16_16_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int16_16_t operator- (const int16_16_t& _obj) const {
|
||||
int16_16_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int16_16_t& operator*= (const int16_16_t& _obj) {
|
||||
int32_t tmp = int32_t(m_data) * int32_t(_obj.m_data) + (1<<14);
|
||||
m_data = int16_t(tmp >> 15);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int16_16_t operator* (const int16_16_t& _obj) const {
|
||||
int16_16_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int16_16_t& operator/= (const int16_16_t& _obj) {
|
||||
int32_t tmp = (int32_t(m_data) << 15) / int32_t(_obj.m_data);
|
||||
m_data = int16_t(tmp);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int16_16_t operator/ (const int16_16_t& _obj) const{
|
||||
int16_16_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int16_16_t& operator++() {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int16_16_t operator++(int _unused) {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
int16_16_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int16_16_t& operator--() {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int16_16_t operator--(int _unused) {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
int16_16_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int16_16_t& _obj);
|
||||
}
|
||||
|
||||
#include <audio/debugRemove.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,17 +8,6 @@
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::int8_8_t& _val) {
|
||||
m_data = int32_t(_val.get()) << 8;
|
||||
}
|
||||
@ -44,11 +33,11 @@ audio::int16_32_t::int16_32_t(const audio::int24_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::int32_32_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 16);
|
||||
m_data = int32_t(_val.get() >> 16);
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::int32_64_t& _val) {
|
||||
m_data = int16_t(std::avg(int64_t(INT56_MIN),
|
||||
m_data = int32_t(std::avg(int64_t(INT56_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT56_MAX)
|
||||
) >> 16
|
||||
@ -56,30 +45,37 @@ audio::int16_32_t::int16_32_t(const audio::int32_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::int64_64_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 56);
|
||||
m_data = int32_t(_val.get() >> 56);
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0f,
|
||||
m_data = int32_t(std::avg(float(INT16_MIN),
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * 32767.0f
|
||||
float(INT16_MAX)
|
||||
) * float(INT16_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0,
|
||||
m_data = int32_t(std::avg(double(INT16_MIN),
|
||||
_val.get(),
|
||||
1.0
|
||||
) * 32767.0
|
||||
double(INT16_MAX)
|
||||
) * double(INT16_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(int32_t _value, int32_t _flotingPointPosition) {
|
||||
audio::int16_32_t::int16_32_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::int16_32_t::set(int32_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (16-_flotingPointPosition);
|
||||
void audio::int16_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (15-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int16_32_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":8.16=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT16_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -15,6 +15,9 @@ namespace audio {
|
||||
int32_t m_data;
|
||||
public:
|
||||
int16_32_t() {}
|
||||
int16_32_t(int32_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int16_32_t(const audio::int8_8_t& _val);
|
||||
int16_32_t(const audio::int8_16_t& _val);
|
||||
@ -28,12 +31,145 @@ namespace audio {
|
||||
int16_32_t(const audio::float_t& _val);
|
||||
int16_32_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int16_32_t(int32_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value, int32_t _flotingPointPosition);
|
||||
int16_32_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int32_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int16_32_t& operator= (const int16_32_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int16_32_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int16_32_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int16_32_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int16_32_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int16_32_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int16_32_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int16_32_t& operator+= (const int16_32_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int16_32_t operator+ (const int16_32_t& _obj) const {
|
||||
int16_32_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int16_32_t& operator-= (const int16_32_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int16_32_t operator- (const int16_32_t& _obj) const {
|
||||
int16_32_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int16_32_t& operator*= (const int16_32_t& _obj) {
|
||||
int64_t tmp = int64_t(m_data) * int64_t(_obj.m_data) + (1<<14);
|
||||
m_data = int32_t(tmp >> 15);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int16_32_t operator* (const int16_32_t& _obj) const {
|
||||
int16_32_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int16_32_t& operator/= (const int16_32_t& _obj) {
|
||||
int64_t tmp = (int64_t(m_data) << 15) / int64_t(_obj.m_data);
|
||||
m_data = int32_t(tmp);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int16_32_t operator/ (const int16_32_t& _obj) const{
|
||||
int16_32_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int16_32_t& operator++() {
|
||||
m_data += (1<<16);
|
||||
return *this;
|
||||
}
|
||||
int16_32_t operator++(int _unused) {
|
||||
int16_32_t result(m_data);
|
||||
result.m_data += (1<<16);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int16_32_t& operator--() {
|
||||
m_data -= (1<<16);
|
||||
return *this;
|
||||
}
|
||||
int16_32_t operator--(int _unused) {
|
||||
int16_32_t result(m_data);
|
||||
result.m_data -= (1<<16);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int16_32_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -64,11 +64,11 @@ audio::int24_24_t::int24_24_t(const audio::double_t& _val) {
|
||||
}
|
||||
|
||||
// set operator
|
||||
audio::int24_24_t::int24_24_t(int32_t _value, int32_t _flotingPointPosition) {
|
||||
audio::int24_24_t::int24_24_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::int24_24_t::set(int32_t _value, int32_t _flotingPointPosition) {
|
||||
void audio::int24_24_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (24-_flotingPointPosition);
|
||||
val = std::avg(int64_t(INT24_MIN), val, int64_t(INT24_MAX));
|
||||
m_data[0] = (val & 0x000000ff);
|
||||
@ -76,10 +76,23 @@ void audio::int24_24_t::set(int32_t _value, int32_t _flotingPointPosition) {
|
||||
m_data[2] = (val & 0x00ff0000) >> 16;
|
||||
}
|
||||
|
||||
void audio::int24_24_t::set(int32_t _value) {
|
||||
m_data[0] = (_value & 0x000000ff);
|
||||
m_data[1] = (_value & 0x0000ff00) >> 8;
|
||||
m_data[2] = (_value & 0x00ff0000) >> 16;
|
||||
}
|
||||
|
||||
int32_t audio::int24_24_t::get() const {
|
||||
int32_t val = 0;
|
||||
val += int32_t(m_data[0]);
|
||||
val += int32_t(m_data[1]) << 8;
|
||||
val += int32_t(m_data[2]) << 16;
|
||||
val += (int32_t(m_data[2]) << 24) >> 8;
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int24_24_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.24=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT24_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -12,9 +12,12 @@
|
||||
namespace audio {
|
||||
class int24_24_t {
|
||||
private:
|
||||
int8_t m_data[3];
|
||||
uint8_t m_data[3];
|
||||
public:
|
||||
int24_24_t() {}
|
||||
int24_24_t(int32_t _value) {
|
||||
set(_value);
|
||||
}
|
||||
// transformation operator:
|
||||
int24_24_t(const audio::int8_8_t& _val);
|
||||
int24_24_t(const audio::int8_16_t& _val);
|
||||
@ -28,10 +31,12 @@ namespace audio {
|
||||
int24_24_t(const audio::float_t& _val);
|
||||
int24_24_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int24_24_t(int32_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value, int32_t _flotingPointPosition);
|
||||
int24_24_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value);
|
||||
int32_t get() const;
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int24_24_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,3 +8,100 @@
|
||||
#include <audio/int24_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int8_8_t& _val) {
|
||||
m_data = int32_t(_val.get()) << 16;
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int8_16_t& _val) {
|
||||
m_data = int32_t(_val.get()) << 16;
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int16_16_t& _val) {
|
||||
m_data = _val.get() << 8;
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int16_32_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
) << 8
|
||||
);
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int24_24_t& _val) {
|
||||
m_data = _val.get();
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int24_32_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int32_32_t& _val) {
|
||||
m_data = int32_t(_val.get() >> 8);
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int32_64_t& _val) {
|
||||
m_data = int32_t(std::avg(int64_t(INT40_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT40_MAX)
|
||||
) >> 8
|
||||
);
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int64_64_t& _val) {
|
||||
m_data = int32_t(_val.get() >> 40);
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::float_t& _val) {
|
||||
m_data = int32_t(std::avg(float(INT8_MIN),
|
||||
_val.get(),
|
||||
float(INT8_MAX)
|
||||
) * float(INT24_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::double_t& _val) {
|
||||
m_data = int32_t(std::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * double(INT24_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _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));
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int24_32_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << "8:24=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT24_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -14,10 +14,162 @@ namespace audio {
|
||||
private:
|
||||
int32_t m_data;
|
||||
public:
|
||||
int24_32_t() {}
|
||||
int24_32_t(int32_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int24_32_t(const audio::int8_8_t& _val);
|
||||
int24_32_t(const audio::int8_16_t& _val);
|
||||
int24_32_t(const audio::int16_16_t& _val);
|
||||
int24_32_t(const audio::int16_32_t& _val);
|
||||
int24_32_t(const audio::int24_24_t& _val);
|
||||
int24_32_t(const audio::int24_32_t& _val);
|
||||
int24_32_t(const audio::int32_32_t& _val);
|
||||
int24_32_t(const audio::int32_64_t& _val);
|
||||
int24_32_t(const audio::int64_64_t& _val);
|
||||
int24_32_t(const audio::float_t& _val);
|
||||
int24_32_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int24_32_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int32_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int24_32_t& operator= (const int24_32_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int24_32_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int24_32_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int24_32_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int24_32_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int24_32_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int24_32_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int24_32_t& operator+= (const int24_32_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int24_32_t operator+ (const int24_32_t& _obj) const {
|
||||
int24_32_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int24_32_t& operator-= (const int24_32_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int24_32_t operator- (const int24_32_t& _obj) const {
|
||||
int24_32_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int24_32_t& operator*= (const int24_32_t& _obj) {
|
||||
int64_t tmp = int64_t(m_data) * int64_t(_obj.m_data);
|
||||
m_data = int32_t(tmp >> 8);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int24_32_t operator* (const int24_32_t& _obj) const {
|
||||
int24_32_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int24_32_t& operator/= (const int24_32_t& _obj) {
|
||||
int64_t tmp = (int64_t(m_data) << 24) / int64_t(_obj.m_data);
|
||||
m_data = int32_t(tmp);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int24_32_t operator/ (const int24_32_t& _obj) const{
|
||||
int24_32_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int24_32_t& operator++() {
|
||||
m_data += (1<<24);
|
||||
return *this;
|
||||
}
|
||||
int24_32_t operator++(int _unused) {
|
||||
int24_32_t result(m_data);
|
||||
result.m_data += (1<<24);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int24_32_t& operator--() {
|
||||
m_data -= (1<<24);
|
||||
return *this;
|
||||
}
|
||||
int24_32_t operator--(int _unused) {
|
||||
int24_32_t result(m_data);
|
||||
result.m_data -= (1<<24);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int24_32_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,3 +8,108 @@
|
||||
#include <audio/int32_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int8_8_t& _val) {
|
||||
m_data = int32_t(_val.get()) << 24;
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int8_16_t& _val) {
|
||||
m_data = int32_t(std::avg(int16_t(INT8_MIN),
|
||||
_val.get(),
|
||||
int16_t(INT8_MAX)
|
||||
) << 24
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int16_16_t& _val) {
|
||||
m_data = int32_t(_val.get()) << 16;
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int16_32_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT16_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT16_MAX)
|
||||
) << 16
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int24_24_t& _val) {
|
||||
m_data = int32_t(_val.get() << 8);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int24_32_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
) << 8
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int32_32_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int32_64_t& _val) {
|
||||
m_data = int32_t(std::avg(int64_t(INT32_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT32_MAX)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int64_64_t& _val) {
|
||||
m_data = int32_t(_val.get() >> 32);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::float_t& _val) {
|
||||
m_data = int32_t(std::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * float(INT32_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * double(INT32_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::int32_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (32-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int32_32_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.32=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT16_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -9,16 +9,172 @@
|
||||
#ifndef __AUDIO_TYPE_INT32_32_T_H__
|
||||
#define __AUDIO_TYPE_INT32_32_T_H__
|
||||
|
||||
#include <audio/debug.h>
|
||||
|
||||
namespace audio {
|
||||
class int32_32_t {
|
||||
private:
|
||||
int32_t m_data;
|
||||
public:
|
||||
int32_32_t() {}
|
||||
int32_32_t(int32_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int32_32_t(const audio::int8_8_t& _val);
|
||||
int32_32_t(const audio::int8_16_t& _val);
|
||||
int32_32_t(const audio::int16_16_t& _val);
|
||||
int32_32_t(const audio::int16_32_t& _val);
|
||||
int32_32_t(const audio::int24_24_t& _val);
|
||||
int32_32_t(const audio::int24_32_t& _val);
|
||||
int32_32_t(const audio::int32_32_t& _val);
|
||||
int32_32_t(const audio::int32_64_t& _val);
|
||||
int32_32_t(const audio::int64_64_t& _val);
|
||||
int32_32_t(const audio::float_t& _val);
|
||||
int32_32_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int32_32_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int32_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int32_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int32_32_t& operator= (const int32_32_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int32_32_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int32_32_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int32_32_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int32_32_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int32_32_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int32_32_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int32_32_t& operator+= (const int32_32_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int32_32_t operator+ (const int32_32_t& _obj) const {
|
||||
int32_32_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int32_32_t& operator-= (const int32_32_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int32_32_t operator- (const int32_32_t& _obj) const {
|
||||
int32_32_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int32_32_t& operator*= (const int32_32_t& _obj) {
|
||||
int64_t tmp = int32_t(m_data) * int32_t(_obj.m_data);
|
||||
m_data = int32_t(tmp >> 32);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int32_32_t operator* (const int32_32_t& _obj) const {
|
||||
int32_32_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int32_32_t& operator/= (const int32_32_t& _obj) {
|
||||
int64_t tmp = (int64_t(m_data) << 32) / int32_t(_obj.m_data);
|
||||
m_data = int32_t(tmp);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int32_32_t operator/ (const int32_32_t& _obj) const{
|
||||
int32_32_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int32_32_t& operator++() {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int32_32_t operator++(int _unused) {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
int32_32_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int32_32_t& operator--() {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int32_32_t operator--(int _unused) {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
int32_32_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int32_32_t& _obj);
|
||||
}
|
||||
|
||||
#include <audio/debugRemove.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,3 +8,92 @@
|
||||
#include <audio/int32_64_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int8_8_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 24;
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int8_16_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 24;
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int16_16_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 16;
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int16_32_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 16;
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int24_24_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 8;
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int24_32_t& _val) {
|
||||
m_data = int64_t(_val.get() << 8);
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int32_32_t& _val) {
|
||||
m_data = int64_t(_val.get());
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int32_64_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::int64_64_t& _val) {
|
||||
m_data = int64_t(_val.get() >> 32);
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::float_t& _val) {
|
||||
m_data = int64_t(std::avg(float(INT32_MIN),
|
||||
_val.get(),
|
||||
float(INT32_MAX)
|
||||
) * float(INT32_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::double_t& _val) {
|
||||
m_data = int64_t(std::avg(double(INT32_MIN),
|
||||
_val.get(),
|
||||
double(INT32_MIN)
|
||||
) * double(INT32_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _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));
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int32_64_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":32.32=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT32_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -14,10 +14,162 @@ namespace audio {
|
||||
private:
|
||||
int64_t m_data;
|
||||
public:
|
||||
int32_64_t() {}
|
||||
int32_64_t(int64_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int32_64_t(const audio::int8_8_t& _val);
|
||||
int32_64_t(const audio::int8_16_t& _val);
|
||||
int32_64_t(const audio::int16_16_t& _val);
|
||||
int32_64_t(const audio::int16_32_t& _val);
|
||||
int32_64_t(const audio::int24_24_t& _val);
|
||||
int32_64_t(const audio::int24_32_t& _val);
|
||||
int32_64_t(const audio::int32_32_t& _val);
|
||||
int32_64_t(const audio::int32_64_t& _val);
|
||||
int32_64_t(const audio::int64_64_t& _val);
|
||||
int32_64_t(const audio::float_t& _val);
|
||||
int32_64_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int32_64_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int64_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int32_64_t& operator= (const int32_64_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int32_64_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int32_64_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int32_64_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int32_64_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int32_64_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int32_64_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int32_64_t& operator+= (const int32_64_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int32_64_t operator+ (const int32_64_t& _obj) const {
|
||||
int32_64_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int32_64_t& operator-= (const int32_64_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int32_64_t operator- (const int32_64_t& _obj) const {
|
||||
int32_64_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int32_64_t& operator*= (const int32_64_t& _obj) {
|
||||
int64_t tmp = m_data>>12 * _obj.m_data>>12;
|
||||
m_data = int64_t(tmp >> 8);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int32_64_t operator* (const int32_64_t& _obj) const {
|
||||
int32_64_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int32_64_t& operator/= (const int32_64_t& _obj) {
|
||||
int64_t tmp = (int64_t(m_data) << 16) / int16_t(_obj.m_data);
|
||||
m_data = int64_t(tmp)<<16;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int32_64_t operator/ (const int32_64_t& _obj) const{
|
||||
int32_64_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int32_64_t& operator++() {
|
||||
m_data += (1LL<<32);
|
||||
return *this;
|
||||
}
|
||||
int32_64_t operator++(int _unused) {
|
||||
int32_64_t result(m_data);
|
||||
result.m_data += (1LL<<32);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int32_64_t& operator--() {
|
||||
m_data -= (1LL<<32);
|
||||
return *this;
|
||||
}
|
||||
int32_64_t operator--(int _unused) {
|
||||
int32_64_t result(m_data);
|
||||
result.m_data -= (1LL<<32);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int32_64_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,3 +8,104 @@
|
||||
#include <audio/int64_64_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int8_8_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 56;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int8_16_t& _val) {
|
||||
m_data = int64_t(std::avg(int16_t(INT8_MIN),
|
||||
_val.get(),
|
||||
int16_t(INT8_MAX)
|
||||
)) << 56;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int16_16_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 48;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int16_32_t& _val) {
|
||||
m_data = int64_t(std::avg(int32_t(INT16_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT16_MAX)
|
||||
)) << 48;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int24_24_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 40;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int24_32_t& _val) {
|
||||
m_data = int64_t(std::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
)) << 40;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int32_32_t& _val) {
|
||||
m_data = int64_t(_val.get()) << 32;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int32_64_t& _val) {
|
||||
m_data = int64_t(std::avg(int64_t(INT32_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT32_MAX)
|
||||
)) << 32;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int64_64_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::float_t& _val) {
|
||||
m_data = int64_t(std::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * double(INT64_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::double_t& _val) {
|
||||
m_data = int64_t(std::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * double(INT64_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::int64_64_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (64-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int64_64_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.64=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT64_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -9,16 +9,172 @@
|
||||
#ifndef __AUDIO_TYPE_INT64_64_T_H__
|
||||
#define __AUDIO_TYPE_INT64_64_T_H__
|
||||
|
||||
#include <audio/debug.h>
|
||||
|
||||
namespace audio {
|
||||
class int64_64_t {
|
||||
private:
|
||||
int64_t m_data;
|
||||
public:
|
||||
int64_64_t() {}
|
||||
int64_64_t(int64_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int64_64_t(const audio::int8_8_t& _val);
|
||||
int64_64_t(const audio::int8_16_t& _val);
|
||||
int64_64_t(const audio::int16_16_t& _val);
|
||||
int64_64_t(const audio::int16_32_t& _val);
|
||||
int64_64_t(const audio::int24_24_t& _val);
|
||||
int64_64_t(const audio::int24_32_t& _val);
|
||||
int64_64_t(const audio::int32_32_t& _val);
|
||||
int64_64_t(const audio::int32_64_t& _val);
|
||||
int64_64_t(const audio::int64_64_t& _val);
|
||||
int64_64_t(const audio::float_t& _val);
|
||||
int64_64_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int64_64_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int64_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int64_64_t& operator= (const int64_64_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int64_64_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int64_64_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int64_64_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int64_64_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int64_64_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int64_64_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int64_64_t& operator+= (const int64_64_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int64_64_t operator+ (const int64_64_t& _obj) const {
|
||||
int64_64_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int64_64_t& operator-= (const int64_64_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int64_64_t operator- (const int64_64_t& _obj) const {
|
||||
int64_64_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int64_64_t& operator*= (const int64_64_t& _obj) {
|
||||
int16_t tmp = (m_data >> 32) * (_obj.m_data >> 32);
|
||||
m_data = tmp;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int64_64_t operator* (const int64_64_t& _obj) const {
|
||||
int64_64_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int64_64_t& operator/= (const int64_64_t& _obj) {
|
||||
int64_t tmp = (m_data << 32) / (_obj.m_data>>32);
|
||||
m_data = tmp;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int64_64_t operator/ (const int64_64_t& _obj) const{
|
||||
int64_64_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int64_64_t& operator++() {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int64_64_t operator++(int _unused) {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
int64_64_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int64_64_t& operator--() {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int64_64_t operator--(int _unused) {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
int64_64_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int64_64_t& _obj);
|
||||
}
|
||||
|
||||
#include <audio/debugRemove.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -8,3 +8,100 @@
|
||||
#include <audio/int8_16_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int8_8_t& _val) {
|
||||
m_data = int16_t(_val.get());
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int8_16_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int16_16_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 8);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int16_32_t& _val) {
|
||||
m_data = int16_t(std::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
) >> 8
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int24_24_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 16);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int24_32_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 16);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int32_32_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 24);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int32_64_t& _val) {
|
||||
m_data = int16_t(std::avg(int64_t(INT40_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT40_MAX)
|
||||
) >> 24
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int64_64_t& _val) {
|
||||
m_data = int16_t(_val.get() >> 56);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(float(INT8_MIN),
|
||||
_val.get(),
|
||||
float(INT8_MAX)
|
||||
) * float(INT8_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(double(INT8_MIN),
|
||||
_val.get(),
|
||||
double(INT8_MAX)
|
||||
) * double(INT8_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _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));
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int8_16_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":8.8=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT8_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -14,10 +14,162 @@ namespace audio {
|
||||
private:
|
||||
int16_t m_data;
|
||||
public:
|
||||
int8_16_t() {}
|
||||
int8_16_t(int16_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int8_16_t(const audio::int8_8_t& _val);
|
||||
int8_16_t(const audio::int8_16_t& _val);
|
||||
int8_16_t(const audio::int16_16_t& _val);
|
||||
int8_16_t(const audio::int16_32_t& _val);
|
||||
int8_16_t(const audio::int24_24_t& _val);
|
||||
int8_16_t(const audio::int24_32_t& _val);
|
||||
int8_16_t(const audio::int32_32_t& _val);
|
||||
int8_16_t(const audio::int32_64_t& _val);
|
||||
int8_16_t(const audio::int64_64_t& _val);
|
||||
int8_16_t(const audio::float_t& _val);
|
||||
int8_16_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int8_16_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int16_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int16_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int8_16_t& operator= (const int8_16_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int8_16_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int8_16_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int8_16_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int8_16_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int8_16_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int8_16_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int8_16_t& operator+= (const int8_16_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int8_16_t operator+ (const int8_16_t& _obj) const {
|
||||
int8_16_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int8_16_t& operator-= (const int8_16_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int8_16_t operator- (const int8_16_t& _obj) const {
|
||||
int8_16_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int8_16_t& operator*= (const int8_16_t& _obj) {
|
||||
int16_t tmp = int16_t(m_data) * int16_t(_obj.m_data);
|
||||
m_data = int8_t(tmp >> 8);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int8_16_t operator* (const int8_16_t& _obj) const {
|
||||
int8_16_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int8_16_t& operator/= (const int8_16_t& _obj) {
|
||||
int16_t tmp = (int16_t(m_data) << 8) / int16_t(_obj.m_data);
|
||||
m_data = int8_t(tmp);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int8_16_t operator/ (const int8_16_t& _obj) const{
|
||||
int8_16_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int8_16_t& operator++() {
|
||||
m_data += (1<<8);
|
||||
return *this;
|
||||
}
|
||||
int8_16_t operator++(int _unused) {
|
||||
int8_16_t result(m_data);
|
||||
result.m_data += (1<<8);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int8_16_t& operator--() {
|
||||
m_data -= (1<<8);
|
||||
return *this;
|
||||
}
|
||||
int8_16_t operator--(int _unused) {
|
||||
int8_16_t result(m_data);
|
||||
result.m_data -= (1<<8);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int8_16_t& _obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,3 +8,106 @@
|
||||
#include <audio/int8_8_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.h>
|
||||
#include <audio/int16_32_t.h>
|
||||
|
||||
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int8_8_t& _val) {
|
||||
m_data = _val.m_data;
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int8_16_t& _val) {
|
||||
m_data = int8_t(std::avg(int16_t(INT8_MIN),
|
||||
_val.get(),
|
||||
int16_t(INT8_MAX)
|
||||
));
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int16_16_t& _val) {
|
||||
m_data = int8_t(_val.get() >> 8);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int16_32_t& _val) {
|
||||
m_data = int8_t(std::avg(int32_t(INT16_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT16_MAX)
|
||||
) >> 8
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int24_24_t& _val) {
|
||||
m_data = int8_t(_val.get() >> 16);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int24_32_t& _val) {
|
||||
m_data = int8_t(std::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
) >> 16);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int32_32_t& _val) {
|
||||
m_data = int8_t(_val.get() >> 24);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int32_64_t& _val) {
|
||||
m_data = int8_t(std::avg(int64_t(INT32_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT32_MAX)
|
||||
) >> 24
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int64_64_t& _val) {
|
||||
m_data = int8_t(_val.get() >> 56);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * float(INT8_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * double(INT8_MAX)
|
||||
);
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
set(_value, _flotingPointPosition);
|
||||
}
|
||||
|
||||
void audio::int8_8_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (8-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT8_MIN), val, int64_t(INT8_MAX));
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int8_8_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.8=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT8_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
156
audio/int8_8_t.h
156
audio/int8_8_t.h
@ -9,16 +9,172 @@
|
||||
#ifndef __AUDIO_TYPE_INT8_8_T_H__
|
||||
#define __AUDIO_TYPE_INT8_8_T_H__
|
||||
|
||||
#include <audio/debug.h>
|
||||
|
||||
namespace audio {
|
||||
class int8_8_t {
|
||||
private:
|
||||
int8_t m_data;
|
||||
public:
|
||||
int8_8_t() {}
|
||||
int8_8_t(int8_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
// transformation operator:
|
||||
int8_8_t(const audio::int8_8_t& _val);
|
||||
int8_8_t(const audio::int8_16_t& _val);
|
||||
int8_8_t(const audio::int16_16_t& _val);
|
||||
int8_8_t(const audio::int16_32_t& _val);
|
||||
int8_8_t(const audio::int24_24_t& _val);
|
||||
int8_8_t(const audio::int24_32_t& _val);
|
||||
int8_8_t(const audio::int32_32_t& _val);
|
||||
int8_8_t(const audio::int32_64_t& _val);
|
||||
int8_8_t(const audio::int64_64_t& _val);
|
||||
int8_8_t(const audio::float_t& _val);
|
||||
int8_8_t(const audio::double_t& _val);
|
||||
// set operator
|
||||
int8_8_t(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int64_t _value, int32_t _flotingPointPosition);
|
||||
void set(int8_t _value) {
|
||||
m_data = _value;
|
||||
}
|
||||
int8_t get() const {
|
||||
return m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* = assigment
|
||||
*****************************************************/
|
||||
const int8_8_t& operator= (const int8_8_t& _obj ) {
|
||||
m_data = _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* == operator
|
||||
*****************************************************/
|
||||
bool operator== (const int8_8_t& _obj) const {
|
||||
return _obj.m_data == m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* != operator
|
||||
*****************************************************/
|
||||
bool operator!= (const int8_8_t& _obj) const {
|
||||
return _obj.m_data != m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator< (const audio::int8_8_t& _obj) const {
|
||||
return m_data < _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator<= (const audio::int8_8_t& _obj) const {
|
||||
return m_data <= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator> (const audio::int8_8_t& _obj) const {
|
||||
return m_data > _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* < operator
|
||||
*****************************************************/
|
||||
bool operator>= (const audio::int8_8_t& _obj) const {
|
||||
return m_data >= _obj.m_data;
|
||||
}
|
||||
/* ****************************************************
|
||||
* += operator
|
||||
*****************************************************/
|
||||
const int8_8_t& operator+= (const int8_8_t& _obj) {
|
||||
m_data += _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* + operator
|
||||
*****************************************************/
|
||||
int8_8_t operator+ (const int8_8_t& _obj) const {
|
||||
int8_8_t tmpp(m_data);
|
||||
tmpp.m_data += _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -= operator
|
||||
*****************************************************/
|
||||
const int8_8_t& operator-= (const int8_8_t& _obj) {
|
||||
m_data -= _obj.m_data;
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* - operator
|
||||
*****************************************************/
|
||||
int8_8_t operator- (const int8_8_t& _obj) const {
|
||||
int8_8_t tmpp(m_data);
|
||||
tmpp.m_data -= _obj.m_data;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* *= operator
|
||||
*****************************************************/
|
||||
const int8_8_t& operator*= (const int8_8_t& _obj) {
|
||||
int16_t tmp = int16_t(m_data) * int16_t(_obj.m_data);
|
||||
m_data = int8_t(tmp >> 8);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* * operator
|
||||
*****************************************************/
|
||||
int8_8_t operator* (const int8_8_t& _obj) const {
|
||||
int8_8_t tmpp(m_data);
|
||||
tmpp *= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* /= operator
|
||||
*****************************************************/
|
||||
const int8_8_t& operator/= (const int8_8_t& _obj) {
|
||||
int16_t tmp = (int16_t(m_data) << 8) / int16_t(_obj.m_data);
|
||||
m_data = int8_t(tmp);
|
||||
return *this;
|
||||
}
|
||||
/* ****************************************************
|
||||
* / operator
|
||||
*****************************************************/
|
||||
int8_8_t operator/ (const int8_8_t& _obj) const{
|
||||
int8_8_t tmpp(m_data);
|
||||
tmpp /= _obj;
|
||||
return tmpp;
|
||||
}
|
||||
/* ****************************************************
|
||||
* ++ operator
|
||||
*****************************************************/
|
||||
int8_8_t& operator++() {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int8_8_t operator++(int _unused) {
|
||||
AUDIO_CRITICAL("INCREMENT ++ a type that can not be > 0");
|
||||
int8_8_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
/* ****************************************************
|
||||
* -- operator
|
||||
*****************************************************/
|
||||
int8_8_t& operator--() {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
return *this;
|
||||
}
|
||||
int8_8_t operator--(int _unused) {
|
||||
AUDIO_CRITICAL("DECREMENT -- a type that can not be > 0");
|
||||
int8_8_t result(m_data);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int8_8_t& _obj);
|
||||
}
|
||||
|
||||
#include <audio/debugRemove.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -20,9 +20,21 @@ namespace audio {
|
||||
class float_t;
|
||||
class double_t;
|
||||
}
|
||||
/*
|
||||
namespace audio {
|
||||
const minInt64[65];
|
||||
const maxInt64[65];
|
||||
const minIntFloat[65];
|
||||
const maxIntFloat[65];
|
||||
const minIntDouble[65];
|
||||
const maxIntDouble[65];
|
||||
}
|
||||
*/
|
||||
#define INT24_MIN 0xFFFFFFFFFF800000LL
|
||||
#define INT24_MAX 0x00000000007FFFFFLL
|
||||
|
||||
#define INT24_MIN 0xFF800000
|
||||
#define INT24_MAX 0x007FFFFF
|
||||
#define INT40_MIN 0xFFFFFF8000000000LL
|
||||
#define INT40_MAX 0x0000007FFFFFFFFFLL
|
||||
|
||||
#define INT56_MIN 0xFFFF800000000000LL
|
||||
#define INT56_MAX 0x00007FFFFFFFFFFFLL
|
||||
|
@ -9,7 +9,6 @@ def get_desc():
|
||||
|
||||
def create(target):
|
||||
myModule = module.Module(__file__, 'audio', 'LIBRARY')
|
||||
|
||||
myModule.add_src_file([
|
||||
'audio/debug.cpp',
|
||||
'audio/channel.cpp',
|
||||
@ -26,19 +25,7 @@ def create(target):
|
||||
'audio/float_t.cpp',
|
||||
'audio/double_t.cpp'
|
||||
])
|
||||
|
||||
myModule.add_module_depend(['etk'])
|
||||
myModule.add_export_path(tools.get_current_path(__file__))
|
||||
|
||||
# add the currrent module at the
|
||||
return myModule
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
24
lutin_audio_test.py
Normal file
24
lutin_audio_test.py
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/python
|
||||
import lutinModule as module
|
||||
import lutinTools as tools
|
||||
import lutinDebug as debug
|
||||
|
||||
def get_desc():
|
||||
return "audio_test : Basic audio types test"
|
||||
|
||||
|
||||
def create(target):
|
||||
myModule = module.Module(__file__, 'audio_test', 'BINARY')
|
||||
myModule.add_src_file([
|
||||
'test/debug.cpp',
|
||||
'test/main.cpp',
|
||||
'test/base.cpp',
|
||||
'test/test_int16_16.cpp',
|
||||
'test/test_int16_32.cpp',
|
||||
'test/test_float.cpp'
|
||||
])
|
||||
myModule.add_module_depend(['audio', 'gtest'])
|
||||
return myModule
|
||||
|
||||
|
||||
|
165
test/base.cpp
Normal file
165
test/base.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <audio/types.h>
|
||||
|
||||
|
||||
|
||||
TEST(TestBase, type_int8_8_t) {
|
||||
audio::int8_8_t typeBase(16, 8);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT8_MIN, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT8_MIN);
|
||||
typeBase.set(INT8_MAX, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT8_MAX);
|
||||
typeBase.set(INT8_MAX+200, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT8_MAX);
|
||||
typeBase.set(INT8_MIN-200, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT8_MIN);
|
||||
typeBase.set(-125);
|
||||
EXPECT_EQ(typeBase.get(), -125);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_int8_16_t) {
|
||||
audio::int8_16_t typeBase(16, 8);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT16_MIN, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MIN);
|
||||
typeBase.set(INT16_MAX, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MAX);
|
||||
typeBase.set(INT16_MAX+200, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MAX);
|
||||
typeBase.set(INT16_MIN-200, 8);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MIN);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
|
||||
TEST(TestBase, type_int16_16_t) {
|
||||
audio::int16_16_t typeBase(16, 16);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT16_MIN, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MIN);
|
||||
typeBase.set(INT16_MAX, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MAX);
|
||||
typeBase.set(INT16_MAX+200, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MAX);
|
||||
typeBase.set(INT16_MIN-200, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT16_MIN);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_int16_32_t) {
|
||||
audio::int16_32_t typeBase(16, 16);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT32_MIN, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(INT32_MAX, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MAX)+200, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MIN)-200, 16);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
|
||||
TEST(TestBase, type_int24_24_t) {
|
||||
audio::int24_24_t typeBase(16, 24);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT24_MIN, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT24_MIN);
|
||||
typeBase.set(INT24_MAX, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT24_MAX);
|
||||
typeBase.set(int64_t(INT24_MAX)+200, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT24_MAX);
|
||||
typeBase.set(int64_t(INT24_MIN)-200, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT24_MIN);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
|
||||
TEST(TestBase, type_int24_32_t) {
|
||||
audio::int24_32_t typeBase(16, 24);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT32_MIN, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(INT32_MAX, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MAX)+200, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MIN)-200, 24);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_int32_32_t) {
|
||||
audio::int32_32_t typeBase(16, 32);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT32_MIN, 32);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(INT32_MAX, 32);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MAX)+200, 32);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MIN)-200, 32);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_int32_64_t) {
|
||||
audio::int32_64_t typeBase(16, 32);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT64_MIN, 32);
|
||||
EXPECT_EQ(typeBase.get(), INT64_MIN);
|
||||
typeBase.set(INT64_MAX, 32);
|
||||
EXPECT_EQ(typeBase.get(), INT64_MAX);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_int64_64_t) {
|
||||
audio::int64_64_t typeBase(16, 64);
|
||||
EXPECT_EQ(typeBase.get(), 16);
|
||||
typeBase.set(INT64_MIN, 64);
|
||||
EXPECT_EQ(typeBase.get(), INT64_MIN);
|
||||
typeBase.set(INT64_MAX, 64);
|
||||
EXPECT_EQ(typeBase.get(), INT64_MAX);
|
||||
typeBase.set(-250);
|
||||
EXPECT_EQ(typeBase.get(), -250);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_float_t) {
|
||||
audio::float_t typeBase(16, 1);
|
||||
EXPECT_EQ(typeBase.get(), 16.0);
|
||||
typeBase.set(INT32_MIN, 1);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MIN);
|
||||
typeBase.set(INT32_MAX, 1);
|
||||
EXPECT_EQ(typeBase.get(), INT32_MAX);
|
||||
typeBase.set(int64_t(INT32_MAX)+200, 1);
|
||||
EXPECT_EQ(typeBase.get(), 2.147483840e+09f); // Note : floating point error
|
||||
typeBase.set(int64_t(INT32_MIN)-200, 1);
|
||||
EXPECT_EQ(typeBase.get(), -2.147483904e+09f); // Note : floating point error
|
||||
typeBase.set(-250.0f);
|
||||
EXPECT_EQ(typeBase.get(), -250.0f);
|
||||
}
|
||||
|
||||
TEST(TestBase, type_double_t) {
|
||||
audio::double_t typeBase(16, 1);
|
||||
EXPECT_EQ(int64_t(typeBase.get()), 16LL);
|
||||
EXPECT_EQ(typeBase.get(), 16.00000000745058); // Note : double point error
|
||||
typeBase.set(-250.0);
|
||||
EXPECT_EQ(typeBase.get(), -250.0);
|
||||
}
|
||||
|
15
test/debug.cpp
Normal file
15
test/debug.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license GPL v3 (see license file)
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
int32_t appl::getLogId() {
|
||||
static int32_t g_val = etk::log::registerInstance("test");
|
||||
return g_val;
|
||||
}
|
||||
|
42
test/debug.h
Normal file
42
test/debug.h
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license GPL v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __APPL_DEBUG_H__
|
||||
#define __APPL_DEBUG_H__
|
||||
|
||||
#include <etk/log.h>
|
||||
|
||||
namespace appl {
|
||||
int32_t getLogId();
|
||||
};
|
||||
#define APPL_BASE(info,data) TK_LOG_BASE(appl::getLogId(),info,data)
|
||||
|
||||
#define APPL_CRITICAL(data) APPL_BASE(1, data)
|
||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||
#define APPL_WARNING(data) APPL_BASE(3, data)
|
||||
#ifdef DEBUG
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#define APPL_DEBUG(data) APPL_BASE(5, data)
|
||||
#define APPL_VERBOSE(data) APPL_BASE(6, data)
|
||||
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
|
||||
#else
|
||||
#define APPL_INFO(data) do { } while(false)
|
||||
#define APPL_DEBUG(data) do { } while(false)
|
||||
#define APPL_VERBOSE(data) do { } while(false)
|
||||
#define APPL_TODO(data) do { } while(false)
|
||||
#endif
|
||||
|
||||
#define APPL_ASSERT(cond,data) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
APPL_CRITICAL(data); \
|
||||
assert(!#cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
38
test/main.cpp
Normal file
38
test/main.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <etk/etk.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <math.h>
|
||||
#include <sstream>
|
||||
#include <unistd.h>
|
||||
#include <etk/thread.h>
|
||||
#include <audio/types.h>
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "test"
|
||||
|
||||
int main(int _argc, const char** _argv) {
|
||||
// init Google test :
|
||||
::testing::InitGoogleTest(&_argc, const_cast<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];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
APPL_INFO("Help : ");
|
||||
APPL_INFO(" ./xxx ---");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
|
||||
|
0
test/test_float.cpp
Normal file
0
test/test_float.cpp
Normal file
32
test/test_int16_16.cpp
Normal file
32
test/test_int16_16.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <audio/types.h>
|
||||
|
||||
|
||||
|
||||
TEST(TestInt16_16, basicOperator) {
|
||||
audio::int16_16_t typeBase(16);
|
||||
audio::int16_16_t out(1, 0);
|
||||
|
||||
EXPECT_EQ(out.get(), ((1<<15)-1));
|
||||
out *= 16;
|
||||
EXPECT_EQ(out.get(), 16);
|
||||
out = 1;
|
||||
EXPECT_EQ(out.get(), 1);
|
||||
out *= typeBase;
|
||||
EXPECT_EQ(out.get(), 0);
|
||||
out = audio::float_t(0.3);
|
||||
APPL_INFO(" data = " << out);
|
||||
out += audio::float_t(0.3);
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), audio::int16_16_t(audio::float_t(0.6)).get());
|
||||
out *= audio::float_t(0.3);
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), audio::int16_16_t(audio::float_t(0.18)).get());
|
||||
}
|
38
test/test_int16_32.cpp
Normal file
38
test/test_int16_32.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include <audio/types.h>
|
||||
|
||||
|
||||
|
||||
TEST(TestInt16_32, basicOperator) {
|
||||
audio::int16_32_t typeBase(16);
|
||||
audio::int16_32_t out(1, 0);
|
||||
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), ((1<<15)));
|
||||
out *= 16;
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), 16);
|
||||
out = 1;
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), 1);
|
||||
out *= typeBase;
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), 0);
|
||||
out = audio::float_t(0.3);
|
||||
APPL_INFO(" data = " << out);
|
||||
out += audio::float_t(0.3);
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), audio::int16_32_t(audio::float_t(0.6)).get());
|
||||
out *= audio::float_t(0.3);
|
||||
APPL_INFO(" data = " << out);
|
||||
EXPECT_EQ(out.get(), audio::int16_32_t(audio::float_t(0.18)).get());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user