A NetworkPlayer is an object that controls the playback of a Network providing a high level transport like interface. More...
#include <NetworkPlayer.hxx>
Classes | |
struct | ExportedPort |
Public Member Functions | |
NetworkPlayer () | |
virtual | ~NetworkPlayer () |
virtual bool | IsWorking ()=0 |
Should return true when the backend is able to run the network. | |
virtual std::string | NonWorkingReason ()=0 |
Whenever the backend is not working, this method returns the reason. | |
virtual void | Init () |
Redefine to add any initialization after being attached to a network TODO: Consider removing it as just Jack backend uses it but it is redundant. | |
virtual void | Start ()=0 |
Redefine to make the backend ready to process and start the network. If IsPlaying() should do nothing. If it IsPaused() you should consider just call BePlaying() without starting the processings. | |
virtual void | Stop ()=0 |
Redefine it to deactivate the backend. | |
virtual void | Pause () |
void | SetNetworkBackLink (Network &net) |
void | BePaused () |
void | BeStopped () |
void | BePlaying () |
bool | IsPaused () const |
bool | IsStopped () const |
bool | IsPlaying () const |
virtual bool | IsRealTime () const =0 |
virtual unsigned | BackendBufferSize () |
virtual unsigned | BackendSampleRate () |
std::string | SourcesAndSinksToString () |
Protected Types | |
enum | Status { Playing = 0, Stopped = 1, Paused = 2 } |
Protected Member Functions | |
Network & | GetNetwork () |
unsigned | GetNControlSinks () const |
unsigned | GetNControlSources () const |
unsigned | GetNSinks () const |
unsigned | GetNSources () const |
void | CacheSourcesAndSinks () |
const std::string & | ControlSourceName (unsigned source) const |
const std::string & | ControlSinkName (unsigned sink) const |
const std::string & | SourceName (unsigned source) const |
const std::string & | SinkName (unsigned sink) const |
void | SetSourceBuffer (unsigned source, const float *data, unsigned nframes) |
void | SetSinkBuffer (unsigned sink, float *data, unsigned nframes) |
void | ReadControlSource (unsigned source, const float *data) |
void | FeedControlSink (unsigned sink, float *data) |
void | SetSinkFrameSize (unsigned sink, unsigned frameSize) |
void | SetSourceFrameSize (unsigned source, unsigned frameSize) |
Protected Attributes | |
ExportedPorts | _controlSources |
ExportedPorts | _controlSinks |
A NetworkPlayer is an object that controls the playback of a Network providing a high level transport like interface.
This class is an abstract class. Subclasses contextualizes the network inside a given execution context dealing with threading, callback calling and device mapping on concrete architectures such as Alsa, PortAudio, Jack, VST, Ladspa...
Definition at line 40 of file NetworkPlayer.hxx.
enum CLAM::NetworkPlayer::Status [protected] |
Definition at line 43 of file NetworkPlayer.hxx.
CLAM::NetworkPlayer::NetworkPlayer | ( | ) | [inline] |
Definition at line 46 of file NetworkPlayer.hxx.
virtual CLAM::NetworkPlayer::~NetworkPlayer | ( | ) | [inline, virtual] |
Definition at line 52 of file NetworkPlayer.hxx.
virtual unsigned CLAM::NetworkPlayer::BackendBufferSize | ( | ) | [inline, virtual] |
Reimplemented in CLAM::JACKNetworkPlayer.
Definition at line 90 of file NetworkPlayer.hxx.
virtual unsigned CLAM::NetworkPlayer::BackendSampleRate | ( | ) | [inline, virtual] |
Reimplemented in CLAM::JACKNetworkPlayer.
Definition at line 95 of file NetworkPlayer.hxx.
void CLAM::NetworkPlayer::BePaused | ( | ) | [inline] |
void CLAM::NetworkPlayer::BePlaying | ( | ) | [inline] |
Definition at line 84 of file NetworkPlayer.hxx.
References Playing.
void CLAM::NetworkPlayer::BeStopped | ( | ) | [inline] |
Definition at line 83 of file NetworkPlayer.hxx.
References Stopped.
Referenced by CLAM::OfflineNetworkPlayer::ProcessInputFile().
void CLAM::NetworkPlayer::CacheSourcesAndSinks | ( | ) | [inline, protected] |
Definition at line 113 of file NetworkPlayer.hxx.
References _controlSinks, _controlSources, CLAM::Processing::GetInPort(), CLAM::InPortBase::GetName(), CLAM::OutPortBase::GetName(), CLAM::Network::GetNetworkId(), CLAM::Processing::GetNInPorts(), CLAM::Processing::GetNOutPorts(), CLAM::Network::getOrderedControlSinks(), CLAM::Network::getOrderedControlSources(), and CLAM::Processing::GetOutPort().
Referenced by CLAM::OfflineNetworkPlayer::NonWorkingReason(), CLAM::MonoOfflineNetworkPlayer::NonWorkingReason(), and SourcesAndSinksToString().
const std::string& CLAM::NetworkPlayer::ControlSinkName | ( | unsigned | sink | ) | const [inline, protected] |
Definition at line 166 of file NetworkPlayer.hxx.
References _controlSinks.
const std::string& CLAM::NetworkPlayer::ControlSourceName | ( | unsigned | source | ) | const [inline, protected] |
Definition at line 162 of file NetworkPlayer.hxx.
References _controlSources.
void CLAM::NetworkPlayer::FeedControlSink | ( | unsigned | sink, | |
float * | data | |||
) | [protected] |
Definition at line 52 of file NetworkPlayer.cxx.
References _controlSinks, and CLAM::ControlSink::GetControlValue().
unsigned CLAM::NetworkPlayer::GetNControlSinks | ( | ) | const [inline, protected] |
Definition at line 109 of file NetworkPlayer.hxx.
References _controlSinks.
unsigned CLAM::NetworkPlayer::GetNControlSources | ( | ) | const [inline, protected] |
Definition at line 110 of file NetworkPlayer.hxx.
References _controlSources.
Network& CLAM::NetworkPlayer::GetNetwork | ( | ) | [inline, protected] |
Definition at line 103 of file NetworkPlayer.hxx.
References CLAM_ASSERT, and NULL.
Referenced by CLAM::MonoOfflineNetworkPlayer::AddInputFile(), CLAM::OfflineNetworkPlayer::AddOutputFile(), and CLAM::JACKNetworkPlayer::RegisterInputPorts().
unsigned CLAM::NetworkPlayer::GetNSinks | ( | ) | const [inline, protected] |
Definition at line 111 of file NetworkPlayer.hxx.
Referenced by CLAM::OfflineNetworkPlayer::NonWorkingReason(), and CLAM::MonoOfflineNetworkPlayer::NonWorkingReason().
unsigned CLAM::NetworkPlayer::GetNSources | ( | ) | const [inline, protected] |
Definition at line 112 of file NetworkPlayer.hxx.
Referenced by CLAM::OfflineNetworkPlayer::NonWorkingReason(), and CLAM::MonoOfflineNetworkPlayer::NonWorkingReason().
virtual void CLAM::NetworkPlayer::Init | ( | ) | [inline, virtual] |
Redefine to add any initialization after being attached to a network TODO: Consider removing it as just Jack backend uses it but it is redundant.
Reimplemented in CLAM::JACKNetworkPlayer.
Definition at line 64 of file NetworkPlayer.hxx.
bool CLAM::NetworkPlayer::IsPaused | ( | ) | const [inline] |
Definition at line 85 of file NetworkPlayer.hxx.
References Paused.
bool CLAM::NetworkPlayer::IsPlaying | ( | ) | const [inline] |
virtual bool CLAM::NetworkPlayer::IsRealTime | ( | ) | const [pure virtual] |
Implemented in CLAM::JACKNetworkPlayer, CLAM::MonoOfflineNetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::PANetworkPlayer.
bool CLAM::NetworkPlayer::IsStopped | ( | ) | const [inline] |
Definition at line 86 of file NetworkPlayer.hxx.
References Stopped.
Referenced by CLAM::OfflineNetworkPlayer::ProcessInputFile().
virtual bool CLAM::NetworkPlayer::IsWorking | ( | ) | [pure virtual] |
Should return true when the backend is able to run the network.
Implemented in CLAM::JACKNetworkPlayer, CLAM::MonoOfflineNetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::PANetworkPlayer.
virtual std::string CLAM::NetworkPlayer::NonWorkingReason | ( | ) | [pure virtual] |
Whenever the backend is not working, this method returns the reason.
Implemented in CLAM::JACKNetworkPlayer, CLAM::MonoOfflineNetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::PANetworkPlayer.
virtual void CLAM::NetworkPlayer::Pause | ( | ) | [inline, virtual] |
Definition at line 75 of file NetworkPlayer.hxx.
References BePaused(), and IsPlaying().
void CLAM::NetworkPlayer::ReadControlSource | ( | unsigned | source, | |
const float * | data | |||
) | [protected] |
Definition at line 44 of file NetworkPlayer.cxx.
References _controlSources, and CLAM::ControlSource::Do().
void CLAM::NetworkPlayer::SetNetworkBackLink | ( | Network & | net | ) | [inline] |
Definition at line 77 of file NetworkPlayer.hxx.
void CLAM::NetworkPlayer::SetSinkBuffer | ( | unsigned | sink, | |
float * | data, | |||
unsigned | nframes | |||
) | [protected] |
Definition at line 68 of file NetworkPlayer.cxx.
Referenced by CLAM::JACKNetworkPlayer::BlankJackBuffers().
Definition at line 75 of file NetworkPlayer.cxx.
void CLAM::NetworkPlayer::SetSourceBuffer | ( | unsigned | source, | |
const float * | data, | |||
unsigned | nframes | |||
) | [protected] |
Definition at line 61 of file NetworkPlayer.cxx.
Referenced by CLAM::JACKNetworkPlayer::CopySinksToJackBuffers().
Definition at line 82 of file NetworkPlayer.cxx.
const std::string& CLAM::NetworkPlayer::SinkName | ( | unsigned | sink | ) | const [inline, protected] |
Definition at line 174 of file NetworkPlayer.hxx.
Referenced by SourcesAndSinksToString().
const std::string& CLAM::NetworkPlayer::SourceName | ( | unsigned | source | ) | const [inline, protected] |
Definition at line 170 of file NetworkPlayer.hxx.
Referenced by SourcesAndSinksToString().
std::string CLAM::NetworkPlayer::SourcesAndSinksToString | ( | ) |
Definition at line 33 of file NetworkPlayer.cxx.
References CacheSourcesAndSinks(), SinkName(), and SourceName().
virtual void CLAM::NetworkPlayer::Start | ( | ) | [pure virtual] |
Redefine to make the backend ready to process and start the network. If IsPlaying() should do nothing. If it IsPaused() you should consider just call BePlaying() without starting the processings.
Implemented in CLAM::JACKNetworkPlayer, CLAM::MonoOfflineNetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::PANetworkPlayer.
virtual void CLAM::NetworkPlayer::Stop | ( | ) | [pure virtual] |
Redefine it to deactivate the backend.
Implemented in CLAM::JACKNetworkPlayer, CLAM::MonoOfflineNetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::PANetworkPlayer.
Referenced by CLAM::Network::Clear().
ExportedPorts CLAM::NetworkPlayer::_controlSinks [protected] |
Definition at line 232 of file NetworkPlayer.hxx.
Referenced by CacheSourcesAndSinks(), ControlSinkName(), FeedControlSink(), and GetNControlSinks().
ExportedPorts CLAM::NetworkPlayer::_controlSources [protected] |
Definition at line 231 of file NetworkPlayer.hxx.
Referenced by CacheSourcesAndSinks(), ControlSourceName(), GetNControlSources(), and ReadControlSource().