Added cwWEBSOCK build option.

Added tests for 'dataset','afop','select_to_file','cut_and_mix','parallel_mix'.
This commit is contained in:
kevin 2020-09-22 11:31:33 -04:00
parent 048ae59c28
commit 9bdc08591e
5 changed files with 151 additions and 24 deletions

View File

@ -17,7 +17,7 @@ include_HEADERS =
WS_DIR = $(HOME)/sdk/libwebsockets/build/out WS_DIR = $(HOME)/sdk/libwebsockets/build/out
AM_CPPFLAGS = -D _GNU_SOURCE -I.. -I$(srcdir)/src/libcw -I$(WS_DIR)/include AM_CPPFLAGS = -D _GNU_SOURCE -I.. -I$(srcdir)/src/libcw
AM_CFLAGS = -Wno-multichar AM_CFLAGS = -Wno-multichar
AM_CXXFLAGS = --std=c++17 -Wno-multichar AM_CXXFLAGS = --std=c++17 -Wno-multichar
AM_LDFLAGS = AM_LDFLAGS =
@ -39,7 +39,7 @@ if OS_64
AM_CFLAGS += -m64 AM_CFLAGS += -m64
endif endif
AM_LDFLAGS += -L$(WS_DIR)/lib -Wl,-Bstatic -lasound -Wl,-Bdynamic AM_LDFLAGS += -Wl,-Bstatic -lasound -Wl,-Bdynamic
endif endif
@ -53,7 +53,13 @@ include_HEADERS += $(libcwHDR)
src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp src_cwtest_cwtest_SOURCES = src/cwtest/main.cpp
# autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l # autoconfig manual recommends setting direct referenes to non-3rd party libraries rather than using -L and -l
src_cwtest_cwtest_LDADD = libcw.la -lpthread -lwebsockets src_cwtest_cwtest_LDADD = libcw.la -lpthread
if cwWEBSOCK
AM_CPPFLAGS += -I$(WS_DIR)/include
AM_LDFLAGS += -L$(WS_DIR)/lib
src_cwtest_cwtest_LDADD += -lwebsockets
endif
# src_cwtest_cwtest_CPPFLAGS = -I$(srcdir)/src/libcw $(AM_CPPFLAGS) # src_cwtest_cwtest_CPPFLAGS = -I$(srcdir)/src/libcw $(AM_CPPFLAGS)
bin_PROGRAMS += src/cwtest/cwtest bin_PROGRAMS += src/cwtest/cwtest

View File

@ -12,6 +12,8 @@ cd ${curdir}
# 2) Run the program. ./foo # 2) Run the program. ./foo
# 3) Run gprof /libtool --mode=execute gprof ./foo # 3) Run gprof /libtool --mode=execute gprof ./foo
# To enable websock: --enable-websock \
../../../configure --prefix=${curdir} \ ../../../configure --prefix=${curdir} \
--enable-debug \ --enable-debug \
CFLAGS="-g -Wall" \ CFLAGS="-g -Wall" \

View File

@ -79,6 +79,23 @@ AC_DEFINE([NDEBUG], 1,[Debugging off.])
fi fi
AC_ARG_ENABLE([websock],
[ --enable-websock Include websock dependencies],
[case "${enableval}" in
yes) websock=true ;;
no) websock=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-websock]) ;;
esac],[websock=false])
echo "websock=${websock}"
AM_CONDITIONAL([cwWEBSOCK], [test x$websock = xtrue])
if test x"$websock" = xtrue; then
AC_DEFINE([cwWEBSOCK], 1,[Use libwebsock.])
fi
# AC_ARG_ENABLE([add_lib], # AC_ARG_ENABLE([add_lib],
# [ --enable-add_lib Append some additional libs to the end of the library link list.], # [ --enable-add_lib Append some additional libs to the end of the library link list.],

View File

@ -24,22 +24,39 @@
m2: [ [[0,1],[2,3]], [[4,5],[6,7]], [[8,9],[10,11]] ], m2: [ [[0,1],[2,3]], [[4,5],[6,7]], [[8,9],[10,11]] ],
m3: [ 0,1,2 ], m3: [ 0,1,2 ],
m4: [ [10,13], [11,14], [12,15] ],
y0: [ [5,14],[14,50] ], y0: [ [5,14],[14,50] ],
y1: [ [9,12,15],[12,17,22],[15,22,29] ], y1: [ [9,12,15],[12,17,22],[15,22,29] ],
}, },
audiofile: audiofile:
{ {
sine: { fn:"~/temp/temp_sine.wav", srate: 48000, bits: 16, hz: 100, gain: 0.5, secs: 10.0 },
rpt: { fn:"~/temp/temp_sine.wav", begIdx: 0, frmCnt: 10 } rpt: { fn:"~/temp/temp_sine.wav", begIdx: 0, frmCnt: 10 }
}, },
afop:
{
sine: { fn:"~/temp/temp_sine_1000_hz.wav", srate: 48000, bits: 16, hz: 1000, gain: 0.5, secs: 10.0 },
},
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.html"
}, },
dataset: {
dsLabel: mnist,
batchN: 32,
validPct: 10,
testPct: 10,
dataL:[
{ 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.",
@ -172,6 +189,58 @@
{ gain: 0.3, src:"~/temp/kc_record/xform_only/wet/preset_g_wet.aiff" } ] { gain: 0.3, src:"~/temp/kc_record/xform_only/wet/preset_g_wet.aiff" } ]
}, },
select_to_file:
{
outDir: "~/temp/select_to_file",
outBits: 24,
selectL: [
{ begSec: 100.25, endSec: 120.25, dst: "preset_a.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_a_mix.wav" },
{ begSec: 200.25, endSec: 220.25, dst: "preset_b.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_b_mix.wav" },
{ begSec: 300.25, endSec: 320.25, dst: "preset_c.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_c_mix.wav" },
{ begSec: 400.25, endSec: 420.25, dst: "preset_d.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_d_mix.wav" },
{ begSec: 500.25, endSec: 520.25, dst: "preset_f1.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_f1_mix.wav" },
{ begSec: 600.25, endSec: 620.25, dst: "preset_f2.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_f2_mix.wav" },
{ begSec: 700.25, endSec: 720.25, dst: "preset_f3.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_f3_mix.wav" },
{ begSec: 800.25, endSec: 820.25, dst: "preset_f4.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_f4_mix.wav" },
{ begSec: 900.25, endSec: 920.25, dst: "preset_g.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_g_mix.wav" },
{ begSec:1000.25, endSec: 1020.25, dst: "preset_ga.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_ga_mix.wav" },
{ begSec:1100.25, endSec: 1120.25, dst: "preset_g1a.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_g1a_mix.wav" },
{ begSec:1200.25, endSec: 1220.25, dst: "preset_g1d.wav", src: "~/temp/kc_record/xform_only/mix_7_3/preset_g1d_mix.wav" },
]
},
cut_and_mix:
{
dstFn: "~/temp/test_xfade.wav",
dstBits: 24,
srcDir: "~/temp",
crossFadeSec: 0.5,
argL: [
{ srcBegSec: 1.0, srcEndSec: 2.0, srcFn: "temp_sine_100_hz.wav", dstBegSec:0.0 },
{ srcBegSec: 3.0, srcEndSec: 4.0, srcFn: "temp_sine_1000_hz.wav", dstBegSec:0.5 }
]
}
parallel_mix:
{
dstFn: "~/temp/test_pmix.wav",
dstBits: 24,
srcDir: "~/temp",
argL: [
{ srcBegSec: 1.0, srcEndSec: 2.0, srcFn: "temp_sine_100_hz.wav", fadeOutSec:0.5 },
{ srcBegSec: 3.0, srcEndSec: 4.0, srcFn: "temp_sine_1000_hz.wav", fadeOutSec:0 }
]
}
} }

View File

@ -8,18 +8,23 @@
#include "cwText.h" #include "cwText.h"
#include "cwNumericConvert.h" #include "cwNumericConvert.h"
#include "cwObject.h" #include "cwObject.h"
#include "cwVectOps.h"
#include "cwMtx.h" #include "cwMtx.h"
#include "cwThread.h" #include "cwThread.h"
#include "cwSpScBuf.h" #include "cwSpScBuf.h"
#include "cwSpScQueueTmpl.h" #include "cwSpScQueueTmpl.h"
#include "cwThreadMach.h" #include "cwThreadMach.h"
#include "cwWebSock.h"
#include "cwWebSockSvr.h"
#include "cwSerialPort.h" #include "cwSerialPort.h"
#include "cwSerialPortSrv.h" #include "cwSerialPortSrv.h"
#include "cwSocket.h" #include "cwSocket.h"
#if defined(cwWEBSOCK)
#include "cwWebSock.h"
#include "cwWebSockSvr.h"
#include "cwUi.h" #include "cwUi.h"
#include "cwUiTest.h" #include "cwUiTest.h"
#endif
#include "cwTime.h" #include "cwTime.h"
#include "cwMidi.h" #include "cwMidi.h"
#include "cwMidiPort.h" #include "cwMidiPort.h"
@ -30,14 +35,20 @@
#include "cwTcpSocket.h" #include "cwTcpSocket.h"
#include "cwTcpSocketSrv.h" #include "cwTcpSocketSrv.h"
#include "cwTcpSocketTest.h" #include "cwTcpSocketTest.h"
#include "cwMdns.h" #include "cwMdns.h"
#include "cwDnsSd.h" #include "cwDnsSd.h"
#include "cwEuCon.h" #include "cwEuCon.h"
#if defined(cwWEBSOCK)
#include "cwIo.h" #include "cwIo.h"
#include "cwIoTest.h" #include "cwIoTest.h"
#endif
#include "cwDataSets.h" #include "cwDataSets.h"
#include "cwSvg.h" #include "cwSvg.h"
#include "cwAudioFile.h" #include "cwAudioFile.h"
#include "cwAudioFileOps.h"
//#include "cwNbMem.h" //#include "cwNbMem.h"
@ -314,7 +325,6 @@ void timeTest( const cw::object_t* cfg, const cw::object_t* args, int a
void threadTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::threadTest(); } void threadTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::threadTest(); }
void spscBuf( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::spsc_buf::test(); } void spscBuf( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::spsc_buf::test(); }
void spscQueueTmpl( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::testSpScQueueTmpl(); } void spscQueueTmpl( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::testSpScQueueTmpl(); }
void websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::websockSrvTest(); }
void serialPortSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::serialPortSrvTest(); } void serialPortSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::serialPortSrvTest(); }
void midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::midi::device::test();} void midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::midi::device::test();}
void textBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::textBuf::test(); } void textBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::textBuf::test(); }
@ -322,10 +332,29 @@ void audioBufTest( const cw::object_t* cfg, const cw::object_t* args, int a
void audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::test( argc, argv ); } void audioDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::test( argc, argv ); }
void audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::alsa::report(); } void audioDevAlsaTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::alsa::report(); }
void audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::report(); } void audioDevRpt( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audio::device::report(); }
void ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::io::test(); }
void mtxTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::mtx::test(args); } void mtxTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::mtx::test(args); }
void audioFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audiofile::test(args); } void audioFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audiofile::test(args); }
void audioFileMix( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::audiofile::mix(args); } void audioFileOp( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::test(args); }
void audioFileMix( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::mix(args); }
void audioFileSelToFile( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::selectToFile(args); }
void audioFileCutAndMix( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::cutAndMix(args); }
void audioFileParallelMix( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::afop::parallelMix(args); }
void socketMdnsTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::net::mdns::test(); }
void dnsSdTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::net::dnssd::test(); }
void euConTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::eucon::test(); }
#if defined(cwWEBSOCK)
void websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::websockSrvTest(); }
void ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::io::test(); }
void uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::ui::test(); }
#else
void _no_websock() { cwLogError(cw::kResourceNotAvailableRC,"Websocket functionality not included in this build."); }
void websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_websock(); }
void ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_websock(); }
void uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { _no_websock(); }
#endif
void socketTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) void socketTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
{ {
@ -467,10 +496,6 @@ void sockMgrTest( const cw::object_t* cfg, const cw::object_t* args, int argc, c
return; return;
} }
void uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::ui::test(); }
void socketMdnsTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::net::mdns::test(); }
void dnsSdTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::net::dnssd::test(); }
void euConTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::eucon::test(); }
void mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) void mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
{ {
char* inDir = requiredExistingDir( args, "inDir"); char* inDir = requiredExistingDir( args, "inDir");
@ -479,6 +504,9 @@ void mnistTest( const cw::object_t* cfg, const cw::object_t* args, int argc, con
cw::dataset::mnist::test(inDir,htmlFn); cw::dataset::mnist::test(inDir,htmlFn);
} }
void datasetTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
{ cw::dataset::test(args); }
void svgTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) void svgTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] )
{ {
char* htmlFn = requiredNewFile( args, "outHtmlFn"); char* htmlFn = requiredNewFile( args, "outHtmlFn");
@ -580,10 +608,15 @@ int main( int argc, const char* argv[] )
{ "dirEntry", dirEntryTest }, { "dirEntry", dirEntryTest },
{ "io", ioTest }, { "io", ioTest },
{ "mnist", mnistTest }, { "mnist", mnistTest },
{ "dataset", datasetTest },
{ "svg", svgTest }, { "svg", svgTest },
{ "mtx", mtxTest }, { "mtx", mtxTest },
{ "afop", audioFileOp },
{ "audiofile", audioFileTest }, { "audiofile", audioFileTest },
{ "audio_mix", audioFileMix }, { "audio_mix", audioFileMix },
{ "select_to_file", audioFileSelToFile },
{ "cut_and_mix", audioFileCutAndMix },
{ "parallel_mix",audioFileParallelMix },
{ "stub", stubTest }, { "stub", stubTest },
{ nullptr, nullptr } { nullptr, nullptr }
}; };