From d224b750f8a18d0d84d03bff2d29f68bc4df6aec Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 11 May 2024 07:57:31 -0400 Subject: [PATCH 01/24] main.cpp : flow::test() is now in cwFlowTest.h/cpp. --- src/cwtest/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index d2d1b50..65b9709 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -35,6 +35,7 @@ #include "cwMidiDecls.h" #include "cwFlowDecl.h" #include "cwFlow.h" +#include "cwFlowTest.h" #include "cwDynRefTbl.h" #include "cwScoreParse.h" @@ -451,7 +452,7 @@ cw::rc_t pvocFileProc( const cw::object_t* cfg, const cw::object_t* args cw::rc_t socketMdnsTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::mdns::test(); } cw::rc_t dnsSdTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::dnssd::test(); } cw::rc_t euConTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::eucon::test(); } -cw::rc_t flowTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::flow::test(args); } +cw::rc_t flowTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::flow::test(args,argc,argv); } cw::rc_t scoreFollowTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::score_follow_test::test(args); } cw::rc_t svgMidiFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::svg_midi::test_midi_file(args); } From 3f8ff7c267b31e6388a7708216c53fbf115aab05 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 11 May 2024 08:01:23 -0400 Subject: [PATCH 02/24] Move current flow .cfg files into cfg/flow. --- src/cwtest/cfg/flow/flow_proc_dict.cfg | 636 +++++++++++++++++++++++ src/cwtest/cfg/flow/flow_subnet_dict.cfg | 34 ++ src/cwtest/cfg/flow/flow_test.cfg | 359 +++++++++++++ 3 files changed, 1029 insertions(+) create mode 100644 src/cwtest/cfg/flow/flow_proc_dict.cfg create mode 100644 src/cwtest/cfg/flow/flow_subnet_dict.cfg create mode 100644 src/cwtest/cfg/flow/flow_test.cfg diff --git a/src/cwtest/cfg/flow/flow_proc_dict.cfg b/src/cwtest/cfg/flow/flow_proc_dict.cfg new file mode 100644 index 0000000..07e816a --- /dev/null +++ b/src/cwtest/cfg/flow/flow_proc_dict.cfg @@ -0,0 +1,636 @@ +{ + balance: { + vars: { + in: { type:coeff, value:0.5, doc:"Input vaue" }, + out: { type:coeff, doc:"Ouput value. Same as input value."}, + inv_out: { type:coeff, doc:"1.0 minus output value."} + } + } + + audio_in: { + vars: { + dev_label: { type:string, doc:"Audio device label." }, + out: { type:audio, doc:"Audio output" }, + } + } + + audio_out: { + vars: { + dev_label: { type:string, doc:"Audio device label." }, + in: { type:audio, flags:["src"], doc:"Audio input." } + } + } + + audio_file_in: { + vars: { + fname: { type:string, doc:"Audio file name." }, + out:{ type:audio, doc:"Audio file output" }, + on_off:{ type:bool, value:false, doc:"1=on 0=off" },, + seekSecs:{ type:ftime, value:0.0, doc:"Seek to the specified seconds offset." } + eofFl:{ type:bool, eofFl: true, doc:"Set the system 'halt' flag when the audio is completely read."}, + } + } + + audio_file_out: { + vars: { + fname: { type:string, doc:"Audio file name." }, + bits: { type:uint, value:32u, doc:"Audio file word width. (8,16,24,32,0=float32)."}, + in: { type:audio, flags:["src"], doc:"Audio file input." } + } + } + + audio_gain: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input." }, + gain: { type:coeff, value:1.0, doc:"Gain coefficient." } + out: { type:audio, doc:"Audio output." }, + } + } + + audio_split: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input." }, + select: { type:int, doc:"Give a list of integers where each integer selects an output channel for the associated input channel." } + igain: { type:coeff, value:1.0, doc:"Audio gain for each input channel." } + ogain: { type:coeff, value:1.0, doc:"Audio gain for each output channel." } + out: { type:audio, doc:"Audio output." }, + } + + presets: + { + mute_off: { gain:1 }, + mute_on: { gain:0 }, + } + } + + audio_duplicate: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input."}, + duplicate: { type: uint, doc:"Count of times to repeat this channel." }, + gain: { type: coeff, value:1.0, doc:"Audio gain." }, + out: { type:audio, doc:"Audio output containing repeat * input channel count channels."} + } + } + + audio_merge: { + vars: { + in0: { type:audio, flags:["src"], doc:"First audio input." }, + in1: { type:audio, flags:["src"], doc:"Second audio input." }, + in2: { type:audio, flags:["src","src_opt"], doc:"Third audio input." }, + in3: { type:audio, flags:["src","src_opt"], doc:"Fourth audio input." }, + in4: { type:audio, flags:["src","src_opt"], doc:"Fifth audio input." }, + in5: { type:audio, flags:["src","src_opt"], doc:"Sixth audio input." }, + in6: { type:audio, flags:["src","src_opt"], doc:"Seventh audio input." }, + in7: { type:audio, flags:["src","src_opt"], doc:"Eigth audio input." }, + gain: { type:coeff, value:1.0, doc:"Audio gain for each selected (output) channel." } + out: { type:audio, doc:"Audio output. Channel count is the sum of the input channel count." }, + } + } + + audio_mix: { + vars: { + in0: { type:audio, flags:["src"], doc:"First audio input." }, + in1: { type:audio, flags:["src"], doc:"Second audio input." }, + gain0: { type:coeff, value:0.5, doc:"Audio gain for input 0." }, + gain1: { type:coeff, value:0.5, doc:"Audio gain for input 1." }, + out: { type:audio, doc:"Audio output. Channel count is max of the input signal channels." }, + } + } + + audio_delay: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input." }, + maxDelayMs: { type:ftime, value:1000.0 doc:"Maximum possible delay in milliseconds." }, + delayMs: { type:ftime, doc:"Delay in milliseconds." }, + out: { type:audio, doc:"Audio output." }, + } + } + + + sine_tone: { + vars: { + srate: { type:srate, value:0, doc:"Sine tone sample rate. 0=Use default system sample rate"} + chCnt: { type:uint, value:2, doc:"Output signal channel count."}, + hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."}, + phase: { type:coeff, value:0.0, doc:"Offset phase in radians."}, + dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."}, + gain: { type:coeff, value:0.8, doc:"Signal frequency."}, + out: { type:audio, doc:"Audio output" }, + } + + presets: { + a220 : { hz:220 }, + a440 : { hz:440 }, + a880 : { hz:880 }, + } + } + + pv_analysis: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input." }, + maxWndSmpN: { type:uint, value: 512, doc:"Maximum window sample count." }, + wndSmpN: { type:uint, value: 512, doc:"Window sample count." }, + hopSmpN: { type:uint, value: 128, doc:"Hop sample count." }, + hzFl: { type:bool, value: false, doc:"Calculate frequency via the method of phase changeof each bin." }, + out: { type:spectrum, doc:"Spectrum output." } + } + + presets: { + + dry: { + wndSmpN: 512, + hopSmpN: 128 + } + + kc: { + wndSmpN: 512, + hopSmpN: 128 + } + + a: { + wndSmpN: 512, + hopSmpN: 128 + } + + b: { + wndSmpN: 512, + hopSmpN: 128 + } + + c: { + wndSmpN: 512, + hopSmpN: 128 + } + + d: { + wndSmpN: 512, + hopSmpN: 128 + } + + f_1: { + wndSmpN: 512, + hopSmpN: 128 + } + + f_2: { + wndSmpN: 512, + hopSmpN: 128 + } + + f_3: { + wndSmpN: 512, + hopSmpN: 128 + } + + f_4: { + wndSmpN: 512, + hopSmpN: 128 + } + + g: { + wndSmpN: 512, + hopSmpN: 128 + } + + g_a: { + wndSmpN: 512, + hopSmpN: 128 + } + + g_1_a: { + wndSmpN: 512, + hopSmpN: 128 + } + + g_1_d: { + wndSmpN: 512, + hopSmpN: 128 + } + } + } + + pv_synthesis: { + vars: { + in: { type:spectrum, flags:["src"], doc:"Spectrum input." }, + out: { type:audio, doc:"Audio output." } + } + } + + spec_dist: { + vars: { + in: { type:spectrum, flags:["src"], doc:"Spectrum input." }, + + bypass: { type:bool, value: false, doc:"Copy input to output without transform."}, + ceiling: { type:coeff, value: 30.0, doc:"Ceiling parameter."}, + expo: { type:coeff, value: 2.0, doc:"Exponent parameter."}, + thresh: { type:coeff, value: 54.0, doc:"Threshold parameter."}, + upr: { type:coeff, value: -0.7, doc:"Upper slope parameter."}, + lwr: { type:coeff, value: 2.0, doc:"Lower slope parameter."}, + mix: { type:coeff, value: 0.0, doc:"Basic/Bump Mix parameter."}, + + out: { type:spectrum, doc:"Spectrum output." }, + + } + + presets: { + + dry: { + + } + + kc: { + ceiling: 20.0, + expo: 2.0, + thresh: 65.0, + upr: 0.0, + lwr: 2.0, + mix: 0.0 + } + + a: { + ceiling: 20.0 + expo: 2.0 + thresh: 60.0 + upr: [ -1.1, -0.99], + lwr: 2.0 + mix: 0.0 + } + + b: { + ceiling: 20.0 + expo: 2.0 + thresh: [ 77.0, 74.0 ], + upr: -0.5 + lwr: [ 3.0, 2.0 ], + mix: 0.0 + } + + c: { + ceiling: 20.0 + expo: 2.0 + thresh: 80.0 + upr: -0.5 + lwr: 5.0 + mix: 0.0 + } + + d: { + ceiling: 20.0 + expo: 2.0 + thresh: 70.0 + upr: [ -3.9, 04.5] + lwr: 4.0 + mix: 0.0 + } + + f_1: { + ceiling: 20.0 + expo: 2.0 + thresh: 50.0 + upr: -3.0 + lwr: 1.0 + mix: 0.0 + } + + f_2: { + ceiling: 20.0 + expo: 2.0 + thresh: 60.0 + upr: -3.0 + lwr: 1.0 + mix: 0.0 + } + + f_3: { + ceiling: 20.0 + expo: 2.0 + thresh: 55.0 + upr: -3.0 + lwr: 1.0 + mix: 0.0 + } + + f_4: { + ceiling: 20.0 + expo: 2.0 + thresh: 55.0 + upr: -5.0 + lwr: 1.0 + mix: 0.0 + } + + g: { + ceiling: 40.0 + expo: 8.0 + thresh: [60.0 64.0] + upr: -0.7 + lwr: 8.0 + mix: 1.0 + } + + g_a: { + ceiling: 40.0 + expo: 2.0 + thresh: [50.0 54.0] + upr: -0.7 + lwr: 2.0 + mix: 1.0 + } + + g_1_a: { + ceiling: 20.0 + expo: 2.0 + thresh: [50.0 54.0] + upr: -0.7 + lwr: 8.0 + mix: 1.0 + } + + g_1_d: { + ceiling: [60.0 64.0] + expo: [ 7.0 5.0] + thresh: [40.0 34.0] + upr: [-0.4 -0.3] + lwr: [ 7.0 5.0] + mix: 1.0 + } + } + } + + + compressor: { + vars: { + in: { type:audio, flags:["src"] true, doc:"Audio input." }, + bypass: { type:bool, value: false, doc:"Bypass the compressor."}, + igain: { type:coeff, value: 1.0, doc:"Input gain."}, + thresh: { type:coeff, value: 90.0, doc:"Attack threshold in dB."}, + ratio: { type:coeff, value: 2.0, doc:"Compression ratio."}, + atk_ms: { type:coeff, value: 20.0, doc:"Attack time in milliseconds."}, + rls_ms: { type:coeff, value: 20.0, doc:"Release time in milliseconds."}, + wnd_ms: { type:coeff, value: 200.0, doc:"RMS calc. window length in milliseconds."}, + maxWnd_ms: { type:coeff, value: 1000.0, doc:"Maximim (allocated) window length in milliseconds."}, + ogain: { type:coeff, value: 1.0, doc:"Output gain."}, + out: { type:audio, doc:"Audio output." }, + } + + presets: { + dflt: { + igain: 3.0 + thresh: 60.0 + ratio: 5.0 + atk_ms: 5.0 + rls_ms: 20.0 + wnd_ms:100.0 + ogain: 1.0 + } + + kc: { + bypass: false + igain: 3.0 + thresh: 80.0 + ratio: 2.0 + atk_ms: 20.0 + rls_ms: 1000.0 + wnd_ms: 200.0 + ogain: 1.0 + } + + input: { + bypass: false + igain: 2.0 + thresh: 30.0 + ratio: 12.0 + atk_ms: 5.0 + rls_ms: 20.0 + wnd_ms: 20.0 + ogain: 0.5 + } + + dry: { + + } + + a: { + igain: 6.0 + ogain: 1.0 + } + + b: { + igain: 10.0 + ogain: 1.0 + } + + c: { + igain: 11.0 + ogain: 1.0 + } + + d: { + igain: 9.0 + ogain: 1.0 + } + + f_1: { + igain: 6.0 + ogain: 1.0 + } + + f_2: { + igain: 6.0 + ogain: 1.0 + } + + f_3: { + igain: 6.0 + ogain: 1.0 + } + + f_4: { + igain: 6.0 + ogain: 1.0 + } + + g: { + igain: 10.0 + ogain: 0.75 + } + + g_a: { + igain: 10.0 + ogain: 0.75 + } + + g_1_a: { + igain: 10.0 + ogain: 0.75 + } + + g_1_d: { + igain: 10.0 + ogain: 0.75 + } + + + } + } + + limiter: { + vars: { + in: { type:audio, flags:["src"] true, doc:"Audio input." }, + bypass: { type:bool, value: false, doc:"Bypass the limiter."}, + igain: { type:coeff, value: 1.0, doc:"Input gain."}, + thresh: { type:coeff, value: 0.0, doc:"Linear (0.0-1.0) threshold."}, + ogain: { type:coeff, value: 1.0, doc:"Output gain."}, + out: { type:audio, doc:"Audio output." }, + } + + presets: { + dflt: { + bypass: false, + igain: 1.0 + thresh: 0.9, + ogain: 1.0 + } + + } + } + + dc_filter: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input." }, + bypass: { type:bool, value: false, doc:"Bypass the DC filter."}, + gain: { type:coeff, value: 1.0, doc:"Output gain."}, + out: { type:audio, doc:"Audio output." }, + } + + presets: { + dflt: { + bypass: false, + gain: 1.0 + } + + } + } + + audio_meter: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input." }, + dbFl: { type:bool, value: true, doc:"Output in Decibels." }, + wndMs: { type:ftime, value: 100.0, doc:"RMS window length." }, + peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." }, + out: { type:coeff, value: 0.0, doc:"Meter output." }, + peakFl: { type:bool, value: false, doc:"Peak output." } + clipFl: { type:bool, value: false, doc:"Clip indicator output."} + } + } + + subnet: { + vars: { + } + } + + poly: { + vars: { + count: { type:uint, doc:"Count of network duplicates." }, + order: { type:string, value:"net", doc:"Execution order 'net'=net first 'proc'=proc first" } + } + } + + sample_hold: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input source." }, + period_ms: { type:ftime, value:50, doc:"Sample period in milliseconds." }, + out: { type:sample, value:0.0, doc:"First value in the sample period." }, + mean: { type:sample, value:0.0, doc:"Mean value of samples in period." }, + } + } + + + number: { + vars: { + value: { type:numeric, value:0.0, doc:"Input and output value."}, + store: { type:numeric, value:0.0, doc:"Store but don't emit until the next exec."} + } + } + + timer: { + vars: { + srate: { type:srate, value:0, flags["src"], doc:"Sample rate to use as the time base. 0=Use default system sample rate." }, + period_ms: { type:ftime, value:100, doc:"Timer period in milliseconds." }, + out: { type:bool, value:false, doc:"Output pulse." }, + } + } + + counter: { + vars: { + trigger: { type:bool, flags["src"], doc:"Counter increments with each toggle of trigger." }, + reset: { type:bool, value:false, doc:"Reset the counter to the initial value." }, + init: { type:numeric, value:0.0, doc:"Counter initial value." }, + min: { type:numeric, value:0.0, doc:"Minimum output value." }, + max: { type:numeric, value:10.0, doc:"Maximum output value." }, + inc: { type:numeric, value:1.0, doc:"Incrment value." }, + repeat_fl: { type:bool, value:true, doc:"Repeat on reaching the limits." }, + mode: { type:string, value:"modulo", doc:"limit mode: 'modulo'=wrap, 'reverse'=count in opposite direction, 'clip'=repeat limit value."}, + out_type: { type:string, value:double, flags["init"], doc:"The type of the output value." }, + out: { type:runtime, value:0.0, doc:"Counter output value."}, + } + } + + // All elements of the list must belong to the same of three possible types: + // string,cfg,numeric (uint,int,float,double) + list: { + vars: { + in: { type:uint, flags:["src"], doc:"List selection index." }, + list: { type:cfg, doc:"List as a 'cfg' object." }, + out: { type:runtime, doc:"List output value." }, + value:{ type:runtime, flags["mult"], doc:"List 'mult' output per list value." }, + } + } + + add: { + vars: { + in: { type:numeric, flags:["src","mult"], doc:"Operands" }, + otype: { type:string, value:double, flags:["init"], doc:"The type of the output value." }, + out: { type:runtime, flags:["no_src"], doc:"Result" }, + } + } + + preset: { + vars: { + in: { type:string, flags:["src"], doc:"Preset to select." }, + } + } + + + xfade_ctl: { + + poly_limit_cnt: 1, + + // Notes: + // 1. It would be better to setup the source net-proc as a 'in' variable with type 'net'. + // 2. The only purpose for the 'srateSrc' is to get the sample rate of the system. + + vars: { + net: { type:string, doc:"Proc name of the poly network."}, + netSfxId: { type:uint, value: 0, doc:"Label sfx id of the source poly instance."}, + srateSrc: { type:audio, flags:["src"], doc:"Audio source to derive the sample rate."}, + durMs: { type:uint, value:1000, doc:"Cross-fade duration in milliseconds" }, + trigger: { type:all, doc:"Start cross-fade." }, + preset: { type:string, doc:"Preset to apply to the poly network." }, + + gain: { type:coeff, flags:["mult"], value:0, doc:"Cross-fade gain output." } + } + }, + + poly_merge: { + + vars: { + in: { type:audio, flags:["src", "mult"], doc:"Audio input channel." }, + gain: { type:coeff, value: 0, flags:["src", "mult"], doc:"Input channel gain." }, + out_gain: { type:coeff, value: 1, doc:"Output gain" }, + out: { type:audio, doc:"Audio output." }, + } + } + + +} diff --git a/src/cwtest/cfg/flow/flow_subnet_dict.cfg b/src/cwtest/cfg/flow/flow_subnet_dict.cfg new file mode 100644 index 0000000..9833db2 --- /dev/null +++ b/src/cwtest/cfg/flow/flow_subnet_dict.cfg @@ -0,0 +1,34 @@ +{ + mod_osc: { + + vars: { + hz: { proxy:hz_lfo.dc, doc:"Audio frequency" }, + hz_mod_hz: { proxy:hz_lfo.hz, doc:"Frequency modulator hz" }, + hz_mod_depth: { proxy:hz_lfo.gain, doc:"Frequency modulator depth" }, + amp_mod_hz: { proxy:amp_lfo.hz, doc:"Amplitude modulator hz" }, + amp_mod_depth: { proxy:amp_lfo.gain, doc:"Amplutide modulator depth."}, + mo_out: { proxy:ogain.out flags:[out] doc:"Oscillator output."}, + }, + + network: { + procs: { + hz_lfo: { class: sine_tone, args: { default:{ chCnt:1 }}} + hz_sh: { class: sample_hold, in:{ in:hz_lfo.out }} + + amp_lfo: { class: sine_tone, args: { default:{ chCnt:1 }}} + amp_sh: { class: sample_hold, in:{ in:amp_lfo.out }} + + osc: { class: sine_tone, in:{ hz: hz_sh.out }} + ogain: { class: audio_gain, in:{ in:osc.out, gain:amp_sh.out}} + } + + presets: { + net_a: { hz_lfo: { dc:220, gain:55 }, amp_lfo: { gain:0.8 } }, + net_b: { hz_lfo: { dc:110, gain:25 }, amp_lfo: { gain:0.7 } }, + } + } + } + + + +} \ No newline at end of file diff --git a/src/cwtest/cfg/flow/flow_test.cfg b/src/cwtest/cfg/flow/flow_test.cfg new file mode 100644 index 0000000..ea4acca --- /dev/null +++ b/src/cwtest/cfg/flow/flow_test.cfg @@ -0,0 +1,359 @@ +{ + test: { + flow_test: { + + proc_cfg_fname: "~/src/cwtest/src/cwtest/cfg/flow/flow_proc_dict.cfg", + subnet_cfg_fname:"~/src/cwtest/src/cwtest/cfg/flow/flow_subnet_dict.cfg", + project_dir:"~/src/cwtest/src/cwtest/cfg/flow/ttest", + test_ref_dir:"~/src/cwtest/src/cwtest/cfg/flow/test", + cmp_enable_fl: false, + + test_cases: { + + test_0: { + framesPerCycle:64, + maxCycleCount:3750, // 5 seconds + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + osc: { class: sine_tone }, + afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} } + } + } + } + } + + test_1: { + framesPerCycle: 64, + maxCycleCount: 1500, + + network: { + + procs: { + lfo: { class: sine_tone, args:{ default:{hz:3, dc:440, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out } }, + afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"/home/kevin/temp/audio_flow_out.wav"} }} + } + } + } + + test_2: { + framesPerCycle: 64, + maxCycleCount: 7500, + + network: { + + procs: { + srate: { class: number, log:{value:0} args:{ default:{ value:48000f } } }, + tmr: { class: timer, in: { srate:srate.value}, log:{out:0} args:{ default:{ period_ms:1000.0 } } }, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ default:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint, repeat_fl:false } } }, + list: { class: list, in: { in:cnt.out }, log:{out:0} args:{ default:{ list:[a,b,c,d] }}} + } + } + } + + + test_3: { + framesPerCycle: 64, + maxCycleCount: 7500, + + network: { + + procs: { + srate: { class: number, log:{value:0} args:{ default:{ value:48000f } } }, + tmr: { class: timer, in: { srate:srate.value}, log:{out:0} args:{ default:{ period_ms:1000.0 } } }, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ default:{ min:0, max:3, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint } } }, + x0v: { class: number, log:{value:0} args:{ default:{ value:2 }}}, + x1v: { class: number, log:{value:0} args:{ default:{ value:3 }}}, + add: { class: add, in: { in0:x0v.value, in1:x1v.value, in2:cnt.out }, log:{out:0} args:{ default:{ otype:int }} } + } + } + } + + test_4: { + framesPerCycle: 64, + maxCycleCount: 15000, + + network: { + + procs: { + srate: { class: number, log:{value:0} args:{ default:{ value:48000.0} } }, + tmr: { class: timer, in: { srate:srate.value } log:{srate:0} args:{ default:{ period_ms:2000 } }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }}} + list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + ps: { class: preset, in: { in:list.out } } + + lfo: { class: sine_tone, in:{ srate:srate.value }, log:{srate:0} args: { default:{hz:3, dc:440, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out, srate:srate.value }} + afout: { class: audio_file_out, in:{ in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + } + + presets: { + a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + } + } + } + + // Same as test_4 but using the system sample rate + test_5: { + framesPerCycle: 64, + maxCycleCount: 15000, + sample_rate: 48000, + + network: { + + procs: { + tmr: { class: timer, log:{srate:0}, args:{ default:{ period_ms:2000 } }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }}} + list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + ps: { class: preset, in: { in:list.out } } + + lfo: { class: sine_tone, log:{srate:0} args: { default:{ chCnt:1, hz:3, dc:440, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out } log:{srate:0} } + afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + } + + presets: { + a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + } + } + } + + // Simple poly + test_6: { + framesPerCycle: 64, + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + + osc_poly: { + class: poly, + args: { default:{ count:3 }} + + + network: { + procs: { + lfo: { class: sine_tone, args: { default:{ chCnt:1, hz:3, dc:440, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz: sh.out }} + } + + presets: { + a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + } + } + } + + poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out}, args:{ default:{ gain:1, out_gain:0.5 }}}, + afout: { class: audio_file_out, in: { in:poly_merge.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + } + + presets: { + } + } + } + + // Test using xfade_ctl to cross-fade and assign presets. + test_7: { + framesPerCycle: 64, + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + + tmr: { class: timer, args:{ default:{ period_ms:2000 } }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }}} + list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + + osc_poly: { + class: poly, + args: { default:{ count:3 }} + + + network: { + procs: { + lfo: { class: sine_tone, args: { default:{ chCnt:1, hz:3, dc:440, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz: sh.out }} + } + + presets: { + a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + } + } + } + + + xfade_ctl: { class: xfade_ctl, in:{ srateSrc:osc_poly.osc.out, preset:list.out, trigger:list.out }, + log:{trigger:0}, + args:{ default:{ net:osc_poly, durMs:1000, preset:a }} }, + + poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out, gain_:xfade_ctl.gain_ }, + args:{ default:{ out_gain:0.5 }}}, + + afout: { class: audio_file_out, in:{ in:poly_merge.out } + args:{ default:{fname:"$/audio_flow_out.wav"} }} + + + } + + presets: { + } + } + } + + // Test using xfade_ctl to assign presets and connecting poly procs + // to non-poly procs using the poly index to select sources. + // See `in:{ lfo_.dc:dc_list.value_}` + test_8: { + framesPerCycle: 64, + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + + tmr: { class: timer, args:{ default:{ period_ms:2000 } }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }}} + list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + + dc_list: { class: list, args: { default:{ in:0, list:[ 110f,220f,440f ]}}} + + osc_poly: { + class: poly, + args: { default:{ count:3 }} + + + network: { + procs: { + lfo: { class: sine_tone, in:{ _.dc:_.dc_list.value_}, args: { default:{ chCnt:1, hz:3, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz: sh.out }} + } + + presets: { + a: { lfo: { hz:1 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + } + } + } + + + xfade_ctl: { class: xfade_ctl, in:{ srateSrc:osc_poly.osc.out, preset:list.out, trigger:list.out }, + log:{trigger:0}, + args:{ default:{ net:osc_poly, durMs:1000, preset:a }} }, + + poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out, gain_:xfade_ctl.gain_ }, + args:{ default:{ out_gain:0.5 }}}, + + afout: { class: audio_file_out, in:{ in:poly_merge.out } + args:{ default:{fname:"$/audio_flow_out.wav"} }} + + + } + + presets: { + } + } + } + + // Test using a subnet. + test_9 : { + framesPerCycle: 64, + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + procs: { + sub_osc: { class: mod_osc args:{ default:{ hz:220, hz_mod_hz:3, hz_mod_depth:55, amp_mod_hz:2, amp_mod_depth:0.5 }}}, + afout: { class: audio_file_out, in:{ in:sub_osc.mo_out } + args:{ default:{fname:"$/audio_flow_out.wav"}}} + } + } + + presets: { + } + } + + // Testing using proc instances with explicit suffix ids. + // See: list0 and list1 + test_10: { + framesPerCycle: 64, + maxCycleCount: 15000, + + network: { + + procs: { + tmr: { class: timer, args:{ default:{ period_ms:1000.0 }}}, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0}, args:{ default:{ min:0, max:1, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint }}}, + list0: { class: list, args:{ default:{ in:2 list:[1,2,3] }}}, + list1: { class: list, args:{ default:{ in:0, list:[10,20,30] }}}, + add: { class: add, in: { in0:list0.out, in1:list1.out, in2:cnt.out }, log:{out:0} args:{ default:{ otype:int }} } + } + } + }, + + + // Test with no exec cycles. + // This network only runs the initialization pass. + test_11: { + framesPerCycle: 64, + maxCycleCount: 0, + + network: { + procs: { + a: { class: number, log:{value:0}, args:{ default:{ value:1 }}}, + b: { class: number, log:{value:0}, args:{ default:{ value:2 }}}, + add: { class: add, in: { in0:a.value, in1:b.value }, log:{out:0}, args:{ default:{ otype:int }}} + } + } + }, + + // Test the 'out' statement to set feedback connections. + test_12: { + framesPerCycle: 64, + maxCycleCount: 10, + + network: { + procs: { + a: { class: number, log:{value:0}, args:{ default:{ value:1 }}}, + b: { class: number, log:{value:0}, args:{ default:{ value:2 }}}, + + add: { class: add, in: { in0:a.value, in1:b.value }, out: { out:b.store }, + log:{out:0}, args:{ default:{ otype:int }}} + } + } + }, + + } + } +} From f402aa2470bcd6fa024513f4510b28ac6d16bf96 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 19 May 2024 15:31:28 -0400 Subject: [PATCH 03/24] flow/flow_test.cfg,flow/flow_proc_dict.cfg --- Makefile.am | 4 +- src/cwtest/cfg/flow/flow_test.cfg | 10 +- src/cwtest/cfg/flow_proc_dict.cfg | 207 ++++++++++++++---- .../cfg/gutim_full/scriabin/csv_to_score.py | 4 +- 4 files changed, 171 insertions(+), 54 deletions(-) diff --git a/Makefile.am b/Makefile.am index f4bfeec..5706035 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,8 +22,8 @@ AM_LDFLAGS = # debug/release switches if DEBUG AM_CFLAGS += -g - # -Wextra -Werror -Wconversion -fsanitize=address - AM_CXXFLAGS += -g -Wall -fsanitize=undefined + # -Wextra -Werror -Wconversion -fsanitize=address -lasan -fsanitize=thread + AM_CXXFLAGS += -g -Wall -Wextra -Wno-unused -fsanitize=undefined else AM_CFLAGS += -O3 AM_CXXFLAGS += -O3 diff --git a/src/cwtest/cfg/flow/flow_test.cfg b/src/cwtest/cfg/flow/flow_test.cfg index ea4acca..eb5f8f8 100644 --- a/src/cwtest/cfg/flow/flow_test.cfg +++ b/src/cwtest/cfg/flow/flow_test.cfg @@ -29,7 +29,7 @@ test_1: { framesPerCycle: 64, maxCycleCount: 1500, - + printNetworkFl: false, // print the network instance network: { procs: { @@ -38,6 +38,11 @@ osc: { class: sine_tone, in:{ hz:sh.out } }, afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"/home/kevin/temp/audio_flow_out.wav"} }} } + + presets: { + a: { lfo:a220, osc: { gain:0.8 } }, + b: { lfo:{ dc:220, gain:25 }, osc: { gain:0.5 } } + } } } @@ -77,7 +82,8 @@ test_4: { framesPerCycle: 64, maxCycleCount: 15000, - + printNetworkFl: false, + network: { procs: { diff --git a/src/cwtest/cfg/flow_proc_dict.cfg b/src/cwtest/cfg/flow_proc_dict.cfg index d69164a..07e816a 100644 --- a/src/cwtest/cfg/flow_proc_dict.cfg +++ b/src/cwtest/cfg/flow_proc_dict.cfg @@ -1,10 +1,9 @@ { - balance: { vars: { - in: { type:real, value:0.5, doc:"Input vaue" }, - out: { type:real, doc:"Ouput value. Same as input value."}, - inv_out: { type:real, doc:"1.0 minus output value."} + in: { type:coeff, value:0.5, doc:"Input vaue" }, + out: { type:coeff, doc:"Ouput value. Same as input value."}, + inv_out: { type:coeff, doc:"1.0 minus output value."} } } @@ -22,20 +21,20 @@ } } - audioFileIn: { + audio_file_in: { vars: { fname: { type:string, doc:"Audio file name." }, out:{ type:audio, doc:"Audio file output" }, on_off:{ type:bool, value:false, doc:"1=on 0=off" },, - seekSecs:{ type:real, value:0.0, doc:"Seek to the specified seconds offset." } + seekSecs:{ type:ftime, value:0.0, doc:"Seek to the specified seconds offset." } eofFl:{ type:bool, eofFl: true, doc:"Set the system 'halt' flag when the audio is completely read."}, } } - audioFileOut: { + audio_file_out: { vars: { - fname: { type:string, doc:"Audio file name." }, - bits: { type:uint, value:32, doc:"Audio file word width. (8,16,24,32,0=float32)."}, + fname: { type:string, doc:"Audio file name." }, + bits: { type:uint, value:32u, doc:"Audio file word width. (8,16,24,32,0=float32)."}, in: { type:audio, flags:["src"], doc:"Audio file input." } } } @@ -43,7 +42,7 @@ audio_gain: { vars: { in: { type:audio, flags:["src"], doc:"Audio input." }, - gain: { type:real, value:1.0, doc:"Gain coefficient." } + gain: { type:coeff, value:1.0, doc:"Gain coefficient." } out: { type:audio, doc:"Audio output." }, } } @@ -51,9 +50,10 @@ audio_split: { vars: { in: { type:audio, flags:["src"], doc:"Audio input." }, - select: { type:bool, doc:"Enable/Disable each channel" } - gain: { type:real, value:1.0, doc:"Audio gain for each selected (output) channel." } - out: { type:audio, doc:"Audio output." }, + select: { type:int, doc:"Give a list of integers where each integer selects an output channel for the associated input channel." } + igain: { type:coeff, value:1.0, doc:"Audio gain for each input channel." } + ogain: { type:coeff, value:1.0, doc:"Audio gain for each output channel." } + out: { type:audio, doc:"Audio output." }, } presets: @@ -67,7 +67,7 @@ vars: { in: { type:audio, flags:["src"], doc:"Audio input."}, duplicate: { type: uint, doc:"Count of times to repeat this channel." }, - gain: { type: real, value:1.0, doc:"Audio gain." }, + gain: { type: coeff, value:1.0, doc:"Audio gain." }, out: { type:audio, doc:"Audio output containing repeat * input channel count channels."} } } @@ -82,7 +82,7 @@ in5: { type:audio, flags:["src","src_opt"], doc:"Sixth audio input." }, in6: { type:audio, flags:["src","src_opt"], doc:"Seventh audio input." }, in7: { type:audio, flags:["src","src_opt"], doc:"Eigth audio input." }, - gain: { type:real, value:1.0, doc:"Audio gain for each selected (output) channel." } + gain: { type:coeff, value:1.0, doc:"Audio gain for each selected (output) channel." } out: { type:audio, doc:"Audio output. Channel count is the sum of the input channel count." }, } } @@ -91,8 +91,8 @@ vars: { in0: { type:audio, flags:["src"], doc:"First audio input." }, in1: { type:audio, flags:["src"], doc:"Second audio input." }, - gain0: { type:real, value:0.5, doc:"Audio gain for input 0." }, - gain1: { type:real, value:0.5, doc:"Audio gain for input 1." }, + gain0: { type:coeff, value:0.5, doc:"Audio gain for input 0." }, + gain1: { type:coeff, value:0.5, doc:"Audio gain for input 1." }, out: { type:audio, doc:"Audio output. Channel count is max of the input signal channels." }, } } @@ -100,8 +100,8 @@ audio_delay: { vars: { in: { type:audio, flags:["src"], doc:"Audio input." }, - maxDelayMs: { type:real, value:1000.0 doc:"Maximum possible delay in milliseconds." }, - delayMs: { type:real, doc:"Delay in milliseconds." }, + maxDelayMs: { type:ftime, value:1000.0 doc:"Maximum possible delay in milliseconds." }, + delayMs: { type:ftime, doc:"Delay in milliseconds." }, out: { type:audio, doc:"Audio output." }, } } @@ -109,16 +109,19 @@ sine_tone: { vars: { - srate: { type:real, value:48000.0, doc:"Sine tone sample rate."} - chCnt: { type:uint, value:2, doc:"Output signal channel count."}, - hz: { type:real, value:440.0, doc:"Frequency in Hertz."}, - gain: { type:real, value:0.8, doc:"Signal frequency."}, - out: { type:audio, doc:"Audio output" }, + srate: { type:srate, value:0, doc:"Sine tone sample rate. 0=Use default system sample rate"} + chCnt: { type:uint, value:2, doc:"Output signal channel count."}, + hz: { type:coeff, value:440.0, doc:"Frequency in Hertz."}, + phase: { type:coeff, value:0.0, doc:"Offset phase in radians."}, + dc: { type:coeff, value:0.0, doc:"DC offset applied after gain."}, + gain: { type:coeff, value:0.8, doc:"Signal frequency."}, + out: { type:audio, doc:"Audio output" }, } presets: { - a: { hz:220 }, - b: { hz:880 }, + a220 : { hz:220 }, + a440 : { hz:440 }, + a880 : { hz:880 }, } } @@ -218,12 +221,12 @@ in: { type:spectrum, flags:["src"], doc:"Spectrum input." }, bypass: { type:bool, value: false, doc:"Copy input to output without transform."}, - ceiling: { type:real, value: 30.0, doc:"Ceiling parameter."}, - expo: { type:real, value: 2.0, doc:"Exponent parameter."}, - thresh: { type:real, value: 54.0, doc:"Threshold parameter."}, - upr: { type:real, value: -0.7, doc:"Upper slope parameter."}, - lwr: { type:real, value: 2.0, doc:"Lower slope parameter."}, - mix: { type:real, value: 0.0, doc:"Basic/Bump Mix parameter."}, + ceiling: { type:coeff, value: 30.0, doc:"Ceiling parameter."}, + expo: { type:coeff, value: 2.0, doc:"Exponent parameter."}, + thresh: { type:coeff, value: 54.0, doc:"Threshold parameter."}, + upr: { type:coeff, value: -0.7, doc:"Upper slope parameter."}, + lwr: { type:coeff, value: 2.0, doc:"Lower slope parameter."}, + mix: { type:coeff, value: 0.0, doc:"Basic/Bump Mix parameter."}, out: { type:spectrum, doc:"Spectrum output." }, @@ -359,14 +362,14 @@ vars: { in: { type:audio, flags:["src"] true, doc:"Audio input." }, bypass: { type:bool, value: false, doc:"Bypass the compressor."}, - igain: { type:real, value: 1.0, doc:"Input gain."}, - thresh: { type:real, value: 90.0, doc:"Attack threshold in dB."}, - ratio: { type:real, value: 2.0, doc:"Compression ratio."}, - atk_ms: { type:real, value: 20.0, doc:"Attack time in milliseconds."}, - rls_ms: { type:real, value: 20.0, doc:"Release time in milliseconds."}, - wnd_ms: { type:real, value: 200.0, doc:"RMS calc. window length in milliseconds."}, - maxWnd_ms: { type:real, value: 1000.0, doc:"Maximim (allocated) window length in milliseconds."}, - ogain: { type:real, value: 1.0, doc:"Output gain."}, + igain: { type:coeff, value: 1.0, doc:"Input gain."}, + thresh: { type:coeff, value: 90.0, doc:"Attack threshold in dB."}, + ratio: { type:coeff, value: 2.0, doc:"Compression ratio."}, + atk_ms: { type:coeff, value: 20.0, doc:"Attack time in milliseconds."}, + rls_ms: { type:coeff, value: 20.0, doc:"Release time in milliseconds."}, + wnd_ms: { type:coeff, value: 200.0, doc:"RMS calc. window length in milliseconds."}, + maxWnd_ms: { type:coeff, value: 1000.0, doc:"Maximim (allocated) window length in milliseconds."}, + ogain: { type:coeff, value: 1.0, doc:"Output gain."}, out: { type:audio, doc:"Audio output." }, } @@ -475,9 +478,9 @@ vars: { in: { type:audio, flags:["src"] true, doc:"Audio input." }, bypass: { type:bool, value: false, doc:"Bypass the limiter."}, - igain: { type:real, value: 1.0, doc:"Input gain."}, - thresh: { type:real, value: 0.0, doc:"Linear (0.0-1.0) threshold."}, - ogain: { type:real, value: 1.0, doc:"Output gain."}, + igain: { type:coeff, value: 1.0, doc:"Input gain."}, + thresh: { type:coeff, value: 0.0, doc:"Linear (0.0-1.0) threshold."}, + ogain: { type:coeff, value: 1.0, doc:"Output gain."}, out: { type:audio, doc:"Audio output." }, } @@ -496,7 +499,7 @@ vars: { in: { type:audio, flags:["src"], doc:"Audio input." }, bypass: { type:bool, value: false, doc:"Bypass the DC filter."}, - gain: { type:real, value: 1.0, doc:"Output gain."}, + gain: { type:coeff, value: 1.0, doc:"Output gain."}, out: { type:audio, doc:"Audio output." }, } @@ -513,13 +516,121 @@ vars: { in: { type:audio, flags:["src"], doc:"Audio input." }, dbFl: { type:bool, value: true, doc:"Output in Decibels." }, - wndMs: { type:real, value: 100.0, doc:"RMS window length." }, - peakDb: { type:real, value: -10.0, doc:"Peak threshold." }, - out: { type:real, value: 0.0, doc:"Meter output." }, + wndMs: { type:ftime, value: 100.0, doc:"RMS window length." }, + peakDb: { type:coeff, value: -10.0, doc:"Peak threshold." }, + out: { type:coeff, value: 0.0, doc:"Meter output." }, peakFl: { type:bool, value: false, doc:"Peak output." } clipFl: { type:bool, value: false, doc:"Clip indicator output."} } } - + subnet: { + vars: { + } + } + + poly: { + vars: { + count: { type:uint, doc:"Count of network duplicates." }, + order: { type:string, value:"net", doc:"Execution order 'net'=net first 'proc'=proc first" } + } + } + + sample_hold: { + vars: { + in: { type:audio, flags:["src"], doc:"Audio input source." }, + period_ms: { type:ftime, value:50, doc:"Sample period in milliseconds." }, + out: { type:sample, value:0.0, doc:"First value in the sample period." }, + mean: { type:sample, value:0.0, doc:"Mean value of samples in period." }, + } + } + + + number: { + vars: { + value: { type:numeric, value:0.0, doc:"Input and output value."}, + store: { type:numeric, value:0.0, doc:"Store but don't emit until the next exec."} + } + } + + timer: { + vars: { + srate: { type:srate, value:0, flags["src"], doc:"Sample rate to use as the time base. 0=Use default system sample rate." }, + period_ms: { type:ftime, value:100, doc:"Timer period in milliseconds." }, + out: { type:bool, value:false, doc:"Output pulse." }, + } + } + + counter: { + vars: { + trigger: { type:bool, flags["src"], doc:"Counter increments with each toggle of trigger." }, + reset: { type:bool, value:false, doc:"Reset the counter to the initial value." }, + init: { type:numeric, value:0.0, doc:"Counter initial value." }, + min: { type:numeric, value:0.0, doc:"Minimum output value." }, + max: { type:numeric, value:10.0, doc:"Maximum output value." }, + inc: { type:numeric, value:1.0, doc:"Incrment value." }, + repeat_fl: { type:bool, value:true, doc:"Repeat on reaching the limits." }, + mode: { type:string, value:"modulo", doc:"limit mode: 'modulo'=wrap, 'reverse'=count in opposite direction, 'clip'=repeat limit value."}, + out_type: { type:string, value:double, flags["init"], doc:"The type of the output value." }, + out: { type:runtime, value:0.0, doc:"Counter output value."}, + } + } + + // All elements of the list must belong to the same of three possible types: + // string,cfg,numeric (uint,int,float,double) + list: { + vars: { + in: { type:uint, flags:["src"], doc:"List selection index." }, + list: { type:cfg, doc:"List as a 'cfg' object." }, + out: { type:runtime, doc:"List output value." }, + value:{ type:runtime, flags["mult"], doc:"List 'mult' output per list value." }, + } + } + + add: { + vars: { + in: { type:numeric, flags:["src","mult"], doc:"Operands" }, + otype: { type:string, value:double, flags:["init"], doc:"The type of the output value." }, + out: { type:runtime, flags:["no_src"], doc:"Result" }, + } + } + + preset: { + vars: { + in: { type:string, flags:["src"], doc:"Preset to select." }, + } + } + + + xfade_ctl: { + + poly_limit_cnt: 1, + + // Notes: + // 1. It would be better to setup the source net-proc as a 'in' variable with type 'net'. + // 2. The only purpose for the 'srateSrc' is to get the sample rate of the system. + + vars: { + net: { type:string, doc:"Proc name of the poly network."}, + netSfxId: { type:uint, value: 0, doc:"Label sfx id of the source poly instance."}, + srateSrc: { type:audio, flags:["src"], doc:"Audio source to derive the sample rate."}, + durMs: { type:uint, value:1000, doc:"Cross-fade duration in milliseconds" }, + trigger: { type:all, doc:"Start cross-fade." }, + preset: { type:string, doc:"Preset to apply to the poly network." }, + + gain: { type:coeff, flags:["mult"], value:0, doc:"Cross-fade gain output." } + } + }, + + poly_merge: { + + vars: { + in: { type:audio, flags:["src", "mult"], doc:"Audio input channel." }, + gain: { type:coeff, value: 0, flags:["src", "mult"], doc:"Input channel gain." }, + out_gain: { type:coeff, value: 1, doc:"Output gain" }, + out: { type:audio, doc:"Audio output." }, + } + } + + } diff --git a/src/cwtest/cfg/gutim_full/scriabin/csv_to_score.py b/src/cwtest/cfg/gutim_full/scriabin/csv_to_score.py index b40e128..8b1adba 100644 --- a/src/cwtest/cfg/gutim_full/scriabin/csv_to_score.py +++ b/src/cwtest/cfg/gutim_full/scriabin/csv_to_score.py @@ -243,10 +243,10 @@ def gen_reference( scoreL, out_dir, out_fn ): f.write(s) if r0 and (r0['src'] == 'gutim' and r['src'] != 'gutim'): - print(r['src'],r['oloc'],end=" ") + print(r['src'],f"m{r0['meas']}",f"loc-begin:{r['oloc']}",end=" ") if r0 and (r0['src'] != 'gutim' and r['src'] == 'gutim'): - print(r0['oloc']) + print(f"end:{r0['oloc']}") r0 = r From 088f367cab005878d95d1f3558d49e02fb058c86 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 21 May 2024 19:12:48 -0400 Subject: [PATCH 04/24] flow/flow_test.cfg : Test cfg. file for initial working and tested presets. --- src/cwtest/cfg/flow/flow_test.cfg | 61 +++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/src/cwtest/cfg/flow/flow_test.cfg b/src/cwtest/cfg/flow/flow_test.cfg index eb5f8f8..1c88d6b 100644 --- a/src/cwtest/cfg/flow/flow_test.cfg +++ b/src/cwtest/cfg/flow/flow_test.cfg @@ -5,8 +5,8 @@ proc_cfg_fname: "~/src/cwtest/src/cwtest/cfg/flow/flow_proc_dict.cfg", subnet_cfg_fname:"~/src/cwtest/src/cwtest/cfg/flow/flow_subnet_dict.cfg", project_dir:"~/src/cwtest/src/cwtest/cfg/flow/ttest", - test_ref_dir:"~/src/cwtest/src/cwtest/cfg/flow/test", - cmp_enable_fl: false, + test_ref_dir:"~/src/cwtest/src/cwtest/cfg/flow/test_ref", + cmp_enable_fl: true, test_cases: { @@ -100,9 +100,9 @@ } presets: { - a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, - b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, - c: { lfo: a220 }, + a: { lfo: { hz:1.0, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2.0, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 } } } } @@ -203,11 +203,14 @@ sh: { class: sample_hold, in:{ in:lfo.out }} osc: { class: sine_tone, in:{ hz: sh.out }} } - + + // Note the use of the trailing underscore to create matching presets + // on all poly channels. Without the underscore the presets would only + // be applied to poly channel 0. presets: { - a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, - b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, - c: { lfo: a220 }, + a: { lfo_: { hz:1, dc:880 }, osc_: { gain:0.95 } }, + b: { lfo_: { hz:2, dc:220 }, osc_: { gain:0.75 } }, + c: { lfo_: a220 }, } } } @@ -263,10 +266,13 @@ osc: { class: sine_tone, in:{ hz: sh.out }} } + // Note the use of the trailing underscore to create matching presets + // on all poly channels. Without the underscore the presets would only + // be applied to poly channel 0. presets: { - a: { lfo: { hz:1 }, osc: { gain:0.95 } }, - b: { lfo: { hz:2 }, osc: { gain:0.75 } }, - c: { lfo: a220 }, + a: { lfo_: { hz:1 }, osc_: { gain:0.95 } }, + b: { lfo_: { hz:2 }, osc_: { gain:0.75 } }, + c: { lfo_: a220 }, } } } @@ -360,6 +366,37 @@ } }, + + // Same as test_4 but with a dual-preset + test_13: { + framesPerCycle: 64, + maxCycleCount: 15000, + printNetworkFl: false, + + network: { + + procs: { + srate: { class: number, log:{value:0} args:{ default:{ value:48000.0} } }, + tmr: { class: timer, in: { srate:srate.value } log:{srate:0} args:{ default:{ period_ms:2000 } }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint }}} + list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c,d ] }}}, + ps: { class: preset, in: { in:list.out } } + + lfo: { class: sine_tone, in:{ srate:srate.value }, log:{srate:0,hz:0,dc:0} args: { default:{hz:3, dc:440, gain:110 }}} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out, srate:srate.value }} + afout: { class: audio_file_out, in:{ in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + } + + presets: { + a: { lfo: { hz:1.0, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2.0, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + d: [ a,b,0.5 ] + } + } + } + } } } From dfc636dee1fa37af7345faf3b1808b92e3ac2556 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 23 May 2024 09:35:37 -0400 Subject: [PATCH 05/24] cfg/flow/flow_test.cfg,flow_subnet_dict.cfg : Updates after the removal of the 'arg_label' field from the proc. inst. description. --- src/cwtest/cfg/flow/flow_subnet_dict.cfg | 4 +- src/cwtest/cfg/flow/flow_test.cfg | 132 +++++++++++------------ 2 files changed, 68 insertions(+), 68 deletions(-) diff --git a/src/cwtest/cfg/flow/flow_subnet_dict.cfg b/src/cwtest/cfg/flow/flow_subnet_dict.cfg index 9833db2..c0b236d 100644 --- a/src/cwtest/cfg/flow/flow_subnet_dict.cfg +++ b/src/cwtest/cfg/flow/flow_subnet_dict.cfg @@ -12,10 +12,10 @@ network: { procs: { - hz_lfo: { class: sine_tone, args: { default:{ chCnt:1 }}} + hz_lfo: { class: sine_tone, args: { chCnt:1 }} hz_sh: { class: sample_hold, in:{ in:hz_lfo.out }} - amp_lfo: { class: sine_tone, args: { default:{ chCnt:1 }}} + amp_lfo: { class: sine_tone, args: { chCnt:1 }} amp_sh: { class: sample_hold, in:{ in:amp_lfo.out }} osc: { class: sine_tone, in:{ hz: hz_sh.out }} diff --git a/src/cwtest/cfg/flow/flow_test.cfg b/src/cwtest/cfg/flow/flow_test.cfg index 1c88d6b..354f3ac 100644 --- a/src/cwtest/cfg/flow/flow_test.cfg +++ b/src/cwtest/cfg/flow/flow_test.cfg @@ -20,7 +20,7 @@ procs: { osc: { class: sine_tone }, - afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} } + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } } } @@ -33,10 +33,10 @@ network: { procs: { - lfo: { class: sine_tone, args:{ default:{hz:3, dc:440, gain:110 }}} + lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out } } osc: { class: sine_tone, in:{ hz:sh.out } }, - afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"/home/kevin/temp/audio_flow_out.wav"} }} + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"/home/kevin/temp/audio_flow_out.wav"} } } presets: { @@ -53,10 +53,10 @@ network: { procs: { - srate: { class: number, log:{value:0} args:{ default:{ value:48000f } } }, - tmr: { class: timer, in: { srate:srate.value}, log:{out:0} args:{ default:{ period_ms:1000.0 } } }, - cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ default:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint, repeat_fl:false } } }, - list: { class: list, in: { in:cnt.out }, log:{out:0} args:{ default:{ list:[a,b,c,d] }}} + srate: { class: number, log:{value:0} args:{ value:48000f } }, + tmr: { class: timer, in: { srate:srate.value}, log:{out:0} args:{ period_ms:1000.0 } }, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint, repeat_fl:false } }, + list: { class: list, in: { in:cnt.out }, log:{out:0} args:{ list:[a,b,c,d] }} } } } @@ -69,12 +69,12 @@ network: { procs: { - srate: { class: number, log:{value:0} args:{ default:{ value:48000f } } }, - tmr: { class: timer, in: { srate:srate.value}, log:{out:0} args:{ default:{ period_ms:1000.0 } } }, - cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ default:{ min:0, max:3, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint } } }, - x0v: { class: number, log:{value:0} args:{ default:{ value:2 }}}, - x1v: { class: number, log:{value:0} args:{ default:{ value:3 }}}, - add: { class: add, in: { in0:x0v.value, in1:x1v.value, in2:cnt.out }, log:{out:0} args:{ default:{ otype:int }} } + srate: { class: number, log:{value:0} args:{ value:48000f } }, + tmr: { class: timer, in: { srate:srate.value}, log:{out:0} args:{ period_ms:1000.0 } }, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ min:0, max:3, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint } }, + x0v: { class: number, log:{value:0} args:{ value:2 }}, + x1v: { class: number, log:{value:0} args:{ value:3 }}, + add: { class: add, in: { in0:x0v.value, in1:x1v.value, in2:cnt.out }, log:{out:0} args:{ otype:int }} } } } @@ -87,16 +87,16 @@ network: { procs: { - srate: { class: number, log:{value:0} args:{ default:{ value:48000.0} } }, - tmr: { class: timer, in: { srate:srate.value } log:{srate:0} args:{ default:{ period_ms:2000 } }}, - cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }}} - list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + srate: { class: number, log:{value:0} args:{ value:48000.0} }, + tmr: { class: timer, in: { srate:srate.value } log:{srate:0} args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, ps: { class: preset, in: { in:list.out } } - lfo: { class: sine_tone, in:{ srate:srate.value }, log:{srate:0} args: { default:{hz:3, dc:440, gain:110 }}} + lfo: { class: sine_tone, in:{ srate:srate.value }, log:{srate:0} args: { hz:3, dc:440, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out } } osc: { class: sine_tone, in:{ hz:sh.out, srate:srate.value }} - afout: { class: audio_file_out, in:{ in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + afout: { class: audio_file_out, in:{ in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } } presets: { @@ -116,15 +116,15 @@ network: { procs: { - tmr: { class: timer, log:{srate:0}, args:{ default:{ period_ms:2000 } }}, - cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }}} - list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + tmr: { class: timer, log:{srate:0}, args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, ps: { class: preset, in: { in:list.out } } - lfo: { class: sine_tone, log:{srate:0} args: { default:{ chCnt:1, hz:3, dc:440, gain:110 }}} + lfo: { class: sine_tone, log:{srate:0} args: { chCnt:1, hz:3, dc:440, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out } } osc: { class: sine_tone, in:{ hz:sh.out } log:{srate:0} } - afout: { class: audio_file_out, in: { in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } } presets: { @@ -149,12 +149,12 @@ osc_poly: { class: poly, - args: { default:{ count:3 }} + args: { count:3 } network: { procs: { - lfo: { class: sine_tone, args: { default:{ chCnt:1, hz:3, dc:440, gain:110 }}} + lfo: { class: sine_tone, args: { chCnt:1, hz:3, dc:440, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out }} osc: { class: sine_tone, in:{ hz: sh.out }} } @@ -167,8 +167,8 @@ } } - poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out}, args:{ default:{ gain:1, out_gain:0.5 }}}, - afout: { class: audio_file_out, in: { in:poly_merge.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out}, args:{ gain:1, out_gain:0.5 }}, + afout: { class: audio_file_out, in: { in:poly_merge.out } args:{ fname:"$/audio_flow_out.wav"} } } presets: { @@ -188,18 +188,18 @@ procs: { - tmr: { class: timer, args:{ default:{ period_ms:2000 } }}, - cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }}} - list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + tmr: { class: timer, args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, osc_poly: { class: poly, - args: { default:{ count:3 }} + args: { count:3 } network: { procs: { - lfo: { class: sine_tone, args: { default:{ chCnt:1, hz:3, dc:440, gain:110 }}} + lfo: { class: sine_tone, args: { chCnt:1, hz:3, dc:440, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out }} osc: { class: sine_tone, in:{ hz: sh.out }} } @@ -218,13 +218,13 @@ xfade_ctl: { class: xfade_ctl, in:{ srateSrc:osc_poly.osc.out, preset:list.out, trigger:list.out }, log:{trigger:0}, - args:{ default:{ net:osc_poly, durMs:1000, preset:a }} }, + args:{ net:osc_poly, durMs:1000, preset:a }} , poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out, gain_:xfade_ctl.gain_ }, - args:{ default:{ out_gain:0.5 }}}, + args:{ out_gain:0.5 }}, afout: { class: audio_file_out, in:{ in:poly_merge.out } - args:{ default:{fname:"$/audio_flow_out.wav"} }} + args:{ fname:"$/audio_flow_out.wav"} } } @@ -248,20 +248,20 @@ procs: { - tmr: { class: timer, args:{ default:{ period_ms:2000 } }}, - cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }}} - list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c ] }}}, + tmr: { class: timer, args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, - dc_list: { class: list, args: { default:{ in:0, list:[ 110f,220f,440f ]}}} + dc_list: { class: list, args: { in:0, list:[ 110f,220f,440f ]}} osc_poly: { class: poly, - args: { default:{ count:3 }} + args: { count:3 } network: { procs: { - lfo: { class: sine_tone, in:{ _.dc:_.dc_list.value_}, args: { default:{ chCnt:1, hz:3, gain:110 }}} + lfo: { class: sine_tone, in:{ _.dc:_.dc_list.value_}, args: { chCnt:1, hz:3, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out }} osc: { class: sine_tone, in:{ hz: sh.out }} } @@ -280,13 +280,13 @@ xfade_ctl: { class: xfade_ctl, in:{ srateSrc:osc_poly.osc.out, preset:list.out, trigger:list.out }, log:{trigger:0}, - args:{ default:{ net:osc_poly, durMs:1000, preset:a }} }, + args:{ net:osc_poly, durMs:1000, preset:a }}, poly_merge: { class: poly_merge, in:{ in_:osc_poly.osc_.out, gain_:xfade_ctl.gain_ }, - args:{ default:{ out_gain:0.5 }}}, + args:{ out_gain:0.5 }}, afout: { class: audio_file_out, in:{ in:poly_merge.out } - args:{ default:{fname:"$/audio_flow_out.wav"} }} + args:{ fname:"$/audio_flow_out.wav"} } } @@ -306,9 +306,9 @@ network: { procs: { - sub_osc: { class: mod_osc args:{ default:{ hz:220, hz_mod_hz:3, hz_mod_depth:55, amp_mod_hz:2, amp_mod_depth:0.5 }}}, + sub_osc: { class: mod_osc args:{ hz:220, hz_mod_hz:3, hz_mod_depth:55, amp_mod_hz:2, amp_mod_depth:0.5 }}, afout: { class: audio_file_out, in:{ in:sub_osc.mo_out } - args:{ default:{fname:"$/audio_flow_out.wav"}}} + args:{ fname:"$/audio_flow_out.wav"}} } } @@ -325,11 +325,11 @@ network: { procs: { - tmr: { class: timer, args:{ default:{ period_ms:1000.0 }}}, - cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0}, args:{ default:{ min:0, max:1, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint }}}, - list0: { class: list, args:{ default:{ in:2 list:[1,2,3] }}}, - list1: { class: list, args:{ default:{ in:0, list:[10,20,30] }}}, - add: { class: add, in: { in0:list0.out, in1:list1.out, in2:cnt.out }, log:{out:0} args:{ default:{ otype:int }} } + tmr: { class: timer, args:{ period_ms:1000.0 }}, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0}, args:{ min:0, max:1, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint }}, + list0: { class: list, args:{ in:2 list:[1,2,3] }}, + list1: { class: list, args:{ in:0, list:[10,20,30] }}, + add: { class: add, in: { in0:list0.out, in1:list1.out, in2:cnt.out }, log:{out:0} args:{ otype:int }} } } }, @@ -343,9 +343,9 @@ network: { procs: { - a: { class: number, log:{value:0}, args:{ default:{ value:1 }}}, - b: { class: number, log:{value:0}, args:{ default:{ value:2 }}}, - add: { class: add, in: { in0:a.value, in1:b.value }, log:{out:0}, args:{ default:{ otype:int }}} + a: { class: number, log:{value:0}, args:{ value:1 }}, + b: { class: number, log:{value:0}, args:{ value:2 }}, + add: { class: add, in: { in0:a.value, in1:b.value }, log:{out:0}, args:{ otype:int }} } } }, @@ -357,17 +357,17 @@ network: { procs: { - a: { class: number, log:{value:0}, args:{ default:{ value:1 }}}, - b: { class: number, log:{value:0}, args:{ default:{ value:2 }}}, + a: { class: number, log:{value:0}, args:{ value:1 }}, + b: { class: number, log:{value:0}, args:{ value:2 }}, add: { class: add, in: { in0:a.value, in1:b.value }, out: { out:b.store }, - log:{out:0}, args:{ default:{ otype:int }}} + log:{out:0}, args:{ otype:int }} } } }, - // Same as test_4 but with a dual-preset + // Same as test_4 but with a dual-preset. See preset 'd'. test_13: { framesPerCycle: 64, maxCycleCount: 15000, @@ -376,16 +376,16 @@ network: { procs: { - srate: { class: number, log:{value:0} args:{ default:{ value:48000.0} } }, - tmr: { class: timer, in: { srate:srate.value } log:{srate:0} args:{ default:{ period_ms:2000 } }}, - cnt: { class: counter, in: { trigger:tmr.out }, args:{ default:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint }}} - list: { class: list, in: { in:cnt.out }, args:{ default:{ list:[ a,b,c,d ] }}}, + srate: { class: number, log:{value:0} args:{ value:48000.0 }} , + tmr: { class: timer, in: { srate:srate.value } log:{srate:0} args:{ period_ms:2000 }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c,d ] }}, ps: { class: preset, in: { in:list.out } } - lfo: { class: sine_tone, in:{ srate:srate.value }, log:{srate:0,hz:0,dc:0} args: { default:{hz:3, dc:440, gain:110 }}} - sh: { class: sample_hold, in:{ in:lfo.out } } + lfo: { class: sine_tone, in:{ srate:srate.value }, log:{srate:0,hz:0,dc:0} args: { hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out }} osc: { class: sine_tone, in:{ hz:sh.out, srate:srate.value }} - afout: { class: audio_file_out, in:{ in:osc.out } args:{ default:{fname:"$/audio_flow_out.wav"} }} + afout: { class: audio_file_out, in:{ in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } } presets: { From 67454d169396a75a34c950798f3e9587c79287c8 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 25 May 2024 08:51:53 -0400 Subject: [PATCH 06/24] flow/flow_proc_dict.cfg, flow_test.cfg : Added 'print'. Fixed error in 'audio_file_in.eofFl' spec.. Added 'test_14' to test 'print' proc. --- src/cwtest/cfg/flow/flow_proc_dict.cfg | 12 ++++++-- src/cwtest/cfg/flow/flow_test.cfg | 41 +++++++++++++------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/src/cwtest/cfg/flow/flow_proc_dict.cfg b/src/cwtest/cfg/flow/flow_proc_dict.cfg index 07e816a..7f49fcc 100644 --- a/src/cwtest/cfg/flow/flow_proc_dict.cfg +++ b/src/cwtest/cfg/flow/flow_proc_dict.cfg @@ -16,7 +16,7 @@ audio_out: { vars: { - dev_label: { type:string, doc:"Audio device label." }, + dev_label: { type:string, doc:"Audio device label." }, in: { type:audio, flags:["src"], doc:"Audio input." } } } @@ -27,7 +27,7 @@ out:{ type:audio, doc:"Audio file output" }, on_off:{ type:bool, value:false, doc:"1=on 0=off" },, seekSecs:{ type:ftime, value:0.0, doc:"Seek to the specified seconds offset." } - eofFl:{ type:bool, eofFl: true, doc:"Set the system 'halt' flag when the audio is completely read."}, + eofFl:{ type:bool, value: true, doc:"Set the system 'halt' flag when the audio is completely read."}, } } @@ -630,6 +630,14 @@ out_gain: { type:coeff, value: 1, doc:"Output gain" }, out: { type:audio, doc:"Audio output." }, } + }, + + print: { + vars: { + in: { type:all, flags:["mult"], doc: "Value to print." }, + eol_fl: { type:all, doc: "Trigger an end-of-line." }, + text: { type:cfg, doc: "List of labels." }, + } } diff --git a/src/cwtest/cfg/flow/flow_test.cfg b/src/cwtest/cfg/flow/flow_test.cfg index 354f3ac..fa8168a 100644 --- a/src/cwtest/cfg/flow/flow_test.cfg +++ b/src/cwtest/cfg/flow/flow_test.cfg @@ -6,15 +6,11 @@ subnet_cfg_fname:"~/src/cwtest/src/cwtest/cfg/flow/flow_subnet_dict.cfg", project_dir:"~/src/cwtest/src/cwtest/cfg/flow/ttest", test_ref_dir:"~/src/cwtest/src/cwtest/cfg/flow/test_ref", - cmp_enable_fl: true, test_cases: { test_0: { - framesPerCycle:64, maxCycleCount:3750, // 5 seconds - printNetworkFl: false, // print the network instance - printClassDictFl: false, // print the class description dictionary network: { @@ -27,7 +23,6 @@ } test_1: { - framesPerCycle: 64, maxCycleCount: 1500, printNetworkFl: false, // print the network instance network: { @@ -36,7 +31,7 @@ lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }} sh: { class: sample_hold, in:{ in:lfo.out } } osc: { class: sine_tone, in:{ hz:sh.out } }, - afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"/home/kevin/temp/audio_flow_out.wav"} } + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } } presets: { @@ -47,7 +42,6 @@ } test_2: { - framesPerCycle: 64, maxCycleCount: 7500, network: { @@ -63,7 +57,6 @@ test_3: { - framesPerCycle: 64, maxCycleCount: 7500, network: { @@ -80,7 +73,6 @@ } test_4: { - framesPerCycle: 64, maxCycleCount: 15000, printNetworkFl: false, @@ -109,7 +101,6 @@ // Same as test_4 but using the system sample rate test_5: { - framesPerCycle: 64, maxCycleCount: 15000, sample_rate: 48000, @@ -137,7 +128,6 @@ // Simple poly test_6: { - framesPerCycle: 64, maxCycleCount: 7500, sample_rate: 48000, printNetworkFl: false, // print the network instance @@ -159,10 +149,13 @@ osc: { class: sine_tone, in:{ hz: sh.out }} } + // Note the use of the trailing underscore to create matching presets + // on all poly channels. Without the underscore the presets would only + // be applied to poly channel 0. presets: { - a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, - b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, - c: { lfo: a220 }, + a: { lfo_: { hz:1, dc:880 }, osc_: { gain:0.95 } }, + b: { lfo_: { hz:2, dc:220 }, osc_: { gain:0.75 } }, + c: { lfo_: a220 }, } } } @@ -178,7 +171,6 @@ // Test using xfade_ctl to cross-fade and assign presets. test_7: { - framesPerCycle: 64, maxCycleCount: 7500, sample_rate: 48000, printNetworkFl: false, // print the network instance @@ -238,7 +230,6 @@ // to non-poly procs using the poly index to select sources. // See `in:{ lfo_.dc:dc_list.value_}` test_8: { - framesPerCycle: 64, maxCycleCount: 7500, sample_rate: 48000, printNetworkFl: false, // print the network instance @@ -298,7 +289,6 @@ // Test using a subnet. test_9 : { - framesPerCycle: 64, maxCycleCount: 7500, sample_rate: 48000, printNetworkFl: false, // print the network instance @@ -319,7 +309,6 @@ // Testing using proc instances with explicit suffix ids. // See: list0 and list1 test_10: { - framesPerCycle: 64, maxCycleCount: 15000, network: { @@ -338,7 +327,6 @@ // Test with no exec cycles. // This network only runs the initialization pass. test_11: { - framesPerCycle: 64, maxCycleCount: 0, network: { @@ -352,7 +340,6 @@ // Test the 'out' statement to set feedback connections. test_12: { - framesPerCycle: 64, maxCycleCount: 10, network: { @@ -369,7 +356,6 @@ // Same as test_4 but with a dual-preset. See preset 'd'. test_13: { - framesPerCycle: 64, maxCycleCount: 15000, printNetworkFl: false, @@ -397,6 +383,19 @@ } } + test_14: { + maxCycleCount: 3750, + + network { + procs: { + tmr: { class: timer, args:{ period_ms:1000.0 }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint }} + add: { class: add, in: { in0:cnt.out, in1:cnt.out }, } + + log: { class: print, in: { in0:cnt.out, in1:add.out, eol_fl:add.out }, args:{ text:["a","b","c"] }} + } + } + } } } } From 497330e85cc7209dace56b6011d479a6318edbdb Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 27 May 2024 13:34:21 -0400 Subject: [PATCH 07/24] main.cpp : Added object readv() tests to objectTest(). --- src/cwtest/main.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 65b9709..2faff49 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -362,10 +362,23 @@ cw::rc_t objectTest( const cw::object_t* cfg, const cw::object_t* args, int argc int a = 0; int b = 0; - + const cw::object_t* c = nullptr; + bool d,e,f; + o->getv("a",a,"b",b); printf("G: %i %i\n",a,b); + + o->readv("a",0,a, + "b",0,b, + "c",cw::kOptFl | cw::kListTId,c, + "d",0,d, + "e",0,e, + "f",0,f); + + printf("R: %i %i : %i %i %i\n",a,b,d,e,f); + + const unsigned bufN = 128; char buf[bufN]; From cbd7174cac0c76a9b5b4dc8529397d96e92a96df Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 29 May 2024 12:38:54 -0400 Subject: [PATCH 08/24] main.cpp,main.cfg : Updates to handle cwTest managed testing. --- src/cwtest/cfg/main.cfg | 43 ++++++++++-- src/cwtest/main.cpp | 142 ++-------------------------------------- 2 files changed, 44 insertions(+), 141 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 841ac66..3a32250 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -14,15 +14,46 @@ test: { + test: { + base_dir: "~/src/cwtest/src/cwtest/cfg/test", + + resource_dir:"rsrc", + output_dir:"cur", + ref_dir:"ref", + + + // Notes: + // 1. The test spec. is recursive. Modules can be listed + // inside of modules. (e.g. 'lex' and 'flow'). + // 2. If a module spec. does not have an embedded + // 'module' or 'module_args' then the cases may + // be listed without a 'cases' label. + // (e.g. 'filesys','object', 'vop') + // 3. Command line args: + // | 'all' (required) The module path always begins with a '/'. + // | 'all' (required) + // 'gen_report' Print modulue/tes label. + // 'compare' Run compare pass. + // 'echo' Print the generated test output to the console. + // 'args' All command line args after 'args' are passed to the tests. + test: { + module_args: {} + + modules: { + lex:{ module_args:{}, cases: { test_0:{} } }, + filesys:{ test_0:{}}, + object:{ basic:{}, to_json:{} }, + vop:{ test_0:{} }, + time:{ test_0:{} }, + flow:"flow_test.cfg", + } + }, + + } + variadicTpl: {}, - lex:{}, - fileSys: {}, numbCvt: {}, - object: {}, - objectToJson: {}, - vop:{}, - time:{}, thread: {}, kbTest1: {}, kbTest2: {}, diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 2faff49..a8f400d 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -1,12 +1,12 @@ #include "cwCommon.h" #include "cwLog.h" #include "cwCommonImpl.h" +#include "cwTest.h" #include "cwMem.h" #include "cwFile.h" #include "cwVariant.h" #include "cwFileSys.h" #include "cwTextBuf.h" -#include "cwLex.h" #include "cwText.h" #include "cwNumericConvert.h" #include "cwObject.h" @@ -33,9 +33,6 @@ #include "cwTime.h" #include "cwMidi.h" #include "cwMidiDecls.h" -#include "cwFlowDecl.h" -#include "cwFlow.h" -#include "cwFlowTest.h" #include "cwDynRefTbl.h" #include "cwScoreParse.h" @@ -109,8 +106,6 @@ #include "cwMidiState.h" #include "cwSvgMidi.h" -//#include "cwNbMem.h" - #include unsigned calc( unsigned n ) @@ -278,6 +273,8 @@ char* optionalNewFile( const cw::object_t* args, const char* label ) { return instantiatePathVariable(args,label,kVarOptionalFl); } + + cw::rc_t variadicTplTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { print("a", 1, "b", 3.14, "c",5L); @@ -301,135 +298,26 @@ cw::rc_t variadicTplTest( const cw::object_t* cfg, const cw::object_t* args, int return cw::kOkRC; } - - -cw::rc_t fileSysTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ - cw::filesys::pathPart_t* pp = cw::filesys::pathParts(__FILE__); - - cwLogInfo("dir:%s",pp->dirStr); - cwLogInfo("fn: %s",pp->fnStr); - cwLogInfo("ext:%s",pp->extStr); - - char* fn = cw::filesys::makeFn( pp->dirStr, pp->fnStr, pp->extStr, nullptr ); - - cwLogInfo("fn: %s",fn); - - cw::mem::release(pp); - cw::mem::release(fn); - - - const char myPath[] = "~/src/foo"; - - char* expPath = cw::filesys::expandPath(myPath); - - cwLogInfo("%s %s",myPath,expPath); - - cw::mem::release(expPath); - - return cw::kOkRC; -} - cw::rc_t numbCvtTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { int8_t x0 = 3; int x1 = 127; cw::numeric_convert( x1, x0 ); - printf("%i %i\n",x0,x1); + cwLogPrint("%i %i\n",x0,x1); int v0 = -1; double v1 = -1; cw::string_to_number("123",v0); cw::string_to_number("3.4",v1); - printf("%i %f\n",v0,v1 ); + cwLogPrint("%i %f\n",v0,v1 ); return cw::kOkRC; } -cw::rc_t objectTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ - cw::object_t* o; - const char s [] = "{ a:1, b:2, c:[ 1.23, 4.56 ], d:true, e:false, f:true }"; - cw::objectFromString(s,o); - int v; - o->get("b",v); - printf("value:%i\n",v); - - o->print(); - - int a = 0; - int b = 0; - const cw::object_t* c = nullptr; - bool d,e,f; - - o->getv("a",a,"b",b); - printf("G: %i %i\n",a,b); - - - o->readv("a",0,a, - "b",0,b, - "c",cw::kOptFl | cw::kListTId,c, - "d",0,d, - "e",0,e, - "f",0,f); - - printf("R: %i %i : %i %i %i\n",a,b,d,e,f); - - - const unsigned bufN = 128; - char buf[bufN]; - - unsigned i = o->to_string(buf,bufN); - printf("%i : %s\n",i, buf); - - cw::object_t* oo = o->duplicate(); - - oo->print(); - - oo->free(); - - - o->free(); - return cw::kOkRC; -} - -cw::rc_t objectToJsonTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ - double v0[] = {1.23,2.34,3.45}; - unsigned v0N = sizeof(v0)/sizeof(v0[0]); - int v1[] = {-1,0,1,2,3,4}; - unsigned v1N = sizeof(v1)/sizeof(v1[0]); - - cw::object_t* d = cw::newDictObject(); - - d->putv("A","Abc","B",1.234); - d->put_numeric_list("v0",v0,v0N); - d->put_numeric_list("v1",v1,v1N); - - char* s = d->to_string(); - printf("%s\n",s); - cw::mem::release(s); - - d->free(); - - return cw::kOkRC; -} - -cw::rc_t vectOpTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ - int v1[] = { 1,2,1,2,1,2,1,2,1,2 }; - int v0[ 10 ]; - - cw::vop::deinterleave( v0, v1, 5, 2 ); - cw::vop::print(v0,10,"%i "); - return cw::kOkRC; -} - -cw::rc_t lexTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::lex::test(); } -cw::rc_t timeTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::time::test(); } +cw::rc_t testTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::test::test(args,argc,argv); } cw::rc_t threadTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::threadTest(); } cw::rc_t kbTest1Test( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::kbTest1(); return cw::kOkRC; } cw::rc_t kbTest2Test( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { cw::kbTest2(); return cw::kOkRC; } @@ -465,7 +353,6 @@ cw::rc_t pvocFileProc( const cw::object_t* cfg, const cw::object_t* args cw::rc_t socketMdnsTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::mdns::test(); } cw::rc_t dnsSdTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::net::dnssd::test(); } cw::rc_t euConTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::eucon::test(); } -cw::rc_t flowTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::flow::test(args,argc,argv); } cw::rc_t scoreFollowTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::score_follow_test::test(args); } cw::rc_t svgMidiFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::svg_midi::test_midi_file(args); } @@ -482,13 +369,6 @@ cw::rc_t ioMinTest( const cw::object_t* cfg, const cw::object_t* args, i cw::rc_t ioAudioMidiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio_midi_app::main(args); } cw::rc_t ioPresetSelTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { - /* - cw::rc_t rc; - const cw::object_t* flow_proc_dict = nullptr; - - if((rc = cfg->getv("flow_proc_dict",flow_proc_dict)) != cw::kOkRC ) - return cwLogError(rc,"The 'flow_proc_dict' specification object was not found."); - */ return cw::preset_sel_app::main(args,argc-1,argv+1); } #else @@ -797,13 +677,8 @@ int main( int argc, const char* argv[] ) func_t modeArray[] = { { "variadicTpl", variadicTplTest }, - { "lex", lexTest }, - { "fileSys", fileSysTest }, + { "test", testTest }, { "numbCvt", numbCvtTest }, - { "object", objectTest }, - { "objectToJson", objectToJsonTest }, - { "vop", vectOpTest }, - { "time", timeTest }, { "thread", threadTest }, { "kbTest1", kbTest1Test }, { "kbTest2", kbTest2Test }, @@ -864,9 +739,6 @@ int main( int argc, const char* argv[] ) { "am_to_midi_file", amToMidiFile }, { "audio_file_proc", audioFileProc }, { "pvoc_file_proc", pvocFileProc }, - { "flow_test", flowTest }, - { "flow_pv", flowTest }, - { "flow_spec_dist", flowTest }, { "preset_sel", ioPresetSelTest }, { "score_follow", scoreFollowTest }, { "svg_midi_file", svgMidiFileTest }, From ede0fcf665031464d5278156f7088701c7671fa2 Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 30 May 2024 09:22:24 -0400 Subject: [PATCH 09/24] main.cpp,main.cfg : Moved audioBuf,mtx, and textBuf tests to cwTest --- src/cwtest/cfg/main.cfg | 26 +++++++++++++++++++++----- src/cwtest/main.cpp | 6 ------ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 3a32250..3c0e979 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -45,11 +45,26 @@ object:{ basic:{}, to_json:{} }, vop:{ test_0:{} }, time:{ test_0:{} }, + textBuf: { test_0:{} }, + audioBuf:{ test_0:{} } + mtx:{ test_0: { + m0: [ [0,3], [1,4], [2,5] ], + m1: [ [0,1,2],[3,4,5] ], + + m2: [ [[0,1],[2,3]], [[4,5],[6,7]], [[8,9],[10,11]] ], + m3: [ 0,1,2 ], + + m4: [ [10,13], [11,14], [12,15] ], + + y0: [ [5,14],[14,50] ], + y1: [ [9,12,15],[12,17,22],[15,22,29] ], + } }, + flow:"flow_test.cfg", } - }, + }}, - } + variadicTpl: {}, @@ -58,6 +73,7 @@ kbTest1: {}, kbTest2: {}, kbTest3: {}, + spscBuf: {}, spscQueueTmpl: {}, @@ -123,9 +139,9 @@ fname: "/home/kevin/src/cwtest/src/cwtest/cfg/gutim_full/data1/beck2/record_5/midi.mid" }, - textBuf: {}, - audioBuf: {}, - audioDev: {}, + //textBuf: {}, + //audioBuf: {}, + //audioDev: {}, audioDevAlsa: {}, audioDevRpt: {}, // print a list of audio device diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index a8f400d..8092e7a 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -326,10 +326,7 @@ cw::rc_t spscBuf( const cw::object_t* cfg, const cw::object_t* args cw::rc_t spscQueueTmpl( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::testSpScQueueTmpl(); } cw::rc_t nbMpScQueue( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::nbmpscq::test(args); } cw::rc_t serialPortSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::serialPortSrvTest(); } -cw::rc_t textBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::textBuf::test(); } -cw::rc_t audioBufTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::buf::test(); } cw::rc_t audioDevFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audio::device::file::test(args); } -cw::rc_t mtxTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::mtx::test(args); } cw::rc_t b23TreeTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::b23::test(args); } cw::rc_t midiFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::midi::file::test(args); } cw::rc_t audioFileTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::audiofile::test(args); } @@ -691,8 +688,6 @@ int main( int argc, const char* argv[] ) { "midiDeviceReport", midiDeviceReport }, { "midiDevice", midiDeviceTest }, { "midiFileDev", midiFileDevTest }, - { "textBuf", textBufTest }, - { "audioBuf", audioBufTest }, { "audioDevFileTest", audioDevFileTest }, { "audioDevTest",audioDevTest }, { "audioDevTone", audioDevTestTone }, @@ -718,7 +713,6 @@ int main( int argc, const char* argv[] ) { "dataset_rdr", datasetRdrTest }, { "dataset_adapter", datasetAdapterTest }, { "svg", svgTest }, - { "mtx", mtxTest }, { "b23Tree", b23TreeTest }, { "midifile", midiFileTest }, { "audiofile", audioFileTest }, From 3dbc8afca91c1245780813c2c321f3c31e618665 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 1 Jun 2024 08:52:44 -0400 Subject: [PATCH 10/24] fow/flow_proc_dict.cfg : Updates to accompany latest changes to cwFlowProc.cpp --- src/cwtest/cfg/flow/flow_proc_dict.cfg | 34 ++++++++------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/src/cwtest/cfg/flow/flow_proc_dict.cfg b/src/cwtest/cfg/flow/flow_proc_dict.cfg index 7f49fcc..5d2a735 100644 --- a/src/cwtest/cfg/flow/flow_proc_dict.cfg +++ b/src/cwtest/cfg/flow/flow_proc_dict.cfg @@ -50,7 +50,7 @@ audio_split: { vars: { in: { type:audio, flags:["src"], doc:"Audio input." }, - select: { type:int, doc:"Give a list of integers where each integer selects an output channel for the associated input channel." } + select: { type:cfg, doc:"Give a list of integers where each integer selects an output channel for the associated input channel." } igain: { type:coeff, value:1.0, doc:"Audio gain for each input channel." } ogain: { type:coeff, value:1.0, doc:"Audio gain for each output channel." } out: { type:audio, doc:"Audio output." }, @@ -63,6 +63,7 @@ } } + audio_duplicate: { vars: { in: { type:audio, flags:["src"], doc:"Audio input."}, @@ -72,19 +73,13 @@ } } - audio_merge: { - vars: { - in0: { type:audio, flags:["src"], doc:"First audio input." }, - in1: { type:audio, flags:["src"], doc:"Second audio input." }, - in2: { type:audio, flags:["src","src_opt"], doc:"Third audio input." }, - in3: { type:audio, flags:["src","src_opt"], doc:"Fourth audio input." }, - in4: { type:audio, flags:["src","src_opt"], doc:"Fifth audio input." }, - in5: { type:audio, flags:["src","src_opt"], doc:"Sixth audio input." }, - in6: { type:audio, flags:["src","src_opt"], doc:"Seventh audio input." }, - in7: { type:audio, flags:["src","src_opt"], doc:"Eigth audio input." }, - gain: { type:coeff, value:1.0, doc:"Audio gain for each selected (output) channel." } - out: { type:audio, doc:"Audio output. Channel count is the sum of the input channel count." }, - } + audio_merge: { + vars: { + in: { type:audio, flags:["src", "mult"], doc:"Audio input channel." }, + gain: { type:coeff, value: 1, flags:["src", "mult"], doc:"Input channel gain." }, + out_gain: { type:coeff, value: 1, doc:"Output gain" }, + out: { type:audio, doc:"Audio output. Channel count is the sum of the input channel count." }, + } } audio_mix: { @@ -122,6 +117,7 @@ a220 : { hz:220 }, a440 : { hz:440 }, a880 : { hz:880 }, + mono: { chCnt:1, gain:0.75 } } } @@ -622,16 +618,6 @@ } }, - poly_merge: { - - vars: { - in: { type:audio, flags:["src", "mult"], doc:"Audio input channel." }, - gain: { type:coeff, value: 0, flags:["src", "mult"], doc:"Input channel gain." }, - out_gain: { type:coeff, value: 1, doc:"Output gain" }, - out: { type:audio, doc:"Audio output." }, - } - }, - print: { vars: { in: { type:all, flags:["mult"], doc: "Value to print." }, From 63858e4002c8d14248ff322a0aad518f7544bb9f Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 3 Jul 2024 14:19:48 -0400 Subject: [PATCH 11/24] cwtest/cfg/test/ref/* : Initial commit --- src/cwtest/cfg/test/flow_test.cfg | 593 ++++++++++++++++++ .../cfg/test/ref/audioBuf/test_0/log.txt | 1 + .../cfg/test/ref/filesys/test_0/log.txt | 1 + .../test/ref/flow/demo_01_sine_file/log.txt | 2 + .../test/ref/flow/demo_02_mod_sine/log.txt | 2 + .../cfg/test/ref/flow/demo_03_presets/log.txt | 3 + .../cfg/test/ref/flow/demo_04_program/log.txt | 12 + .../test/ref/flow/demo_05_mult_inputs/log.txt | 12 + .../test/ref/flow/demo_06_mult_conn/log.txt | 2 + .../test/ref/flow/demo_07_proc_suffix/log.txt | 2 + .../cfg/test/ref/flow/demo_08_mix/log.txt | 2 + .../test/ref/flow/demo_09_simple_poly/log.txt | 2 + src/cwtest/cfg/test/ref/flow/test_0/log.txt | 2 + src/cwtest/cfg/test/ref/flow/test_1/log.txt | 2 + src/cwtest/cfg/test/ref/flow/test_10/log.txt | 6 + src/cwtest/cfg/test/ref/flow/test_11/log.txt | 7 + src/cwtest/cfg/test/ref/flow/test_12/log.txt | 25 + src/cwtest/cfg/test/ref/flow/test_13/log.txt | 21 + src/cwtest/cfg/test/ref/flow/test_14/log.txt | 7 + src/cwtest/cfg/test/ref/flow/test_2/log.txt | 20 + src/cwtest/cfg/test/ref/flow/test_3/log.txt | 24 + src/cwtest/cfg/test/ref/flow/test_4/log.txt | 8 + src/cwtest/cfg/test/ref/flow/test_5/log.txt | 8 + src/cwtest/cfg/test/ref/flow/test_6/log.txt | 2 + src/cwtest/cfg/test/ref/flow/test_7/log.txt | 12 + src/cwtest/cfg/test/ref/flow/test_8/log.txt | 12 + src/cwtest/cfg/test/ref/flow/test_9/log.txt | 2 + src/cwtest/cfg/test/ref/lex/test_0/log.txt | 32 + src/cwtest/cfg/test/ref/mtx/test_0/log.txt | 69 ++ src/cwtest/cfg/test/ref/object/basic/log.txt | 19 + .../cfg/test/ref/object/to_json/log.txt | 1 + .../cfg/test/ref/textBuf/test_0/log.txt | 2 + src/cwtest/cfg/test/ref/time/test_0/log.txt | 6 + src/cwtest/cfg/test/ref/vop/test_0/log.txt | 1 + 34 files changed, 922 insertions(+) create mode 100644 src/cwtest/cfg/test/flow_test.cfg create mode 100644 src/cwtest/cfg/test/ref/audioBuf/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/filesys/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_01_sine_file/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_02_mod_sine/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_03_presets/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_04_program/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_05_mult_inputs/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_06_mult_conn/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_07_proc_suffix/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_08_mix/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/demo_09_simple_poly/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_1/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_10/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_11/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_12/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_13/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_14/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_2/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_3/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_4/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_5/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_6/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_7/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_8/log.txt create mode 100644 src/cwtest/cfg/test/ref/flow/test_9/log.txt create mode 100644 src/cwtest/cfg/test/ref/lex/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/mtx/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/object/basic/log.txt create mode 100644 src/cwtest/cfg/test/ref/object/to_json/log.txt create mode 100644 src/cwtest/cfg/test/ref/textBuf/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/time/test_0/log.txt create mode 100644 src/cwtest/cfg/test/ref/vop/test_0/log.txt diff --git a/src/cwtest/cfg/test/flow_test.cfg b/src/cwtest/cfg/test/flow_test.cfg new file mode 100644 index 0000000..3e955b9 --- /dev/null +++ b/src/cwtest/cfg/test/flow_test.cfg @@ -0,0 +1,593 @@ +{ + module_args: { + proc_cfg_fname: "~/src/cwtest/src/libcw/flow/proc_dict.cfg", + subnet_cfg_fname:"~/src/cwtest/src/libcw/flow/subnet_dict.cfg", + }, + + cases: { + + test_0: { + maxCycleCount:3750, // 5 seconds + + network: { + + procs: { + osc: { class: sine_tone }, + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/audio_flow_out.wav"} + } + } + } + } + + test_1: { + maxCycleCount: 1500, + printNetworkFl: false, // print the network instance + network: { + + procs: { + lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out } }, + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } + } + + presets: { + a: { lfo:a220, osc: { gain:0.8 } }, + b: { lfo:{ dc:220, gain:25 }, osc: { gain:0.5 } } + } + } + } + + test_2: { + maxCycleCount: 7500, + + network: { + + procs: { + srate: { class: number, log:{out:0} args:{ in:48000.0f } }, + tmr: { class: timer, in: { srate:srate.out}, log:{out:0} args:{ period_ms:1000.0 } }, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint, repeat_fl:false } }, + list: { class: list, in: { in:cnt.out }, log:{out:0} args:{ list:[a,b,c,d] }} + } + } + } + + + test_3: { + maxCycleCount: 7500, + + network: { + + procs: { + srate: { class: number, log:{out:0} args:{ in:48000f } }, + tmr: { class: timer, in: { srate:srate.out}, log:{out:0} args:{ period_ms:1000.0 } }, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0} args:{ min:0, max:3, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint } }, + x0v: { class: number, log:{out:0} args:{ in:2 }}, + x1v: { class: number, log:{out:0} args:{ in:3 }}, + add: { class: add, in: { in0:x0v.out, in1:x1v.out, in2:cnt.out }, log:{out:0} args:{ otype:int }} + } + } + } + + test_4: { + maxCycleCount: 15000, + printNetworkFl: false, + + network: { + + procs: { + srate: { class: number, log:{in:0} args:{ in:48000.0f} }, + tmr: { class: timer, in: { srate:srate.out } log:{srate:0} args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, + ps: { class: preset, in: { in:list.out } } + + lfo: { class: sine_tone, in:{ srate:srate.out }, log:{srate:0} args: { hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out, srate:srate.out }} + afout: { class: audio_file_out, in:{ in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } + } + + presets: { + a: { lfo: { hz:1.0, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2.0, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 } + } + } + } + + // Same as test_4 but using the system sample rate + test_5: { + maxCycleCount: 15000, + sample_rate: 48000, + + network: { + + procs: { + tmr: { class: timer, log:{srate:0}, args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:clip, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, + ps: { class: preset, in: { in:list.out } } + + lfo: { class: sine_tone, log:{srate:0} args: { chCnt:1, hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out } log:{srate:0} } + afout: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } + } + + presets: { + a: { lfo: { hz:1, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + } + } + } + + // Simple poly + test_6: { + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + + osc_poly: { + class: poly, + args: { count:3 } + + + network: { + procs: { + lfo: { class: sine_tone, args: { chCnt:1, hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz: sh.out }} + } + + // Note the use of the trailing underscore to create matching presets + // on all poly channels. Without the underscore the presets would only + // be applied to poly channel 0. + presets: { + a: { lfo_: { hz:1, dc:880 }, osc_: { gain:0.95 } }, + b: { lfo_: { hz:2, dc:220 }, osc_: { gain:0.75 } }, + c: { lfo_: a220 }, + } + } + } + + poly_merge: { class: audio_merge, in:{ in_:osc_poly.osc_.out}, args:{ gain:1, out_gain:0.5 }}, + afout: { class: audio_file_out, in: { in:poly_merge.out } args:{ fname:"$/audio_flow_out.wav"} } + } + + presets: { + } + } + } + + // Test using xfade_ctl to cross-fade and assign presets. + test_7: { + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + + tmr: { class: timer, args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, + + osc_poly: { + class: poly, + args: { count:3 } + + + network: { + procs: { + lfo: { class: sine_tone, args: { chCnt:1, hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz: sh.out }} + } + + // Note the use of the trailing underscore to create matching presets + // on all poly channels. Without the underscore the presets would only + // be applied to poly channel 0. + presets: { + a: { lfo_: { hz:1, dc:880 }, osc_: { gain:0.95 } }, + b: { lfo_: { hz:2, dc:220 }, osc_: { gain:0.75 } }, + c: { lfo_: a220 }, + } + } + } + + + xfade_ctl: { class: xfade_ctl, in:{ srateSrc:osc_poly.osc.out, preset:list.out, trigger:list.out }, + log:{trigger:0}, + args:{ net:osc_poly, durMs:1000, preset:a }} , + + poly_merge: { class: audio_merge, in:{ in_:osc_poly.osc_.out, gain_:xfade_ctl.gain_ }, + args:{ out_gain:0.5 }}, + + afout: { class: audio_file_out, in:{ in:poly_merge.out } + args:{ fname:"$/audio_flow_out.wav"} } + + + } + + presets: { + } + } + } + + // Test using xfade_ctl to assign presets and connecting poly procs + // to non-poly procs using the poly index to select sources. + // See `in:{ lfo_.dc:dc_list.value_}` + test_8: { + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + + procs: { + + tmr: { class: timer, args:{ period_ms:2000 } }, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:2, inc:1, init:0, mode:reverse, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c ] }}, + + dc_list: { class: list, args: { in:0, list:[ 110f,220f,440f ]}} + + osc_poly: { + class: poly, + args: { count:3 } + + + network: { + procs: { + lfo: { class: sine_tone, in:{ _.dc:_.dc_list.value_}, args: { chCnt:1, hz:3, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz: sh.out }} + } + + // Note the use of the trailing underscore to create matching presets + // on all poly channels. Without the underscore the presets would only + // be applied to poly channel 0. + presets: { + a: { lfo_: { hz:1 }, osc_: { gain:0.95 } }, + b: { lfo_: { hz:2 }, osc_: { gain:0.75 } }, + c: { lfo_: a220 }, + } + } + } + + + xfade_ctl: { class: xfade_ctl, in:{ srateSrc:osc_poly.osc.out, preset:list.out, trigger:list.out }, + log:{trigger:0}, + args:{ net:osc_poly, durMs:1000, preset:a }}, + + poly_merge: { class: audio_merge, in:{ in_:osc_poly.osc_.out, gain_:xfade_ctl.gain_ }, + args:{ out_gain:0.5 }}, + + afout: { class: audio_file_out, in:{ in:poly_merge.out } + args:{ fname:"$/audio_flow_out.wav"} } + + + } + + presets: { + } + } + } + + // Test using a subnet. + test_9 : { + maxCycleCount: 7500, + sample_rate: 48000, + printNetworkFl: false, // print the network instance + printClassDictFl: false, // print the class description dictionary + + network: { + procs: { + sub_osc: { class: mod_osc args:{ hz:220, hz_mod_hz:3, hz_mod_depth:55, amp_mod_hz:2, amp_mod_depth:0.5 }}, + afout: { class: audio_file_out, in:{ in:sub_osc.mo_out } + args:{ fname:"$/audio_flow_out.wav"}} + } + } + } + + // Testing using proc instances with explicit suffix ids. + // See: list0 and list1 + test_10: { + maxCycleCount: 15000, + + network: { + + procs: { + tmr: { class: timer, args:{ period_ms:1000.0 }}, + cnt: { class: counter, in: { trigger:tmr.out }, log:{out:0}, args:{ min:0, max:2, inc:1, init:0, mode:clip, repeat_fl:false, out_type:uint }}, + list0: { class: list, args:{ in:2 list:[1,2,3] }}, + list1: { class: list, args:{ in:0, list:[10,20,30] }}, + add: { class: add, in: { in0:list0.out, in1:list1.out, in2:cnt.out }, log:{out:0} args:{ otype:int }} + } + } + }, + + + // Test with no exec cycles. + // This network only runs the initialization pass. + test_11: { + maxCycleCount: 0, + + network: { + procs: { + a: { class: number, log:{out:0}, args:{ in:1 }}, + b: { class: number, log:{out:0}, args:{ in:2 }}, + add: { class: add, in: { in0:a.out, in1:b.out }, log:{out:0}, args:{ otype:int }} + } + } + }, + + /* + + This test is broken because the only time that 'add' outputs a value + is when one of it's inputs changes value, and in this case that is + that only occurs when 'add' is being constructed - prior to the + feedback connection being created. + + // Test the 'out' statement to set feedback connections. + test_12: { + maxCycleCount: 10, + + network: { + procs: { + a: { class: number, log:{out:0}, args:{ in:1 }}, + b: { class: number, log:{out:0}, args:{ in0:0, in1:2 }}, + + add: { class: add, in: { in0:a.out, in1:b.out }, out: { out:b.in0 }, + log:{out:0}, args:{ otype:int }} + } + } + }, + */ + + // Same as test_4 but with a dual-preset. See preset 'd'. + test_13: { + maxCycleCount: 15000, + printNetworkFl: false, + + network: { + + procs: { + srate: { class: number, log:{out:0} args:{ in:48000.0f }} , + tmr: { class: timer, in: { srate:srate.out } log:{srate:0} args:{ period_ms:2000 }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint }} + list: { class: list, in: { in:cnt.out }, args:{ list:[ a,b,c,d ] }}, + ps: { class: preset, in: { in:list.out } } + + lfo: { class: sine_tone, in:{ srate:srate.out }, log:{srate:0,hz:0,dc:0} args: { hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out }} + osc: { class: sine_tone, in:{ hz:sh.out, srate:srate.out }} + afout: { class: audio_file_out, in:{ in:osc.out } args:{ fname:"$/audio_flow_out.wav"} } + } + + presets: { + a: { lfo: { hz:1.0, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2.0, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a220 }, + d: [ a,b,0.5 ] + } + } + } + + test_14: { + maxCycleCount: 3750, + + network { + procs: { + tmr: { class: timer, args:{ period_ms:1000.0 }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:clip, out_type:uint }} + add: { class: add, in: { in0:cnt.out, in1:cnt.out }, } + + log: { class: print, in: { in0:cnt.out, in1:add.out, eol_fl:add.out }, args:{ text:["a","b","c"] }} + } + } + } + + //------------------ caw example test cases + + // Demonstrate a simple two processor network. + demo_01_sine_file: { + + durLimitSecs:5.0, + + network: { + + procs: { + osc: { class: sine_tone }, + af: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/out.wav"} } + } + } + } + + + // Demonstrate simple signal processing and how to apply a processor class prefix. + demo_02_mod_sine: { + + durLimitSecs:5.0, + + network: { + + procs: { + lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, preset:mono, in:{ hz:sh.out } }, + af: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/out.wav"} } + } + } + } + + // Demonstrate applying a preset at initialization time. + demo_03_presets: { + + durLimitSecs:5.0, + preset: "a", + + network: { + + procs: { + lfo: { class: sine_tone, args:{ hz:3, dc:440, gain:110 }} + sh: { class: sample_hold, in:{ in:lfo.out } } + osc: { class: sine_tone, in:{ hz:sh.out } }, + af: { class: audio_file_out, in: { in:osc.out } args:{ fname:"$/out.wav"} } + } + + presets: + { + a: { lfo: { hz:1.0, dc:880 }, osc: { gain:0.95 } }, + b: { lfo: { hz:2.0, dc:220 }, osc: { gain:0.75 } }, + c: { lfo: a880 }, + d: [ a,b,0.5 ] + + } + } + } + + // Demonstrate the `print` processor and event programming. + demo_04_program: { + + durLimitSecs: 10.0, + + network { + procs: { + tmr: { class: timer, args:{ period_ms:1000.0 }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:modulo } }, + print: { class: print, in: { in:cnt.out, eol_fl:cnt.out }, args:{ text:["my","count"] }} + } + } + } + + // Demonstrate 'mult' inputs. + demo_05_mult_inputs: { + + durLimitSecs: 10.0, + + network: { + procs: { + tmr: { class: timer, args:{ period_ms:1000.0 }}, + cnt: { class: counter, in: { trigger:tmr.out }, args:{ min:0, max:3, inc:1, init:0, mode:modulo } }, + numb: { class: number, args:{ in:3 }}, + sum: { class: add, in: { in0:cnt.out, in1:numb.out } }, + print: { class: print, in: { in0:cnt.out, in1:sum.out, eol_fl:sum.out }, args:{ text:["cnt","add","count"] }} + } + } + } + + // Demonstrate different forms of the in-stmt + demo_06_mult_conn: { + durLimitSecs: 5.0, + + network: { + procs: { + osc: { class: sine_tone, args: { chCnt:6, hz:[110,220,440,880,1760, 3520] }}, + split: { class: audio_split, in:{ in:osc.out }, args: { select:[ 0,0, 1,1, 2,2 ] } }, + + // Create merge.in0,in1,in2 by iterating across all outputs of 'split'. + merge_a: { class: audio_merge, in:{ in_:split.out_ } }, + af_a: { class: audio_file_out, in:{ in:merge_a.out }, args:{ fname:"$/out_a.wav" }} + + // Create merge.in0,in1 and connect them to split.out0 and split.out1 + merge_b: { class: audio_merge, in:{ in_:split.out0_2 } }, + af_b: { class: audio_file_out, in:{ in:merge_b.out }, args:{ fname:"$/out_b.wav" }} + + // Create merge.in0,in1 and connect them both to split.out1 + merge_c: { class: audio_merge, in:{ in0_2:split.out1 } }, + af_c: { class: audio_file_out, in:{ in:merge_c.out }, args:{ fname:"$/out_c.wav" }} + + } + } + } + + // Demonstrate creating processors with explicit sfx-ids and connecting to them with a single in-stmt. + demo_07_proc_suffix: { + durLimitSecs: 5.0, + + network: { + procs: { + osc: { class: sine_tone, args: { chCnt:6, hz:[110,220,440,880,1760, 3520] }}, + split: { class: audio_split, in:{ in:osc.out }, args: { select:[ 0,0, 1,1, 2,2 ] } }, + + // Create 3 audio gain controls with explicit sfx-ids + g0: { class:audio_gain, in:{ in:split0.out0 }, args:{ gain:0.9} }, + g1: { class:audio_gain, in:{ in:split0.out1 }, args:{ gain:0.5} }, + g2: { class:audio_gain, in:{ in:split0.out2 }, args:{ gain:0.1} }, + + // Create audio-merge inputs and connect them to 3 consecutive gain controls + // by iterating the in-stmt over the source proc sfx-id. + merge: { class: audio_merge, in:{ in_:g_.out } }, + af: { class: audio_file_out, in:{ in:merge.out }, args:{ fname:"$/out_a.wav" }} + + + } + } + } + + // Demonstrate instantiating 'mult' variables from the an 'args' statement. + demo_08_mix: { + + durLimitSecs:5.0, + + network: { + + procs: { + osc_a: { class: sine_tone, args: { hz:110 } }, + osc_b: { class: sine_tone, args: { hz:220 } }, + + // Instantiate gain:0 and gain:1 to control the input gain of in:0 and in:1. + mix: { class: audio_mix, in: { in0:osc_a.out, in1:osc_b.out }, args:{ igain0:[0.8, 0], igain1:[0, 0.2] } }, + af: { class: audio_file_out, in: { in:mix.out } args:{ fname:"$/out.wav"} } + } + } + } + + // Demonstrate a network with a polyphonic subnet. + demo_09_simple_poly: { + + durLimitSecs: 5.0, + + network: { + + procs: { + + g_list: { class: list, args: { in:0, list:[ 110f,220f,440f ]}}, + dc_list: { class: list, args: { in:0, list:[ 220f,440f,880f ]}}, + + osc_poly: { + class: poly, + args: { count:3 }, // Create 3 instances of 'network'. + + network: { + procs: { + lfo: { class: sine_tone, in:{ _.dc:_.dc_list.value_, _.gain:_.g_list.value_ } args: { chCnt:1, hz:3 }}, + sh: { class: sample_hold, in:{ in:lfo.out }}, + osc: { class: sine_tone, in:{ hz: sh.out }}, + } + } + } + + // Iterate over the instances of `osc_poly.osc_.out` to create one `audio_merge` + // input for every output from the polyphonic network. + merge: { class: audio_merge, in:{ in_:osc_poly.osc_.out}, args:{ gain:1, out_gain:0.5 }}, + af: { class: audio_file_out, in:{ in:merge.out } args:{ fname:"$/out.wav"} } + } + } + } + + + + } +} diff --git a/src/cwtest/cfg/test/ref/audioBuf/test_0/log.txt b/src/cwtest/cfg/test/ref/audioBuf/test_0/log.txt new file mode 100644 index 0000000..396c549 --- /dev/null +++ b/src/cwtest/cfg/test/ref/audioBuf/test_0/log.txt @@ -0,0 +1 @@ +: 0.000000 : 1.000000 : 2.000000 : 3.000000 : 4.000000 : 5.000000 : 6.000000 : 7.000000 : 8.000000 : 9.000000 : 10.000000 : 11.000000 : 12.000000 : 13.000000 : 14.000000 : 15.000000 : 16.000000 : 17.000000 : 18.000000 : 19.000000 : 20.000000 : 21.000000 : 22.000000 : 23.000000 : 24.000000 : 25.000000 : 26.000000 : 27.000000 : 28.000000 : 29.000000 : 30.000000 : 31.000000 : 32.000000 : 33.000000 : 34.000000 : 35.000000 : 36.000000 : 37.000000 : 38.000000 : 39.000000 : 40.000000 : 41.000000 : 42.000000 : 43.000000 : 44.000000 : 45.000000 : 46.000000 : 47.000000 : 48.000000 : 49.000000 : 50.000000 : 51.000000 : 52.000000 : 53.000000 : 54.000000 : 55.000000 : 56.000000 : 57.000000 : 58.000000 : 59.000000 : 60.000000 : 61.000000 : 62.000000 : 63.000000 : 64.000000 : 65.000000 : 66.000000 : 67.000000 : 68.000000 : 69.000000 : 70.000000 : 71.000000 : 72.000000 : 73.000000 : 74.000000 : 75.000000 : 76.000000 : 77.000000 : 78.000000 : 79.000000 : 80.000000 : 81.000000 : 82.000000 : 83.000000 : 84.000000 : 85.000000 : 86.000000 : 87.000000 : 88.000000 : 89.000000 : 90.000000 : 91.000000 : 92.000000 : 93.000000 : 94.000000 : 95.000000 : 96.000000 : 97.000000 : 98.000000 : 99.000000 : 100.000000 : 101.000000 : 102.000000 : 103.000000 : 104.000000 : 105.000000 : 106.000000 : 107.000000 : 108.000000 : 109.000000 : 110.000000 : 111.000000 : 112.000000 : 113.000000 : 114.000000 : 115.000000 : 116.000000 : 117.000000 : 118.000000 : 119.000000 : 120.000000 : 121.000000 : 122.000000 : 123.000000 : 124.000000 : 125.000000 : 126.000000 : 127.000000 : 128.000000 : 129.000000 : 130.000000 : 131.000000 : 132.000000 : 133.000000 : 134.000000 : 135.000000 : 136.000000 : 137.000000 : 138.000000 : 139.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : 0.000000 : diff --git a/src/cwtest/cfg/test/ref/filesys/test_0/log.txt b/src/cwtest/cfg/test/ref/filesys/test_0/log.txt new file mode 100644 index 0000000..a0fb375 --- /dev/null +++ b/src/cwtest/cfg/test/ref/filesys/test_0/log.txt @@ -0,0 +1 @@ +: dir:../../../src/libcw: fn: cwFileSys: ext:cpp: fn: ../../../src/libcw/cwFileSys.cpp: ~/src/foo /home/kevin/src/foo \ No newline at end of file diff --git a/src/cwtest/cfg/test/ref/flow/demo_01_sine_file/log.txt b/src/cwtest/cfg/test/ref/flow/demo_01_sine_file/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_01_sine_file/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_02_mod_sine/log.txt b/src/cwtest/cfg/test/ref/flow/demo_02_mod_sine/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_02_mod_sine/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_03_presets/log.txt b/src/cwtest/cfg/test/ref/flow/demo_03_presets/log.txt new file mode 100644 index 0000000..29f35f7 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_03_presets/log.txt @@ -0,0 +1,3 @@ +info: : Activated preset:a +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_04_program/log.txt b/src/cwtest/cfg/test/ref/flow/demo_04_program/log.txt new file mode 100644 index 0000000..c8b2930 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_04_program/log.txt @@ -0,0 +1,12 @@ +: my : 0.000000 : count +info: : Entering runtime. +: my : 1.000000 : count +: my : 2.000000 : count +: my : 0.000000 : count +: my : 1.000000 : count +: my : 2.000000 : count +: my : 0.000000 : count +: my : 1.000000 : count +: my : 2.000000 : count +: my : 0.000000 : count +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_05_mult_inputs/log.txt b/src/cwtest/cfg/test/ref/flow/demo_05_mult_inputs/log.txt new file mode 100644 index 0000000..8ca3a12 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_05_mult_inputs/log.txt @@ -0,0 +1,12 @@ +: cnt : 0.000000 : add : 3.000000 : count +info: : Entering runtime. +: cnt : 1.000000 : add : 4.000000 : count +: cnt : 2.000000 : add : 5.000000 : count +: cnt : 0.000000 : add : 3.000000 : count +: cnt : 1.000000 : add : 4.000000 : count +: cnt : 2.000000 : add : 5.000000 : count +: cnt : 0.000000 : add : 3.000000 : count +: cnt : 1.000000 : add : 4.000000 : count +: cnt : 2.000000 : add : 5.000000 : count +: cnt : 0.000000 : add : 3.000000 : count +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_06_mult_conn/log.txt b/src/cwtest/cfg/test/ref/flow/demo_06_mult_conn/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_06_mult_conn/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_07_proc_suffix/log.txt b/src/cwtest/cfg/test/ref/flow/demo_07_proc_suffix/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_07_proc_suffix/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_08_mix/log.txt b/src/cwtest/cfg/test/ref/flow/demo_08_mix/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_08_mix/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/demo_09_simple_poly/log.txt b/src/cwtest/cfg/test/ref/flow/demo_09_simple_poly/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/demo_09_simple_poly/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_0/log.txt b/src/cwtest/cfg/test/ref/flow/test_0/log.txt new file mode 100644 index 0000000..3cf2b74 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_0/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_1/log.txt b/src/cwtest/cfg/test/ref/flow/test_1/log.txt new file mode 100644 index 0000000..0c97ce6 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_1/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 1500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_10/log.txt b/src/cwtest/cfg/test/ref/flow/test_10/log.txt new file mode 100644 index 0000000..c9c1da3 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_10/log.txt @@ -0,0 +1,6 @@ +: cycle: 0 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:0 : +: cycle: 0 : add: 0: out: 0 vid: 0 ch: -1 : : : i:13 : +info: : Entering runtime. +: cycle: 750 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:1 : dst:add:0.in:2: +: cycle: 750 : add: 0: out: 0 vid: 0 ch: -1 : : : i:14 : +info: : 'maxCycleCnt' reached: 15000. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_11/log.txt b/src/cwtest/cfg/test/ref/flow/test_11/log.txt new file mode 100644 index 0000000..c2b43d7 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_11/log.txt @@ -0,0 +1,7 @@ +: cycle: 0 : a: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : a: 0: out: 0 vid: 2 ch: -1 : : : i:1 : +: cycle: 0 : b: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : b: 0: out: 0 vid: 2 ch: -1 : : : i:2 : +: cycle: 0 : add: 0: out: 0 vid: 0 ch: -1 : : : i:3 : +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 0. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_12/log.txt b/src/cwtest/cfg/test/ref/flow/test_12/log.txt new file mode 100644 index 0000000..3683f2b --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_12/log.txt @@ -0,0 +1,25 @@ +: cycle: 0 : a: 0: value: 0 vid: 0 ch: -1 : : : i:1 : +: cycle: 0 : b: 0: value: 0 vid: 0 ch: -1 : : : i:2 : +: cycle: 0 : add: 0: out: 0 vid: 0 ch: -1 : : : i:3 : dst:b:0.store:0: +info: : Entering runtime. +: cycle: 0 : b: 0: value: 0 vid: 0 ch: -1 : : : i:3 : dst:add:0.in:1: +: cycle: 0 : add: 0: out: 0 vid: 0 ch: -1 : : : i:4 : dst:b:0.store:0: +: cycle: 1 : b: 0: value: 0 vid: 0 ch: -1 : : : i:4 : dst:add:0.in:1: +: cycle: 1 : add: 0: out: 0 vid: 0 ch: -1 : : : i:5 : dst:b:0.store:0: +: cycle: 2 : b: 0: value: 0 vid: 0 ch: -1 : : : i:5 : dst:add:0.in:1: +: cycle: 2 : add: 0: out: 0 vid: 0 ch: -1 : : : i:6 : dst:b:0.store:0: +: cycle: 3 : b: 0: value: 0 vid: 0 ch: -1 : : : i:6 : dst:add:0.in:1: +: cycle: 3 : add: 0: out: 0 vid: 0 ch: -1 : : : i:7 : dst:b:0.store:0: +: cycle: 4 : b: 0: value: 0 vid: 0 ch: -1 : : : i:7 : dst:add:0.in:1: +: cycle: 4 : add: 0: out: 0 vid: 0 ch: -1 : : : i:8 : dst:b:0.store:0: +: cycle: 5 : b: 0: value: 0 vid: 0 ch: -1 : : : i:8 : dst:add:0.in:1: +: cycle: 5 : add: 0: out: 0 vid: 0 ch: -1 : : : i:9 : dst:b:0.store:0: +: cycle: 6 : b: 0: value: 0 vid: 0 ch: -1 : : : i:9 : dst:add:0.in:1: +: cycle: 6 : add: 0: out: 0 vid: 0 ch: -1 : : : i:10 : dst:b:0.store:0: +: cycle: 7 : b: 0: value: 0 vid: 0 ch: -1 : : : i:10 : dst:add:0.in:1: +: cycle: 7 : add: 0: out: 0 vid: 0 ch: -1 : : : i:11 : dst:b:0.store:0: +: cycle: 8 : b: 0: value: 0 vid: 0 ch: -1 : : : i:11 : dst:add:0.in:1: +: cycle: 8 : add: 0: out: 0 vid: 0 ch: -1 : : : i:12 : dst:b:0.store:0: +: cycle: 9 : b: 0: value: 0 vid: 0 ch: -1 : : : i:12 : dst:add:0.in:1: +: cycle: 9 : add: 0: out: 0 vid: 0 ch: -1 : : : i:13 : dst:b:0.store:0: +info: : 'maxCycleCnt' reached: 10. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_13/log.txt b/src/cwtest/cfg/test/ref/flow/test_13/log.txt new file mode 100644 index 0000000..d377aba --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_13/log.txt @@ -0,0 +1,21 @@ +: cycle: 0 : srate: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : srate: 0: out: 0 vid: 2 ch: -1 : : : f:48000.000000 : +: cycle: 0 : tmr: 0: srate: 0 vid: 0 ch: -1 : extern : : f:48000.000000 : src:srate:0.out:0: +: cycle: 0 : lfo: 0: srate: 0 vid: 0 ch: -1 : extern : : f:48000.000000 : src:srate:0.out:0: +: cycle: 0 : lfo: 0: hz: 0 vid: 2 ch: -1 : : : f:3.000000 : +: cycle: 0 : lfo: 0: dc: 0 vid: 4 ch: -1 : : : f:440.000000 : +info: : Entering runtime. +: cycle: 0 : lfo: 0: hz: 0 vid: 2 ch: -1 : : : f:1.000000 : +: cycle: 0 : lfo: 0: dc: 0 vid: 4 ch: -1 : : : f:880.000000 : +info: : Activated preset:a +: cycle: 1500 : lfo: 0: hz: 0 vid: 2 ch: -1 : : : f:2.000000 : +: cycle: 1500 : lfo: 0: dc: 0 vid: 4 ch: -1 : : : f:220.000000 : +info: : Activated preset:b +: cycle: 3000 : lfo: 0: hz: 0 vid: 2 ch: -1 : : : f:220.000000 : +info: : Activated preset:c +: cycle: 4500 : lfo: 0: hz: 0 vid: 2 ch: -1 : : : f:1.500000 : +: cycle: 4500 : lfo: 0: hz: 0 vid: 2 ch: -1 : : : f:1.500000 : +: cycle: 4500 : lfo: 0: dc: 0 vid: 4 ch: -1 : : : f:550.000000 : +: cycle: 4500 : lfo: 0: dc: 0 vid: 4 ch: -1 : : : f:550.000000 : +info: : Activated preset:d +info: : 'maxCycleCnt' reached: 15000. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_14/log.txt b/src/cwtest/cfg/test/ref/flow/test_14/log.txt new file mode 100644 index 0000000..bc62331 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_14/log.txt @@ -0,0 +1,7 @@ +: a : 0 : b : 0.000000 : c +info: : Entering runtime. +: a : 1 : b : 2.000000 : c +: a : 2 : b : 4.000000 : c +: a : 3 : b : 6.000000 : c +: a : 3 : b : 6.000000 : c +info: : 'maxCycleCnt' reached: 3750. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_2/log.txt b/src/cwtest/cfg/test/ref/flow/test_2/log.txt new file mode 100644 index 0000000..a88488c --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_2/log.txt @@ -0,0 +1,20 @@ +: cycle: 0 : srate: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : srate: 0: out: 0 vid: 2 ch: -1 : : : f:48000.000000 : +: cycle: 0 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : +: cycle: 0 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:0 : +: cycle: 0 : list: 0: out: 0 vid: 2 ch: -1 : : : a : +info: : Entering runtime. +: cycle: 750 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 750 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:1 : dst:list:0.in:0: +: cycle: 750 : list: 0: out: 0 vid: 2 ch: -1 : : : b : +: cycle: 1500 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 1500 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:2 : dst:list:0.in:0: +: cycle: 1500 : list: 0: out: 0 vid: 2 ch: -1 : : : c : +: cycle: 2250 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 3000 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 3750 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 4500 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 5250 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 6000 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 6750 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_3/log.txt b/src/cwtest/cfg/test/ref/flow/test_3/log.txt new file mode 100644 index 0000000..d227bb6 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_3/log.txt @@ -0,0 +1,24 @@ +: cycle: 0 : srate: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : srate: 0: out: 0 vid: 2 ch: -1 : : : f:48000.000000 : +: cycle: 0 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : +: cycle: 0 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:0 : +: cycle: 0 : x0v: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : x0v: 0: out: 0 vid: 2 ch: -1 : : : i:2 : +: cycle: 0 : x1v: 0: out: 0 vid: 2 ch: -1 : : : : +: cycle: 0 : x1v: 0: out: 0 vid: 2 ch: -1 : : : i:3 : +: cycle: 0 : add: 0: out: 0 vid: 0 ch: -1 : : : i:5 : +info: : Entering runtime. +: cycle: 750 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 750 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:1 : dst:add:0.in:2: +: cycle: 750 : add: 0: out: 0 vid: 0 ch: -1 : : : i:6 : +: cycle: 1500 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 1500 : cnt: 0: out: 0 vid: 12 ch: -1 : : : u:2 : dst:add:0.in:2: +: cycle: 1500 : add: 0: out: 0 vid: 0 ch: -1 : : : i:7 : +: cycle: 2250 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 3000 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 3750 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 4500 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 5250 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +: cycle: 6000 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:false : dst:cnt:0.trigger:0: +: cycle: 6750 : tmr: 0: out: 0 vid: 3 ch: -1 : : : b:true : dst:cnt:0.trigger:0: +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_4/log.txt b/src/cwtest/cfg/test/ref/flow/test_4/log.txt new file mode 100644 index 0000000..cffe1f4 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_4/log.txt @@ -0,0 +1,8 @@ +: cycle: 0 : srate: 0: in: 0 vid: 3 ch: -1 : : : f:48000.000000 : +: cycle: 0 : tmr: 0: srate: 0 vid: 0 ch: -1 : extern : : f:48000.000000 : src:srate:0.out:0: +: cycle: 0 : lfo: 0: srate: 0 vid: 0 ch: -1 : extern : : f:48000.000000 : src:srate:0.out:0: +info: : Entering runtime. +info: : Activated preset:a +info: : Activated preset:b +info: : Activated preset:c +info: : 'maxCycleCnt' reached: 15000. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_5/log.txt b/src/cwtest/cfg/test/ref/flow/test_5/log.txt new file mode 100644 index 0000000..dcc3e53 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_5/log.txt @@ -0,0 +1,8 @@ +: cycle: 0 : tmr: 0: srate: 0 vid: 0 ch: -1 : : : f:48000.000000 : +: cycle: 0 : lfo: 0: srate: 0 vid: 0 ch: -1 : : : f:0.000000 : +: cycle: 0 : osc: 0: srate: 0 vid: 0 ch: -1 : : : f:0.000000 : +info: : Entering runtime. +info: : Activated preset:a +info: : Activated preset:b +info: : Activated preset:c +info: : 'maxCycleCnt' reached: 15000. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_6/log.txt b/src/cwtest/cfg/test/ref/flow/test_6/log.txt new file mode 100644 index 0000000..d92b938 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_6/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_7/log.txt b/src/cwtest/cfg/test/ref/flow/test_7/log.txt new file mode 100644 index 0000000..7e7be2f --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_7/log.txt @@ -0,0 +1,12 @@ +: cycle: 0 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : a : src:list:0.out:0: +info: : Entering runtime. +info: : Activated preset:a +: cycle: 1500 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : b : src:list:0.out:0: +info: : Activated preset:b +: cycle: 3000 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : c : src:list:0.out:0: +info: : Activated preset:c +: cycle: 4500 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : b : src:list:0.out:0: +info: : Activated preset:b +: cycle: 6000 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : a : src:list:0.out:0: +info: : Activated preset:a +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_8/log.txt b/src/cwtest/cfg/test/ref/flow/test_8/log.txt new file mode 100644 index 0000000..7e7be2f --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_8/log.txt @@ -0,0 +1,12 @@ +: cycle: 0 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : a : src:list:0.out:0: +info: : Entering runtime. +info: : Activated preset:a +: cycle: 1500 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : b : src:list:0.out:0: +info: : Activated preset:b +: cycle: 3000 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : c : src:list:0.out:0: +info: : Activated preset:c +: cycle: 4500 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : b : src:list:0.out:0: +info: : Activated preset:b +: cycle: 6000 : xfade_ctl: 0: trigger: 0 vid: 4 ch: -1 : extern : : a : src:list:0.out:0: +info: : Activated preset:a +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/flow/test_9/log.txt b/src/cwtest/cfg/test/ref/flow/test_9/log.txt new file mode 100644 index 0000000..d92b938 --- /dev/null +++ b/src/cwtest/cfg/test/ref/flow/test_9/log.txt @@ -0,0 +1,2 @@ +info: : Entering runtime. +info: : 'maxCycleCnt' reached: 7500. Shutting down flow. diff --git a/src/cwtest/cfg/test/ref/lex/test_0/log.txt b/src/cwtest/cfg/test/ref/lex/test_0/log.txt new file mode 100644 index 0000000..327f65e --- /dev/null +++ b/src/cwtest/cfg/test/ref/lex/test_0/log.txt @@ -0,0 +1,32 @@ +info: : ln:1 col:1 tok: '123' len:3 +info: : Number: int:123 dbl:123.000000 unsigned:0 float:0 +info: : ln:1 col:4 tok: 'ident0' len:6 +info: : ln:1 col:10 tok: ' + ' len:2 +info: : ln:2 col:3 tok: '123.456' len:7 +info: : Number: int:123 dbl:123.456000 unsigned:0 float:0 +info: : ln:2 col:10 tok: ' +' len:1 +info: : ln:3 col:2 tok: 'ident0' len:6 +info: : ln:3 col:8 tok: ' +' len:1 +info: : ln:4 col:2 tok: '0xa12' len:5 +info: : Number: int:2578 dbl:2578.000000 unsigned:0 float:0 +info: : ln:4 col:7 tok:+ '+' len:1 +info: : ln:4 col:8 tok: '.2' len:2 +info: : Number: int:0 dbl:0.200000 unsigned:0 float:0 +info: : ln:4 col:10 tok: ' + ' len:24 +info: : ln:5 col:25 tok: '// comment +' len:12 +info: : ln:6 col:2 tok: '/* block +comment */' len:20 +info: : ln:7 col:12 tok: 'quoted string' len:13 +info: : ln:7 col:27 tok: 'ident1' len:6 +info: : ln:7 col:33 tok: ' ' len:1 +info: : ln:7 col:34 tok: '1234.56f' len:8 +info: : Number: int:1234 dbl:1234.560000 unsigned:0 float:1 +info: : ln:7 col:42 tok: '345u' len:4 +info: : Number: int:345 dbl:345.000000 unsigned:1 float:0 +info: : ln:7 col:46 tok: ' ' len:23 +info: : ln:7 col:69 tok: '// last line comment' len:20 diff --git a/src/cwtest/cfg/test/ref/mtx/test_0/log.txt b/src/cwtest/cfg/test/ref/mtx/test_0/log.txt new file mode 100644 index 0000000..85939c2 --- /dev/null +++ b/src/cwtest/cfg/test/ref/mtx/test_0/log.txt @@ -0,0 +1,69 @@ +: offset: 3 +: m0 :: 3 : 2 : +: 0 | : 0.000 : 3.000 : +: 1 | : 1.000 : 4.000 : +: 2 | : 2.000 : 5.000 : +: m1 :: 2 : 3 : +: 0 | : 0.000 : 1.000 : 2.000 : +: 1 | : 3.000 : 4.000 : 5.000 : +: m2 :: 3 : 2 : 2 : +: 0 +: 0 | : 0.000 : 1.000 : +: 1 | : 2.000 : 3.000 : +: 1 +: 0 | : 4.000 : 5.000 : +: 1 | : 6.000 : 7.000 : +: 2 +: 0 | : 8.000 : 9.000 : +: 1 | : 10.000 : 11.000 : +: m3 :: 3 : +: 0.000 : 1.000 : 2.000 : +: m4 :: 3 : 2 : +: 0 | : 10.000 : 13.000 : +: 1 | : 11.000 : 14.000 : +: 2 | : 12.000 : 15.000 : +: y0 :: 2 : 2 : +: 0 | : 5.000 : 14.000 : +: 1 | : 14.000 : 50.000 : +: y1 :: 3 : 3 : +: 0 | : 9.000 : 12.000 : 15.000 : +: 1 | : 12.000 : 17.000 : 22.000 : +: 2 | : 15.000 : 22.000 : 29.000 : +: y0 :: 2 : 2 : +: 0 | : 5.000 : 14.000 : +: 1 | : 14.000 : 50.000 : +: y1 :: 3 : 3 : +: 0 | : 9.000 : 12.000 : 15.000 : +: 1 | : 12.000 : 17.000 : 22.000 : +: 2 | : 15.000 : 22.000 : 29.000 : +: m0 :: 3 : 2 : +: 0 | : 0.000 : 3.000 : +: 1 | : 1.000 : 4.000 : +: 2 | : 2.000 : 5.000 : +: y2 :: 6 : 2 : +: 0 | : 0.000 : 3.000 : +: 1 | : 1.000 : 4.000 : +: 2 | : 2.000 : 5.000 : +: 3 | : 10.000 : 13.000 : +: 4 | : 11.000 : 14.000 : +: 5 | : 12.000 : 15.000 : +: m0 :: 3 : 2 : +: 0 | : 0.000 : 3.000 : +: 1 | : 1.000 : 4.000 : +: 2 | : 2.000 : 5.000 : +: m4 :: 3 : 2 : +: 0 | : 10.000 : 13.000 : +: 1 | : 11.000 : 14.000 : +: 2 | : 12.000 : 15.000 : +: y3 :: 3 : 4 : +: 0 | : 0.000 : 3.000 : 10.000 : 13.000 : +: 1 | : 1.000 : 4.000 : 11.000 : 14.000 : +: 2 | : 2.000 : 5.000 : 12.000 : 15.000 : +: y4 - slice :: 1 : 4 : +: 0 | : 0.000 : 3.000 : 10.000 : 13.000 : +: y4 - mod :: 1 : 4 : +: 0 | : 0.000 : 2.000 : 10.000 : 13.000 : +: y5 -(one_hot(y4)) :: 3 : 4 : +: 0 | : 1.000 : 0.000 : 0.000 : 0.000 : +: 1 | : 0.000 : 1.000 : 1.000 : 0.000 : +: 2 | : 0.000 : 0.000 : 0.000 : 1.000 : diff --git a/src/cwtest/cfg/test/ref/object/basic/log.txt b/src/cwtest/cfg/test/ref/object/basic/log.txt new file mode 100644 index 0000000..c48959e --- /dev/null +++ b/src/cwtest/cfg/test/ref/object/basic/log.txt @@ -0,0 +1,19 @@ +: value:2 +: { +: : : : a: : : 1: , +: : : : b: : : 2: , +: : : : c: : : [: : : : : : 1.230000: ,: : : : : : 4.560000: : ]: , +: : : : d: : : true: , +: : : : e: : : false: , +: : : : f: : : true: , +: }: G: 1 2 +: R: 1 2 : 1 0 1 +: 91 : { "a" : 1, "b" : 2, "c" : [ 1.230000, 4.560000 ] , "d" : true, "e" : false, "f" : true } +: { +: : : : a: : : 1: , +: : : : b: : : 2: , +: : : : c: : : [: : : : : : 1.230000: ,: : : : : : 4.560000: : ]: , +: : : : d: : : true: , +: : : : e: : : false: , +: : : : f: : : true: , +: } \ No newline at end of file diff --git a/src/cwtest/cfg/test/ref/object/to_json/log.txt b/src/cwtest/cfg/test/ref/object/to_json/log.txt new file mode 100644 index 0000000..1201539 --- /dev/null +++ b/src/cwtest/cfg/test/ref/object/to_json/log.txt @@ -0,0 +1 @@ +: { "A" : "Abc", "B" : 1.234000, "v0" : [ 1.230000, 2.340000, 3.450000 ] , "v1" : [ -1, 0, 1, 2, 3, 4 ] } diff --git a/src/cwtest/cfg/test/ref/textBuf/test_0/log.txt b/src/cwtest/cfg/test/ref/textBuf/test_0/log.txt new file mode 100644 index 0000000..f7c45f1 --- /dev/null +++ b/src/cwtest/cfg/test/ref/textBuf/test_0/log.txt @@ -0,0 +1,2 @@ +: Hello +foo diff --git a/src/cwtest/cfg/test/ref/time/test_0/log.txt b/src/cwtest/cfg/test/ref/time/test_0/log.txt new file mode 100644 index 0000000..40e15a6 --- /dev/null +++ b/src/cwtest/cfg/test/ref/time/test_0/log.txt @@ -0,0 +1,6 @@ +: dMs:1000 : GTE:0 LTE:1 +: 2 500000000 +: 1 750000000 +: 1 250000000 +: usec:5000 +: sleep 1000 ms diff --git a/src/cwtest/cfg/test/ref/vop/test_0/log.txt b/src/cwtest/cfg/test/ref/vop/test_0/log.txt new file mode 100644 index 0000000..21138c9 --- /dev/null +++ b/src/cwtest/cfg/test/ref/vop/test_0/log.txt @@ -0,0 +1 @@ +: 1 : 1 : 1 : 1 : 1 : 2 : 2 : 2 : 2 : 2 : From 3159bda77a3e1775d81ba8fcee56f70af0824614 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 16 Jul 2024 17:23:07 -0400 Subject: [PATCH 12/24] cfg/main.cfg : Updates and additions to 'test' sub-cfg. --- src/cwtest/cfg/main.cfg | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 3c0e979..2d06063 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -32,10 +32,13 @@ // 3. Command line args: // | 'all' (required) The module path always begins with a '/'. // | 'all' (required) - // 'gen_report' Print modulue/tes label. + // 'gen_report' Print modulue/test label. // 'compare' Run compare pass. // 'echo' Print the generated test output to the console. // 'args' All command line args after 'args' are passed to the tests. + // 4. Example command lines: + // r ~/src/cwtest/src/cwtest/cfg/main.cfg test /lex test_0 compare + // r ~/src/cwtest/src/cwtest/cfg/main.cfg test /flow test_0 compare test: { module_args: {} @@ -61,6 +64,9 @@ } }, flow:"flow_test.cfg", + wt_bank: { test_0: { + wtb_cfg_fname:"/home/kevin/temp/wt1/bank", + }} } }}, @@ -662,6 +668,8 @@ }, + lazy: {}, + svg: { desc:"Create an SVG/HTML test file.", From 2341c405dd11ed7a31b271e4115da71b4e050f61 Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 2 Aug 2024 13:42:44 -0400 Subject: [PATCH 13/24] Added audio_transform and wt_note tests. --- src/cwtest/cfg/main.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 2d06063..2460bc0 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -67,6 +67,8 @@ wt_bank: { test_0: { wtb_cfg_fname:"/home/kevin/temp/wt1/bank", }} + audio_transform: { wnd_func:{}, ola:{}, shift_buf:{}, wt_osc:{}, wt_seq_osc:{}, multi_ch_wt_seq_osc:{} }, + wt_note: { test_0:{} } } }}, From 8fa6a49056749e915da3c8ea241e08ad8b550928 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 Sep 2024 14:56:36 -0400 Subject: [PATCH 14/24] Makefile.am : Remove Atlas dependency. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 5706035..3149fe8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -84,7 +84,7 @@ if cwWEBSOCK src_cwtest_cwtest_LDADD += -lwebsockets endif -src_cwtest_cwtest_LDADD += -lsatlas +# src_cwtest_cwtest_LDADD += -lsatlas # src_cwtest_cwtest_CPPFLAGS = -I$(srcdir)/src/libcw $(AM_CPPFLAGS) bin_PROGRAMS += src/cwtest/cwtest From 1a634c2ecc2cd8638dbe26f057b26f489f59d638 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 Sep 2024 14:56:58 -0400 Subject: [PATCH 15/24] main.cfg : Added thread_tasks to test. --- src/cwtest/cfg/main.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 2460bc0..6efe08c 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -68,7 +68,8 @@ wtb_cfg_fname:"/home/kevin/temp/wt1/bank", }} audio_transform: { wnd_func:{}, ola:{}, shift_buf:{}, wt_osc:{}, wt_seq_osc:{}, multi_ch_wt_seq_osc:{} }, - wt_note: { test_0:{} } + wt_note: { test_0:{} }, + thread_tasks: { test_0:{} }, } }}, From 632d251faafcb8884f69855f39637e23415903c2 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 15 Sep 2024 15:00:55 -0400 Subject: [PATCH 16/24] main.cpp : Remove audio_transform test case because it has been moved to cwTest --- src/cwtest/cfg/main.cfg | 2 -- src/cwtest/main.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 6efe08c..b023ce6 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -1068,8 +1068,6 @@ }, - audio_transforms: {}, - // Convert the the 'am' files in 'inDir' to MIDI and CSV files // named 'midi.mid' and 'midi.csv'. // The 'beg_loc' and 'end_loc' will be written to a file named 'meta.cfg'. diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 8092e7a..a66eef3 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -343,7 +343,6 @@ cw::rc_t ifftTest( const cw::object_t* cfg, const cw::object_t* args cw::rc_t convolveTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dsp::convolve::test(); } cw::rc_t pianoScoreTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::perf_score::test(args); } cw::rc_t gutimRegTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::gutim::reg::test(args); } -cw::rc_t audioTransformsTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::dsp::test(args); } cw::rc_t amToMidiFile( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::midi_record_play::am_to_midi_file(args); } cw::rc_t audioFileProc( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::file_processor(args); } cw::rc_t pvocFileProc( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::afop::pvoc_file_processor(args); } @@ -729,7 +728,6 @@ int main( int argc, const char* argv[] ) { "convolve", convolveTest }, { "piano_score", pianoScoreTest }, { "gutim_reg", gutimRegTest }, - { "audio_transforms", audioTransformsTest }, { "am_to_midi_file", amToMidiFile }, { "audio_file_proc", audioFileProc }, { "pvoc_file_proc", pvocFileProc }, From 3a13fe13c46357d518f7c71451f714f02c00039d Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 29 Nov 2024 14:29:01 -0500 Subject: [PATCH 17/24] main.cpp,cfg/main.cfg : MOve cwTest cfg. to cfg/test/main.cfg. Move numbCvt test to cwTest. Update 'midiDevice' test in main.cfg. --- src/cwtest/cfg/main.cfg | 74 ++++++----------------------------------- src/cwtest/main.cpp | 19 ----------- 2 files changed, 10 insertions(+), 83 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index b023ce6..37fac53 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -14,70 +14,9 @@ test: { - test: { - base_dir: "~/src/cwtest/src/cwtest/cfg/test", - - resource_dir:"rsrc", - output_dir:"cur", - ref_dir:"ref", - - - // Notes: - // 1. The test spec. is recursive. Modules can be listed - // inside of modules. (e.g. 'lex' and 'flow'). - // 2. If a module spec. does not have an embedded - // 'module' or 'module_args' then the cases may - // be listed without a 'cases' label. - // (e.g. 'filesys','object', 'vop') - // 3. Command line args: - // | 'all' (required) The module path always begins with a '/'. - // | 'all' (required) - // 'gen_report' Print modulue/test label. - // 'compare' Run compare pass. - // 'echo' Print the generated test output to the console. - // 'args' All command line args after 'args' are passed to the tests. - // 4. Example command lines: - // r ~/src/cwtest/src/cwtest/cfg/main.cfg test /lex test_0 compare - // r ~/src/cwtest/src/cwtest/cfg/main.cfg test /flow test_0 compare - test: { - module_args: {} - - modules: { - lex:{ module_args:{}, cases: { test_0:{} } }, - filesys:{ test_0:{}}, - object:{ basic:{}, to_json:{} }, - vop:{ test_0:{} }, - time:{ test_0:{} }, - textBuf: { test_0:{} }, - audioBuf:{ test_0:{} } - mtx:{ test_0: { - m0: [ [0,3], [1,4], [2,5] ], - m1: [ [0,1,2],[3,4,5] ], - - m2: [ [[0,1],[2,3]], [[4,5],[6,7]], [[8,9],[10,11]] ], - m3: [ 0,1,2 ], - - m4: [ [10,13], [11,14], [12,15] ], - - y0: [ [5,14],[14,50] ], - y1: [ [9,12,15],[12,17,22],[15,22,29] ], - } }, - - flow:"flow_test.cfg", - wt_bank: { test_0: { - wtb_cfg_fname:"/home/kevin/temp/wt1/bank", - }} - audio_transform: { wnd_func:{}, ola:{}, shift_buf:{}, wt_osc:{}, wt_seq_osc:{}, multi_ch_wt_seq_osc:{} }, - wt_note: { test_0:{} }, - thread_tasks: { test_0:{} }, - } - }}, - - variadicTpl: {}, - numbCvt: {}, thread: {}, kbTest1: {}, kbTest2: {}, @@ -101,15 +40,22 @@ serialSrv: {}, midiDeviceReport: {}, - + + // Test the MIDI file input device. See cwMidiDeviceTest.cpp + // Compares the time between MIDI events in a file to the time between + // the same events from the file device. midiDevice: { appNameStr: "test_app", fileDevName: "file_dev", fileDevReadAheadMicros: 3000, parseBufByteCnt: 1024, - testFileLabel: "file_0", + enableBufFl:true, + bufferMsgCnt:4096, + filterRtSenseFl:true + + testFileLabel: "file_0", // testFileEnableFl: true, - + file_ports: [ { "label":"file_0", diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index a66eef3..315f129 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -298,24 +298,6 @@ cw::rc_t variadicTplTest( const cw::object_t* cfg, const cw::object_t* args, int return cw::kOkRC; } -cw::rc_t numbCvtTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) -{ - int8_t x0 = 3; - int x1 = 127; - - cw::numeric_convert( x1, x0 ); - cwLogPrint("%i %i\n",x0,x1); - - - int v0 = -1; - double v1 = -1; - cw::string_to_number("123",v0); - cw::string_to_number("3.4",v1); - cwLogPrint("%i %f\n",v0,v1 ); - - return cw::kOkRC; -} - cw::rc_t testTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::test::test(args,argc,argv); } cw::rc_t threadTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::threadTest(); } @@ -674,7 +656,6 @@ int main( int argc, const char* argv[] ) { { "variadicTpl", variadicTplTest }, { "test", testTest }, - { "numbCvt", numbCvtTest }, { "thread", threadTest }, { "kbTest1", kbTest1Test }, { "kbTest2", kbTest2Test }, From db8dbbe40093d7ec1e0e1ee9ebf22edc9c3973f2 Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 29 Nov 2024 17:05:06 -0500 Subject: [PATCH 18/24] main.cpp : Remove non-existent midiFileDevTest() and fix bug in call to websockSrvTest(). --- src/cwtest/main.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/cwtest/main.cpp b/src/cwtest/main.cpp index 315f129..1a53d51 100644 --- a/src/cwtest/main.cpp +++ b/src/cwtest/main.cpp @@ -339,7 +339,7 @@ cw::rc_t csvTest( const cw::object_t* cfg, const cw::object_t* args, cw::rc_t scoreTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::score_test::test(args); } cw::rc_t translateFrags( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::preset_sel::translate_frags(args); } #if defined(cwWEBSOCK) -cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::websockSrvTest(cfg); } +cw::rc_t websockSrvTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::websockSrvTest(args); } cw::rc_t uiTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::ui::test(args); } #if defined(cwALSA) cw::rc_t ioTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::io::test(args); } @@ -370,7 +370,6 @@ cw::rc_t ioPresetSelTest( const cw::object_t* cfg, const cw::object_t* args, i #if defined(cwALSA) cw::rc_t midiDeviceReport( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::midi::device::testReport();} cw::rc_t midiDeviceTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::midi::device::test(args);} -cw::rc_t midiFileDevTest( const cw::object_t* cfg, const cw::object_t* args, int argc, const char* argv[] ) { return cw::midi::device::file_dev::test( args );} 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(); } @@ -379,7 +378,6 @@ cw::rc_t audioDevRpt( const cw::object_t* cfg, const cw::object_t* args cw::rc_t _no_alsa() { return cwLogError(cw::kResourceNotAvailableRC,"ALSA based functionality not included in this build."); } cw::rc_t midiDeviceReport( 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 midiFileDevTest( 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(); } @@ -667,7 +665,6 @@ int main( int argc, const char* argv[] ) { "serialSrv", serialPortSrvTest }, { "midiDeviceReport", midiDeviceReport }, { "midiDevice", midiDeviceTest }, - { "midiFileDev", midiFileDevTest }, { "audioDevFileTest", audioDevFileTest }, { "audioDevTest",audioDevTest }, { "audioDevTone", audioDevTestTone }, From 30721b074681d67697867f428840c5c039d22adb Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 29 Nov 2024 17:06:09 -0500 Subject: [PATCH 19/24] cfg/main.cfg : Remove dead code, and update websockSrv tester to use cfg. provided parameters rather than hard coded values. --- src/cwtest/cfg/main.cfg | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/src/cwtest/cfg/main.cfg b/src/cwtest/cfg/main.cfg index 37fac53..01d896e 100644 --- a/src/cwtest/cfg/main.cfg +++ b/src/cwtest/cfg/main.cfg @@ -34,8 +34,15 @@ } websockSrv: { - physRootDir: "~/src/cwtest/src/libcw/html/websockSrvTest", - dfltHtmlPageFn: "test_websocket.html", + + physRootDir: "~/src/cwtest/src/libcw/html/websockSrvTest", // path to 'dfltHtmlPageFn' + dfltHtmlPageFn: "test_websocket.html", // websockets enabled HTML/JS app + port: 5687, // websocket port + rcvBufByteN: 128, // incoming msg's larger than this will be broken into multiple parts + xmtBufByteN: 128, // outgoing msg's larger than this will be broken into multiple parts + queueBlkCnt: 3, // count of memory blocks in the non-blocking queue (See: cwNbMpScQueue) + queueBlkByteCnt: 4096, // size of each non-blocking memory block + timeOutMs: 50, // milliseconds to block waiting for incoming websock messages }, serialSrv: {}, @@ -68,35 +75,7 @@ ] }, - /* - midiSource: { - fname: "~/temp/test.mid", - src: { - ticks_per_quarter: 480, - noteL: [ - { tempo : 120 }, - { bar: 1 } - { meter: [ 4, 4 ] }, - { voiceL: [ [ - { b : [ Cs3, mf ] }, // 1st beat : qtr note - { b : [ [E1 B3] , p ] }, // 2nd beat : two 8ths at p - { b : [ [E2 [A1 B2]] , mf ] }, // 3rd beat : 8th and two 16ths - { b : [ [E3 [A1 [B2 p]]] , mf ] }, // 4th beat : 8th and two 16ths w/ dyn - { b : [ [E4 [R r.]] - ]] - { bar: 2 } - ] - } - }, - */ - midiFileDev: { - fname: "/home/kevin/src/cwtest/src/cwtest/cfg/gutim_full/data1/beck2/record_5/midi.mid" - }, - - //textBuf: {}, - //audioBuf: {}, - //audioDev: {}, audioDevAlsa: {}, audioDevRpt: {}, // print a list of audio device From 20bc84c856a3b54e4c91dbab832966fe0da3fba8 Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 29 Nov 2024 17:06:48 -0500 Subject: [PATCH 20/24] README.md : Updates to document utilities and tests provided by main.cpp/main.cfg. --- README.md | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 156 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d3c8e03..06bbbc7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,159 @@ -libcw Testing and Development App +# libcw Testing and Development App + +Command line: +``` +cwtest