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
src/signal/postprob.c
src/signal/pot.c
src/signal/scan.c
- src/signal/shift.c
src/signal/spatialgain.c
src/signal/spatialindex.c
src/signal/spatialmask.c
+ src/signal/steer.c
src/signal/tau.c
src/signal/tdoa.c
src/signal/track.c
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
src/system/mixture2mixture.c
src/system/particle2coherence.c
src/system/particle2particle.c
- src/system/shift2freq.c
+ src/system/steer2env.c
+ src/system/steer2freq.c
src/system/track2gain.c
- src/system/track2shift.c
+ src/system/track2steer.c
src/system/xcorr2aimg.c
src/system/xcorr2xcorr.c
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
src/amessage/amsg_tracks.c
+ src/amodule/amod_gain.c
src/amodule/amod_istft.c
src/amodule/amod_mapping.c
src/amodule/amod_resample.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
add_executable(server
demo/server.c
)
+
+add_executable(debug
+ demo/debug.c
+)
+target_link_libraries(debug
+ odas
+)
\ No newline at end of file
input:
{
- raw: { type = "file"; path = "in.raw"; format = "bin16"; }
+ raw: { type = "file"; path = "meeting_recorded_raw_16.raw"; format = "bin16"; }
#raw: { type = "soundcard"; card = 3; device = 0; format = "bin16"; }
};
ssl:
(
- { type = "file"; path = "potential.bin"; format = "float"; }
+# { type = "file"; path = "potential.bin"; format = "float"; },
+# { type = "socket"; ip = "10.51.80.27"; port = 5000; format = "json"; }
);
sst:
(
- { type = "file"; path = "tracked.bin"; format = "float"; }
+# { type = "file"; path = "tracked.bin"; format = "float"; }
+# { type = "socket"; ip = "10.51.80.27"; port = 5000; format = "json"; }
);
sss:
(
- { type = "file"; path = "separated_stft.bin"; format = "float"; }
+# { type = "file"; path = "separated_stft.bin"; format = "float"; }
);
sspf:
(
- { type = "file"; path = "postfiltered_stft.bin"; format = "float"; }
+# { type = "file"; path = "postfiltered_stft.bin"; format = "float"; }
);
+ istft:
+ (
+# { type = "file"; path = "separated_16.raw"; format = "bin16"; }
+ )
+
+ playback:
+ (
+ { type = "file"; path = "playback_16.raw"; format = "bin16"; }
+ )
+
}
\ No newline at end of file
raw:
{
- fS = 44100;
+ fS = 48000;
hopSize = 512;
nChannels = 8;
# Parameters used by both the Kalman and particle filter
active = (
- { weight = 1.0; mu = 0.1; sigma2 = 0.0001 }
+ { weight = 1.0; mu = 0.3; sigma2 = 0.0025 }
);
inactive = (
- { weight = 1.0; mu = 0.07; sigma2 = 0.0001 }
+ { weight = 1.0; mu = 0.15; sigma2 = 0.0025 }
);
sigmaR2_prob = 0.0025;
kalman: {
- sigmaQ = 0.01;
+ sigmaQ = 0.001;
}
sspf: {
- nThetas = 181;
- gainMin = 0.01;
+ alpha = 10.0;
+ beta = 0.95;
+ Ginterf = 0.01;
+
+}
+
+# Playback of separated streams
+
+playback: {
+
+ volume = 10.0;
}
\ No newline at end of file
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->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->snk_hops_mapping_configs[iSink] = parameters_snk_hops_mapping_config(file_config, file_ios, iSink);
+
}
// +----------------------------------------------------------+
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->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);
+
}
// +----------------------------------------------------------+
cfgs->snk_pots_ssl_configs = (snk_pots_cfg **) malloc(sizeof(snk_pots_cfg *) * cfgs->snk_pots_ssl_config_count);
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);
+
}
// +----------------------------------------------------------+
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->msg_spectra_sss_config = parameters_msg_spectra_sss_config(file_config, file_ios);
+ cfgs->msg_envs_sss_config = parameters_msg_envs_sss_config(file_config, file_ios);
// +------------------------------------------------------+
// | Sinks |
cfgs->snk_spectra_sss_configs = (snk_spectra_cfg **) malloc(sizeof(snk_spectra_cfg *) * cfgs->snk_spectra_sss_config_count);
for (iSink = 0; iSink < cfgs->snk_spectra_sss_config_count; iSink++) {
+
cfgs->snk_spectra_sss_configs[iSink] = parameters_snk_spectra_sss_config(file_config, file_ios, iSink);
+
}
// +----------------------------------------------------------+
cfgs->snk_spectra_sspf_configs = (snk_spectra_cfg **) malloc(sizeof(snk_spectra_cfg *) * cfgs->snk_spectra_sspf_config_count);
for (iSink = 0; iSink < cfgs->snk_spectra_sspf_config_count; iSink++) {
+
cfgs->snk_spectra_sspf_configs[iSink] = parameters_snk_spectra_sspf_config(file_config, file_ios, iSink);
+
+ }
+
+
+ // +----------------------------------------------------------+
+ // | ISTFT |
+ // +----------------------------------------------------------+
+
+ // +------------------------------------------------------+
+ // | Module |
+ // +------------------------------------------------------+
+
+ cfgs->mod_istft_config = parameters_mod_istft_config(file_config, file_ios);
+
+ // +------------------------------------------------------+
+ // | Message |
+ // +------------------------------------------------------+
+
+ cfgs->msg_hops_istft_config = parameters_msg_hops_istft_config(file_config, file_ios);
+
+ // +------------------------------------------------------+
+ // | Sinks |
+ // +------------------------------------------------------+
+
+ cfgs->snk_hops_istft_config_count = parameters_snk_hops_istft_count(file_config, file_ios);
+ cfgs->snk_hops_istft_configs = (snk_hops_cfg **) malloc(sizeof(snk_hops_cfg *) * cfgs->snk_hops_istft_config_count);
+
+ for (iSink = 0; iSink < cfgs->snk_hops_istft_config_count; iSink++) {
+
+ cfgs->snk_hops_istft_configs[iSink] = parameters_snk_hops_istft_config(file_config, file_ios, iSink);
+
}
+ // +----------------------------------------------------------+
+ // | Gain |
+ // +----------------------------------------------------------+
+
+ // +------------------------------------------------------+
+ // | Module |
+ // +------------------------------------------------------+
+
+ cfgs->mod_gain_config = parameters_mod_gain_config(file_config, file_ios);
+
+ // +------------------------------------------------------+
+ // | Message |
+ // +------------------------------------------------------+
+
+ cfgs->msg_hops_gain_config = parameters_msg_hops_gain_config(file_config, file_ios);
+
+ // +------------------------------------------------------+
+ // | Sinks |
+ // +------------------------------------------------------+
+
+ cfgs->snk_hops_gain_config_count = parameters_snk_hops_gain_count(file_config, file_ios);
+ cfgs->snk_hops_gain_configs = (snk_hops_cfg **) malloc(sizeof(snk_hops_cfg *) * cfgs->snk_hops_gain_config_count);
+
+ for (iSink = 0; iSink < cfgs->snk_hops_gain_config_count; iSink++) {
+
+ cfgs->snk_hops_gain_configs[iSink] = parameters_snk_hops_gain_config(file_config, file_ios, iSink);
+
+ }
return cfgs;
// +------------------------------------------------------+
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);
// +----------------------------------------------------------+
// +------------------------------------------------------+
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);
// +----------------------------------------------------------+
// +------------------------------------------------------+
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);
// +----------------------------------------------------------+
// +------------------------------------------------------+
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);
// +----------------------------------------------------------+
// +------------------------------------------------------+
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);
// +----------------------------------------------------------+
// +------------------------------------------------------+
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);
// +----------------------------------------------------------+
// +------------------------------------------------------+
msg_spectra_cfg_destroy(cfgs->msg_spectra_sss_config);
+ msg_envs_cfg_destroy(cfgs->msg_envs_sss_config);
// +------------------------------------------------------+
// | Sinks |
// +------------------------------------------------------+
for (iSink = 0; iSink < cfgs->snk_spectra_sss_config_count; iSink++) {
+
snk_spectra_cfg_destroy(cfgs->snk_spectra_sss_configs[iSink]);
+
}
+
free((void *) cfgs->snk_spectra_sss_configs);
// +----------------------------------------------------------+
// +------------------------------------------------------+
for (iSink = 0; iSink < cfgs->snk_spectra_sspf_config_count; iSink++) {
+
snk_spectra_cfg_destroy(cfgs->snk_spectra_sspf_configs[iSink]);
+
}
+
free((void *) cfgs->snk_spectra_sspf_configs);
+ // +----------------------------------------------------------+
+ // | ISTFT |
+ // +----------------------------------------------------------+
+
+ // +------------------------------------------------------+
+ // | Module |
+ // +------------------------------------------------------+
+
+ mod_istft_cfg_destroy(cfgs->mod_istft_config);
+
+ // +------------------------------------------------------+
+ // | Message |
+ // +------------------------------------------------------+
+
+ msg_hops_cfg_destroy(cfgs->msg_hops_istft_config);
+
+ // +------------------------------------------------------+
+ // | Sinks |
+ // +------------------------------------------------------+
+
+ for (iSink = 0; iSink < cfgs->snk_hops_istft_config_count; iSink++) {
+
+ snk_hops_cfg_destroy(cfgs->snk_hops_istft_configs[iSink]);
+
+ }
+
+ free((void *) cfgs->snk_hops_istft_configs);
+
+ // +----------------------------------------------------------+
+ // | Gain |
+ // +----------------------------------------------------------+
+
+ // +------------------------------------------------------+
+ // | Module |
+ // +------------------------------------------------------+
+
+ mod_gain_cfg_destroy(cfgs->mod_gain_config);
+
+ // +------------------------------------------------------+
+ // | Message |
+ // +------------------------------------------------------+
+
+ msg_hops_cfg_destroy(cfgs->msg_hops_gain_config);
+
+ // +------------------------------------------------------+
+ // | Sinks |
+ // +------------------------------------------------------+
+
+ for (iSink = 0; iSink < cfgs->snk_hops_gain_config_count; iSink++) {
+
+ snk_hops_cfg_destroy(cfgs->snk_hops_gain_configs[iSink]);
+
+ }
+
+ free((void *) cfgs->snk_hops_gain_configs);
+
free((void *) cfgs);
}
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;
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;
+
} configs;
configs * configs_construct(const char * file_config, const char * file_ios);
--- /dev/null
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
+
+ #include <odas/odas.h>
+
+ int main(int argc, char* argv[])
+ {
+
+
+ return 0;
+
+ }
\ No newline at end of file
// | Source |
// +--------------------------------------------------+
- objs->src_hops_raw_object = src_hops_construct(cfgs->src_hops_raw_config, cfgs->msg_hops_raw_config);
+ objs->src_hops_raw_object = src_hops_construct(cfgs->src_hops_raw_config,
+ cfgs->msg_hops_raw_config);
// +--------------------------------------------------+
// | Message |
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->snk_hops_raw_objects[iSink] = snk_hops_construct(cfgs->snk_hops_raw_configs[iSink],
+ cfgs->msg_hops_raw_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->mod_mapping_object = mod_mapping_construct(cfgs->mod_mapping_config, cfgs->msg_hops_mapping_config);
+ objs->mod_mapping_object = mod_mapping_construct(cfgs->mod_mapping_config,
+ cfgs->msg_hops_mapping_config);
// +--------------------------------------------------+
// | Message |
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->snk_hops_mapping_objects[iSink] = snk_hops_construct(cfgs->snk_hops_mapping_configs[iSink],
+ cfgs->msg_hops_mapping_config);
+
}
// +------------------------------------------------------+
// | 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_object = mod_resample_construct(cfgs->mod_resample_config,
+ cfgs->msg_hops_mapping_config,
+ cfgs->msg_hops_resample_config);
// +--------------------------------------------------+
// | Message |
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->snk_hops_resample_objects[iSink] = snk_hops_construct(cfgs->snk_hops_resample_configs[iSink],
+ cfgs->msg_hops_resample_config);
+
}
// +------------------------------------------------------+
// | 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_object = mod_stft_construct(cfgs->mod_stft_config,
+ cfgs->msg_hops_resample_config,
+ cfgs->msg_spectra_stft_config);
// +--------------------------------------------------+
// | Message |
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->snk_spectra_stft_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_stft_configs[iSink],
+ cfgs->msg_spectra_stft_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->mod_ssl_object = mod_ssl_construct(cfgs->mod_ssl_config, cfgs->msg_spectra_stft_config, cfgs->msg_pots_ssl_config);
+ objs->mod_ssl_object = mod_ssl_construct(cfgs->mod_ssl_config,
+ cfgs->msg_spectra_stft_config,
+ cfgs->msg_pots_ssl_config);
// +--------------------------------------------------+
// | Message |
objs->snk_pots_ssl_objects = (snk_pots_obj **) malloc(sizeof(snk_pots_obj *) * cfgs->snk_pots_ssl_config_count);
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);
+
+ objs->snk_pots_ssl_objects[iSink] = snk_pots_construct(cfgs->snk_pots_ssl_configs[iSink],
+ cfgs->msg_pots_ssl_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->mod_sst_object = mod_sst_construct(cfgs->mod_sst_config, cfgs->mod_ssl_config, cfgs->msg_pots_ssl_config, cfgs->msg_tracks_sst_config);
+ objs->mod_sst_object = mod_sst_construct(cfgs->mod_sst_config,
+ cfgs->mod_ssl_config,
+ cfgs->msg_pots_ssl_config,
+ cfgs->msg_tracks_sst_config);
// +--------------------------------------------------+
// | Message |
objs->snk_tracks_sst_objects = (snk_tracks_obj **) malloc(sizeof(snk_tracks_obj *) * cfgs->snk_tracks_sst_config_count);
for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) {
- objs->snk_tracks_sst_objects[iSink] = snk_tracks_construct(cfgs->snk_tracks_sst_configs[iSink], cfgs->msg_tracks_sst_config);
+
+ objs->snk_tracks_sst_objects[iSink] = snk_tracks_construct(cfgs->snk_tracks_sst_configs[iSink],
+ cfgs->msg_tracks_sst_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->mod_sss_object = mod_sss_construct(cfgs->mod_sss_config, cfgs->msg_spectra_sss_config, cfgs->msg_tracks_sst_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);
// +--------------------------------------------------+
// | Message |
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);
+
+ objs->snk_spectra_sss_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_sss_configs[iSink],
+ cfgs->msg_spectra_sss_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->mod_sspf_object = mod_sspf_construct(cfgs->mod_sspf_config, cfgs->msg_spectra_sspf_config, cfgs->msg_tracks_sst_config);
+ 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 |
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);
+
+ objs->snk_spectra_sspf_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_sspf_configs[iSink],
+ cfgs->msg_spectra_sspf_config);
+
+ }
+
+ // +------------------------------------------------------+
+ // | ISTFT |
+ // +------------------------------------------------------+
+
+ // +--------------------------------------------------+
+ // | Module |
+ // +--------------------------------------------------+
+
+ objs->mod_istft_object = mod_istft_construct(cfgs->mod_istft_config,
+ cfgs->msg_spectra_sspf_config,
+ cfgs->msg_hops_istft_config);
+
+ // +--------------------------------------------------+
+ // | Message |
+ // +--------------------------------------------------+
+
+ objs->msg_hops_istft_object = msg_hops_construct(cfgs->msg_hops_istft_config);
+
+ // +--------------------------------------------------+
+ // | 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);
+
+ }
+
+ // +------------------------------------------------------+
+ // | Gain |
+ // +------------------------------------------------------+
+
+ // +--------------------------------------------------+
+ // | 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);
+
+ // +--------------------------------------------------+
+ // | 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);
+
+ 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 |
// +----------------------------------------------------------+
- 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+3, 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+2, 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_spectra_sspf_object = con_spectra_construct(objs->snk_spectra_sspf_object_count, cfgs->msg_spectra_sspf_config);
+ // 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 + 2,
+ 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 + 2,
+ 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);
+
+ objs->con_spectra_sspf_object = con_spectra_construct(objs->snk_spectra_sspf_object_count + 1,
+ cfgs->msg_spectra_sspf_config);
+
+ objs->con_hops_istft_object = con_hops_construct(objs->snk_hops_istft_object_count + 1,
+ cfgs->msg_hops_istft_config);
+
+ objs->con_hops_gain_object = con_hops_construct(objs->snk_hops_gain_object_count,
+ cfgs->msg_hops_gain_config);
// +------------------------------------------------------+
// | Raw |
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]);
+ objs->con_hops_raw_object->outs[iSink + 1]);
}
for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) {
snk_hops_connect(objs->snk_hops_mapping_objects[iSink],
- objs->con_hops_mapping_object->outs[iSink+1]);
+ objs->con_hops_mapping_object->outs[iSink + 1]);
}
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]);
+ objs->con_hops_resample_object->outs[iSink + 1]);
}
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+3]);
+ objs->con_spectra_stft_object->outs[iSink + 2]);
}
for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) {
snk_pots_connect(objs->snk_pots_ssl_objects[iSink],
- objs->con_pots_ssl_object->outs[iSink+1]);
+ objs->con_pots_ssl_object->outs[iSink + 1]);
}
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+2]);
+ objs->con_tracks_sst_object->outs[iSink + 2]);
}
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_spectra_sss_object->in,
+ objs->con_envs_sss_object->in);
// +--------------------------------------------------+
// | Sinks |
for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) {
snk_spectra_connect(objs->snk_spectra_sss_objects[iSink],
- objs->con_spectra_sss_object->outs[iSink+1]);
+ objs->con_spectra_sss_object->outs[iSink + 1]);
}
// +--------------------------------------------------+
mod_sspf_connect(objs->mod_sspf_object,
- objs->con_spectra_stft_object->outs[2],
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);
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]);
+ objs->con_spectra_sspf_object->outs[iSink + 1]);
}
+ // +------------------------------------------------------+
+ // | ISTFT |
+ // +------------------------------------------------------+
+
+ // +--------------------------------------------------+
+ // | Module |
+ // +--------------------------------------------------+
+
+ mod_istft_connect(objs->mod_istft_object,
+ objs->con_spectra_sspf_object->outs[0],
+ objs->con_hops_istft_object->in);
+
+ // +--------------------------------------------------+
+ // | Sinks |
+ // +--------------------------------------------------+
+
+ 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]);
+
+ }
+
+ // +------------------------------------------------------+
+ // | Gain |
+ // +------------------------------------------------------+
+
+ // +--------------------------------------------------+
+ // | Module |
+ // +--------------------------------------------------+
+
+ mod_gain_connect(objs->mod_gain_object,
+ objs->con_hops_istft_object->outs[0],
+ objs->con_hops_gain_object->in);
+
+ // +--------------------------------------------------+
+ // | Sinks |
+ // +--------------------------------------------------+
+
+ 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;
}
// +--------------------------------------------------+
for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) {
+
snk_hops_destroy(objs->snk_hops_raw_objects[iSink]);
+
}
+
free((void *) objs->snk_hops_raw_objects);
// +--------------------------------------------------+
// +--------------------------------------------------+
for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) {
+
snk_hops_destroy(objs->snk_hops_mapping_objects[iSink]);
+
}
+
free((void *) objs->snk_hops_mapping_objects);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
con_spectra_destroy(objs->con_spectra_sss_object);
+ con_envs_destroy(objs->con_envs_sss_object);
// +------------------------------------------------------+
// | SSPF |
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
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);
}
// | Source |
// +--------------------------------------------------+
- objs->asrc_hops_raw_object = asrc_hops_construct(cfgs->src_hops_raw_config, cfgs->msg_hops_raw_config);
+ 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);
+ objs->amsg_hops_raw_object = amsg_hops_construct(objs->nMessages,
+ cfgs->msg_hops_raw_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_hops_raw_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_raw_configs[iSink],
+ cfgs->msg_hops_raw_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->amod_mapping_object = amod_mapping_construct(cfgs->mod_mapping_config, cfgs->msg_hops_mapping_config);
+ 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);
+ objs->amsg_hops_mapping_object = amsg_hops_construct(objs->nMessages,
+ cfgs->msg_hops_mapping_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_hops_mapping_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_mapping_configs[iSink],
+ cfgs->msg_hops_mapping_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->amod_resample_object = amod_resample_construct(cfgs->mod_resample_config, cfgs->msg_hops_mapping_config, cfgs->msg_hops_resample_config);
+ 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);
+ objs->amsg_hops_resample_object = amsg_hops_construct(objs->nMessages,
+ cfgs->msg_hops_resample_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_hops_resample_objects[iSink] = asnk_hops_construct(cfgs->snk_hops_resample_configs[iSink],
+ cfgs->msg_hops_resample_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->amod_stft_object = amod_stft_construct(cfgs->mod_stft_config, cfgs->msg_hops_resample_config, cfgs->msg_spectra_stft_config);
+ 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);
+ objs->amsg_spectra_stft_object = amsg_spectra_construct(objs->nMessages,
+ cfgs->msg_spectra_stft_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_spectra_stft_objects[iSink] = asnk_spectra_construct(cfgs->snk_spectra_stft_configs[iSink],
+ cfgs->msg_spectra_stft_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->amod_ssl_object = amod_ssl_construct(cfgs->mod_ssl_config, cfgs->msg_spectra_stft_config, cfgs->msg_pots_ssl_config);
+ 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);
+ objs->amsg_pots_ssl_object = amsg_pots_construct(objs->nMessages,
+ cfgs->msg_pots_ssl_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_pots_ssl_objects[iSink] = asnk_pots_construct(cfgs->snk_pots_ssl_configs[iSink],
+ cfgs->msg_pots_ssl_config);
+
}
// +------------------------------------------------------+
// | 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);
+ 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);
+ objs->amsg_tracks_sst_object = amsg_tracks_construct(objs->nMessages,
+ cfgs->msg_tracks_sst_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_tracks_sst_objects[iSink] = asnk_tracks_construct(cfgs->snk_tracks_sst_configs[iSink],
+ cfgs->msg_tracks_sst_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->amod_sss_object = amod_sss_construct(cfgs->mod_sss_config, cfgs->msg_spectra_sss_config, cfgs->msg_tracks_sst_config);
+ 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);
+ objs->amsg_spectra_sss_object = amsg_spectra_construct(objs->nMessages,
+ cfgs->msg_spectra_sss_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ objs->asnk_spectra_sss_objects[iSink] = asnk_spectra_construct(cfgs->snk_spectra_sss_configs[iSink],
+ cfgs->msg_spectra_sss_config);
+
}
// +------------------------------------------------------+
// | Module |
// +--------------------------------------------------+
- objs->amod_sspf_object = amod_sspf_construct(cfgs->mod_sspf_config, cfgs->msg_spectra_sspf_config, cfgs->msg_tracks_sst_config);
+ 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);
+ objs->amsg_spectra_sspf_object = amsg_spectra_construct(objs->nMessages,
+ cfgs->msg_spectra_sspf_config);
// +--------------------------------------------------+
// | Sinks |
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);
+
+ 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 |
// +----------------------------------------------------------+
- 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+3, 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+2, 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_spectra_sspf_object = acon_spectra_construct(objs->asnk_spectra_sspf_object_count, objs->nMessages, cfgs->msg_spectra_sspf_config);
+ // 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 + 2,
+ 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 + 2,
+ 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 |
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]);
+ objs->acon_hops_raw_object->outs[iSink + 1]);
}
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]);
+ objs->acon_hops_mapping_object->outs[iSink + 1]);
}
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]);
+ objs->acon_hops_resample_object->outs[iSink + 1]);
}
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+3]);
+ objs->acon_spectra_stft_object->outs[iSink + 2]);
}
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]);
+ objs->acon_pots_ssl_object->outs[iSink + 1]);
}
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+2]);
+ objs->acon_tracks_sst_object->outs[iSink + 2]);
}
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_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]);
+ objs->acon_spectra_sss_object->outs[iSink + 1]);
}
// +--------------------------------------------------+
amod_sspf_connect(objs->amod_sspf_object,
- objs->acon_spectra_stft_object->outs[2],
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);
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]);
+ 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]);
+
+ }
return objs;
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
// +--------------------------------------------------+
acon_spectra_destroy(objs->acon_spectra_sss_object);
+ acon_envs_destroy(objs->acon_envs_sss_object);
// +------------------------------------------------------+
// | SSPF |
// +--------------------------------------------------+
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);
// +--------------------------------------------------+
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);
+
+ // +--------------------------------------------------+
+ // | 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_hops_destroy(objs->acon_hops_gain_object);
+
free((void *) objs);
}
\ No newline at end of file
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;
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 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;
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);
free((void *) tmpLabel);
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); }
free((void *) tmpStr1);
cfg->fS = parameters_lookup_int(fileConfig, "general.samplerate.mu");
// +----------------------------------------------------------+
- // | Hop size |
+ // | Half Frame Size |
// +----------------------------------------------------------+
cfg->halfFrameSize = parameters_lookup_int(fileConfig, "general.size.frameSize") / 2 + 1;
}
+ 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");
cfg = mod_sspf_cfg_construct();
// +----------------------------------------------------------+
- // | Number of channels |
+ // | alpha |
// +----------------------------------------------------------+
- 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);
-
- }
+ cfg->alpha = parameters_lookup_float(fileConfig, "sspf.alpha");
// +----------------------------------------------------------+
- // | Epsilon |
+ // | beta |
// +----------------------------------------------------------+
- cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon");
+ cfg->beta = parameters_lookup_float(fileConfig, "sspf.beta");
// +----------------------------------------------------------+
- // | Spatial filter |
+ // | Ginterf |
// +----------------------------------------------------------+
- 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]");
+ cfg->Ginterf = parameters_lookup_float(fileConfig, "sspf.Ginterf");
// +----------------------------------------------------------+
- // | Directivity |
+ // | Epsilon |
// +----------------------------------------------------------+
- cfg->nThetas = parameters_lookup_int(fileConfig, "sspf.nThetas");
- cfg->gainMin = parameters_lookup_float(fileConfig, "sspf.gainMin");
+ cfg->epsilon = parameters_lookup_float(fileConfig, "general.epsilon");
+
+
return cfg;
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
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);
+
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);
snk_spectra_cfg * parameters_snk_spectra_sspf_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink);
+ mod_istft_cfg * parameters_mod_istft_config(const char * fileConfig, const char * fileIOs);
+
+ 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);
+
+ snk_hops_cfg * parameters_snk_hops_istft_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink);
+
+
+ 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);
+
+ unsigned int parameters_snk_hops_gain_count(const char * fileConfig, const char * fileIOs);
+
+ snk_hops_cfg * parameters_snk_hops_gain_config(const char * fileConfig, const char * fileIOs, const unsigned int iSink);
+
#endif
\ No newline at end of file
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;
}
prf->snk_pots_ssl_prf +
prf->snk_tracks_sst_prf +
prf->snk_spectra_sss_prf +
- prf->snk_spectra_sspf_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_ssl_prf +
prf->mod_sst_prf +
prf->mod_sss_prf +
- prf->mod_sspf_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_pots_ssl_prf +
prf->con_tracks_sst_prf +
prf->con_spectra_sss_prf +
- prf->con_spectra_sspf_prf;
+ prf->con_envs_sss_prf +
+ prf->con_spectra_sspf_prf +
+ prf->con_hops_istft_prf +
+ prf->con_hops_gain_prf;
total = source + sink + module + connector;
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("+--------------------------------------------+\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);
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);
// +------------------------------------------------------+
thread_start(aobjs->acon_spectra_sss_object->thread);
+ thread_start(aobjs->acon_envs_sss_object->thread);
// +----------------------------------------------------------+
// | SSPF |
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) {
// +------------------------------------------------------+
thread_join(aobjs->acon_spectra_sss_object->thread);
+ thread_join(aobjs->acon_envs_sss_object->thread);
// +----------------------------------------------------------+
// | SSPF |
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) {
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) {
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) {
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 |
// +--------------------------------------------------+
// | Sinks |
// +--------------------------------------------------+
- begin = clock();
+ 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;
+ #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"
#include "../../src/message/msg_tracks.h"
+ #include "../../src/module/mod_gain.h"
+ #include "../../src/module/mod_istft.h"
#include "../../src/module/mod_mapping.h"
#include "../../src/module/mod_resample.h"
#include "../../src/module/mod_ssl.h"
#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"
#include "../../src/amessage/amsg_tracks.h"
+ #include "../../src/amodule/amod_gain.h"
+ #include "../../src/amodule/amod_istft.h"
#include "../../src/amodule/amod_mapping.h"
#include "../../src/amodule/amod_resample.h"
#include "../../src/amodule/amod_ssl.h"
--- /dev/null
+
+ #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
--- /dev/null
+#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 <stdlib.h>
+ #include <stdio.h>
+
+ 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
--- /dev/null
+
+ #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
--- /dev/null
+#ifndef __ODAS_AMESSAGE_ENVS
+#define __ODAS_AMESSAGE_ENVS
+
+ #include <stdlib.h>
+
+ #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
--- /dev/null
+
+ #include "amod_gain.h"
+
+ amod_gain_obj * amod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config) {
+
+ amod_gain_obj * obj;
+
+ obj = (amod_gain_obj *) malloc(sizeof(amod_gain_obj));
+
+ obj->mod_gain = mod_gain_construct(mod_gain_config, msg_hops_config);
+ obj->in = (amsg_hops_obj *) NULL;
+ obj->out = (amsg_hops_obj *) NULL;
+
+ obj->thread = thread_construct(&amod_gain_thread, (void *) obj);
+
+ return obj;
+
+ }
+
+ void amod_gain_destroy(amod_gain_obj * obj) {
+
+ mod_gain_destroy(obj->mod_gain);
+ thread_destroy(obj->thread);
+
+ free((void *) obj);
+
+ }
+
+ void amod_gain_connect(amod_gain_obj * obj, amsg_hops_obj * in, amsg_hops_obj * out) {
+
+ obj->in = in;
+ obj->out = out;
+
+ }
+
+ void amod_gain_disconnect(amod_gain_obj * obj) {
+
+ obj->in = (amsg_hops_obj *) NULL;
+ obj->out = (amsg_hops_obj *) NULL;
+
+ }
+
+ void * amod_gain_thread(void * ptr) {
+
+ amod_gain_obj * obj;
+ msg_hops_obj * msg_hops_in;
+ msg_hops_obj * msg_hops_out;
+ int rtnValue;
+
+ obj = (amod_gain_obj *) ptr;
+
+ while(1) {
+
+ // Pop a message, process, and push back
+ msg_hops_in = amsg_hops_filled_pop(obj->in);
+ msg_hops_out = amsg_hops_empty_pop(obj->out);
+ mod_gain_connect(obj->mod_gain, msg_hops_in, msg_hops_out);
+ rtnValue = mod_gain_process(obj->mod_gain);
+ mod_gain_disconnect(obj->mod_gain);
+ amsg_hops_empty_push(obj->in, msg_hops_in);
+ amsg_hops_filled_push(obj->out, msg_hops_out);
+
+ // If this is the last frame, rtnValue = -1
+ if (rtnValue == -1) {
+ break;
+ }
+
+ }
+
+ }
\ No newline at end of file
--- /dev/null
+#ifndef __ODAS_AMODULE_GAIN
+#define __ODAS_AMODULE_GAIN
+
+ #include "../module/mod_gain.h"
+ #include "../amessage/amsg_hops.h"
+ #include "../general/thread.h"
+
+ typedef struct amod_gain_obj {
+
+ mod_gain_obj * mod_gain;
+ amsg_hops_obj * in;
+ amsg_hops_obj * out;
+ thread_obj * thread;
+
+ } amod_gain_obj;
+
+ amod_gain_obj * amod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config);
+
+ void amod_gain_destroy(amod_gain_obj * obj);
+
+ void amod_gain_connect(amod_gain_obj * obj, amsg_hops_obj * in, amsg_hops_obj * out);
+
+ void amod_gain_disconnect(amod_gain_obj * obj);
+
+ void * amod_gain_thread(void * ptr);
+
+#endif
\ No newline at end of file
#include "amod_sspf.h"
- amod_sspf_obj * amod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_config) {
+ 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_spectra_config, msg_tracks_config);
-
+
+ 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_spectra_obj *) NULL;
+ obj->in2 = (amsg_envs_obj *) NULL;
obj->in3 = (amsg_tracks_obj *) NULL;
obj->out = (amsg_spectra_obj *) NULL;
}
- void amod_sspf_connect(amod_sspf_obj * obj, amsg_spectra_obj * in1, amsg_spectra_obj * in2, amsg_tracks_obj * in3, amsg_spectra_obj * out) {
+ 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;
void amod_sspf_disconnect(amod_sspf_obj * obj) {
obj->in1 = (amsg_spectra_obj *) NULL;
- obj->in2 = (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_in1;
- msg_spectra_obj * msg_spectra_in2;
+ 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;
while(1) {
// Pop a message, process, and push back
- msg_spectra_in1 = amsg_spectra_filled_pop(obj->in1);
- msg_spectra_in2 = amsg_spectra_filled_pop(obj->in2);
+ 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_in1, msg_spectra_in2, msg_tracks_in, msg_spectra_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_in1);
- amsg_spectra_empty_push(obj->in2, msg_spectra_in2);
+ 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);
#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"
mod_sspf_obj * mod_sspf;
amsg_spectra_obj * in1;
- amsg_spectra_obj * in2;
+ 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_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_config);
+ 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_spectra_obj * in2, amsg_tracks_obj * in3, amsg_spectra_obj * out);
+ 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);
#include "amod_sss.h"
- amod_sss_obj * amod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_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, const msg_envs_cfg * msg_envs_config) {
amod_sss_obj * obj;
obj = (amod_sss_obj *) malloc(sizeof(amod_sss_obj));
- obj->mod_sss = mod_sss_construct(mod_sss_config, msg_spectra_config, msg_tracks_config);
+ obj->mod_sss = mod_sss_construct(mod_sss_config, msg_tracks_config, msg_spectra_config, msg_envs_config);
obj->in1 = (amsg_spectra_obj *) NULL;
obj->in2 = (amsg_tracks_obj *) NULL;
- obj->out = (amsg_spectra_obj *) NULL;
+ obj->out1 = (amsg_spectra_obj *) NULL;
+ obj->out2 = (amsg_envs_obj *) NULL;
obj->thread = thread_construct(&amod_sss_thread, (void *) obj);
}
- void amod_sss_connect(amod_sss_obj * obj, amsg_spectra_obj * in1, amsg_tracks_obj * in2, amsg_spectra_obj * out) {
+ void amod_sss_connect(amod_sss_obj * obj, amsg_spectra_obj * in1, amsg_tracks_obj * in2, amsg_spectra_obj * out1, amsg_envs_obj * out2) {
obj->in1 = in1;
obj->in2 = in2;
- obj->out = out;
+ obj->out1 = out1;
+ obj->out2 = out2;
}
obj->in1 = (amsg_spectra_obj *) NULL;
obj->in2 = (amsg_tracks_obj *) NULL;
- obj->out = (amsg_spectra_obj *) NULL;
+ obj->out1 = (amsg_spectra_obj *) NULL;
+ obj->out2 = (amsg_envs_obj *) NULL;
}
msg_spectra_obj * msg_spectra_in;
msg_tracks_obj * msg_tracks_in;
msg_spectra_obj * msg_spectra_out;
+ msg_envs_obj * msg_envs_out;
int rtnValue;
obj = (amod_sss_obj *) ptr;
// 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->out);
- mod_sss_connect(obj->mod_sss, msg_spectra_in, msg_tracks_in, msg_spectra_out);
+ 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);
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->out, msg_spectra_out);
+ amsg_spectra_filled_push(obj->out1, msg_spectra_out);
+ amsg_envs_filled_push(obj->out2, msg_envs_out);
// If this is the last frame, rtnValue = -1
if (rtnValue == -1) {
#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"
mod_sss_obj * mod_sss;
amsg_spectra_obj * in1;
amsg_tracks_obj * in2;
- amsg_spectra_obj * out;
+ amsg_spectra_obj * out1;
+ amsg_envs_obj * out2;
thread_obj * thread;
} amod_sss_obj;
- amod_sss_obj * amod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_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, const msg_envs_cfg * msg_envs_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 * out);
+ 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_disconnect(amod_sss_obj * obj);
--- /dev/null
+
+ #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
--- /dev/null
+#ifndef __ODAS_CONNECTOR_ENVS
+#define __ODAS_CONNECTOR_ENVS
+
+ #include "../message/msg_envs.h"
+
+ #include <stdlib.h>
+ #include <stdio.h>
+
+ 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
--- /dev/null
+
+ #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
--- /dev/null
+#ifndef __ODAS_MESSAGE_ENVS
+#define __ODAS_MESSAGE_ENVS
+
+ #include <stdlib.h>
+
+ #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
--- /dev/null
+
+ #include "mod_gain.h"
+
+ mod_gain_obj * mod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config) {
+
+ mod_gain_obj * obj;
+
+ obj = (mod_gain_obj *) malloc(sizeof(mod_gain_obj));
+
+ obj->hop2hop_gain = hop2hop_gain_construct_zero(msg_hops_config->hopSize, mod_gain_config->gain);
+
+ obj->in = (msg_hops_obj *) NULL;
+ obj->out = (msg_hops_obj *) NULL;
+
+ return obj;
+
+ }
+
+ void mod_gain_destroy(mod_gain_obj * obj) {
+
+ hop2hop_gain_destroy(obj->hop2hop_gain);
+ free((void *) obj);
+
+ }
+
+ int mod_gain_process(mod_gain_obj * obj) {
+
+ int rtnValue;
+
+ if (msg_hops_isZero(obj->in) == 0) {
+
+ hop2hop_gain_process(obj->hop2hop_gain, obj->in->hops, obj->out->hops);
+
+ obj->out->timeStamp = obj->in->timeStamp;
+
+ rtnValue = 0;
+
+ }
+ else {
+
+ msg_hops_zero(obj->out);
+
+ rtnValue = -1;
+
+ }
+
+ return rtnValue;
+
+ }
+
+ void mod_gain_connect(mod_gain_obj * obj, msg_hops_obj * in, msg_hops_obj * out) {
+
+ obj->in = in;
+ obj->out = out;
+
+ }
+
+ void mod_gain_disconnect(mod_gain_obj * obj) {
+
+ obj->in = (msg_hops_obj *) NULL;
+ obj->out = (msg_hops_obj *) NULL;
+
+ }
+
+ mod_gain_cfg * mod_gain_cfg_construct(void) {
+
+ mod_gain_cfg * cfg;
+
+ cfg = (mod_gain_cfg *) malloc(sizeof(mod_gain_cfg));
+
+ cfg->gain = 0.0f;
+
+ return cfg;
+
+ }
+
+ void mod_gain_cfg_destroy(mod_gain_cfg * cfg) {
+
+ free((void *) cfg);
+
+ }
+
+ void mod_gain_cfg_printf(const mod_gain_cfg * cfg) {
+
+ }
\ No newline at end of file
--- /dev/null
+#ifndef __ODAS_MODULE_GAIN
+#define __ODAS_MODULE_GAIN
+
+ #include "../system/hop2hop.h"
+ #include "../message/msg_hops.h"
+
+ typedef struct mod_gain_obj {
+
+ hop2hop_gain_obj * hop2hop_gain;
+
+ msg_hops_obj * in;
+ msg_hops_obj * out;
+
+ } mod_gain_obj;
+
+ typedef struct mod_gain_cfg {
+
+ float gain;
+
+ } mod_gain_cfg;
+
+ mod_gain_obj * mod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config);
+
+ void mod_gain_destroy(mod_gain_obj * obj);
+
+ int mod_gain_process(mod_gain_obj * obj);
+
+ void mod_gain_connect(mod_gain_obj * obj, msg_hops_obj * in, msg_hops_obj * out);
+
+ void mod_gain_disconnect(mod_gain_obj * obj);
+
+ mod_gain_cfg * mod_gain_cfg_construct(void);
+
+ void mod_gain_cfg_destroy(mod_gain_cfg * cfg);
+
+ void mod_gain_cfg_printf(const mod_gain_cfg * cfg);
+
+#endif
\ No newline at end of file
obj->framesAnalysis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->frame2freq = frame2freq_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->freqsAnalysis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
- obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, obj-> lowPassCut, 0.0f);
+ obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, obj-> lowPassCut, 0.0f, 0.0f, 0.0f, 0.0f);
obj->freqsSynthesis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
obj->freq2frame = freq2frame_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->framesSynthesis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->framesAnalysis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->frame2freq = frame2freq_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->freqsAnalysis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
- obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, obj-> lowPassCut, 0.0f);
+ obj->freq2freq = freq2freq_construct_zero(obj->halfFrameSize, obj-> lowPassCut, 0.0f, 0.0f, 0.0f, 0.0f);
obj->freqsSynthesis = freqs_construct_zero(obj->nChannels, obj->halfFrameSize);
obj->freq2frame = freq2frame_construct_zero(obj->frameSize, obj->halfFrameSize);
obj->framesSynthesis = frames_construct_zero(obj->nChannels, obj->frameSize);
obj->freq2freq = freq2freq_construct_zero(msg_spectra_config->halfFrameSize,
0,
- mod_ssl_config->epsilon);
+ mod_ssl_config->epsilon,
+ 0.0f,
+ 0.0f,
+ 0.0f);
obj->phasors = freqs_construct_zero(mod_ssl_config->mics->nChannels,
msg_spectra_config->halfFrameSize);
#include "mod_sspf.h"
- mod_sspf_obj * mod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_config) {
+ 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->nChannels = mod_sspf_config->mics->nChannels;
- obj->nSeps = msg_tracks_config->nTracks;
+ obj->nSeps = msg_spectra_config->nChannels;
+ obj->halfFrameSize = msg_spectra_config->halfFrameSize;
- obj->beampatterns_mics = directivity_beampattern_mics(mod_sspf_config->mics, mod_sspf_config->nThetas);
- obj->beampatterns_spatialfilter = directivity_beampattern_spatialfilter(mod_sspf_config->spatialfilter, mod_sspf_config->nThetas);
+ 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->track2gain = track2gain_construct_zero(obj->nSeps,
- obj->nChannels,
- mod_sspf_config->mics->direction,
- mod_sspf_config->spatialfilter->direction);
-
- obj->gains = gains_construct_zero(obj->nSeps,
- obj->nChannels);
-
- obj->gain2mask = gain2mask_construct_zero(obj->nSeps,
- obj->nChannels,
- mod_sspf_config->gainMin);
-
- obj->masks = masks_construct_zero(obj->nSeps,
- obj->nChannels);
-
- obj->freq2freq = freq2freq_construct_zero(msg_spectra_config->halfFrameSize,
- 0,
- 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, obj->epsilon, obj->alpha, obj->beta, obj->Ginterf);
obj->in1 = (msg_spectra_obj *) NULL;
- obj->in2 = (msg_spectra_obj *) NULL;
+ obj->in2 = (msg_envs_obj *) NULL;
obj->in3 = (msg_tracks_obj *) NULL;
- obj->out = (msg_spectra_obj *) NULL;
+ obj->out = (msg_spectra_obj *) NULL;
return obj;
void mod_sspf_destroy(mod_sspf_obj * obj) {
- beampatterns_destroy(obj->beampatterns_mics);
- beampatterns_destroy(obj->beampatterns_spatialfilter);
-
- track2gain_destroy(obj->track2gain);
- gains_destroy(obj->gains);
- gain2mask_destroy(obj->gain2mask);
- masks_destroy(obj->masks);
+ freq2env_destroy(obj->freq2env);
+ envs_destroy(obj->envs);
freq2freq_destroy(obj->freq2freq);
free((void *) obj);
int rtnValue;
- if ((msg_spectra_isZero(obj->in1) == 0) && (msg_spectra_isZero(obj->in2) == 0) && (msg_tracks_isZero(obj->in3) == 0)) {
+ 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);
}
- track2gain_process(obj->track2gain,
- obj->beampatterns_mics,
- obj->beampatterns_spatialfilter,
- obj->in3->tracks,
- obj->gains);
-
- gain2mask_process(obj->gain2mask,
- obj->gains,
- obj->masks);
-
- freq2freq_process_postfilter(obj->freq2freq,
- obj->in1->freqs,
- obj->in2->freqs,
- obj->gains,
- obj->masks,
- obj->out->freqs);
+ 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;
msg_spectra_zero(obj->out);
- rtnValue = -1;
+ rtnValue = -1;
}
}
- void mod_sspf_connect(mod_sspf_obj * obj, msg_spectra_obj * in1, msg_spectra_obj * in2, msg_tracks_obj * in3, msg_spectra_obj * out) {
+ 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;
void mod_sspf_disconnect(mod_sspf_obj * obj) {
obj->in1 = (msg_spectra_obj *) NULL;
- obj->in2 = (msg_spectra_obj *) NULL;
+ obj->in2 = (msg_envs_obj *) NULL;
obj->in3 = (msg_tracks_obj *) NULL;
- obj->out = (msg_spectra_obj *) NULL;
+ obj->out = (msg_spectra_obj *) NULL;
}
cfg = (mod_sspf_cfg *) malloc(sizeof(mod_sspf_cfg));
- cfg->mics = (mics_obj *) NULL;
- cfg->spatialfilter = (spatialfilter_obj *) NULL;
-
+ cfg->alpha = 0.0f;
+ cfg->beta = 0.0f;
+ cfg->Ginterf = 0.0f;
cfg->epsilon = 0.0f;
- cfg->nThetas = 0;
- cfg->gainMin = 0.0f;
-
return cfg;
}
void mod_sspf_cfg_destroy(mod_sspf_cfg * cfg) {
- if (cfg->mics != NULL) {
- mics_destroy(cfg->mics);
- }
-
- if (cfg->spatialfilter != NULL) {
- spatialfilter_destroy(cfg->spatialfilter);
- }
-
free((void *) cfg);
}
void mod_sspf_cfg_printf(const mod_sspf_cfg * cfg) {
- }
+ }
\ No newline at end of file
#ifndef __ODAS_MODULE_SSPF
#define __ODAS_MODULE_SSPF
- #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 "../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/freq2env.h"
+ #include "../signal/env.h"
+ #include "../system/freq2freq.h"
+
#include <stdlib.h>
typedef struct mod_sspf_obj {
- unsigned int nChannels;
unsigned int nSeps;
+ unsigned int halfFrameSize;
- beampatterns_obj * beampatterns_mics;
- beampatterns_obj * beampatterns_spatialfilter;
+ float alpha;
+ float beta;
+ float Ginterf;
+ float epsilon;
- track2gain_obj * track2gain;
- gains_obj * gains;
- gain2mask_obj * gain2mask;
- masks_obj * masks;
+ freq2env_obj * freq2env;
+ envs_obj * envs;
freq2freq_obj * freq2freq;
msg_spectra_obj * in1;
- msg_spectra_obj * in2;
+ msg_envs_obj * in2;
msg_tracks_obj * in3;
msg_spectra_obj * out;
typedef struct mod_sspf_cfg {
- mics_obj * mics;
- spatialfilter_obj * spatialfilter;
-
+ float alpha;
+ float beta;
+ float Ginterf;
float epsilon;
- unsigned int nThetas;
- float gainMin;
-
} mod_sspf_cfg;
- mod_sspf_obj * mod_sspf_construct(const mod_sspf_cfg * mod_sspf_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_config);
+ 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_spectra_obj * in2, msg_tracks_obj * in3, msg_spectra_obj * out);
+ 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);
#include "mod_sss.h"
- mod_sss_obj * mod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_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, const msg_envs_cfg * msg_envs_config) {
mod_sss_obj * obj;
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);
- obj->track2shift = track2shift_construct_zero(obj->nSeps,
- obj->nChannels,
- mod_sss_config->samplerate->mu,
- mod_sss_config->soundspeed->mu,
- mod_sss_config->mics->mu);
-
- obj->shifts = shifts_construct_zero(obj->nSeps,
- obj->nChannels);
-
obj->track2gain = track2gain_construct_zero(obj->nSeps,
obj->nChannels,
mod_sss_config->mics->direction,
obj->masks = masks_construct_zero(obj->nSeps,
obj->nChannels);
- obj->freq2freq = freq2freq_construct_zero(msg_spectra_config->halfFrameSize,
- 0,
- 0.0f);
+ 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);
+
+ obj->W = steers_construct_zero(msg_spectra_config->halfFrameSize,
+ obj->nSeps,
+ obj->nChannels);
+
+ obj->steer2freq = steer2freq_construct_zero(obj->nSeps,
+ obj->nChannels,
+ msg_spectra_config->halfFrameSize);
+
+ obj->steer2env = steer2env_construct_zero(obj->nSeps,
+ obj->nChannels,
+ msg_envs_config->halfFrameSize);
+
+ obj->ids = (unsigned long long *) malloc(sizeof(unsigned long long) * obj->nSeps);
+ memset(obj->ids, 0x00, sizeof(unsigned long long) * obj->nSeps);
obj->in1 = (msg_spectra_obj *) NULL;
obj->in2 = (msg_tracks_obj *) NULL;
- obj->out = (msg_spectra_obj *) NULL;
+ obj->out1 = (msg_spectra_obj *) NULL;
+ obj->out2 = (msg_envs_obj *) NULL;
return obj;
beampatterns_destroy(obj->beampatterns_mics);
beampatterns_destroy(obj->beampatterns_spatialfilter);
- track2shift_destroy(obj->track2shift);
- shifts_destroy(obj->shifts);
track2gain_destroy(obj->track2gain);
gains_destroy(obj->gains);
gain2mask_destroy(obj->gain2mask);
masks_destroy(obj->masks);
- freq2freq_destroy(obj->freq2freq);
+
+ track2steer_destroy(obj->track2steer);
+ steers_destroy(obj->W);
+ steer2freq_destroy(obj->steer2freq);
+ steer2env_destroy(obj->steer2env);
free((void *) obj);
int mod_sss_process(mod_sss_obj * obj) {
int rtnValue;
+ unsigned int iSep;
if ((msg_spectra_isZero(obj->in1) == 0) && (msg_tracks_isZero(obj->in2) == 0)) {
exit(EXIT_FAILURE);
}
- track2shift_process(obj->track2shift,
- obj->in2->tracks,
- obj->shifts);
-
+ // 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);
-
- freq2freq_process_delaysum(obj->freq2freq,
- obj->in1->freqs,
- obj->shifts,
- obj->gains,
- obj->masks,
- obj->out->freqs);
-
- obj->out->timeStamp = obj->in1->timeStamp;
+
+ // 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;
}
else {
- msg_spectra_zero(obj->out);
+ msg_spectra_zero(obj->out1);
+ msg_envs_zero(obj->out2);
rtnValue = -1;
}
- void mod_sss_connect(mod_sss_obj * obj, msg_spectra_obj * in1, msg_tracks_obj * in2, msg_spectra_obj * out) {
+ 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->out = out;
+ obj->out1 = out1;
+ obj->out2 = out2;
}
obj->in1 = (msg_spectra_obj *) NULL;
obj->in2 = (msg_tracks_obj *) NULL;
- obj->out = (msg_spectra_obj *) NULL;
+ obj->out1 = (msg_spectra_obj *) NULL;
+ obj->out2 = (msg_envs_obj *) NULL;
}
#include "../signal/freq.h"
#include "../signal/gain.h"
#include "../signal/mask.h"
- #include "../signal/shift.h"
#include "../system/gain2mask.h"
#include "../system/track2gain.h"
- #include "../system/track2shift.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 "../init/directivity.h"
+ #include "../message/msg_envs.h"
#include "../message/msg_spectra.h"
#include "../message/msg_tracks.h"
typedef struct mod_sss_obj {
+ unsigned int halfFrameSize;
unsigned int nChannels;
unsigned int nSeps;
beampatterns_obj * beampatterns_mics;
beampatterns_obj * beampatterns_spatialfilter;
- track2shift_obj * track2shift;
- shifts_obj * shifts;
track2gain_obj * track2gain;
gains_obj * gains;
gain2mask_obj * gain2mask;
masks_obj * masks;
- freq2freq_obj * freq2freq;
+
+ track2steer_obj * track2steer;
+ steers_obj * W;
+ steer2freq_obj * steer2freq;
+ steer2env_obj * steer2env;
msg_spectra_obj * in1;
msg_tracks_obj * in2;
- msg_spectra_obj * out;
+ msg_spectra_obj * out1;
+ msg_envs_obj * out2;
+
+ unsigned long long * ids;
} mod_sss_obj;
spatialfilter_obj * spatialfilter;
unsigned int nThetas;
- float gainMin;
+ float gainMin;
} mod_sss_cfg;
- mod_sss_obj * mod_sss_construct(const mod_sss_cfg * mod_sss_config, const msg_spectra_cfg * msg_spectra_config, const msg_tracks_cfg * msg_tracks_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, const msg_envs_cfg * msg_envs_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 * out);
+ void mod_sss_connect(mod_sss_obj * obj, msg_spectra_obj * in1, msg_tracks_obj * in2, msg_spectra_obj * out1, msg_envs_obj * out2);
void mod_sss_disconnect(mod_sss_obj * obj);
--- /dev/null
+
+ #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
--- /dev/null
+#ifndef __ODAS_SIGNAL_ENV
+#define __ODAS_SIGNAL_ENV
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+
+ 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
+++ /dev/null
-
- #include "shift.h"
-
- shifts_obj * shifts_construct_zero(const unsigned int nSeps, const unsigned int nChannels) {
-
- shifts_obj * obj;
- unsigned int iChannel;
-
- obj = (shifts_obj *) malloc(sizeof(shifts_obj));
-
- obj->nSeps = nSeps;
- obj->nChannels = nChannels;
-
- obj->array = (float *) malloc(sizeof(float) * nSeps * nChannels);
- memset(obj->array, 0x00, sizeof(float) * nSeps * nChannels);
-
- return obj;
-
- }
-
- void shifts_destroy(shifts_obj * obj) {
-
- free((void *) obj->array);
- free((void *) obj);
-
- }
-
- void shifts_printf(const shifts_obj * obj) {
-
- unsigned int iSep;
- unsigned int iChannel;
-
- for (iSep = 0; iSep < obj->nSeps; iSep++) {
-
- printf("(%02u): ",iSep);
-
- for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
-
- printf("%+1.3f ",obj->array[iChannel]);
-
- }
-
- printf("\n");
-
- }
-
- }
\ No newline at end of file
+++ /dev/null
-#ifndef __ODAS_SIGNAL_SHIFT
-#define __ODAS_SIGNAL_SHIFT
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
-
- typedef struct shifts_obj {
-
- unsigned int nSeps;
- unsigned int nChannels;
- float * array;
-
- } shifts_obj;
-
- shifts_obj * shifts_construct_zero(const unsigned int nSeps, const unsigned int nChannels);
-
- void shifts_destroy(shifts_obj * obj);
-
- void shifts_printf(const shifts_obj * obj);
-
-#endif
\ No newline at end of file
--- /dev/null
+
+ #include "steer.h"
+
+ steers_obj * steers_construct_zero(const unsigned int halfFrameSize, const unsigned int nSeps, const unsigned int nChannels) {
+
+ steers_obj * obj;
+ unsigned int iSep;
+
+ obj = (steers_obj *) malloc(sizeof(steers_obj));
+
+ obj->nSeps = nSeps;
+ obj->nChannels = nChannels;
+ obj->halfFrameSize = halfFrameSize;
+
+ obj->array = (float **) malloc(sizeof(float *) * obj->nSeps);
+
+ for (iSep = 0; iSep < obj->nSeps; iSep++) {
+
+ obj->array[iSep] = (float *) malloc(sizeof(float) * obj->halfFrameSize * obj->nChannels * 2);
+ memset(obj->array[iSep], 0x00, sizeof(float) * obj->halfFrameSize * obj->nChannels * 2);
+
+ }
+
+ return obj;
+
+ }
+
+ void steers_destroy(steers_obj * obj) {
+
+ unsigned int iSep;
+
+ for (iSep = 0; iSep < obj->nSeps; iSep++) {
+
+ free((void *) obj->array[iSep]);
+
+ }
+
+ free((void *) obj->array);
+ free((void *) obj);
+
+ }
+
+ void steers_copy(steers_obj * dest, const steers_obj * src) {
+
+ unsigned int iSep;
+
+ for (iSep = 0; iSep < src->nSeps; iSep++) {
+ memcpy(dest->array[iSep], src->array[iSep], src->halfFrameSize * src->nChannels * 2 * sizeof(float));
+ }
+
+ }
+
+ void steers_printf(const steers_obj * obj) {
+
+ unsigned int iBin;
+ unsigned int iSep;
+ unsigned int iChannel;
+
+ float real;
+ float imag;
+
+ for (iSep = 0; iSep < obj->nSeps; iSep++) {
+
+ printf("\nSource index: %u\n",iSep);
+
+ for (iBin = 0; iBin < obj->halfFrameSize; iBin++) {
+
+ printf("(%03u): ",iBin);
+
+ for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
+
+ real = obj->array[iSep][iBin * obj->nChannels * 2 + iChannel * 2 + 0];
+ imag = obj->array[iSep][iBin * obj->nChannels * 2 + iChannel * 2 + 1];
+
+ printf("(%+1.2f + %1.2fi) ", real, imag);
+
+ }
+
+ printf("\n");
+
+ }
+
+ }
+
+ }
\ No newline at end of file
--- /dev/null
+#ifndef __ODAS_SIGNAL_STEER
+#define __ODAS_SIGNAL_STEER
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+
+ typedef struct steers_obj {
+
+ unsigned int nSeps;
+ unsigned int nChannels;
+ unsigned int halfFrameSize;
+
+ float ** array;
+
+ } steers_obj;
+
+ steers_obj * steers_construct_zero(const unsigned int halfFrameSize, const unsigned int nSeps, const unsigned int nChannels);
+
+ void steers_destroy(steers_obj * obj);
+
+ void steers_copy(steers_obj * dest, const steers_obj * src);
+
+ void steers_printf(const steers_obj * obj);
+
+#endif
\ No newline at end of file
switch (obj->format->type) {
case format_json: break;
+ case format_float: break;
default:
printf("Invalid format.\n");
--- /dev/null
+
+ #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
--- /dev/null
+#ifndef __ODAS_SYSTEM_FREQ2ENV
+#define __ODAS_SYSTEM_FREQ2ENV
+
+ #include <stdlib.h>
+ #include <math.h>
+
+ #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
#include "freq2freq.h"
- freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int lowPassCut, const float epsilon) {
+ freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int lowPassCut, const float epsilon, const float alpha, const float beta, const float Ginterf) {
freq2freq_obj * obj;
obj->lowPassCut = lowPassCut;
obj->epsilon = epsilon;
+ obj->alpha = alpha;
+ obj->beta = beta;
+ obj->Ginterf = Ginterf;
+
return obj;
}
}
- void freq2freq_process_delaysum(freq2freq_obj * obj, const freqs_obj * freqsChannels, const shifts_obj * shifts, const gains_obj * gains, const masks_obj * masks, freqs_obj * freqsSeps) {
+ 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 iSep;
- unsigned int iChannel;
+ unsigned int iSignal;
unsigned int iSample;
- unsigned int nSeps;
- unsigned int nChannels;
- unsigned int nSamples;
- float N;
-
- float channelReal;
- float channelImag;
-
- float gainTotal;
+ float ratio;
float gain;
- float tau;
- float phase;
-
- float shiftReal;
- float shiftImag;
-
- float sepReal;
- float sepImag;
-
- nSeps = freqsSeps->nSignals;
- nChannels = freqsChannels->nSignals;
- nSamples = freqsChannels->halfFrameSize;
-
- N = (float) (2 * (freqsChannels->halfFrameSize-1));
-
- for (iSep = 0; iSep < nSeps; iSep++) {
-
- memset(freqsSeps->array[iSep], 0x00, sizeof(float) * nSamples * 2);
-
- gainTotal = 0.0f;
-
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- if (masks->array[iSep * nChannels + iChannel] == 0x01) {
-
- gainTotal += gains->array[iSep * nChannels + iChannel];
-
- }
+ float real;
+ float imag;
- }
-
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- if (masks->array[iSep * nChannels + iChannel] == 0x01) {
-
- gain = gains->array[iSep * nChannels + iChannel] / gainTotal;
- tau = shifts->array[iSep * nChannels + iChannel];
+ for (iSignal = 0; iSignal < freqsSeps->nSignals; iSignal++) {
- for (iSample = 0; iSample < freqsChannels->halfFrameSize; iSample++) {
+ if (tracks->ids[iSignal] != 0) {
- phase = 2.0f * M_PI * tau * ((float) iSample) / N;
+ for (iSample = 0; iSample < obj->halfFrameSize; iSample++) {
- shiftReal = gain * cosf(phase);
- shiftImag = gain * sinf(phase);
+ ratio = envsSeps->array[iSignal][iSample] / (envsDiffuse->array[iSignal][iSample] + obj->epsilon);
- channelReal = freqsChannels->array[iChannel][iSample * 2 + 0];
- channelImag = freqsChannels->array[iChannel][iSample * 2 + 1];
+ gain = (1.0f - obj->Ginterf) / (1.0f + expf(-1.0f * obj->alpha * (ratio - obj->beta))) + obj->Ginterf;
- sepReal = channelReal * shiftReal - channelImag * shiftImag;
- sepImag = channelImag * shiftReal + channelReal * shiftImag;
+ real = freqsSeps->array[iSignal][iSample * 2 + 0];
+ imag = freqsSeps->array[iSignal][iSample * 2 + 1];
- freqsSeps->array[iSep][iSample * 2 + 0] += sepReal;
- freqsSeps->array[iSep][iSample * 2 + 1] += sepImag;
-
- }
+ freqsPosts->array[iSignal][iSample * 2 + 0] = gain * real;
+ freqsPosts->array[iSignal][iSample * 2 + 1] = gain * imag;
}
}
+ else {
- }
-
- }
-
- void freq2freq_process_postfilter(freq2freq_obj * obj, const freqs_obj * freqsChannels, const freqs_obj * freqsSeps, const gains_obj * gains, const masks_obj * masks, freqs_obj * freqsPosts) {
-
- unsigned int iSep;
- unsigned int iChannel;
- unsigned int iSample;
-
- unsigned int nSeps;
- unsigned int nChannels;
- unsigned int nSamples;
-
- float sepReal;
- float sepImag;
- float sepPwr;
-
- float gain;
- float gainTotal;
- float gainTotal2;
-
- float channelReal;
- float channelImag;
- float channelPwr;
- float channelsPwr;
-
- float ratio;
- float factor;
-
- nSeps = freqsSeps->nSignals;
- nChannels = freqsChannels->nSignals;
- nSamples = freqsChannels->halfFrameSize;
-
- for (iSample = 0; iSample < nSamples; iSample++) {
-
- for (iSep = 0; iSep < nSeps; iSep++) {
-
- sepReal = freqsSeps->array[iSep][iSample * 2 + 0];
- sepImag = freqsSeps->array[iSep][iSample * 2 + 1];
- sepPwr = sepReal * sepReal + sepImag * sepImag;
-
- gainTotal = 0.0f;
- gainTotal2 = 0.0f;
-
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- if (masks->array[iSep * nChannels + iChannel] == 0x01) {
-
- gain = gains->array[iSep * nChannels + iChannel];
- gainTotal += gain;
- gainTotal2 += gain * gain;
-
- }
-
- }
-
- channelsPwr = 0.0f;
-
- for (iChannel = 0; iChannel < nChannels; iChannel++) {
-
- if (masks->array[iSep * nChannels + iChannel] == 0x01) {
-
- gain = gains->array[iSep * nChannels + iChannel] / gainTotal;
-
- channelReal = gain * freqsChannels->array[iChannel][iSample * 2 + 0];
- channelImag = gain * freqsChannels->array[iChannel][iSample * 2 + 1];
- channelPwr = channelReal * channelReal + channelImag * channelImag;
-
- channelsPwr += channelPwr;
-
- }
-
- }
-
- ratio = sepPwr / (channelsPwr * gainTotal2 + obj->epsilon);
-
- factor = 0.9f / (1.0f + expf(-20.0f * (ratio-0.5f))) + 0.1f;
-
- freqsPosts->array[iSep][iSample * 2 + 0] = factor * freqsSeps->array[iSep][iSample * 2 + 0];
- freqsPosts->array[iSep][iSample * 2 + 1] = factor * freqsSeps->array[iSep][iSample * 2 + 1];
+ memset(freqsPosts->array[iSignal], 0x00, sizeof(float) * obj->halfFrameSize * 2);
}
#include <stdlib.h>
#include <math.h>
+ #include "../signal/env.h"
#include "../signal/freq.h"
#include "../signal/gain.h"
#include "../signal/mask.h"
#include "../signal/pair.h"
- #include "../signal/shift.h"
+ #include "../signal/track.h"
typedef struct freq2freq_obj {
unsigned int halfFrameSize;
unsigned int lowPassCut;
float epsilon;
+ float alpha;
+ float beta;
+ float Ginterf;
} freq2freq_obj;
- freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int lowPassCut, const float epsilon);
+ freq2freq_obj * freq2freq_construct_zero(const unsigned int halfFrameSize, const unsigned int lowPassCut, const float epsilon, const float alpha, const float beta, const float Ginterf);
void freq2freq_destroy(freq2freq_obj * obj);
void freq2freq_process_lowpass(freq2freq_obj * obj, const freqs_obj * freqsAllPass, freqs_obj * freqsLowPass);
- void freq2freq_process_delaysum(freq2freq_obj * obj, const freqs_obj * freqsChannels, const shifts_obj * shifts, const gains_obj * gains, const masks_obj * masks, freqs_obj * freqsSeps);
-
- void freq2freq_process_postfilter(freq2freq_obj * obj, const freqs_obj * freqsChannels, const freqs_obj * freqsSeps, const gains_obj * gains, const masks_obj * masks, freqs_obj * freqsPosts);
+ 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);
#endif
\ No newline at end of file
return rtnValue;
+ }
+
+ hop2hop_gain_obj * hop2hop_gain_construct_zero(const unsigned int hopSize, const float gain) {
+
+ hop2hop_gain_obj * obj;
+
+ obj = (hop2hop_gain_obj *) malloc(sizeof(hop2hop_gain_obj));
+
+ obj->hopSize = hopSize;
+ obj->gain = gain;
+
+ return obj;
+
+ }
+
+ void hop2hop_gain_destroy(hop2hop_gain_obj * obj) {
+
+ free((void *) obj);
+
+ }
+
+ void hop2hop_gain_process(hop2hop_gain_obj * obj, const hops_obj * src, hops_obj * dest) {
+
+ unsigned int iSignal;
+ unsigned int iSample;
+
+ for (iSignal = 0; iSignal < src->nSignals; iSignal++) {
+
+ for (iSample = 0; iSample < src->hopSize; iSample++) {
+
+ dest->array[iSignal][iSample] = obj->gain * src->array[iSignal][iSample];
+
+ }
+
+ }
+
}
\ No newline at end of file
} hop2hop_buffer_obj;
+ typedef struct hop2hop_gain_obj {
+
+ unsigned int hopSize;
+ float gain;
+
+ } hop2hop_gain_obj;
+
hop2hop_multiplex_obj * hop2hop_multiplex_construct_zero(const unsigned int hopSize);
void hop2hop_multiplex_destroy(hop2hop_multiplex_obj * obj);
char hop2hop_buffer_isEmpty(hop2hop_buffer_obj * obj);
+ hop2hop_gain_obj * hop2hop_gain_construct_zero(const unsigned int hopSize, const float gain);
+
+ void hop2hop_gain_destroy(hop2hop_gain_obj * obj);
+
+ void hop2hop_gain_process(hop2hop_gain_obj * obj, const hops_obj * src, hops_obj * dest);
+
#endif
\ No newline at end of file
+++ /dev/null
-
- #include "shift2freq.h"
-
- shift2freq_obj * shift2freq_construct_zero(const unsigned int nChannels, const unsigned int halfFrameSize) {
-
- shift2freq_obj * obj;
- unsigned int iSample;
-
- obj = (shift2freq_obj *) malloc(sizeof(shift2freq_obj));
-
- obj->nChannels = nChannels;
- obj->halfFrameSize = halfFrameSize;
-
- obj->array = (float *) malloc(sizeof(float) * halfFrameSize);
-
- for (iSample = 0; iSample < halfFrameSize; iSample++) {
-
- obj->array[iSample] = 2.0f * M_PI * ((float) iSample) / ((float) ((halfFrameSize-1)*2));
-
- }
-
- return obj;
-
- }
-
- void shift2freq_destroy(shift2freq_obj * obj) {
-
- free((void *) obj);
-
- }
-
- void shift2freq_process(shift2freq_obj * obj, const shifts_obj * shifts, const gains_obj * gains, const masks_obj * masks, freqs_obj * freqs) {
-
- unsigned int iChannel;
- unsigned int iSample;
- float gainTotal;
- float normalize;
-
- gainTotal = 0.0f;
-
- for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
-
- if (masks->array[iChannel] == 0x01) {
-
- gainTotal += gains->array[iChannel];
-
- }
-
- }
-
- normalize = 1.0f / (gainTotal);
-
- for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
-
- if (masks->array[iChannel] == 0x01) {
-
- for (iSample = 0; iSample < obj->halfFrameSize; iSample++) {
-
- freqs->array[iChannel][iSample*2+0] = normalize * gains->array[iChannel] * cosf(obj->array[iSample] * shifts->array[iChannel]);
- freqs->array[iChannel][iSample*2+1] = normalize * gains->array[iChannel] * sinf(obj->array[iSample] * shifts->array[iChannel]);
-
- }
-
- }
-
- }
-
- }
\ No newline at end of file
+++ /dev/null
-#ifndef __ODAS_SYSTEM_SHIFT2FREQ
-#define __ODAS_SYSTEM_SHIFT2FREQ
-
- #include "../signal/gain.h"
- #include "../signal/mask.h"
- #include "../signal/shift.h"
- #include "../signal/freq.h"
-
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
-
- typedef struct shift2freq_obj {
-
- unsigned int nChannels;
- unsigned int halfFrameSize;
-
- float * array;
-
- } shift2freq_obj;
-
- shift2freq_obj * shift2freq_construct_zero(const unsigned int nChannels, const unsigned int halfFrameSize);
-
- void shift2freq_destroy(shift2freq_obj * obj);
-
- void shift2freq_process(shift2freq_obj * obj, const shifts_obj * shifts, const gains_obj * gains, const masks_obj * masks, freqs_obj * freqs);
-
-#endif
\ No newline at end of file
--- /dev/null
+
+ #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);
+
+ }
+
+ }
+
+ }
--- /dev/null
+#ifndef __ODAS_SYSTEM_STEER2ENV
+#define __ODAS_SYSTEM_STEER2ENV
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <math.h>
+
+ #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
--- /dev/null
+
+ #include "steer2freq.h"
+
+ steer2freq_obj * steer2freq_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int halfFrameSize) {
+
+ steer2freq_obj * obj;
+
+ obj = (steer2freq_obj *) malloc(sizeof(steer2freq_obj));
+
+ obj->nSeps = nSeps;
+ obj->nChannels = nChannels;
+ obj->halfFrameSize = halfFrameSize;
+
+ return obj;
+
+ }
+
+ void steer2freq_destroy(steer2freq_obj * obj) {
+
+ free((void *) obj);
+
+ }
+
+ void steer2freq_process(steer2freq_obj * obj, const tracks_obj * tracks, const steers_obj * demixing, const masks_obj * masks, const freqs_obj * freqsChannel, freqs_obj * freqsSeparated) {
+
+ 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(freqsSeparated->array[iSep], 0x00, sizeof(float) * obj->halfFrameSize * 2);
+
+ 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 = freqsChannel->array[iChannel][iSampleB * 2 + 0];
+ Ximag = freqsChannel->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;
+
+ freqsSeparated->array[iSep][iSampleB * 2 + 0] += Yreal;
+ freqsSeparated->array[iSep][iSampleB * 2 + 1] += Yimag;
+
+ }
+
+ }
+
+ }
+
+ }
+ else {
+
+ memset(freqsSeparated->array[iSep], 0x00, sizeof(float) * obj->halfFrameSize * 2);
+
+ }
+
+ }
+
+ }
\ No newline at end of file
--- /dev/null
+#ifndef __ODAS_SYSTEM_STEER2FREQ
+#define __ODAS_SYSTEM_STEER2FREQ
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <math.h>
+
+ #include "../signal/freq.h"
+ #include "../signal/mask.h"
+ #include "../signal/steer.h"
+ #include "../signal/track.h"
+
+ typedef struct steer2freq_obj {
+
+ unsigned int nSeps;
+ unsigned int nChannels;
+ unsigned int halfFrameSize;
+
+ } steer2freq_obj;
+
+ steer2freq_obj * steer2freq_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int halfFrameSize);
+
+ void steer2freq_destroy(steer2freq_obj * obj);
+
+ void steer2freq_process(steer2freq_obj * obj, const tracks_obj * tracks, const steers_obj * demixing, const masks_obj * masks, const freqs_obj * freqsChannel, freqs_obj * freqsSeparated);
+
+#endif
\ No newline at end of file
+++ /dev/null
-
- #include "track2shift.h"
-
- track2shift_obj * track2shift_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int fS, const unsigned int c, const float * mics) {
-
- track2shift_obj * obj;
-
- obj = (track2shift_obj *) malloc(sizeof(track2shift_obj));
-
- obj->nSeps = nSeps;
- obj->nChannels = nChannels;
- obj->fS = fS;
- obj->c = c;
-
- obj->mics = (float *) malloc(sizeof(float) * nChannels * 3);
- memcpy(obj->mics, mics, sizeof(float) * nChannels * 3);
-
- return obj;
-
- }
-
- void track2shift_destroy(track2shift_obj * obj) {
-
- free((void *) obj->mics);
- free((void *) obj);
-
- }
-
- void track2shift_process(track2shift_obj * obj, const tracks_obj * tracks, shifts_obj * shifts) {
-
- unsigned int iSep;
- unsigned int iChannel;
- float dist;
-
- for (iSep = 0; iSep < obj->nSeps; iSep++) {
-
- if (tracks->ids[iSep] != 0) {
-
- for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
-
- dist = tracks->array[iSep * 3 + 0] * obj->mics[iChannel * 3 + 0] +
- tracks->array[iSep * 3 + 1] * obj->mics[iChannel * 3 + 1] +
- tracks->array[iSep * 3 + 2] * obj->mics[iChannel * 3 + 2];
-
- shifts->array[iSep * obj->nChannels + iChannel] = -1.0f * (((float) obj->fS) / obj->c) * dist;
-
- }
-
- }
- else {
-
- memset(&(shifts->array[iSep * obj->nChannels]), 0x00, sizeof(float) * obj->nChannels);
-
- }
-
- }
-
- }
\ No newline at end of file
+++ /dev/null
-#ifndef __ODAS_SYSTEM_TRACK2SHIFT
-#define __ODAS_SYSTEM_TRACK2SHIFT
-
- #include "../signal/track.h"
- #include "../signal/shift.h"
-
- typedef struct track2shift_obj {
-
- unsigned int nSeps;
- unsigned int nChannels;
- unsigned int fS;
- float c;
- float * mics;
-
- } track2shift_obj;
-
- track2shift_obj * track2shift_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int fS, const unsigned int c, const float * mics);
-
- void track2shift_destroy(track2shift_obj * obj);
-
- void track2shift_process(track2shift_obj * obj, const tracks_obj * tracks, shifts_obj * shifts);
-
-#endif
\ No newline at end of file
--- /dev/null
+
+ #include "track2steer.h"
+
+ track2steer_obj * track2steer_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int halfFrameSize, const float c, const unsigned int fS, const float * mics) {
+
+ track2steer_obj * obj;
+ unsigned int iBin;
+
+ obj = (track2steer_obj *) malloc(sizeof(track2steer_obj));
+
+ obj->nSeps = nSeps;
+ obj->nChannels = nChannels;
+ obj->halfFrameSize = halfFrameSize;
+ obj->c = c;
+ obj->fS = fS;
+
+ obj->mics = (float *) malloc(sizeof(float) * nChannels * 3);
+ memcpy(obj->mics, mics, sizeof(float) * nChannels * 3);
+
+ obj->factor = (float *) malloc(sizeof(float) * halfFrameSize);
+
+ for (iBin = 0; iBin < halfFrameSize; iBin++) {
+
+ obj->factor[iBin] = -2.0f * M_PI * ((float) iBin) / ((float) ((halfFrameSize-1) * 2));
+
+ }
+
+ obj->speed = ((float) obj->fS) / obj->c;
+
+ return obj;
+
+ }
+
+ void track2steer_destroy(track2steer_obj * obj) {
+
+ unsigned int iBin;
+
+ free((void *) obj->factor);
+ free((void *) obj->mics);
+
+ free((void *) obj);
+
+ }
+
+ void track2steer_process_demixing(track2steer_obj * obj, const tracks_obj * tracks, const gains_obj * gains, const masks_obj * masks, steers_obj * steers) {
+
+ unsigned int iSep;
+ unsigned int iBin;
+ unsigned int iChannel;
+
+ float dist;
+ float delay;
+ float gain;
+ float gainTotal;
+ char mask;
+
+ float Wreal;
+ float Wimag;
+
+ unsigned int iSampleSC;
+ unsigned int iSampleBC;
+
+ for (iSep = 0; iSep < obj->nSeps; iSep++) {
+
+ if (tracks->ids[iSep] != 0) {
+
+ gainTotal = 0.0f;
+
+ for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
+
+ iSampleSC = iSep * obj->nChannels + iChannel;
+ mask = masks->array[iSampleSC];
+
+ if (mask == 1) {
+
+ gain = gains->array[iSampleSC];
+ gainTotal += gain * gain;
+
+ }
+
+ }
+
+ for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
+
+ iSampleSC = iSep * obj->nChannels + iChannel;
+ mask = masks->array[iSampleSC];
+
+ if (mask == 1) {
+
+ dist = tracks->array[iSep * 3 + 0] * obj->mics[iChannel * 3 + 0] +
+ tracks->array[iSep * 3 + 1] * obj->mics[iChannel * 3 + 1] +
+ tracks->array[iSep * 3 + 2] * obj->mics[iChannel * 3 + 2];
+
+ delay = -1.0f * obj->speed * dist;
+
+ gain = gains->array[iSampleSC] / gainTotal;
+
+ for (iBin = 0; iBin < obj->halfFrameSize; iBin++) {
+
+ iSampleBC = iBin * obj->nChannels + iChannel;
+
+ Wreal = gain * cosf(obj->factor[iBin] * -1.0f * delay);
+ Wimag = gain * sinf(obj->factor[iBin] * -1.0f * delay);
+
+ steers->array[iSep][iSampleBC * 2 + 0] = Wreal;
+ steers->array[iSep][iSampleBC * 2 + 1] = Wimag;
+
+ }
+
+ }
+
+ }
+
+ }
+ else {
+
+ memset(steers->array[iSep], 0x00, sizeof(float) * obj->halfFrameSize * obj->nChannels * 2);
+
+ }
+
+ }
+
+ }
\ No newline at end of file
--- /dev/null
+#ifndef __ODAS_SYSTEM_TRACK2STEER
+#define __ODAS_SYSTEM_TRACK2STEER
+
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+ #include <math.h>
+
+ #include "../signal/gain.h"
+ #include "../signal/mask.h"
+ #include "../signal/track.h"
+ #include "../signal/steer.h"
+
+ typedef struct track2steer_obj {
+
+ unsigned int nSeps;
+ unsigned int nChannels;
+ unsigned int halfFrameSize;
+ float c;
+ unsigned int fS;
+ float * mics;
+
+ float * factor;
+ float speed;
+
+ } track2steer_obj;
+
+ track2steer_obj * track2steer_construct_zero(const unsigned int nSeps, const unsigned int nChannels, const unsigned int halfFrameSize, const float c, const unsigned int fS, const float * mics);
+
+ void track2steer_destroy(track2steer_obj * obj);
+
+ void track2steer_process_demixing(track2steer_obj * obj, const tracks_obj * tracks, const gains_obj * gains, const masks_obj * masks, steers_obj * steers);
+
+#endif
\ No newline at end of file