[DEV] update new etk Uri API
This commit is contained in:
parent
a6088f420f
commit
6fd8eb2879
@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
#include <test-debug/debug.hpp>
|
#include <test-debug/debug.hpp>
|
||||||
#include <etk/etk.hpp>
|
#include <etk/etk.hpp>
|
||||||
|
#include <etk/uri/uri.hpp>
|
||||||
#include <audio/algo/river/Lms.hpp>
|
#include <audio/algo/river/Lms.hpp>
|
||||||
#include <audio/algo/river/Nlms.hpp>
|
#include <audio/algo/river/Nlms.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
|
||||||
#include <echrono/Steady.hpp>
|
#include <echrono/Steady.hpp>
|
||||||
#include <ethread/tools.hpp>
|
#include <ethread/tools.hpp>
|
||||||
|
|
||||||
@ -64,8 +64,8 @@ int main(int _argc, const char** _argv) {
|
|||||||
// the only one init for etk:
|
// the only one init for etk:
|
||||||
etk::init(_argc, _argv);
|
etk::init(_argc, _argv);
|
||||||
ethread::setName("test thread");
|
ethread::setName("test thread");
|
||||||
etk::String fbName = "";
|
etk::Path fbName;
|
||||||
etk::String micName = "";
|
etk::Path micName;
|
||||||
int32_t filterSize = 0;
|
int32_t filterSize = 0;
|
||||||
float mu = 0.0f;
|
float mu = 0.0f;
|
||||||
bool nlms = false;
|
bool nlms = false;
|
||||||
@ -105,8 +105,8 @@ int main(int _argc, const char** _argv) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( fbName == ""
|
if ( fbName.isEmpty() == true
|
||||||
|| micName == "") {
|
|| micName.isEmpty() == true) {
|
||||||
TEST_ERROR("Can not Process missing parameters...");
|
TEST_ERROR("Can not Process missing parameters...");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@ -114,10 +114,22 @@ int main(int _argc, const char** _argv) {
|
|||||||
Performance perfo;
|
Performance perfo;
|
||||||
|
|
||||||
TEST_INFO("Read FeedBack:");
|
TEST_INFO("Read FeedBack:");
|
||||||
etk::Vector<int16_t> fbData = etk::FSNodeReadAllDataType<int16_t>(fbName);
|
etk::Vector<int16_t> fbData;
|
||||||
|
{
|
||||||
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(fbName);
|
||||||
|
fileIO->open(etk::io::OpenMode::Read);
|
||||||
|
fbData = fileIO->readAll<int16_t>();
|
||||||
|
fileIO->close();
|
||||||
|
}
|
||||||
TEST_INFO(" " << fbData.size() << " samples");
|
TEST_INFO(" " << fbData.size() << " samples");
|
||||||
TEST_INFO("Read Microphone:");
|
TEST_INFO("Read Microphone:");
|
||||||
etk::Vector<int16_t> micData = etk::FSNodeReadAllDataType<int16_t>(micName);
|
etk::Vector<int16_t> micData;
|
||||||
|
{
|
||||||
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(micName);
|
||||||
|
fileIO->open(etk::io::OpenMode::Read);
|
||||||
|
micData = fileIO->readAll<int16_t>();
|
||||||
|
fileIO->close();
|
||||||
|
}
|
||||||
TEST_INFO(" " << micData.size() << " samples");
|
TEST_INFO(" " << micData.size() << " samples");
|
||||||
// resize output :
|
// resize output :
|
||||||
etk::Vector<int16_t> output;
|
etk::Vector<int16_t> output;
|
||||||
@ -189,6 +201,13 @@ int main(int _argc, const char** _argv) {
|
|||||||
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(blockSize))/1000000000.0)*100.0 << "%");
|
<< (float((perfo.getMaxProcessing().get()*sampleRate)/double(blockSize))/1000000000.0)*100.0 << "%");
|
||||||
TEST_PRINT("float : " << sampleRate << " : " << avg << "%");
|
TEST_PRINT("float : " << sampleRate << " : " << avg << "%");
|
||||||
}
|
}
|
||||||
etk::FSNodeWriteAllDataType<int16_t>("output.raw", output);
|
{
|
||||||
|
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(etk::Path("output.raw"));
|
||||||
|
if (fileIO->open(etk::io::OpenMode::Write) == false) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fileIO->writeAll<int16_t>(output);
|
||||||
|
fileIO->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user