Sequential processing with a single thread added
authorFrancoisGrondin <francois.grondin2@usherbrooke.ca>
Wed, 12 Jul 2017 19:26:11 +0000 (15:26 -0400)
committerFrancoisGrondin <francois.grondin2@usherbrooke.ca>
Wed, 12 Jul 2017 19:26:11 +0000 (15:26 -0400)
50 files changed:
CMakeLists.txt
config/azimut3_open.cfg
config/interfaces.ios
config/xmos.cfg [new file with mode: 0644]
demo/main.c
demo/objects.c
demo/objects.h
demo/parameters.c
demo/profiler.c [new file with mode: 0644]
demo/profiler.h [new file with mode: 0644]
demo/threads.c
demo/threads.h
include/odas/odas.h
src/aconnector/acon_hops.c
src/aconnector/acon_pots.c
src/aconnector/acon_spectra.c
src/aconnector/acon_tracks.c
src/asink/asnk_xcorrs.c [new file with mode: 0644]
src/asink/asnk_xcorrs.h [new file with mode: 0644]
src/asource/asrc_spectra.c [new file with mode: 0644]
src/asource/asrc_spectra.h [new file with mode: 0644]
src/connector/con_hops.c
src/connector/con_hops.h
src/connector/con_pots.c
src/connector/con_pots.h
src/connector/con_spectra.c
src/connector/con_spectra.h
src/connector/con_tracks.c
src/connector/con_tracks.h
src/message/msg_spectra.c
src/message/msg_xcorrs.c [new file with mode: 0644]
src/message/msg_xcorrs.h [new file with mode: 0644]
src/signal/xcorr.c
src/signal/xcorr.h
src/sink/snk_hops.c
src/sink/snk_pots.c
src/sink/snk_spectra.c
src/sink/snk_tracks.c
src/sink/snk_xcorrs.c [new file with mode: 0644]
src/sink/snk_xcorrs.h [new file with mode: 0644]
src/source/src_hops.c
src/source/src_hops.h
src/source/src_pots.c [new file with mode: 0644]
src/source/src_pots.h [new file with mode: 0644]
src/source/src_spectra.c [new file with mode: 0644]
src/source/src_spectra.h [new file with mode: 0644]
src/source/src_tracks.c [new file with mode: 0644]
src/source/src_tracks.h [new file with mode: 0644]
src/source/src_xcorrs.c [new file with mode: 0644]
src/source/src_xcorrs.h [new file with mode: 0644]

index dfa42a325bdcf1fa632fb8a621d27105ea0dfe91..d55b86602eedbc8904955391b73704f93d7eedb2 100644 (file)
@@ -114,6 +114,7 @@ set(SRC
     src/asink/asnk_spectra.c
     src/asink/asnk_tracks.c
     src/asource/asrc_hops.c  
+    src/asource/asrc_spectra.c
     
     src/connector/con_hops.c
     src/connector/con_pots.c
@@ -123,6 +124,7 @@ set(SRC
     src/message/msg_pots.c
     src/message/msg_spectra.c
     src/message/msg_tracks.c
+    src/message/msg_xcorrs.c
     src/module/mod_istft.c
     src/module/mod_mapping.c
     src/module/mod_resample.c
@@ -135,7 +137,11 @@ set(SRC
     src/sink/snk_pots.c
     src/sink/snk_spectra.c
     src/sink/snk_tracks.c
+    src/sink/snk_xcorrs.c
     src/source/src_hops.c
+    src/source/src_pots.c
+    src/source/src_spectra.c
+    src/source/src_tracks.c
 
 )
 
@@ -156,6 +162,7 @@ add_executable(core
     demo/configs.c
     demo/objects.c
     demo/parameters.c
+    demo/profiler.c
     demo/threads.c
 )
 target_link_libraries(core
index cae2a63e7e87c4e06a8a92942916e8792cd7a06c..78af4f8823416768712a92d8648af0fc6368a2ed 100644 (file)
@@ -210,7 +210,7 @@ sst:
 
     # Mode is either "kalman" or "particle"
 
-    mode = "particle";
+    mode = "kalman";
 
     # Parameters used by both the Kalman and particle filter
 
index 349881411deac2e823db5ed0e0ee4de61f9c75c4..7196a9d2c8f901623ea1549545b073787a60d4af 100644 (file)
@@ -4,6 +4,7 @@ input:
 {
    
     raw: { type = "file"; path = "in.raw"; format = "bin16"; }
+    #raw: { type = "soundcard"; card = 2; device = 0; format = "bin16"; }
 
 };
 
@@ -13,14 +14,14 @@ output:
 {
     raw:
     (
-#        { type = "file"; path = "recorded_raw_16.raw"; format = "bin16"; },
+#        { type = "file"; path = "recorded_raw_16.raw"; format = "bin16"; }
 #        { type = "file"; path = "recorded_raw_32.raw"; format = "bin32"; },
 #        { type = "file"; path = "recorded_raw_24.raw"; format = "bin24"; }
     );
 
     mapping:
     (
-#        { type = "file"; path = "recorded_mapping_16.raw"; format = "bin16"; },
+#        { type = "file"; path = "recorded_mapping_16.raw"; format = "bin16"; }
 #        { type = "file"; path = "recorded_mapping_32.raw"; format = "bin32"; }
     );
 
@@ -32,7 +33,7 @@ output:
 
     stft:
     (
-        { type = "file"; path = "recorded_stft.bin"; format = "float"; }
+#        { type = "file"; path = "recorded_stft.bin"; format = "float"; }
     );
 
     ssl:
@@ -52,7 +53,7 @@ output:
 
     sspf:
     (
-        { type = "file"; path = "postfiltered_stft.bin"; format = "float"; }
+        #{ type = "file"; path = "postfiltered_stft.bin"; format = "float"; }
     )
 
 }
\ No newline at end of file
diff --git a/config/xmos.cfg b/config/xmos.cfg
new file mode 100644 (file)
index 0000000..531b18d
--- /dev/null
@@ -0,0 +1,209 @@
+# Configuration file for XMOS circular sound card
+
+version = "2.0";
+
+# Raw
+
+raw: 
+{
+
+    fS = 48000;
+    hopSize = 512;
+    nChannels = 8;
+
+}
+
+# Mapping
+
+mapping:
+{
+    
+    map: (1, 2, 3, 4, 5, 6, 7);
+
+}
+
+# General
+
+general:
+{
+    
+    epsilon = 1E-20;
+
+    size: 
+    {
+        hopSize = 512;
+        frameSize = 1024;
+    };
+    
+    samplerate:
+    {
+        mu = 48000;
+        sigma2 = 0.01;
+    };
+
+    speedofsound:
+    {
+        mu = 343.0;
+        sigma2 = 25.0;
+    };
+
+    mics = (
+        
+        # Microphone 1
+        { 
+            mu = ( +0.000, +0.000, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );
+        },
+
+        # Microphone 2
+        { 
+            mu = ( -0.022, -0.037, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );
+        },
+
+        # Microphone 3
+        { 
+            mu = ( -0.043, +0.000, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );
+        },
+
+        # Microphone 4
+        { 
+            mu = ( -0.022, +0.037, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );
+        },
+
+        # Microphone 5
+        { 
+            mu = ( +0.022, +0.037, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );        
+        },
+
+        # Microphone 6
+        { 
+            mu = ( +0.043, +0.000, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );        
+        },
+
+        # Microphone 7
+        { 
+            mu = ( +0.022, -0.037, +0.000 ); 
+            sigma2 = ( +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000, +0.000 );
+            direction = ( +0.000, +0.000, +1.000 );
+            angle = ( 80.0, 90.0 );
+        }
+        
+    );
+
+};
+
+# Sound Source Localization
+
+ssl:
+{
+
+    nPots = 4;
+    nMatches = 10;
+    probMin = 0.5;
+    nRefinedLevels = 1;
+    gainMin = 0.25;
+    nThetas = 181;
+
+    # Number of scans: level is the resolution of the sphere
+    # and delta is the size of the maximum sliding window
+    # (delta = -1 means the size is automatically computed)
+    scans = (
+        { level = 2; delta = -1; },
+        { level = 4; delta = -1; }
+    );
+
+};
+
+# Sound Source Tracking
+
+sst:
+{  
+
+    # Mode is either "kalman" or "particle"
+
+    mode = "particle";
+
+    # Parameters used by both the Kalman and particle filter
+
+    active = (
+        { weight = 1.0; mu = 0.1; sigma2 = 0.0001 }
+    );
+
+    inactive = (
+        { weight = 1.0; mu = 0.07; sigma2 = 0.0001 }
+    );
+
+    sigmaR2_prob = 0.0025;
+    sigmaR2_active = 0.0225;
+    Pfalse = 0.1;
+    Pnew = 0.1;
+    Ptrack = 0.8;
+
+    theta_new = 0.9;
+    N_prob = 5;
+    theta_prob = 0.8;
+    N_inactive = ( 150, 200, 250, 250 );
+    theta_inactive = 0.9;
+
+    # Parameters used by the Kalman filter only
+
+    kalman: {
+
+        sigmaQ = 0.01;
+        
+    }
+   
+    # Parameters used by the particle filter only
+
+    particle: {
+
+        nParticles = 1000;
+        st_alpha = 2.0;
+        st_beta = 0.04;
+        st_ratio = 0.5;
+        ve_alpha = 0.05;
+        ve_beta = 0.2;
+        ve_ratio = 0.3;
+        ac_alpha = 0.5;
+        ac_beta = 0.2;
+        ac_ratio = 0.2;
+        Nmin = 0.7;
+
+    }
+
+}
+
+# Sound source separation
+
+sss: {
+   
+    nThetas = 181;
+    gainMin = 0.01;
+
+}
+
+# Sound source post-filtering
+
+sspf: {
+    
+    nThetas = 181;
+    gainMin = 0.01;
+
+}
\ No newline at end of file
index db8ac89f2538772df4a84a3c46566763b4c4da00..7ec931b510f7503f9d007acda48e6e878ea6f0e0 100644 (file)
@@ -5,52 +5,89 @@
     #include "configs.h"
     #include "objects.h"
     #include "threads.h"
+    #include "profiler.h"
 
     #include <getopt.h>
     #include <time.h>
+    #include <signal.h>
 
-    int main(int argc, char * argv[]) {
+    // +----------------------------------------------------------+
+    // | Variables                                                |
+    // +----------------------------------------------------------+  
+
+        // +------------------------------------------------------+
+        // | Type                                                 |
+        // +------------------------------------------------------+   
+
+            enum processing {
+                processing_singlethread,
+                processing_multithread
+            } type;
 
-        // +----------------------------------------------------------+
-        // | Getopt                                                   |
-        // +----------------------------------------------------------+   
+        // +------------------------------------------------------+
+        // | Getopt                                               |
+        // +------------------------------------------------------+   
 
             int c;
             char * file_config;
             char * file_ios;
 
-        // +----------------------------------------------------------+
-        // | Timer                                                    |
-        // +----------------------------------------------------------+   
+        // +------------------------------------------------------+
+        // | Objects                                              |
+        // +------------------------------------------------------+   
 
-            struct timespec ts;
+            objects * objs;
+            aobjects * aobjs;
 
-        // +----------------------------------------------------------+
-        // | Flag                                                     |
-        // +----------------------------------------------------------+              
+        // +------------------------------------------------------+
+        // | Configurations                                       |
+        // +------------------------------------------------------+        
 
-            char isRunning;
+            configs * cfgs;   
 
-        // +----------------------------------------------------------+
-        // | Configurations                                           |
-        // +----------------------------------------------------------+        
+        // +------------------------------------------------------+
+        // | Profiler                                             |
+        // +------------------------------------------------------+   
 
-            configs * cfgs;
+            profiler * prf;
 
-        // +----------------------------------------------------------+
-        // | Objects                                                  |
-        // +----------------------------------------------------------+        
+        // +------------------------------------------------------+
+        // | Flag                                                 |
+        // +------------------------------------------------------+                   
 
-            objects * objs;
+            char stopProcess;
+
+    // +----------------------------------------------------------+
+    // | Signal handler                                           |
+    // +----------------------------------------------------------+  
+
+    void sighandler(int signum) {
+        
+        if (type == processing_singlethread) {
+            stopProcess = 1;
+        }
+        if (type == processing_multithread) {
+            threads_multiple_stop(aobjs);
+        }        
+
+    }
+
+    // +----------------------------------------------------------+
+    // | Main routine                                             |
+    // +----------------------------------------------------------+  
+
+    int main(int argc, char * argv[]) {
 
-        // +----------------------------------------------------------+
-        // | Arguments                                                |
-        // +----------------------------------------------------------+  
+        // +------------------------------------------------------+
+        // | Arguments                                            |
+        // +------------------------------------------------------+  
 
             file_config = (char *) NULL;
             file_ios = (char *) NULL;
 
-            while ((c = getopt(argc,argv, "hc:i:")) != -1) {
+            type = processing_multithread;
+
+            while ((c = getopt(argc,argv, "hc:i:s")) != -1) {
 
                 switch(c) {
 
 
                     break;
 
+                    case 's':
+
+                        type = processing_singlethread;
+
+                    break;
+
                 }
 
             }
                 exit(EXIT_FAILURE);
             }
 
-        // +----------------------------------------------------------+
-        // | Copyright                                                |
-        // +----------------------------------------------------------+ 
+        // +------------------------------------------------------+
+        // | Copyright                                            |
+        // +------------------------------------------------------+ 
 
             printf("+--------------------------------------------+\n");
             printf("|    ODAS (Open embeddeD Audition System)    |\n");
             printf("| Version: 1.0                               |\n");
             printf("+--------------------------------------------+\n");
 
-        // +----------------------------------------------------------+
-        // | Configure                                                |
-        // +----------------------------------------------------------+ 
+        // +------------------------------------------------------+
+        // | Single thread                                        |
+        // +------------------------------------------------------+  
 
-            printf("  + Initializing configurations...... "); fflush(stdout); 
+            if (type == processing_singlethread) {
 
-            cfgs = configs_construct(file_config, file_ios);
+            // +--------------------------------------------------+
+            // | Profiler                                         |
+            // +--------------------------------------------------+ 
 
-            printf("[Done]\n");
+                prf = profiler_construct();
 
-        // +----------------------------------------------------------+
-        // | Construct                                                |
-        // +----------------------------------------------------------+  
+            // +--------------------------------------------------+
+            // | Configure                                        |
+            // +--------------------------------------------------+ 
 
-            printf("  + Initializing objects............. "); fflush(stdout); 
+                printf("  + Initializing configurations...... "); fflush(stdout); 
 
-            objs = objects_construct(cfgs);
+                cfgs = configs_construct(file_config, file_ios);
 
-            printf("[Done]\n");         
+                printf("[Done]\n");
 
-        // +----------------------------------------------------------+
-        // | Launch threads                                           |
-        // +----------------------------------------------------------+  
+            // +--------------------------------------------------+
+            // | Construct                                        |
+            // +--------------------------------------------------+  
 
-            printf("  + Launch threads................... "); fflush(stdout); 
+                printf("  + Initializing objects............. "); fflush(stdout); 
+                
+                objs = objects_construct(cfgs);    
+                
+                printf("[Done]\n");   
 
-            threads_start(objs);
+            // +--------------------------------------------------+
+            // | Processing                                       |
+            // +--------------------------------------------------+  
 
-            printf("[Done]\n");
+                printf("  + Processing....................... "); fflush(stdout);
 
+                threads_single_open(objs);
+                stopProcess = 0;
+                while((threads_single_process(objs, prf) == 0) && (stopProcess == 0));
+                threads_single_close(objs);
 
-        // +----------------------------------------------------------+
-        // | Wait                                                     |
-        // +----------------------------------------------------------+  
+                printf("[Done]\n");
 
-            printf("  + Threads running.................. "); fflush(stdout); 
-            
-            threads_join(objs);
+            // +--------------------------------------------------+
+            // | Free memory                                      |
+            // +--------------------------------------------------+  
 
-            printf("[Done]\n");
+                printf("  + Free memory...................... "); fflush(stdout);
 
-        // +----------------------------------------------------------+
-        // | Free memory                                              |
-        // +----------------------------------------------------------+  
+                objects_destroy(objs);
+                configs_destroy(cfgs);
+                free((void *) file_config);
+                free((void *) file_ios);
 
-            printf("  + Free memory...................... "); fflush(stdout);
+                printf("[Done]\n");
+
+            // +--------------------------------------------------+
+            // | Results                                          |
+            // +--------------------------------------------------+  
+
+                profiler_printf(prf);
+
+                profiler_destroy(prf);
+
+            }
 
-            objects_destroy(objs);
-            configs_destroy(cfgs);
-            free((void *) file_config);
-            free((void *) file_ios);
+        // +------------------------------------------------------+
+        // | Multiple threads                                     |
+        // +------------------------------------------------------+  
 
-            printf("[Done]\n");
+            if (type == processing_multithread) {
+
+            // +--------------------------------------------------+
+            // | Configure                                        |
+            // +--------------------------------------------------+ 
+
+                printf("  + Initializing configurations...... "); fflush(stdout); 
+
+                cfgs = configs_construct(file_config, file_ios);
+
+                printf("[Done]\n");
+
+            // +--------------------------------------------------+
+            // | Construct                                        |
+            // +--------------------------------------------------+  
+
+                printf("  + Initializing objects............. "); fflush(stdout); 
+                
+                aobjs = aobjects_construct(cfgs);    
+
+                printf("[Done]\n");                         
+
+            // +--------------------------------------------------+
+            // | Launch threads                                   |
+            // +--------------------------------------------------+  
+
+                signal(SIGINT, sighandler);
+
+                printf("  + Launch threads................... "); fflush(stdout); 
+
+                threads_multiple_start(aobjs);
+
+                printf("[Done]\n");
+
+            // +--------------------------------------------------+
+            // | Wait                                             |
+            // +--------------------------------------------------+  
+
+                printf("  + Threads running.................. "); fflush(stdout); 
+                
+                threads_multiple_join(aobjs);
+
+                printf("[Done]\n");
+
+            // +--------------------------------------------------+
+            // | Free memory                                      |
+            // +--------------------------------------------------+  
+
+                printf("  + Free memory...................... "); fflush(stdout);
+
+                aobjects_destroy(aobjs);
+                configs_destroy(cfgs);
+                free((void *) file_config);
+                free((void *) file_ios);
+
+                printf("[Done]\n");
+
+            }
 
         return 0;
 
index 865b74ddb6f97acfda9508ad45c8aa7951e10c60..657180ef063a31cce7598e65457ebd6669606cee 100644 (file)
@@ -8,6 +8,696 @@
 
         objs = (objects *) malloc(sizeof(objects));
 
+        // +----------------------------------------------------------+
+        // | Construct                                                |
+        // +----------------------------------------------------------+
+
+            // +------------------------------------------------------+
+            // | Raw                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Source                                           |
+                // +--------------------------------------------------+  
+
+                    objs->src_hops_raw_object = src_hops_construct(cfgs->src_hops_raw_config, cfgs->msg_hops_raw_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_hops_raw_object = msg_hops_construct(cfgs->msg_hops_raw_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_hops_raw_object_count = cfgs->snk_hops_raw_config_count;
+                    objs->snk_hops_raw_objects = (snk_hops_obj **) malloc(sizeof(snk_hops_obj *) * cfgs->snk_hops_raw_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) {
+                        objs->snk_hops_raw_objects[iSink] = snk_hops_construct(cfgs->snk_hops_raw_configs[iSink], cfgs->msg_hops_raw_config);
+                    }
+
+            // +------------------------------------------------------+
+            // | Mapping                                              |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    objs->mod_mapping_object = mod_mapping_construct(cfgs->mod_mapping_config, cfgs->msg_hops_mapping_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_hops_mapping_object = msg_hops_construct(cfgs->msg_hops_mapping_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_hops_mapping_object_count = cfgs->snk_hops_mapping_config_count;
+                    objs->snk_hops_mapping_objects = (snk_hops_obj **) malloc(sizeof(snk_hops_obj *) * cfgs->snk_hops_mapping_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) {
+                        objs->snk_hops_mapping_objects[iSink] = snk_hops_construct(cfgs->snk_hops_mapping_configs[iSink], cfgs->msg_hops_mapping_config);
+                    }
+
+            // +------------------------------------------------------+
+            // | Resample                                             |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    objs->mod_resample_object = mod_resample_construct(cfgs->mod_resample_config, cfgs->msg_hops_mapping_config, cfgs->msg_hops_resample_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_hops_resample_object = msg_hops_construct(cfgs->msg_hops_resample_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_hops_resample_object_count = cfgs->snk_hops_resample_config_count;
+                    objs->snk_hops_resample_objects = (snk_hops_obj **) malloc(sizeof(asnk_hops_obj *) * cfgs->snk_hops_resample_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) {
+                        objs->snk_hops_resample_objects[iSink] = snk_hops_construct(cfgs->snk_hops_resample_configs[iSink], cfgs->msg_hops_resample_config);
+                    }
+
+            // +------------------------------------------------------+
+            // | STFT                                                 |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    objs->mod_stft_object = mod_stft_construct(cfgs->mod_stft_config, cfgs->msg_hops_resample_config, cfgs->msg_spectra_stft_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_spectra_stft_object = msg_spectra_construct(cfgs->msg_spectra_stft_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_spectra_stft_object_count = cfgs->snk_spectra_stft_config_count;
+                    objs->snk_spectra_stft_objects = (snk_spectra_obj **) malloc(sizeof(snk_spectra_obj *) * cfgs->snk_spectra_stft_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) {
+                        objs->snk_spectra_stft_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_stft_configs[iSink], cfgs->msg_spectra_stft_config);
+                    }
+
+            // +------------------------------------------------------+
+            // | SSL                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    objs->mod_ssl_object = mod_ssl_construct(cfgs->mod_ssl_config, cfgs->msg_spectra_stft_config, cfgs->msg_pots_ssl_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_pots_ssl_object = msg_pots_construct(cfgs->msg_pots_ssl_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_pots_ssl_object_count = cfgs->snk_pots_ssl_config_count;
+                    objs->snk_pots_ssl_objects = (snk_pots_obj **) malloc(sizeof(snk_pots_obj *) * cfgs->snk_pots_ssl_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) {
+                        objs->snk_pots_ssl_objects[iSink] = snk_pots_construct(cfgs->snk_pots_ssl_configs[iSink], cfgs->msg_pots_ssl_config);
+                    }
+
+            // +------------------------------------------------------+
+            // | SST                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | 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);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_tracks_sst_object = msg_tracks_construct(cfgs->msg_tracks_sst_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_tracks_sst_object_count = cfgs->snk_tracks_sst_config_count;
+                    objs->snk_tracks_sst_objects = (snk_tracks_obj **) malloc(sizeof(snk_tracks_obj *) * cfgs->snk_tracks_sst_config_count);
+
+                    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);
+                    }
+
+            // +------------------------------------------------------+
+            // | SSS                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    objs->mod_sss_object = mod_sss_construct(cfgs->mod_sss_config, cfgs->msg_spectra_sss_config, cfgs->msg_tracks_sst_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_spectra_sss_object = msg_spectra_construct(cfgs->msg_spectra_sss_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_spectra_sss_object_count = cfgs->snk_spectra_sss_config_count;
+                    objs->snk_spectra_sss_objects = (snk_spectra_obj **) malloc(sizeof(snk_spectra_obj *) * cfgs->snk_spectra_sss_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) {
+                        objs->snk_spectra_sss_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_sss_configs[iSink], cfgs->msg_spectra_sss_config);
+                    }
+
+            // +------------------------------------------------------+
+            // | SSPF                                                 |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    objs->mod_sspf_object = mod_sspf_construct(cfgs->mod_sspf_config, cfgs->msg_spectra_sspf_config, cfgs->msg_tracks_sst_config);
+
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    objs->msg_spectra_sspf_object = msg_spectra_construct(cfgs->msg_spectra_sspf_config);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    objs->snk_spectra_sspf_object_count = cfgs->snk_spectra_sspf_config_count;
+                    objs->snk_spectra_sspf_objects = (snk_spectra_obj **) malloc(sizeof(snk_spectra_obj *) * cfgs->snk_spectra_sspf_config_count);
+
+                    for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) {
+                        objs->snk_spectra_sspf_objects[iSink] = snk_spectra_construct(cfgs->snk_spectra_sspf_configs[iSink], cfgs->msg_spectra_sspf_config);
+                    }                    
+
+        // +----------------------------------------------------------+
+        // | 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);
+
+            // +------------------------------------------------------+
+            // | Raw                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Source                                           |
+                // +--------------------------------------------------+  
+
+                    src_hops_connect(objs->src_hops_raw_object, 
+                                     objs->con_hops_raw_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | Mapping                                              |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_mapping_connect(objs->mod_mapping_object, 
+                                        objs->con_hops_raw_object->outs[0], 
+                                        objs->con_hops_mapping_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | Resample                                             |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_resample_connect(objs->mod_resample_object, 
+                                         objs->con_hops_mapping_object->outs[0], 
+                                         objs->con_hops_resample_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | STFT                                                 |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_stft_connect(objs->mod_stft_object, 
+                                     objs->con_hops_resample_object->outs[0], 
+                                     objs->con_spectra_stft_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | SSL                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_ssl_connect(objs->mod_ssl_object, 
+                                    objs->con_spectra_stft_object->outs[0], 
+                                    objs->con_pots_ssl_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | SST                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_sst_connect(objs->mod_sst_object, 
+                                    objs->con_pots_ssl_object->outs[0], 
+                                    objs->con_tracks_sst_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) {
+
+                        snk_tracks_connect(objs->snk_tracks_sst_objects[iSink],
+                                           objs->con_tracks_sst_object->outs[iSink+2]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | SSS                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    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);
+
+                // +--------------------------------------------------+
+                // | 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]);
+
+                    }
+
+            // +------------------------------------------------------+
+            // | SSPF                                                 |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_sspf_connect(objs->mod_sspf_object,
+                                     objs->con_spectra_stft_object->outs[2],
+                                     objs->con_spectra_sss_object->outs[0],
+                                     objs->con_tracks_sst_object->outs[1],
+                                     objs->con_spectra_sspf_object->in);
+
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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]);
+
+                    }                    
+
+        return objs;
+
+    }
+
+    void objects_destroy(objects * objs) {
+
+        unsigned int iSink;
+
+        // +----------------------------------------------------------+
+        // | Destroy                                                  |
+        // +----------------------------------------------------------+
+
+            // +------------------------------------------------------+
+            // | Raw                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Source                                           |
+                // +--------------------------------------------------+  
+
+                    src_hops_destroy(objs->src_hops_raw_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_hops_destroy(objs->msg_hops_raw_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_hops_destroy(objs->con_hops_raw_object);
+
+            // +------------------------------------------------------+
+            // | Mapping                                              |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_mapping_destroy(objs->mod_mapping_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_hops_destroy(objs->msg_hops_mapping_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    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);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_hops_destroy(objs->con_hops_mapping_object);             
+
+            // +------------------------------------------------------+
+            // | Resample                                             |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_resample_destroy(objs->mod_resample_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_hops_destroy(objs->msg_hops_resample_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) {
+                        snk_hops_destroy(objs->snk_hops_resample_objects[iSink]);
+                    }
+                    free((void *) objs->snk_hops_resample_objects);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_hops_destroy(objs->con_hops_resample_object);    
+
+            // +------------------------------------------------------+
+            // | STFT                                                 |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_stft_destroy(objs->mod_stft_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_spectra_destroy(objs->msg_spectra_stft_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) {
+                        snk_spectra_destroy(objs->snk_spectra_stft_objects[iSink]);
+                    }
+                    free((void *) objs->snk_spectra_stft_objects);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_spectra_destroy(objs->con_spectra_stft_object);   
+
+            // +------------------------------------------------------+
+            // | SSL                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_ssl_destroy(objs->mod_ssl_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_pots_destroy(objs->msg_pots_ssl_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) {
+                        snk_pots_destroy(objs->snk_pots_ssl_objects[iSink]);
+                    }
+                    free((void *) objs->snk_pots_ssl_objects);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_pots_destroy(objs->con_pots_ssl_object);   
+
+            // +------------------------------------------------------+
+            // | SST                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_sst_destroy(objs->mod_sst_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_tracks_destroy(objs->msg_tracks_sst_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) {
+                        snk_tracks_destroy(objs->snk_tracks_sst_objects[iSink]);
+                    }
+                    free((void *) objs->snk_tracks_sst_objects);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_tracks_destroy(objs->con_tracks_sst_object);   
+
+            // +------------------------------------------------------+
+            // | SSS                                                  |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_sss_destroy(objs->mod_sss_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_spectra_destroy(objs->msg_spectra_sss_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) {
+                        snk_spectra_destroy(objs->snk_spectra_sss_objects[iSink]);
+                    }
+                    free((void *) objs->snk_spectra_sss_objects);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_spectra_destroy(objs->con_spectra_sss_object);   
+
+            // +------------------------------------------------------+
+            // | SSPF                                                 |
+            // +------------------------------------------------------+  
+
+                // +--------------------------------------------------+
+                // | Module                                           |
+                // +--------------------------------------------------+  
+
+                    mod_sspf_destroy(objs->mod_sspf_object);
+                    
+                // +--------------------------------------------------+
+                // | Message                                          |
+                // +--------------------------------------------------+  
+
+                    msg_spectra_destroy(objs->msg_spectra_sspf_object);
+                    
+                // +--------------------------------------------------+
+                // | Sinks                                            |
+                // +--------------------------------------------------+  
+
+                    for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) {
+                        snk_spectra_destroy(objs->snk_spectra_sspf_objects[iSink]);
+                    }
+                    free((void *) objs->snk_spectra_sspf_objects);
+
+                // +--------------------------------------------------+
+                // | Connector                                        |
+                // +--------------------------------------------------+  
+
+                    con_spectra_destroy(objs->con_spectra_sspf_object);   
+
+        free((void *) objs);
+
+    }
+
+    aobjects * aobjects_construct(const configs * cfgs) {
+
+        aobjects * objs;
+        unsigned int iSink;
+
+        objs = (aobjects *) malloc(sizeof(aobjects));
+
         objs->nMessages = 10;
 
         // +----------------------------------------------------------+
 
     }
 
-    void objects_destroy(objects * objs) {
+    void aobjects_destroy(aobjects * objs) {
 
         unsigned int iSink;
 
index e76bab9250e8d230d9f0de0d5fa20f9e5f1dae44..154df11490fe263b1fb7838e5a54c2461022c15b 100644 (file)
@@ -7,6 +7,58 @@
     #include <stdlib.h>
 
     typedef struct objects {
+
+        src_hops_obj * src_hops_raw_object;
+        msg_hops_obj * msg_hops_raw_object;        
+        unsigned int snk_hops_raw_object_count;
+        snk_hops_obj ** snk_hops_raw_objects;                
+        con_hops_obj * con_hops_raw_object; 
+
+        mod_mapping_obj * mod_mapping_object;
+        msg_hops_obj * msg_hops_mapping_object;
+        unsigned int snk_hops_mapping_object_count;
+        snk_hops_obj ** snk_hops_mapping_objects;
+        con_hops_obj * con_hops_mapping_object;              
+
+        mod_resample_obj * mod_resample_object;
+        msg_hops_obj * msg_hops_resample_object;
+        unsigned int snk_hops_resample_object_count;
+        snk_hops_obj ** snk_hops_resample_objects;
+        con_hops_obj * con_hops_resample_object;
+
+        mod_stft_obj * mod_stft_object;
+        msg_spectra_obj * msg_spectra_stft_object;
+        unsigned int snk_spectra_stft_object_count;
+        snk_spectra_obj ** snk_spectra_stft_objects;
+        con_spectra_obj * con_spectra_stft_object;
+
+        mod_ssl_obj * mod_ssl_object;
+        msg_pots_obj * msg_pots_ssl_object;
+        unsigned int snk_pots_ssl_object_count;
+        snk_pots_obj ** snk_pots_ssl_objects;
+        con_pots_obj * con_pots_ssl_object;
+
+        mod_sst_obj * mod_sst_object;
+        msg_tracks_obj * msg_tracks_sst_object;
+        unsigned int snk_tracks_sst_object_count;
+        snk_tracks_obj ** snk_tracks_sst_objects;
+        con_tracks_obj * con_tracks_sst_object;
+
+        mod_sss_obj * mod_sss_object;
+        msg_spectra_obj * msg_spectra_sss_object;
+        unsigned int snk_spectra_sss_object_count;
+        snk_spectra_obj ** snk_spectra_sss_objects;
+        con_spectra_obj * con_spectra_sss_object;
+
+        mod_sspf_obj * mod_sspf_object;
+        msg_spectra_obj * msg_spectra_sspf_object;
+        unsigned int snk_spectra_sspf_object_count;
+        snk_spectra_obj ** snk_spectra_sspf_objects;
+        con_spectra_obj * con_spectra_sspf_object;
+
+    } objects;   
+
+    typedef struct aobjects {
       
         unsigned int nMessages;
 
         asnk_spectra_obj ** asnk_spectra_sspf_objects;
         acon_spectra_obj * acon_spectra_sspf_object;
 
-    } objects;
-
+    } aobjects;
+ 
     objects * objects_construct(const configs * cfgs);
 
     void objects_destroy(objects * objs);
 
+    aobjects * aobjects_construct(const configs * cfgs);
+
+    void aobjects_destroy(aobjects * objs);
+
 #endif
\ No newline at end of file
index d1ed7871c7f5528e05a65309268bf4c6c47ee31c..eca035ce8c28a934f1702c35b124afc7111a9c48 100644 (file)
             }
             else if (strcmp(tmpStr1, "soundcard") == 0) {
 
-                tmpInt1 = parameters_lookup_int(fileIOs, "input.raw.device");
-                tmpInt2 = parameters_lookup_int(fileIOs, "input.raw.subdevice");
+                tmpInt1 = parameters_lookup_int(fileIOs, "input.raw.card");
+                tmpInt2 = parameters_lookup_int(fileIOs, "input.raw.device");
 
                 cfg->interface = interface_construct_soundcard(tmpInt1, tmpInt2);
 
diff --git a/demo/profiler.c b/demo/profiler.c
new file mode 100644 (file)
index 0000000..5182d97
--- /dev/null
@@ -0,0 +1,132 @@
+    
+    #include "profiler.h"
+
+    profiler * profiler_construct(void) {
+
+        profiler * prf;
+
+        prf = (profiler *) malloc(sizeof(profiler));
+
+        prf->duration = 0.0f;
+
+        prf->src_hops_raw_prf = 0.0f;
+        prf->con_hops_raw_prf = 0.0f;
+        prf->snk_hops_raw_prf = 0.0f;
+
+        prf->mod_mapping_prf = 0.0f;
+        prf->con_hops_mapping_prf = 0.0f;
+        prf->snk_hops_mapping_prf = 0.0f;
+
+        prf->mod_resample_prf = 0.0f;
+        prf->con_hops_resample_prf = 0.0f;
+        prf->snk_hops_resample_prf = 0.0f;
+
+        prf->mod_stft_prf = 0.0f;
+        prf->con_spectra_stft_prf = 0.0f;
+        prf->snk_spectra_stft_prf = 0.0f;
+
+        prf->mod_ssl_prf = 0.0f;
+        prf->con_pots_ssl_prf = 0.0f;
+        prf->snk_pots_ssl_prf = 0.0f;
+
+        prf->mod_sst_prf = 0.0f;
+        prf->con_tracks_sst_prf = 0.0f;
+        prf->snk_tracks_sst_prf = 0.0f;
+
+        prf->mod_sss_prf = 0.0f;
+        prf->con_spectra_sss_prf = 0.0f;
+        prf->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;
+
+        return prf;
+
+    }
+
+    void profiler_destroy(profiler * prf) {
+
+        free((void *) prf);
+
+    }
+
+    void profiler_printf(const profiler * prf) {
+
+        float source, sink, module, connector;
+        float total;
+
+        source = prf->src_hops_raw_prf;
+
+        sink = prf->snk_hops_raw_prf + 
+               prf->snk_hops_mapping_prf + 
+               prf->snk_hops_resample_prf + 
+               prf->snk_spectra_stft_prf +
+               prf->snk_pots_ssl_prf +
+               prf->snk_tracks_sst_prf +
+               prf->snk_spectra_sss_prf +
+               prf->snk_spectra_sspf_prf;
+
+        module = prf->mod_mapping_prf + 
+                 prf->mod_resample_prf +
+                 prf->mod_stft_prf +
+                 prf->mod_ssl_prf +
+                 prf->mod_sst_prf +
+                 prf->mod_sss_prf +
+                 prf->mod_sspf_prf;
+
+        connector = prf->con_hops_raw_prf +
+                    prf->con_hops_mapping_prf +
+                    prf->con_hops_resample_prf +
+                    prf->con_spectra_stft_prf +
+                    prf->con_pots_ssl_prf +
+                    prf->con_tracks_sst_prf +
+                    prf->con_spectra_sss_prf +
+                    prf->con_spectra_sspf_prf;
+
+        total = source + sink + module + connector;                    
+
+        printf("+--------------------------------------------+\n");
+        printf("|              Profiler summary              |\n");
+        printf("+--------------------------------------------+\n");
+        printf("| + Raw                                      |\n");
+        printf("|    - Source.......... %07.3f (%06.2f%%)    |\n",prf->src_hops_raw_prf,roundf(10000.0f * prf->src_hops_raw_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_hops_raw_prf,roundf(10000.0f * prf->con_hops_raw_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_hops_raw_prf,roundf(10000.0f * prf->snk_hops_raw_prf / prf->duration) / 100.0f);
+        printf("| + Mapping                                  |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_mapping_prf,roundf(10000.0f * prf->mod_mapping_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_hops_mapping_prf,roundf(10000.0f * prf->con_hops_mapping_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_hops_mapping_prf,roundf(10000.0f * prf->snk_hops_mapping_prf / prf->duration) / 100.0f);
+        printf("| + Resample                                 |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_resample_prf,roundf(10000.0f * prf->mod_resample_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_hops_resample_prf,roundf(10000.0f * prf->con_hops_resample_prf / prf->duration));
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_hops_resample_prf,roundf(10000.0f * prf->snk_hops_resample_prf / prf->duration));
+        printf("| + STFT                                     |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_stft_prf,roundf(10000.0f * prf->mod_stft_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_spectra_stft_prf,roundf(10000.0f * prf->con_spectra_stft_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_spectra_stft_prf,roundf(10000.0f * prf->snk_spectra_stft_prf / prf->duration) / 100.0f);        
+        printf("| + SSL                                      |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_ssl_prf,roundf(10000.0f * prf->mod_ssl_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_pots_ssl_prf,roundf(10000.0f * prf->con_pots_ssl_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_pots_ssl_prf,roundf(10000.0f * prf->snk_pots_ssl_prf / prf->duration) / 100.0f);  
+        printf("| + SST                                      |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_sst_prf,roundf(10000.0f * prf->mod_sst_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_tracks_sst_prf,roundf(10000.0f * prf->con_tracks_sst_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_tracks_sst_prf,roundf(10000.0f * prf->snk_tracks_sst_prf / prf->duration) / 100.0f);  
+        printf("| + SSS                                      |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_sss_prf,roundf(10000.0f * prf->mod_sss_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_spectra_sss_prf,roundf(10000.0f * prf->con_spectra_sss_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_spectra_sss_prf,roundf(10000.0f * prf->snk_spectra_sss_prf / prf->duration) / 100.0f);  
+        printf("| + SSPF                                     |\n");
+        printf("|    - Module.......... %07.3f (%06.2f%%)    |\n",prf->mod_sspf_prf,roundf(10000.0f * prf->mod_sspf_prf / prf->duration) / 100.0f);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",prf->con_spectra_sspf_prf,roundf(10000.0f * prf->con_spectra_sspf_prf / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",prf->snk_spectra_sspf_prf,roundf(10000.0f * prf->snk_spectra_sspf_prf / prf->duration) / 100.0f); 
+        printf("+--------------------------------------------+\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);
+        printf("|    - Connector....... %07.3f (%06.2f%%)    |\n",connector,roundf(10000.0f * connector / prf->duration) / 100.0f);
+        printf("|    - Source.......... %07.3f (%06.2f%%)    |\n",source,roundf(10000.0f * source / prf->duration) / 100.0f);
+        printf("|    - Sink............ %07.3f (%06.2f%%)    |\n",sink,roundf(10000.0f * sink / prf->duration) / 100.0f); 
+        printf("+--------------------------------------------+\n");
+
+    }
\ No newline at end of file
diff --git a/demo/profiler.h b/demo/profiler.h
new file mode 100644 (file)
index 0000000..5ca62ef
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef __DEMO_PROFILER
+#define __DEMO_PROFILER
+
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <math.h>
+
+    typedef struct profiler {
+
+        float duration;
+
+        float src_hops_raw_prf;
+        float con_hops_raw_prf;
+        float snk_hops_raw_prf;
+
+        float mod_mapping_prf;
+        float con_hops_mapping_prf;
+        float snk_hops_mapping_prf;
+
+        float mod_resample_prf;
+        float con_hops_resample_prf;
+        float snk_hops_resample_prf;
+
+        float mod_stft_prf;
+        float con_spectra_stft_prf;
+        float snk_spectra_stft_prf;
+
+        float mod_ssl_prf;
+        float con_pots_ssl_prf;
+        float snk_pots_ssl_prf;
+
+        float mod_sst_prf;
+        float con_tracks_sst_prf;
+        float snk_tracks_sst_prf;
+
+        float mod_sss_prf;
+        float con_spectra_sss_prf;
+        float snk_spectra_sss_prf;
+
+        float mod_sspf_prf;
+        float con_spectra_sspf_prf;
+        float snk_spectra_sspf_prf;
+
+    } profiler;
+
+    profiler * profiler_construct(void);
+
+    void profiler_destroy(profiler * prf);
+
+    void profiler_printf(const profiler * prf);
+
+#endif
\ No newline at end of file
index b4c01442db718a0a63e6fd8e59092ef644cc42e1..6999feaa726d35f4c6e6f8f6fc711e858e0b07b0 100644 (file)
@@ -1,7 +1,7 @@
     
     #include "threads.h"
 
-    void threads_start(objects * objs) {
+    void threads_multiple_start(aobjects * aobjs) {
 
         unsigned int iSink;
 
             // | Source                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->asrc_hops_raw_object->thread);
+                thread_start(aobjs->asrc_hops_raw_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_hops_raw_object_count; iSink++) {
-                    thread_start(objs->asnk_hops_raw_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_hops_raw_object_count; iSink++) {
+                    thread_start(aobjs->asnk_hops_raw_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_hops_raw_object->thread);
+                thread_start(aobjs->acon_hops_raw_object->thread);
 
         // +----------------------------------------------------------+
         // | Mapping                                                  |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_mapping_object->thread);
+                thread_start(aobjs->amod_mapping_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_hops_mapping_object_count; iSink++) {
-                    thread_start(objs->asnk_hops_mapping_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_hops_mapping_object_count; iSink++) {
+                    thread_start(aobjs->asnk_hops_mapping_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_hops_mapping_object->thread);
+                thread_start(aobjs->acon_hops_mapping_object->thread);
 
         // +----------------------------------------------------------+
         // | Resample                                                 |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_resample_object->thread);
+                thread_start(aobjs->amod_resample_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_hops_resample_object_count; iSink++) {
-                    thread_start(objs->asnk_hops_resample_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_hops_resample_object_count; iSink++) {
+                    thread_start(aobjs->asnk_hops_resample_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_hops_resample_object->thread);
+                thread_start(aobjs->acon_hops_resample_object->thread);
 
         // +----------------------------------------------------------+
         // | STFT                                                     |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_stft_object->thread);
+                thread_start(aobjs->amod_stft_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_spectra_stft_object_count; iSink++) {
-                    thread_start(objs->asnk_spectra_stft_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_spectra_stft_object_count; iSink++) {
+                    thread_start(aobjs->asnk_spectra_stft_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_spectra_stft_object->thread);
+                thread_start(aobjs->acon_spectra_stft_object->thread);
 
         // +----------------------------------------------------------+
         // | SSL                                                      |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_ssl_object->thread);
+                thread_start(aobjs->amod_ssl_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_pots_ssl_object_count; iSink++) {
-                    thread_start(objs->asnk_pots_ssl_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_pots_ssl_object_count; iSink++) {
+                    thread_start(aobjs->asnk_pots_ssl_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_pots_ssl_object->thread);
+                thread_start(aobjs->acon_pots_ssl_object->thread);
 
         // +----------------------------------------------------------+
         // | SST                                                      |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_sst_object->thread);
+                thread_start(aobjs->amod_sst_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_tracks_sst_object_count; iSink++) {
-                    thread_start(objs->asnk_tracks_sst_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_tracks_sst_object_count; iSink++) {
+                    thread_start(aobjs->asnk_tracks_sst_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_tracks_sst_object->thread);
+                thread_start(aobjs->acon_tracks_sst_object->thread);
 
         // +----------------------------------------------------------+
         // | SSS                                                      |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_sss_object->thread);
+                thread_start(aobjs->amod_sss_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_spectra_sss_object_count; iSink++) {
-                    thread_start(objs->asnk_spectra_sss_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_spectra_sss_object_count; iSink++) {
+                    thread_start(aobjs->asnk_spectra_sss_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_spectra_sss_object->thread);
+                thread_start(aobjs->acon_spectra_sss_object->thread);
 
         // +----------------------------------------------------------+
         // | SSPF                                                     |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_start(objs->amod_sspf_object->thread);
+                thread_start(aobjs->amod_sspf_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+                      
 
-                for (iSink = 0; iSink < objs->asnk_spectra_sspf_object_count; iSink++) {
-                    thread_start(objs->asnk_spectra_sspf_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_spectra_sspf_object_count; iSink++) {
+                    thread_start(aobjs->asnk_spectra_sspf_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+                     
 
-                thread_start(objs->acon_spectra_sspf_object->thread);
+                thread_start(aobjs->acon_spectra_sspf_object->thread);
 
     }
 
-    void threads_stop(objects * objs) {
+    void threads_multiple_stop(aobjects * aobjs) {
 
         // +----------------------------------------------------------+
         // | Raw                                                      |
             // | Source                                               |
             // +------------------------------------------------------+  
 
-                thread_stop(objs->asrc_hops_raw_object->thread);
+                thread_stop(aobjs->asrc_hops_raw_object->thread);
 
                 // Stops the source that generate frames to process.
                 // This will generate a "zero" message that will stop
 
     }
 
-    void threads_join(objects * objs) {
+    void threads_multiple_join(aobjects * aobjs) {
 
         unsigned int iSink;
 
             // | Source                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->asrc_hops_raw_object->thread);
+                thread_join(aobjs->asrc_hops_raw_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_hops_raw_object_count; iSink++) {
-                    thread_join(objs->asnk_hops_raw_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_hops_raw_object_count; iSink++) {
+                    thread_join(aobjs->asnk_hops_raw_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_hops_raw_object->thread);
+                thread_join(aobjs->acon_hops_raw_object->thread);
 
         // +----------------------------------------------------------+
         // | Mapping                                                  |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_mapping_object->thread);
+                thread_join(aobjs->amod_mapping_object->thread);
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_hops_mapping_object_count; iSink++) {
-                    thread_join(objs->asnk_hops_mapping_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_hops_mapping_object_count; iSink++) {
+                    thread_join(aobjs->asnk_hops_mapping_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_hops_mapping_object->thread);
+                thread_join(aobjs->acon_hops_mapping_object->thread);
 
         // +----------------------------------------------------------+
         // | Resample                                                 |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_resample_object->thread);               
+                thread_join(aobjs->amod_resample_object->thread);               
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_hops_resample_object_count; iSink++) {
-                    thread_join(objs->asnk_hops_resample_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_hops_resample_object_count; iSink++) {
+                    thread_join(aobjs->asnk_hops_resample_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_hops_resample_object->thread);
+                thread_join(aobjs->acon_hops_resample_object->thread);
 
         // +----------------------------------------------------------+
         // | STFT                                                     |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_stft_object->thread);               
+                thread_join(aobjs->amod_stft_object->thread);               
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_spectra_stft_object_count; iSink++) {
-                    thread_join(objs->asnk_spectra_stft_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_spectra_stft_object_count; iSink++) {
+                    thread_join(aobjs->asnk_spectra_stft_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_spectra_stft_object->thread);
+                thread_join(aobjs->acon_spectra_stft_object->thread);
 
         // +----------------------------------------------------------+
         // | SSL                                                      |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_ssl_object->thread);               
+                thread_join(aobjs->amod_ssl_object->thread);               
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_pots_ssl_object_count; iSink++) {
-                    thread_join(objs->asnk_pots_ssl_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_pots_ssl_object_count; iSink++) {
+                    thread_join(aobjs->asnk_pots_ssl_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_pots_ssl_object->thread);
+                thread_join(aobjs->acon_pots_ssl_object->thread);
 
         // +----------------------------------------------------------+
         // | SST                                                      |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_sst_object->thread);               
+                thread_join(aobjs->amod_sst_object->thread);               
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_tracks_sst_object_count; iSink++) {
-                    thread_join(objs->asnk_tracks_sst_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_tracks_sst_object_count; iSink++) {
+                    thread_join(aobjs->asnk_tracks_sst_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_tracks_sst_object->thread);
+                thread_join(aobjs->acon_tracks_sst_object->thread);
 
         // +----------------------------------------------------------+
         // | SSS                                                      |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_sss_object->thread);               
+                thread_join(aobjs->amod_sss_object->thread);               
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_spectra_sss_object_count; iSink++) {
-                    thread_join(objs->asnk_spectra_sss_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_spectra_sss_object_count; iSink++) {
+                    thread_join(aobjs->asnk_spectra_sss_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_spectra_sss_object->thread);
+                thread_join(aobjs->acon_spectra_sss_object->thread);
 
         // +----------------------------------------------------------+
         // | SSPF                                                     |
             // | Module                                               |
             // +------------------------------------------------------+  
 
-                thread_join(objs->amod_sspf_object->thread);               
+                thread_join(aobjs->amod_sspf_object->thread);               
 
             // +------------------------------------------------------+
             // | Sinks                                                |
             // +------------------------------------------------------+   
                 
-                for (iSink = 0; iSink < objs->asnk_spectra_sspf_object_count; iSink++) {
-                    thread_join(objs->asnk_spectra_sspf_objects[iSink]->thread);
+                for (iSink = 0; iSink < aobjs->asnk_spectra_sspf_object_count; iSink++) {
+                    thread_join(aobjs->asnk_spectra_sspf_objects[iSink]->thread);
                 }
 
             // +------------------------------------------------------+
             // | Connector                                            |
             // +------------------------------------------------------+  
 
-                thread_join(objs->acon_spectra_sspf_object->thread);
+                thread_join(aobjs->acon_spectra_sspf_object->thread);
+
+    }
+
+    void threads_single_open(objects * objs) {
+
+        unsigned int iSink;
+
+        // +----------------------------------------------------------+
+        // | Raw                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Source                                               |
+            // +------------------------------------------------------+  
+
+                src_hops_open(objs->src_hops_raw_object);
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) {
+                    snk_hops_open(objs->snk_hops_raw_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | Mapping                                                  |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) {
+                    snk_hops_open(objs->snk_hops_mapping_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | Resample                                                 |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) {
+                    snk_hops_open(objs->snk_hops_resample_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | STFT                                                     |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) {
+                    snk_spectra_open(objs->snk_spectra_stft_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SSL                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) {
+                    snk_pots_open(objs->snk_pots_ssl_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SST                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) {
+                    snk_tracks_open(objs->snk_tracks_sst_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SSS                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) {
+                    snk_spectra_open(objs->snk_spectra_sss_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SSPF                                                     |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) {
+                    snk_spectra_open(objs->snk_spectra_sspf_objects[iSink]);
+                }
+
+    }
+
+    void threads_single_close(objects * objs) {
+
+        unsigned int iSink;
+
+        // +----------------------------------------------------------+
+        // | Raw                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Source                                               |
+            // +------------------------------------------------------+  
+
+                src_hops_close(objs->src_hops_raw_object);
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) {
+                    snk_hops_close(objs->snk_hops_raw_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | Mapping                                                  |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) {
+                    snk_hops_close(objs->snk_hops_mapping_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | Resample                                                 |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) {
+                    snk_hops_close(objs->snk_hops_resample_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | STFT                                                     |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) {
+                    snk_spectra_close(objs->snk_spectra_stft_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SSL                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) {
+                    snk_pots_close(objs->snk_pots_ssl_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SST                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) {
+                    snk_tracks_close(objs->snk_tracks_sst_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SSS                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) {
+                    snk_spectra_close(objs->snk_spectra_sss_objects[iSink]);
+                }
+
+        // +----------------------------------------------------------+
+        // | SSPF                                                     |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) {
+                    snk_spectra_close(objs->snk_spectra_sspf_objects[iSink]);
+                }
+
+    }
+
+    int threads_single_process(objects * objs, profiler * prf) {
+
+        int rtnValue;
+        unsigned int iSink;
+
+        clock_t begin, end;
+
+        prf->duration += ((float) (objs->src_hops_raw_object->hopSize)) / ((float) (objs->src_hops_raw_object->fS));
+
+        // +----------------------------------------------------------+
+        // | Raw                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Source                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                rtnValue = src_hops_process(objs->src_hops_raw_object);
+                end = clock();
+                prf->src_hops_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+   
+
+                begin = clock();
+                con_hops_process(objs->con_hops_raw_object);
+                end = clock();
+                prf->con_hops_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_hops_raw_object_count; iSink++) {
+
+                    snk_hops_process(objs->snk_hops_raw_objects[iSink]);
+
+                }
+                end = clock();
+                prf->snk_hops_raw_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);               
+
+        // +----------------------------------------------------------+
+        // | Mapping                                                  |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_mapping_process(objs->mod_mapping_object);
+                end = clock();
+                prf->mod_mapping_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+                     
+
+                begin = clock();
+                con_hops_process(objs->con_hops_mapping_object);
+                end = clock();
+                prf->con_hops_mapping_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_hops_mapping_object_count; iSink++) {
+                    snk_hops_process(objs->snk_hops_mapping_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_hops_mapping_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                   
+
+        // +----------------------------------------------------------+
+        // | Resample                                                 |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_resample_process(objs->mod_resample_object);
+                end = clock();
+                prf->mod_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+      
+
+                begin = clock();
+                con_hops_process(objs->con_hops_resample_object);
+                end = clock();
+                prf->con_hops_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_hops_resample_object_count; iSink++) {
+                    snk_hops_process(objs->snk_hops_resample_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_hops_resample_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                  
+
+        // +----------------------------------------------------------+
+        // | STFT                                                     |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_stft_process(objs->mod_stft_object);
+                end = clock();
+                prf->mod_stft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+                     
+
+                begin = clock();
+                con_spectra_process(objs->con_spectra_stft_object);
+                end = clock();
+                prf->con_spectra_stft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                     
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_spectra_stft_object_count; iSink++) {
+                    snk_spectra_process(objs->snk_spectra_stft_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_spectra_stft_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                 
+
+        // +----------------------------------------------------------+
+        // | SSL                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_ssl_process(objs->mod_ssl_object);
+                end = clock();
+                prf->mod_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+                     
+
+                begin = clock();
+                con_pots_process(objs->con_pots_ssl_object);
+                end = clock();
+                prf->con_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                    
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_pots_ssl_object_count; iSink++) {
+                    snk_pots_process(objs->snk_pots_ssl_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_pots_ssl_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                
+
+        // +----------------------------------------------------------+
+        // | SST                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_sst_process(objs->mod_sst_object);
+                end = clock();
+                prf->mod_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+                     
+
+                begin = clock();
+                con_tracks_process(objs->con_tracks_sst_object);
+                end = clock();
+                prf->con_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                   
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_tracks_sst_object_count; iSink++) {
+                    snk_tracks_process(objs->snk_tracks_sst_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_tracks_sst_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                   
+
+        // +----------------------------------------------------------+
+        // | SSS                                                      |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_sss_process(objs->mod_sss_object);
+                end = clock();
+                prf->mod_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                               
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+                     
+
+                begin = clock();
+                con_spectra_process(objs->con_spectra_sss_object);
+                end = clock();
+                prf->con_spectra_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                   
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_spectra_sss_object_count; iSink++) {
+                    snk_spectra_process(objs->snk_spectra_sss_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_spectra_sss_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                   
+
+        // +----------------------------------------------------------+
+        // | SSPF                                                     |
+        // +----------------------------------------------------------+  
+
+            // +------------------------------------------------------+
+            // | Module                                               |
+            // +------------------------------------------------------+  
+
+                begin = clock();
+                mod_sspf_process(objs->mod_sspf_object);
+                end = clock();
+                prf->mod_sspf_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                              
+
+            // +------------------------------------------------------+
+            // | Connector                                            |
+            // +------------------------------------------------------+                     
+
+                begin = clock();
+                con_spectra_process(objs->con_spectra_sspf_object);
+                end = clock();
+                prf->con_spectra_sspf_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                   
+
+            // +------------------------------------------------------+
+            // | Sinks                                                |
+            // +------------------------------------------------------+                      
+
+                begin = clock();
+                for (iSink = 0; iSink < objs->snk_spectra_sspf_object_count; iSink++) {
+                    snk_spectra_process(objs->snk_spectra_sspf_objects[iSink]);
+                }
+                end = clock();
+                prf->snk_spectra_sspf_prf += (float) (((double) (end-begin)) / CLOCKS_PER_SEC);                                                   
+
+        return rtnValue;
 
     }
\ No newline at end of file
index f245a18f76f5e9cd5262d0029a534a97207f8f1b..64a1376c15ad88acd313987cdd7d7a8f0b6d6c6d 100644 (file)
@@ -2,13 +2,22 @@
 #define __DEMO_THREADS
 
     #include "objects.h"
+    #include "profiler.h"
+
+    #include <time.h>
 
     #include <odas/odas.h>
 
-    void threads_start(objects * objs);
+    void threads_multiple_start(aobjects * aobjs);
+
+    void threads_multiple_stop(aobjects * aobjs);
+
+    void threads_multiple_join(aobjects * aobjs);
+
+    void threads_single_open(objects * objs);
 
-    void threads_stop(objects * objs);
+    void threads_single_close(objects * objs);
 
-    void threads_join(objects * objs);
+    int threads_single_process(objects * objs, profiler * prf);
 
 #endif
\ No newline at end of file
index b8f5513a5c60d0afa974614017512f8ba18de9e2..b088b7a02b6affe6a473ae6a489dcb4d79697c51 100644 (file)
@@ -1,4 +1,25 @@
 
+    #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_hops.h"
+    #include "../../src/message/msg_pots.h"
+    #include "../../src/message/msg_spectra.h"
+    #include "../../src/message/msg_tracks.h"
+    #include "../../src/module/mod_mapping.h"
+    #include "../../src/module/mod_resample.h"
+    #include "../../src/module/mod_ssl.h"
+    #include "../../src/module/mod_sspf.h"
+    #include "../../src/module/mod_sss.h"
+    #include "../../src/module/mod_sst.h"
+    #include "../../src/module/mod_stft.h"
+    #include "../../src/sink/snk_hops.h"
+    #include "../../src/sink/snk_pots.h"
+    #include "../../src/sink/snk_spectra.h"
+    #include "../../src/sink/snk_tracks.h"
+    #include "../../src/source/src_hops.h"
+
     #include "../../src/aconnector/acon_hops.h"
     #include "../../src/aconnector/acon_pots.h"
     #include "../../src/aconnector/acon_spectra.h"
index cc5ba6bd6e188143e80737183a4f39c8e86122d9..0edc5d3dc317410a4b19c25e2809b39871a4d9e2 100644 (file)
@@ -15,7 +15,7 @@
             obj->outs[iOut] = amsg_hops_construct(nMessages, msg_hops_config);
         }
 
-        obj->con_hops = con_hops_construct_zero(nOuts, msg_hops_config);
+        obj->con_hops = con_hops_construct(nOuts, msg_hops_config);
 
         obj->thread = thread_construct(&acon_hops_thread, (void *) obj);
 
index 2da99aeb9980a2e9cfcd6efea56ee91b9fad848f..c838f40167e91d748fc185e512297f11fcc2eaa1 100644 (file)
@@ -15,7 +15,7 @@
             obj->outs[iOut] = amsg_pots_construct(nMessages, msg_pots_config);
         }
 
-        obj->con_pots = con_pots_construct_zero(nOuts, msg_pots_config);
+        obj->con_pots = con_pots_construct(nOuts, msg_pots_config);
 
         obj->thread = thread_construct(&acon_pots_thread, (void *) obj);
 
index f424ae4350f421dba74192d839a011940bbe568c..bd8fcd8ec1da33d3279b9623a2e0d8c0e9f17c4d 100644 (file)
@@ -15,7 +15,7 @@
             obj->outs[iOut] = amsg_spectra_construct(nMessages, msg_spectra_config);
         }
 
-        obj->con_spectra = con_spectra_construct_zero(nOuts, msg_spectra_config);
+        obj->con_spectra = con_spectra_construct(nOuts, msg_spectra_config);
 
         obj->thread = thread_construct(&acon_spectra_thread, (void *) obj);
 
index 192012b3b275b950bcdfcb581758420b8b8627c7..a29eb53b4264824d3768ccd254443058184e8e19 100644 (file)
@@ -15,7 +15,7 @@
             obj->outs[iOut] = amsg_tracks_construct(nMessages, msg_tracks_config);
         }
 
-        obj->con_tracks = con_tracks_construct_zero(nOuts, msg_tracks_config);
+        obj->con_tracks = con_tracks_construct(nOuts, msg_tracks_config);
 
         obj->thread = thread_construct(&acon_tracks_thread, (void *) obj);
 
diff --git a/src/asink/asnk_xcorrs.c b/src/asink/asnk_xcorrs.c
new file mode 100644 (file)
index 0000000..b17fca5
--- /dev/null
@@ -0,0 +1,70 @@
+    
+    #include "asnk_xcorrs.h"
+
+    asnk_xcorrs_obj * asnk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config) {
+
+        asnk_xcorrs_obj * obj;
+
+        obj = (asnk_xcorrs_obj *) malloc(sizeof(asnk_xcorrs_obj));
+
+        obj->snk_spectra = snk_xcorrs_construct(snk_xcorrs_config, msg_xcorrs_config);
+        obj->in = (amsg_xcorrs_obj *) NULL;
+
+        obj->thread = thread_construct(&asnk_xcorrs_thread, (void *) obj);
+
+        return obj;
+
+    }
+
+    void asnk_xcorrs_destroy(asnk_xcorrs_obj * obj) {
+
+        snk_xcorrs_destroy(obj->snk_spectra);
+        thread_destroy(obj->thread);
+
+        free((void *) obj);
+
+    }
+
+    void asnk_xcorrs_connect(asnk_xcorrs_obj * obj, amsg_xcorrs_obj * in) {
+
+        obj->in = in;
+
+    }
+
+    void asnk_xcorrs_disconnect(asnk_xcorrs_obj * obj) {
+
+        obj->in = (amsg_xcorrs_obj *) NULL;
+
+    }
+
+    void * asnk_xcorrs_thread(void * ptr) {
+
+        asnk_xcorrs_obj * obj;
+        msg_xcorrs_obj * msg_xcorrs_in;
+        int rtnValue;
+
+        obj = (asnk_xcorrs_obj *) ptr;
+
+        // Open the sink
+        snk_xcorrs_open(obj->snk_spectra);
+
+        while(1) {
+
+            // Pop a message, process, and push back
+            msg_xcorrs_in = amsg_xcorrs_filled_pop(obj->in);
+            snk_xcorrs_connect(obj->snk_spectra, msg_xcorrs_in);
+            rtnValue = snk_xcorrs_process(obj->snk_spectra);
+            snk_xcorrs_disconnect(obj->snk_spectra);
+            amsg_xcorrs_empty_push(obj->in, msg_xcorrs_in);
+
+            // If this is the last frame, rtnValue = -1
+            if (rtnValue == -1) {
+                break;
+            }
+
+        }
+
+        // Close the sink
+        snk_xcorrs_close(obj->snk_spectra);
+
+    }
\ No newline at end of file
diff --git a/src/asink/asnk_xcorrs.h b/src/asink/asnk_xcorrs.h
new file mode 100644 (file)
index 0000000..1d86b4c
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __ODAS_ASINK_XCORRS
+#define __ODAS_ASINK_XCORRS
+
+    #include "../amessage/amsg_xcorrs.h"
+    #include "../sink/snk_xcorrs.h"
+    #include "../general/thread.h"
+
+    #include <stdlib.h>
+
+    typedef struct asnk_xcorrs_obj {
+
+        snk_xcorrs_obj * snk_xcorrs;
+        amsg_xcorrs_obj * in;
+        thread_obj * thread;
+
+    } asnk_xcorrs_obj;
+
+    asnk_xcorrs_obj * asnk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config);
+
+    void asnk_xcorrs_destroy(asnk_xcorrs_obj * obj);
+
+    void asnk_xcorrs_connect(asnk_xcorrs_obj * obj, amsg_xcorrs_obj * in);
+
+    void asnk_xcorrs_disconnect(asnk_xcorrs_obj * obj);
+
+    void * asnk_xcorrs_thread(void * ptr);
+
+#endif
\ No newline at end of file
diff --git a/src/asource/asrc_spectra.c b/src/asource/asrc_spectra.c
new file mode 100644 (file)
index 0000000..d9d95a1
--- /dev/null
@@ -0,0 +1,81 @@
+    
+    #include "asrc_spectra.h"
+
+    asrc_spectra_obj * asrc_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config) {
+
+        asrc_spectra_obj * obj;
+
+        obj = (asrc_spectra_obj *) malloc(sizeof(asrc_spectra_obj));
+
+        obj->src_spectra = src_spectra_construct(src_spectra_config, msg_spectra_config);
+        obj->out = (amsg_spectra_obj *) NULL;
+
+        obj->thread = thread_construct(&asrc_spectra_thread, (void *) obj);
+
+        return obj;
+
+    }
+
+    void asrc_spectra_destroy(asrc_spectra_obj * obj) {
+
+        src_spectra_destroy(obj->src_spectra);
+        thread_destroy(obj->thread);
+
+        free((void *) obj);
+
+    }
+
+    void asrc_spectra_connect(asrc_spectra_obj * obj, amsg_spectra_obj * out) {
+
+        obj->out = out;
+
+    }
+
+    void asrc_spectra_disconnect(asrc_spectra_obj * obj) {
+
+        obj->out = (amsg_spectra_obj *) NULL;
+
+    }
+
+    void * asrc_spectra_thread(void * ptr) {
+
+        asrc_spectra_obj * obj;
+        msg_spectra_obj * msg_spectra_out;
+        int rtnValue;
+
+        obj = (asrc_spectra_obj *) ptr;
+
+        // Open the source
+        src_spectra_open(obj->src_spectra);
+
+        while(1) {
+
+            // Pop a message, process, and push back
+            msg_spectra_out = amsg_spectra_empty_pop(obj->out);
+            src_spectra_connect(obj->src_spectra, msg_spectra_out);
+            rtnValue = src_spectra_process(obj->src_spectra);
+            src_spectra_disconnect(obj->src_spectra);
+            amsg_spectra_filled_push(obj->out, msg_spectra_out);
+
+            // If this is the last frame, rtnValue = -1
+            if (rtnValue == -1) {
+                break;
+            }
+
+            // Some other process may ask to stop the thread
+            if (thread_askedToStop(obj->thread) == 1) {
+                break;
+            }
+
+        }
+
+        // Close the source
+        src_spectra_close(obj->src_spectra);
+
+        // Send the "0" message, that kills all connected threads
+        // that will consume this message
+        msg_spectra_out = amsg_spectra_empty_pop(obj->out);
+        msg_spectra_zero(msg_spectra_out);
+        amsg_spectra_filled_push(obj->out, msg_spectra_out);
+
+    }
\ No newline at end of file
diff --git a/src/asource/asrc_spectra.h b/src/asource/asrc_spectra.h
new file mode 100644 (file)
index 0000000..80976ad
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef __ODAS_ASOURCE_SPECTRA
+#define __ODAS_ASOURCE_SPECTRA
+
+    #include "../amessage/amsg_spectra.h"
+    #include "../source/src_spectra.h"
+    #include "../general/thread.h"
+
+    #include <stdlib.h>
+
+    typedef struct asrc_spectra_obj {
+
+        src_spectra_obj * src_spectra;
+        amsg_spectra_obj * out;
+        thread_obj * thread;
+
+    } asrc_spectra_obj;
+
+    asrc_spectra_obj * asrc_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config);
+
+    void asrc_spectra_destroy(asrc_spectra_obj * obj);
+
+    void asrc_spectra_connect(asrc_spectra_obj * obj, amsg_spectra_obj * out);
+
+    void asrc_spectra_disconnect(asrc_spectra_obj * obj);
+
+    void * asrc_spectra_thread(void * ptr);
+
+#endif
\ No newline at end of file
index 78279ade2ea76275d157a839f33b2918329f1ca4..bb1a1f622be908485b95ae7a33f7871a526bc53a 100644 (file)
@@ -1,7 +1,7 @@
     
     #include "con_hops.h"
 
-    con_hops_obj * con_hops_construct_zero(const unsigned int nOuts, const msg_hops_cfg * msg_hops_config) {
+    con_hops_obj * con_hops_construct(const unsigned int nOuts, const msg_hops_cfg * msg_hops_config) {
 
         con_hops_obj * obj;
         unsigned int iOut;
index 8a5474cf54ecaf7edb31d7983f9bea77b38e72df..1882d9f4ec18da521bc5d1d8707cf58beef688ce 100644 (file)
@@ -15,7 +15,7 @@
 
     } con_hops_obj;
 
-    con_hops_obj * con_hops_construct_zero(const unsigned int nOuts, const msg_hops_cfg * msg_hops_config);
+    con_hops_obj * con_hops_construct(const unsigned int nOuts, const msg_hops_cfg * msg_hops_config);
 
     void con_hops_destroy(con_hops_obj * obj);
 
index 05ad4c156e9134e4c06de2e30e06c554817e6b65..a4fa06aabf33628b7ad1223f89bb268f87594bcb 100644 (file)
@@ -1,7 +1,7 @@
     
     #include "con_pots.h"
 
-    con_pots_obj * con_pots_construct_zero(const unsigned int nOuts, const msg_pots_cfg * msg_pots_config) {
+    con_pots_obj * con_pots_construct(const unsigned int nOuts, const msg_pots_cfg * msg_pots_config) {
 
         con_pots_obj * obj;
         unsigned int iOut;
index fbea0a180a0638867c81ee9231a6301d0ed5b712..d861dc69101ec981bd17570ad834b4cb4d5e1d1d 100644 (file)
@@ -15,7 +15,7 @@
 
     } con_pots_obj;
 
-    con_pots_obj * con_pots_construct_zero(const unsigned int nOuts, const msg_pots_cfg * msg_pots_config);
+    con_pots_obj * con_pots_construct(const unsigned int nOuts, const msg_pots_cfg * msg_pots_config);
 
     void con_pots_destroy(con_pots_obj * obj);
 
index ffb7470fab884fd0fa4772b98472216fe6a581d1..cc1e3f841c146ee265ed1fd33f8cb7169a8d64cb 100644 (file)
@@ -1,7 +1,7 @@
     
     #include "con_spectra.h"
 
-    con_spectra_obj * con_spectra_construct_zero(const unsigned int nOuts, const msg_spectra_cfg * msg_spectra_config) {
+    con_spectra_obj * con_spectra_construct(const unsigned int nOuts, const msg_spectra_cfg * msg_spectra_config) {
 
         con_spectra_obj * obj;
         unsigned int iOut;
index 379262ebe279e1463690dd3e85c8740153abfdc0..1d6b45ad51583954996de7539db4908b10486300 100644 (file)
@@ -15,7 +15,7 @@
 
     } con_spectra_obj;
 
-    con_spectra_obj * con_spectra_construct_zero(const unsigned int nOuts, const msg_spectra_cfg * msg_spectra_config);
+    con_spectra_obj * con_spectra_construct(const unsigned int nOuts, const msg_spectra_cfg * msg_spectra_config);
 
     void con_spectra_destroy(con_spectra_obj * obj);
 
index 46e2932e781c93a7902e2314d33c6fbc27eb3285..45794f4aa1775520e0b5f8430d737f4c15cc65f7 100644 (file)
@@ -1,7 +1,7 @@
     
     #include "con_tracks.h"
 
-    con_tracks_obj * con_tracks_construct_zero(const unsigned int nOuts, const msg_tracks_cfg * msg_tracks_config) {
+    con_tracks_obj * con_tracks_construct(const unsigned int nOuts, const msg_tracks_cfg * msg_tracks_config) {
 
         con_tracks_obj * obj;
         unsigned int iOut;
index bcd5a960101a6c2d5a877641816d7c33ca1fd1f5..4466576a012669bb4aefa54ff025ccf6284dae51 100644 (file)
@@ -15,7 +15,7 @@
 
     } con_tracks_obj;
 
-    con_tracks_obj * con_tracks_construct_zero(const unsigned int nOuts, const msg_tracks_cfg * msg_tracks_config);
+    con_tracks_obj * con_tracks_construct(const unsigned int nOuts, const msg_tracks_cfg * msg_tracks_config);
 
     void con_tracks_destroy(con_tracks_obj * obj);
 
index 184cca9f202ae02c574073460a8c9112a4226a10..27ad4faab683fbc582911069edaf5df41dd11b4f 100644 (file)
 
     }
 
-    void msg_spectra_printf(const msg_spectra_obj * obj) {
-
-        if (obj != NULL) {
-
-            printf("timeStamp = %llu\n", obj->timeStamp);
-            printf("freqs = %p\n", obj->freqs);
-
-        }
-        else {
-
-            printf("(null)\n");
-
-        }
-
-    }
-
     msg_spectra_cfg * msg_spectra_cfg_construct(void) {
 
         msg_spectra_cfg * cfg;
diff --git a/src/message/msg_xcorrs.c b/src/message/msg_xcorrs.c
new file mode 100644 (file)
index 0000000..5aed415
--- /dev/null
@@ -0,0 +1,91 @@
+    
+    #include "msg_xcorrs.h"
+
+    msg_xcorrs_obj * msg_xcorrs_construct(const msg_xcorrs_cfg * msg_xcorrs_config) {
+
+        msg_xcorrs_obj * obj;
+
+        obj = (msg_xcorrs_obj *) malloc(sizeof(msg_xcorrs_obj));
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        obj->xcorrs = xcorrs_construct_zero(msg_xcorrs_config->nPairs, msg_xcorrs_config->frameSize);
+
+        return obj;
+
+    }
+
+    void msg_xcorrs_destroy(msg_xcorrs_obj * obj) {
+
+        xcorrs_destroy(obj->xcorrs);
+        free((void *) obj);
+
+    }
+
+    void msg_xcorrs_copy(msg_xcorrs_obj * dest, const msg_xcorrs_obj * src) {
+
+        dest->timeStamp = src->timeStamp;
+        dest->fS = src->fS;
+        xcorrs_copy(dest->xcorrs, src->xcorrs);
+
+    }
+
+    void msg_xcorrs_zero(msg_xcorrs_obj * obj) {
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        xcorrs_zero(obj->xcorrs);
+
+    }
+
+    unsigned int msg_xcorrs_isZero(const msg_xcorrs_obj * obj) {
+
+        unsigned int rtnValue;
+
+        if (obj->timeStamp == 0) {
+            rtnValue = 1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
+
+    msg_xcorrs_cfg * msg_xcorrs_cfg_construct(void) {
+
+        msg_xcorrs_cfg * cfg;
+
+        cfg = (msg_xcorrs_cfg *) malloc(sizeof(msg_xcorrs_cfg));
+
+        cfg->frameSize = 0;
+        cfg->nPairs = 0;
+        cfg->fS = 0;
+
+        return cfg;
+
+    }
+
+    void msg_xcorrs_cfg_destroy(msg_xcorrs_cfg * msg_xcorrs_config) {
+
+        free((void *) msg_xcorrs_config);
+
+    }
+
+    void msg_xcorrs_cfg_printf(const msg_xcorrs_cfg * msg_xcorrs_config) {
+
+        if (msg_xcorrs_config != NULL) {
+
+            printf("frameSize = %u\n", msg_xcorrs_config->frameSize);
+            printf("nPairs = %u\n", msg_xcorrs_config->nPairs);
+            printf("fS = %u\n", msg_xcorrs_config->fS);
+
+        }
+        else {
+
+            printf("(null)\n");
+
+        }       
+
+    }
\ No newline at end of file
diff --git a/src/message/msg_xcorrs.h b/src/message/msg_xcorrs.h
new file mode 100644 (file)
index 0000000..24962ef
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef __ODAS_MESSAGE_XCORRS
+#define __ODAS_MESSAGE_XCORRS
+
+    #include <stdlib.h>
+
+    #include "../signal/xcorr.h"
+
+    typedef struct msg_xcorrs_obj {
+
+        unsigned long long timeStamp;
+        unsigned int fS;
+        xcorrs_obj * xcorrs;
+
+    } msg_xcorrs_obj;
+
+    typedef struct msg_xcorrs_cfg {
+
+        unsigned int frameSize;
+        unsigned int nPairs;
+        unsigned int fS;
+
+    } msg_xcorrs_cfg;
+
+    msg_xcorrs_obj * msg_xcorrs_construct(const msg_xcorrs_cfg * msg_xcorrs_config);
+
+    void msg_xcorrs_destroy(msg_xcorrs_obj * obj);
+
+    void msg_xcorrs_copy(msg_xcorrs_obj * dest, const msg_xcorrs_obj * src);
+
+    void msg_xcorrs_zero(msg_xcorrs_obj * obj);
+
+    unsigned int msg_xcorrs_isZero(const msg_xcorrs_obj * obj);
+
+    msg_xcorrs_cfg * msg_xcorrs_cfg_construct(void);
+
+    void msg_xcorrs_cfg_destroy(msg_xcorrs_cfg * msg_xcorrs_config);
+
+    void msg_xcorrs_cfg_printf(const msg_xcorrs_cfg * msg_xcorrs_config);
+
+#endif
\ No newline at end of file
index 5221e97eea00af8972625281865bbbfbc8fce82d..1799f7deab22ce6fc9dcbd10b91290db74ba5443 100644 (file)
 
     }
 
+    void xcorrs_copy(xcorrs_obj * dest, const xcorrs_obj * src) {
+
+        unsigned int iSignal;
+
+        for (iSignal = 0; iSignal < src->nSignals; iSignal++) {
+            memcpy(dest->array[iSignal], src->array[iSignal], src->frameSize * sizeof(float));
+        }
+
+    }
+
+    void xcorrs_zero(xcorrs_obj * obj) {
+
+        unsigned int iSignal;
+
+        for (iSignal = 0; iSignal < obj->nSignals; iSignal++) {
+            memset(obj->array[iSignal], 0x00, obj->frameSize * sizeof(float));
+        }
+
+    }
+
     void xcorrs_printf(const xcorrs_obj * obj) {
 
         unsigned int iSignal;
index 7bc7cec0895f7ea840f2314dabf6a02aedb394c6..fb9956fe5ddf339cb5ac9a649f4d4f5177f18dba 100644 (file)
 
     void xcorrs_destroy(xcorrs_obj * obj);
 
+    void xcorrs_copy(xcorrs_obj * dest, const xcorrs_obj * src);
+
+    void xcorrs_zero(xcorrs_obj * obj);
+
     void xcorrs_printf(const xcorrs_obj * obj);
 
     void xcorrs_printf_signal(const xcorrs_obj * obj, const unsigned int iSignal);
index 00c9cf46eaa1c10520698ac0491b4b90720107f7..29f0a9d2fdd6345bb982355947d0108c1e3d950e 100644 (file)
 
         memset(obj->bytes, 0x00, 4 * sizeof(char));
 
+        switch (obj->format->type) {
+            
+            case format_bin08: break;
+            case format_bin16: break;
+            case format_bin24: break;
+            case format_bin32: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
         obj->in = (msg_hops_obj *) NULL;
 
         return obj;
index 92a560076a445fd64870e2cd2c1d736031907cef..1772ee6e42efecf4040499bbd6ab10968eda5656 100644 (file)
         obj->format = format_clone(snk_pots_config->format);
         obj->interface = interface_clone(snk_pots_config->interface);
 
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
         obj->in = (msg_pots_obj *) NULL;
 
         return obj;
index dfad19064a41c8bf5ae32fba4fb520876b4b42a7..6dd3cfd68726e656f2a1d801ec81787bc5ce22bc 100644 (file)
         obj->format = format_clone(snk_spectra_config->format);
         obj->interface = interface_clone(snk_spectra_config->interface);
 
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
         obj->in = (msg_spectra_obj *) NULL;
 
         return obj;
index cb1cea06f912c958e0eff1d53c0c64de3c84ff31..bc5ced99d0323818c8559c78b39bb1620985d62e 100644 (file)
         obj->format = format_clone(snk_tracks_config->format);
         obj->interface = interface_clone(snk_tracks_config->interface);
 
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
         obj->in = (msg_tracks_obj *) NULL;
 
         return obj;
diff --git a/src/sink/snk_xcorrs.c b/src/sink/snk_xcorrs.c
new file mode 100644 (file)
index 0000000..8b4ea54
--- /dev/null
@@ -0,0 +1,218 @@
+    
+    #include "snk_xcorrs.h"
+
+    snk_xcorrs_obj * snk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config) {
+
+        snk_xcorrs_obj * obj;
+
+        obj = (snk_xcorrs_obj *) malloc(sizeof(snk_xcorrs_obj));
+
+        obj->frameSize = msg_xcorrs_config->frameSize;
+        obj->nPairs = msg_xcorrs_config->nPairs;
+        obj->fS = msg_xcorrs_config->fS;
+        
+        obj->format = format_clone(snk_xcorrs_config->format);
+        obj->interface = interface_clone(snk_xcorrs_config->interface);
+
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+        obj->in = (msg_xcorrs_obj *) NULL;
+
+        return obj;
+
+    }
+
+    void snk_xcorrs_destroy(snk_xcorrs_obj * obj) {
+
+        format_destroy(obj->format);
+        interface_destroy(obj->interface);
+
+        free((void *) obj);
+
+    }
+
+    void snk_xcorrs_connect(snk_xcorrs_obj * obj, msg_xcorrs_obj * in) {
+
+        obj->in = in;
+
+    }
+
+    void snk_xcorrs_disconnect(snk_xcorrs_obj * obj) {
+
+        obj->in = (msg_xcorrs_obj *) NULL;
+
+    }
+
+    int snk_xcorrs_open(snk_xcorrs_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                obj->fp = fopen(obj->interface->fileName, "wb");
+
+            break;
+
+            case interface_socket:
+
+                printf("Not implemented yet.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;           
+
+        }
+
+    }
+
+    int snk_xcorrs_close(snk_xcorrs_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                fclose(obj->fp);
+
+            break;
+
+            case interface_socket:
+
+                printf("Not implemented yet.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+    }
+
+    int snk_xcorrs_process(snk_xcorrs_obj * obj) {
+
+        int rtnValue;
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                rtnValue = snk_xcorrs_process_file(obj);
+
+            break;
+
+            case interface_socket:
+
+                rtnValue = snk_xcorrs_process_socket(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+        return rtnValue;
+
+    }
+
+    int snk_xcorrs_process_file(snk_xcorrs_obj * obj) {
+
+        unsigned int iSample;
+        unsigned int iPair;
+        float sample;
+        float sampleImag;
+        int rtnValue;
+
+        if (obj->in->timeStamp != 0) {
+
+            for (iSample = 0; iSample < obj->frameSize; iSample++) {
+                
+                for (iPair = 0; iPair < obj->nPairs; iPair++) {
+
+                    sample = obj->in->xcorrs->array[iPair][iSample];
+
+                    switch (obj->format->type) {
+                        
+                        case format_float:
+
+                            fwrite(&sample, sizeof(float), 1, obj->fp);
+
+                        break;
+
+                    }
+
+                }
+
+            }
+
+            rtnValue = 0;
+
+        }
+        else {
+
+            rtnValue = -1;
+
+        }
+
+        return rtnValue;
+
+    }
+
+    int snk_xcorrs_process_socket(snk_xcorrs_obj * obj) {
+
+        printf("Not implemented\n");
+        exit(EXIT_FAILURE);
+
+    }
+
+    snk_xcorrs_cfg * snk_xcorrs_cfg_construct(void) {
+
+        snk_xcorrs_cfg * cfg;
+
+        cfg = (snk_xcorrs_cfg *) malloc(sizeof(snk_xcorrs_cfg));
+
+        cfg->fS = 0;
+        cfg->format = (format_obj *) NULL;
+        cfg->interface = (interface_obj *) NULL;
+
+        return cfg;
+
+    }
+
+    void snk_xcorrs_cfg_destroy(snk_xcorrs_cfg * snk_xcorrs_config) {
+
+        if (snk_xcorrs_config->format != NULL) {
+            format_destroy(snk_xcorrs_config->format);
+        }
+        if (snk_xcorrs_config->interface != NULL) {
+            interface_destroy(snk_xcorrs_config->interface);
+        }
+
+        free((void *) snk_xcorrs_config);
+
+    }
\ No newline at end of file
diff --git a/src/sink/snk_xcorrs.h b/src/sink/snk_xcorrs.h
new file mode 100644 (file)
index 0000000..300c5e3
--- /dev/null
@@ -0,0 +1,59 @@
+#ifndef __ODAS_SINK_XCORRS
+#define __ODAS_SINK_XCORRS
+
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <string.h>
+
+    #include "../general/format.h"
+    #include "../general/interface.h"
+    #include "../message/msg_xcorrs.h"
+
+    typedef struct snk_xcorrs_obj {
+
+        unsigned long long timeStamp;
+
+        unsigned int frameSize;
+        unsigned int nPairs;
+        unsigned int fS;
+
+        format_obj * format;
+        interface_obj * interface;
+
+        FILE * fp;
+
+        msg_xcorrs_obj * in;
+
+    } snk_xcorrs_obj;
+
+    typedef struct snk_xcorrs_cfg {
+
+        unsigned int fS;
+        format_obj * format;
+        interface_obj * interface;
+
+    } snk_xcorrs_cfg;
+
+    snk_xcorrs_obj * snk_xcorrs_construct(const snk_xcorrs_cfg * snk_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config);
+
+    void snk_xcorrs_destroy(snk_xcorrs_obj * obj);
+
+    void snk_xcorrs_connect(snk_xcorrs_obj * obj, msg_xcorrs_obj * in);
+
+    void snk_xcorrs_disconnect(snk_xcorrs_obj * obj);
+
+    int snk_xcorrs_open(snk_xcorrs_obj * obj);
+
+    int snk_xcorrs_close(snk_xcorrs_obj * obj);
+
+    int snk_xcorrs_process(snk_xcorrs_obj * obj);
+
+    int snk_xcorrs_process_file(snk_xcorrs_obj * obj);
+
+    int snk_xcorrs_process_socket(snk_xcorrs_obj * obj);
+
+    snk_xcorrs_cfg * snk_xcorrs_cfg_construct(void);
+
+    void snk_xcorrs_cfg_destroy(snk_xcorrs_cfg * snk_xcorrs_config);
+
+#endif
\ No newline at end of file
index 2f8ded5a1c48f23729c4de59e5d32b4bdd342c85..63c2eebeeaf93e9aa6206d28af1c778313220598 100644 (file)
@@ -66,7 +66,6 @@
 
     void src_hops_open(src_hops_obj * obj) {
 
-
         switch(obj->interface->type) {
 
             case interface_file:
index 28bcc06ae61e9ae335aaf3f2a153dadcaeaadb32..cba9c7f0171adb4477a68b5c23914b386da1e419 100644 (file)
@@ -8,7 +8,6 @@
 
     #include "../general/format.h"
     #include "../general/interface.h"
-    #include "../general/thread.h"
     #include "../message/msg_hops.h"
     #include "../signal/hop.h"
     #include "../utils/pcm.h"
diff --git a/src/source/src_pots.c b/src/source/src_pots.c
new file mode 100644 (file)
index 0000000..5abe1e4
--- /dev/null
@@ -0,0 +1,200 @@
+    
+    #include "src_pots.h"
+
+    src_pots_obj * src_pots_construct(const src_pots_cfg * src_pots_config, const msg_pots_cfg * msg_pots_config) {
+
+        src_pots_obj * obj;
+        unsigned int nBytes;
+
+        obj = (src_pots_obj *) malloc(sizeof(src_pots_obj));
+
+        obj->timeStamp = 0;
+
+        obj->nPots = msg_pots_config->nPots;
+        obj->fS = src_pots_config->fS;
+        
+        obj->format = format_clone(src_pots_config->format);
+        obj->interface = interface_clone(src_pots_config->interface);
+
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+        obj->buffer = (float *) malloc(sizeof(float) * 4 * obj->nPots);
+
+        obj->out = (msg_pots_obj *) NULL;
+        
+        return obj;
+
+    }
+
+    void src_pots_destroy(src_pots_obj * obj) {
+
+        format_destroy(obj->format);
+        interface_destroy(obj->interface);
+
+        free((void *) obj);
+
+    }
+
+    void src_pots_connect(src_pots_obj * obj, msg_pots_obj * out) {
+
+        obj->out = out;
+
+    }
+
+    void src_pots_disconnect(src_pots_obj * obj) {
+
+        obj->out = (msg_pots_obj *) NULL;
+
+    }
+
+    void src_pots_open(src_pots_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                src_pots_open_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }   
+
+    }
+
+    void src_pots_open_file(src_pots_obj * obj) {
+
+        obj->fp = fopen(obj->interface->fileName, "rb");
+
+    }
+
+    void src_pots_close(src_pots_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                src_pots_close_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+    }
+
+    void src_pots_close_file(src_pots_obj * obj) {
+
+        fclose(obj->fp);
+
+    }
+
+    int src_pots_process(src_pots_obj * obj) {
+
+        int rtnValue;
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                rtnValue = src_pots_process_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;           
+
+        }
+
+        obj->timeStamp++;
+        obj->out->timeStamp = obj->timeStamp;
+
+        return rtnValue;
+
+    }
+
+    int src_pots_process_file(src_pots_obj * obj) {
+
+        unsigned int iPot;
+        int nSamples;
+        int rtnValue;
+
+        memset(obj->buffer, 0x00, sizeof(float) * 4 * obj->nPots);
+        nSamples = fread(obj->buffer, sizeof(float), 4 * obj->nPots, obj->fp);
+
+        for (iPot = 0; iPot < obj->nPots; iPot++) {
+
+            obj->out->pots->array[iPot*4+0] = obj->buffer[iPot*4+0];
+            obj->out->pots->array[iPot*4+1] = obj->buffer[iPot*4+1];
+            obj->out->pots->array[iPot*4+2] = obj->buffer[iPot*4+2];
+            obj->out->pots->array[iPot*4+3] = obj->buffer[iPot*4+3];
+
+        }
+
+        if (nSamples != (4 * obj->nPots)) {
+            
+            rtnValue = -1;    
+
+        }
+        else {
+
+            rtnValue = 0;
+
+        }
+
+        return rtnValue;
+
+    }
+
+    src_pots_cfg * src_pots_cfg_construct(void) {
+
+        src_pots_cfg * cfg;
+
+        cfg = (src_pots_cfg *) malloc(sizeof(src_pots_cfg));
+
+        cfg->fS = 0;
+        cfg->format = (format_obj *) NULL;
+        cfg->interface = (interface_obj *) NULL;
+
+        return cfg;
+
+    }
+
+    void src_pots_cfg_destroy(src_pots_cfg * src_pots_config) {
+
+        if (src_pots_config->format != NULL) {
+            format_destroy(src_pots_config->format);
+        }
+        if (src_pots_config->interface != NULL) {
+            interface_destroy(src_pots_config->interface);
+        }
+
+        free((void *) src_pots_config);
+
+    }
\ No newline at end of file
diff --git a/src/source/src_pots.h b/src/source/src_pots.h
new file mode 100644 (file)
index 0000000..1c75d13
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef __ODAS_SOURCE_POTS
+#define __ODAS_SOURCE_POTS
+
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <string.h>
+
+    #include "../general/format.h"
+    #include "../general/interface.h"
+    #include "../message/msg_pots.h"
+    #include "../signal/pot.h"
+    #include "../utils/pcm.h"
+
+    typedef struct src_pots_obj {
+
+        unsigned long long timeStamp;
+
+        unsigned int nPots;
+        unsigned int fS;
+
+        format_obj * format;
+        interface_obj * interface;
+
+        FILE * fp;
+
+        float * buffer;
+
+        msg_pots_obj * out;
+
+    } src_pots_obj;
+
+    typedef struct src_pots_cfg {
+
+        unsigned int fS;
+        format_obj * format;
+        interface_obj * interface;
+
+    } src_pots_cfg;
+
+    src_pots_obj * src_pots_construct(const src_pots_cfg * src_pots_config, const msg_pots_cfg * msg_pots_config);
+
+    void src_pots_destroy(src_pots_obj * obj);
+
+    void src_pots_connect(src_pots_obj * obj, msg_pots_obj * out);
+
+    void src_pots_disconnect(src_pots_obj * obj);
+
+    void src_pots_open(src_pots_obj * obj);
+
+    void src_pots_open_file(src_pots_obj * obj);
+
+    void src_pots_close(src_pots_obj * obj);
+
+    void src_pots_close_file(src_pots_obj * obj);
+
+    int src_pots_process(src_pots_obj * obj);
+
+    int src_pots_process_file(src_pots_obj * obj);
+
+    src_pots_cfg * src_pots_cfg_construct(void);
+
+    void src_pots_cfg_destroy(src_pots_cfg * src_pots_config);
+
+#endif
\ No newline at end of file
diff --git a/src/source/src_spectra.c b/src/source/src_spectra.c
new file mode 100644 (file)
index 0000000..33580db
--- /dev/null
@@ -0,0 +1,207 @@
+    
+    #include "src_spectra.h"
+
+    src_spectra_obj * src_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config) {
+
+        src_spectra_obj * obj;
+        unsigned int nBytes;
+
+        obj = (src_spectra_obj *) malloc(sizeof(src_spectra_obj));
+
+        obj->timeStamp = 0;
+
+        obj->halfFrameSize = msg_spectra_config->halfFrameSize;
+        obj->nChannels = msg_spectra_config->nChannels;
+        obj->fS = src_spectra_config->fS;
+        
+        obj->format = format_clone(src_spectra_config->format);
+        obj->interface = interface_clone(src_spectra_config->interface);
+
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+        obj->buffer = (float *) malloc(sizeof(float) * obj->halfFrameSize * 2 * obj->nChannels);
+
+        obj->out = (msg_spectra_obj *) NULL;
+        
+        return obj;
+
+    }
+
+    void src_spectra_destroy(src_spectra_obj * obj) {
+
+        free((void *) obj->buffer);
+        format_destroy(obj->format);
+        interface_destroy(obj->interface);
+
+        free((void *) obj);
+
+    }
+
+    void src_spectra_connect(src_spectra_obj * obj, msg_spectra_obj * out) {
+
+        obj->out = out;
+
+    }
+
+    void src_spectra_disconnect(src_spectra_obj * obj) {
+
+        obj->out = (msg_spectra_obj *) NULL;
+
+    }
+
+    void src_spectra_open(src_spectra_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                src_spectra_open_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }   
+
+    }
+
+    void src_spectra_open_file(src_spectra_obj * obj) {
+
+        obj->fp = fopen(obj->interface->fileName, "rb");
+
+    }
+
+    void src_spectra_close(src_spectra_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                src_spectra_close_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+    }
+
+    void src_spectra_close_file(src_spectra_obj * obj) {
+
+        fclose(obj->fp);
+
+    }
+
+    int src_spectra_process(src_spectra_obj * obj) {
+
+        int rtnValue;
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                rtnValue = src_spectra_process_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;           
+
+        }
+
+        obj->timeStamp++;
+        obj->out->timeStamp = obj->timeStamp;
+
+        return rtnValue;
+
+    }
+
+    int src_spectra_process_file(src_spectra_obj * obj) {
+
+        unsigned int iSample;
+        unsigned int iChannel;
+        float sampleReal;
+        float sampleImag;
+        int nSamples;
+        int rtnValue;
+
+        memset(obj->buffer, 0x00, sizeof(float) * obj->halfFrameSize * 2 * obj->nChannels);
+        nSamples = fread(obj->buffer, sizeof(float), obj->halfFrameSize * 2 * obj->nChannels, obj->fp);
+
+        for (iSample = 0; iSample < obj->halfFrameSize; iSample++) {
+
+            for (iChannel = 0; iChannel < obj->nChannels; iChannel++) {
+
+                obj->out->freqs->array[iChannel][iSample*2+0] = obj->buffer[(iSample*2) * obj->nChannels + iChannel + 0];
+                obj->out->freqs->array[iChannel][iSample*2+1] = obj->buffer[(iSample*2) * obj->nChannels + iChannel + 1];
+
+            }
+
+        }
+
+        if (nSamples != (obj->nChannels * obj->halfFrameSize)) {
+            
+            rtnValue = -1;    
+
+        }
+        else {
+
+            rtnValue = 0;
+
+        }
+
+        return rtnValue;
+
+    }
+
+    src_spectra_cfg * src_spectra_cfg_construct(void) {
+
+        src_spectra_cfg * cfg;
+
+        cfg = (src_spectra_cfg *) malloc(sizeof(src_spectra_cfg));
+
+        cfg->fS = 0;
+        cfg->format = (format_obj *) NULL;
+        cfg->interface = (interface_obj *) NULL;
+
+        return cfg;
+
+    }
+
+    void src_spectra_cfg_destroy(src_spectra_cfg * src_spectra_config) {
+
+        if (src_spectra_config->format != NULL) {
+            format_destroy(src_spectra_config->format);
+        }
+        if (src_spectra_config->interface != NULL) {
+            interface_destroy(src_spectra_config->interface);
+        }
+
+        free((void *) src_spectra_config);
+
+    }
\ No newline at end of file
diff --git a/src/source/src_spectra.h b/src/source/src_spectra.h
new file mode 100644 (file)
index 0000000..b2b9f13
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef __ODAS_SOURCE_SPECTRA
+#define __ODAS_SOURCE_SPECTRA
+
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <string.h>
+
+    #include "../general/format.h"
+    #include "../general/interface.h"
+    #include "../general/thread.h"
+    #include "../message/msg_spectra.h"
+    #include "../signal/freq.h"
+    #include "../utils/pcm.h"
+
+    typedef struct src_spectra_obj {
+
+        unsigned long long timeStamp;
+
+        unsigned int halfFrameSize;
+        unsigned int nChannels;
+        unsigned int fS;
+
+        format_obj * format;
+        interface_obj * interface;
+
+        FILE * fp;
+
+        float * buffer;
+
+        msg_spectra_obj * out;
+
+    } src_spectra_obj;
+
+    typedef struct src_spectra_cfg {
+
+        unsigned int fS;
+        format_obj * format;
+        interface_obj * interface;
+
+    } src_spectra_cfg;
+
+    src_spectra_obj * src_spectra_construct(const src_spectra_cfg * src_spectra_config, const msg_spectra_cfg * msg_spectra_config);
+
+    void src_spectra_destroy(src_spectra_obj * obj);
+
+    void src_spectra_connect(src_spectra_obj * obj, msg_spectra_obj * out);
+
+    void src_spectra_disconnect(src_spectra_obj * obj);
+
+    void src_spectra_open(src_spectra_obj * obj);
+
+    void src_spectra_open_file(src_spectra_obj * obj);
+
+    void src_spectra_close(src_spectra_obj * obj);
+
+    void src_spectra_close_file(src_spectra_obj * obj);
+
+    int src_spectra_process(src_spectra_obj * obj);
+
+    int src_spectra_process_file(src_spectra_obj * obj);
+
+    src_spectra_cfg * src_spectra_cfg_construct(void);
+
+    void src_spectra_cfg_destroy(src_spectra_cfg * src_spectra_config);
+
+#endif
\ No newline at end of file
diff --git a/src/source/src_tracks.c b/src/source/src_tracks.c
new file mode 100644 (file)
index 0000000..42142b4
--- /dev/null
@@ -0,0 +1,199 @@
+    
+    #include "src_tracks.h"
+
+    src_tracks_obj * src_tracks_construct(const src_tracks_cfg * src_tracks_config, const msg_tracks_cfg * msg_tracks_config) {
+
+        src_tracks_obj * obj;
+        unsigned int nBytes;
+
+        obj = (src_tracks_obj *) malloc(sizeof(src_tracks_obj));
+
+        obj->timeStamp = 0;
+
+        obj->nTracks = msg_tracks_config->nTracks;
+        obj->fS = src_tracks_config->fS;
+        
+        obj->format = format_clone(src_tracks_config->format);
+        obj->interface = interface_clone(src_tracks_config->interface);
+
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+        obj->buffer = (float *) malloc(sizeof(float) * 3 * obj->nTracks);
+
+        obj->out = (msg_tracks_obj *) NULL;
+        
+        return obj;
+
+    }
+
+    void src_tracks_destroy(src_tracks_obj * obj) {
+
+        format_destroy(obj->format);
+        interface_destroy(obj->interface);
+
+        free((void *) obj);
+
+    }
+
+    void src_tracks_connect(src_tracks_obj * obj, msg_tracks_obj * out) {
+
+        obj->out = out;
+
+    }
+
+    void src_tracks_disconnect(src_tracks_obj * obj) {
+
+        obj->out = (msg_tracks_obj *) NULL;
+
+    }
+
+    void src_tracks_open(src_tracks_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                src_tracks_open_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }   
+
+    }
+
+    void src_tracks_open_file(src_tracks_obj * obj) {
+
+        obj->fp = fopen(obj->interface->fileName, "rb");
+
+    }
+
+    void src_tracks_close(src_tracks_obj * obj) {
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                src_tracks_close_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+    }
+
+    void src_tracks_close_file(src_tracks_obj * obj) {
+
+        fclose(obj->fp);
+
+    }
+
+    int src_tracks_process(src_tracks_obj * obj) {
+
+        int rtnValue;
+
+        switch(obj->interface->type) {
+
+            case interface_file:
+
+                rtnValue = src_tracks_process_file(obj);
+
+            break;
+
+            default:
+
+                printf("Invalid interface type.\n");
+                exit(EXIT_FAILURE);
+
+            break;           
+
+        }
+
+        obj->timeStamp++;
+        obj->out->timeStamp = obj->timeStamp;
+
+        return rtnValue;
+
+    }
+
+    int src_tracks_process_file(src_tracks_obj * obj) {
+
+        unsigned int iTrack;
+        int nSamples;
+        int rtnValue;
+
+        memset(obj->buffer, 0x00, sizeof(float) * 3 * obj->nTracks);
+        nSamples = fread(obj->buffer, sizeof(float), 3 * obj->nTracks, obj->fp);
+
+        for (iTrack = 0; iTrack < obj->nTracks; iTrack++) {
+
+            obj->out->tracks->array[iTrack*3+0] = obj->buffer[iTrack*3+0];
+            obj->out->tracks->array[iTrack*3+1] = obj->buffer[iTrack*3+1];
+            obj->out->tracks->array[iTrack*3+2] = obj->buffer[iTrack*3+2];
+
+        }
+
+        if (nSamples != (3 * obj->nTracks)) {
+            
+            rtnValue = -1;    
+
+        }
+        else {
+
+            rtnValue = 0;
+
+        }
+
+        return rtnValue;
+
+    }
+
+    src_tracks_cfg * src_tracks_cfg_construct(void) {
+
+        src_tracks_cfg * cfg;
+
+        cfg = (src_tracks_cfg *) malloc(sizeof(src_tracks_cfg));
+
+        cfg->fS = 0;
+        cfg->format = (format_obj *) NULL;
+        cfg->interface = (interface_obj *) NULL;
+
+        return cfg;
+
+    }
+
+    void src_tracks_cfg_destroy(src_tracks_cfg * src_tracks_config) {
+
+        if (src_tracks_config->format != NULL) {
+            format_destroy(src_tracks_config->format);
+        }
+        if (src_tracks_config->interface != NULL) {
+            interface_destroy(src_tracks_config->interface);
+        }
+
+        free((void *) src_tracks_config);
+
+    }
\ No newline at end of file
diff --git a/src/source/src_tracks.h b/src/source/src_tracks.h
new file mode 100644 (file)
index 0000000..0ef2659
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef __ODAS_SOURCE_TRACKS
+#define __ODAS_SOURCE_TRACKS
+
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <string.h>
+
+    #include "../general/format.h"
+    #include "../general/interface.h"
+    #include "../message/msg_tracks.h"
+    #include "../signal/pot.h"
+    #include "../utils/pcm.h"
+
+    typedef struct src_tracks_obj {
+
+        unsigned long long timeStamp;
+
+        unsigned int nTracks;
+        unsigned int fS;
+
+        format_obj * format;
+        interface_obj * interface;
+
+        FILE * fp;
+
+        float * buffer;
+
+        msg_tracks_obj * out;
+
+    } src_tracks_obj;
+
+    typedef struct src_tracks_cfg {
+
+        unsigned int fS;
+        format_obj * format;
+        interface_obj * interface;
+
+    } src_tracks_cfg;
+
+    src_tracks_obj * src_tracks_construct(const src_tracks_cfg * src_tracks_config, const msg_tracks_cfg * msg_tracks_config);
+
+    void src_tracks_destroy(src_tracks_obj * obj);
+
+    void src_tracks_connect(src_tracks_obj * obj, msg_tracks_obj * out);
+
+    void src_tracks_disconnect(src_tracks_obj * obj);
+
+    void src_tracks_open(src_tracks_obj * obj);
+
+    void src_tracks_open_file(src_tracks_obj * obj);
+
+    void src_tracks_close(src_tracks_obj * obj);
+
+    void src_tracks_close_file(src_tracks_obj * obj);
+
+    int src_tracks_process(src_tracks_obj * obj);
+
+    int src_tracks_process_file(src_tracks_obj * obj);
+
+    src_tracks_cfg * src_tracks_cfg_construct(void);
+
+    void src_tracks_cfg_destroy(src_tracks_cfg * src_tracks_config);
+
+#endif
\ No newline at end of file
diff --git a/src/source/src_xcorrs.c b/src/source/src_xcorrs.c
new file mode 100644 (file)
index 0000000..b0fe1e3
--- /dev/null
@@ -0,0 +1,101 @@
+    
+    #include "src_xcorrs.h"
+
+    src_xcorrs_obj * src_xcorrs_construct(const src_xcorrs_cfg * src_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config) {
+
+        src_xcorrs_obj * obj;
+        unsigned int nBytes;
+
+        obj = (src_xcorrs_obj *) malloc(sizeof(src_xcorrs_obj));
+
+        obj->timeStamp = 0;
+
+        obj->frameSize = msg_spectra_config->frameSize;
+        obj->nPairs = msg_spectra_config->nPairs;
+        obj->fS = src_spectra_config->fS;
+        
+        obj->format = format_clone(src_spectra_config->format);
+        obj->interface = interface_clone(src_spectra_config->interface);
+
+        switch (obj->format->type) {
+            
+            case format_float: break;
+            default:
+
+                printf("Invalid format.\n");
+                exit(EXIT_FAILURE);
+
+            break;
+
+        }
+
+        obj->buffer = (float *) malloc(sizeof(float) * obj->halfFrameSize * 2 * obj->nChannels);
+
+        obj->out = (msg_spectra_obj *) NULL;
+        
+        return obj;
+
+    }
+
+    void src_xcorrs_destroy(src_xcorrs_obj * obj) {
+
+    }
+
+    void src_xcorrs_connect(src_xcorrs_obj * obj, msg_xcorrs_obj * out) {
+
+    }
+
+    void src_xcorrs_disconnect(src_xcorrs_obj * obj) {
+
+    }
+
+    void src_xcorrs_open(src_xcorrs_obj * obj) {
+
+    }
+
+    void src_xcorrs_open_file(src_xcorrs_obj * obj) {
+
+    }
+
+    void src_xcorrs_close(src_xcorrs_obj * obj) {
+
+    }
+
+    void src_xcorrs_close_file(src_xcorrs_obj * obj) {
+
+    }
+
+    int src_xcorrs_process(src_xcorrs_obj * obj) {
+
+    }
+
+    int src_xcorrs_process_file(src_xcorrs_obj * obj) {
+
+    }
+
+    src_xcorrs_cfg * src_xcorrs_cfg_construct(void) {
+
+        src_xcorrs_cfg * cfg;
+
+        cfg = (src_xcorrs_cfg *) malloc(sizeof(src_xcorrs_cfg));
+
+        cfg->fS = 0;
+        cfg->format = (format_obj *) NULL;
+        cfg->interface = (interface_obj *) NULL;
+
+        return cfg;
+
+    }
+
+    void src_xcorrs_cfg_destroy(src_xcorrs_cfg * src_xcorrs_config) {
+
+        if (src_xcorrs_config->format != NULL) {
+            format_destroy(src_xcorrs_config->format);
+        }
+        if (src_xcorrs_config->interface != NULL) {
+            interface_destroy(src_xcorrs_config->interface);
+        }
+
+        free((void *) src_xcorrs_config);
+
+    }
\ No newline at end of file
diff --git a/src/source/src_xcorrs.h b/src/source/src_xcorrs.h
new file mode 100644 (file)
index 0000000..77db97f
--- /dev/null
@@ -0,0 +1,66 @@
+#ifndef __ODAS_SOURCE_XCORRS
+#define __ODAS_SOURCE_XCORRS
+
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <string.h>
+
+    #include "../general/format.h"
+    #include "../general/interface.h"
+    #include "../general/thread.h"
+    #include "../message/msg_xcorrs.h"
+    #include "../signal/xcorr.h"
+    #include "../utils/pcm.h"
+
+    typedef struct src_xcorrs_obj {
+
+        unsigned long long timeStamp;
+
+        unsigned int frameSize;
+        unsigned int nPairs;
+        unsigned int fS;
+
+        format_obj * format;
+        interface_obj * interface;
+
+        FILE * fp;
+
+        float * buffer;
+
+        msg_xcorrs_obj * out;
+
+    } src_xcorrs_obj;
+
+    typedef struct src_xcorrs_cfg {
+
+        unsigned int fS;
+        format_obj * format;
+        interface_obj * interface;
+
+    } src_xcorrs_cfg;
+
+    src_xcorrs_obj * src_xcorrs_construct(const src_xcorrs_cfg * src_xcorrs_config, const msg_xcorrs_cfg * msg_xcorrs_config);
+
+    void src_xcorrs_destroy(src_xcorrs_obj * obj);
+
+    void src_xcorrs_connect(src_xcorrs_obj * obj, msg_xcorrs_obj * out);
+
+    void src_xcorrs_disconnect(src_xcorrs_obj * obj);
+
+    void src_xcorrs_open(src_xcorrs_obj * obj);
+
+    void src_xcorrs_open_file(src_xcorrs_obj * obj);
+
+    void src_xcorrs_close(src_xcorrs_obj * obj);
+
+    void src_xcorrs_close_file(src_xcorrs_obj * obj);
+
+    int src_xcorrs_process(src_xcorrs_obj * obj);
+
+    int src_xcorrs_process_file(src_xcorrs_obj * obj);
+
+    src_xcorrs_cfg * src_xcorrs_cfg_construct(void);
+
+    void src_xcorrs_cfg_destroy(src_xcorrs_cfg * src_xcorrs_config);
+
+#endif
\ No newline at end of file