Skip to content

Commit

Permalink
Added audio source, sink and splitter
Browse files Browse the repository at this point in the history
  • Loading branch information
sh123 committed Dec 11, 2014
1 parent eb894a1 commit e223a9d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 12 deletions.
44 changes: 34 additions & 10 deletions src/svxlink/modules/frn/ModuleFrn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
****************************************************************************/
#include <AsyncConfig.h>

#include <AsyncAudioSplitter.h>
#include <AsyncAudioValve.h>
#include <AsyncAudioSelector.h>


/****************************************************************************
Expand All @@ -65,7 +67,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
****************************************************************************/

using namespace std;

using namespace Async;


/****************************************************************************
Expand Down Expand Up @@ -134,6 +136,9 @@ extern "C" {

ModuleFrn::ModuleFrn(void *dl_handle, Logic *logic, const string& cfg_name)
: Module(dl_handle, logic, cfg_name)
, audio_from_rig(0)
, audio_to_frn(0)
, audio_from_frn(0)
{
cout << "\tModule Frn v" MODULE_FRN_VERSION " starting...\n";

Expand All @@ -142,13 +147,10 @@ ModuleFrn::ModuleFrn(void *dl_handle, Logic *logic, const string& cfg_name)

ModuleFrn::~ModuleFrn(void)
{

moduleCleanup();
} /* ~ModuleFrn */





/****************************************************************************
*
* Protected member functions
Expand Down Expand Up @@ -268,11 +270,33 @@ bool ModuleFrn::initialize(void)
return false;
}

audio_from_rig = new AudioValve;
AudioSink::setHandler(audio_from_rig);

audio_to_frn = new AudioSplitter;
audio_from_rig->registerSink(audio_to_frn);

audio_from_frn = new AudioSelector;
AudioSource::setHandler(audio_from_frn);

return true;

} /* initialize */


void ModuleFrn::moduleCleanup()
{
AudioSink::clearHandler();
delete audio_from_frn;
audio_from_frn = 0;
delete audio_from_rig;
audio_from_rig = 0;

AudioSource::clearHandler();
delete audio_from_frn;
audio_from_frn = 0;
}

/*
*----------------------------------------------------------------------------
* Method: activateInit
Expand All @@ -287,8 +311,8 @@ bool ModuleFrn::initialize(void)
*/
void ModuleFrn::activateInit(void)
{

} /* activateInit */
audio_from_rig->setOpen(true);
}


/*
Expand All @@ -306,8 +330,8 @@ void ModuleFrn::activateInit(void)
*/
void ModuleFrn::deactivateCleanup(void)
{

} /* deactivateCleanup */
audio_from_rig->setOpen(true);
}


/*
Expand Down
14 changes: 12 additions & 2 deletions src/svxlink/modules/frn/ModuleFrn.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Forward declarations
*
****************************************************************************/

namespace Async
{
class AudioSplitter;
class AudioValve;
class AudioSelector;
};


/****************************************************************************
Expand Down Expand Up @@ -120,6 +125,7 @@ class ModuleFrn : public Module
const char *compiledForVersion(void) const { return SVXLINK_VERSION; }

private:
void moduleCleanup();
bool initialize(void);
void activateInit(void);
void deactivateCleanup(void);
Expand All @@ -130,7 +136,7 @@ class ModuleFrn : public Module
void allMsgsWritten(void);
void reportState(void);

private:
private:
std::string opt_server;
std::string opt_version;
std::string opt_email_address;
Expand All @@ -143,6 +149,10 @@ class ModuleFrn : public Module
std::string opt_city_city_part;
std::string opt_net;

Async::AudioValve *audio_from_rig;
Async::AudioSplitter *audio_to_frn;
Async::AudioSelector *audio_from_frn;

}; /* class ModuleFrn */


Expand Down

0 comments on commit e223a9d

Please sign in to comment.