main.cpp/cfg : Added audioDevTestTone and dataset rdr/wtr/adapter tests.

This commit is contained in:
kevin 2020-12-29 11:25:09 -05:00
parent b51792ca50
commit d3d6c55f64
2 changed files with 60 additions and 12 deletions

View File

@ -49,6 +49,20 @@
dirEntry: {}, dirEntry: {},
io: {}, 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: mtx:
{ {
@ -77,10 +91,36 @@
mnist: { mnist: {
desc: "Print the MNIST images to an SVG/HTML file.", desc: "Print the MNIST images to an SVG/HTML file.",
inDir: "~/src/datasets/mnist", 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: { 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, dsLabel: mnist,
batchN: 32, batchN: 32,
validPct: 10, validPct: 10,
@ -89,8 +129,9 @@
{ name: mnist, inDir: "~/src/datasets/mnist" } { name: mnist, inDir: "~/src/datasets/mnist" }
], ],
} },
svg: { svg: {
desc:"Create an SVG/HTML test file.", desc:"Create an SVG/HTML test file.",
notes:"If no CSS file name is given then the style information will be written inline.", notes:"If no CSS file name is given then the style information will be written inline.",

View File

@ -2,6 +2,8 @@
#include "cwLog.h" #include "cwLog.h"
#include "cwCommonImpl.h" #include "cwCommonImpl.h"
#include "cwMem.h" #include "cwMem.h"
#include "cwFile.h"
#include "cwVariant.h"
#include "cwFileSys.h" #include "cwFileSys.h"
#include "cwTextBuf.h" #include "cwTextBuf.h"
#include "cwLex.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) #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 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 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(); } 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 #else
cw::rc_t _no_alsa() { return cwLogError(cw::kResourceNotAvailableRC,"ALSA based functionality not included in this build."); } 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 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 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 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(); } cw::rc_t audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return _no_alsa(); }
#endif #endif
@ -561,15 +565,14 @@ cw::rc_t svgTest( const cw::object_t* cfg, const cw::object_t* args, int arg
#else #else
cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) cw::rc_t mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
{ {
char* inDir = requiredExistingDir( args, "inDir"); return cw::dataset::mnist::test(cfg);
char* htmlFn = requiredNewFile( args, "outHtmlFn");
return cw::dataset::mnist::test(inDir,htmlFn);
} }
cw::rc_t datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) cw::rc_t datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dataset::test(args); }
{ 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[] ) 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 }, { "midiDevice", midiDeviceTest },
{ "textBuf", textBufTest }, { "textBuf", textBufTest },
{ "audioBuf", audioBufTest }, { "audioBuf", audioBufTest },
{ "audioDev",audioDevTest }, { "audioDevTest",audioDevTest },
{ "audioDevTone", audioDevTestTone },
{ "audioDevAlsa", audioDevAlsaTest }, { "audioDevAlsa", audioDevAlsaTest },
{ "audioDevRpt", audioDevRpt }, { "audioDevRpt", audioDevRpt },
//{ "nbmem", nbmemTest }, //{ "nbmem", nbmemTest },
@ -681,6 +685,9 @@ int main( int argc, const char* argv[] )
{ "io", ioTest }, { "io", ioTest },
{ "mnist", mnistTest }, { "mnist", mnistTest },
{ "dataset", datasetTest }, { "dataset", datasetTest },
{ "dataset_wtr", datasetWtrTest },
{ "dataset_rdr", datasetRdrTest },
{ "dataset_adapter", datasetAdapterTest },
{ "svg", svgTest }, { "svg", svgTest },
{ "mtx", mtxTest }, { "mtx", mtxTest },
{ "afop", audioFileOp }, { "afop", audioFileOp },