From b4c0bc5a8a2feff6fc99e0b77a813ec76300e1e1 Mon Sep 17 00:00:00 2001 From: FrancoisGrondin Date: Tue, 3 Oct 2017 12:58:53 -0400 Subject: [PATCH] Cleaning the configurations and parameters architecture --- CMakeLists.txt | 26 - README.md | 22 +- config/respeaker.cfg | 85 +- config/respeaker.ios | 41 - config/xmos.cfg | 87 +- config/xmos.ios | 42 - demo/configs.c | 178 +--- demo/configs.h | 55 +- demo/debug.c | 13 - demo/main.c | 25 +- demo/objects.c | 1737 +++++------------------------------- demo/objects.h | 150 +--- demo/parameters.c | 1346 ++-------------------------- demo/parameters.h | 88 +- demo/profiler.c | 122 +-- demo/profiler.h | 37 +- demo/threads.c | 741 +-------------- include/odas/odas.h | 8 - src/aconnector/acon_envs.c | 85 -- src/aconnector/acon_envs.h | 27 - src/amessage/amsg_envs.c | 64 -- src/amessage/amsg_envs.h | 29 - src/amodule/amod_sspf.c | 83 -- src/amodule/amod_sspf.h | 31 - src/amodule/amod_sss.c | 24 +- src/amodule/amod_sss.h | 7 +- src/asink/asnk_xcorrs.c | 70 -- src/asink/asnk_xcorrs.h | 28 - src/asource/asrc_spectra.c | 81 -- src/asource/asrc_spectra.h | 28 - src/connector/con_envs.c | 57 -- src/connector/con_envs.h | 24 - src/general/format.c | 42 +- src/general/format.h | 18 +- src/general/interface.c | 90 ++ src/general/interface.h | 11 +- src/message/msg_envs.c | 91 -- src/message/msg_envs.h | 40 - src/message/msg_hops.c | 2 +- src/message/msg_xcorrs.c | 91 -- src/message/msg_xcorrs.h | 40 - src/module/mod_ssl.c | 4 - src/module/mod_sspf.c | 113 --- src/module/mod_sspf.h | 60 -- src/module/mod_sss.c | 188 +--- src/module/mod_sss.h | 65 +- src/signal/env.c | 100 --- src/signal/env.h | 28 - src/sink/snk_hops.c | 57 +- src/sink/snk_hops.h | 2 + src/sink/snk_pots.c | 117 ++- src/sink/snk_pots.h | 4 + src/sink/snk_spectra.c | 4 +- src/sink/snk_tracks.c | 53 +- src/sink/snk_tracks.h | 2 + src/sink/snk_xcorrs.c | 218 ----- src/sink/snk_xcorrs.h | 59 -- src/source/src_hops.c | 35 +- src/source/src_hops.h | 1 - src/source/src_pots.c | 200 ----- src/source/src_pots.h | 64 -- src/source/src_spectra.c | 207 ----- src/source/src_spectra.h | 66 -- src/source/src_tracks.c | 199 ----- src/source/src_tracks.h | 64 -- src/source/src_xcorrs.c | 101 --- src/source/src_xcorrs.h | 66 -- src/system/freq2env.c | 47 - src/system/freq2env.h | 23 - src/system/freq2freq.c | 39 - src/system/freq2freq.h | 3 - src/system/steer2env.c | 84 -- src/system/steer2env.h | 29 - 73 files changed, 1118 insertions(+), 7050 deletions(-) delete mode 100644 config/respeaker.ios delete mode 100644 config/xmos.ios delete mode 100644 demo/debug.c delete mode 100644 src/aconnector/acon_envs.c delete mode 100644 src/aconnector/acon_envs.h delete mode 100644 src/amessage/amsg_envs.c delete mode 100644 src/amessage/amsg_envs.h delete mode 100644 src/amodule/amod_sspf.c delete mode 100644 src/amodule/amod_sspf.h delete mode 100644 src/asink/asnk_xcorrs.c delete mode 100644 src/asink/asnk_xcorrs.h delete mode 100644 src/asource/asrc_spectra.c delete mode 100644 src/asource/asrc_spectra.h delete mode 100644 src/connector/con_envs.c delete mode 100644 src/connector/con_envs.h delete mode 100644 src/message/msg_envs.c delete mode 100644 src/message/msg_envs.h delete mode 100644 src/message/msg_xcorrs.c delete mode 100644 src/message/msg_xcorrs.h delete mode 100644 src/module/mod_sspf.c delete mode 100644 src/module/mod_sspf.h delete mode 100644 src/signal/env.c delete mode 100644 src/signal/env.h delete mode 100644 src/sink/snk_xcorrs.c delete mode 100644 src/sink/snk_xcorrs.h delete mode 100644 src/source/src_pots.c delete mode 100644 src/source/src_pots.h delete mode 100644 src/source/src_spectra.c delete mode 100644 src/source/src_spectra.h delete mode 100644 src/source/src_tracks.c delete mode 100644 src/source/src_tracks.h delete mode 100644 src/source/src_xcorrs.c delete mode 100644 src/source/src_xcorrs.h delete mode 100644 src/system/freq2env.c delete mode 100644 src/system/freq2env.h delete mode 100644 src/system/steer2env.c delete mode 100644 src/system/steer2env.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d1233d..82f6135 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,6 @@ set(SRC src/signal/beampattern.c src/signal/coherence.c src/signal/delta.c - src/signal/env.c src/signal/frame.c src/signal/freq.c src/signal/gain.c @@ -72,7 +71,6 @@ set(SRC src/system/hop2hop.c src/system/hop2frame.c src/system/frame2freq.c - src/system/freq2env.c src/system/freq2freq.c src/system/freq2frame.c src/system/freq2xcorr.c @@ -83,7 +81,6 @@ set(SRC src/system/mixture2mixture.c src/system/particle2coherence.c src/system/particle2particle.c - src/system/steer2env.c src/system/steer2freq.c src/system/track2gain.c src/system/track2steer.c @@ -97,12 +94,10 @@ set(SRC src/utils/pcm.c src/utils/random.c - src/aconnector/acon_envs.c src/aconnector/acon_hops.c src/aconnector/acon_pots.c src/aconnector/acon_spectra.c src/aconnector/acon_tracks.c - src/amessage/amsg_envs.c src/amessage/amsg_hops.c src/amessage/amsg_pots.c src/amessage/amsg_spectra.c @@ -112,7 +107,6 @@ set(SRC src/amodule/amod_mapping.c src/amodule/amod_resample.c src/amodule/amod_ssl.c - src/amodule/amod_sspf.c src/amodule/amod_sss.c src/amodule/amod_sst.c src/amodule/amod_stft.c @@ -121,25 +115,20 @@ set(SRC src/asink/asnk_spectra.c src/asink/asnk_tracks.c src/asource/asrc_hops.c - src/asource/asrc_spectra.c - src/connector/con_envs.c src/connector/con_hops.c src/connector/con_pots.c src/connector/con_spectra.c src/connector/con_tracks.c - src/message/msg_envs.c src/message/msg_hops.c src/message/msg_pots.c src/message/msg_spectra.c src/message/msg_tracks.c - src/message/msg_xcorrs.c src/module/mod_gain.c src/module/mod_istft.c src/module/mod_mapping.c src/module/mod_resample.c src/module/mod_ssl.c - src/module/mod_sspf.c src/module/mod_sss.c src/module/mod_sst.c src/module/mod_stft.c @@ -147,11 +136,7 @@ set(SRC src/sink/snk_pots.c src/sink/snk_spectra.c src/sink/snk_tracks.c - src/sink/snk_xcorrs.c src/source/src_hops.c - src/source/src_pots.c - src/source/src_spectra.c - src/source/src_tracks.c ) @@ -179,17 +164,6 @@ target_link_libraries(odascore odas ) -#add_executable(server -# demo/server.c -#) - -#add_executable(debug -# demo/debug.c -#) -#target_link_libraries(debug -# odas -#) - install(TARGETS odas DESTINATION lib) diff --git a/README.md b/README.md index 82fdb07..0d2f9f3 100644 --- a/README.md +++ b/README.md @@ -76,17 +76,20 @@ card 3: Array [ReSpeaker Microphone Array], device 0: USB Audio [USB Audio] Subdevice #0: subdevice #0 ``` -In this case, the soundcard ID is 3, and the device ID is 0. Open the file config/respeaker.ios, and set the soundcard ID and device ID: +In this case, the soundcard ID is 3, and the device ID is 0. Open the file config/respeaker.cfg, and set in the section "raw" the soundcard ID and device ID: ``` -#ReSpeaker Device, 16bits. -raw: { type = "soundcard"; card = 3; device = 0; format = "bin16"; } +interface: { + type = "soundcard"; + card = 3; + device = 0; +} ``` To run ODAS with ReSpeaker, and type in the following command: ``` -bin/odascore -c config/respeaker.cfg -i config/respeaker.ios +bin/odascore -c config/respeaker.cfg ``` You should get the following output: @@ -128,17 +131,20 @@ card 3: UAC20 [XMOS Microphone Array UAC2.0], device 0: USB Audio [USB Audio] Subdevice #0: subdevice #0 ``` -In this case, the soundcard ID is 3, and the device ID is 0. Open the file config/xmos.ios, and set the soundcard ID and device ID: +In this case, the soundcard ID is 3, and the device ID is 0. Open the file config/xmos.cfg, and set in the section "raw" the soundcard ID and device ID: ``` -#XMOS Device, 32bits. -raw: { type = "soundcard"; card = 3; device = 0; format = "bin32"; } +interface: { + type = "soundcard"; + card = 3; + device = 0; +} ``` To run ODAS with XMOS, and type in the following command: ``` -bin/odascore -c config/xmos.cfg -i config/xmos.ios +bin/odascore -c config/xmos.cfg ``` You should get the following output: diff --git a/config/respeaker.cfg b/config/respeaker.cfg index adfbb99..e133fc4 100644 --- a/config/respeaker.cfg +++ b/config/respeaker.cfg @@ -1,8 +1,6 @@ # Configuration file for ReSpeaker circular sound card -version = "2.0"; -author = "François Grondin"; -date = "21/09/2017" +version = "2.1"; # Raw @@ -11,7 +9,15 @@ raw: fS = 16000; hopSize = 128; - nChannels = 8; + nBits = 16; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "soundcard"; + card = 3; + device = 0; + } } @@ -19,7 +25,7 @@ raw: mapping: { - + map: (1, 2, 3, 4, 5, 6, 7); } @@ -118,6 +124,9 @@ general: }; + nThetas = 181; + gainMin = 0.25; + }; # Sound Source Localization @@ -129,9 +138,7 @@ ssl: nMatches = 10; probMin = 0.5; nRefinedLevels = 1; - gainMin = 0.25; - nThetas = 181; - interpRate = 4; + interpRate = 1; # Number of scans: level is the resolution of the sphere # and delta is the size of the maximum sliding window @@ -141,6 +148,17 @@ ssl: { level = 4; delta = -1; } ); + # Output to export potential sources + potential: { + + format = "json"; + + interface: { + type = "blackhole"; + }; + + }; + }; # Sound Source Tracking @@ -155,7 +173,7 @@ sst: # Parameters used by both the Kalman and particle filter active = ( - { weight = 1.0; mu = 0.5; sigma2 = 0.0025 } + { weight = 1.0; mu = 0.3; sigma2 = 0.0025 } ); inactive = ( @@ -180,7 +198,7 @@ sst: sigmaQ = 0.001; - } + }; # Parameters used by the particle filter only @@ -198,6 +216,51 @@ sst: ac_ratio = 0.2; Nmin = 0.7; - } + }; + + # Output to export tracked sources + tracked: { + + format = "json"; + + interface: { + type = "blackhole"; + }; + + }; + +} + +sss: +{ + + # Mode is either "ds", "gss" or "mvdr" + + mode = "ds"; + + ds: { + + }; + + gss: { + + }; + + mvdr: { + + }; + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + } + + }; } diff --git a/config/respeaker.ios b/config/respeaker.ios deleted file mode 100644 index 2227497..0000000 --- a/config/respeaker.ios +++ /dev/null @@ -1,41 +0,0 @@ -# Input - -input: -{ - - #ReSpeaker Device, 16bits. - raw: { type = "soundcard"; card = 3; device = 0; format = "bin16"; } - -}; - -# Output: - -output: -{ - - # No raw output for now... - raw: (); - - # For debug purpose, leave empty. - mapping: (); - resample: (); - stft: (); - - # Sound Source Localization Results - ssl: (); - - # Sound Source Tracking Results - sst: - ( - { type = "terminal"; format = "json"; } - ); - - # For debug purpose, leave empty. - sss: (); - sspf: (); - istft: (); - - # Separated signal, for now leave empty. - playback: (); - -} diff --git a/config/xmos.cfg b/config/xmos.cfg index c7067be..a218908 100644 --- a/config/xmos.cfg +++ b/config/xmos.cfg @@ -1,6 +1,6 @@ # Configuration file for XMOS circular sound card -version = "2.0"; +version = "2.1"; # Raw @@ -9,7 +9,14 @@ raw: fS = 44100; hopSize = 512; - nChannels = 8; + nBits = 32; + nChannels = 8; + + # Input with raw signal from microphones + interface: { + type = "file"; + path = "input.raw"; + } } @@ -17,7 +24,7 @@ raw: mapping: { - + map: (1, 2, 3, 4, 5, 6, 7); } @@ -116,6 +123,9 @@ general: }; + nThetas = 181; + gainMin = 0.25; + }; # Sound Source Localization @@ -127,8 +137,6 @@ ssl: nMatches = 10; probMin = 0.5; nRefinedLevels = 1; - gainMin = 0.25; - nThetas = 181; interpRate = 1; # Number of scans: level is the resolution of the sphere @@ -139,6 +147,17 @@ ssl: { level = 4; delta = -1; } ); + # Output to export potential sources + potential: { + + format = "json"; + + interface: { + type = "blackhole"; + }; + + }; + }; # Sound Source Tracking @@ -178,7 +197,7 @@ sst: sigmaQ = 0.001; - } + }; # Parameters used by the particle filter only @@ -196,33 +215,51 @@ sst: ac_ratio = 0.2; Nmin = 0.7; - } + }; -} + # Output to export tracked sources + tracked: { -# Sound source separation + format = "json"; -sss: { - - nThetas = 181; - gainMin = 0.01; + interface: { + type = "blackhole"; + }; -} + }; -# Sound source post-filtering +} -sspf: { +sss: +{ - alpha = 10.0; - beta = 0.95; - Ginterf = 0.01; + # Mode is either "ds", "gss" or "mvdr" -} + mode = "ds"; -# Playback of separated streams + ds: { -playback: { - - volume = 10.0; + }; + + gss: { + + }; -} \ No newline at end of file + mvdr: { + + }; + + separated: { + + fS = 44100; + hopSize = 512; + nBits = 16; + + interface: { + type = "file"; + path = "separated.raw"; + } + + }; + +} diff --git a/config/xmos.ios b/config/xmos.ios deleted file mode 100644 index 10edbe0..0000000 --- a/config/xmos.ios +++ /dev/null @@ -1,42 +0,0 @@ -# Input - -input: -{ - - #XMOS Device, 32bits. - raw: { type = "soundcard"; card = 3; device = 0; format = "bin32"; } - -}; - -# Output: - -output: -{ - - # No raw output for now... - raw: (); - - # For debug purpose, leave empty. - mapping: (); - resample: (); - stft: (); - - # Sound Source Localization Results - ssl: (); - - # Sound Source Tracking Results - sst: - ( - { type = "terminal"; format = "json"; } - ); - - # For debug purpose, leave empty. - sss: (); - sspf: (); - istft: (); - - # Separated signal, for now leave empty. - playback: (); - -} - diff --git a/demo/configs.c b/demo/configs.c index dfe67ca..7b6ec7c 100644 --- a/demo/configs.c +++ b/demo/configs.c @@ -1,7 +1,7 @@ #include "configs.h" - configs * configs_construct(const char * file_config, const char * file_ios) { + configs * configs_construct(const char * file_config) { configs * cfgs; unsigned int iSink; @@ -16,26 +16,13 @@ // | Source | // +------------------------------------------------------+ - cfgs->src_hops_raw_config = parameters_src_hops_raw_config(file_config, file_ios); + cfgs->src_hops_mics_config = parameters_src_hops_mics_config(file_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - cfgs->msg_hops_raw_config = parameters_msg_hops_raw_config(file_config, file_ios); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - cfgs->snk_hops_raw_config_count = parameters_snk_hops_raw_count(file_config, file_ios); - cfgs->snk_hops_raw_configs = (snk_hops_cfg **) malloc(sizeof(snk_hops_cfg *) * cfgs->snk_hops_raw_config_count); - - for (iSink = 0; iSink < cfgs->snk_hops_raw_config_count; iSink++) { - - cfgs->snk_hops_raw_configs[iSink] = parameters_snk_hops_raw_config(file_config, file_ios, iSink); - - } + cfgs->msg_hops_mics_raw_config = parameters_msg_hops_mics_raw_config(file_config); // +----------------------------------------------------------+ // | Mapping | @@ -45,26 +32,14 @@ // | Module | // +------------------------------------------------------+ - cfgs->mod_mapping_config = parameters_mod_mapping_config(file_config, file_ios); + cfgs->mod_mapping_mics_config = parameters_mod_mapping_mics_config(file_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - cfgs->msg_hops_mapping_config = parameters_msg_hops_mapping_config(file_config, file_ios); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - cfgs->snk_hops_mapping_config_count = parameters_snk_hops_mapping_count(file_config, file_ios); - cfgs->snk_hops_mapping_configs = (snk_hops_cfg **) malloc(sizeof(snk_hops_cfg *) * cfgs->snk_hops_mapping_config_count); - - for (iSink = 0; iSink < cfgs->snk_hops_mapping_config_count; iSink++) { + cfgs->msg_hops_mics_map_config = parameters_msg_hops_mics_map_config(file_config); - cfgs->snk_hops_mapping_configs[iSink] = parameters_snk_hops_mapping_config(file_config, file_ios, iSink); - - } // +----------------------------------------------------------+ // | Resample | @@ -74,26 +49,13 @@ // | Module | // +------------------------------------------------------+ - cfgs->mod_resample_config = parameters_mod_resample_config(file_config, file_ios); + cfgs->mod_resample_mics_config = parameters_mod_resample_mics_config(file_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - cfgs->msg_hops_resample_config = parameters_msg_hops_resample_config(file_config, file_ios); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - cfgs->snk_hops_resample_config_count = parameters_snk_hops_resample_count(file_config, file_ios); - cfgs->snk_hops_resample_configs = (snk_hops_cfg **) malloc(sizeof(snk_hops_cfg *) * cfgs->snk_hops_resample_config_count); - - for (iSink = 0; iSink < cfgs->snk_hops_resample_config_count; iSink++) { - - cfgs->snk_hops_resample_configs[iSink] = parameters_snk_hops_resample_config(file_config, file_ios, iSink); - - } + cfgs->msg_hops_mics_rs_config = parameters_msg_hops_mics_rs_config(file_config); // +----------------------------------------------------------+ // | STFT | @@ -103,26 +65,14 @@ // | Module | // +------------------------------------------------------+ - cfgs->mod_stft_config = parameters_mod_stft_config(file_config, file_ios); + cfgs->mod_stft_mics_config = parameters_mod_stft_mics_config(file_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - cfgs->msg_spectra_stft_config = parameters_msg_spectra_stft_config(file_config, file_ios); + cfgs->msg_spectra_mics_config = parameters_msg_spectra_mics_config(file_config); - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - cfgs->snk_spectra_stft_config_count = parameters_snk_spectra_stft_count(file_config, file_ios); - cfgs->snk_spectra_stft_configs = (snk_spectra_cfg **) malloc(sizeof(snk_spectra_cfg *) * cfgs->snk_spectra_stft_config_count); - - for (iSink = 0; iSink < cfgs->snk_spectra_stft_config_count; iSink++) { - - cfgs->snk_spectra_stft_configs[iSink] = parameters_snk_spectra_stft_config(file_config, file_ios, iSink); - - } // +----------------------------------------------------------+ // | SSL | @@ -132,26 +82,20 @@ // | Module | // +------------------------------------------------------+ - cfgs->mod_ssl_config = parameters_mod_ssl_config(file_config, file_ios); + cfgs->mod_ssl_config = parameters_mod_ssl_config(file_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - cfgs->msg_pots_ssl_config = parameters_msg_pots_ssl_config(file_config, file_ios); + cfgs->msg_pots_ssl_config = parameters_msg_pots_ssl_config(file_config); // +------------------------------------------------------+ // | Sinks | // +------------------------------------------------------+ - cfgs->snk_pots_ssl_config_count = parameters_snk_pots_ssl_count(file_config, file_ios); - cfgs->snk_pots_ssl_configs = (snk_pots_cfg **) malloc(sizeof(snk_pots_cfg *) * cfgs->snk_pots_ssl_config_count); + cfgs->snk_pots_ssl_config = parameters_snk_pots_ssl_config(file_config); - for (iSink = 0; iSink < cfgs->snk_pots_ssl_config_count; iSink++) { - - cfgs->snk_pots_ssl_configs[iSink] = parameters_snk_pots_ssl_config(file_config, file_ios, iSink); - - } // +----------------------------------------------------------+ // | SST | @@ -161,26 +105,20 @@ // | Module | // +------------------------------------------------------+ - cfgs->mod_sst_config = parameters_mod_sst_config(file_config, file_ios); + cfgs->mod_sst_config = parameters_mod_sst_config(file_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - cfgs->msg_tracks_sst_config = parameters_msg_tracks_sst_config(file_config, file_ios); + cfgs->msg_tracks_sst_config = parameters_msg_tracks_sst_config(file_config); // +------------------------------------------------------+ // | Sinks | // +------------------------------------------------------+ - cfgs->snk_tracks_sst_config_count = parameters_snk_tracks_sst_count(file_config, file_ios); - cfgs->snk_tracks_sst_configs = (snk_tracks_cfg **) malloc(sizeof(snk_tracks_cfg *) * cfgs->snk_tracks_sst_config_count); - - for (iSink = 0; iSink < cfgs->snk_tracks_sst_config_count; iSink++) { - - cfgs->snk_tracks_sst_configs[iSink] = parameters_snk_tracks_sst_config(file_config, file_ios, iSink); + cfgs->snk_tracks_sst_config = parameters_snk_tracks_sst_config(file_config); - } /* // +----------------------------------------------------------+ // | SSS | @@ -316,26 +254,14 @@ // | Source | // +------------------------------------------------------+ - src_hops_cfg_destroy(cfgs->src_hops_raw_config); + src_hops_cfg_destroy(cfgs->src_hops_mics_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - msg_hops_cfg_destroy(cfgs->msg_hops_raw_config); + msg_hops_cfg_destroy(cfgs->msg_hops_mics_raw_config); - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < cfgs->snk_hops_raw_config_count; iSink++) { - - snk_hops_cfg_destroy(cfgs->snk_hops_raw_configs[iSink]); - - } - - free((void *) cfgs->snk_hops_raw_configs); - // +----------------------------------------------------------+ // | Mapping | // +----------------------------------------------------------+ @@ -344,26 +270,14 @@ // | Module | // +------------------------------------------------------+ - mod_mapping_cfg_destroy(cfgs->mod_mapping_config); + mod_mapping_cfg_destroy(cfgs->mod_mapping_mics_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - msg_hops_cfg_destroy(cfgs->msg_hops_mapping_config); + msg_hops_cfg_destroy(cfgs->msg_hops_mics_map_config); - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < cfgs->snk_hops_mapping_config_count; iSink++) { - - snk_hops_cfg_destroy(cfgs->snk_hops_mapping_configs[iSink]); - - } - - free((void *) cfgs->snk_hops_mapping_configs); - // +----------------------------------------------------------+ // | Mapping | // +----------------------------------------------------------+ @@ -372,26 +286,14 @@ // | Module | // +------------------------------------------------------+ - mod_resample_cfg_destroy(cfgs->mod_resample_config); + mod_resample_cfg_destroy(cfgs->mod_resample_mics_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - msg_hops_cfg_destroy(cfgs->msg_hops_resample_config); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < cfgs->snk_hops_resample_config_count; iSink++) { - - snk_hops_cfg_destroy(cfgs->snk_hops_resample_configs[iSink]); - - } - - free((void *) cfgs->snk_hops_resample_configs); - + msg_hops_cfg_destroy(cfgs->msg_hops_mics_rs_config); + // +----------------------------------------------------------+ // | STFT | // +----------------------------------------------------------+ @@ -400,26 +302,14 @@ // | Module | // +------------------------------------------------------+ - mod_stft_cfg_destroy(cfgs->mod_stft_config); + mod_stft_cfg_destroy(cfgs->mod_stft_mics_config); // +------------------------------------------------------+ // | Message | // +------------------------------------------------------+ - msg_spectra_cfg_destroy(cfgs->msg_spectra_stft_config); + msg_spectra_cfg_destroy(cfgs->msg_spectra_mics_config); - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < cfgs->snk_spectra_stft_config_count; iSink++) { - - snk_spectra_cfg_destroy(cfgs->snk_spectra_stft_configs[iSink]); - - } - - free((void *) cfgs->snk_spectra_stft_configs); - // +----------------------------------------------------------+ // | SSL | // +----------------------------------------------------------+ @@ -437,16 +327,10 @@ msg_pots_cfg_destroy(cfgs->msg_pots_ssl_config); // +------------------------------------------------------+ - // | Sinks | + // | Sink | // +------------------------------------------------------+ - for (iSink = 0; iSink < cfgs->snk_pots_ssl_config_count; iSink++) { - - snk_pots_cfg_destroy(cfgs->snk_pots_ssl_configs[iSink]); - - } - - free((void *) cfgs->snk_pots_ssl_configs); + snk_pots_cfg_destroy(cfgs->snk_pots_ssl_config); // +----------------------------------------------------------+ // | SST | @@ -465,16 +349,10 @@ msg_tracks_cfg_destroy(cfgs->msg_tracks_sst_config); // +------------------------------------------------------+ - // | Sinks | + // | Sink | // +------------------------------------------------------+ - for (iSink = 0; iSink < cfgs->snk_tracks_sst_config_count; iSink++) { - - snk_tracks_cfg_destroy(cfgs->snk_tracks_sst_configs[iSink]); - - } - - free((void *) cfgs->snk_tracks_sst_configs); + snk_tracks_cfg_destroy(cfgs->snk_tracks_sst_config); /* // +----------------------------------------------------------+ // | SSS | diff --git a/demo/configs.h b/demo/configs.h index fa7113e..b925a6c 100644 --- a/demo/configs.h +++ b/demo/configs.h @@ -8,62 +8,29 @@ typedef struct configs { - src_hops_cfg * src_hops_raw_config; - msg_hops_cfg * msg_hops_raw_config; - unsigned int snk_hops_raw_config_count; - snk_hops_cfg ** snk_hops_raw_configs; + src_hops_cfg * src_hops_mics_config; + msg_hops_cfg * msg_hops_mics_raw_config; - mod_mapping_cfg * mod_mapping_config; - msg_hops_cfg * msg_hops_mapping_config; - unsigned int snk_hops_mapping_config_count; - snk_hops_cfg ** snk_hops_mapping_configs; + mod_mapping_cfg * mod_mapping_mics_config; + msg_hops_cfg * msg_hops_mics_map_config; - mod_resample_cfg * mod_resample_config; - msg_hops_cfg * msg_hops_resample_config; - unsigned int snk_hops_resample_config_count; - snk_hops_cfg ** snk_hops_resample_configs; + mod_resample_cfg * mod_resample_mics_config; + msg_hops_cfg * msg_hops_mics_rs_config; - mod_stft_cfg * mod_stft_config; - msg_spectra_cfg * msg_spectra_stft_config; - unsigned int snk_spectra_stft_config_count; - snk_spectra_cfg ** snk_spectra_stft_configs; + mod_stft_cfg * mod_stft_mics_config; + msg_spectra_cfg * msg_spectra_mics_config; mod_ssl_cfg * mod_ssl_config; msg_pots_cfg * msg_pots_ssl_config; - unsigned int snk_pots_ssl_config_count; - snk_pots_cfg ** snk_pots_ssl_configs; + snk_pots_cfg * snk_pots_ssl_config; mod_sst_cfg * mod_sst_config; msg_tracks_cfg * msg_tracks_sst_config; - unsigned int snk_tracks_sst_config_count; - snk_tracks_cfg ** snk_tracks_sst_configs; - - /* - mod_sss_cfg * mod_sss_config; - msg_spectra_cfg * msg_spectra_sss_config; - msg_envs_cfg * msg_envs_sss_config; - unsigned int snk_spectra_sss_config_count; - snk_spectra_cfg ** snk_spectra_sss_configs; - - mod_sspf_cfg * mod_sspf_config; - msg_spectra_cfg * msg_spectra_sspf_config; - unsigned int snk_spectra_sspf_config_count; - snk_spectra_cfg ** snk_spectra_sspf_configs; - - mod_istft_cfg * mod_istft_config; - msg_hops_cfg * msg_hops_istft_config; - unsigned int snk_hops_istft_config_count; - snk_hops_cfg ** snk_hops_istft_configs; - - mod_gain_cfg * mod_gain_config; - msg_hops_cfg * msg_hops_gain_config; - unsigned int snk_hops_gain_config_count; - snk_hops_cfg ** snk_hops_gain_configs; - */ + snk_tracks_cfg * snk_tracks_sst_config; } configs; - configs * configs_construct(const char * file_config, const char * file_ios); + configs * configs_construct(const char * file_config); void configs_destroy(configs * cfgs); diff --git a/demo/debug.c b/demo/debug.c deleted file mode 100644 index fb4b120..0000000 --- a/demo/debug.c +++ /dev/null @@ -1,13 +0,0 @@ - #include - #include - #include - - #include - - int main(int argc, char* argv[]) - { - - - return 0; - - } \ No newline at end of file diff --git a/demo/main.c b/demo/main.c index a29b82b..f53517c 100644 --- a/demo/main.c +++ b/demo/main.c @@ -30,7 +30,6 @@ int c; char * file_config; - char * file_ios; // +------------------------------------------------------+ // | Objects | @@ -83,21 +82,14 @@ // +------------------------------------------------------+ file_config = (char *) NULL; - file_ios = (char *) NULL; char verbose = 0x00; type = processing_multithread; - while ((c = getopt(argc,argv, "hc:i:sv")) != -1) { + while ((c = getopt(argc,argv, "c:hsv")) != -1) { switch(c) { - case 'h': - - exit(EXIT_SUCCESS); - - break; - case 'c': file_config = (char *) malloc(sizeof(char) * (strlen(optarg)+1)); @@ -105,10 +97,9 @@ break; - case 'i': + case 'h': - file_ios = (char *) malloc(sizeof(char) * (strlen(optarg)+1)); - strcpy(file_ios, optarg); + exit(EXIT_SUCCESS); break; @@ -132,10 +123,6 @@ printf("Missing configuration file.\n"); exit(EXIT_FAILURE); } - if (file_ios == NULL) { - printf("Missing ios file.\n"); - exit(EXIT_FAILURE); - } // +------------------------------------------------------+ // | Copyright | @@ -172,7 +159,7 @@ if (verbose == 0x01) printf(" + Initializing configurations...... "); fflush(stdout); - cfgs = configs_construct(file_config, file_ios); + cfgs = configs_construct(file_config); if (verbose == 0x01) printf("[Done]\n"); @@ -208,7 +195,6 @@ objects_destroy(objs); configs_destroy(cfgs); free((void *) file_config); - free((void *) file_ios); if (verbose == 0x01) printf("[Done]\n"); @@ -234,7 +220,7 @@ if (verbose == 0x01) printf(" + Initializing configurations...... "); fflush(stdout); - cfgs = configs_construct(file_config, file_ios); + cfgs = configs_construct(file_config); if (verbose == 0x01) printf("[Done]\n"); @@ -279,7 +265,6 @@ aobjects_destroy(aobjs); configs_destroy(cfgs); free((void *) file_config); - free((void *) file_ios); if (verbose == 0x01) printf("[Done]\n"); diff --git a/demo/objects.c b/demo/objects.c index 5560d60..d35b909 100644 --- a/demo/objects.c +++ b/demo/objects.c @@ -20,28 +20,14 @@ // | Source | // +--------------------------------------------------+ - objs->src_hops_raw_object = src_hops_construct(cfgs->src_hops_raw_config, - cfgs->msg_hops_raw_config); + objs->src_hops_mics_object = src_hops_construct(cfgs->src_hops_mics_config, + cfgs->msg_hops_mics_raw_config); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - objs->msg_hops_raw_object = msg_hops_construct(cfgs->msg_hops_raw_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->snk_hops_raw_object_count = cfgs->snk_hops_raw_config_count; - objs->snk_hops_raw_objects = (snk_hops_obj **) malloc(sizeof(snk_hops_obj *) * cfgs->snk_hops_raw_config_count); - - for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) { - - objs->snk_hops_raw_objects[iSink] = snk_hops_construct(cfgs->snk_hops_raw_configs[iSink], - cfgs->msg_hops_raw_config); - - } + objs->msg_hops_mics_raw_object = msg_hops_construct(cfgs->msg_hops_mics_raw_config); // +------------------------------------------------------+ // | Mapping | @@ -51,28 +37,14 @@ // | Module | // +--------------------------------------------------+ - objs->mod_mapping_object = mod_mapping_construct(cfgs->mod_mapping_config, - cfgs->msg_hops_mapping_config); + objs->mod_mapping_mics_object = mod_mapping_construct(cfgs->mod_mapping_mics_config, + cfgs->msg_hops_mics_map_config); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - objs->msg_hops_mapping_object = msg_hops_construct(cfgs->msg_hops_mapping_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->snk_hops_mapping_object_count = cfgs->snk_hops_mapping_config_count; - objs->snk_hops_mapping_objects = (snk_hops_obj **) malloc(sizeof(snk_hops_obj *) * cfgs->snk_hops_mapping_config_count); - - for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) { - - objs->snk_hops_mapping_objects[iSink] = snk_hops_construct(cfgs->snk_hops_mapping_configs[iSink], - cfgs->msg_hops_mapping_config); - - } + objs->msg_hops_mics_map_object = msg_hops_construct(cfgs->msg_hops_mics_map_config); // +------------------------------------------------------+ // | Resample | @@ -82,29 +54,15 @@ // | Module | // +--------------------------------------------------+ - objs->mod_resample_object = mod_resample_construct(cfgs->mod_resample_config, - cfgs->msg_hops_mapping_config, - cfgs->msg_hops_resample_config); + objs->mod_resample_mics_object = mod_resample_construct(cfgs->mod_resample_mics_config, + cfgs->msg_hops_mics_map_config, + cfgs->msg_hops_mics_rs_config); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - objs->msg_hops_resample_object = msg_hops_construct(cfgs->msg_hops_resample_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->snk_hops_resample_object_count = cfgs->snk_hops_resample_config_count; - objs->snk_hops_resample_objects = (snk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_resample_config_count); - - for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) { - - objs->snk_hops_resample_objects[iSink] = snk_hops_construct(cfgs->snk_hops_resample_configs[iSink], - cfgs->msg_hops_resample_config); - - } + objs->msg_hops_mics_rs_object = msg_hops_construct(cfgs->msg_hops_mics_rs_config); // +------------------------------------------------------+ // | STFT | @@ -114,29 +72,15 @@ // | Module | // +--------------------------------------------------+ - objs->mod_stft_object = mod_stft_construct(cfgs->mod_stft_config, - cfgs->msg_hops_resample_config, - cfgs->msg_spectra_stft_config); + objs->mod_stft_mics_object = mod_stft_construct(cfgs->mod_stft_mics_config, + cfgs->msg_hops_mics_rs_config, + cfgs->msg_spectra_mics_config); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - objs->msg_spectra_stft_object = msg_spectra_construct(cfgs->msg_spectra_stft_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->snk_spectra_stft_object_count = cfgs->snk_spectra_stft_config_count; - objs->snk_spectra_stft_objects = (snk_spectra_obj **) malloc(sizeof(snk_spectra_obj *) * cfgs->snk_spectra_stft_config_count); - - for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) { - - objs->snk_spectra_stft_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_stft_configs[iSink], - cfgs->msg_spectra_stft_config); - - } + objs->msg_spectra_mics_object = msg_spectra_construct(cfgs->msg_spectra_mics_config); // +------------------------------------------------------+ // | SSL | @@ -147,7 +91,7 @@ // +--------------------------------------------------+ objs->mod_ssl_object = mod_ssl_construct(cfgs->mod_ssl_config, - cfgs->msg_spectra_stft_config, + cfgs->msg_spectra_mics_config, cfgs->msg_pots_ssl_config); // +--------------------------------------------------+ @@ -160,15 +104,9 @@ // | Sinks | // +--------------------------------------------------+ - objs->snk_pots_ssl_object_count = cfgs->snk_pots_ssl_config_count; - objs->snk_pots_ssl_objects = (snk_pots_obj **) malloc(sizeof(snk_pots_obj *) * cfgs->snk_pots_ssl_config_count); + objs->snk_pots_ssl_object = snk_pots_construct(cfgs->snk_pots_ssl_config, + cfgs->msg_pots_ssl_config); - for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) { - - objs->snk_pots_ssl_objects[iSink] = snk_pots_construct(cfgs->snk_pots_ssl_configs[iSink], - cfgs->msg_pots_ssl_config); - - } // +------------------------------------------------------+ // | SST | @@ -193,235 +131,122 @@ // | Sinks | // +--------------------------------------------------+ - objs->snk_tracks_sst_object_count = cfgs->snk_tracks_sst_config_count; - objs->snk_tracks_sst_objects = (snk_tracks_obj **) malloc(sizeof(snk_tracks_obj *) * cfgs->snk_tracks_sst_config_count); + objs->snk_tracks_sst_object = snk_tracks_construct(cfgs->snk_tracks_sst_config, + cfgs->msg_tracks_sst_config); - for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) { + // +----------------------------------------------------------+ + // | Connect | + // +----------------------------------------------------------+ - objs->snk_tracks_sst_objects[iSink] = snk_tracks_construct(cfgs->snk_tracks_sst_configs[iSink], - cfgs->msg_tracks_sst_config); + objs->con_hops_mics_raw_object = con_hops_construct(1, cfgs->msg_hops_mics_raw_config); - } -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ + objs->con_hops_mics_map_object = con_hops_construct(1, cfgs->msg_hops_mics_map_config); - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ + objs->con_hops_mics_rs_object = con_hops_construct(1, cfgs->msg_hops_mics_rs_config); - objs->mod_sss_object = mod_sss_construct(cfgs->mod_sss_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_spectra_sss_config, - cfgs->msg_envs_sss_config); + objs->con_spectra_mics_object = con_spectra_construct(1, cfgs->msg_spectra_mics_config); - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ + objs->con_pots_ssl_object = con_pots_construct(2, cfgs->msg_pots_ssl_config); + + objs->con_tracks_sst_object = con_tracks_construct(1, cfgs->msg_tracks_sst_config); - objs->msg_spectra_sss_object = msg_spectra_construct(cfgs->msg_spectra_sss_config); + // +------------------------------------------------------+ + // | Raw | + // +------------------------------------------------------+ // +--------------------------------------------------+ - // | Sinks | + // | Source | // +--------------------------------------------------+ - objs->snk_spectra_sss_object_count = cfgs->snk_spectra_sss_config_count; - objs->snk_spectra_sss_objects = (snk_spectra_obj **) malloc(sizeof(snk_spectra_obj *) * cfgs->snk_spectra_sss_config_count); - - for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) { - - objs->snk_spectra_sss_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_sss_configs[iSink], - cfgs->msg_spectra_sss_config); - - } + src_hops_connect(objs->src_hops_mics_object, + objs->con_hops_mics_raw_object->in); // +------------------------------------------------------+ - // | SSPF | + // | Mapping | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Module | // +--------------------------------------------------+ - objs->mod_sspf_object = mod_sspf_construct(cfgs->mod_sspf_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_spectra_sspf_config, - cfgs->msg_envs_sss_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ + mod_mapping_connect(objs->mod_mapping_mics_object, + objs->con_hops_mics_raw_object->outs[0], + objs->con_hops_mics_map_object->in); - objs->msg_spectra_sspf_object = msg_spectra_construct(cfgs->msg_spectra_sspf_config); + // +------------------------------------------------------+ + // | Resample | + // +------------------------------------------------------+ // +--------------------------------------------------+ - // | Sinks | + // | Module | // +--------------------------------------------------+ - objs->snk_spectra_sspf_object_count = cfgs->snk_spectra_sspf_config_count; - objs->snk_spectra_sspf_objects = (snk_spectra_obj **) malloc(sizeof(snk_spectra_obj *) * cfgs->snk_spectra_sspf_config_count); - - for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) { - - objs->snk_spectra_sspf_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_sspf_configs[iSink], - cfgs->msg_spectra_sspf_config); - - } + mod_resample_connect(objs->mod_resample_mics_object, + objs->con_hops_mics_map_object->outs[0], + objs->con_hops_mics_rs_object->in); // +------------------------------------------------------+ - // | ISTFT | + // | STFT | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Module | // +--------------------------------------------------+ - objs->mod_istft_object = mod_istft_construct(cfgs->mod_istft_config, - cfgs->msg_spectra_sspf_config, - cfgs->msg_hops_istft_config); + mod_stft_connect(objs->mod_stft_mics_object, + objs->con_hops_mics_rs_object->outs[0], + objs->con_spectra_mics_object->in); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ // +--------------------------------------------------+ - // | Message | + // | Module | // +--------------------------------------------------+ - objs->msg_hops_istft_object = msg_hops_construct(cfgs->msg_hops_istft_config); + mod_ssl_connect(objs->mod_ssl_object, + objs->con_spectra_mics_object->outs[0], + objs->con_pots_ssl_object->in); // +--------------------------------------------------+ // | Sinks | // +--------------------------------------------------+ - objs->snk_hops_istft_object_count = cfgs->snk_hops_istft_config_count; - objs->snk_hops_istft_objects = (snk_hops_obj **) malloc(sizeof(snk_hops_obj *) * cfgs->snk_hops_istft_config_count); - - for (iSink = 0; iSink < objs->snk_hops_istft_object_count; iSink++) { - - objs->snk_hops_istft_objects[iSink] = snk_hops_construct(cfgs->snk_hops_istft_configs[iSink], - cfgs->msg_hops_istft_config); - - } + snk_pots_connect(objs->snk_pots_ssl_object, + objs->con_pots_ssl_object->outs[1]); // +------------------------------------------------------+ - // | Gain | + // | SST | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Module | // +--------------------------------------------------+ - objs->mod_gain_object = mod_gain_construct(cfgs->mod_gain_config, - cfgs->msg_hops_gain_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->msg_hops_gain_object = msg_hops_construct(cfgs->msg_hops_gain_config); + mod_sst_connect(objs->mod_sst_object, + objs->con_pots_ssl_object->outs[0], + objs->con_tracks_sst_object->in); // +--------------------------------------------------+ // | Sinks | // +--------------------------------------------------+ - objs->snk_hops_gain_object_count = cfgs->snk_hops_gain_config_count; - objs->snk_hops_gain_objects = (snk_hops_obj **) malloc(sizeof(snk_hops_obj *) * cfgs->snk_hops_gain_config_count); + snk_tracks_connect(objs->snk_tracks_sst_object, + objs->con_tracks_sst_object->outs[0]); - for (iSink = 0; iSink < objs->snk_hops_gain_object_count; iSink++) { - - objs->snk_hops_gain_objects[iSink] = snk_hops_construct(cfgs->snk_hops_gain_configs[iSink], - cfgs->msg_hops_gain_config); - - } -*/ - // +----------------------------------------------------------+ - // | Connect | - // +----------------------------------------------------------+ + return objs; - // Hops ....... Raw ........ (0): Mapping Hops - // ........ (1): Sink 1 - // ........ (2): Sink 2 - // etc. - // - // Hops ....... Mapping .... (0): Resample Hops - // .... (1): Sink 1 - // .... (2): Sink 2 - // etc. - // - // Hops ....... Resample ... (0): STFT Hops - // ... (1): Sink 1 - // ... (2): Sink 2 - // etc. - // - // Spectra .... STFT ....... (0): SSL - // ....... (1): SSS - // ....... (2): Sink 1 - // ....... (3): Sink 2 - // etc. - // - // Pots ....... SSL ........ (0): SST - // ........ (1): Sink 1 - // ........ (2): Sink 2 - // etc. - // - // Tracks ..... SST ........ (0): SSS - // ........ (1): SSPF - // ........ (2): Sink 1 - // ........ (3): Sink 2 - // etc. - // - // Spectra .... SSS ........ (0): SSPF - // ........ (1): Sink 1 - // ........ (2): Sink 2 - // etc. - // - // Envs ....... SSS ........ (0): SSPF - // - // Spectra .... SSPF ....... (0): ISTFT - // ....... (1): Sink 1 - // ....... (2): Sink 2 - // etc. - // - // Hops ....... ISTFT ...... (0): Gain - // ...... (1): Sink 1 - // ...... (2): Sink 2 - // etc. - // - // Hops ....... Gain ....... (0): Sink 1 - // ....... (1): Sink 2 - // etc. - - objs->con_hops_raw_object = con_hops_construct(objs->snk_hops_raw_object_count + 1, - cfgs->msg_hops_raw_config); - - objs->con_hops_mapping_object = con_hops_construct(objs->snk_hops_mapping_object_count + 1, - cfgs->msg_hops_mapping_config); - - objs->con_hops_resample_object = con_hops_construct(objs->snk_hops_resample_object_count + 1, - cfgs->msg_hops_resample_config); - - objs->con_spectra_stft_object = con_spectra_construct(objs->snk_spectra_stft_object_count + 1, - cfgs->msg_spectra_stft_config); - - objs->con_pots_ssl_object = con_pots_construct(objs->snk_pots_ssl_object_count + 1, - cfgs->msg_pots_ssl_config); - - objs->con_tracks_sst_object = con_tracks_construct(objs->snk_tracks_sst_object_count + 0, - cfgs->msg_tracks_sst_config); -/* - objs->con_spectra_sss_object = con_spectra_construct(objs->snk_spectra_sss_object_count + 1, - cfgs->msg_spectra_sss_config); + } - objs->con_envs_sss_object = con_envs_construct(1, - cfgs->msg_envs_sss_config); + void objects_destroy(objects * objs) { - objs->con_spectra_sspf_object = con_spectra_construct(objs->snk_spectra_sspf_object_count + 1, - cfgs->msg_spectra_sspf_config); + unsigned int iSink; - objs->con_hops_istft_object = con_hops_construct(objs->snk_hops_istft_object_count + 1, - cfgs->msg_hops_istft_config); + // +----------------------------------------------------------+ + // | Destroy | + // +----------------------------------------------------------+ - objs->con_hops_gain_object = con_hops_construct(objs->snk_hops_gain_object_count, - cfgs->msg_hops_gain_config); -*/ // +------------------------------------------------------+ // | Raw | // +------------------------------------------------------+ @@ -430,19 +255,19 @@ // | Source | // +--------------------------------------------------+ - src_hops_connect(objs->src_hops_raw_object, - objs->con_hops_raw_object->in); - + src_hops_destroy(objs->src_hops_mics_object); + // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) { - - snk_hops_connect(objs->snk_hops_raw_objects[iSink], - objs->con_hops_raw_object->outs[iSink + 1]); + msg_hops_destroy(objs->msg_hops_mics_raw_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ - } + con_hops_destroy(objs->con_hops_mics_raw_object); // +------------------------------------------------------+ // | Mapping | @@ -452,20 +277,19 @@ // | Module | // +--------------------------------------------------+ - mod_mapping_connect(objs->mod_mapping_object, - objs->con_hops_raw_object->outs[0], - objs->con_hops_mapping_object->in); - + mod_mapping_destroy(objs->mod_mapping_mics_object); + // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) { + msg_hops_destroy(objs->msg_hops_mics_map_object); - snk_hops_connect(objs->snk_hops_mapping_objects[iSink], - objs->con_hops_mapping_object->outs[iSink + 1]); + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ - } + con_hops_destroy(objs->con_hops_mics_map_object); // +------------------------------------------------------+ // | Resample | @@ -475,20 +299,19 @@ // | Module | // +--------------------------------------------------+ - mod_resample_connect(objs->mod_resample_object, - objs->con_hops_mapping_object->outs[0], - objs->con_hops_resample_object->in); - + mod_resample_destroy(objs->mod_resample_mics_object); + // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) { - - snk_hops_connect(objs->snk_hops_resample_objects[iSink], - objs->con_hops_resample_object->outs[iSink + 1]); + msg_hops_destroy(objs->msg_hops_mics_rs_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ - } + con_hops_destroy(objs->con_hops_mics_rs_object); // +------------------------------------------------------+ // | STFT | @@ -498,20 +321,19 @@ // | Module | // +--------------------------------------------------+ - mod_stft_connect(objs->mod_stft_object, - objs->con_hops_resample_object->outs[0], - objs->con_spectra_stft_object->in); - + mod_stft_destroy(objs->mod_stft_mics_object); + // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) { - - snk_spectra_connect(objs->snk_spectra_stft_objects[iSink], - objs->con_spectra_stft_object->outs[iSink + 1]); + msg_spectra_destroy(objs->msg_spectra_mics_object); + + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ - } + con_spectra_destroy(objs->con_spectra_mics_object); // +------------------------------------------------------+ // | SSL | @@ -521,20 +343,25 @@ // | Module | // +--------------------------------------------------+ - mod_ssl_connect(objs->mod_ssl_object, - objs->con_spectra_stft_object->outs[0], - objs->con_pots_ssl_object->in); + mod_ssl_destroy(objs->mod_ssl_object); + + // +--------------------------------------------------+ + // | Message | + // +--------------------------------------------------+ + msg_pots_destroy(objs->msg_pots_ssl_object); + // +--------------------------------------------------+ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) { + snk_pots_destroy(objs->snk_pots_ssl_object); - snk_pots_connect(objs->snk_pots_ssl_objects[iSink], - objs->con_pots_ssl_object->outs[iSink + 1]); + // +--------------------------------------------------+ + // | Connector | + // +--------------------------------------------------+ - } + con_pots_destroy(objs->con_pots_ssl_object); // +------------------------------------------------------+ // | SST | @@ -544,940 +371,196 @@ // | Module | // +--------------------------------------------------+ - mod_sst_connect(objs->mod_sst_object, - objs->con_pots_ssl_object->outs[0], - objs->con_tracks_sst_object->in); + mod_sst_destroy(objs->mod_sst_object); + + // +--------------------------------------------------+ + // | Message | + // +--------------------------------------------------+ + msg_tracks_destroy(objs->msg_tracks_sst_object); + // +--------------------------------------------------+ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) { - - snk_tracks_connect(objs->snk_tracks_sst_objects[iSink], - objs->con_tracks_sst_object->outs[iSink + 0]); - - } -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ + snk_tracks_destroy(objs->snk_tracks_sst_object); // +--------------------------------------------------+ - // | Module | + // | Connector | // +--------------------------------------------------+ - mod_sss_connect(objs->mod_sss_object, - objs->con_spectra_stft_object->outs[1], - objs->con_tracks_sst_object->outs[0], - objs->con_spectra_sss_object->in, - objs->con_envs_sss_object->in); + con_tracks_destroy(objs->con_tracks_sst_object); - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ + free((void *) objs); + + } + + aobjects * aobjects_construct(const configs * cfgs) { + + aobjects * objs; + unsigned int iSink; - for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) { + objs = (aobjects *) malloc(sizeof(aobjects)); - snk_spectra_connect(objs->snk_spectra_sss_objects[iSink], - objs->con_spectra_sss_object->outs[iSink + 1]); + objs->nMessages = 100; - } + // +----------------------------------------------------------+ + // | Construct | + // +----------------------------------------------------------+ // +------------------------------------------------------+ - // | SSPF | + // | Raw | // +------------------------------------------------------+ // +--------------------------------------------------+ - // | Module | + // | Source | // +--------------------------------------------------+ - mod_sspf_connect(objs->mod_sspf_object, - objs->con_spectra_sss_object->outs[0], - objs->con_envs_sss_object->outs[0], - objs->con_tracks_sst_object->outs[1], - objs->con_spectra_sspf_object->in); - + objs->asrc_hops_mics_object = asrc_hops_construct(cfgs->src_hops_mics_config, + cfgs->msg_hops_mics_raw_config); + // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) { - - snk_spectra_connect(objs->snk_spectra_sspf_objects[iSink], - objs->con_spectra_sspf_object->outs[iSink + 1]); - - } + objs->amsg_hops_mics_raw_object = amsg_hops_construct(objs->nMessages, + cfgs->msg_hops_mics_raw_config); // +------------------------------------------------------+ - // | ISTFT | + // | Mapping | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Module | // +--------------------------------------------------+ - mod_istft_connect(objs->mod_istft_object, - objs->con_spectra_sspf_object->outs[0], - objs->con_hops_istft_object->in); + objs->amod_mapping_mics_object = amod_mapping_construct(cfgs->mod_mapping_mics_config, + cfgs->msg_hops_mics_map_config); // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_istft_object_count; iSink++) { - - snk_hops_connect(objs->snk_hops_istft_objects[iSink], - objs->con_hops_istft_object->outs[iSink + 1]); - - } + objs->amsg_hops_mics_map_object = amsg_hops_construct(objs->nMessages, + cfgs->msg_hops_mics_map_config); // +------------------------------------------------------+ - // | Gain | + // | Resample | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Module | // +--------------------------------------------------+ - mod_gain_connect(objs->mod_gain_object, - objs->con_hops_istft_object->outs[0], - objs->con_hops_gain_object->in); + objs->amod_resample_mics_object = amod_resample_construct(cfgs->mod_resample_mics_config, + cfgs->msg_hops_mics_map_config, + cfgs->msg_hops_mics_rs_config); // +--------------------------------------------------+ - // | Sinks | + // | Message | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_gain_object_count; iSink++) { - - snk_hops_connect(objs->snk_hops_gain_objects[iSink], - objs->con_hops_gain_object->outs[iSink]); - - } -*/ - return objs; - - } - - void objects_destroy(objects * objs) { - - unsigned int iSink; - - // +----------------------------------------------------------+ - // | Destroy | - // +----------------------------------------------------------+ + objs->amsg_hops_mics_rs_object = amsg_hops_construct(objs->nMessages, + cfgs->msg_hops_mics_rs_config); // +------------------------------------------------------+ - // | Raw | + // | STFT | // +------------------------------------------------------+ // +--------------------------------------------------+ - // | Source | + // | Module | // +--------------------------------------------------+ - src_hops_destroy(objs->src_hops_raw_object); - + objs->amod_stft_mics_object = amod_stft_construct(cfgs->mod_stft_mics_config, + cfgs->msg_hops_mics_rs_config, + cfgs->msg_spectra_mics_config); + // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - msg_hops_destroy(objs->msg_hops_raw_object); - + objs->amsg_spectra_mics_object = amsg_spectra_construct(objs->nMessages, + cfgs->msg_spectra_mics_config); + + // +------------------------------------------------------+ + // | SSL | + // +------------------------------------------------------+ + // +--------------------------------------------------+ - // | Sinks | + // | Module | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) { - - snk_hops_destroy(objs->snk_hops_raw_objects[iSink]); + objs->amod_ssl_object = amod_ssl_construct(cfgs->mod_ssl_config, + cfgs->msg_spectra_mics_config, + cfgs->msg_pots_ssl_config); - } + // +--------------------------------------------------+ + // | Message | + // +--------------------------------------------------+ - free((void *) objs->snk_hops_raw_objects); + objs->amsg_pots_ssl_object = amsg_pots_construct(objs->nMessages, + cfgs->msg_pots_ssl_config); // +--------------------------------------------------+ - // | Connector | + // | Sinks | // +--------------------------------------------------+ - con_hops_destroy(objs->con_hops_raw_object); + objs->asnk_pots_ssl_object = asnk_pots_construct(cfgs->snk_pots_ssl_config, + cfgs->msg_pots_ssl_config); // +------------------------------------------------------+ - // | Mapping | + // | SST | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Module | // +--------------------------------------------------+ - mod_mapping_destroy(objs->mod_mapping_object); - + objs->amod_sst_object = amod_sst_construct(cfgs->mod_sst_config, + cfgs->mod_ssl_config, + cfgs->msg_pots_ssl_config, + cfgs->msg_tracks_sst_config); + // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - msg_hops_destroy(objs->msg_hops_mapping_object); - + objs->amsg_tracks_sst_object = amsg_tracks_construct(objs->nMessages, + cfgs->msg_tracks_sst_config); + // +--------------------------------------------------+ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) { + objs->asnk_tracks_sst_object = asnk_tracks_construct(cfgs->snk_tracks_sst_config, + cfgs->msg_tracks_sst_config); + + // +----------------------------------------------------------+ + // | Connect | + // +----------------------------------------------------------+ + + objs->acon_hops_mics_raw_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_raw_config); - snk_hops_destroy(objs->snk_hops_mapping_objects[iSink]); + objs->acon_hops_mics_map_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_map_config); - } + objs->acon_hops_mics_rs_object = acon_hops_construct(1, objs->nMessages, cfgs->msg_hops_mics_rs_config); - free((void *) objs->snk_hops_mapping_objects); + objs->acon_spectra_mics_object = acon_spectra_construct(1, objs->nMessages, cfgs->msg_spectra_mics_config); - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ + objs->acon_pots_ssl_object = acon_pots_construct(2, objs->nMessages, cfgs->msg_pots_ssl_config); - con_hops_destroy(objs->con_hops_mapping_object); + objs->acon_tracks_sst_object = acon_tracks_construct(1, objs->nMessages, cfgs->msg_tracks_sst_config); // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_resample_destroy(objs->mod_resample_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_hops_destroy(objs->msg_hops_resample_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) { - - snk_hops_destroy(objs->snk_hops_resample_objects[iSink]); - - } - - free((void *) objs->snk_hops_resample_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_resample_object); - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_stft_destroy(objs->mod_stft_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_spectra_destroy(objs->msg_spectra_stft_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) { - - snk_spectra_destroy(objs->snk_spectra_stft_objects[iSink]); - - } - - free((void *) objs->snk_spectra_stft_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_spectra_destroy(objs->con_spectra_stft_object); - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_ssl_destroy(objs->mod_ssl_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_pots_destroy(objs->msg_pots_ssl_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) { - - snk_pots_destroy(objs->snk_pots_ssl_objects[iSink]); - - } - - free((void *) objs->snk_pots_ssl_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_pots_destroy(objs->con_pots_ssl_object); - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sst_destroy(objs->mod_sst_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_tracks_destroy(objs->msg_tracks_sst_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) { - - snk_tracks_destroy(objs->snk_tracks_sst_objects[iSink]); - - } - - free((void *) objs->snk_tracks_sst_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_tracks_destroy(objs->con_tracks_sst_object); -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sss_destroy(objs->mod_sss_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_spectra_destroy(objs->msg_spectra_sss_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) { - - snk_spectra_destroy(objs->snk_spectra_sss_objects[iSink]); - - } - - free((void *) objs->snk_spectra_sss_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_spectra_destroy(objs->con_spectra_sss_object); - con_envs_destroy(objs->con_envs_sss_object); - - // +------------------------------------------------------+ - // | SSPF | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_sspf_destroy(objs->mod_sspf_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_spectra_destroy(objs->msg_spectra_sspf_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) { - - snk_spectra_destroy(objs->snk_spectra_sspf_objects[iSink]); - - } - - free((void *) objs->snk_spectra_sspf_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_spectra_destroy(objs->con_spectra_sspf_object); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_istft_destroy(objs->mod_istft_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_hops_destroy(objs->msg_hops_istft_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_istft_object_count; iSink++) { - - snk_hops_destroy(objs->snk_hops_istft_objects[iSink]); - - } - - free((void *) objs->snk_hops_istft_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_istft_object); - - // +------------------------------------------------------+ - // | Gain | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - mod_gain_destroy(objs->mod_gain_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - msg_hops_destroy(objs->msg_hops_gain_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_gain_object_count; iSink++) { - - snk_hops_destroy(objs->snk_hops_gain_objects[iSink]); - - } - - free((void *) objs->snk_hops_gain_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - con_hops_destroy(objs->con_hops_gain_object); -*/ - free((void *) objs); - - } - - aobjects * aobjects_construct(const configs * cfgs) { - - aobjects * objs; - unsigned int iSink; - - objs = (aobjects *) malloc(sizeof(aobjects)); - - objs->nMessages = 100; - - // +----------------------------------------------------------+ - // | Construct | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Raw | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Source | - // +--------------------------------------------------+ - - objs->asrc_hops_raw_object = asrc_hops_construct(cfgs->src_hops_raw_config, - cfgs->msg_hops_raw_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_hops_raw_object = amsg_hops_construct(objs->nMessages, - cfgs->msg_hops_raw_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_hops_raw_object_count = cfgs->snk_hops_raw_config_count; - objs->asnk_hops_raw_objects = (asnk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_raw_config_count); - - for (iSink = 0; iSink < objs->asnk_hops_raw_object_count; iSink++) { - - objs->asnk_hops_raw_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_raw_configs[iSink], - cfgs->msg_hops_raw_config); - - } - - // +------------------------------------------------------+ - // | Mapping | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_mapping_object = amod_mapping_construct(cfgs->mod_mapping_config, - cfgs->msg_hops_mapping_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_hops_mapping_object = amsg_hops_construct(objs->nMessages, - cfgs->msg_hops_mapping_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_hops_mapping_object_count = cfgs->snk_hops_mapping_config_count; - objs->asnk_hops_mapping_objects = (asnk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_mapping_config_count); - - for (iSink = 0; iSink < objs->asnk_hops_mapping_object_count; iSink++) { - - objs->asnk_hops_mapping_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_mapping_configs[iSink], - cfgs->msg_hops_mapping_config); - - } - - // +------------------------------------------------------+ - // | Resample | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_resample_object = amod_resample_construct(cfgs->mod_resample_config, - cfgs->msg_hops_mapping_config, - cfgs->msg_hops_resample_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_hops_resample_object = amsg_hops_construct(objs->nMessages, - cfgs->msg_hops_resample_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_hops_resample_object_count = cfgs->snk_hops_resample_config_count; - objs->asnk_hops_resample_objects = (asnk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_resample_config_count); - - for (iSink = 0; iSink < objs->asnk_hops_resample_object_count; iSink++) { - - objs->asnk_hops_resample_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_resample_configs[iSink], - cfgs->msg_hops_resample_config); - - } - - // +------------------------------------------------------+ - // | STFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_stft_object = amod_stft_construct(cfgs->mod_stft_config, - cfgs->msg_hops_resample_config, - cfgs->msg_spectra_stft_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_spectra_stft_object = amsg_spectra_construct(objs->nMessages, - cfgs->msg_spectra_stft_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_spectra_stft_object_count = cfgs->snk_spectra_stft_config_count; - objs->asnk_spectra_stft_objects = (asnk_spectra_obj **) malloc(sizeof(asnk_spectra_obj *) * cfgs->snk_spectra_stft_config_count); - - for (iSink = 0; iSink < objs->asnk_spectra_stft_object_count; iSink++) { - - objs->asnk_spectra_stft_objects[iSink] = asnk_spectra_construct(cfgs->snk_spectra_stft_configs[iSink], - cfgs->msg_spectra_stft_config); - - } - - // +------------------------------------------------------+ - // | SSL | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_ssl_object = amod_ssl_construct(cfgs->mod_ssl_config, - cfgs->msg_spectra_stft_config, - cfgs->msg_pots_ssl_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_pots_ssl_object = amsg_pots_construct(objs->nMessages, - cfgs->msg_pots_ssl_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_pots_ssl_object_count = cfgs->snk_pots_ssl_config_count; - objs->asnk_pots_ssl_objects = (asnk_pots_obj **) malloc(sizeof(asnk_pots_obj *) * cfgs->snk_pots_ssl_config_count); - - for (iSink = 0; iSink < objs->asnk_pots_ssl_object_count; iSink++) { - - objs->asnk_pots_ssl_objects[iSink] = asnk_pots_construct(cfgs->snk_pots_ssl_configs[iSink], - cfgs->msg_pots_ssl_config); - - } - - // +------------------------------------------------------+ - // | SST | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_sst_object = amod_sst_construct(cfgs->mod_sst_config, - cfgs->mod_ssl_config, - cfgs->msg_pots_ssl_config, - cfgs->msg_tracks_sst_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_tracks_sst_object = amsg_tracks_construct(objs->nMessages, - cfgs->msg_tracks_sst_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_tracks_sst_object_count = cfgs->snk_tracks_sst_config_count; - objs->asnk_tracks_sst_objects = (asnk_tracks_obj **) malloc(sizeof(asnk_tracks_obj *) * cfgs->snk_tracks_sst_config_count); - - for (iSink = 0; iSink < objs->asnk_tracks_sst_object_count; iSink++) { - - objs->asnk_tracks_sst_objects[iSink] = asnk_tracks_construct(cfgs->snk_tracks_sst_configs[iSink], - cfgs->msg_tracks_sst_config); - - } -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_sss_object = amod_sss_construct(cfgs->mod_sss_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_spectra_sss_config, - cfgs->msg_envs_sss_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_spectra_sss_object = amsg_spectra_construct(objs->nMessages, - cfgs->msg_spectra_sss_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_spectra_sss_object_count = cfgs->snk_spectra_sss_config_count; - objs->asnk_spectra_sss_objects = (asnk_spectra_obj **) malloc(sizeof(asnk_spectra_obj *) * cfgs->snk_spectra_sss_config_count); - - for (iSink = 0; iSink < objs->asnk_spectra_sss_object_count; iSink++) { - - objs->asnk_spectra_sss_objects[iSink] = asnk_spectra_construct(cfgs->snk_spectra_sss_configs[iSink], - cfgs->msg_spectra_sss_config); - - } - - // +------------------------------------------------------+ - // | SSPF | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_sspf_object = amod_sspf_construct(cfgs->mod_sspf_config, - cfgs->msg_tracks_sst_config, - cfgs->msg_spectra_sspf_config, - cfgs->msg_envs_sss_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_spectra_sspf_object = amsg_spectra_construct(objs->nMessages, - cfgs->msg_spectra_sspf_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_spectra_sspf_object_count = cfgs->snk_spectra_sspf_config_count; - objs->asnk_spectra_sspf_objects = (asnk_spectra_obj **) malloc(sizeof(asnk_spectra_obj *) * cfgs->snk_spectra_sspf_config_count); - - for (iSink = 0; iSink < objs->asnk_spectra_sspf_object_count; iSink++) { - - objs->asnk_spectra_sspf_objects[iSink] = asnk_spectra_construct(cfgs->snk_spectra_sspf_configs[iSink], - cfgs->msg_spectra_sspf_config); - - } - - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_istft_object = amod_istft_construct(cfgs->mod_istft_config, - cfgs->msg_spectra_sspf_config, - cfgs->msg_hops_istft_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_hops_istft_object = amsg_hops_construct(objs->nMessages, - cfgs->msg_hops_istft_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_hops_istft_object_count = cfgs->snk_hops_istft_config_count; - objs->asnk_hops_istft_objects = (asnk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_istft_config_count); - - for (iSink = 0; iSink < objs->asnk_hops_istft_object_count; iSink++) { - - objs->asnk_hops_istft_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_istft_configs[iSink], - cfgs->msg_hops_istft_config); - - } - - // +------------------------------------------------------+ - // | Gain | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - objs->amod_gain_object = amod_gain_construct(cfgs->mod_gain_config, - cfgs->msg_hops_gain_config); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - objs->amsg_hops_gain_object = amsg_hops_construct(objs->nMessages, - cfgs->msg_hops_gain_config); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - objs->asnk_hops_gain_object_count = cfgs->snk_hops_gain_config_count; - objs->asnk_hops_gain_objects = (asnk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_gain_config_count); - - for (iSink = 0; iSink < objs->asnk_hops_gain_object_count; iSink++) { - - objs->asnk_hops_gain_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_gain_configs[iSink], - cfgs->msg_hops_gain_config); - - } -*/ - // +----------------------------------------------------------+ - // | Connect | - // +----------------------------------------------------------+ - - // Hops ....... Raw ........ (0): Mapping Hops - // ........ (1): Sink 1 - // ........ (2): Sink 2 - // etc. - // - // Hops ....... Mapping .... (0): Resample Hops - // .... (1): Sink 1 - // .... (2): Sink 2 - // etc. - // - // Hops ....... Resample ... (0): STFT Hops - // ... (1): Sink 1 - // ... (2): Sink 2 - // etc. - // - // Spectra .... STFT ....... (0): SSL - // ....... (1): SSS - // ....... (2): Sink 1 - // ....... (3): Sink 2 - // etc. - // - // Pots ....... SSL ........ (0): SST - // ........ (1): Sink 1 - // ........ (2): Sink 2 - // etc. - // - // Tracks ..... SST ........ (0): SSS - // ........ (1): SSPF - // ........ (2): Sink 1 - // ........ (3): Sink 2 - // etc. - // - // Spectra .... SSS ........ (0): SSPF - // ........ (1): Sink 1 - // ........ (2): Sink 2 - // etc. - // - // Envs ....... SSS ........ (0): SSPF - // - // Spectra .... SSPF ....... (0): ISTFT - // ....... (1): Sink 1 - // ....... (2): Sink 2 - // etc. - // - // Hops ...... ISTFT ....... (0): Gain - // ....... (1): Sink 1 - // ....... (2): Sink 2 - // etc. - // - // Hops ....... Gain ....... (0): Sink 1 - // ....... (1): Sink 2 - // etc. - - objs->acon_hops_raw_object = acon_hops_construct(objs->asnk_hops_raw_object_count + 1, - objs->nMessages, - cfgs->msg_hops_raw_config); - - objs->acon_hops_mapping_object = acon_hops_construct(objs->asnk_hops_mapping_object_count + 1, - objs->nMessages, - cfgs->msg_hops_mapping_config); - - objs->acon_hops_resample_object = acon_hops_construct(objs->asnk_hops_resample_object_count + 1, - objs->nMessages, - cfgs->msg_hops_resample_config); - - objs->acon_spectra_stft_object = acon_spectra_construct(objs->asnk_spectra_stft_object_count + 1, - objs->nMessages, - cfgs->msg_spectra_stft_config); - - objs->acon_pots_ssl_object = acon_pots_construct(objs->asnk_pots_ssl_object_count + 1, - objs->nMessages, - cfgs->msg_pots_ssl_config); - - objs->acon_tracks_sst_object = acon_tracks_construct(objs->asnk_tracks_sst_object_count + 0, - objs->nMessages, - cfgs->msg_tracks_sst_config); -/* - objs->acon_spectra_sss_object = acon_spectra_construct(objs->asnk_spectra_sss_object_count + 1, - objs->nMessages, - cfgs->msg_spectra_sss_config); - - objs->acon_envs_sss_object = acon_envs_construct(1, - objs->nMessages, - cfgs->msg_envs_sss_config); - - objs->acon_spectra_sspf_object = acon_spectra_construct(objs->asnk_spectra_sspf_object_count + 1, - objs->nMessages, - cfgs->msg_spectra_sspf_config); - - objs->acon_hops_istft_object = acon_hops_construct(objs->asnk_hops_istft_object_count + 1, - objs->nMessages, - cfgs->msg_hops_istft_config); - - objs->acon_hops_gain_object = acon_hops_construct(objs->asnk_hops_gain_object_count, - objs->nMessages, - cfgs->msg_hops_gain_config); -*/ - // +------------------------------------------------------+ - // | Raw | + // | Raw | // +------------------------------------------------------+ // +--------------------------------------------------+ // | Source | // +--------------------------------------------------+ - asrc_hops_connect(objs->asrc_hops_raw_object, - objs->acon_hops_raw_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_raw_object_count; iSink++) { - - asnk_hops_connect(objs->asnk_hops_raw_objects[iSink], - objs->acon_hops_raw_object->outs[iSink + 1]); - - } + asrc_hops_connect(objs->asrc_hops_mics_object, + objs->acon_hops_mics_raw_object->in); // +------------------------------------------------------+ // | Mapping | @@ -1487,20 +570,9 @@ // | Module | // +--------------------------------------------------+ - amod_mapping_connect(objs->amod_mapping_object, - objs->acon_hops_raw_object->outs[0], - objs->acon_hops_mapping_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_mapping_object_count; iSink++) { - - asnk_hops_connect(objs->asnk_hops_mapping_objects[iSink], - objs->acon_hops_mapping_object->outs[iSink + 1]); - - } + amod_mapping_connect(objs->amod_mapping_mics_object, + objs->acon_hops_mics_raw_object->outs[0], + objs->acon_hops_mics_map_object->in); // +------------------------------------------------------+ // | Resample | @@ -1510,20 +582,9 @@ // | Module | // +--------------------------------------------------+ - amod_resample_connect(objs->amod_resample_object, - objs->acon_hops_mapping_object->outs[0], - objs->acon_hops_resample_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_resample_object_count; iSink++) { - - asnk_hops_connect(objs->asnk_hops_resample_objects[iSink], - objs->acon_hops_resample_object->outs[iSink + 1]); - - } + amod_resample_connect(objs->amod_resample_mics_object, + objs->acon_hops_mics_map_object->outs[0], + objs->acon_hops_mics_rs_object->in); // +------------------------------------------------------+ // | STFT | @@ -1533,20 +594,9 @@ // | Module | // +--------------------------------------------------+ - amod_stft_connect(objs->amod_stft_object, - objs->acon_hops_resample_object->outs[0], - objs->acon_spectra_stft_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_spectra_stft_object_count; iSink++) { - - asnk_spectra_connect(objs->asnk_spectra_stft_objects[iSink], - objs->acon_spectra_stft_object->outs[iSink + 1]); - - } + amod_stft_connect(objs->amod_stft_mics_object, + objs->acon_hops_mics_rs_object->outs[0], + objs->acon_spectra_mics_object->in); // +------------------------------------------------------+ // | SSL | @@ -1557,19 +607,15 @@ // +--------------------------------------------------+ amod_ssl_connect(objs->amod_ssl_object, - objs->acon_spectra_stft_object->outs[0], + objs->acon_spectra_mics_object->outs[0], objs->acon_pots_ssl_object->in); // +--------------------------------------------------+ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->asnk_pots_ssl_object_count; iSink++) { - - asnk_pots_connect(objs->asnk_pots_ssl_objects[iSink], - objs->acon_pots_ssl_object->outs[iSink + 1]); - - } + asnk_pots_connect(objs->asnk_pots_ssl_object, + objs->acon_pots_ssl_object->outs[1]); // +------------------------------------------------------+ // | SST | @@ -1587,109 +633,9 @@ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->asnk_tracks_sst_object_count; iSink++) { - - asnk_tracks_connect(objs->asnk_tracks_sst_objects[iSink], - objs->acon_tracks_sst_object->outs[iSink + 0]); - - } -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sss_connect(objs->amod_sss_object, - objs->acon_spectra_stft_object->outs[1], - objs->acon_tracks_sst_object->outs[0], - objs->acon_spectra_sss_object->in, - objs->acon_envs_sss_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_spectra_sss_object_count; iSink++) { - - asnk_spectra_connect(objs->asnk_spectra_sss_objects[iSink], - objs->acon_spectra_sss_object->outs[iSink + 1]); - - } - - // +------------------------------------------------------+ - // | SSPF | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sspf_connect(objs->amod_sspf_object, - objs->acon_spectra_sss_object->outs[0], - objs->acon_envs_sss_object->outs[0], - objs->acon_tracks_sst_object->outs[1], - objs->acon_spectra_sspf_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_spectra_sspf_object_count; iSink++) { - - asnk_spectra_connect(objs->asnk_spectra_sspf_objects[iSink], - objs->acon_spectra_sspf_object->outs[iSink + 1]); - - } - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_istft_connect(objs->amod_istft_object, - objs->acon_spectra_sspf_object->outs[0], - objs->acon_hops_istft_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_istft_object_count; iSink++) { - - asnk_hops_connect(objs->asnk_hops_istft_objects[iSink], - objs->acon_hops_istft_object->outs[iSink + 1]); - - } - - // +------------------------------------------------------+ - // | Gain | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_gain_connect(objs->amod_gain_object, - objs->acon_hops_istft_object->outs[0], - objs->acon_hops_gain_object->in); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_gain_object_count; iSink++) { - - asnk_hops_connect(objs->asnk_hops_gain_objects[iSink], - objs->acon_hops_gain_object->outs[iSink]); + asnk_tracks_connect(objs->asnk_tracks_sst_object, + objs->acon_tracks_sst_object->outs[0]); - } -*/ return objs; } @@ -1710,31 +656,19 @@ // | Source | // +--------------------------------------------------+ - asrc_hops_destroy(objs->asrc_hops_raw_object); + asrc_hops_destroy(objs->asrc_hops_mics_object); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - amsg_hops_destroy(objs->amsg_hops_raw_object); + amsg_hops_destroy(objs->amsg_hops_mics_raw_object); - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_raw_object_count; iSink++) { - - asnk_hops_destroy(objs->asnk_hops_raw_objects[iSink]); - - } - - free((void *) objs->asnk_hops_raw_objects); - // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ - acon_hops_destroy(objs->acon_hops_raw_object); + acon_hops_destroy(objs->acon_hops_mics_raw_object); // +------------------------------------------------------+ // | Mapping | @@ -1744,31 +678,19 @@ // | Module | // +--------------------------------------------------+ - amod_mapping_destroy(objs->amod_mapping_object); + amod_mapping_destroy(objs->amod_mapping_mics_object); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - amsg_hops_destroy(objs->amsg_hops_mapping_object); + amsg_hops_destroy(objs->amsg_hops_mics_map_object); - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_mapping_object_count; iSink++) { - - asnk_hops_destroy(objs->asnk_hops_mapping_objects[iSink]); - - } - - free((void *) objs->asnk_hops_mapping_objects); - // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ - acon_hops_destroy(objs->acon_hops_mapping_object); + acon_hops_destroy(objs->acon_hops_mics_map_object); // +------------------------------------------------------+ // | Resample | @@ -1778,31 +700,19 @@ // | Module | // +--------------------------------------------------+ - amod_resample_destroy(objs->amod_resample_object); + amod_resample_destroy(objs->amod_resample_mics_object); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - amsg_hops_destroy(objs->amsg_hops_resample_object); + amsg_hops_destroy(objs->amsg_hops_mics_rs_object); - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_resample_object_count; iSink++) { - - asnk_hops_destroy(objs->asnk_hops_resample_objects[iSink]); - - } - - free((void *) objs->asnk_hops_resample_objects); - // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ - acon_hops_destroy(objs->acon_hops_resample_object); + acon_hops_destroy(objs->acon_hops_mics_rs_object); // +------------------------------------------------------+ // | STFT | @@ -1812,31 +722,19 @@ // | Module | // +--------------------------------------------------+ - amod_stft_destroy(objs->amod_stft_object); + amod_stft_destroy(objs->amod_stft_mics_object); // +--------------------------------------------------+ // | Message | // +--------------------------------------------------+ - amsg_spectra_destroy(objs->amsg_spectra_stft_object); + amsg_spectra_destroy(objs->amsg_spectra_mics_object); - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_spectra_stft_object_count; iSink++) { - - asnk_spectra_destroy(objs->asnk_spectra_stft_objects[iSink]); - - } - - free((void *) objs->asnk_spectra_stft_objects); - // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ - acon_spectra_destroy(objs->acon_spectra_stft_object); + acon_spectra_destroy(objs->acon_spectra_mics_object); // +------------------------------------------------------+ // | SSL | @@ -1858,13 +756,7 @@ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->asnk_pots_ssl_object_count; iSink++) { - - asnk_pots_destroy(objs->asnk_pots_ssl_objects[iSink]); - - } - - free((void *) objs->asnk_pots_ssl_objects); + asnk_pots_destroy(objs->asnk_pots_ssl_object); // +--------------------------------------------------+ // | Connector | @@ -1892,157 +784,14 @@ // | Sinks | // +--------------------------------------------------+ - for (iSink = 0; iSink < objs->asnk_tracks_sst_object_count; iSink++) { - - asnk_tracks_destroy(objs->asnk_tracks_sst_objects[iSink]); - - } - - free((void *) objs->asnk_tracks_sst_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_tracks_destroy(objs->acon_tracks_sst_object); -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sss_destroy(objs->amod_sss_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - amsg_spectra_destroy(objs->amsg_spectra_sss_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_spectra_sss_object_count; iSink++) { - - asnk_spectra_destroy(objs->asnk_spectra_sss_objects[iSink]); - - } - - free((void *) objs->asnk_spectra_sss_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_spectra_destroy(objs->acon_spectra_sss_object); - acon_envs_destroy(objs->acon_envs_sss_object); - - // +------------------------------------------------------+ - // | SSPF | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_sspf_destroy(objs->amod_sspf_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - amsg_spectra_destroy(objs->amsg_spectra_sspf_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_spectra_sspf_object_count; iSink++) { - - asnk_spectra_destroy(objs->asnk_spectra_sspf_objects[iSink]); - - } - - free((void *) objs->asnk_spectra_sspf_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - acon_spectra_destroy(objs->acon_spectra_sspf_object); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_istft_destroy(objs->amod_istft_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - amsg_hops_destroy(objs->amsg_hops_istft_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_istft_object_count; iSink++) { - - asnk_hops_destroy(objs->asnk_hops_istft_objects[iSink]); - - } - - free((void *) objs->asnk_hops_istft_objects); + asnk_tracks_destroy(objs->asnk_tracks_sst_object); // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ - acon_hops_destroy(objs->acon_hops_istft_object); - - // +------------------------------------------------------+ - // | Gain | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - amod_gain_destroy(objs->amod_gain_object); - - // +--------------------------------------------------+ - // | Message | - // +--------------------------------------------------+ - - amsg_hops_destroy(objs->amsg_hops_gain_object); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - for (iSink = 0; iSink < objs->asnk_hops_gain_object_count; iSink++) { - - asnk_hops_destroy(objs->asnk_hops_gain_objects[iSink]); - - } - - free((void *) objs->asnk_hops_gain_objects); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ + acon_tracks_destroy(objs->acon_tracks_sst_object); - acon_hops_destroy(objs->acon_hops_gain_object); -*/ free((void *) objs); } \ No newline at end of file diff --git a/demo/objects.h b/demo/objects.h index 5ccdc3a..93d580b 100644 --- a/demo/objects.h +++ b/demo/objects.h @@ -9,138 +9,72 @@ typedef struct objects { - src_hops_obj * src_hops_raw_object; - msg_hops_obj * msg_hops_raw_object; - unsigned int snk_hops_raw_object_count; - snk_hops_obj ** snk_hops_raw_objects; - con_hops_obj * con_hops_raw_object; - - mod_mapping_obj * mod_mapping_object; - msg_hops_obj * msg_hops_mapping_object; - unsigned int snk_hops_mapping_object_count; - snk_hops_obj ** snk_hops_mapping_objects; - con_hops_obj * con_hops_mapping_object; - - mod_resample_obj * mod_resample_object; - msg_hops_obj * msg_hops_resample_object; - unsigned int snk_hops_resample_object_count; - snk_hops_obj ** snk_hops_resample_objects; - con_hops_obj * con_hops_resample_object; - - mod_stft_obj * mod_stft_object; - msg_spectra_obj * msg_spectra_stft_object; - unsigned int snk_spectra_stft_object_count; - snk_spectra_obj ** snk_spectra_stft_objects; - con_spectra_obj * con_spectra_stft_object; + src_hops_obj * src_hops_mics_object; + msg_hops_obj * msg_hops_mics_raw_object; + snk_hops_obj * snk_hops_mics_raw_object; + con_hops_obj * con_hops_mics_raw_object; + + mod_mapping_obj * mod_mapping_mics_object; + msg_hops_obj * msg_hops_mics_map_object; + snk_hops_obj * snk_hops_mics_map_object; + con_hops_obj * con_hops_mics_map_object; + + mod_resample_obj * mod_resample_mics_object; + msg_hops_obj * msg_hops_mics_rs_object; + snk_hops_obj * snk_hops_mics_rs_object; + con_hops_obj * con_hops_mics_rs_object; + + mod_stft_obj * mod_stft_mics_object; + msg_spectra_obj * msg_spectra_mics_object; + snk_spectra_obj * snk_spectra_mics_object; + con_spectra_obj * con_spectra_mics_object; mod_ssl_obj * mod_ssl_object; msg_pots_obj * msg_pots_ssl_object; - unsigned int snk_pots_ssl_object_count; - snk_pots_obj ** snk_pots_ssl_objects; + snk_pots_obj * snk_pots_ssl_object; con_pots_obj * con_pots_ssl_object; mod_sst_obj * mod_sst_object; msg_tracks_obj * msg_tracks_sst_object; - unsigned int snk_tracks_sst_object_count; - snk_tracks_obj ** snk_tracks_sst_objects; + snk_tracks_obj * snk_tracks_sst_object; con_tracks_obj * con_tracks_sst_object; - /* - mod_sss_obj * mod_sss_object; - msg_spectra_obj * msg_spectra_sss_object; - unsigned int snk_spectra_sss_object_count; - snk_spectra_obj ** snk_spectra_sss_objects; - con_spectra_obj * con_spectra_sss_object; - con_envs_obj * con_envs_sss_object; - - mod_sspf_obj * mod_sspf_object; - msg_spectra_obj * msg_spectra_sspf_object; - unsigned int snk_spectra_sspf_object_count; - snk_spectra_obj ** snk_spectra_sspf_objects; - con_spectra_obj * con_spectra_sspf_object; - - mod_istft_obj * mod_istft_object; - msg_hops_obj * msg_hops_istft_object; - unsigned int snk_hops_istft_object_count; - snk_hops_obj ** snk_hops_istft_objects; - con_hops_obj * con_hops_istft_object; - - mod_gain_obj * mod_gain_object; - msg_hops_obj * msg_hops_gain_object; - unsigned int snk_hops_gain_object_count; - snk_hops_obj ** snk_hops_gain_objects; - con_hops_obj * con_hops_gain_object; - */ - } objects; typedef struct aobjects { unsigned int nMessages; - asrc_hops_obj * asrc_hops_raw_object; - amsg_hops_obj * amsg_hops_raw_object; - unsigned int asnk_hops_raw_object_count; - asnk_hops_obj ** asnk_hops_raw_objects; - acon_hops_obj * acon_hops_raw_object; - - amod_mapping_obj * amod_mapping_object; - amsg_hops_obj * amsg_hops_mapping_object; - unsigned int asnk_hops_mapping_object_count; - asnk_hops_obj ** asnk_hops_mapping_objects; - acon_hops_obj * acon_hops_mapping_object; - - amod_resample_obj * amod_resample_object; - amsg_hops_obj * amsg_hops_resample_object; - unsigned int asnk_hops_resample_object_count; - asnk_hops_obj ** asnk_hops_resample_objects; - acon_hops_obj * acon_hops_resample_object; - - amod_stft_obj * amod_stft_object; - amsg_spectra_obj * amsg_spectra_stft_object; - unsigned int asnk_spectra_stft_object_count; - asnk_spectra_obj ** asnk_spectra_stft_objects; - acon_spectra_obj * acon_spectra_stft_object; + asrc_hops_obj * asrc_hops_mics_object; + amsg_hops_obj * amsg_hops_mics_raw_object; + asnk_hops_obj * asnk_hops_mics_raw_object; + acon_hops_obj * acon_hops_mics_raw_object; + + amod_mapping_obj * amod_mapping_mics_object; + amsg_hops_obj * amsg_hops_mics_map_object; + asnk_hops_obj * asnk_hops_mics_map_objects; + acon_hops_obj * acon_hops_mics_map_object; + + amod_resample_obj * amod_resample_mics_object; + amsg_hops_obj * amsg_hops_mics_rs_object; + asnk_hops_obj * asnk_hops_mics_rs_object; + acon_hops_obj * acon_hops_mics_rs_object; + + amod_stft_obj * amod_stft_mics_object; + amsg_spectra_obj * amsg_spectra_mics_object; + asnk_spectra_obj * asnk_spectra_mics_object; + acon_spectra_obj * acon_spectra_mics_object; amod_ssl_obj * amod_ssl_object; amsg_pots_obj * amsg_pots_ssl_object; - unsigned int asnk_pots_ssl_object_count; - asnk_pots_obj ** asnk_pots_ssl_objects; + asnk_pots_obj * asnk_pots_ssl_object; acon_pots_obj * acon_pots_ssl_object; amod_sst_obj * amod_sst_object; amsg_tracks_obj * amsg_tracks_sst_object; - unsigned int asnk_tracks_sst_object_count; - asnk_tracks_obj ** asnk_tracks_sst_objects; + asnk_tracks_obj * asnk_tracks_sst_object; acon_tracks_obj * acon_tracks_sst_object; - /* - amod_sss_obj * amod_sss_object; - amsg_spectra_obj * amsg_spectra_sss_object; - unsigned int asnk_spectra_sss_object_count; - asnk_spectra_obj ** asnk_spectra_sss_objects; - acon_spectra_obj * acon_spectra_sss_object; - acon_envs_obj * acon_envs_sss_object; - - amod_sspf_obj * amod_sspf_object; - amsg_spectra_obj * amsg_spectra_sspf_object; - unsigned int asnk_spectra_sspf_object_count; - asnk_spectra_obj ** asnk_spectra_sspf_objects; - acon_spectra_obj * acon_spectra_sspf_object; - - amod_istft_obj * amod_istft_object; - amsg_hops_obj * amsg_hops_istft_object; - unsigned int asnk_hops_istft_object_count; - asnk_hops_obj ** asnk_hops_istft_objects; - acon_hops_obj * acon_hops_istft_object; - - amod_gain_obj * amod_gain_object; - amsg_hops_obj * amsg_hops_gain_object; - unsigned int asnk_hops_gain_object_count; - asnk_hops_obj ** asnk_hops_gain_objects; - acon_hops_obj * acon_hops_gain_object; - */ - } aobjects; objects * objects_construct(const configs * cfgs); diff --git a/demo/parameters.c b/demo/parameters.c index e7c240c..6a5587d 100644 --- a/demo/parameters.c +++ b/demo/parameters.c @@ -141,7 +141,7 @@ } - src_hops_cfg * parameters_src_hops_raw_config(const char * fileConfig, const char * fileIOs) { + src_hops_cfg * parameters_src_hops_mics_config(const char * fileConfig) { src_hops_cfg * cfg; char * tmpStr1; @@ -151,35 +151,29 @@ cfg = src_hops_cfg_construct(); - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); - // +----------------------------------------------------------+ // | Format | // +----------------------------------------------------------+ - tmpStr1 = parameters_lookup_string(fileIOs, "input.raw.format"); - - if (strcmp(tmpStr1, "bin08") == 0) { cfg->format = format_construct_bin(8); } - else if (strcmp(tmpStr1, "bin16") == 0) { cfg->format = format_construct_bin(16); } - else if (strcmp(tmpStr1, "bin24") == 0) { cfg->format = format_construct_bin(24); } - else if (strcmp(tmpStr1, "bin32") == 0) { cfg->format = format_construct_bin(32); } - else { printf("Sink hops raw: Invalid format\n"); exit(EXIT_FAILURE); } + tmpInt1 = parameters_lookup_int(fileConfig, "raw.nBits"); - free((void *) tmpStr1); + if ((tmpInt1 == 8) || (tmpInt1 == 16) || (tmpInt1 == 24) || (tmpInt1 == 32)) { + cfg->format = format_construct_binary_int(tmpInt1); + } + else { + printf("raw.nBits: Invalid number of bits\n"); + exit(EXIT_FAILURE); + } // +----------------------------------------------------------+ // | Type | // +----------------------------------------------------------+ - tmpStr1 = parameters_lookup_string(fileIOs, "input.raw.type"); + tmpStr1 = parameters_lookup_string(fileConfig, "raw.interface.type"); if (strcmp(tmpStr1, "file") == 0) { - tmpStr2 = parameters_lookup_string(fileIOs, "input.raw.path"); + tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.path"); cfg->interface = interface_construct_file(tmpStr2); @@ -188,8 +182,8 @@ } else if (strcmp(tmpStr1, "socket") == 0) { - tmpStr2 = parameters_lookup_string(fileIOs, "input.raw.ip"); - tmpInt1 = parameters_lookup_int(fileIOs, "input.raw.port"); + tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "raw.interface.port"); cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); @@ -198,12 +192,16 @@ } else if (strcmp(tmpStr1, "soundcard") == 0) { - tmpInt1 = parameters_lookup_int(fileIOs, "input.raw.card"); - tmpInt2 = parameters_lookup_int(fileIOs, "input.raw.device"); + tmpInt1 = parameters_lookup_int(fileConfig, "raw.interface.card"); + tmpInt2 = parameters_lookup_int(fileConfig, "raw.interface.device"); cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); } + else { + printf("raw.interface.type: Invalid type\n"); + exit(EXIT_FAILURE); + } free((void *) tmpStr1); @@ -211,7 +209,7 @@ } - msg_hops_cfg * parameters_msg_hops_raw_config(const char * fileConfig, const char * fileIOs) { + msg_hops_cfg * parameters_msg_hops_mics_raw_config(const char * fileConfig) { msg_hops_cfg * cfg; @@ -239,111 +237,8 @@ } - unsigned int parameters_snk_hops_raw_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.raw"); - - } - - snk_hops_cfg * parameters_snk_hops_raw_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { - - snk_hops_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_hops_cfg_construct(); - - // +------------------------------------------------------+ - // | Sample rate | - // +------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); - - // +------------------------------------------------------+ - // | Format | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "bin08") == 0) { cfg->format = format_construct_bin(8); } - else if (strcmp(tmpStr1, "bin16") == 0) { cfg->format = format_construct_bin(16); } - else if (strcmp(tmpStr1, "bin24") == 0) { cfg->format = format_construct_bin(24); } - else if (strcmp(tmpStr1, "bin32") == 0) { cfg->format = format_construct_bin(32); } - else { printf("Sink hops raw: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +------------------------------------------------------+ - // | Type | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "soundcard") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].device", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.raw.[%u].subdevice", iSink); - tmpInt2 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - mod_mapping_cfg * parameters_mod_mapping_config(const char * fileConfig, const char * fileIOs) { + mod_mapping_cfg * parameters_mod_mapping_mics_config(const char * fileConfig) { mod_mapping_cfg * cfg; unsigned int nLinks; @@ -372,7 +267,7 @@ } - msg_hops_cfg * parameters_msg_hops_mapping_config(const char * fileConfig, const char * fileIOs) { + msg_hops_cfg * parameters_msg_hops_mics_map_config(const char * fileConfig) { msg_hops_cfg * cfg; @@ -400,131 +295,35 @@ } - unsigned int parameters_snk_hops_mapping_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.mapping"); - - } + mod_resample_cfg * parameters_mod_resample_mics_config(const char * fileConfig) { - snk_hops_cfg * parameters_snk_hops_mapping_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { + mod_resample_cfg * cfg; - snk_hops_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; unsigned int tmpInt1; unsigned int tmpInt2; - cfg = snk_hops_cfg_construct(); - - // +------------------------------------------------------+ - // | Sample rate | - // +------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "raw.fS"); - - // +------------------------------------------------------+ - // | Format | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "bin08") == 0) { cfg->format = format_construct_bin(8); } - else if (strcmp(tmpStr1, "bin16") == 0) { cfg->format = format_construct_bin(16); } - else if (strcmp(tmpStr1, "bin24") == 0) { cfg->format = format_construct_bin(24); } - else if (strcmp(tmpStr1, "bin32") == 0) { cfg->format = format_construct_bin(32); } - else { printf("Sink hops mapping: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +------------------------------------------------------+ - // | Type | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "soundcard") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].device", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.mapping.[%u].subdevice", iSink); - tmpInt2 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_resample_cfg * parameters_mod_resample_config(const char * fileConfig, const char * fileIOs) { - - mod_resample_cfg * cfg; - cfg = mod_resample_cfg_construct(); - unsigned int fSin; - unsigned int fSout; - // +----------------------------------------------------------+ // | Sample rates | // +----------------------------------------------------------+ - cfg->fSin = parameters_lookup_int(fileConfig, "raw.fS"); - cfg->fSout = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + tmpInt1 = parameters_lookup_int(fileConfig, "raw.fS"); + tmpInt2 = parameters_lookup_int(fileConfig, "general.samplerate.mu"); + + if (tmpInt1 < tmpInt2) { + printf("general.samplerate.mu: This sample rate must be smaller or equal to raw.fS"); + exit(EXIT_FAILURE); + } + + cfg->fSin = tmpInt1; + cfg->fSout = tmpInt2; return cfg; } - msg_hops_cfg * parameters_msg_hops_resample_config(const char * fileConfig, const char * fileIOs) { + msg_hops_cfg * parameters_msg_hops_mics_rs_config(const char * fileConfig) { msg_hops_cfg * cfg; @@ -552,111 +351,7 @@ } - unsigned int parameters_snk_hops_resample_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.resample"); - - } - - snk_hops_cfg * parameters_snk_hops_resample_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { - - snk_hops_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_hops_cfg_construct(); - - // +------------------------------------------------------+ - // | Sample rate | - // +------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +------------------------------------------------------+ - // | Format | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "bin08") == 0) { cfg->format = format_construct_bin(8); } - else if (strcmp(tmpStr1, "bin16") == 0) { cfg->format = format_construct_bin(16); } - else if (strcmp(tmpStr1, "bin24") == 0) { cfg->format = format_construct_bin(24); } - else if (strcmp(tmpStr1, "bin32") == 0) { cfg->format = format_construct_bin(32); } - else { printf("Sink hops resample: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +------------------------------------------------------+ - // | Type | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "soundcard") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].device", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.resample.[%u].subdevice", iSink); - tmpInt2 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_stft_cfg * parameters_mod_stft_config(const char * fileConfig, const char * fileIOs) { + mod_stft_cfg * parameters_mod_stft_mics_config(const char * fileConfig) { mod_stft_cfg * cfg; @@ -666,7 +361,7 @@ } - msg_spectra_cfg * parameters_msg_spectra_stft_config(const char * fileConfig, const char * fileIOs) { + msg_spectra_cfg * parameters_msg_spectra_mics_config(const char * fileConfig) { msg_spectra_cfg * cfg; @@ -698,133 +393,47 @@ } - unsigned int parameters_snk_spectra_stft_count(const char * fileConfig, const char * fileIOs) { + mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig) { - return parameters_count(fileIOs, "output.stft"); - - } + mod_ssl_cfg * cfg; - snk_spectra_cfg * parameters_snk_spectra_stft_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { + unsigned int nChannels; + unsigned int iChannel; + unsigned int iSample; + unsigned int iLevel; - snk_spectra_cfg * cfg; - char * tmpStr1; - char * tmpStr2; char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - cfg = snk_spectra_cfg_construct(); + cfg = mod_ssl_cfg_construct(); // +----------------------------------------------------------+ - // | Sample rate | + // | Number of channels | // +----------------------------------------------------------+ - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ + nChannels = parameters_count(fileConfig, "general.mics"); - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.stft.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + cfg->mics = mics_construct_zero(nChannels); - if (strcmp(tmpStr1, "float") == 0) { cfg->format = format_construct_float(); } - else { printf("Sink spectra stft: Invalid format\n"); exit(EXIT_FAILURE); } + for (iChannel = 0; iChannel < nChannels; iChannel++) { - free((void *) tmpStr1); + // +--------------------------------------------------+ + // | Mu | + // +--------------------------------------------------+ - // +----------------------------------------------------------+ - // | Type | - // +----------------------------------------------------------+ + for (iSample = 0; iSample < 3; iSample++) { - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.stft.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpLabel = (char *) malloc(sizeof(char) * 1024); + sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); + cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); + free((void *) tmpLabel); - if (strcmp(tmpStr1, "file") == 0) { + } - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.stft.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + // +--------------------------------------------------+ + // | Sigma2 | + // +--------------------------------------------------+ - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.stft.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.stft.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig, const char * fileIOs) { - - mod_ssl_cfg * cfg; - - unsigned int nChannels; - unsigned int iChannel; - unsigned int iSample; - unsigned int iLevel; - - char * tmpLabel; - - cfg = mod_ssl_cfg_construct(); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - nChannels = parameters_count(fileConfig, "general.mics"); - - cfg->mics = mics_construct_zero(nChannels); - - for (iChannel = 0; iChannel < nChannels; iChannel++) { - - // +--------------------------------------------------+ - // | Mu | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); - cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Sigma2 | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 9; iSample++) { + for (iSample = 0; iSample < 9; iSample++) { tmpLabel = (char *) malloc(sizeof(char) * 1024); sprintf(tmpLabel, "general.mics.[%u].sigma2.[%u]", iChannel, iSample); @@ -937,13 +546,13 @@ // | Number of thetas | // +----------------------------------------------------------+ - cfg->nThetas = parameters_lookup_int(fileConfig, "ssl.nThetas"); + cfg->nThetas = parameters_lookup_int(fileConfig, "general.nThetas"); // +----------------------------------------------------------+ // | Number of thetas | // +----------------------------------------------------------+ - cfg->gainMin = parameters_lookup_float(fileConfig, "ssl.gainMin"); + cfg->gainMin = parameters_lookup_float(fileConfig, "general.gainMin"); // +----------------------------------------------------------+ // | Spatial filter | @@ -961,7 +570,7 @@ } - msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig, const char * fileIOs) { + msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig) { msg_pots_cfg * cfg; @@ -983,13 +592,7 @@ } - unsigned int parameters_snk_pots_ssl_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.ssl"); - - } - - snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { + snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig) { snk_pots_cfg * cfg; char * tmpStr1; @@ -1010,14 +613,11 @@ // | Format | // +----------------------------------------------------------+ - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.ssl.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpStr1 = parameters_lookup_string(fileConfig, "ssl.potential.format"); - if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_json(); } - else if (strcmp(tmpStr1, "float") == 0) { cfg->format = format_construct_float(); } - else { printf("Sink pots: Invalid format\n"); exit(EXIT_FAILURE); } + if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } + else if (strcmp(tmpStr1, "binary") == 0) { cfg->format = format_construct_binary_float(); } + else { printf("ssl.potential.format: Invalid format\n"); exit(EXIT_FAILURE); } free((void *) tmpStr1); @@ -1025,33 +625,24 @@ // | Type | // +----------------------------------------------------------+ - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.ssl.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpStr1 = parameters_lookup_string(fileConfig, "ssl.potential.interface.type"); - if (strcmp(tmpStr1, "file") == 0) { + if (strcmp(tmpStr1, "blackhole") == 0) { - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.ssl.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + cfg->interface = interface_construct_blackhole(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + tmpStr2 = parameters_lookup_string(fileConfig, "ssl.potential.interface.path"); cfg->interface = interface_construct_file(tmpStr2); free((void *) tmpStr2); } else if (strcmp(tmpStr1, "socket") == 0) { - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.ssl.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.ssl.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpStr2 = parameters_lookup_string(fileConfig, "ssl.potential.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "ssl.potential.interface.port"); cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); free((void *) tmpStr2); @@ -1064,7 +655,7 @@ } else { - printf("Invalid type\n"); + printf("ssl.potential.interface.type: Invalid type\n"); exit(EXIT_FAILURE); } @@ -1075,7 +666,7 @@ } - mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig, const char * fileIOs) { + mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig) { mod_sst_cfg * cfg; @@ -1103,7 +694,7 @@ cfg->mode = 'p'; } else { - printf("Invalid filter type.\n"); + printf("sst.mode: Invalid filter type.\n"); exit(EXIT_FAILURE); } @@ -1253,7 +844,7 @@ } - msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig, const char * fileIOs) { + msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig) { msg_tracks_cfg * cfg; @@ -1275,13 +866,7 @@ } - unsigned int parameters_snk_tracks_sst_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.sst"); - - } - - snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { + snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig) { snk_tracks_cfg * cfg; char * tmpStr1; @@ -1302,14 +887,11 @@ // | Format | // +----------------------------------------------------------+ - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sst.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpStr1 = parameters_lookup_string(fileConfig, "sst.tracked.format"); - if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_json(); } - else if (strcmp(tmpStr1, "float") == 0) { cfg->format = format_construct_float(); } - else { printf("Sink tracks: Invalid format\n"); exit(EXIT_FAILURE); } + if (strcmp(tmpStr1, "json") == 0) { cfg->format = format_construct_text_json(); } + else if (strcmp(tmpStr1, "binary") == 0) { cfg->format = format_construct_binary_float(); } + else { printf("sst.tracked.format: Invalid format\n"); exit(EXIT_FAILURE); } free((void *) tmpStr1); @@ -1317,33 +899,24 @@ // | Type | // +----------------------------------------------------------+ - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sst.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpStr1 = parameters_lookup_string(fileConfig, "sst.tracked.interface.type"); - if (strcmp(tmpStr1, "file") == 0) { + if (strcmp(tmpStr1, "blackhole") == 0) { - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sst.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); + cfg->interface = interface_construct_blackhole(); + + } + else if (strcmp(tmpStr1, "file") == 0) { + tmpStr2 = parameters_lookup_string(fileConfig, "sst.tracked.interface.path"); cfg->interface = interface_construct_file(tmpStr2); free((void *) tmpStr2); } else if (strcmp(tmpStr1, "socket") == 0) { - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sst.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sst.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); + tmpStr2 = parameters_lookup_string(fileConfig, "sst.tracked.interface.ip"); + tmpInt1 = parameters_lookup_int(fileConfig, "sst.tracked.interface.port"); cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); free((void *) tmpStr2); @@ -1353,10 +926,10 @@ cfg->interface = interface_construct_terminal(); - } + } else { - printf("Invalid type\n"); + printf("sst.tracked.interface.type: Invalid type\n"); exit(EXIT_FAILURE); } @@ -1368,725 +941,4 @@ } - /* - mod_sss_cfg * parameters_mod_sss_config(const char * fileConfig, const char * fileIOs) { - - mod_sss_cfg * cfg; - - unsigned int nChannels; - unsigned int iChannel; - unsigned int iSample; - unsigned int iLevel; - - char * tmpLabel; - - cfg = mod_sss_cfg_construct(); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - nChannels = parameters_count(fileConfig, "general.mics"); - - cfg->mics = mics_construct_zero(nChannels); - - for (iChannel = 0; iChannel < nChannels; iChannel++) { - - // +--------------------------------------------------+ - // | Mu | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].mu.[%u]", iChannel, iSample); - cfg->mics->mu[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Sigma2 | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 9; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].sigma2.[%u]", iChannel, iSample); - cfg->mics->sigma2[iChannel * 9 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Direction | - // +--------------------------------------------------+ - - for (iSample = 0; iSample < 3; iSample++) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].direction.[%u]", iChannel, iSample); - cfg->mics->direction[iChannel * 3 + iSample] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +--------------------------------------------------+ - // | Angle | - // +--------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 0); - cfg->mics->thetaAllPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "general.mics.[%u].angle.[%u]", iChannel, 1); - cfg->mics->thetaNoPass[iChannel] = parameters_lookup_float(fileConfig, tmpLabel); - free((void *) tmpLabel); - - } - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->samplerate = samplerate_construct_zero(); - - cfg->samplerate->mu = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - cfg->samplerate->sigma2 = parameters_lookup_float(fileConfig, "general.samplerate.sigma2"); - - // +----------------------------------------------------------+ - // | Sound speed | - // +----------------------------------------------------------+ - - cfg->soundspeed = soundspeed_construct_zero(); - - cfg->soundspeed->mu = parameters_lookup_float(fileConfig, "general.speedofsound.mu"); - cfg->soundspeed->sigma2 = parameters_lookup_float(fileConfig, "general.speedofsound.sigma2"); - - // +----------------------------------------------------------+ - // | Spatial filter | - // +----------------------------------------------------------+ - - cfg->spatialfilter = spatialfilter_construct_zero(); - - cfg->spatialfilter->direction[0] = parameters_lookup_float(fileConfig, "general.spatialfilter.direction.[0]"); - cfg->spatialfilter->direction[1] = parameters_lookup_float(fileConfig, "general.spatialfilter.direction.[1]"); - cfg->spatialfilter->direction[2] = parameters_lookup_float(fileConfig, "general.spatialfilter.direction.[2]"); - cfg->spatialfilter->thetaAllPass = parameters_lookup_float(fileConfig, "general.spatialfilter.angle.[0]"); - cfg->spatialfilter->thetaNoPass = parameters_lookup_float(fileConfig, "general.spatialfilter.angle.[1]"); - - // +----------------------------------------------------------+ - // | Directivity | - // +----------------------------------------------------------+ - - cfg->nThetas = parameters_lookup_int(fileConfig, "sss.nThetas"); - cfg->gainMin = parameters_lookup_float(fileConfig, "sss.gainMin"); - - return cfg; - - } - - msg_spectra_cfg * parameters_msg_spectra_sss_config(const char * fileConfig, const char * fileIOs) { - - msg_spectra_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Half Frame Size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - - } - - msg_envs_cfg * parameters_msg_envs_sss_config(const char * fileConfig, const char * fileIOs) { - - msg_envs_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_envs_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Half Frame Size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - unsigned int parameters_snk_spectra_sss_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.sss"); - - } - - snk_spectra_cfg * parameters_snk_spectra_sss_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { - - snk_spectra_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sss.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "float") == 0) { cfg->format = format_construct_float(); } - else { printf("Sink spectra separation: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Type | - // +----------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sss.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sss.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sss.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sss.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_sspf_cfg * parameters_mod_sspf_config(const char * fileConfig, const char * fileIOs) { - - mod_sspf_cfg * cfg; - - unsigned int nChannels; - unsigned int iChannel; - unsigned int iSample; - unsigned int iLevel; - - char * tmpLabel; - - cfg = mod_sspf_cfg_construct(); - - // +----------------------------------------------------------+ - // | alpha | - // +----------------------------------------------------------+ - - cfg->alpha = parameters_lookup_float(fileConfig, "sspf.alpha"); - - // +----------------------------------------------------------+ - // | beta | - // +----------------------------------------------------------+ - - cfg->beta = parameters_lookup_float(fileConfig, "sspf.beta"); - - // +----------------------------------------------------------+ - // | Ginterf | - // +----------------------------------------------------------+ - - cfg->Ginterf = parameters_lookup_float(fileConfig, "sspf.Ginterf"); - - // +----------------------------------------------------------+ - // | Epsilon | - // +----------------------------------------------------------+ - - cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon"); - - - - return cfg; - - } - - msg_spectra_cfg * parameters_msg_spectra_sspf_config(const char * fileConfig, const char * fileIOs) { - - msg_spectra_cfg * cfg; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - cfg = msg_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1; - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - unsigned int parameters_snk_spectra_sspf_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.sspf"); - - } - - snk_spectra_cfg * parameters_snk_spectra_sspf_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { - - snk_spectra_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_spectra_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Format | - // +----------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sspf.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "float") == 0) { cfg->format = format_construct_float(); } - else { printf("Sink spectra postfilter: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +----------------------------------------------------------+ - // | Type | - // +----------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sspf.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sspf.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sspf.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.sspf.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_istft_cfg * parameters_mod_istft_config(const char * fileConfig, const char * fileIOs) { - - mod_istft_cfg * cfg; - - cfg = mod_istft_cfg_construct(); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_istft_config(const char * fileConfig, const char * fileIOs) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - unsigned int parameters_snk_hops_istft_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.istft"); - - } - - snk_hops_cfg * parameters_snk_hops_istft_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { - - snk_hops_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_hops_cfg_construct(); - - // +------------------------------------------------------+ - // | Sample rate | - // +------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +------------------------------------------------------+ - // | Format | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "bin08") == 0) { cfg->format = format_construct_bin(8); } - else if (strcmp(tmpStr1, "bin16") == 0) { cfg->format = format_construct_bin(16); } - else if (strcmp(tmpStr1, "bin24") == 0) { cfg->format = format_construct_bin(24); } - else if (strcmp(tmpStr1, "bin32") == 0) { cfg->format = format_construct_bin(32); } - else { printf("Sink hops ISTFT: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +------------------------------------------------------+ - // | Type | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "soundcard") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].device", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.istft.[%u].subdevice", iSink); - tmpInt2 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - - mod_gain_cfg * parameters_mod_gain_config(const char * fileConfig, const char * fileIOs) { - - mod_gain_cfg * cfg; - - cfg = mod_gain_cfg_construct(); - - // +------------------------------------------------------+ - // | Gain | - // +------------------------------------------------------+ - - cfg->gain = parameters_lookup_float(fileConfig, "playback.volume"); - - return cfg; - - } - - msg_hops_cfg * parameters_msg_hops_gain_config(const char * fileConfig, const char * fileIOs) { - - msg_hops_cfg * cfg; - - cfg = msg_hops_cfg_construct(); - - // +----------------------------------------------------------+ - // | Sample rate | - // +----------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +----------------------------------------------------------+ - // | Hop size | - // +----------------------------------------------------------+ - - cfg->hopSize = parameters_lookup_int(fileConfig, "general.size.hopSize"); - - // +----------------------------------------------------------+ - // | Number of channels | - // +----------------------------------------------------------+ - - cfg->nChannels = parameters_count(fileConfig, "sst.N_inactive"); - - return cfg; - - } - - unsigned int parameters_snk_hops_gain_count(const char * fileConfig, const char * fileIOs) { - - return parameters_count(fileIOs, "output.playback"); - - } - - snk_hops_cfg * parameters_snk_hops_gain_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink) { - - snk_hops_cfg * cfg; - char * tmpStr1; - char * tmpStr2; - char * tmpLabel; - unsigned int tmpInt1; - unsigned int tmpInt2; - - cfg = snk_hops_cfg_construct(); - - // +------------------------------------------------------+ - // | Sample rate | - // +------------------------------------------------------+ - - cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu"); - - // +------------------------------------------------------+ - // | Format | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].format", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "bin08") == 0) { cfg->format = format_construct_bin(8); } - else if (strcmp(tmpStr1, "bin16") == 0) { cfg->format = format_construct_bin(16); } - else if (strcmp(tmpStr1, "bin24") == 0) { cfg->format = format_construct_bin(24); } - else if (strcmp(tmpStr1, "bin32") == 0) { cfg->format = format_construct_bin(32); } - else { printf("Sink hops ISTFT: Invalid format\n"); exit(EXIT_FAILURE); } - - free((void *) tmpStr1); - - // +------------------------------------------------------+ - // | Type | - // +------------------------------------------------------+ - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].type", iSink); - tmpStr1 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - if (strcmp(tmpStr1, "file") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].path", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_file(tmpStr2); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "socket") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].ip", iSink); - tmpStr2 = parameters_lookup_string(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].port", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_socket(tmpStr2, tmpInt1); - free((void *) tmpStr2); - - } - else if (strcmp(tmpStr1, "soundcard") == 0) { - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].device", iSink); - tmpInt1 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - tmpLabel = (char *) malloc(sizeof(char) * 1024); - sprintf(tmpLabel, "output.playback.[%u].subdevice", iSink); - tmpInt2 = parameters_lookup_int(fileIOs, tmpLabel); - free((void *) tmpLabel); - - cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2); - - } - else { - - printf("Invalid type\n"); - exit(EXIT_FAILURE); - - } - - free((void *) tmpStr1); - - return cfg; - - } - */ \ No newline at end of file + \ No newline at end of file diff --git a/demo/parameters.h b/demo/parameters.h index 55b9485..39a92ad 100644 --- a/demo/parameters.h +++ b/demo/parameters.h @@ -13,97 +13,37 @@ unsigned int parameters_count(const char * file, const char * path); - src_hops_cfg * parameters_src_hops_raw_config(const char * fileConfig, const char * fileIOs); + src_hops_cfg * parameters_src_hops_mics_config(const char * fileConfig); - msg_hops_cfg * parameters_msg_hops_raw_config(const char * fileConfig, const char * fileIOs); - - unsigned int parameters_snk_hops_raw_count(const char * fileConfig, const char * fileIOs); - - snk_hops_cfg * parameters_snk_hops_raw_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - - - mod_mapping_cfg * parameters_mod_mapping_config(const char * fileConfig, const char * fileIOs); - - msg_hops_cfg * parameters_msg_hops_mapping_config(const char * fileConfig, const char * fileIOs); - - unsigned int parameters_snk_hops_mapping_count(const char * fileConfig, const char * fileIOs); - - snk_hops_cfg * parameters_snk_hops_mapping_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - - - mod_resample_cfg * parameters_mod_resample_config(const char * fileConfig, const char * fileIOs); - - msg_hops_cfg * parameters_msg_hops_resample_config(const char * fileConfig, const char * fileIOs); - - unsigned int parameters_snk_hops_resample_count(const char * fileConfig, const char * fileIOs); - - snk_hops_cfg * parameters_snk_hops_resample_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - - - mod_stft_cfg * parameters_mod_stft_config(const char * fileConfig, const char * fileIOs); - - msg_spectra_cfg * parameters_msg_spectra_stft_config(const char * fileConfig, const char * fileIOs); - - unsigned int parameters_snk_spectra_stft_count(const char * fileConfig, const char * fileIOs); - - snk_spectra_cfg * parameters_snk_spectra_stft_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - - - mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig, const char * fileIOs); - - msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig, const char * fileIOs); - - unsigned int parameters_snk_pots_ssl_count(const char * fileConfig, const char * fileIOs); - - snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - - - mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig, const char * fileIOs); - - msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig, const char * fileIOs); - - unsigned int parameters_snk_tracks_sst_count(const char * fileConfig, const char * fileIOs); - - snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - - - /* - mod_sss_cfg * parameters_mod_sss_config(const char * fileConfig, const char * fileIOs); - - msg_spectra_cfg * parameters_msg_spectra_sss_config(const char * fileConfig, const char * fileIOs); - - msg_envs_cfg * parameters_msg_envs_sss_config(const char * fileConfig, const char * fileIOs); + msg_hops_cfg * parameters_msg_hops_mics_raw_config(const char * fileConfig); - unsigned int parameters_snk_spectra_sss_count(const char * fileConfig, const char * fileIOs); - snk_spectra_cfg * parameters_snk_spectra_sss_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); + mod_mapping_cfg * parameters_mod_mapping_mics_config(const char * fileConfig); + msg_hops_cfg * parameters_msg_hops_mics_map_config(const char * fileConfig); - mod_sspf_cfg * parameters_mod_sspf_config(const char * fileConfig, const char * fileIOs); - msg_spectra_cfg * parameters_msg_spectra_sspf_config(const char * fileConfig, const char * fileIOs); + mod_resample_cfg * parameters_mod_resample_mics_config(const char * fileConfig); - unsigned int parameters_snk_spectra_sspf_count(const char * fileConfig, const char * fileIOs); + msg_hops_cfg * parameters_msg_hops_mics_rs_config(const char * fileConfig); - snk_spectra_cfg * parameters_snk_spectra_sspf_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); + mod_stft_cfg * parameters_mod_stft_mics_config(const char * fileConfig); - mod_istft_cfg * parameters_mod_istft_config(const char * fileConfig, const char * fileIOs); + msg_spectra_cfg * parameters_msg_spectra_mics_config(const char * fileConfig); - msg_hops_cfg * parameters_msg_hops_istft_config(const char * fileConfig, const char * fileIOs); - unsigned int parameters_snk_hops_istft_count(const char * fileConfig, const char * fileIOs); + mod_ssl_cfg * parameters_mod_ssl_config(const char * fileConfig); - snk_hops_cfg * parameters_snk_hops_istft_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); + msg_pots_cfg * parameters_msg_pots_ssl_config(const char * fileConfig); + snk_pots_cfg * parameters_snk_pots_ssl_config(const char * fileConfig); - mod_gain_cfg * parameters_mod_gain_config(const char * fileConfig, const char * fileIOs); - msg_hops_cfg * parameters_msg_hops_gain_config(const char * fileConfig, const char * fileIOs); + mod_sst_cfg * parameters_mod_sst_config(const char * fileConfig); - unsigned int parameters_snk_hops_gain_count(const char * fileConfig, const char * fileIOs); + msg_tracks_cfg * parameters_msg_tracks_sst_config(const char * fileConfig); - snk_hops_cfg * parameters_snk_hops_gain_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink); - */ + snk_tracks_cfg * parameters_snk_tracks_sst_config(const char * fileConfig); #endif \ No newline at end of file diff --git a/demo/profiler.c b/demo/profiler.c index d94534c..80c0151 100644 --- a/demo/profiler.c +++ b/demo/profiler.c @@ -9,21 +9,17 @@ prf->duration = 0.0f; - prf->src_hops_raw_prf = 0.0f; - prf->con_hops_raw_prf = 0.0f; - prf->snk_hops_raw_prf = 0.0f; + prf->src_hops_mics_prf = 0.0f; + prf->con_hops_mics_raw_prf = 0.0f; - prf->mod_mapping_prf = 0.0f; - prf->con_hops_mapping_prf = 0.0f; - prf->snk_hops_mapping_prf = 0.0f; + prf->mod_mapping_mics_prf = 0.0f; + prf->con_hops_mics_map_prf = 0.0f; - prf->mod_resample_prf = 0.0f; - prf->con_hops_resample_prf = 0.0f; - prf->snk_hops_resample_prf = 0.0f; + prf->mod_resample_mics_prf = 0.0f; + prf->con_hops_mics_rs_prf = 0.0f; - prf->mod_stft_prf = 0.0f; - prf->con_spectra_stft_prf = 0.0f; - prf->snk_spectra_stft_prf = 0.0f; + prf->mod_stft_mics_prf = 0.0f; + prf->con_spectra_mics_prf = 0.0f; prf->mod_ssl_prf = 0.0f; prf->con_pots_ssl_prf = 0.0f; @@ -33,23 +29,6 @@ prf->con_tracks_sst_prf = 0.0f; prf->snk_tracks_sst_prf = 0.0f; - prf->mod_sss_prf = 0.0f; - prf->con_spectra_sss_prf = 0.0f; - prf->con_envs_sss_prf = 0.0f; - prf->snk_spectra_sss_prf = 0.0f; - - prf->mod_sspf_prf = 0.0f; - prf->con_spectra_sspf_prf = 0.0f; - prf->snk_spectra_sspf_prf = 0.0f; - - prf->mod_istft_prf = 0.0f; - prf->con_hops_istft_prf = 0.0f; - prf->snk_hops_istft_prf = 0.0f; - - prf->mod_gain_prf = 0.0f; - prf->con_hops_gain_prf = 0.0f; - prf->snk_hops_gain_prf = 0.0f; - return prf; } @@ -65,40 +44,23 @@ float source, sink, module, connector; float total; - source = prf->src_hops_raw_prf; - - sink = prf->snk_hops_raw_prf + - prf->snk_hops_mapping_prf + - prf->snk_hops_resample_prf + - prf->snk_spectra_stft_prf + - prf->snk_pots_ssl_prf + - prf->snk_tracks_sst_prf + - prf->snk_spectra_sss_prf + - prf->snk_spectra_sspf_prf + - prf->snk_hops_istft_prf + - prf->snk_hops_gain_prf; - - module = prf->mod_mapping_prf + - prf->mod_resample_prf + - prf->mod_stft_prf + + source = prf->src_hops_mics_prf; + + sink = prf->snk_pots_ssl_prf + + prf->snk_tracks_sst_prf; + + module = prf->mod_mapping_mics_prf + + prf->mod_resample_mics_prf + + prf->mod_stft_mics_prf + prf->mod_ssl_prf + - prf->mod_sst_prf + - prf->mod_sss_prf + - prf->mod_sspf_prf + - prf->mod_istft_prf + - prf->mod_gain_prf; - - connector = prf->con_hops_raw_prf + - prf->con_hops_mapping_prf + - prf->con_hops_resample_prf + - prf->con_spectra_stft_prf + + prf->mod_sst_prf; + + connector = prf->con_hops_mics_raw_prf + + prf->con_hops_mics_map_prf + + prf->con_hops_mics_rs_prf + + prf->con_spectra_mics_prf + prf->con_pots_ssl_prf + - prf->con_tracks_sst_prf + - prf->con_spectra_sss_prf + - prf->con_envs_sss_prf + - prf->con_spectra_sspf_prf + - prf->con_hops_istft_prf + - prf->con_hops_gain_prf; + prf->con_tracks_sst_prf; total = source + sink + module + connector; @@ -106,21 +68,17 @@ printf("| Profiler summary |\n"); printf("+--------------------------------------------+\n"); printf("| + Raw |\n"); - printf("| - Source.......... %07.3f (%06.2f%%) |\n",prf->src_hops_raw_prf,roundf(10000.0f * prf->src_hops_raw_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_raw_prf,roundf(10000.0f * prf->con_hops_raw_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_hops_raw_prf,roundf(10000.0f * prf->snk_hops_raw_prf / prf->duration) / 100.0f); + printf("| - Source.......... %07.3f (%06.2f%%) |\n",prf->src_hops_mics_prf,roundf(10000.0f * prf->src_hops_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_raw_prf,roundf(10000.0f * prf->con_hops_mics_raw_prf / prf->duration) / 100.0f); printf("| + Mapping |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_mapping_prf,roundf(10000.0f * prf->mod_mapping_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mapping_prf,roundf(10000.0f * prf->con_hops_mapping_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_hops_mapping_prf,roundf(10000.0f * prf->snk_hops_mapping_prf / prf->duration) / 100.0f); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_mapping_mics_prf,roundf(10000.0f * prf->mod_mapping_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_map_prf,roundf(10000.0f * prf->con_hops_mics_map_prf / prf->duration) / 100.0f); printf("| + Resample |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_resample_prf,roundf(10000.0f * prf->mod_resample_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_resample_prf,roundf(10000.0f * prf->con_hops_resample_prf / prf->duration)); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_hops_resample_prf,roundf(10000.0f * prf->snk_hops_resample_prf / prf->duration)); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_resample_mics_prf,roundf(10000.0f * prf->mod_resample_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_mics_rs_prf,roundf(10000.0f * prf->con_hops_mics_rs_prf / prf->duration)); printf("| + STFT |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_stft_prf,roundf(10000.0f * prf->mod_stft_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_spectra_stft_prf,roundf(10000.0f * prf->con_spectra_stft_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_spectra_stft_prf,roundf(10000.0f * prf->snk_spectra_stft_prf / prf->duration) / 100.0f); + printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_stft_mics_prf,roundf(10000.0f * prf->mod_stft_mics_prf / prf->duration) / 100.0f); + printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_spectra_mics_prf,roundf(10000.0f * prf->con_spectra_mics_prf / prf->duration) / 100.0f); printf("| + SSL |\n"); printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_ssl_prf,roundf(10000.0f * prf->mod_ssl_prf / prf->duration) / 100.0f); printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_pots_ssl_prf,roundf(10000.0f * prf->con_pots_ssl_prf / prf->duration) / 100.0f); @@ -128,23 +86,7 @@ printf("| + SST |\n"); printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sst_prf,roundf(10000.0f * prf->mod_sst_prf / prf->duration) / 100.0f); printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_tracks_sst_prf,roundf(10000.0f * prf->con_tracks_sst_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_tracks_sst_prf,roundf(10000.0f * prf->snk_tracks_sst_prf / prf->duration) / 100.0f); -/* printf("| + SSS |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sss_prf,roundf(10000.0f * prf->mod_sss_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_spectra_sss_prf,roundf(10000.0f * prf->con_spectra_sss_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_spectra_sss_prf,roundf(10000.0f * prf->snk_spectra_sss_prf / prf->duration) / 100.0f); - printf("| + SSPF |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_sspf_prf,roundf(10000.0f * prf->mod_sspf_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_spectra_sspf_prf,roundf(10000.0f * prf->con_spectra_sspf_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_spectra_sspf_prf,roundf(10000.0f * prf->snk_spectra_sspf_prf / prf->duration) / 100.0f); - printf("| + ISTFT |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_istft_prf,roundf(10000.0f * prf->mod_istft_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_istft_prf,roundf(10000.0f * prf->con_hops_istft_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_hops_istft_prf,roundf(10000.0f * prf->snk_hops_istft_prf / prf->duration) / 100.0f); - printf("| + Playback |\n"); - printf("| - Module.......... %07.3f (%06.2f%%) |\n",prf->mod_gain_prf,roundf(10000.0f * prf->mod_gain_prf / prf->duration) / 100.0f); - printf("| - Connector....... %07.3f (%06.2f%%) |\n",prf->con_hops_gain_prf,roundf(10000.0f * prf->con_hops_gain_prf / prf->duration) / 100.0f); - printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_hops_gain_prf,roundf(10000.0f * prf->snk_hops_gain_prf / prf->duration) / 100.0f);*/ + printf("| - Sink............ %07.3f (%06.2f%%) |\n",prf->snk_tracks_sst_prf,roundf(10000.0f * prf->snk_tracks_sst_prf / prf->duration) / 100.0f); printf("+--------------------------------------------+\n"); printf("| + TOTAL.............. %07.3f (%06.2f%%) |\n",total,roundf(10000.0f * total / prf->duration) / 100.0f); printf("| - Module.......... %07.3f (%06.2f%%) |\n",module,roundf(10000.0f * module / prf->duration) / 100.0f); diff --git a/demo/profiler.h b/demo/profiler.h index b273aa1..9c03933 100644 --- a/demo/profiler.h +++ b/demo/profiler.h @@ -9,21 +9,17 @@ float duration; - float src_hops_raw_prf; - float con_hops_raw_prf; - float snk_hops_raw_prf; + float src_hops_mics_prf; + float con_hops_mics_raw_prf; - float mod_mapping_prf; - float con_hops_mapping_prf; - float snk_hops_mapping_prf; + float mod_mapping_mics_prf; + float con_hops_mics_map_prf; - float mod_resample_prf; - float con_hops_resample_prf; - float snk_hops_resample_prf; + float mod_resample_mics_prf; + float con_hops_mics_rs_prf; - float mod_stft_prf; - float con_spectra_stft_prf; - float snk_spectra_stft_prf; + float mod_stft_mics_prf; + float con_spectra_mics_prf; float mod_ssl_prf; float con_pots_ssl_prf; @@ -33,23 +29,6 @@ float con_tracks_sst_prf; float snk_tracks_sst_prf; - float mod_sss_prf; - float con_spectra_sss_prf; - float con_envs_sss_prf; - float snk_spectra_sss_prf; - - float mod_sspf_prf; - float con_spectra_sspf_prf; - float snk_spectra_sspf_prf; - - float mod_istft_prf; - float con_hops_istft_prf; - float snk_hops_istft_prf; - - float mod_gain_prf; - float con_hops_gain_prf; - float snk_hops_gain_prf; - } profiler; profiler * profiler_construct(void); diff --git a/demo/threads.c b/demo/threads.c index 2fbbee5..efc934c 100644 --- a/demo/threads.c +++ b/demo/threads.c @@ -13,21 +13,13 @@ // | Source | // +------------------------------------------------------+ - thread_start(aobjs->asrc_hops_raw_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_raw_object_count; iSink++) { - thread_start(aobjs->asnk_hops_raw_objects[iSink]->thread); - } + thread_start(aobjs->asrc_hops_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_start(aobjs->acon_hops_raw_object->thread); + thread_start(aobjs->acon_hops_mics_raw_object->thread); // +----------------------------------------------------------+ // | Mapping | @@ -37,21 +29,13 @@ // | Module | // +------------------------------------------------------+ - thread_start(aobjs->amod_mapping_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_mapping_object_count; iSink++) { - thread_start(aobjs->asnk_hops_mapping_objects[iSink]->thread); - } + thread_start(aobjs->amod_mapping_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_start(aobjs->acon_hops_mapping_object->thread); + thread_start(aobjs->acon_hops_mics_map_object->thread); // +----------------------------------------------------------+ // | Resample | @@ -61,21 +45,13 @@ // | Module | // +------------------------------------------------------+ - thread_start(aobjs->amod_resample_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_resample_object_count; iSink++) { - thread_start(aobjs->asnk_hops_resample_objects[iSink]->thread); - } + thread_start(aobjs->amod_resample_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_start(aobjs->acon_hops_resample_object->thread); + thread_start(aobjs->acon_hops_mics_rs_object->thread); // +----------------------------------------------------------+ // | STFT | @@ -85,21 +61,13 @@ // | Module | // +------------------------------------------------------+ - thread_start(aobjs->amod_stft_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_spectra_stft_object_count; iSink++) { - thread_start(aobjs->asnk_spectra_stft_objects[iSink]->thread); - } + thread_start(aobjs->amod_stft_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_start(aobjs->acon_spectra_stft_object->thread); + thread_start(aobjs->acon_spectra_mics_object->thread); // +----------------------------------------------------------+ // | SSL | @@ -115,9 +83,7 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < aobjs->asnk_pots_ssl_object_count; iSink++) { - thread_start(aobjs->asnk_pots_ssl_objects[iSink]->thread); - } + thread_start(aobjs->asnk_pots_ssl_object->thread); // +------------------------------------------------------+ // | Connector | @@ -139,113 +105,14 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < aobjs->asnk_tracks_sst_object_count; iSink++) { - thread_start(aobjs->asnk_tracks_sst_objects[iSink]->thread); - } + thread_start(aobjs->asnk_tracks_sst_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ thread_start(aobjs->acon_tracks_sst_object->thread); -/* - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_sss_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_spectra_sss_object_count; iSink++) { - thread_start(aobjs->asnk_spectra_sss_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_spectra_sss_object->thread); - thread_start(aobjs->acon_envs_sss_object->thread); - - // +----------------------------------------------------------+ - // | SSPF | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_sspf_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_spectra_sspf_object_count; iSink++) { - thread_start(aobjs->asnk_spectra_sspf_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_spectra_sspf_object->thread); - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_istft_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_istft_object_count; iSink++) { - thread_start(aobjs->asnk_hops_istft_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_hops_istft_object->thread); - - // +----------------------------------------------------------+ - // | Gain | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_start(aobjs->amod_gain_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_gain_object_count; iSink++) { - thread_start(aobjs->asnk_hops_gain_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_start(aobjs->acon_hops_gain_object->thread); -*/ } void threads_multiple_stop(aobjects * aobjs) { @@ -258,7 +125,7 @@ // | Source | // +------------------------------------------------------+ - thread_stop(aobjs->asrc_hops_raw_object->thread); + thread_stop(aobjs->asrc_hops_mics_object->thread); // Stops the source that generate frames to process. // This will generate a "zero" message that will stop @@ -278,21 +145,13 @@ // | Source | // +------------------------------------------------------+ - thread_join(aobjs->asrc_hops_raw_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_raw_object_count; iSink++) { - thread_join(aobjs->asnk_hops_raw_objects[iSink]->thread); - } + thread_join(aobjs->asrc_hops_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_join(aobjs->acon_hops_raw_object->thread); + thread_join(aobjs->acon_hops_mics_raw_object->thread); // +----------------------------------------------------------+ // | Mapping | @@ -302,21 +161,13 @@ // | Module | // +------------------------------------------------------+ - thread_join(aobjs->amod_mapping_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_mapping_object_count; iSink++) { - thread_join(aobjs->asnk_hops_mapping_objects[iSink]->thread); - } + thread_join(aobjs->amod_mapping_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_join(aobjs->acon_hops_mapping_object->thread); + thread_join(aobjs->acon_hops_mics_map_object->thread); // +----------------------------------------------------------+ // | Resample | @@ -326,21 +177,13 @@ // | Module | // +------------------------------------------------------+ - thread_join(aobjs->amod_resample_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_resample_object_count; iSink++) { - thread_join(aobjs->asnk_hops_resample_objects[iSink]->thread); - } + thread_join(aobjs->amod_resample_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_join(aobjs->acon_hops_resample_object->thread); + thread_join(aobjs->acon_hops_mics_rs_object->thread); // +----------------------------------------------------------+ // | STFT | @@ -350,21 +193,13 @@ // | Module | // +------------------------------------------------------+ - thread_join(aobjs->amod_stft_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_spectra_stft_object_count; iSink++) { - thread_join(aobjs->asnk_spectra_stft_objects[iSink]->thread); - } + thread_join(aobjs->amod_stft_mics_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ - thread_join(aobjs->acon_spectra_stft_object->thread); + thread_join(aobjs->acon_spectra_mics_object->thread); // +----------------------------------------------------------+ // | SSL | @@ -380,9 +215,7 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < aobjs->asnk_pots_ssl_object_count; iSink++) { - thread_join(aobjs->asnk_pots_ssl_objects[iSink]->thread); - } + thread_join(aobjs->asnk_pots_ssl_object->thread); // +------------------------------------------------------+ // | Connector | @@ -404,113 +237,14 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < aobjs->asnk_tracks_sst_object_count; iSink++) { - thread_join(aobjs->asnk_tracks_sst_objects[iSink]->thread); - } + thread_join(aobjs->asnk_tracks_sst_object->thread); // +------------------------------------------------------+ // | Connector | // +------------------------------------------------------+ thread_join(aobjs->acon_tracks_sst_object->thread); -/* - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_sss_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_spectra_sss_object_count; iSink++) { - thread_join(aobjs->asnk_spectra_sss_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_spectra_sss_object->thread); - thread_join(aobjs->acon_envs_sss_object->thread); - - // +----------------------------------------------------------+ - // | SSPF | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_sspf_object->thread); - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_spectra_sspf_object_count; iSink++) { - thread_join(aobjs->asnk_spectra_sspf_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_spectra_sspf_object->thread); - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_istft_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_istft_object_count; iSink++) { - thread_join(aobjs->asnk_hops_istft_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_hops_istft_object->thread); - - // +----------------------------------------------------------+ - // | Gain | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Module | - // +------------------------------------------------------+ - - thread_join(aobjs->amod_gain_object->thread); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < aobjs->asnk_hops_gain_object_count; iSink++) { - thread_join(aobjs->asnk_hops_gain_objects[iSink]->thread); - } - - // +------------------------------------------------------+ - // | Connector | - // +------------------------------------------------------+ - - thread_join(aobjs->acon_hops_gain_object->thread); -*/ } void threads_single_open(objects * objs) { @@ -525,51 +259,7 @@ // | Source | // +------------------------------------------------------+ - src_hops_open(objs->src_hops_raw_object); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) { - snk_hops_open(objs->snk_hops_raw_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | Mapping | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) { - snk_hops_open(objs->snk_hops_mapping_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) { - snk_hops_open(objs->snk_hops_resample_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) { - snk_spectra_open(objs->snk_spectra_stft_objects[iSink]); - } + src_hops_open(objs->src_hops_mics_object); // +----------------------------------------------------------+ // | SSL | @@ -579,9 +269,7 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) { - snk_pots_open(objs->snk_pots_ssl_objects[iSink]); - } + snk_pots_open(objs->snk_pots_ssl_object); // +----------------------------------------------------------+ // | SST | @@ -591,58 +279,8 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) { - snk_tracks_open(objs->snk_tracks_sst_objects[iSink]); - } -/* - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) { - snk_spectra_open(objs->snk_spectra_sss_objects[iSink]); - } + snk_tracks_open(objs->snk_tracks_sst_object); - // +----------------------------------------------------------+ - // | SSPF | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) { - snk_spectra_open(objs->snk_spectra_sspf_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_istft_object_count; iSink++) { - snk_hops_open(objs->snk_hops_istft_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | Gain | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_gain_object_count; iSink++) { - snk_hops_open(objs->snk_hops_gain_objects[iSink]); - } -*/ } void threads_single_close(objects * objs) { @@ -657,51 +295,7 @@ // | Source | // +------------------------------------------------------+ - src_hops_close(objs->src_hops_raw_object); - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) { - snk_hops_close(objs->snk_hops_raw_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | Mapping | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) { - snk_hops_close(objs->snk_hops_mapping_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | Resample | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) { - snk_hops_close(objs->snk_hops_resample_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | STFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) { - snk_spectra_close(objs->snk_spectra_stft_objects[iSink]); - } + src_hops_close(objs->src_hops_mics_object); // +----------------------------------------------------------+ // | SSL | @@ -711,9 +305,7 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) { - snk_pots_close(objs->snk_pots_ssl_objects[iSink]); - } + snk_pots_close(objs->snk_pots_ssl_object); // +----------------------------------------------------------+ // | SST | @@ -723,58 +315,8 @@ // | Sinks | // +------------------------------------------------------+ - for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) { - snk_tracks_close(objs->snk_tracks_sst_objects[iSink]); - } -/* - // +----------------------------------------------------------+ - // | SSS | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) { - snk_spectra_close(objs->snk_spectra_sss_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | SSPF | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ + snk_tracks_close(objs->snk_tracks_sst_object); - for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) { - snk_spectra_close(objs->snk_spectra_sspf_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | ISTFT | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_istft_object_count; iSink++) { - snk_hops_close(objs->snk_hops_istft_objects[iSink]); - } - - // +----------------------------------------------------------+ - // | Gain | - // +----------------------------------------------------------+ - - // +------------------------------------------------------+ - // | Sinks | - // +------------------------------------------------------+ - - for (iSink = 0; iSink < objs->snk_hops_gain_object_count; iSink++) { - snk_hops_close(objs->snk_hops_gain_objects[iSink]); - } -*/ } int threads_single_process(objects * objs, profiler * prf) { @@ -785,7 +327,7 @@ clock_t begin, end; - prf->duration += ((float) (objs->src_hops_raw_object->hopSize)) / ((float) (objs->src_hops_raw_object->fS)); + prf->duration += ((float) (objs->src_hops_mics_object->hopSize)) / ((float) (objs->src_hops_mics_object->fS)); // +----------------------------------------------------------+ // | SECTION I | @@ -800,31 +342,18 @@ // +--------------------------------------------------+ begin = clock(); - rtnValue = src_hops_process(objs->src_hops_raw_object); + rtnValue = src_hops_process(objs->src_hops_mics_object); end = clock(); - prf->src_hops_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->src_hops_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ begin = clock(); - con_hops_process(objs->con_hops_raw_object); - end = clock(); - prf->con_hops_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) { - - snk_hops_process(objs->snk_hops_raw_objects[iSink]); - - } + con_hops_process(objs->con_hops_mics_raw_object); end = clock(); - prf->snk_hops_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->con_hops_mics_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +------------------------------------------------------+ // | Mapping | @@ -835,29 +364,18 @@ // +--------------------------------------------------+ begin = clock(); - mod_mapping_process(objs->mod_mapping_object); + mod_mapping_process(objs->mod_mapping_mics_object); end = clock(); - prf->mod_mapping_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->mod_mapping_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ begin = clock(); - con_hops_process(objs->con_hops_mapping_object); + con_hops_process(objs->con_hops_mics_map_object); end = clock(); - prf->con_hops_mapping_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) { - snk_hops_process(objs->snk_hops_mapping_objects[iSink]); - } - end = clock(); - prf->snk_hops_mapping_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->con_hops_mics_map_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +------------------------------------------------------+ // | Resample | @@ -868,9 +386,9 @@ // +--------------------------------------------------+ begin = clock(); - mod_resample_process_push(objs->mod_resample_object); + mod_resample_process_push(objs->mod_resample_mics_object); end = clock(); - prf->mod_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->mod_resample_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +----------------------------------------------------------+ // | SECTION II | @@ -888,9 +406,9 @@ // +--------------------------------------------------+ begin = clock(); - rtnResample = mod_resample_process_pop(objs->mod_resample_object); + rtnResample = mod_resample_process_pop(objs->mod_resample_mics_object); end = clock(); - prf->mod_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->mod_resample_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // If there is no frames to process, stop if (rtnResample == -1) { @@ -902,20 +420,9 @@ // +--------------------------------------------------+ begin = clock(); - con_hops_process(objs->con_hops_resample_object); + con_hops_process(objs->con_hops_mics_rs_object); end = clock(); - prf->con_hops_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) { - snk_hops_process(objs->snk_hops_resample_objects[iSink]); - } - end = clock(); - prf->snk_hops_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->con_hops_mics_rs_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +------------------------------------------------------+ // | STFT | @@ -926,29 +433,18 @@ // +--------------------------------------------------+ begin = clock(); - mod_stft_process(objs->mod_stft_object); + mod_stft_process(objs->mod_stft_mics_object); end = clock(); - prf->mod_stft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->mod_stft_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +--------------------------------------------------+ // | Connector | // +--------------------------------------------------+ begin = clock(); - con_spectra_process(objs->con_spectra_stft_object); - end = clock(); - prf->con_spectra_stft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) { - snk_spectra_process(objs->snk_spectra_stft_objects[iSink]); - } + con_spectra_process(objs->con_spectra_mics_object); end = clock(); - prf->snk_spectra_stft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); + prf->con_spectra_mics_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); // +------------------------------------------------------+ // | SSL | @@ -977,9 +473,7 @@ // +--------------------------------------------------+ begin = clock(); - for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) { - snk_pots_process(objs->snk_pots_ssl_objects[iSink]); - } + snk_pots_process(objs->snk_pots_ssl_object); end = clock(); prf->snk_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); @@ -1010,149 +504,10 @@ // +--------------------------------------------------+ begin = clock(); - for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) { - snk_tracks_process(objs->snk_tracks_sst_objects[iSink]); - } + snk_tracks_process(objs->snk_tracks_sst_object); end = clock(); prf->snk_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); -/* - // +------------------------------------------------------+ - // | SSS | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_sss_process(objs->mod_sss_object); - end = clock(); - prf->mod_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_spectra_process(objs->con_spectra_sss_object); - end = clock(); - prf->con_spectra_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - begin = clock(); - con_envs_process(objs->con_envs_sss_object); - end = clock(); - prf->con_envs_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) { - snk_spectra_process(objs->snk_spectra_sss_objects[iSink]); - } - end = clock(); - prf->snk_spectra_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | SSPF | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_sspf_process(objs->mod_sspf_object); - end = clock(); - prf->mod_sspf_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_spectra_process(objs->con_spectra_sspf_object); - end = clock(); - prf->con_spectra_sspf_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) { - snk_spectra_process(objs->snk_spectra_sspf_objects[iSink]); - } - end = clock(); - prf->snk_spectra_sspf_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | ISTFT | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_istft_process(objs->mod_istft_object); - end = clock(); - prf->mod_istft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_istft_object); - end = clock(); - prf->con_hops_istft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_hops_istft_object_count; iSink++) { - snk_hops_process(objs->snk_hops_istft_objects[iSink]); - } - end = clock(); - prf->snk_hops_istft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +------------------------------------------------------+ - // | Gain | - // +------------------------------------------------------+ - - // +--------------------------------------------------+ - // | Module | - // +--------------------------------------------------+ - - begin = clock(); - mod_gain_process(objs->mod_gain_object); - end = clock(); - prf->mod_gain_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Connector | - // +--------------------------------------------------+ - - begin = clock(); - con_hops_process(objs->con_hops_gain_object); - end = clock(); - prf->con_hops_gain_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); - - // +--------------------------------------------------+ - // | Sinks | - // +--------------------------------------------------+ - - begin = clock(); - for (iSink = 0; iSink < objs->snk_hops_gain_object_count; iSink++) { - snk_hops_process(objs->snk_hops_gain_objects[iSink]); - } - end = clock(); - prf->snk_hops_gain_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC); -*/ } return rtnValue; diff --git a/include/odas/odas.h b/include/odas/odas.h index 2ff8197..2518eae 100644 --- a/include/odas/odas.h +++ b/include/odas/odas.h @@ -1,10 +1,8 @@ - #include "../../src/connector/con_envs.h" #include "../../src/connector/con_hops.h" #include "../../src/connector/con_pots.h" #include "../../src/connector/con_spectra.h" #include "../../src/connector/con_tracks.h" - #include "../../src/message/msg_envs.h" #include "../../src/message/msg_hops.h" #include "../../src/message/msg_pots.h" #include "../../src/message/msg_spectra.h" @@ -14,8 +12,6 @@ #include "../../src/module/mod_mapping.h" #include "../../src/module/mod_resample.h" #include "../../src/module/mod_ssl.h" - #include "../../src/module/mod_sspf.h" - #include "../../src/module/mod_sss.h" #include "../../src/module/mod_sst.h" #include "../../src/module/mod_stft.h" #include "../../src/sink/snk_hops.h" @@ -24,12 +20,10 @@ #include "../../src/sink/snk_tracks.h" #include "../../src/source/src_hops.h" - #include "../../src/aconnector/acon_envs.h" #include "../../src/aconnector/acon_hops.h" #include "../../src/aconnector/acon_pots.h" #include "../../src/aconnector/acon_spectra.h" #include "../../src/aconnector/acon_tracks.h" - #include "../../src/amessage/amsg_envs.h" #include "../../src/amessage/amsg_hops.h" #include "../../src/amessage/amsg_pots.h" #include "../../src/amessage/amsg_spectra.h" @@ -39,8 +33,6 @@ #include "../../src/amodule/amod_mapping.h" #include "../../src/amodule/amod_resample.h" #include "../../src/amodule/amod_ssl.h" - #include "../../src/amodule/amod_sspf.h" - #include "../../src/amodule/amod_sss.h" #include "../../src/amodule/amod_sst.h" #include "../../src/amodule/amod_stft.h" #include "../../src/asink/asnk_hops.h" diff --git a/src/aconnector/acon_envs.c b/src/aconnector/acon_envs.c deleted file mode 100644 index 95bce71..0000000 --- a/src/aconnector/acon_envs.c +++ /dev/null @@ -1,85 +0,0 @@ - - #include "acon_envs.h" - - acon_envs_obj * acon_envs_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_envs_cfg * msg_envs_config) { - - acon_envs_obj * obj; - unsigned int iOut; - - obj = (acon_envs_obj *) malloc(sizeof(acon_envs_obj)); - - obj->in = amsg_envs_construct(nMessages, msg_envs_config); - - obj->outs = (amsg_envs_obj **) malloc(sizeof(amsg_envs_obj *) * nOuts); - for (iOut = 0; iOut < nOuts; iOut++) { - obj->outs[iOut] = amsg_envs_construct(nMessages, msg_envs_config); - } - - obj->con_envs = con_envs_construct(nOuts, msg_envs_config); - - obj->thread = thread_construct(&acon_envs_thread, (void *) obj); - - return obj; - - } - - void acon_envs_destroy(acon_envs_obj * obj) { - - unsigned int iOut; - unsigned int nOuts; - - nOuts = obj->con_envs->nOuts; - - thread_destroy(obj->thread); - - con_envs_destroy(obj->con_envs); - - for (iOut = 0; iOut < nOuts; iOut++) { - amsg_envs_destroy(obj->outs[iOut]); - } - free((void *) obj->outs); - - amsg_envs_destroy(obj->in); - - free((void *) obj); - - - } - - void * acon_envs_thread(void * ptr) { - - msg_envs_obj * msg_envs_in; - msg_envs_obj * msg_envs_out; - - acon_envs_obj * obj; - unsigned int iOut; - unsigned int nOuts; - int rtnValue; - - obj = (acon_envs_obj *) ptr; - - nOuts = obj->con_envs->nOuts; - - while(1) { - - msg_envs_in = amsg_envs_filled_pop(obj->in); - msg_envs_copy(obj->con_envs->in, msg_envs_in); - amsg_envs_empty_push(obj->in, msg_envs_in); - - rtnValue = con_envs_process(obj->con_envs); - - for (iOut = 0; iOut < nOuts; iOut++) { - - msg_envs_out = amsg_envs_empty_pop(obj->outs[iOut]); - msg_envs_copy(msg_envs_out, obj->con_envs->outs[iOut]); - amsg_envs_filled_push(obj->outs[iOut], msg_envs_out); - - } - - if (rtnValue == -1) { - break; - } - - } - - } \ No newline at end of file diff --git a/src/aconnector/acon_envs.h b/src/aconnector/acon_envs.h deleted file mode 100644 index 3cf076c..0000000 --- a/src/aconnector/acon_envs.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __ODAS_ACONNECTOR_ENVS -#define __ODAS_ACONNECTOR_ENVS - - #include "../connector/con_envs.h" - #include "../amessage/amsg_envs.h" - #include "../message/msg_envs.h" - #include "../general/thread.h" - - #include - #include - - typedef struct acon_envs_obj { - - amsg_envs_obj * in; - amsg_envs_obj ** outs; - con_envs_obj * con_envs; - thread_obj * thread; - - } acon_envs_obj; - - acon_envs_obj * acon_envs_construct(const unsigned int nOuts, const unsigned int nMessages, const msg_envs_cfg * msg_envs_config); - - void acon_envs_destroy(acon_envs_obj * obj); - - void * acon_envs_thread(void * ptr); - -#endif \ No newline at end of file diff --git a/src/amessage/amsg_envs.c b/src/amessage/amsg_envs.c deleted file mode 100644 index 96f1747..0000000 --- a/src/amessage/amsg_envs.c +++ /dev/null @@ -1,64 +0,0 @@ - - #include "amsg_envs.h" - - amsg_envs_obj * amsg_envs_construct(const unsigned int nMessages, const msg_envs_cfg * msg_envs_config) { - - amsg_envs_obj * obj; - unsigned int iMessage; - - obj = (amsg_envs_obj *) malloc(sizeof(amsg_envs_obj)); - - obj->nMessages = nMessages; - obj->filled = fifo_construct_zero(nMessages); - obj->empty = fifo_construct_zero(nMessages); - - for (iMessage = 0; iMessage < nMessages; iMessage++) { - - fifo_push(obj->empty, (void *) msg_envs_construct(msg_envs_config)); - - } - - return obj; - - } - - void amsg_envs_destroy(amsg_envs_obj * obj) { - - while(fifo_nElements(obj->filled) > 0) { - msg_envs_destroy((void *) fifo_pop(obj->filled)); - } - - while(fifo_nElements(obj->empty) > 0) { - msg_envs_destroy((void *) fifo_pop(obj->empty)); - } - - fifo_destroy(obj->filled); - fifo_destroy(obj->empty); - - free((void *) obj); - - } - - msg_envs_obj * amsg_envs_filled_pop(amsg_envs_obj * obj) { - - return ((msg_envs_obj *) fifo_pop(obj->filled)); - - } - - void amsg_envs_filled_push(amsg_envs_obj * obj, msg_envs_obj * msg_envs) { - - fifo_push(obj->filled, (void *) msg_envs); - - } - - msg_envs_obj * amsg_envs_empty_pop(amsg_envs_obj * obj) { - - return ((msg_envs_obj *) fifo_pop(obj->empty)); - - } - - void amsg_envs_empty_push(amsg_envs_obj * obj, msg_envs_obj * msg_envs) { - - fifo_push(obj->empty, (void *) msg_envs); - - } \ No newline at end of file diff --git a/src/amessage/amsg_envs.h b/src/amessage/amsg_envs.h deleted file mode 100644 index 686a3ff..0000000 --- a/src/amessage/amsg_envs.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ODAS_AMESSAGE_ENVS -#define __ODAS_AMESSAGE_ENVS - - #include - - #include "../message/msg_envs.h" - #include "../utils/fifo.h" - - typedef struct amsg_envs_obj { - - unsigned int nMessages; - fifo_obj * filled; - fifo_obj * empty; - - } amsg_envs_obj; - - amsg_envs_obj * amsg_envs_construct(const unsigned int nMessages, const msg_envs_cfg * msg_envs_config); - - void amsg_envs_destroy(amsg_envs_obj * obj); - - msg_envs_obj * amsg_envs_filled_pop(amsg_envs_obj * obj); - - void amsg_envs_filled_push(amsg_envs_obj * obj, msg_envs_obj * msg_envs); - - msg_envs_obj * amsg_envs_empty_pop(amsg_envs_obj * obj); - - void amsg_envs_empty_push(amsg_envs_obj * obj, msg_envs_obj * msg_envs); - -#endif \ No newline at end of file diff --git a/src/amodule/amod_sspf.c b/src/amodule/amod_sspf.c deleted file mode 100644 index ae1202b..0000000 --- a/src/amodule/amod_sspf.c +++ /dev/null @@ -1,83 +0,0 @@ - - #include "amod_sspf.h" - - amod_sspf_obj * amod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config) { - - amod_sspf_obj * obj; - - obj = (amod_sspf_obj *) malloc(sizeof(amod_sspf_obj)); - - obj->mod_sspf = mod_sspf_construct(mod_sspf_config, msg_tracks_config, msg_spectra_config, msg_envs_config); - - obj->in1 = (amsg_spectra_obj *) NULL; - obj->in2 = (amsg_envs_obj *) NULL; - obj->in3 = (amsg_tracks_obj *) NULL; - obj->out = (amsg_spectra_obj *) NULL; - - obj->thread = thread_construct(&amod_sspf_thread, (void *) obj); - - return obj; - - } - - void amod_sspf_destroy(amod_sspf_obj * obj) { - - mod_sspf_destroy(obj->mod_sspf); - thread_destroy(obj->thread); - - free((void *) obj); - - } - - void amod_sspf_connect(amod_sspf_obj * obj, amsg_spectra_obj * in1, amsg_envs_obj * in2, amsg_tracks_obj * in3, amsg_spectra_obj * out) { - - obj->in1 = in1; - obj->in2 = in2; - obj->in3 = in3; - obj->out = out; - - } - - void amod_sspf_disconnect(amod_sspf_obj * obj) { - - obj->in1 = (amsg_spectra_obj *) NULL; - obj->in2 = (amsg_envs_obj *) NULL; - obj->in3 = (amsg_tracks_obj *) NULL; - obj->out = (amsg_spectra_obj *) NULL; - - } - - void * amod_sspf_thread(void * ptr) { - - amod_sspf_obj * obj; - msg_spectra_obj * msg_spectra_in; - msg_envs_obj * msg_envs_in; - msg_tracks_obj * msg_tracks_in; - msg_spectra_obj * msg_spectra_out; - int rtnValue; - - obj = (amod_sspf_obj *) ptr; - - while(1) { - - // Pop a message, process, and push back - msg_spectra_in = amsg_spectra_filled_pop(obj->in1); - msg_envs_in = amsg_envs_filled_pop(obj->in2); - msg_tracks_in = amsg_tracks_filled_pop(obj->in3); - msg_spectra_out = amsg_spectra_empty_pop(obj->out); - mod_sspf_connect(obj->mod_sspf, msg_spectra_in, msg_envs_in, msg_tracks_in, msg_spectra_out); - rtnValue = mod_sspf_process(obj->mod_sspf); - mod_sspf_disconnect(obj->mod_sspf); - amsg_spectra_empty_push(obj->in1, msg_spectra_in); - amsg_envs_empty_push(obj->in2, msg_envs_in); - amsg_tracks_empty_push(obj->in3, msg_tracks_in); - amsg_spectra_filled_push(obj->out, msg_spectra_out); - - // If this is the last frame, rtnValue = -1 - if (rtnValue == -1) { - break; - } - - } - - } \ No newline at end of file diff --git a/src/amodule/amod_sspf.h b/src/amodule/amod_sspf.h deleted file mode 100644 index df079ce..0000000 --- a/src/amodule/amod_sspf.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __ODAS_AMODULE_SSPF -#define __ODAS_AMODULE_SSPF - - #include "../module/mod_sspf.h" - #include "../amessage/amsg_envs.h" - #include "../amessage/amsg_tracks.h" - #include "../amessage/amsg_spectra.h" - #include "../general/thread.h" - - typedef struct amod_sspf_obj { - - mod_sspf_obj * mod_sspf; - amsg_spectra_obj * in1; - amsg_envs_obj * in2; - amsg_tracks_obj * in3; - amsg_spectra_obj * out; - thread_obj * thread; - - } amod_sspf_obj; - - amod_sspf_obj * amod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config); - - void amod_sspf_destroy(amod_sspf_obj * obj); - - void amod_sspf_connect(amod_sspf_obj * obj, amsg_spectra_obj * in1, amsg_envs_obj * in2, amsg_tracks_obj * in3, amsg_spectra_obj * out); - - void amod_sspf_disconnect(amod_sspf_obj * obj); - - void * amod_sspf_thread(void * ptr); - -#endif \ No newline at end of file diff --git a/src/amodule/amod_sss.c b/src/amodule/amod_sss.c index 215cabd..8cbffdb 100644 --- a/src/amodule/amod_sss.c +++ b/src/amodule/amod_sss.c @@ -1,18 +1,18 @@ #include "amod_sss.h" - amod_sss_obj * amod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config) { + amod_sss_obj * amod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config) { amod_sss_obj * obj; obj = (amod_sss_obj *) malloc(sizeof(amod_sss_obj)); - obj->mod_sss = mod_sss_construct(mod_sss_config, msg_tracks_config, msg_spectra_config, msg_envs_config); + obj->mod_sss = mod_sss_construct(mod_sss_config, msg_tracks_config, msg_spectra_config); obj->in1 = (amsg_spectra_obj *) NULL; obj->in2 = (amsg_tracks_obj *) NULL; obj->out1 = (amsg_spectra_obj *) NULL; - obj->out2 = (amsg_envs_obj *) NULL; + obj->out2 = (amsg_spectra_obj *) NULL; obj->thread = thread_construct(&amod_sss_thread, (void *) obj); @@ -29,7 +29,7 @@ } - void amod_sss_connect(amod_sss_obj * obj, amsg_spectra_obj * in1, amsg_tracks_obj * in2, amsg_spectra_obj * out1, amsg_envs_obj * out2) { + void amod_sss_connect(amod_sss_obj * obj, amsg_spectra_obj * in1, amsg_tracks_obj * in2, amsg_spectra_obj * out1, amsg_spectra_obj * out2) { obj->in1 = in1; obj->in2 = in2; @@ -43,7 +43,7 @@ obj->in1 = (amsg_spectra_obj *) NULL; obj->in2 = (amsg_tracks_obj *) NULL; obj->out1 = (amsg_spectra_obj *) NULL; - obj->out2 = (amsg_envs_obj *) NULL; + obj->out2 = (amsg_spectra_obj *) NULL; } @@ -52,8 +52,8 @@ amod_sss_obj * obj; msg_spectra_obj * msg_spectra_in; msg_tracks_obj * msg_tracks_in; - msg_spectra_obj * msg_spectra_out; - msg_envs_obj * msg_envs_out; + msg_spectra_obj * msg_spectra_out1; + msg_spectra_obj * msg_spectra_out2; int rtnValue; obj = (amod_sss_obj *) ptr; @@ -63,15 +63,15 @@ // Pop a message, process, and push back msg_spectra_in = amsg_spectra_filled_pop(obj->in1); msg_tracks_in = amsg_tracks_filled_pop(obj->in2); - msg_spectra_out = amsg_spectra_empty_pop(obj->out1); - msg_envs_out = amsg_envs_empty_pop(obj->out2); - mod_sss_connect(obj->mod_sss, msg_spectra_in, msg_tracks_in, msg_spectra_out, msg_envs_out); + msg_spectra_out1 = amsg_spectra_empty_pop(obj->out1); + msg_spectra_out2 = amsg_spectra_empty_pop(obj->out2); + mod_sss_connect(obj->mod_sss, msg_spectra_in, msg_tracks_in, msg_spectra_out1, msg_spectra_out2); rtnValue = mod_sss_process(obj->mod_sss); mod_sss_disconnect(obj->mod_sss); amsg_spectra_empty_push(obj->in1, msg_spectra_in); amsg_tracks_empty_push(obj->in2, msg_tracks_in); - amsg_spectra_filled_push(obj->out1, msg_spectra_out); - amsg_envs_filled_push(obj->out2, msg_envs_out); + amsg_spectra_filled_push(obj->out1, msg_spectra_out1); + amsg_spectra_filled_push(obj->out2, msg_spectra_out2); // If this is the last frame, rtnValue = -1 if (rtnValue == -1) { diff --git a/src/amodule/amod_sss.h b/src/amodule/amod_sss.h index a68bf1f..12adcda 100644 --- a/src/amodule/amod_sss.h +++ b/src/amodule/amod_sss.h @@ -2,7 +2,6 @@ #define __ODAS_AMODULE_SSS #include "../module/mod_sss.h" - #include "../amessage/amsg_envs.h" #include "../amessage/amsg_tracks.h" #include "../amessage/amsg_spectra.h" #include "../general/thread.h" @@ -13,16 +12,16 @@ amsg_spectra_obj * in1; amsg_tracks_obj * in2; amsg_spectra_obj * out1; - amsg_envs_obj * out2; + amsg_spectra_obj * out2; thread_obj * thread; } amod_sss_obj; - amod_sss_obj * amod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config); + amod_sss_obj * amod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config); void amod_sss_destroy(amod_sss_obj * obj); - void amod_sss_connect(amod_sss_obj * obj, amsg_spectra_obj * in1, amsg_tracks_obj * in2, amsg_spectra_obj * out1, amsg_envs_obj * out2); + void amod_sss_connect(amod_sss_obj * obj, amsg_spectra_obj * in1, amsg_tracks_obj * in2, amsg_spectra_obj * out1, amsg_spectra_obj * out2); void amod_sss_disconnect(amod_sss_obj * obj); diff --git a/src/asink/asnk_xcorrs.c b/src/asink/asnk_xcorrs.c deleted file mode 100644 index b17fca5..0000000 --- a/src/asink/asnk_xcorrs.c +++ /dev/null @@ -1,70 +0,0 @@ - - #include "asnk_xcorrs.h" - - asnk_xcorrs_obj * asnk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config) { - - asnk_xcorrs_obj * obj; - - obj = (asnk_xcorrs_obj *) malloc(sizeof(asnk_xcorrs_obj)); - - obj->snk_spectra = snk_xcorrs_construct(snk_xcorrs_config, msg_xcorrs_config); - obj->in = (amsg_xcorrs_obj *) NULL; - - obj->thread = thread_construct(&asnk_xcorrs_thread, (void *) obj); - - return obj; - - } - - void asnk_xcorrs_destroy(asnk_xcorrs_obj * obj) { - - snk_xcorrs_destroy(obj->snk_spectra); - thread_destroy(obj->thread); - - free((void *) obj); - - } - - void asnk_xcorrs_connect(asnk_xcorrs_obj * obj, amsg_xcorrs_obj * in) { - - obj->in = in; - - } - - void asnk_xcorrs_disconnect(asnk_xcorrs_obj * obj) { - - obj->in = (amsg_xcorrs_obj *) NULL; - - } - - void * asnk_xcorrs_thread(void * ptr) { - - asnk_xcorrs_obj * obj; - msg_xcorrs_obj * msg_xcorrs_in; - int rtnValue; - - obj = (asnk_xcorrs_obj *) ptr; - - // Open the sink - snk_xcorrs_open(obj->snk_spectra); - - while(1) { - - // Pop a message, process, and push back - msg_xcorrs_in = amsg_xcorrs_filled_pop(obj->in); - snk_xcorrs_connect(obj->snk_spectra, msg_xcorrs_in); - rtnValue = snk_xcorrs_process(obj->snk_spectra); - snk_xcorrs_disconnect(obj->snk_spectra); - amsg_xcorrs_empty_push(obj->in, msg_xcorrs_in); - - // If this is the last frame, rtnValue = -1 - if (rtnValue == -1) { - break; - } - - } - - // Close the sink - snk_xcorrs_close(obj->snk_spectra); - - } \ No newline at end of file diff --git a/src/asink/asnk_xcorrs.h b/src/asink/asnk_xcorrs.h deleted file mode 100644 index 1d86b4c..0000000 --- a/src/asink/asnk_xcorrs.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ODAS_ASINK_XCORRS -#define __ODAS_ASINK_XCORRS - - #include "../amessage/amsg_xcorrs.h" - #include "../sink/snk_xcorrs.h" - #include "../general/thread.h" - - #include - - typedef struct asnk_xcorrs_obj { - - snk_xcorrs_obj * snk_xcorrs; - amsg_xcorrs_obj * in; - thread_obj * thread; - - } asnk_xcorrs_obj; - - asnk_xcorrs_obj * asnk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config); - - void asnk_xcorrs_destroy(asnk_xcorrs_obj * obj); - - void asnk_xcorrs_connect(asnk_xcorrs_obj * obj, amsg_xcorrs_obj * in); - - void asnk_xcorrs_disconnect(asnk_xcorrs_obj * obj); - - void * asnk_xcorrs_thread(void * ptr); - -#endif \ No newline at end of file diff --git a/src/asource/asrc_spectra.c b/src/asource/asrc_spectra.c deleted file mode 100644 index d9d95a1..0000000 --- a/src/asource/asrc_spectra.c +++ /dev/null @@ -1,81 +0,0 @@ - - #include "asrc_spectra.h" - - asrc_spectra_obj * asrc_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config) { - - asrc_spectra_obj * obj; - - obj = (asrc_spectra_obj *) malloc(sizeof(asrc_spectra_obj)); - - obj->src_spectra = src_spectra_construct(src_spectra_config, msg_spectra_config); - obj->out = (amsg_spectra_obj *) NULL; - - obj->thread = thread_construct(&asrc_spectra_thread, (void *) obj); - - return obj; - - } - - void asrc_spectra_destroy(asrc_spectra_obj * obj) { - - src_spectra_destroy(obj->src_spectra); - thread_destroy(obj->thread); - - free((void *) obj); - - } - - void asrc_spectra_connect(asrc_spectra_obj * obj, amsg_spectra_obj * out) { - - obj->out = out; - - } - - void asrc_spectra_disconnect(asrc_spectra_obj * obj) { - - obj->out = (amsg_spectra_obj *) NULL; - - } - - void * asrc_spectra_thread(void * ptr) { - - asrc_spectra_obj * obj; - msg_spectra_obj * msg_spectra_out; - int rtnValue; - - obj = (asrc_spectra_obj *) ptr; - - // Open the source - src_spectra_open(obj->src_spectra); - - while(1) { - - // Pop a message, process, and push back - msg_spectra_out = amsg_spectra_empty_pop(obj->out); - src_spectra_connect(obj->src_spectra, msg_spectra_out); - rtnValue = src_spectra_process(obj->src_spectra); - src_spectra_disconnect(obj->src_spectra); - amsg_spectra_filled_push(obj->out, msg_spectra_out); - - // If this is the last frame, rtnValue = -1 - if (rtnValue == -1) { - break; - } - - // Some other process may ask to stop the thread - if (thread_askedToStop(obj->thread) == 1) { - break; - } - - } - - // Close the source - src_spectra_close(obj->src_spectra); - - // Send the "0" message, that kills all connected threads - // that will consume this message - msg_spectra_out = amsg_spectra_empty_pop(obj->out); - msg_spectra_zero(msg_spectra_out); - amsg_spectra_filled_push(obj->out, msg_spectra_out); - - } \ No newline at end of file diff --git a/src/asource/asrc_spectra.h b/src/asource/asrc_spectra.h deleted file mode 100644 index 80976ad..0000000 --- a/src/asource/asrc_spectra.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ODAS_ASOURCE_SPECTRA -#define __ODAS_ASOURCE_SPECTRA - - #include "../amessage/amsg_spectra.h" - #include "../source/src_spectra.h" - #include "../general/thread.h" - - #include - - typedef struct asrc_spectra_obj { - - src_spectra_obj * src_spectra; - amsg_spectra_obj * out; - thread_obj * thread; - - } asrc_spectra_obj; - - asrc_spectra_obj * asrc_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config); - - void asrc_spectra_destroy(asrc_spectra_obj * obj); - - void asrc_spectra_connect(asrc_spectra_obj * obj, amsg_spectra_obj * out); - - void asrc_spectra_disconnect(asrc_spectra_obj * obj); - - void * asrc_spectra_thread(void * ptr); - -#endif \ No newline at end of file diff --git a/src/connector/con_envs.c b/src/connector/con_envs.c deleted file mode 100644 index 7c69e0b..0000000 --- a/src/connector/con_envs.c +++ /dev/null @@ -1,57 +0,0 @@ - - #include "con_envs.h" - - con_envs_obj * con_envs_construct(const unsigned int nOuts, const msg_envs_cfg * msg_envs_config) { - - con_envs_obj * obj; - unsigned int iOut; - - obj = (con_envs_obj *) malloc(sizeof(con_envs_obj)); - - obj->nOuts = nOuts; - - obj->in = msg_envs_construct(msg_envs_config); - - obj->outs = (msg_envs_obj **) malloc(sizeof(msg_envs_obj *) * nOuts); - for (iOut = 0; iOut < obj->nOuts; iOut++) { - obj->outs[iOut] = msg_envs_construct(msg_envs_config); - } - - return obj; - - } - - void con_envs_destroy(con_envs_obj * obj) { - - unsigned int iOut; - - for (iOut = 0; iOut < obj->nOuts; iOut++) { - msg_envs_destroy(obj->outs[iOut]); - } - free((void *) obj->outs); - - msg_envs_destroy(obj->in); - - free((void *) obj); - - } - - int con_envs_process(con_envs_obj * obj) { - - unsigned int iOut; - int rtnValue; - - for (iOut = 0; iOut < obj->nOuts; iOut++) { - msg_envs_copy(obj->outs[iOut], obj->in); - } - - if (msg_envs_isZero(obj->in) == 1) { - rtnValue = -1; - } - else { - rtnValue = 0; - } - - return rtnValue; - - } \ No newline at end of file diff --git a/src/connector/con_envs.h b/src/connector/con_envs.h deleted file mode 100644 index ea6fa27..0000000 --- a/src/connector/con_envs.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __ODAS_CONNECTOR_ENVS -#define __ODAS_CONNECTOR_ENVS - - #include "../message/msg_envs.h" - - #include - #include - - typedef struct con_envs_obj { - - msg_envs_obj * in; - msg_envs_obj ** outs; - - unsigned int nOuts; - - } con_envs_obj; - - con_envs_obj * con_envs_construct(const unsigned int nOuts, const msg_envs_cfg * msg_envs_config); - - void con_envs_destroy(con_envs_obj * obj); - - int con_envs_process(con_envs_obj * obj); - -#endif \ No newline at end of file diff --git a/src/general/format.c b/src/general/format.c index 6586ce3..2d14f7d 100644 --- a/src/general/format.c +++ b/src/general/format.c @@ -13,7 +13,7 @@ } - format_obj * format_construct_bin(const unsigned int nBits) { + format_obj * format_construct_binary_int(const unsigned int nBits) { format_obj * obj; @@ -23,25 +23,25 @@ case 8: - obj->type = format_bin08; + obj->type = format_binary_int08; break; case 16: - obj->type = format_bin16; + obj->type = format_binary_int16; break; case 24: - obj->type = format_bin24; + obj->type = format_binary_int24; break; case 32: - obj->type = format_bin32; + obj->type = format_binary_int32; break; @@ -58,25 +58,25 @@ } - format_obj * format_construct_float() { + format_obj * format_construct_binary_float() { format_obj * obj; obj = (format_obj *) malloc(sizeof(format_obj)); - obj->type = format_float; + obj->type = format_binary_float; return obj; } - format_obj * format_construct_json() { + format_obj * format_construct_text_json() { format_obj * obj; obj = (format_obj *) malloc(sizeof(format_obj)); - obj->type = format_json; + obj->type = format_text_json; return obj; @@ -106,28 +106,28 @@ switch(obj->type) { - case format_bin08: - printf("type = bin08\n"); + case format_binary_int08: + printf("type = binary_int08\n"); break; - case format_bin16: - printf("type = bin16\n"); + case format_binary_int16: + printf("type = binary_int16\n"); break; - case format_bin24: - printf("type = bin24\n"); + case format_binary_int24: + printf("type = binary_int24\n"); break; - case format_bin32: - printf("type = bin32\n"); + case format_binary_int32: + printf("type = binary_int32\n"); break; - case format_float: - printf("type = float\n"); + case format_binary_float: + printf("type = binary_float\n"); break; - case format_json: - printf("type = json\n"); + case format_text_json: + printf("type = text_json\n"); break; } diff --git a/src/general/format.h b/src/general/format.h index 5a15b24..e337944 100644 --- a/src/general/format.h +++ b/src/general/format.h @@ -7,12 +7,12 @@ typedef enum format_type { format_undefined = 0, - format_bin08 = 8, - format_bin16 = 16, - format_bin24 = 24, - format_bin32 = 32, - format_float = 1, - format_json = 2, + format_binary_int08 = 8, + format_binary_int16 = 16, + format_binary_int24 = 24, + format_binary_int32 = 32, + format_binary_float = 1, + format_text_json = 2, } format_type; @@ -24,11 +24,11 @@ format_obj * format_construct(); - format_obj * format_construct_bin(const unsigned int nBits); + format_obj * format_construct_binary_int(const unsigned int nBits); - format_obj * format_construct_float(); + format_obj * format_construct_binary_float(); - format_obj * format_construct_json(); + format_obj * format_construct_text_json(); format_obj * format_clone(const format_obj * obj); diff --git a/src/general/interface.c b/src/general/interface.c index 3a77ebe..e16e9df 100644 --- a/src/general/interface.c +++ b/src/general/interface.c @@ -13,6 +13,60 @@ obj->type = interface_undefined; + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + + // +----------------------------------------------------------+ + // | File | + // +----------------------------------------------------------+ + + obj->fileName = (char *) NULL; + + // +----------------------------------------------------------+ + // | Socket | + // +----------------------------------------------------------+ + + obj->ip = (char *) NULL; + obj->port = 0; + + // +----------------------------------------------------------+ + // | Soundcard | + // +----------------------------------------------------------+ + + obj->card = 0; + obj->device = 0; + + // +----------------------------------------------------------+ + // | Terminal | + // +----------------------------------------------------------+ + + // (Empty) + + return obj; + + } + + interface_obj * interface_construct_blackhole() { + + interface_obj * obj; + + obj = (interface_obj *) malloc(sizeof(interface_obj)); + + // +----------------------------------------------------------+ + // | Type | + // +----------------------------------------------------------+ + + obj->type = interface_blackhole; + + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + // +----------------------------------------------------------+ // | File | // +----------------------------------------------------------+ @@ -55,6 +109,12 @@ obj->type = interface_file; + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + // +----------------------------------------------------------+ // | File | // +----------------------------------------------------------+ @@ -98,6 +158,12 @@ obj->type = interface_socket; + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + // +----------------------------------------------------------+ // | File | // +----------------------------------------------------------+ @@ -141,6 +207,12 @@ obj->type = interface_soundcard; + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + // +----------------------------------------------------------+ // | File | // +----------------------------------------------------------+ @@ -183,6 +255,12 @@ obj->type = interface_terminal; + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + // +----------------------------------------------------------+ // | File | // +----------------------------------------------------------+ @@ -225,6 +303,12 @@ clone->type = obj->type; + // +----------------------------------------------------------+ + // | Blackhole | + // +----------------------------------------------------------+ + + // (Empty) + // +----------------------------------------------------------+ // | File | // +----------------------------------------------------------+ @@ -293,6 +377,12 @@ switch(obj->type) { + case interface_blackhole: + + printf("type = blackhole\n"); + + break; + case interface_file: printf("type = file, fileName = %s\n",obj->fileName); diff --git a/src/general/interface.h b/src/general/interface.h index d16d956..e7f50bd 100644 --- a/src/general/interface.h +++ b/src/general/interface.h @@ -8,10 +8,11 @@ typedef enum interface_type { interface_undefined = 0, - interface_file = 1, - interface_socket = 2, - interface_soundcard = 3, - interface_terminal = 4, + interface_blackhole = 1, + interface_file = 2, + interface_socket = 3, + interface_soundcard = 4, + interface_terminal = 5, } interface_type; @@ -31,6 +32,8 @@ interface_obj * interface_construct(); + interface_obj * interface_construct_blackhole(); + interface_obj * interface_construct_file(const char * fileName); interface_obj * interface_construct_socket(const char * ip, const unsigned int port); diff --git a/src/message/msg_envs.c b/src/message/msg_envs.c deleted file mode 100644 index 9ac4e44..0000000 --- a/src/message/msg_envs.c +++ /dev/null @@ -1,91 +0,0 @@ - - #include "msg_envs.h" - - msg_envs_obj * msg_envs_construct(const msg_envs_cfg * msg_envs_config) { - - msg_envs_obj * obj; - - obj = (msg_envs_obj *) malloc(sizeof(msg_envs_obj)); - - obj->timeStamp = 0; - obj->fS = msg_envs_config->fS; - obj->envs = envs_construct_zero(msg_envs_config->nChannels, msg_envs_config->halfFrameSize); - - return obj; - - } - - void msg_envs_destroy(msg_envs_obj * obj) { - - free((void *) obj->envs); - free((void *) obj); - - } - - void msg_envs_copy(msg_envs_obj * dest, const msg_envs_obj * src) { - - dest->timeStamp = src->timeStamp; - dest->fS = src->fS; - envs_copy(dest->envs, src->envs); - - } - - void msg_envs_zero(msg_envs_obj * obj) { - - obj->timeStamp = 0; - obj->fS = 0; - envs_zero(obj->envs); - - } - - unsigned int msg_envs_isZero(const msg_envs_obj * obj) { - - unsigned int rtnValue; - - if (obj->timeStamp == 0) { - rtnValue = 1; - } - else { - rtnValue = 0; - } - - return rtnValue; - - } - - msg_envs_cfg * msg_envs_cfg_construct(void) { - - msg_envs_cfg * cfg; - - cfg = (msg_envs_cfg *) malloc(sizeof(msg_envs_cfg)); - - cfg->halfFrameSize = 0; - cfg->nChannels = 0; - cfg->fS = 0; - - return cfg; - - } - - void msg_envs_cfg_destroy(msg_envs_cfg * msg_envs_config) { - - free((void *) msg_envs_config); - - } - - void msg_envs_cfg_printf(const msg_envs_cfg * msg_envs_config) { - - if (msg_envs_config != NULL) { - - printf("halfFrameSize = %u\n", msg_envs_config->halfFrameSize); - printf("nChannels = %u\n", msg_envs_config->nChannels); - printf("fS = %u\n", msg_envs_config->fS); - - } - else { - - printf("(null)\n"); - - } - - } \ No newline at end of file diff --git a/src/message/msg_envs.h b/src/message/msg_envs.h deleted file mode 100644 index da4c128..0000000 --- a/src/message/msg_envs.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __ODAS_MESSAGE_ENVS -#define __ODAS_MESSAGE_ENVS - - #include - - #include "../signal/env.h" - - typedef struct msg_envs_obj { - - unsigned long long timeStamp; - unsigned int fS; - envs_obj * envs; - - } msg_envs_obj; - - typedef struct msg_envs_cfg { - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - } msg_envs_cfg; - - msg_envs_obj * msg_envs_construct(const msg_envs_cfg * msg_envs_config); - - void msg_envs_destroy(msg_envs_obj * obj); - - void msg_envs_copy(msg_envs_obj * dest, const msg_envs_obj * src); - - void msg_envs_zero(msg_envs_obj * obj); - - unsigned int msg_envs_isZero(const msg_envs_obj * obj); - - msg_envs_cfg * msg_envs_cfg_construct(void); - - void msg_envs_cfg_destroy(msg_envs_cfg * msg_envs_config); - - void msg_envs_cfg_printf(const msg_envs_cfg * msg_envs_config); - -#endif \ No newline at end of file diff --git a/src/message/msg_hops.c b/src/message/msg_hops.c index 109c2a7..779ee08 100644 --- a/src/message/msg_hops.c +++ b/src/message/msg_hops.c @@ -61,7 +61,7 @@ cfg->hopSize = 0; cfg->nChannels = 0; - cfg->fS; + cfg->fS = 0; return cfg; diff --git a/src/message/msg_xcorrs.c b/src/message/msg_xcorrs.c deleted file mode 100644 index 5aed415..0000000 --- a/src/message/msg_xcorrs.c +++ /dev/null @@ -1,91 +0,0 @@ - - #include "msg_xcorrs.h" - - msg_xcorrs_obj * msg_xcorrs_construct(const msg_xcorrs_cfg * msg_xcorrs_config) { - - msg_xcorrs_obj * obj; - - obj = (msg_xcorrs_obj *) malloc(sizeof(msg_xcorrs_obj)); - - obj->timeStamp = 0; - obj->fS = 0; - obj->xcorrs = xcorrs_construct_zero(msg_xcorrs_config->nPairs, msg_xcorrs_config->frameSize); - - return obj; - - } - - void msg_xcorrs_destroy(msg_xcorrs_obj * obj) { - - xcorrs_destroy(obj->xcorrs); - free((void *) obj); - - } - - void msg_xcorrs_copy(msg_xcorrs_obj * dest, const msg_xcorrs_obj * src) { - - dest->timeStamp = src->timeStamp; - dest->fS = src->fS; - xcorrs_copy(dest->xcorrs, src->xcorrs); - - } - - void msg_xcorrs_zero(msg_xcorrs_obj * obj) { - - obj->timeStamp = 0; - obj->fS = 0; - xcorrs_zero(obj->xcorrs); - - } - - unsigned int msg_xcorrs_isZero(const msg_xcorrs_obj * obj) { - - unsigned int rtnValue; - - if (obj->timeStamp == 0) { - rtnValue = 1; - } - else { - rtnValue = 0; - } - - return rtnValue; - - } - - msg_xcorrs_cfg * msg_xcorrs_cfg_construct(void) { - - msg_xcorrs_cfg * cfg; - - cfg = (msg_xcorrs_cfg *) malloc(sizeof(msg_xcorrs_cfg)); - - cfg->frameSize = 0; - cfg->nPairs = 0; - cfg->fS = 0; - - return cfg; - - } - - void msg_xcorrs_cfg_destroy(msg_xcorrs_cfg * msg_xcorrs_config) { - - free((void *) msg_xcorrs_config); - - } - - void msg_xcorrs_cfg_printf(const msg_xcorrs_cfg * msg_xcorrs_config) { - - if (msg_xcorrs_config != NULL) { - - printf("frameSize = %u\n", msg_xcorrs_config->frameSize); - printf("nPairs = %u\n", msg_xcorrs_config->nPairs); - printf("fS = %u\n", msg_xcorrs_config->fS); - - } - else { - - printf("(null)\n"); - - } - - } \ No newline at end of file diff --git a/src/message/msg_xcorrs.h b/src/message/msg_xcorrs.h deleted file mode 100644 index 24962ef..0000000 --- a/src/message/msg_xcorrs.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef __ODAS_MESSAGE_XCORRS -#define __ODAS_MESSAGE_XCORRS - - #include - - #include "../signal/xcorr.h" - - typedef struct msg_xcorrs_obj { - - unsigned long long timeStamp; - unsigned int fS; - xcorrs_obj * xcorrs; - - } msg_xcorrs_obj; - - typedef struct msg_xcorrs_cfg { - - unsigned int frameSize; - unsigned int nPairs; - unsigned int fS; - - } msg_xcorrs_cfg; - - msg_xcorrs_obj * msg_xcorrs_construct(const msg_xcorrs_cfg * msg_xcorrs_config); - - void msg_xcorrs_destroy(msg_xcorrs_obj * obj); - - void msg_xcorrs_copy(msg_xcorrs_obj * dest, const msg_xcorrs_obj * src); - - void msg_xcorrs_zero(msg_xcorrs_obj * obj); - - unsigned int msg_xcorrs_isZero(const msg_xcorrs_obj * obj); - - msg_xcorrs_cfg * msg_xcorrs_cfg_construct(void); - - void msg_xcorrs_cfg_destroy(msg_xcorrs_cfg * msg_xcorrs_config); - - void msg_xcorrs_cfg_printf(const msg_xcorrs_cfg * msg_xcorrs_config); - -#endif \ No newline at end of file diff --git a/src/module/mod_ssl.c b/src/module/mod_ssl.c index 7c0bd97..25af6a0 100644 --- a/src/module/mod_ssl.c +++ b/src/module/mod_ssl.c @@ -1,10 +1,6 @@ #include "mod_ssl.h" - // +----------------------------------------------------------+ - // | Object - Constructor | - // +----------------------------------------------------------+ - mod_ssl_obj * mod_ssl_construct(const mod_ssl_cfg * mod_ssl_config, const msg_spectra_cfg * msg_spectra_config, const msg_pots_cfg * msg_pots_config) { mod_ssl_obj * obj; diff --git a/src/module/mod_sspf.c b/src/module/mod_sspf.c deleted file mode 100644 index a4ea687..0000000 --- a/src/module/mod_sspf.c +++ /dev/null @@ -1,113 +0,0 @@ - - #include "mod_sspf.h" - - mod_sspf_obj * mod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config) { - - mod_sspf_obj * obj; - - obj = (mod_sspf_obj *) malloc(sizeof(mod_sspf_obj)); - - obj->nSeps = msg_spectra_config->nChannels; - obj->halfFrameSize = msg_spectra_config->halfFrameSize; - - obj->alpha = mod_sspf_config->alpha; - obj->beta = mod_sspf_config->beta; - obj->Ginterf = mod_sspf_config->Ginterf; - obj->epsilon = mod_sspf_config->epsilon; - - obj->freq2env = freq2env_construct_zero(obj->halfFrameSize, obj->nSeps); - obj->envs = envs_construct_zero(obj->nSeps, obj->halfFrameSize); - obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, 0, 0, obj->epsilon, obj->alpha, obj->beta, obj->Ginterf); - - obj->in1 = (msg_spectra_obj *) NULL; - obj->in2 = (msg_envs_obj *) NULL; - obj->in3 = (msg_tracks_obj *) NULL; - obj->out = (msg_spectra_obj *) NULL; - - return obj; - - } - - void mod_sspf_destroy(mod_sspf_obj * obj) { - - freq2env_destroy(obj->freq2env); - envs_destroy(obj->envs); - freq2freq_destroy(obj->freq2freq); - - free((void *) obj); - - } - - int mod_sspf_process(mod_sspf_obj * obj) { - - int rtnValue; - - if ((msg_spectra_isZero(obj->in1) == 0) && (msg_envs_isZero(obj->in2) == 0) && (msg_tracks_isZero(obj->in3) == 0)) { - - if ((obj->in1->timeStamp != obj->in2->timeStamp) || (obj->in1->timeStamp != obj->in3->timeStamp)) { - printf("Time stamp mismatch.\n"); - exit(EXIT_FAILURE); - } - - freq2env_process(obj->freq2env, obj->in1->freqs, obj->envs); - freq2freq_process_postfilter(obj->freq2freq, obj->in3->tracks, obj->in1->freqs, obj->envs, obj->in2->envs, obj->out->freqs); - - obj->out->timeStamp = obj->in1->timeStamp; - - rtnValue = 0; - - } - else { - - msg_spectra_zero(obj->out); - - rtnValue = -1; - - } - - return rtnValue; - - } - - void mod_sspf_connect(mod_sspf_obj * obj, msg_spectra_obj * in1, msg_envs_obj * in2, msg_tracks_obj * in3, msg_spectra_obj * out) { - - obj->in1 = in1; - obj->in2 = in2; - obj->in3 = in3; - obj->out = out; - - } - - void mod_sspf_disconnect(mod_sspf_obj * obj) { - - obj->in1 = (msg_spectra_obj *) NULL; - obj->in2 = (msg_envs_obj *) NULL; - obj->in3 = (msg_tracks_obj *) NULL; - obj->out = (msg_spectra_obj *) NULL; - - } - - mod_sspf_cfg * mod_sspf_cfg_construct(void) { - - mod_sspf_cfg * cfg; - - cfg = (mod_sspf_cfg *) malloc(sizeof(mod_sspf_cfg)); - - cfg->alpha = 0.0f; - cfg->beta = 0.0f; - cfg->Ginterf = 0.0f; - cfg->epsilon = 0.0f; - - return cfg; - - } - - void mod_sspf_cfg_destroy(mod_sspf_cfg * cfg) { - - free((void *) cfg); - - } - - void mod_sspf_cfg_printf(const mod_sspf_cfg * cfg) { - - } \ No newline at end of file diff --git a/src/module/mod_sspf.h b/src/module/mod_sspf.h deleted file mode 100644 index ee31703..0000000 --- a/src/module/mod_sspf.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __ODAS_MODULE_SSPF -#define __ODAS_MODULE_SSPF - - #include "../message/msg_envs.h" - #include "../message/msg_spectra.h" - #include "../message/msg_tracks.h" - - #include "../system/freq2env.h" - #include "../signal/env.h" - #include "../system/freq2freq.h" - - #include - - typedef struct mod_sspf_obj { - - unsigned int nSeps; - unsigned int halfFrameSize; - - float alpha; - float beta; - float Ginterf; - float epsilon; - - freq2env_obj * freq2env; - envs_obj * envs; - freq2freq_obj * freq2freq; - - msg_spectra_obj * in1; - msg_envs_obj * in2; - msg_tracks_obj * in3; - msg_spectra_obj * out; - - } mod_sspf_obj; - - typedef struct mod_sspf_cfg { - - float alpha; - float beta; - float Ginterf; - float epsilon; - - } mod_sspf_cfg; - - mod_sspf_obj * mod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config); - - void mod_sspf_destroy(mod_sspf_obj * obj); - - int mod_sspf_process(mod_sspf_obj * obj); - - void mod_sspf_connect(mod_sspf_obj * obj, msg_spectra_obj * in1, msg_envs_obj * in2, msg_tracks_obj * in3, msg_spectra_obj * out); - - void mod_sspf_disconnect(mod_sspf_obj * obj); - - mod_sspf_cfg * mod_sspf_cfg_construct(void); - - void mod_sspf_cfg_destroy(mod_sspf_cfg * cfg); - - void mod_sspf_cfg_printf(const mod_sspf_cfg * cfg); - -#endif \ No newline at end of file diff --git a/src/module/mod_sss.c b/src/module/mod_sss.c index 8f91ef7..75ef791 100644 --- a/src/module/mod_sss.c +++ b/src/module/mod_sss.c @@ -1,204 +1,100 @@ #include "mod_sss.h" - mod_sss_obj * mod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config) { + mod_sss_obj * mod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config) { mod_sss_obj * obj; - + obj = (mod_sss_obj *) malloc(sizeof(mod_sss_obj)); - obj->nChannels = mod_sss_config->mics->nChannels; obj->nSeps = msg_tracks_config->nTracks; + obj->nChannels = msg_spectra_config->nChannels; + obj->halfFrameSize = msg_spectra_config->halfFrameSize; - obj->beampatterns_mics = directivity_beampattern_mics(mod_sss_config->mics, mod_sss_config->nThetas); - obj->beampatterns_spatialfilter = directivity_beampattern_spatialfilter(mod_sss_config->spatialfilter, mod_sss_config->nThetas); + switch(obj->mode_sep) { - obj->track2gain = track2gain_construct_zero(obj->nSeps, - obj->nChannels, - mod_sss_config->mics->direction, - mod_sss_config->spatialfilter->direction); + case 'd': - obj->gains = gains_construct_zero(obj->nSeps, - obj->nChannels); + break; - obj->gain2mask = gain2mask_construct_zero(obj->nSeps, - obj->nChannels, - mod_sss_config->gainMin); + case 'g': - obj->masks = masks_construct_zero(obj->nSeps, - obj->nChannels); + break; - obj->track2steer = track2steer_construct_zero(obj->nSeps, - obj->nChannels, - msg_spectra_config->halfFrameSize, - mod_sss_config->soundspeed->mu, - mod_sss_config->samplerate->mu, - mod_sss_config->mics->mu); + case 'm': - obj->W = steers_construct_zero(msg_spectra_config->halfFrameSize, - obj->nSeps, - obj->nChannels); + break; - obj->steer2freq = steer2freq_construct_zero(obj->nSeps, - obj->nChannels, - msg_spectra_config->halfFrameSize); + default: - obj->steer2env = steer2env_construct_zero(obj->nSeps, - obj->nChannels, - msg_envs_config->halfFrameSize); + printf("Invalid separation method.\n"); + exit(EXIT_FAILURE); - obj->ids = (unsigned long long *) malloc(sizeof(unsigned long long) * obj->nSeps); - memset(obj->ids, 0x00, sizeof(unsigned long long) * obj->nSeps); + break; - obj->in1 = (msg_spectra_obj *) NULL; - obj->in2 = (msg_tracks_obj *) NULL; - obj->out1 = (msg_spectra_obj *) NULL; - obj->out2 = (msg_envs_obj *) NULL; + } - return obj; + switch(obj->mode_pf) { - } + case 'm': - void mod_sss_destroy(mod_sss_obj * obj) { + break; - beampatterns_destroy(obj->beampatterns_mics); - beampatterns_destroy(obj->beampatterns_spatialfilter); + default: - track2gain_destroy(obj->track2gain); - gains_destroy(obj->gains); - gain2mask_destroy(obj->gain2mask); - masks_destroy(obj->masks); + printf("Invalid post-filtering method.\n"); + exit(EXIT_FAILURE); - track2steer_destroy(obj->track2steer); - steers_destroy(obj->W); - steer2freq_destroy(obj->steer2freq); - steer2env_destroy(obj->steer2env); + break; - free((void *) obj); + } - } - int mod_sss_process(mod_sss_obj * obj) { - int rtnValue; - unsigned int iSep; + return obj; - if ((msg_spectra_isZero(obj->in1) == 0) && (msg_tracks_isZero(obj->in2) == 0)) { + } - if (obj->in1->timeStamp != obj->in2->timeStamp) { - printf("Time stamp mismatch.\n"); - exit(EXIT_FAILURE); - } - - // Generate the gain according to each source direction - track2gain_process(obj->track2gain, - obj->beampatterns_mics, - obj->beampatterns_spatialfilter, - obj->in2->tracks, - obj->gains); - - // Generate masks from gains - gain2mask_process(obj->gain2mask, - obj->gains, - obj->masks); - - // Generate the demixing matrix W with gains - track2steer_process_demixing(obj->track2steer, - obj->in2->tracks, - obj->gains, - obj->masks, - obj->W); - - // Apply W to get separated spectra - steer2freq_process(obj->steer2freq, - obj->in2->tracks, - obj->W, - obj->masks, - obj->in1->freqs, - obj->out1->freqs); - - // Apply W to get separated envelope - steer2env_process(obj->steer2env, - obj->in2->tracks, - obj->W, - obj->masks, - obj->in1->freqs, - obj->out2->envs); - - obj->out1->timeStamp = obj->in1->timeStamp; - obj->out2->timeStamp = obj->in1->timeStamp; - - rtnValue = 0; + void mod_sss_destroy(mod_sss_obj * obj) { - } - else { + free((void *) obj); - msg_spectra_zero(obj->out1); - msg_envs_zero(obj->out2); + } - rtnValue = -1; + int mod_sss_process(mod_sss_obj * obj) { + + int rtnValue; - } return rtnValue; } - void mod_sss_connect(mod_sss_obj * obj, msg_spectra_obj * in1, msg_tracks_obj * in2, msg_spectra_obj * out1, msg_envs_obj * out2) { - - obj->in1 = in1; - obj->in2 = in2; - obj->out1 = out1; - obj->out2 = out2; + int mod_sss_process_dds(mod_sss_obj * obj) { } - void mod_sss_disconnect(mod_sss_obj * obj) { - - obj->in1 = (msg_spectra_obj *) NULL; - obj->in2 = (msg_tracks_obj *) NULL; - obj->out1 = (msg_spectra_obj *) NULL; - obj->out2 = (msg_envs_obj *) NULL; + int mod_sss_process_dgss(mod_sss_obj * obj) { } - mod_sss_cfg * mod_sss_cfg_construct(void) { + int mod_sss_process_dmvdr(mod_sss_obj * obj) { - mod_sss_cfg * cfg; - - cfg = (mod_sss_cfg *) malloc(sizeof(mod_sss_cfg)); - - cfg->mics = (mics_obj *) NULL; - cfg->spatialfilter = (spatialfilter_obj *) NULL; - cfg->samplerate = (samplerate_obj *) NULL; - cfg->soundspeed = (soundspeed_obj *) NULL; - - cfg->nThetas = 0; - cfg->gainMin = 0.0f; + } - return cfg; + void mod_sss_connect(mod_sss_obj * obj, msg_spectra_obj * in1, msg_tracks_obj * in2, msg_spectra_obj * out1, msg_spectra_obj * out2) { } - void mod_sss_cfg_destroy(mod_sss_cfg * cfg) { - - if (cfg->mics != NULL) { - mics_destroy(cfg->mics); - } + void mod_sss_disconnect(mod_sss_obj * obj) { - if (cfg->spatialfilter != NULL) { - spatialfilter_destroy(cfg->spatialfilter); - } + } - if (cfg->samplerate != NULL) { - samplerate_destroy(cfg->samplerate); - } + mod_sss_cfg * mod_sss_cfg_construct(void) { - if (cfg->soundspeed != NULL) { - soundspeed_destroy(cfg->soundspeed); - } + } - free((void *) cfg); + void mod_sss_cfg_destroy(mod_sss_cfg * cfg) { } diff --git a/src/module/mod_sss.h b/src/module/mod_sss.h index c638611..b22ada0 100644 --- a/src/module/mod_sss.h +++ b/src/module/mod_sss.h @@ -1,78 +1,57 @@ #ifndef __ODAS_MODULE_SSS #define __ODAS_MODULE_SSS - #include "../signal/beampattern.h" - #include "../signal/freq.h" - #include "../signal/gain.h" - #include "../signal/mask.h" - - #include "../system/gain2mask.h" - #include "../system/track2gain.h" - #include "../system/freq2freq.h" - #include "../system/track2steer.h" - #include "../system/steer2env.h" - #include "../system/steer2freq.h" - #include "../general/mic.h" #include "../general/samplerate.h" #include "../general/soundspeed.h" #include "../general/spatialfilter.h" - #include "../init/directivity.h" - - #include "../message/msg_envs.h" #include "../message/msg_spectra.h" #include "../message/msg_tracks.h" + #include "../system/track2steer.h" + #include + #include typedef struct mod_sss_obj { - unsigned int halfFrameSize; - unsigned int nChannels; unsigned int nSeps; + unsigned int nChannels; + unsigned int halfFrameSize; - beampatterns_obj * beampatterns_mics; - beampatterns_obj * beampatterns_spatialfilter; - - track2gain_obj * track2gain; - gains_obj * gains; - gain2mask_obj * gain2mask; - masks_obj * masks; - - track2steer_obj * track2steer; - steers_obj * W; - steer2freq_obj * steer2freq; - steer2env_obj * steer2env; - - msg_spectra_obj * in1; - msg_tracks_obj * in2; - msg_spectra_obj * out1; - msg_envs_obj * out2; + char mode_sep; + char mode_pf; - unsigned long long * ids; + track2steer_obj * dds_track2steer; } mod_sss_obj; typedef struct mod_sss_cfg { - + + char mode_sep; + char mode_pf; + mics_obj * mics; samplerate_obj * samplerate; - soundspeed_obj * soundspeed; - spatialfilter_obj * spatialfilter; - - unsigned int nThetas; - float gainMin; + soundspeed_obj * soundspeed; + spatialfilter_obj * spatialfilter; } mod_sss_cfg; - mod_sss_obj * mod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config, const msg_envs_cfg * msg_envs_config); + mod_sss_obj * mod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_tracks_cfg * msg_tracks_config, const msg_spectra_cfg * msg_spectra_config); void mod_sss_destroy(mod_sss_obj * obj); int mod_sss_process(mod_sss_obj * obj); - void mod_sss_connect(mod_sss_obj * obj, msg_spectra_obj * in1, msg_tracks_obj * in2, msg_spectra_obj * out1, msg_envs_obj * out2); + int mod_sss_process_dds(mod_sss_obj * obj); + + int mod_sss_process_dgss(mod_sss_obj * obj); + + int mod_sss_process_dmvdr(mod_sss_obj * obj); + + void mod_sss_connect(mod_sss_obj * obj, msg_spectra_obj * in1, msg_tracks_obj * in2, msg_spectra_obj * out1, msg_spectra_obj * out2); void mod_sss_disconnect(mod_sss_obj * obj); diff --git a/src/signal/env.c b/src/signal/env.c deleted file mode 100644 index 134b6cd..0000000 --- a/src/signal/env.c +++ /dev/null @@ -1,100 +0,0 @@ - - #include "env.h" - - envs_obj * envs_construct_zero(const unsigned int nSignals, const unsigned int halfFrameSize) { - - envs_obj * obj; - unsigned int iSignal; - - obj = (envs_obj *) malloc(sizeof(envs_obj)); - - obj->nSignals = nSignals; - obj->halfFrameSize = halfFrameSize; - - obj->array = (float **) malloc(sizeof(float *) * nSignals); - for (iSignal = 0; iSignal < nSignals; iSignal++) { - obj->array[iSignal] = (float *) malloc(sizeof(float) * halfFrameSize); - memset(obj->array[iSignal], 0x00, halfFrameSize * sizeof(float)); - } - - return obj; - - } - - envs_obj * envs_clone(const envs_obj * obj) { - - envs_obj * clone; - unsigned int iSignal; - - clone = (envs_obj *) malloc(sizeof(envs_obj)); - - clone->nSignals = obj->nSignals; - clone->halfFrameSize = obj->halfFrameSize; - - clone->array = (float **) malloc(sizeof(float *) * obj->nSignals); - for (iSignal = 0; iSignal < obj->nSignals; iSignal++) { - clone->array[iSignal] = (float *) malloc(sizeof(float) * obj->halfFrameSize); - memcpy(clone->array[iSignal], obj->array[iSignal], obj->halfFrameSize * sizeof(float)); - } - - return clone; - - } - - void envs_copy(envs_obj * dest, const envs_obj * src) { - - unsigned int iSignal; - - for (iSignal = 0; iSignal < src->nSignals; iSignal++) { - memcpy(dest->array[iSignal], src->array[iSignal], src->halfFrameSize * sizeof(float)); - } - - } - - void envs_zero(envs_obj * obj) { - - unsigned int iSignal; - - for (iSignal = 0; iSignal < obj->nSignals; iSignal++) { - memset(obj->array[iSignal], 0x00, obj->halfFrameSize * sizeof(float)); - } - - } - - void envs_destroy(envs_obj * obj) { - - unsigned int iSignal; - - for (iSignal = 0; iSignal < obj->nSignals; iSignal++) { - free((void *) obj->array[iSignal]); - } - free((void *) obj->array); - - free((void *) obj); - - } - - void envs_printf(const envs_obj * obj) { - - unsigned int iSignal; - unsigned int iSample; - - for (iSignal = 0; iSignal < obj->nSignals; iSignal++) { - - printf("(%04u): ",iSignal); - - for (iSample = 0; iSample < obj->halfFrameSize; iSample++) { - - printf("%+1.5f ", obj->array[iSignal][iSample]); - - if ((((iSample+1) % 16) == 0) && ((iSample+1)!=obj->halfFrameSize)) { - printf("\n "); - } - - } - - printf("\n"); - - } - - } \ No newline at end of file diff --git a/src/signal/env.h b/src/signal/env.h deleted file mode 100644 index 7803ec2..0000000 --- a/src/signal/env.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __ODAS_SIGNAL_ENV -#define __ODAS_SIGNAL_ENV - - #include - #include - #include - - typedef struct envs_obj { - - unsigned int nSignals; - unsigned int halfFrameSize; - float ** array; - - } envs_obj; - - envs_obj * envs_construct_zero(const unsigned int nSignals, const unsigned int halfFrameSize); - - envs_obj * envs_clone(const envs_obj * obj); - - void envs_copy(envs_obj * dest, const envs_obj * src); - - void envs_zero(envs_obj * obj); - - void envs_destroy(envs_obj * obj); - - void envs_printf(const envs_obj * obj); - -#endif \ No newline at end of file diff --git a/src/sink/snk_hops.c b/src/sink/snk_hops.c index c33d303..7d24d71 100644 --- a/src/sink/snk_hops.c +++ b/src/sink/snk_hops.c @@ -20,10 +20,10 @@ switch (obj->format->type) { - case format_bin08: break; - case format_bin16: break; - case format_bin24: break; - case format_bin32: break; + case format_binary_int08: break; + case format_binary_int16: break; + case format_binary_int24: break; + case format_binary_int32: break; default: printf("Invalid format.\n"); @@ -64,6 +64,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + // Empty + + break; + case interface_file: obj->fp = fopen(obj->interface->fileName, "wb"); @@ -72,10 +78,6 @@ case interface_socket: - //struct sockaddr_in sserver; - //char * smessage; - //int sid; - printf("Not implemented yet.\n"); exit(EXIT_FAILURE); @@ -103,6 +105,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + // Empty + + break; + case interface_file: fclose(obj->fp); @@ -140,6 +148,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + rtnValue = snk_hops_process_blackhole(obj); + + break; + case interface_file: rtnValue = snk_hops_process_file(obj); @@ -171,6 +185,25 @@ } + int snk_hops_process_blackhole(snk_hops_obj * obj) { + + int rtnValue; + + if (obj->in->timeStamp != 0) { + + rtnValue = 0; + + } + else { + + rtnValue = -1; + + } + + return rtnValue; + + } + int snk_hops_process_file(snk_hops_obj * obj) { unsigned int iSample; @@ -186,10 +219,10 @@ switch (obj->format->type) { - case format_bin08: nBytes = 1; break; - case format_bin16: nBytes = 2; break; - case format_bin24: nBytes = 3; break; - case format_bin32: nBytes = 4; break; + case format_binary_int08: nBytes = 1; break; + case format_binary_int16: nBytes = 2; break; + case format_binary_int24: nBytes = 3; break; + case format_binary_int32: nBytes = 4; break; } diff --git a/src/sink/snk_hops.h b/src/sink/snk_hops.h index 0cbdca6..990c41a 100644 --- a/src/sink/snk_hops.h +++ b/src/sink/snk_hops.h @@ -55,6 +55,8 @@ int snk_hops_process(snk_hops_obj * obj); + int snk_hops_process_blackhole(snk_hops_obj * obj); + int snk_hops_process_file(snk_hops_obj * obj); int snk_hops_process_socket(snk_hops_obj * obj); diff --git a/src/sink/snk_pots.c b/src/sink/snk_pots.c index 8853879..2da9332 100644 --- a/src/sink/snk_pots.c +++ b/src/sink/snk_pots.c @@ -17,8 +17,8 @@ switch (obj->format->type) { - case format_json: break; - case format_float: break; + case format_text_json: break; + case format_binary_float: break; default: printf("Invalid format.\n"); @@ -65,6 +65,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + // Empty + + break; + case interface_file: obj->fp = fopen(obj->interface->fileName, "wb"); @@ -89,6 +95,12 @@ break; + case interface_terminal: + + // Empty + + break; + default: printf("Invalid interface type.\n"); @@ -104,6 +116,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + // Empty + + break; + case interface_file: fclose(obj->fp); @@ -116,6 +134,12 @@ break; + case interface_terminal: + + // Empty + + break; + default: printf("Invalid interface type.\n"); @@ -133,6 +157,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + rtnValue = snk_pots_process_blackhole(obj); + + break; + case interface_file: rtnValue = snk_pots_process_file(obj); @@ -145,6 +175,12 @@ break; + case interface_terminal: + + rtnValue = snk_pots_process_terminal(obj); + + break; + default: printf("Invalid interface type.\n"); @@ -158,6 +194,25 @@ } + int snk_pots_process_blackhole(snk_pots_obj * obj) { + + int rtnValue; + + if (obj->in->timeStamp != 0) { + + rtnValue = 0; + + } + else { + + rtnValue = -1; + + } + + return rtnValue; + + } + int snk_pots_process_file(snk_pots_obj * obj) { int rtnValue; @@ -166,7 +221,7 @@ switch(obj->format->type) { - case format_float: + case format_binary_float: fwrite(obj->in->pots->array, sizeof(float), 4 * obj->in->pots->nPots, obj->fp); @@ -196,7 +251,7 @@ switch(obj->format->type) { - case format_json: + case format_text_json: obj->smessage[0] = 0x00; @@ -244,6 +299,60 @@ } + int snk_pots_process_terminal(snk_pots_obj * obj) { + + int rtnValue; + unsigned int iPot; + + if (obj->in->timeStamp != 0) { + + switch(obj->format->type) { + + case format_text_json: + + printf("{\n"); + printf(" \"timeStamp\": %llu,\n",obj->in->timeStamp); + printf(" \"src\": [\n"); + + for (iPot = 0; iPot < obj->nPots; iPot++) { + + printf(" { \"x\": %1.3f, \"y\": %1.3f, \"z\": %1.3f, \"E\": %1.3f }", + obj->in->pots->array[iPot*4+0], + obj->in->pots->array[iPot*4+1], + obj->in->pots->array[iPot*4+2], + obj->in->pots->array[iPot*4+3]); + + if (iPot != (obj->nPots - 1)) { + + printf(","); + + } + + printf("\n"); + + } + + printf(" ]\n"); + printf("}\n"); + + rtnValue = 0; + + break; + + } + + } + else { + + rtnValue = -1; + + } + + return rtnValue; + + } + + snk_pots_cfg * snk_pots_cfg_construct(void) { snk_pots_cfg * cfg; diff --git a/src/sink/snk_pots.h b/src/sink/snk_pots.h index 706e95d..e6e68e9 100644 --- a/src/sink/snk_pots.h +++ b/src/sink/snk_pots.h @@ -55,10 +55,14 @@ int snk_pots_process(snk_pots_obj * obj); + int snk_pots_process_blackhole(snk_pots_obj * obj); + int snk_pots_process_file(snk_pots_obj * obj); int snk_pots_process_socket(snk_pots_obj * obj); + int snk_pots_process_terminal(snk_pots_obj * obj); + snk_pots_cfg * snk_pots_cfg_construct(void); void snk_pots_cfg_destroy(snk_pots_cfg * snk_pots_config); diff --git a/src/sink/snk_spectra.c b/src/sink/snk_spectra.c index 6dd3cfd..e8ae83f 100644 --- a/src/sink/snk_spectra.c +++ b/src/sink/snk_spectra.c @@ -16,7 +16,7 @@ switch (obj->format->type) { - case format_float: break; + case format_binary_float: break; default: printf("Invalid format.\n"); @@ -159,7 +159,7 @@ switch (obj->format->type) { - case format_float: + case format_binary_float: fwrite(&sampleReal, sizeof(float), 1, obj->fp); fwrite(&sampleImag, sizeof(float), 1, obj->fp); diff --git a/src/sink/snk_tracks.c b/src/sink/snk_tracks.c index 821c9ee..7387bb1 100644 --- a/src/sink/snk_tracks.c +++ b/src/sink/snk_tracks.c @@ -17,8 +17,8 @@ switch (obj->format->type) { - case format_json: break; - case format_float: break; + case format_text_json: break; + case format_binary_float: break; default: printf("Invalid format.\n"); @@ -65,6 +65,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + // Empty + + break; + case interface_file: obj->fp = fopen(obj->interface->fileName, "wb"); @@ -110,6 +116,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + // Empty + + break; + case interface_file: fclose(obj->fp); @@ -124,7 +136,7 @@ case interface_terminal: - // (Empty) + // Empty break; @@ -145,6 +157,12 @@ switch(obj->interface->type) { + case interface_blackhole: + + rtnValue = snk_tracks_process_blackhole(obj); + + break; + case interface_file: rtnValue = snk_tracks_process_file(obj); @@ -176,6 +194,25 @@ } + int snk_tracks_process_blackhole(snk_tracks_obj * obj) { + + int rtnValue; + + if (obj->in->timeStamp != 0) { + + rtnValue = 0; + + } + else { + + rtnValue = -1; + + } + + return rtnValue; + + } + int snk_tracks_process_file(snk_tracks_obj * obj) { int rtnValue; @@ -184,7 +221,7 @@ switch(obj->format->type) { - case format_float: + case format_binary_float: fwrite(obj->in->tracks->ids, sizeof(unsigned long long), obj->in->tracks->nTracks, obj->fp); fwrite(obj->in->tracks->array, sizeof(float), 3 * obj->in->tracks->nTracks, obj->fp); @@ -215,7 +252,7 @@ switch(obj->format->type) { - case format_json: + case format_text_json: obj->smessage[0] = 0x00; @@ -227,7 +264,9 @@ sprintf(obj->smessage,"%s { \"id\": %llu, \"x\": %1.3f, \"y\": %1.3f, \"z\": %1.3f }", obj->smessage, obj->in->tracks->ids[iTrack], - obj->in->tracks->array[iTrack*3+0], obj->in->tracks->array[iTrack*3+1], obj->in->tracks->array[iTrack*3+2]); + obj->in->tracks->array[iTrack*3+0], + obj->in->tracks->array[iTrack*3+1], + obj->in->tracks->array[iTrack*3+2]); if (iTrack != (obj->nTracks - 1)) { @@ -273,7 +312,7 @@ switch(obj->format->type) { - case format_json: + case format_text_json: printf("{\n"); printf(" \"timeStamp\": %llu,\n",obj->in->timeStamp); diff --git a/src/sink/snk_tracks.h b/src/sink/snk_tracks.h index 0e5b059..9685d96 100644 --- a/src/sink/snk_tracks.h +++ b/src/sink/snk_tracks.h @@ -55,6 +55,8 @@ int snk_tracks_process(snk_tracks_obj * obj); + int snk_tracks_process_blackhole(snk_tracks_obj * obj); + int snk_tracks_process_file(snk_tracks_obj * obj); int snk_tracks_process_socket(snk_tracks_obj * obj); diff --git a/src/sink/snk_xcorrs.c b/src/sink/snk_xcorrs.c deleted file mode 100644 index 8b4ea54..0000000 --- a/src/sink/snk_xcorrs.c +++ /dev/null @@ -1,218 +0,0 @@ - - #include "snk_xcorrs.h" - - snk_xcorrs_obj * snk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config) { - - snk_xcorrs_obj * obj; - - obj = (snk_xcorrs_obj *) malloc(sizeof(snk_xcorrs_obj)); - - obj->frameSize = msg_xcorrs_config->frameSize; - obj->nPairs = msg_xcorrs_config->nPairs; - obj->fS = msg_xcorrs_config->fS; - - obj->format = format_clone(snk_xcorrs_config->format); - obj->interface = interface_clone(snk_xcorrs_config->interface); - - switch (obj->format->type) { - - case format_float: break; - default: - - printf("Invalid format.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->in = (msg_xcorrs_obj *) NULL; - - return obj; - - } - - void snk_xcorrs_destroy(snk_xcorrs_obj * obj) { - - format_destroy(obj->format); - interface_destroy(obj->interface); - - free((void *) obj); - - } - - void snk_xcorrs_connect(snk_xcorrs_obj * obj, msg_xcorrs_obj * in) { - - obj->in = in; - - } - - void snk_xcorrs_disconnect(snk_xcorrs_obj * obj) { - - obj->in = (msg_xcorrs_obj *) NULL; - - } - - int snk_xcorrs_open(snk_xcorrs_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - obj->fp = fopen(obj->interface->fileName, "wb"); - - break; - - case interface_socket: - - printf("Not implemented yet.\n"); - exit(EXIT_FAILURE); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - int snk_xcorrs_close(snk_xcorrs_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - fclose(obj->fp); - - break; - - case interface_socket: - - printf("Not implemented yet.\n"); - exit(EXIT_FAILURE); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - int snk_xcorrs_process(snk_xcorrs_obj * obj) { - - int rtnValue; - - switch(obj->interface->type) { - - case interface_file: - - rtnValue = snk_xcorrs_process_file(obj); - - break; - - case interface_socket: - - rtnValue = snk_xcorrs_process_socket(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - return rtnValue; - - } - - int snk_xcorrs_process_file(snk_xcorrs_obj * obj) { - - unsigned int iSample; - unsigned int iPair; - float sample; - float sampleImag; - int rtnValue; - - if (obj->in->timeStamp != 0) { - - for (iSample = 0; iSample < obj->frameSize; iSample++) { - - for (iPair = 0; iPair < obj->nPairs; iPair++) { - - sample = obj->in->xcorrs->array[iPair][iSample]; - - switch (obj->format->type) { - - case format_float: - - fwrite(&sample, sizeof(float), 1, obj->fp); - - break; - - } - - } - - } - - rtnValue = 0; - - } - else { - - rtnValue = -1; - - } - - return rtnValue; - - } - - int snk_xcorrs_process_socket(snk_xcorrs_obj * obj) { - - printf("Not implemented\n"); - exit(EXIT_FAILURE); - - } - - snk_xcorrs_cfg * snk_xcorrs_cfg_construct(void) { - - snk_xcorrs_cfg * cfg; - - cfg = (snk_xcorrs_cfg *) malloc(sizeof(snk_xcorrs_cfg)); - - cfg->fS = 0; - cfg->format = (format_obj *) NULL; - cfg->interface = (interface_obj *) NULL; - - return cfg; - - } - - void snk_xcorrs_cfg_destroy(snk_xcorrs_cfg * snk_xcorrs_config) { - - if (snk_xcorrs_config->format != NULL) { - format_destroy(snk_xcorrs_config->format); - } - if (snk_xcorrs_config->interface != NULL) { - interface_destroy(snk_xcorrs_config->interface); - } - - free((void *) snk_xcorrs_config); - - } \ No newline at end of file diff --git a/src/sink/snk_xcorrs.h b/src/sink/snk_xcorrs.h deleted file mode 100644 index 300c5e3..0000000 --- a/src/sink/snk_xcorrs.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __ODAS_SINK_XCORRS -#define __ODAS_SINK_XCORRS - - #include - #include - #include - - #include "../general/format.h" - #include "../general/interface.h" - #include "../message/msg_xcorrs.h" - - typedef struct snk_xcorrs_obj { - - unsigned long long timeStamp; - - unsigned int frameSize; - unsigned int nPairs; - unsigned int fS; - - format_obj * format; - interface_obj * interface; - - FILE * fp; - - msg_xcorrs_obj * in; - - } snk_xcorrs_obj; - - typedef struct snk_xcorrs_cfg { - - unsigned int fS; - format_obj * format; - interface_obj * interface; - - } snk_xcorrs_cfg; - - snk_xcorrs_obj * snk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config); - - void snk_xcorrs_destroy(snk_xcorrs_obj * obj); - - void snk_xcorrs_connect(snk_xcorrs_obj * obj, msg_xcorrs_obj * in); - - void snk_xcorrs_disconnect(snk_xcorrs_obj * obj); - - int snk_xcorrs_open(snk_xcorrs_obj * obj); - - int snk_xcorrs_close(snk_xcorrs_obj * obj); - - int snk_xcorrs_process(snk_xcorrs_obj * obj); - - int snk_xcorrs_process_file(snk_xcorrs_obj * obj); - - int snk_xcorrs_process_socket(snk_xcorrs_obj * obj); - - snk_xcorrs_cfg * snk_xcorrs_cfg_construct(void); - - void snk_xcorrs_cfg_destroy(snk_xcorrs_cfg * snk_xcorrs_config); - -#endif \ No newline at end of file diff --git a/src/source/src_hops.c b/src/source/src_hops.c index 63c2eeb..0c28b55 100644 --- a/src/source/src_hops.c +++ b/src/source/src_hops.c @@ -12,7 +12,7 @@ obj->hopSize = msg_hops_config->hopSize; obj->nChannels = msg_hops_config->nChannels; - obj->fS = src_hops_config->fS; + obj->fS = msg_hops_config->fS; obj->format = format_clone(src_hops_config->format); obj->interface = interface_clone(src_hops_config->interface); @@ -21,10 +21,10 @@ switch (obj->format->type) { - case format_bin08: nBytes = 1; break; - case format_bin16: nBytes = 2; break; - case format_bin24: nBytes = 3; break; - case format_bin32: nBytes = 4; break; + case format_binary_int08: nBytes = 1; break; + case format_binary_int16: nBytes = 2; break; + case format_binary_int24: nBytes = 3; break; + case format_binary_int32: nBytes = 4; break; default: printf("Invalid format.\n"); @@ -119,25 +119,25 @@ switch (obj->format->type) { - case format_bin08: + case format_binary_int08: format = SND_PCM_FORMAT_S8; break; - case format_bin16: + case format_binary_int16: format = SND_PCM_FORMAT_S16_LE; break; - case format_bin24: + case format_binary_int24: format = SND_PCM_FORMAT_S24_LE; break; - case format_bin32: + case format_binary_int32: format = SND_PCM_FORMAT_S32_LE; @@ -312,10 +312,10 @@ switch (obj->format->type) { - case format_bin08: nBytes = 1; break; - case format_bin16: nBytes = 2; break; - case format_bin24: nBytes = 3; break; - case format_bin32: nBytes = 4; break; + case format_binary_int08: nBytes = 1; break; + case format_binary_int16: nBytes = 2; break; + case format_binary_int24: nBytes = 3; break; + case format_binary_int32: nBytes = 4; break; } @@ -373,10 +373,10 @@ switch (obj->format->type) { - case format_bin08: nBytes = 1; break; - case format_bin16: nBytes = 2; break; - case format_bin24: nBytes = 3; break; - case format_bin32: nBytes = 4; break; + case format_binary_int08: nBytes = 1; break; + case format_binary_int16: nBytes = 2; break; + case format_binary_int24: nBytes = 3; break; + case format_binary_int32: nBytes = 4; break; } @@ -417,7 +417,6 @@ cfg = (src_hops_cfg *) malloc(sizeof(src_hops_cfg)); - cfg->fS = 0; cfg->format = (format_obj *) NULL; cfg->interface = (interface_obj *) NULL; diff --git a/src/source/src_hops.h b/src/source/src_hops.h index cba9c7f..5dbff23 100644 --- a/src/source/src_hops.h +++ b/src/source/src_hops.h @@ -35,7 +35,6 @@ typedef struct src_hops_cfg { - unsigned int fS; format_obj * format; interface_obj * interface; diff --git a/src/source/src_pots.c b/src/source/src_pots.c deleted file mode 100644 index 5abe1e4..0000000 --- a/src/source/src_pots.c +++ /dev/null @@ -1,200 +0,0 @@ - - #include "src_pots.h" - - src_pots_obj * src_pots_construct(const src_pots_cfg * src_pots_config, const msg_pots_cfg * msg_pots_config) { - - src_pots_obj * obj; - unsigned int nBytes; - - obj = (src_pots_obj *) malloc(sizeof(src_pots_obj)); - - obj->timeStamp = 0; - - obj->nPots = msg_pots_config->nPots; - obj->fS = src_pots_config->fS; - - obj->format = format_clone(src_pots_config->format); - obj->interface = interface_clone(src_pots_config->interface); - - switch (obj->format->type) { - - case format_float: break; - default: - - printf("Invalid format.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->buffer = (float *) malloc(sizeof(float) * 4 * obj->nPots); - - obj->out = (msg_pots_obj *) NULL; - - return obj; - - } - - void src_pots_destroy(src_pots_obj * obj) { - - format_destroy(obj->format); - interface_destroy(obj->interface); - - free((void *) obj); - - } - - void src_pots_connect(src_pots_obj * obj, msg_pots_obj * out) { - - obj->out = out; - - } - - void src_pots_disconnect(src_pots_obj * obj) { - - obj->out = (msg_pots_obj *) NULL; - - } - - void src_pots_open(src_pots_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - src_pots_open_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - void src_pots_open_file(src_pots_obj * obj) { - - obj->fp = fopen(obj->interface->fileName, "rb"); - - } - - void src_pots_close(src_pots_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - src_pots_close_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - void src_pots_close_file(src_pots_obj * obj) { - - fclose(obj->fp); - - } - - int src_pots_process(src_pots_obj * obj) { - - int rtnValue; - - switch(obj->interface->type) { - - case interface_file: - - rtnValue = src_pots_process_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->timeStamp++; - obj->out->timeStamp = obj->timeStamp; - - return rtnValue; - - } - - int src_pots_process_file(src_pots_obj * obj) { - - unsigned int iPot; - int nSamples; - int rtnValue; - - memset(obj->buffer, 0x00, sizeof(float) * 4 * obj->nPots); - nSamples = fread(obj->buffer, sizeof(float), 4 * obj->nPots, obj->fp); - - for (iPot = 0; iPot < obj->nPots; iPot++) { - - obj->out->pots->array[iPot*4+0] = obj->buffer[iPot*4+0]; - obj->out->pots->array[iPot*4+1] = obj->buffer[iPot*4+1]; - obj->out->pots->array[iPot*4+2] = obj->buffer[iPot*4+2]; - obj->out->pots->array[iPot*4+3] = obj->buffer[iPot*4+3]; - - } - - if (nSamples != (4 * obj->nPots)) { - - rtnValue = -1; - - } - else { - - rtnValue = 0; - - } - - return rtnValue; - - } - - src_pots_cfg * src_pots_cfg_construct(void) { - - src_pots_cfg * cfg; - - cfg = (src_pots_cfg *) malloc(sizeof(src_pots_cfg)); - - cfg->fS = 0; - cfg->format = (format_obj *) NULL; - cfg->interface = (interface_obj *) NULL; - - return cfg; - - } - - void src_pots_cfg_destroy(src_pots_cfg * src_pots_config) { - - if (src_pots_config->format != NULL) { - format_destroy(src_pots_config->format); - } - if (src_pots_config->interface != NULL) { - interface_destroy(src_pots_config->interface); - } - - free((void *) src_pots_config); - - } \ No newline at end of file diff --git a/src/source/src_pots.h b/src/source/src_pots.h deleted file mode 100644 index 1c75d13..0000000 --- a/src/source/src_pots.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __ODAS_SOURCE_POTS -#define __ODAS_SOURCE_POTS - - #include - #include - #include - - #include "../general/format.h" - #include "../general/interface.h" - #include "../message/msg_pots.h" - #include "../signal/pot.h" - #include "../utils/pcm.h" - - typedef struct src_pots_obj { - - unsigned long long timeStamp; - - unsigned int nPots; - unsigned int fS; - - format_obj * format; - interface_obj * interface; - - FILE * fp; - - float * buffer; - - msg_pots_obj * out; - - } src_pots_obj; - - typedef struct src_pots_cfg { - - unsigned int fS; - format_obj * format; - interface_obj * interface; - - } src_pots_cfg; - - src_pots_obj * src_pots_construct(const src_pots_cfg * src_pots_config, const msg_pots_cfg * msg_pots_config); - - void src_pots_destroy(src_pots_obj * obj); - - void src_pots_connect(src_pots_obj * obj, msg_pots_obj * out); - - void src_pots_disconnect(src_pots_obj * obj); - - void src_pots_open(src_pots_obj * obj); - - void src_pots_open_file(src_pots_obj * obj); - - void src_pots_close(src_pots_obj * obj); - - void src_pots_close_file(src_pots_obj * obj); - - int src_pots_process(src_pots_obj * obj); - - int src_pots_process_file(src_pots_obj * obj); - - src_pots_cfg * src_pots_cfg_construct(void); - - void src_pots_cfg_destroy(src_pots_cfg * src_pots_config); - -#endif \ No newline at end of file diff --git a/src/source/src_spectra.c b/src/source/src_spectra.c deleted file mode 100644 index 33580db..0000000 --- a/src/source/src_spectra.c +++ /dev/null @@ -1,207 +0,0 @@ - - #include "src_spectra.h" - - src_spectra_obj * src_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config) { - - src_spectra_obj * obj; - unsigned int nBytes; - - obj = (src_spectra_obj *) malloc(sizeof(src_spectra_obj)); - - obj->timeStamp = 0; - - obj->halfFrameSize = msg_spectra_config->halfFrameSize; - obj->nChannels = msg_spectra_config->nChannels; - obj->fS = src_spectra_config->fS; - - obj->format = format_clone(src_spectra_config->format); - obj->interface = interface_clone(src_spectra_config->interface); - - switch (obj->format->type) { - - case format_float: break; - default: - - printf("Invalid format.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->buffer = (float *) malloc(sizeof(float) * obj->halfFrameSize * 2 * obj->nChannels); - - obj->out = (msg_spectra_obj *) NULL; - - return obj; - - } - - void src_spectra_destroy(src_spectra_obj * obj) { - - free((void *) obj->buffer); - format_destroy(obj->format); - interface_destroy(obj->interface); - - free((void *) obj); - - } - - void src_spectra_connect(src_spectra_obj * obj, msg_spectra_obj * out) { - - obj->out = out; - - } - - void src_spectra_disconnect(src_spectra_obj * obj) { - - obj->out = (msg_spectra_obj *) NULL; - - } - - void src_spectra_open(src_spectra_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - src_spectra_open_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - void src_spectra_open_file(src_spectra_obj * obj) { - - obj->fp = fopen(obj->interface->fileName, "rb"); - - } - - void src_spectra_close(src_spectra_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - src_spectra_close_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - void src_spectra_close_file(src_spectra_obj * obj) { - - fclose(obj->fp); - - } - - int src_spectra_process(src_spectra_obj * obj) { - - int rtnValue; - - switch(obj->interface->type) { - - case interface_file: - - rtnValue = src_spectra_process_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->timeStamp++; - obj->out->timeStamp = obj->timeStamp; - - return rtnValue; - - } - - int src_spectra_process_file(src_spectra_obj * obj) { - - unsigned int iSample; - unsigned int iChannel; - float sampleReal; - float sampleImag; - int nSamples; - int rtnValue; - - memset(obj->buffer, 0x00, sizeof(float) * obj->halfFrameSize * 2 * obj->nChannels); - nSamples = fread(obj->buffer, sizeof(float), obj->halfFrameSize * 2 * obj->nChannels, obj->fp); - - for (iSample = 0; iSample < obj->halfFrameSize; iSample++) { - - for (iChannel = 0; iChannel < obj->nChannels; iChannel++) { - - obj->out->freqs->array[iChannel][iSample*2+0] = obj->buffer[(iSample*2) * obj->nChannels + iChannel + 0]; - obj->out->freqs->array[iChannel][iSample*2+1] = obj->buffer[(iSample*2) * obj->nChannels + iChannel + 1]; - - } - - } - - if (nSamples != (obj->nChannels * obj->halfFrameSize)) { - - rtnValue = -1; - - } - else { - - rtnValue = 0; - - } - - return rtnValue; - - } - - src_spectra_cfg * src_spectra_cfg_construct(void) { - - src_spectra_cfg * cfg; - - cfg = (src_spectra_cfg *) malloc(sizeof(src_spectra_cfg)); - - cfg->fS = 0; - cfg->format = (format_obj *) NULL; - cfg->interface = (interface_obj *) NULL; - - return cfg; - - } - - void src_spectra_cfg_destroy(src_spectra_cfg * src_spectra_config) { - - if (src_spectra_config->format != NULL) { - format_destroy(src_spectra_config->format); - } - if (src_spectra_config->interface != NULL) { - interface_destroy(src_spectra_config->interface); - } - - free((void *) src_spectra_config); - - } \ No newline at end of file diff --git a/src/source/src_spectra.h b/src/source/src_spectra.h deleted file mode 100644 index b2b9f13..0000000 --- a/src/source/src_spectra.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __ODAS_SOURCE_SPECTRA -#define __ODAS_SOURCE_SPECTRA - - #include - #include - #include - - #include "../general/format.h" - #include "../general/interface.h" - #include "../general/thread.h" - #include "../message/msg_spectra.h" - #include "../signal/freq.h" - #include "../utils/pcm.h" - - typedef struct src_spectra_obj { - - unsigned long long timeStamp; - - unsigned int halfFrameSize; - unsigned int nChannels; - unsigned int fS; - - format_obj * format; - interface_obj * interface; - - FILE * fp; - - float * buffer; - - msg_spectra_obj * out; - - } src_spectra_obj; - - typedef struct src_spectra_cfg { - - unsigned int fS; - format_obj * format; - interface_obj * interface; - - } src_spectra_cfg; - - src_spectra_obj * src_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config); - - void src_spectra_destroy(src_spectra_obj * obj); - - void src_spectra_connect(src_spectra_obj * obj, msg_spectra_obj * out); - - void src_spectra_disconnect(src_spectra_obj * obj); - - void src_spectra_open(src_spectra_obj * obj); - - void src_spectra_open_file(src_spectra_obj * obj); - - void src_spectra_close(src_spectra_obj * obj); - - void src_spectra_close_file(src_spectra_obj * obj); - - int src_spectra_process(src_spectra_obj * obj); - - int src_spectra_process_file(src_spectra_obj * obj); - - src_spectra_cfg * src_spectra_cfg_construct(void); - - void src_spectra_cfg_destroy(src_spectra_cfg * src_spectra_config); - -#endif \ No newline at end of file diff --git a/src/source/src_tracks.c b/src/source/src_tracks.c deleted file mode 100644 index 42142b4..0000000 --- a/src/source/src_tracks.c +++ /dev/null @@ -1,199 +0,0 @@ - - #include "src_tracks.h" - - src_tracks_obj * src_tracks_construct(const src_tracks_cfg * src_tracks_config, const msg_tracks_cfg * msg_tracks_config) { - - src_tracks_obj * obj; - unsigned int nBytes; - - obj = (src_tracks_obj *) malloc(sizeof(src_tracks_obj)); - - obj->timeStamp = 0; - - obj->nTracks = msg_tracks_config->nTracks; - obj->fS = src_tracks_config->fS; - - obj->format = format_clone(src_tracks_config->format); - obj->interface = interface_clone(src_tracks_config->interface); - - switch (obj->format->type) { - - case format_float: break; - default: - - printf("Invalid format.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->buffer = (float *) malloc(sizeof(float) * 3 * obj->nTracks); - - obj->out = (msg_tracks_obj *) NULL; - - return obj; - - } - - void src_tracks_destroy(src_tracks_obj * obj) { - - format_destroy(obj->format); - interface_destroy(obj->interface); - - free((void *) obj); - - } - - void src_tracks_connect(src_tracks_obj * obj, msg_tracks_obj * out) { - - obj->out = out; - - } - - void src_tracks_disconnect(src_tracks_obj * obj) { - - obj->out = (msg_tracks_obj *) NULL; - - } - - void src_tracks_open(src_tracks_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - src_tracks_open_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - void src_tracks_open_file(src_tracks_obj * obj) { - - obj->fp = fopen(obj->interface->fileName, "rb"); - - } - - void src_tracks_close(src_tracks_obj * obj) { - - switch(obj->interface->type) { - - case interface_file: - - src_tracks_close_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - } - - void src_tracks_close_file(src_tracks_obj * obj) { - - fclose(obj->fp); - - } - - int src_tracks_process(src_tracks_obj * obj) { - - int rtnValue; - - switch(obj->interface->type) { - - case interface_file: - - rtnValue = src_tracks_process_file(obj); - - break; - - default: - - printf("Invalid interface type.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->timeStamp++; - obj->out->timeStamp = obj->timeStamp; - - return rtnValue; - - } - - int src_tracks_process_file(src_tracks_obj * obj) { - - unsigned int iTrack; - int nSamples; - int rtnValue; - - memset(obj->buffer, 0x00, sizeof(float) * 3 * obj->nTracks); - nSamples = fread(obj->buffer, sizeof(float), 3 * obj->nTracks, obj->fp); - - for (iTrack = 0; iTrack < obj->nTracks; iTrack++) { - - obj->out->tracks->array[iTrack*3+0] = obj->buffer[iTrack*3+0]; - obj->out->tracks->array[iTrack*3+1] = obj->buffer[iTrack*3+1]; - obj->out->tracks->array[iTrack*3+2] = obj->buffer[iTrack*3+2]; - - } - - if (nSamples != (3 * obj->nTracks)) { - - rtnValue = -1; - - } - else { - - rtnValue = 0; - - } - - return rtnValue; - - } - - src_tracks_cfg * src_tracks_cfg_construct(void) { - - src_tracks_cfg * cfg; - - cfg = (src_tracks_cfg *) malloc(sizeof(src_tracks_cfg)); - - cfg->fS = 0; - cfg->format = (format_obj *) NULL; - cfg->interface = (interface_obj *) NULL; - - return cfg; - - } - - void src_tracks_cfg_destroy(src_tracks_cfg * src_tracks_config) { - - if (src_tracks_config->format != NULL) { - format_destroy(src_tracks_config->format); - } - if (src_tracks_config->interface != NULL) { - interface_destroy(src_tracks_config->interface); - } - - free((void *) src_tracks_config); - - } \ No newline at end of file diff --git a/src/source/src_tracks.h b/src/source/src_tracks.h deleted file mode 100644 index 0ef2659..0000000 --- a/src/source/src_tracks.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef __ODAS_SOURCE_TRACKS -#define __ODAS_SOURCE_TRACKS - - #include - #include - #include - - #include "../general/format.h" - #include "../general/interface.h" - #include "../message/msg_tracks.h" - #include "../signal/pot.h" - #include "../utils/pcm.h" - - typedef struct src_tracks_obj { - - unsigned long long timeStamp; - - unsigned int nTracks; - unsigned int fS; - - format_obj * format; - interface_obj * interface; - - FILE * fp; - - float * buffer; - - msg_tracks_obj * out; - - } src_tracks_obj; - - typedef struct src_tracks_cfg { - - unsigned int fS; - format_obj * format; - interface_obj * interface; - - } src_tracks_cfg; - - src_tracks_obj * src_tracks_construct(const src_tracks_cfg * src_tracks_config, const msg_tracks_cfg * msg_tracks_config); - - void src_tracks_destroy(src_tracks_obj * obj); - - void src_tracks_connect(src_tracks_obj * obj, msg_tracks_obj * out); - - void src_tracks_disconnect(src_tracks_obj * obj); - - void src_tracks_open(src_tracks_obj * obj); - - void src_tracks_open_file(src_tracks_obj * obj); - - void src_tracks_close(src_tracks_obj * obj); - - void src_tracks_close_file(src_tracks_obj * obj); - - int src_tracks_process(src_tracks_obj * obj); - - int src_tracks_process_file(src_tracks_obj * obj); - - src_tracks_cfg * src_tracks_cfg_construct(void); - - void src_tracks_cfg_destroy(src_tracks_cfg * src_tracks_config); - -#endif \ No newline at end of file diff --git a/src/source/src_xcorrs.c b/src/source/src_xcorrs.c deleted file mode 100644 index b0fe1e3..0000000 --- a/src/source/src_xcorrs.c +++ /dev/null @@ -1,101 +0,0 @@ - - #include "src_xcorrs.h" - - src_xcorrs_obj * src_xcorrs_construct(const src_xcorrs_cfg * src_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config) { - - src_xcorrs_obj * obj; - unsigned int nBytes; - - obj = (src_xcorrs_obj *) malloc(sizeof(src_xcorrs_obj)); - - obj->timeStamp = 0; - - obj->frameSize = msg_spectra_config->frameSize; - obj->nPairs = msg_spectra_config->nPairs; - obj->fS = src_spectra_config->fS; - - obj->format = format_clone(src_spectra_config->format); - obj->interface = interface_clone(src_spectra_config->interface); - - switch (obj->format->type) { - - case format_float: break; - default: - - printf("Invalid format.\n"); - exit(EXIT_FAILURE); - - break; - - } - - obj->buffer = (float *) malloc(sizeof(float) * obj->halfFrameSize * 2 * obj->nChannels); - - obj->out = (msg_spectra_obj *) NULL; - - return obj; - - } - - void src_xcorrs_destroy(src_xcorrs_obj * obj) { - - } - - void src_xcorrs_connect(src_xcorrs_obj * obj, msg_xcorrs_obj * out) { - - } - - void src_xcorrs_disconnect(src_xcorrs_obj * obj) { - - } - - void src_xcorrs_open(src_xcorrs_obj * obj) { - - } - - void src_xcorrs_open_file(src_xcorrs_obj * obj) { - - } - - void src_xcorrs_close(src_xcorrs_obj * obj) { - - } - - void src_xcorrs_close_file(src_xcorrs_obj * obj) { - - } - - int src_xcorrs_process(src_xcorrs_obj * obj) { - - } - - int src_xcorrs_process_file(src_xcorrs_obj * obj) { - - } - - src_xcorrs_cfg * src_xcorrs_cfg_construct(void) { - - src_xcorrs_cfg * cfg; - - cfg = (src_xcorrs_cfg *) malloc(sizeof(src_xcorrs_cfg)); - - cfg->fS = 0; - cfg->format = (format_obj *) NULL; - cfg->interface = (interface_obj *) NULL; - - return cfg; - - } - - void src_xcorrs_cfg_destroy(src_xcorrs_cfg * src_xcorrs_config) { - - if (src_xcorrs_config->format != NULL) { - format_destroy(src_xcorrs_config->format); - } - if (src_xcorrs_config->interface != NULL) { - interface_destroy(src_xcorrs_config->interface); - } - - free((void *) src_xcorrs_config); - - } \ No newline at end of file diff --git a/src/source/src_xcorrs.h b/src/source/src_xcorrs.h deleted file mode 100644 index 77db97f..0000000 --- a/src/source/src_xcorrs.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifndef __ODAS_SOURCE_XCORRS -#define __ODAS_SOURCE_XCORRS - - #include - #include - #include - - #include "../general/format.h" - #include "../general/interface.h" - #include "../general/thread.h" - #include "../message/msg_xcorrs.h" - #include "../signal/xcorr.h" - #include "../utils/pcm.h" - - typedef struct src_xcorrs_obj { - - unsigned long long timeStamp; - - unsigned int frameSize; - unsigned int nPairs; - unsigned int fS; - - format_obj * format; - interface_obj * interface; - - FILE * fp; - - float * buffer; - - msg_xcorrs_obj * out; - - } src_xcorrs_obj; - - typedef struct src_xcorrs_cfg { - - unsigned int fS; - format_obj * format; - interface_obj * interface; - - } src_xcorrs_cfg; - - src_xcorrs_obj * src_xcorrs_construct(const src_xcorrs_cfg * src_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config); - - void src_xcorrs_destroy(src_xcorrs_obj * obj); - - void src_xcorrs_connect(src_xcorrs_obj * obj, msg_xcorrs_obj * out); - - void src_xcorrs_disconnect(src_xcorrs_obj * obj); - - void src_xcorrs_open(src_xcorrs_obj * obj); - - void src_xcorrs_open_file(src_xcorrs_obj * obj); - - void src_xcorrs_close(src_xcorrs_obj * obj); - - void src_xcorrs_close_file(src_xcorrs_obj * obj); - - int src_xcorrs_process(src_xcorrs_obj * obj); - - int src_xcorrs_process_file(src_xcorrs_obj * obj); - - src_xcorrs_cfg * src_xcorrs_cfg_construct(void); - - void src_xcorrs_cfg_destroy(src_xcorrs_cfg * src_xcorrs_config); - -#endif \ No newline at end of file diff --git a/src/system/freq2env.c b/src/system/freq2env.c deleted file mode 100644 index 295af65..0000000 --- a/src/system/freq2env.c +++ /dev/null @@ -1,47 +0,0 @@ - - #include "freq2env.h" - - freq2env_obj * freq2env_construct_zero(const unsigned int halfFrameSize, const unsigned int nSignals) { - - freq2env_obj * obj; - - obj = (freq2env_obj *) malloc(sizeof(freq2env_obj)); - - obj->halfFrameSize = halfFrameSize; - obj->nSignals = nSignals; - - return obj; - - } - - void freq2env_destroy(freq2env_obj * obj) { - - free((void *) obj); - - } - - void freq2env_process(freq2env_obj * obj, const freqs_obj * freqs, envs_obj * envs) { - - unsigned int iSignal; - unsigned int iSample; - - float real; - float imag; - float env; - - for (iSignal = 0; iSignal < obj->nSignals; iSignal++) { - - for (iSample = 0; iSample < obj->halfFrameSize; iSample++) { - - real = freqs->array[iSignal][iSample * 2 + 0]; - imag = freqs->array[iSignal][iSample * 2 + 1]; - - env = real * real + imag * imag; - - envs->array[iSignal][iSample] = sqrtf(env); - - } - - } - - } \ No newline at end of file diff --git a/src/system/freq2env.h b/src/system/freq2env.h deleted file mode 100644 index aff3e63..0000000 --- a/src/system/freq2env.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef __ODAS_SYSTEM_FREQ2ENV -#define __ODAS_SYSTEM_FREQ2ENV - - #include - #include - - #include "../signal/freq.h" - #include "../signal/env.h" - - typedef struct freq2env_obj { - - unsigned int nSignals; - unsigned int halfFrameSize; - - } freq2env_obj; - - freq2env_obj * freq2env_construct_zero(const unsigned int halfFrameSize, const unsigned int nSignals); - - void freq2env_destroy(freq2env_obj * obj); - - void freq2env_process(freq2env_obj * obj, const freqs_obj * freqs, envs_obj * envs); - -#endif \ No newline at end of file diff --git a/src/system/freq2freq.c b/src/system/freq2freq.c index ef89bd1..21f55c6 100644 --- a/src/system/freq2freq.c +++ b/src/system/freq2freq.c @@ -99,45 +99,6 @@ } - void freq2freq_process_postfilter(freq2freq_obj * obj, const tracks_obj * tracks, const freqs_obj * freqsSeps, const envs_obj * envsSeps, const envs_obj * envsDiffuse, freqs_obj * freqsPosts) { - - unsigned int iSignal; - unsigned int iSample; - - float ratio; - float gain; - float real; - float imag; - - for (iSignal = 0; iSignal < freqsSeps->nSignals; iSignal++) { - - if (tracks->ids[iSignal] != 0) { - - for (iSample = 0; iSample < obj->halfFrameSize; iSample++) { - - ratio = envsSeps->array[iSignal][iSample] / (envsDiffuse->array[iSignal][iSample] + obj->epsilon); - - gain = (1.0f - obj->Ginterf) / (1.0f + expf(-1.0f * obj->alpha * (ratio - obj->beta))) + obj->Ginterf; - - real = freqsSeps->array[iSignal][iSample * 2 + 0]; - imag = freqsSeps->array[iSignal][iSample * 2 + 1]; - - freqsPosts->array[iSignal][iSample * 2 + 0] = gain * real; - freqsPosts->array[iSignal][iSample * 2 + 1] = gain * imag; - - } - - } - else { - - memset(freqsPosts->array[iSignal], 0x00, sizeof(float) * obj->halfFrameSize * 2); - - } - - } - - } - void freq2freq_process_interpolate(freq2freq_obj * obj, const freqs_obj * freqs, const freqs_obj * freqsInterp) { unsigned int iSignal; diff --git a/src/system/freq2freq.h b/src/system/freq2freq.h index ee759a5..a3816bc 100644 --- a/src/system/freq2freq.h +++ b/src/system/freq2freq.h @@ -4,7 +4,6 @@ #include #include - #include "../signal/env.h" #include "../signal/freq.h" #include "../signal/pair.h" #include "../signal/track.h" @@ -31,8 +30,6 @@ void freq2freq_process_lowpass(freq2freq_obj * obj, const freqs_obj * freqsAllPass, freqs_obj * freqsLowPass); - void freq2freq_process_postfilter(freq2freq_obj * obj, const tracks_obj * tracks, const freqs_obj * freqsSeps, const envs_obj * envsSeps, const envs_obj * envsDiffuse, freqs_obj * freqsPosts); - void freq2freq_process_interpolate(freq2freq_obj * obj, const freqs_obj * freqs, const freqs_obj * freqsInterp); #endif \ No newline at end of file diff --git a/src/system/steer2env.c b/src/system/steer2env.c deleted file mode 100644 index 57de3e4..0000000 --- a/src/system/steer2env.c +++ /dev/null @@ -1,84 +0,0 @@ - - #include "steer2env.h" - - steer2env_obj * steer2env_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int halfFrameSize) { - - steer2env_obj * obj; - - obj = (steer2env_obj *) malloc(sizeof(steer2env_obj)); - - obj->nSeps = nSeps; - obj->nChannels = nChannels; - obj->halfFrameSize = halfFrameSize; - - return obj; - - } - - void steer2env_destroy(steer2env_obj * obj) { - - free((void *) obj); - - } - - void steer2env_process(steer2env_obj * obj, const tracks_obj * tracks, const steers_obj * demixing, const masks_obj * masks, const freqs_obj * freqs, envs_obj * envs) { - - unsigned int iSep; - unsigned int iChannel; - unsigned int iBin; - - unsigned int iSampleSC; - unsigned int iSampleBC; - unsigned int iSampleB; - - float Xreal; - float Ximag; - float Wreal; - float Wimag; - float Yreal; - float Yimag; - - for (iSep = 0; iSep < obj->nSeps; iSep++) { - - if (tracks->ids[iSep] != 0) { - - memset(envs->array[iSep], 0x00, sizeof(float) * obj->halfFrameSize); - - for (iChannel = 0; iChannel < obj->nChannels; iChannel++) { - - iSampleSC = iSep * obj->nChannels + iChannel; - - if (masks->array[iSampleSC] == 1) { - - for (iBin = 0; iBin < obj->halfFrameSize; iBin++) { - - iSampleBC = iBin * obj->nChannels + iChannel; - iSampleB = iBin; - - Xreal = freqs->array[iChannel][iSampleB * 2 + 0]; - Ximag = freqs->array[iChannel][iSampleB * 2 + 1]; - - Wreal = demixing->array[iSep][iSampleBC * 2 + 0]; - Wimag = demixing->array[iSep][iSampleBC * 2 + 1]; - - Yreal = Wreal * Xreal - Wimag * Ximag; - Yimag = Wreal * Ximag + Wimag * Xreal; - - envs->array[iSep][iSampleB] += sqrtf(Yreal*Yreal + Yimag*Yimag); - - } - - } - - } - - } - else { - - memset(envs->array[iSep], 0x00, sizeof(float) * obj->halfFrameSize); - - } - - } - - } diff --git a/src/system/steer2env.h b/src/system/steer2env.h deleted file mode 100644 index 61e1f2d..0000000 --- a/src/system/steer2env.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __ODAS_SYSTEM_STEER2ENV -#define __ODAS_SYSTEM_STEER2ENV - - #include - #include - #include - #include - - #include "../signal/env.h" - #include "../signal/freq.h" - #include "../signal/mask.h" - #include "../signal/steer.h" - #include "../signal/track.h" - - typedef struct steer2env_obj { - - unsigned int nSeps; - unsigned int nChannels; - unsigned int halfFrameSize; - - } steer2env_obj; - - steer2env_obj * steer2env_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int halfFrameSize); - - void steer2env_destroy(steer2env_obj * obj); - - void steer2env_process(steer2env_obj * obj, const tracks_obj * tracks, const steers_obj * demixing, const masks_obj * masks, const freqs_obj * freqs, envs_obj * envs); - -#endif \ No newline at end of file -- 2.34.1