JackPort Class Reference

#include <JackPort.h>

Inheritance diagram for JackPort:

Inheritance graph
[legend]

List of all members.

Public Member Functions

bool ConnectTo (const string &destport)
void DisconnectFrom (const string &destport)
 JackPort (const string &name, bool writer, const char *type)
 ~JackPort ()

Protected Member Functions

jack_port_t * GetPort () const

Private Attributes

jack_port_t * m_port
bool m_writer


Detailed Description

Definition at line 12 of file JackPort.h.


Constructor & Destructor Documentation

JackPort::JackPort ( const string &  name,
bool  writer,
const char *  type 
)

Definition at line 8 of file JackPort.cpp.

References JackClient::GetSingleton(), m_port, and m_writer.

00008                                                                     : m_writer(writer)
00009 {
00010     m_port = jack_port_register(JackClient::GetSingleton()->GetClient(), name.c_str(), 
00011             type, (m_writer ? JackPortIsOutput : JackPortIsInput) | JackPortIsTerminal, 0);
00012 }

JackPort::~JackPort (  ) 

Definition at line 14 of file JackPort.cpp.

References JackClient::GetSingleton(), and m_port.

00015 {
00016     try {
00017         jack_port_unregister(JackClient::GetSingleton()->GetClient(), m_port);
00018     }
00019     catch(...) {} //Ignore.
00020 }


Member Function Documentation

bool JackPort::ConnectTo ( const string &  destport  ) 

Definition at line 22 of file JackPort.cpp.

References GetPort(), JackClient::GetSingleton(), and m_writer.

Referenced by BOOST_PYTHON_MODULE().

00023 {
00024     const char* in = m_writer ? destport.c_str() : jack_port_name(GetPort());
00025     const char* out = m_writer ? jack_port_name(GetPort()) : destport.c_str();
00026 
00027     int result = jack_connect(JackClient::GetSingleton()->GetClient(), out, in);
00028     
00029     if (result == 0) {
00030         return true;
00031     }
00032     else if (result == EEXIST) {
00033         return false;
00034     }
00035     else {
00036         throw runtime_error("Could not connect to port `" + destport + "'.");
00037     }
00038 }

void JackPort::DisconnectFrom ( const string &  destport  ) 

Definition at line 40 of file JackPort.cpp.

References GetPort(), and JackClient::GetSingleton().

00041 {
00042     int result = jack_disconnect(JackClient::GetSingleton()->GetClient(),
00043         jack_port_name(GetPort()), destport.c_str());
00044     
00045     if (result != 0) {
00046         throw runtime_error("Could not disconnect from port `" + destport + "'.");
00047     }
00048 }

jack_port_t* JackPort::GetPort (  )  const [inline, protected]

Definition at line 27 of file JackPort.h.

References m_port.

Referenced by ConnectTo(), DisconnectFrom(), JackAudioPort::GetFrame(), JackAudioPort::PutFrame(), and JackMidiPort::Read().

00027 { return m_port; }


Member Data Documentation

jack_port_t* JackPort::m_port [private]

Definition at line 30 of file JackPort.h.

Referenced by GetPort(), JackPort(), and ~JackPort().

bool JackPort::m_writer [private]

Definition at line 31 of file JackPort.h.

Referenced by ConnectTo(), and JackPort().


The documentation for this class was generated from the following files:

Get JackFX at SourceForge.net. Fast, secure and Free Open Source software downloads
Generated for JackFX by  doxygen