From d3d6c55f64b739a24c0f1909db203dc54d747980 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 29 Dec 2020 11:25:09 -0500 Subject: [PATCH] main.cpp/cfg : Added audioDevTestTone and dataset rdr/wtr/adapter tests. --- src/cwtest/cfg/main.cfg | 47 ++++++++++++++++++++++++++++++++++++++--- src/cwtest/main.cpp | 25 ++++++++++++++-------- 2 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index cbbdba0..f3e7a2f 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -49,6 +49,20 @@ dirEntry: {}, io: {}, + audioDevRpt: {}, + + audioDevTest: { + srate: 48000, + bufN: 3, + framesPerCycle: 512, + inDev: "USB Audio CODEC USB Audio", + outDev: "USB Audio CODEC USB Audio", + meterMs: 50, + amHz: 1, + amMaxGain: 0.8 + }, + + mtx: { @@ -77,10 +91,36 @@ mnist: { desc: "Print the MNIST images to an SVG/HTML file.", inDir: "~/src/datasets/mnist", - outHtmlFn: "~/temp/image_svg.html" + outHtmlFn: "~/temp/image_svg_0.html" }, + + dataset_wtr: { + outFn: "~/temp/temp.ds" + }, + + dataset_rdr: { + inFn: "~/temp/temp.ds", + cacheByteN: 146, + }, + + dataset_adapter: { + inFn: "~/temp/temp.ds", + cacheByteN: 154, + batchN: 3, + }, + + dataset: { + desc: "Read MNIST native file -> write dataset file -> read datasetf le -> write SVG file", + inDir: "~/src/datasets/mnist", + dsFn: "~/temp/temp_dataset.ds", + outHtmlFn: "~/temp/image_svg.html", + batchN: 3500, + cacheByteN: 2800000 + }, + + dataset0: { dsLabel: mnist, batchN: 32, validPct: 10, @@ -89,8 +129,9 @@ { name: mnist, inDir: "~/src/datasets/mnist" } ], - } - + }, + + svg: { desc:"Create an SVG/HTML test file.", notes:"If no CSS file name is given then the style information will be written inline.", diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 470b653..d1fff37 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -2,6 +2,8 @@ #include "cwLog.h" #include "cwCommonImpl.h" #include "cwMem.h" +#include "cwFile.h" +#include "cwVariant.h" #include "cwFileSys.h" #include "cwTextBuf.h" #include "cwLex.h" @@ -377,13 +379,15 @@ cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, i #if defined(cwALSA) cw::rc_t midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::midi::device::test();} -cw::rc_t audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::device::test( argc, argv ); } +cw::rc_t audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::device::test( args ); } +cw::rc_t audioDevTestTone( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::device::test_tone( args ); } cw::rc_t audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::device::alsa::report(); } cw::rc_t audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::device::report(); } #else cw::rc_t _no_alsa() { return cwLogError(cw::kResourceNotAvailableRC,"ALSA based functionality not included in this build."); } cw::rc_t midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa();} cw::rc_t audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa(); } +cw::rc_t audioDevTestTone( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa(); } cw::rc_t audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa(); } cw::rc_t audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa(); } #endif @@ -561,15 +565,14 @@ cw::rc_t svgTest( const cw::object_t* cfg, const cw::object_t* args, int arg #else cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ - char* inDir = requiredExistingDir( args, "inDir"); - char* htmlFn = requiredNewFile( args, "outHtmlFn"); - - return cw::dataset::mnist::test(inDir,htmlFn); +{ + return cw::dataset::mnist::test(cfg); } -cw::rc_t datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ return cw::dataset::test(args); } +cw::rc_t datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::test(args); } +cw::rc_t datasetWtrTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::wtr::test(args); } +cw::rc_t datasetRdrTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::rdr::test(args); } +cw::rc_t datasetAdapterTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::adapter::test(args); } cw::rc_t svgTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { @@ -664,7 +667,8 @@ int main( int argc, const char* argv[] ) { "midiDevice", midiDeviceTest }, { "textBuf", textBufTest }, { "audioBuf", audioBufTest }, - { "audioDev",audioDevTest }, + { "audioDevTest",audioDevTest }, + { "audioDevTone", audioDevTestTone }, { "audioDevAlsa", audioDevAlsaTest }, { "audioDevRpt", audioDevRpt }, //{ "nbmem", nbmemTest }, @@ -681,6 +685,9 @@ int main( int argc, const char* argv[] ) { "io", ioTest }, { "mnist", mnistTest }, { "dataset", datasetTest }, + { "dataset_wtr", datasetWtrTest }, + { "dataset_rdr", datasetRdrTest }, + { "dataset_adapter", datasetAdapterTest }, { "svg", svgTest }, { "mtx", mtxTest }, { "afop", audioFileOp },