[DEV] continue removing stl
This commit is contained in:
parent
e8778a51aa
commit
484e81e834
@ -49,15 +49,15 @@ void audio::algo::chunkware::Compressor::init() {
|
||||
m_isConfigured = true;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::algo::chunkware::Compressor::getSupportedFormat() {
|
||||
std::vector<enum audio::format> out = getNativeSupportedFormat();
|
||||
out.push_back(audio::format_int16);
|
||||
etk::Vector<enum audio::format> audio::algo::chunkware::Compressor::getSupportedFormat() {
|
||||
etk::Vector<enum audio::format> out = getNativeSupportedFormat();
|
||||
out.pushBack(audio::format_int16);
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::algo::chunkware::Compressor::getNativeSupportedFormat() {
|
||||
std::vector<enum audio::format> out;
|
||||
out.push_back(audio::format_double);
|
||||
etk::Vector<enum audio::format> audio::algo::chunkware::Compressor::getNativeSupportedFormat() {
|
||||
etk::Vector<enum audio::format> out;
|
||||
out.pushBack(audio::format_double);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ void audio::algo::chunkware::Compressor::process(void* _output, const void* _inp
|
||||
processDouble(vals, vals, _nbChannel);
|
||||
for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) {
|
||||
vals[kkk] *= 32768.0;
|
||||
output[iii*_nbChannel+kkk] = int16_t(std::avg(-32768.0, vals[kkk], 32767.0));
|
||||
output[iii*_nbChannel+kkk] = int16_t(etk::avg(-32768.0, vals[kkk], 32767.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ void audio::algo::chunkware::Compressor::processDouble(double* _out, const doubl
|
||||
// get greater value;
|
||||
for (int8_t iii=0; iii<_nbChannel; ++iii) {
|
||||
double absValue = std::abs(_in[iii]);
|
||||
keyLink = std::max(keyLink, absValue);
|
||||
keyLink = etk::max(keyLink, absValue);
|
||||
}
|
||||
processDouble(_out, _in, _nbChannel, keyLink);
|
||||
}
|
||||
|
@ -47,12 +47,12 @@ namespace audio {
|
||||
* @brief Get list of format suported in input.
|
||||
* @return list of supported format
|
||||
*/
|
||||
virtual std::vector<enum audio::format> getSupportedFormat();
|
||||
virtual etk::Vector<enum audio::format> getSupportedFormat();
|
||||
/**
|
||||
* @brief Get list of algorithm format suported. No format convertion.
|
||||
* @return list of supported format
|
||||
*/
|
||||
virtual std::vector<enum audio::format> getNativeSupportedFormat();
|
||||
virtual etk::Vector<enum audio::format> getNativeSupportedFormat();
|
||||
/**
|
||||
* @brief Main input algo process.
|
||||
* @param[in,out] _output Output data.
|
||||
|
@ -47,15 +47,15 @@ void audio::algo::chunkware::Gate::init() {
|
||||
m_isConfigured = true;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::algo::chunkware::Gate::getSupportedFormat() {
|
||||
std::vector<enum audio::format> out = getNativeSupportedFormat();
|
||||
out.push_back(audio::format_int16);
|
||||
etk::Vector<enum audio::format> audio::algo::chunkware::Gate::getSupportedFormat() {
|
||||
etk::Vector<enum audio::format> out = getNativeSupportedFormat();
|
||||
out.pushBack(audio::format_int16);
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::algo::chunkware::Gate::getNativeSupportedFormat() {
|
||||
std::vector<enum audio::format> out;
|
||||
out.push_back(audio::format_double);
|
||||
etk::Vector<enum audio::format> audio::algo::chunkware::Gate::getNativeSupportedFormat() {
|
||||
etk::Vector<enum audio::format> out;
|
||||
out.pushBack(audio::format_double);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ void audio::algo::chunkware::Gate::process(void* _output, const void* _input, si
|
||||
processDouble(vals, vals, _nbChannel);
|
||||
for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) {
|
||||
vals[kkk] *= 32768.0;
|
||||
output[iii*_nbChannel+kkk] = int16_t(std::avg(-32768.0, vals[kkk], 32767.0));
|
||||
output[iii*_nbChannel+kkk] = int16_t(etk::avg(-32768.0, vals[kkk], 32767.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,7 +104,7 @@ void audio::algo::chunkware::Gate::processDouble(double* _out, const double* _in
|
||||
// get greater value;
|
||||
for (int8_t iii=0; iii<_nbChannel; ++iii) {
|
||||
double absValue = std::abs(_in[iii]);
|
||||
keyLink = std::max(keyLink, absValue);
|
||||
keyLink = etk::max(keyLink, absValue);
|
||||
}
|
||||
processDouble(_out, _in, _nbChannel, keyLink);
|
||||
}
|
||||
|
@ -47,12 +47,12 @@ namespace audio {
|
||||
* @brief Get list of format suported in input.
|
||||
* @return list of supported format
|
||||
*/
|
||||
virtual std::vector<enum audio::format> getSupportedFormat();
|
||||
virtual etk::Vector<enum audio::format> getSupportedFormat();
|
||||
/**
|
||||
* @brief Get list of algorithm format suported. No format convertion.
|
||||
* @return list of supported format
|
||||
*/
|
||||
virtual std::vector<enum audio::format> getNativeSupportedFormat();
|
||||
virtual etk::Vector<enum audio::format> getNativeSupportedFormat();
|
||||
/**
|
||||
* @brief Main input algo process.
|
||||
* @param[in,out] _output Output data.
|
||||
|
@ -84,15 +84,15 @@ void audio::algo::chunkware::FastEnvelope::setCoef() {
|
||||
m_coefficient = std::pow(0.01, (1000.0 / (m_timeMs * m_sampleRate)));
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::algo::chunkware::Limiter::getSupportedFormat() {
|
||||
std::vector<enum audio::format> out = getNativeSupportedFormat();
|
||||
out.push_back(audio::format_int16);
|
||||
etk::Vector<enum audio::format> audio::algo::chunkware::Limiter::getSupportedFormat() {
|
||||
etk::Vector<enum audio::format> out = getNativeSupportedFormat();
|
||||
out.pushBack(audio::format_int16);
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::algo::chunkware::Limiter::getNativeSupportedFormat() {
|
||||
std::vector<enum audio::format> out;
|
||||
out.push_back(audio::format_double);
|
||||
etk::Vector<enum audio::format> audio::algo::chunkware::Limiter::getNativeSupportedFormat() {
|
||||
etk::Vector<enum audio::format> out;
|
||||
out.pushBack(audio::format_double);
|
||||
return out;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ void audio::algo::chunkware::Limiter::process(void* _output, const void* _input,
|
||||
processDouble(vals, vals, _nbChannel);
|
||||
for (int8_t kkk=0; kkk<_nbChannel ; ++kkk) {
|
||||
vals[kkk] *= 32768.0;
|
||||
output[iii*_nbChannel+kkk] = int16_t(std::avg(-32768.0, vals[kkk], 32767.0));
|
||||
output[iii*_nbChannel+kkk] = int16_t(etk::avg(-32768.0, vals[kkk], 32767.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ void audio::algo::chunkware::Limiter::processDouble(double* _out, const double*
|
||||
// get greater value;
|
||||
for (int8_t iii=0; iii<_nbChannel; ++iii) {
|
||||
double absValue = std::abs(_in[iii]);
|
||||
keyLink = std::max(keyLink, absValue);
|
||||
keyLink = etk::max(keyLink, absValue);
|
||||
}
|
||||
// we always want to feed the sidechain AT LEATS the threshold value
|
||||
if (keyLink < m_threshold) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <audio/algo/chunkware/AttRelEnvelope.hpp>
|
||||
#include <audio/algo/chunkware/Gain.hpp>
|
||||
#include <chrono>
|
||||
#include <vector>
|
||||
#include <etk/Vector.hpp>
|
||||
|
||||
namespace audio {
|
||||
namespace algo {
|
||||
@ -63,12 +63,12 @@ namespace audio {
|
||||
* @brief Get list of format suported in input.
|
||||
* @return list of supported format
|
||||
*/
|
||||
virtual std::vector<enum audio::format> getSupportedFormat();
|
||||
virtual etk::Vector<enum audio::format> getSupportedFormat();
|
||||
/**
|
||||
* @brief Get list of algorithm format suported. No format convertion.
|
||||
* @return list of supported format
|
||||
*/
|
||||
virtual std::vector<enum audio::format> getNativeSupportedFormat();
|
||||
virtual etk::Vector<enum audio::format> getNativeSupportedFormat();
|
||||
/**
|
||||
* @brief Main input algo process.
|
||||
* @param[in,out] _output Output data.
|
||||
@ -150,7 +150,7 @@ namespace audio {
|
||||
static const int BUFFER_SIZE = 1024; //!< buffer size (always a power of 2!)
|
||||
uint32_t m_bufferMask; //!< buffer mask
|
||||
uint32_t m_cursor; //!< cursor
|
||||
std::vector<std::vector<double> > m_outputBuffer; //!< output buffer
|
||||
etk::Vector<etk::Vector<double> > m_outputBuffer; //!< output buffer
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,8 @@
|
||||
|
||||
|
||||
|
||||
static std::vector<double> convert(const std::vector<int16_t>& _data) {
|
||||
std::vector<double> out;
|
||||
static etk::Vector<double> convert(const etk::Vector<int16_t>& _data) {
|
||||
etk::Vector<double> out;
|
||||
out.resize(_data.size(), 0.0);
|
||||
for (size_t iii=0; iii<_data.size(); ++iii) {
|
||||
out[iii] = _data[iii];
|
||||
@ -27,11 +27,11 @@ static std::vector<double> convert(const std::vector<int16_t>& _data) {
|
||||
return out;
|
||||
}
|
||||
|
||||
static std::vector<int16_t> convert(const std::vector<double>& _data) {
|
||||
std::vector<int16_t> out;
|
||||
static etk::Vector<int16_t> convert(const etk::Vector<double>& _data) {
|
||||
etk::Vector<int16_t> out;
|
||||
out.resize(_data.size(), 0.0);
|
||||
for (size_t iii=0; iii<_data.size(); ++iii) {
|
||||
out[iii] = int16_t(std::avg(-32768.0, _data[iii]*32768.0, 32767.0));
|
||||
out[iii] = int16_t(etk::avg(-32768.0, _data[iii]*32768.0, 32767.0));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -59,8 +59,8 @@ class Performance {
|
||||
void toc() {
|
||||
m_timeStop = std::chrono::steady_clock::now();
|
||||
std::chrono::nanoseconds time = m_timeStop - m_timeStart;
|
||||
m_minProcessing = std::min(m_minProcessing, time);
|
||||
m_maxProcessing = std::max(m_maxProcessing, time);
|
||||
m_minProcessing = etk::min(m_minProcessing, time);
|
||||
m_maxProcessing = etk::max(m_maxProcessing, time);
|
||||
m_totalTimeProcessing += time;
|
||||
m_totalIteration++;
|
||||
|
||||
@ -82,9 +82,9 @@ class Performance {
|
||||
};
|
||||
|
||||
void performanceCompressor() {
|
||||
std::vector<double> input;
|
||||
etk::Vector<double> input;
|
||||
input.resize(8192, 0);
|
||||
std::vector<double> output;
|
||||
etk::Vector<double> output;
|
||||
output.resize(8192, 0);
|
||||
double sampleRate = 48000.0;
|
||||
{
|
||||
@ -121,9 +121,9 @@ void performanceCompressor() {
|
||||
}
|
||||
|
||||
void performanceLimiter() {
|
||||
std::vector<double> input;
|
||||
etk::Vector<double> input;
|
||||
input.resize(8192, 0);
|
||||
std::vector<double> output;
|
||||
etk::Vector<double> output;
|
||||
output.resize(8192, 0);
|
||||
double sampleRate = 48000.0;
|
||||
{
|
||||
@ -162,9 +162,9 @@ void performanceLimiter() {
|
||||
}
|
||||
|
||||
void performanceGate() {
|
||||
std::vector<double> input;
|
||||
etk::Vector<double> input;
|
||||
input.resize(8192, 0);
|
||||
std::vector<double> output;
|
||||
etk::Vector<double> output;
|
||||
output.resize(8192, 0);
|
||||
double sampleRate = 48000.0;
|
||||
{
|
||||
@ -208,12 +208,12 @@ void performanceGate() {
|
||||
int main(int _argc, const char** _argv) {
|
||||
// the only one init for etk:
|
||||
etk::init(_argc, _argv);
|
||||
std::string inputName = "";
|
||||
etk::String inputName = "";
|
||||
bool performance = false;
|
||||
bool perf = false;
|
||||
int64_t sampleRate = 48000;
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if (etk::start_with(data,"--in=")) {
|
||||
inputName = &data[5];
|
||||
} else if (data == "--performance") {
|
||||
@ -246,10 +246,10 @@ int main(int _argc, const char** _argv) {
|
||||
exit(-1);
|
||||
}
|
||||
TEST_INFO("Read input:");
|
||||
std::vector<double> inputData = convert(etk::FSNodeReadAllDataType<int16_t>(inputName));
|
||||
etk::Vector<double> inputData = convert(etk::FSNodeReadAllDataType<int16_t>(inputName));
|
||||
TEST_INFO(" " << inputData.size() << " samples");
|
||||
// resize output :
|
||||
std::vector<double> output;
|
||||
etk::Vector<double> output;
|
||||
output.resize(inputData.size(), 0);
|
||||
// process in chunk of 256 samples
|
||||
int32_t blockSize = 256;
|
||||
|
Loading…
x
Reference in New Issue
Block a user