+++ /dev/null
-
- #include "amod_gain.h"
-
- amod_gain_obj * amod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config) {
-
- amod_gain_obj * obj;
-
- obj = (amod_gain_obj *) malloc(sizeof(amod_gain_obj));
-
- obj->mod_gain = mod_gain_construct(mod_gain_config, msg_hops_config);
- obj->in = (amsg_hops_obj *) NULL;
- obj->out = (amsg_hops_obj *) NULL;
-
- obj->thread = thread_construct(&amod_gain_thread, (void *) obj);
-
- return obj;
-
- }
-
- void amod_gain_destroy(amod_gain_obj * obj) {
-
- mod_gain_destroy(obj->mod_gain);
- thread_destroy(obj->thread);
-
- free((void *) obj);
-
- }
-
- void amod_gain_connect(amod_gain_obj * obj, amsg_hops_obj * in, amsg_hops_obj * out) {
-
- obj->in = in;
- obj->out = out;
-
- }
-
- void amod_gain_disconnect(amod_gain_obj * obj) {
-
- obj->in = (amsg_hops_obj *) NULL;
- obj->out = (amsg_hops_obj *) NULL;
-
- }
-
- void * amod_gain_thread(void * ptr) {
-
- amod_gain_obj * obj;
- msg_hops_obj * msg_hops_in;
- msg_hops_obj * msg_hops_out;
- int rtnValue;
-
- obj = (amod_gain_obj *) ptr;
-
- while(1) {
-
- // Pop a message, process, and push back
- msg_hops_in = amsg_hops_filled_pop(obj->in);
- msg_hops_out = amsg_hops_empty_pop(obj->out);
- mod_gain_connect(obj->mod_gain, msg_hops_in, msg_hops_out);
- rtnValue = mod_gain_process(obj->mod_gain);
- mod_gain_disconnect(obj->mod_gain);
- amsg_hops_empty_push(obj->in, msg_hops_in);
- amsg_hops_filled_push(obj->out, msg_hops_out);
-
- // If this is the last frame, rtnValue = -1
- if (rtnValue == -1) {
- break;
- }
-
- }
-
- }
\ No newline at end of file
+++ /dev/null
-#ifndef __ODAS_AMODULE_GAIN
-#define __ODAS_AMODULE_GAIN
-
- #include "../module/mod_gain.h"
- #include "../amessage/amsg_hops.h"
- #include "../general/thread.h"
-
- typedef struct amod_gain_obj {
-
- mod_gain_obj * mod_gain;
- amsg_hops_obj * in;
- amsg_hops_obj * out;
- thread_obj * thread;
-
- } amod_gain_obj;
-
- amod_gain_obj * amod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config);
-
- void amod_gain_destroy(amod_gain_obj * obj);
-
- void amod_gain_connect(amod_gain_obj * obj, amsg_hops_obj * in, amsg_hops_obj * out);
-
- void amod_gain_disconnect(amod_gain_obj * obj);
-
- void * amod_gain_thread(void * ptr);
-
-#endif
\ No newline at end of file
+++ /dev/null
-
- #include "mod_gain.h"
-
- mod_gain_obj * mod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config) {
-
- mod_gain_obj * obj;
-
- obj = (mod_gain_obj *) malloc(sizeof(mod_gain_obj));
-
- obj->hop2hop_gain = hop2hop_gain_construct_zero(msg_hops_config->hopSize, mod_gain_config->gain);
-
- obj->in = (msg_hops_obj *) NULL;
- obj->out = (msg_hops_obj *) NULL;
-
- return obj;
-
- }
-
- void mod_gain_destroy(mod_gain_obj * obj) {
-
- hop2hop_gain_destroy(obj->hop2hop_gain);
- free((void *) obj);
-
- }
-
- int mod_gain_process(mod_gain_obj * obj) {
-
- int rtnValue;
-
- if (msg_hops_isZero(obj->in) == 0) {
-
- hop2hop_gain_process(obj->hop2hop_gain, obj->in->hops, obj->out->hops);
-
- obj->out->timeStamp = obj->in->timeStamp;
-
- rtnValue = 0;
-
- }
- else {
-
- msg_hops_zero(obj->out);
-
- rtnValue = -1;
-
- }
-
- return rtnValue;
-
- }
-
- void mod_gain_connect(mod_gain_obj * obj, msg_hops_obj * in, msg_hops_obj * out) {
-
- obj->in = in;
- obj->out = out;
-
- }
-
- void mod_gain_disconnect(mod_gain_obj * obj) {
-
- obj->in = (msg_hops_obj *) NULL;
- obj->out = (msg_hops_obj *) NULL;
-
- }
-
- mod_gain_cfg * mod_gain_cfg_construct(void) {
-
- mod_gain_cfg * cfg;
-
- cfg = (mod_gain_cfg *) malloc(sizeof(mod_gain_cfg));
-
- cfg->gain = 0.0f;
-
- return cfg;
-
- }
-
- void mod_gain_cfg_destroy(mod_gain_cfg * cfg) {
-
- free((void *) cfg);
-
- }
-
- void mod_gain_cfg_printf(const mod_gain_cfg * cfg) {
-
- }
\ No newline at end of file
+++ /dev/null
-#ifndef __ODAS_MODULE_GAIN
-#define __ODAS_MODULE_GAIN
-
- #include "../system/hop2hop.h"
- #include "../message/msg_hops.h"
-
- typedef struct mod_gain_obj {
-
- hop2hop_gain_obj * hop2hop_gain;
-
- msg_hops_obj * in;
- msg_hops_obj * out;
-
- } mod_gain_obj;
-
- typedef struct mod_gain_cfg {
-
- float gain;
-
- } mod_gain_cfg;
-
- mod_gain_obj * mod_gain_construct(const mod_gain_cfg * mod_gain_config, const msg_hops_cfg * msg_hops_config);
-
- void mod_gain_destroy(mod_gain_obj * obj);
-
- int mod_gain_process(mod_gain_obj * obj);
-
- void mod_gain_connect(mod_gain_obj * obj, msg_hops_obj * in, msg_hops_obj * out);
-
- void mod_gain_disconnect(mod_gain_obj * obj);
-
- mod_gain_cfg * mod_gain_cfg_construct(void);
-
- void mod_gain_cfg_destroy(mod_gain_cfg * cfg);
-
- void mod_gain_cfg_printf(const mod_gain_cfg * cfg);
-
-#endif
\ No newline at end of file