Revert "RendezVous Team Changes "
authorFrançois Grondin <Francois.Grondin2@USherbrooke.ca>
Thu, 1 Apr 2021 17:28:01 +0000 (13:28 -0400)
committerGitHub <noreply@github.com>
Thu, 1 Apr 2021 17:28:01 +0000 (13:28 -0400)
13 files changed:
.gitignore [deleted file]
CMakeLists.txt
demo/odaslive/objects.c
demo/odaslive/objects.h
demo/odaslive/parameters.c
include/odas/general/interface.h
include/odas/general/map.h [deleted file]
include/odas/sink/snk_hops.h
include/odas/source/src_hops.h
src/general/interface.c
src/general/map.c [deleted file]
src/sink/snk_hops.c
src/source/src_hops.c

diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index 9a64151..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/*
-build/*
-lib/*
\ No newline at end of file
index 67084a306e5837e46bc5da069b0e74532383f855..9a2ac3ca96ff48f1746a3f60f4eee440e05513ed 100644 (file)
@@ -27,7 +27,6 @@ set(SRC
     src/general/format.c
     src/general/interface.c
     src/general/link.c
-    src/general/map.c
     src/general/mic.c
     src/general/samplerate.c
     src/general/soundspeed.c
@@ -194,8 +193,6 @@ target_link_libraries(odas
        ${PC_FFTW3_LIBRARIES}
        ${PC_ALSA_LIBRARIES}
     ${PC_LIBCONFIG_LIBRARIES}
-    pulse
-    pulse-simple
        m
     pthread
 )
index 194cca77cc933fe9811b8f36a39393c0d711baa2..c7fecbaca5e836b78f2e71fa00c2e17268e7dc27 100644 (file)
@@ -8,8 +8,6 @@
 
         objs = (objects *) malloc(sizeof(objects));
 
-        map_init(&objs->timestamp_map);
-
         // +----------------------------------------------------------+
         // | Construct                                                |
         // +----------------------------------------------------------+
 
                 // +--------------------------------------------------+
                 // | Source                                           |
-                // +--------------------------------------------------+
+                // +--------------------------------------------------+  
 
                     objs->src_hops_mics_object = src_hops_construct(cfgs->src_hops_mics_config, 
                                                                     cfgs->msg_hops_mics_raw_config);
-                    
-                    src_hops_set_timestamp_map(objs->src_hops_mics_object, &objs->timestamp_map);
 
                 // +--------------------------------------------------+
                 // | Connector                                        |
                     objs->snk_hops_seps_vol_object = snk_hops_construct(cfgs->snk_hops_seps_vol_config, 
                                                                         cfgs->msg_hops_seps_vol_config);
 
-                    snk_hops_set_timestamp_map(objs->snk_hops_seps_vol_object, &objs->timestamp_map);                                                                        
-
                     objs->snk_hops_pfs_vol_object = snk_hops_construct(cfgs->snk_hops_pfs_vol_config, 
                                                                        cfgs->msg_hops_pfs_vol_config);
 
         // | Destroy                                                  |
         // +----------------------------------------------------------+
 
-            map_deinit(&objs->timestamp_map);
-
             // +------------------------------------------------------+
             // | Raw                                                  |
             // +------------------------------------------------------+  
 
         objs->nMessages = 100;
 
-        map_init(&objs->timestamp_map);
-
         // +----------------------------------------------------------+
         // | Construct                                                |
         // +----------------------------------------------------------+
 
                     objs->asrc_hops_mics_object = asrc_hops_construct(cfgs->src_hops_mics_config, 
                                                                       cfgs->msg_hops_mics_raw_config);
-
-                    src_hops_set_timestamp_map(objs->asrc_hops_mics_object->src_hops, &objs->timestamp_map);  
                 
                 // +--------------------------------------------------+
                 // | Connector                                        |
                     objs->asnk_hops_seps_vol_object = asnk_hops_construct(cfgs->snk_hops_seps_vol_config, 
                                                                           cfgs->msg_hops_seps_vol_config);
 
-                    snk_hops_set_timestamp_map(objs->asnk_hops_seps_vol_object->snk_hops, &objs->timestamp_map);  
-
                     objs->asnk_hops_pfs_vol_object = asnk_hops_construct(cfgs->snk_hops_pfs_vol_config, 
                                                                          cfgs->msg_hops_pfs_vol_config);
 
         // | Destroy                                                  |
         // +----------------------------------------------------------+
 
-            map_deinit(&objs->timestamp_map);
-
             // +------------------------------------------------------+
             // | Raw                                                  |
             // +------------------------------------------------------+  
index b94a5b2d3a64fb1559928bf9d58a3d7927514c7d..dbb3abf6e1b9c353659b6bb484b019121f903ed5 100644 (file)
@@ -60,8 +60,6 @@
         con_categories_obj * con_categories_object;
         snk_categories_obj * snk_categories_object;
 
-        map_ull_t timestamp_map;
-
     } objects;   
 
     typedef struct aobjects {
         acon_categories_obj * acon_categories_object;
         asnk_categories_obj * asnk_categories_object;
 
-        map_ull_t timestamp_map;
-
     } aobjects;
  
     objects * objects_construct(const configs * cfgs);
index bc4ad327450c2fd78b4ee48bdab9e51b37f60cec..eb0777a99e6337e6e5b3a82418b0c7b69de555e9 100644 (file)
 
                 cfg->interface = interface_construct_soundcard_by_name(tmpStr2);
 
-            }
-            else if (strcmp(tmpStr1, "pulseaudio") == 0) {
-
-                tmpStr2 = parameters_lookup_string(fileConfig, "raw.interface.source");
-
-                cfg->interface = interface_construct_pulseaudio(tmpStr2);
-
             }
             else {
                 printf("raw.interface.type: Invalid type\n");
index 58c71fe3265788b64870116b6f4738e01ef59634..349ca1e5eb0b4501f8c41a3c8092de9d9f3a5898 100644 (file)
@@ -35,7 +35,6 @@
         interface_socket = 3,
         interface_soundcard = 4,
         interface_terminal = 5,
-        interface_pulseaudio = 6
 
     } interface_type;
 
@@ -60,8 +59,6 @@
 
     interface_obj * interface_construct_socket(const char * ip, const unsigned int port);
 
-    interface_obj * interface_construct_pulseaudio(const char * sourceName);
-
     interface_obj * interface_construct_soundcard(const unsigned int card, const unsigned int device);
 
     interface_obj * interface_construct_soundcard_by_name(char * deviceName);
diff --git a/include/odas/general/map.h b/include/odas/general/map.h
deleted file mode 100644 (file)
index cf923d5..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/** 
- * Copyright (c) 2014 rxi
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MIT license. See LICENSE for details.
- */
-
-#ifndef MAP_H
-#define MAP_H
-
-#include <string.h>
-
-#define MAP_VERSION "0.1.0"
-
-struct map_node_t;
-typedef struct map_node_t map_node_t;
-
-typedef struct {
-  map_node_t **buckets;
-  unsigned nbuckets, nnodes;
-} map_base_t;
-
-typedef struct {
-  unsigned bucketidx;
-  map_node_t *node;
-} map_iter_t;
-
-
-#define map_t(T)\
-  struct { map_base_t base; T *ref; T tmp; }
-
-
-#define map_init(m)\
-  memset(m, 0, sizeof(*(m)))
-
-
-#define map_deinit(m)\
-  map_deinit_(&(m)->base)
-
-
-#define map_get(m, key)\
-  ( (m)->ref = map_get_(&(m)->base, key) )
-
-
-#define map_set(m, key, value)\
-  ( (m)->tmp = (value),\
-    map_set_(&(m)->base, key, &(m)->tmp, sizeof((m)->tmp)) )
-
-
-#define map_remove(m, key)\
-  map_remove_(&(m)->base, key)
-
-
-#define map_iter(m)\
-  map_iter_()
-
-
-#define map_next(m, iter)\
-  map_next_(&(m)->base, iter)
-
-
-void map_deinit_(map_base_t *m);
-void *map_get_(map_base_t *m, const char *key);
-int map_set_(map_base_t *m, const char *key, void *value, int vsize);
-void map_remove_(map_base_t *m, const char *key);
-map_iter_t map_iter_(void);
-const char *map_next_(map_base_t *m, map_iter_t *iter);
-
-
-typedef map_t(void*) map_void_t;
-typedef map_t(char*) map_str_t;
-typedef map_t(int) map_int_t;
-typedef map_t(char) map_char_t;
-typedef map_t(float) map_float_t;
-typedef map_t(double) map_double_t;
-typedef map_t(unsigned long long) map_ull_t;
-
-#endif
\ No newline at end of file
index ce918e2a31599c332e0d4e32983ea966880d1f76..677f225e36230efb839deebc06dbaa837d7ddf29 100644 (file)
@@ -32,7 +32,6 @@
     #include <arpa/inet.h>
 
     #include "../general/format.h"
-    #include "../general/map.h"
     #include "../general/interface.h"
     #include "../message/msg_hops.h"
     #include "../utils/pcm.h"
@@ -40,8 +39,6 @@
     typedef struct snk_hops_obj {
 
         unsigned long long timeStamp;
-        unsigned long long readTimeStamp;
-        map_ull_t * timeStampMap;
 
         unsigned int hopSize;
         unsigned int nChannels;
         interface_obj * interface;
 
         char * buffer;
-        char * headerBufferPtr;
-        char * audioBufferPtr;
-        unsigned int headerSize;
-        unsigned int audioSize;
+        unsigned int bufferSize;
 
         FILE * fp;
 
 
     void snk_hops_process_format_undefined(snk_hops_obj * obj);
 
-    void snk_hops_set_timestamp_map(snk_hops_obj * obj, map_ull_t * timestamp_map);
-
     snk_hops_cfg * snk_hops_cfg_construct(void);
 
     void snk_hops_cfg_destroy(snk_hops_cfg * snk_hops_config);
index 63e5a1a57cb3c71627f9c9f18453bc9a681c22a4..b0a32b9ee00f342745b25c395f426cc5a3d68c69 100644 (file)
     #include <stdio.h>
     #include <string.h>
     #include <alsa/asoundlib.h>
-    #include <pulse/simple.h>
-    #include <pulse/error.h>
 
     #include "../general/format.h"
     #include "../general/interface.h"
-    #include "../general/map.h"
     #include "../message/msg_hops.h"
     #include "../signal/hop.h"
     #include "../utils/pcm.h"
@@ -40,7 +37,6 @@
     typedef struct src_hops_obj {
 
         unsigned long long timeStamp;
-        map_ull_t * timeStampMap;
 
         unsigned int hopSize;
         unsigned int nChannels;
@@ -51,9 +47,6 @@
 
         FILE * fp;
         snd_pcm_t * ch;
-        pa_simple * pa;
-        pa_sample_spec ss;
-        pa_channel_map map;
 
         char * buffer;
         unsigned int bufferSize;
 
     void src_hops_open_interface_soundcard(src_hops_obj * obj);
 
-    void src_hops_open_interface_pulseaudio(src_hops_obj * obj);
-
     void src_hops_close(src_hops_obj * obj);
 
     void src_hops_close_interface_file(src_hops_obj * obj);
 
     void src_hops_close_interface_soundcard(src_hops_obj * obj);
 
-    void src_hops_close_interface_pulseaudio(src_hops_obj * obj);
-
     int src_hops_process(src_hops_obj * obj);
 
     int src_hops_process_interface_file(src_hops_obj * obj);
 
     int src_hops_process_interface_soundcard(src_hops_obj * obj);
 
-    int src_hops_process_interface_pulseaudio(src_hops_obj * obj);
-
     void src_hops_process_format_binary_int08(src_hops_obj * obj);
 
     void src_hops_process_format_binary_int16(src_hops_obj * obj);
 
     void src_hops_process_format_binary_int32(src_hops_obj * obj);
 
-    void src_hops_set_timestamp_map(src_hops_obj * obj, map_ull_t * timestamp_map);
-
     src_hops_cfg * src_hops_cfg_construct(void);
 
     void src_hops_cfg_destroy(src_hops_cfg * src_hops_config);
index 02e07a5cfd9ed88f20a8c420346636758c1ef76a..c01a628c7d3b651fdd1fdfc1ed429943e43f1eef 100644 (file)
 
     }
 
-    interface_obj * interface_construct_pulseaudio(const char * sourceName) {
-
-        interface_obj * obj;
-
-        obj = (interface_obj *) malloc(sizeof(interface_obj));
-
-        // +----------------------------------------------------------+
-        // | Type                                                     |
-        // +----------------------------------------------------------+
-
-            obj->type = interface_pulseaudio;
-
-        // +----------------------------------------------------------+
-        // | Blackhole                                                |
-        // +----------------------------------------------------------+
-
-            // (Empty)
-
-        // +----------------------------------------------------------+
-        // | File                                                     |
-        // +----------------------------------------------------------+
-
-            obj->fileName = (char *) NULL;
-
-        // +----------------------------------------------------------+
-        // | Socket                                                   |
-        // +----------------------------------------------------------+
-
-            obj->ip = (char *) NULL;
-            obj->port = 0;
-
-        // +----------------------------------------------------------+
-        // | Soundcard                                                |
-        // +----------------------------------------------------------+
-
-            obj->deviceName = (char *) malloc(sizeof(char) * (strlen(sourceName)+1));
-            strcpy(obj->deviceName, sourceName);
-
-        // +----------------------------------------------------------+
-        // | Terminal                                                 |
-        // +----------------------------------------------------------+
-
-            // (Empty)
-
-        return obj;        
-
-    }
-
    interface_obj * interface_construct_soundcard(const unsigned int card, const unsigned int device) {
 
        char * deviceName = (char *) malloc(sizeof(char) * 1024);
                 clone->deviceName = obj->deviceName;
             }
 
-        // +----------------------------------------------------------+
-        // | Pulseaudio                                               |
-        // +----------------------------------------------------------+
-
-            if (obj->type == interface_pulseaudio) {
-                clone->deviceName = obj->deviceName;
-            }
-
-
         // +----------------------------------------------------------+
         // | Terminal                                                 |
         // +----------------------------------------------------------+
 
                     break;
 
-                case interface_pulseaudio:
-
-                    printf("type = pulseaudio, devicename = %s\n", obj->deviceName);
-
-                    break;
-
                 case interface_terminal:
 
                     printf("type = terminal\n");
diff --git a/src/general/map.c b/src/general/map.c
deleted file mode 100644 (file)
index 7753bf4..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/** 
- * Copyright (c) 2014 rxi
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the MIT license. See LICENSE for details.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include "general/map.h"
-
-struct map_node_t {
-  unsigned hash;
-  void *value;
-  map_node_t *next;
-  /* char key[]; */
-  /* char value[]; */
-};
-
-
-static unsigned map_hash(const char *str) {
-  unsigned hash = 5381;
-  while (*str) {
-    hash = ((hash << 5) + hash) ^ *str++;
-  }
-  return hash;
-}
-
-
-static map_node_t *map_newnode(const char *key, void *value, int vsize) {
-  map_node_t *node;
-  int ksize = strlen(key) + 1;
-  int voffset = ksize + ((sizeof(void*) - ksize) % sizeof(void*));
-  node = malloc(sizeof(*node) + voffset + vsize);
-  if (!node) return NULL;
-  memcpy(node + 1, key, ksize);
-  node->hash = map_hash(key);
-  node->value = ((char*) (node + 1)) + voffset;
-  memcpy(node->value, value, vsize);
-  return node;
-}
-
-
-static int map_bucketidx(map_base_t *m, unsigned hash) {
-  /* If the implementation is changed to allow a non-power-of-2 bucket count,
-   * the line below should be changed to use mod instead of AND */
-  return hash & (m->nbuckets - 1);
-}
-
-
-static void map_addnode(map_base_t *m, map_node_t *node) {
-  int n = map_bucketidx(m, node->hash);
-  node->next = m->buckets[n];
-  m->buckets[n] = node;
-}
-
-
-static int map_resize(map_base_t *m, int nbuckets) {
-  map_node_t *nodes, *node, *next;
-  map_node_t **buckets;
-  int i; 
-  /* Chain all nodes together */
-  nodes = NULL;
-  i = m->nbuckets;
-  while (i--) {
-    node = (m->buckets)[i];
-    while (node) {
-      next = node->next;
-      node->next = nodes;
-      nodes = node;
-      node = next;
-    }
-  }
-  /* Reset buckets */
-  buckets = realloc(m->buckets, sizeof(*m->buckets) * nbuckets);
-  if (buckets != NULL) {
-    m->buckets = buckets;
-    m->nbuckets = nbuckets;
-  }
-  if (m->buckets) {
-    memset(m->buckets, 0, sizeof(*m->buckets) * m->nbuckets);
-    /* Re-add nodes to buckets */
-    node = nodes;
-    while (node) {
-      next = node->next;
-      map_addnode(m, node);
-      node = next;
-    }
-  }
-  /* Return error code if realloc() failed */
-  return (buckets == NULL) ? -1 : 0;
-}
-
-
-static map_node_t **map_getref(map_base_t *m, const char *key) {
-  unsigned hash = map_hash(key);
-  map_node_t **next;
-  if (m->nbuckets > 0) {
-    next = &m->buckets[map_bucketidx(m, hash)];
-    while (*next) {
-      if ((*next)->hash == hash && !strcmp((char*) (*next + 1), key)) {
-        return next;
-      }
-      next = &(*next)->next;
-    }
-  }
-  return NULL;
-}
-
-
-void map_deinit_(map_base_t *m) {
-  map_node_t *next, *node;
-  int i;
-  i = m->nbuckets;
-  while (i--) {
-    node = m->buckets[i];
-    while (node) {
-      next = node->next;
-      free(node);
-      node = next;
-    }
-  }
-  free(m->buckets);
-}
-
-
-void *map_get_(map_base_t *m, const char *key) {
-  map_node_t **next = map_getref(m, key);
-  return next ? (*next)->value : NULL;
-}
-
-
-int map_set_(map_base_t *m, const char *key, void *value, int vsize) {
-  int n, err;
-  map_node_t **next, *node;
-  /* Find & replace existing node */
-  next = map_getref(m, key);
-  if (next) {
-    memcpy((*next)->value, value, vsize);
-    return 0;
-  }
-  /* Add new node */
-  node = map_newnode(key, value, vsize);
-  if (node == NULL) goto fail;
-  if (m->nnodes >= m->nbuckets) {
-    n = (m->nbuckets > 0) ? (m->nbuckets << 1) : 1;
-    err = map_resize(m, n);
-    if (err) goto fail;
-  }
-  map_addnode(m, node);
-  m->nnodes++;
-  return 0;
-  fail:
-  if (node) free(node);
-  return -1;
-}
-
-
-void map_remove_(map_base_t *m, const char *key) {
-  map_node_t *node;
-  map_node_t **next = map_getref(m, key);
-  if (next) {
-    node = *next;
-    *next = (*next)->next;
-    free(node);
-    m->nnodes--;
-  }
-}
-
-
-map_iter_t map_iter_(void) {
-  map_iter_t iter;
-  iter.bucketidx = -1;
-  iter.node = NULL;
-  return iter;
-}
-
-
-const char *map_next_(map_base_t *m, map_iter_t *iter) {
-  if (iter->node) {
-    iter->node = iter->node->next;
-    if (iter->node == NULL) goto nextBucket;
-  } else {
-    nextBucket:
-    do {
-      if (++iter->bucketidx >= m->nbuckets) {
-        return NULL;
-      }
-      iter->node = m->buckets[iter->bucketidx];
-    } while (iter->node == NULL);
-  }
-  return (char*) (iter->node + 1);
-}
\ No newline at end of file
index c34b0a4de286eeed0eb5d003d549d97f7efb0968..406ad13d468448660c3bb447bfe9d09d997c5138 100644 (file)
@@ -30,8 +30,6 @@
         obj = (snk_hops_obj *) malloc(sizeof(snk_hops_obj));
 
         obj->timeStamp = 0;
-        obj->readTimeStamp = 0;
-        obj->timeStampMap = NULL;
 
         obj->hopSize = msg_hops_config->hopSize;
         obj->nChannels = msg_hops_config->nChannels;
 
         }
 
-        unsigned int headerSize = sizeof(obj->readTimeStamp);
-        unsigned int audioSize = sizeof(char) * msg_hops_config->nChannels * msg_hops_config->hopSize * 4;
-
-        obj->buffer = (char *) malloc(headerSize + audioSize);
-        obj->headerBufferPtr = obj->buffer;
-        obj->audioBufferPtr = obj->buffer + headerSize;
-        memset(obj->headerBufferPtr, 0x00, headerSize);
-        memset(obj->audioBufferPtr, 0x00, audioSize);
-        obj->audioSize = 0;
-        obj->headerSize = headerSize;
+        obj->buffer = (char *) malloc(sizeof(char) * msg_hops_config->nChannels * msg_hops_config->hopSize * 4);
+        memset(obj->buffer, 0x00, sizeof(char) * msg_hops_config->nChannels * msg_hops_config->hopSize * 4);
+        obj->bufferSize = 0;
 
         obj->in = (msg_hops_obj *) NULL;
 
 
         if (obj->in->timeStamp != 0) {
 
-            if (obj->timeStampMap != NULL)
-            {
-                const int n = snprintf(NULL, 0, "%llu", obj->in->timeStamp);
-                char key[n+1];
-                int c = snprintf(key, n+1, "%llu", obj->in->timeStamp);
-                if (key[n] != '\0' || c != n) {
-                    printf("Sink hops: Invalid timestamp \n");
-                    rtnValue = -1;
-                }
-
-                unsigned long long* readTimeStamp = map_get(obj->timeStampMap, key);
-                if (readTimeStamp) {
-                    obj->readTimeStamp = *readTimeStamp;
-                    map_remove(obj->timeStampMap, key);
-                } else {
-                    printf("Sink hops: timestamp not found \n");
-                }
-            }
-
             switch(obj->format->type) {
 
                 case format_binary_int08:
 
     void snk_hops_process_interface_file(snk_hops_obj * obj) {
 
-        fwrite(obj->audioBufferPtr, sizeof(char), obj->audioSize, obj->fp);
+        fwrite(obj->buffer, sizeof(char), obj->bufferSize, obj->fp);
 
     }
 
     void snk_hops_process_interface_socket(snk_hops_obj * obj) {
 
-        char* bufferToSend = obj->audioBufferPtr;
-        unsigned int bytesToSend = obj->audioSize;
-
-        if (obj->readTimeStamp != 0) {
-            bufferToSend = obj->headerBufferPtr;
-            bytesToSend = obj->headerSize + obj->audioSize;
-            memcpy(obj->headerBufferPtr, &obj->readTimeStamp, obj->headerSize);
-        }
-
-        if (send(obj->sid, bufferToSend, bytesToSend, 0) < 0) {
+        if (send(obj->sid, obj->buffer, obj->bufferSize, 0) < 0) {
             printf("Sink hops: Could not send message.\n");
             exit(EXIT_FAILURE);
         }
 
                 sample = obj->in->hops->array[iChannel][iSample];
                 pcm_normalized2signedXXbits(sample, nBytes, obj->bytes);
-                memcpy(&(obj->audioBufferPtr[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
+                memcpy(&(obj->buffer[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
 
                 nBytesTotal += nBytes;
 
 
         }
 
-        obj->audioSize = nBytesTotal;
+        obj->bufferSize = nBytesTotal;
 
     }
 
 
                 sample = obj->in->hops->array[iChannel][iSample];
                 pcm_normalized2signedXXbits(sample, nBytes, obj->bytes);
-                memcpy(&(obj->audioBufferPtr[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
+                memcpy(&(obj->buffer[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
 
                 nBytesTotal += nBytes;
 
 
         }
 
-        obj->audioSize = nBytesTotal;
+        obj->bufferSize = nBytesTotal;
 
     }
 
 
                 sample = obj->in->hops->array[iChannel][iSample];
                 pcm_normalized2signedXXbits(sample, nBytes, obj->bytes);
-                memcpy(&(obj->audioBufferPtr[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
+                memcpy(&(obj->buffer[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
 
                 nBytesTotal += nBytes;
 
 
         }
 
-        obj->audioSize = nBytesTotal;
+        obj->bufferSize = nBytesTotal;
 
     }    
 
 
                 sample = obj->in->hops->array[iChannel][iSample];
                 pcm_normalized2signedXXbits(sample, nBytes, obj->bytes);
-                memcpy(&(obj->audioBufferPtr[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
+                memcpy(&(obj->buffer[nBytesTotal]), &(obj->bytes[4-nBytes]), sizeof(char) * nBytes);
 
                 nBytesTotal += nBytes;
 
 
         }
 
-        obj->audioSize = nBytesTotal;
+        obj->bufferSize = nBytesTotal;
 
     }
 
     void snk_hops_process_format_undefined(snk_hops_obj * obj) {
 
-        obj->audioBufferPtr[0] = 0x00;
-        obj->audioSize = 0;
-
-    }
+        obj->buffer[0] = 0x00;
+        obj->bufferSize = 0;
 
-    void snk_hops_set_timestamp_map(snk_hops_obj * obj, map_ull_t * timestamp_map)
-    {
-        obj->timeStampMap = timestamp_map;
     }
 
     snk_hops_cfg * snk_hops_cfg_construct(void) {
index 466181315627073412080c63750407566473aaed..8c2081f21ea6c9059132d3692b8d67548ab25958 100644 (file)
@@ -31,7 +31,6 @@
         obj = (src_hops_obj *) malloc(sizeof(src_hops_obj));
 
         obj->timeStamp = 0;
-        obj->timeStampMap = NULL;
 
         obj->hopSize = msg_hops_config->hopSize;
         obj->nChannels = msg_hops_config->nChannels;
               ((obj->interface->type == interface_soundcard)  && (obj->format->type == format_binary_int08)) ||
               ((obj->interface->type == interface_soundcard)  && (obj->format->type == format_binary_int16)) ||
               ((obj->interface->type == interface_soundcard)  && (obj->format->type == format_binary_int24)) ||
-              ((obj->interface->type == interface_soundcard)  && (obj->format->type == format_binary_int32)) ||
-              ((obj->interface->type == interface_pulseaudio)  && (obj->format->type == format_binary_int08)) ||
-              ((obj->interface->type == interface_pulseaudio)  && (obj->format->type == format_binary_int16)) ||
-              ((obj->interface->type == interface_pulseaudio)  && (obj->format->type == format_binary_int24)) ||
-              ((obj->interface->type == interface_pulseaudio)  && (obj->format->type == format_binary_int32)))) {
+              ((obj->interface->type == interface_soundcard)  && (obj->format->type == format_binary_int32)))) {
             
             printf("Source hops: Invalid interface and/or format.\n");
             exit(EXIT_FAILURE);
 
             break;
 
-            case interface_pulseaudio:
-
-                src_hops_open_interface_pulseaudio(obj);
-
-            break;
-
             default:
 
                 printf("Source hops: Invalid interface type.\n");
 
     }
 
-    void src_hops_open_interface_pulseaudio(src_hops_obj * obj) {
-
-        pa_sample_format_t format;
-
-        switch (obj->format->type) {
-            
-            case format_binary_int08:
-
-                format = PA_SAMPLE_U8;
-
-            break;
-
-            case format_binary_int16:
-
-                format = PA_SAMPLE_S16LE;
-
-            break;
-
-            case format_binary_int24:
-
-                format = PA_SAMPLE_S24LE;
-
-            break;
-            
-            case format_binary_int32:
-            
-                format = PA_SAMPLE_S32LE;
-            
-            break;
-
-            default:
-
-                printf("Source hops: Invalid format.\n");
-                exit(EXIT_FAILURE);
-
-            break;
-
-        }
-
-        obj->ss.format = format;
-        obj->ss.rate = obj->fS;
-        obj->ss.channels = obj->nChannels;
-
-        obj->map.channels = obj->nChannels;
-        switch(obj->nChannels)
-        {
-            case 1:
-                obj->map.map[0] = PA_CHANNEL_POSITION_MONO;
-                break;
-
-            case 2:
-                obj->map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
-                obj->map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
-                break;
-
-            case 8:
-                obj->map.map[0] = PA_CHANNEL_POSITION_FRONT_LEFT;
-                obj->map.map[1] = PA_CHANNEL_POSITION_FRONT_RIGHT;
-                obj->map.map[2] = PA_CHANNEL_POSITION_REAR_LEFT;
-                obj->map.map[3] = PA_CHANNEL_POSITION_REAR_RIGHT;
-                obj->map.map[4] = PA_CHANNEL_POSITION_FRONT_CENTER;
-                obj->map.map[5] = PA_CHANNEL_POSITION_LFE;
-                obj->map.map[6] = PA_CHANNEL_POSITION_SIDE_LEFT;
-                obj->map.map[7] = PA_CHANNEL_POSITION_SIDE_RIGHT;
-                break;
-
-            case 16:
-                obj->map.map[0]  = PA_CHANNEL_POSITION_FRONT_LEFT;
-                obj->map.map[1]  = PA_CHANNEL_POSITION_FRONT_RIGHT;
-                obj->map.map[2]  = PA_CHANNEL_POSITION_REAR_LEFT;
-                obj->map.map[3]  = PA_CHANNEL_POSITION_REAR_RIGHT;
-                obj->map.map[4]  = PA_CHANNEL_POSITION_FRONT_CENTER;
-                obj->map.map[5]  = PA_CHANNEL_POSITION_LFE;
-                obj->map.map[6]  = PA_CHANNEL_POSITION_SIDE_LEFT;
-                obj->map.map[7]  = PA_CHANNEL_POSITION_SIDE_RIGHT;
-                obj->map.map[8]  = PA_CHANNEL_POSITION_AUX0;
-                obj->map.map[9]  = PA_CHANNEL_POSITION_AUX1;
-                obj->map.map[10] = PA_CHANNEL_POSITION_AUX2;
-                obj->map.map[11] = PA_CHANNEL_POSITION_AUX3;
-                obj->map.map[12] = PA_CHANNEL_POSITION_AUX4;
-                obj->map.map[13] = PA_CHANNEL_POSITION_AUX5;
-                obj->map.map[14] = PA_CHANNEL_POSITION_AUX6;
-                obj->map.map[15] = PA_CHANNEL_POSITION_AUX7;
-                break;
-
-            default:
-
-                printf("Source hops: Invalid format.\n");
-                exit(EXIT_FAILURE);
-
-            break;
-        }
-
-        int err;
-        if (!(obj->pa = pa_simple_new(NULL, "Odas", PA_STREAM_RECORD, obj->interface->deviceName, "record", &obj->ss, &obj->map, NULL, &err))) {
-            printf("Source hops: Cannot open pulseaudio device %s: %s\n", obj->interface->deviceName, pa_strerror(err));
-            exit(EXIT_FAILURE);
-        }
-        
-    }
-
     void src_hops_open_interface_soundcard(src_hops_obj * obj) {
 
         snd_pcm_hw_params_t * hw_params;
 
             break;
 
-            case interface_pulseaudio:
-
-                src_hops_close_interface_pulseaudio(obj);
-
-            break;
-
             default:
 
                 printf("Source hops: Invalid interface type.\n");
 
     }
 
-    void src_hops_close_interface_pulseaudio(src_hops_obj * obj) {
-
-        if (obj->pa != NULL)
-            pa_simple_free(obj->pa);
-
-    }
-
     int src_hops_process(src_hops_obj * obj) {
 
         int rtnValue;
 
             break;
 
-            case interface_pulseaudio:
-
-                rtnValue = src_hops_process_interface_pulseaudio(obj);
-
-            break;
-
             default:
 
                 printf("Source hops: Invalid interface type.\n");
 
     }
 
-    int src_hops_process_interface_pulseaudio(src_hops_obj * obj) {
-
-        int rtnValue;
-        int err;
-
-        if (pa_simple_read(obj->pa, obj->buffer, obj->bufferSize, &err) < 0) {
-            
-            rtnValue = -1;
-
-        }
-        else {
-
-            rtnValue = 0;
-
-        }
-
-        struct timeval currentTime;
-        gettimeofday(&currentTime, NULL);
-        unsigned long long microseconds = currentTime.tv_sec * (int)1e6 + currentTime.tv_usec;
-
-        // remove pulseaudio latency
-        pa_usec_t latency;
-        latency = pa_simple_get_latency(obj->pa, &err);
-        if (latency == (pa_usec_t) -1) {
-            printf("Source hops: Could not get pulseaudio latency: %s\n", pa_strerror(err));
-            rtnValue = -1;
-        }
-
-        unsigned long long timestamp = obj->timeStamp + 1;
-        unsigned long long readTimeStamp = microseconds - latency;
-
-        const int n = snprintf(NULL, 0, "%llu", timestamp);
-        char key[n+1];
-        int c = snprintf(key, n+1, "%llu", timestamp);
-        if (key[n] != '\0' || c != n) {
-            printf("Source hops: Invalid timestamp \n");
-            rtnValue = -1;
-        }
-
-        if (obj->timeStampMap != NULL) {
-            map_set(obj->timeStampMap, key, readTimeStamp);
-        }
-
-        return rtnValue;
-
-    }
-
     void src_hops_process_format_binary_int08(src_hops_obj * obj) {
 
         unsigned int iSample;
 
     }
 
-    void src_hops_set_timestamp_map(src_hops_obj * obj, map_ull_t * timestamp_map)
-    {
-        obj->timeStampMap = timestamp_map;
-    }
-
     src_hops_cfg * src_hops_cfg_construct(void) {
 
         src_hops_cfg * cfg;