CLAM-Development  1.4.0
Classes | Public Member Functions | Protected Types | Protected Member Functions
CLAM::NetworkPlayer Class Reference

A NetworkPlayer is an object that controls the playback of a Network providing a high level transport like interface. More...

#include <NetworkPlayer.hxx>

List of all members.

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

NetworkGetNetwork ()
unsigned GetNSinks () const
unsigned GetNSources () const
void CacheSourcesAndSinks ()
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 SetSinkFrameSize (unsigned sink, unsigned frameSize)
void SetSourceFrameSize (unsigned source, unsigned frameSize)

Detailed Description

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.


Member Enumeration Documentation

Enumerator:
Playing 
Stopped 
Paused 

Definition at line 43 of file NetworkPlayer.hxx.


Constructor & Destructor Documentation

CLAM::NetworkPlayer::NetworkPlayer ( )
inline

Definition at line 46 of file NetworkPlayer.hxx.

virtual CLAM::NetworkPlayer::~NetworkPlayer ( )
inlinevirtual

Definition at line 52 of file NetworkPlayer.hxx.


Member Function Documentation

virtual unsigned CLAM::NetworkPlayer::BackendBufferSize ( )
inlinevirtual

Reimplemented in CLAM::JACKNetworkPlayer.

Definition at line 90 of file NetworkPlayer.hxx.

Referenced by CLAM::Network::BackendBufferSize().

virtual unsigned CLAM::NetworkPlayer::BackendSampleRate ( )
inlinevirtual

Reimplemented in CLAM::JACKNetworkPlayer.

Definition at line 95 of file NetworkPlayer.hxx.

Referenced by CLAM::Network::BackendSampleRate().

void CLAM::NetworkPlayer::BePaused ( )
inline

Definition at line 82 of file NetworkPlayer.hxx.

References Paused.

Referenced by Pause().

void CLAM::NetworkPlayer::BePlaying ( )
inline
void CLAM::NetworkPlayer::BeStopped ( )
inline
void CLAM::NetworkPlayer::CacheSourcesAndSinks ( )
inlineprotected
Network& CLAM::NetworkPlayer::GetNetwork ( )
inlineprotected
unsigned CLAM::NetworkPlayer::GetNSinks ( ) const
inlineprotected
unsigned CLAM::NetworkPlayer::GetNSources ( ) const
inlineprotected
virtual void CLAM::NetworkPlayer::Init ( )
inlinevirtual

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.

Referenced by CLAM::Network::SetPlayer().

bool CLAM::NetworkPlayer::IsPaused ( ) const
inline
bool CLAM::NetworkPlayer::IsPlaying ( ) const
inline
virtual bool CLAM::NetworkPlayer::IsRealTime ( ) const
pure virtual
bool CLAM::NetworkPlayer::IsStopped ( ) const
inline
virtual bool CLAM::NetworkPlayer::IsWorking ( )
pure virtual

Should return true when the backend is able to run the network.

Implemented in CLAM::JACKNetworkPlayer, CLAM::PANetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::MonoOfflineNetworkPlayer.

virtual std::string CLAM::NetworkPlayer::NonWorkingReason ( )
pure virtual

Whenever the backend is not working, this method returns the reason.

Implemented in CLAM::JACKNetworkPlayer, CLAM::PANetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::MonoOfflineNetworkPlayer.

virtual void CLAM::NetworkPlayer::Pause ( )
inlinevirtual

Definition at line 75 of file NetworkPlayer.hxx.

References BePaused(), and IsPlaying().

Referenced by CLAM::Network::Pause().

void CLAM::NetworkPlayer::SetNetworkBackLink ( Network net)
inline

Definition at line 77 of file NetworkPlayer.hxx.

Referenced by CLAM::Network::SetPlayer().

void CLAM::NetworkPlayer::SetSinkBuffer ( unsigned  sink,
float *  data,
unsigned  nframes 
)
protected
void CLAM::NetworkPlayer::SetSinkFrameSize ( unsigned  sink,
unsigned  frameSize 
)
protected

Definition at line 56 of file NetworkPlayer.cxx.

Referenced by CLAM::JACKNetworkPlayer::RegisterOutputPorts().

void CLAM::NetworkPlayer::SetSourceBuffer ( unsigned  source,
const float *  data,
unsigned  nframes 
)
protected
void CLAM::NetworkPlayer::SetSourceFrameSize ( unsigned  source,
unsigned  frameSize 
)
protected

Definition at line 63 of file NetworkPlayer.cxx.

Referenced by CLAM::JACKNetworkPlayer::RegisterInputPorts().

const std::string& CLAM::NetworkPlayer::SinkName ( unsigned  sink) const
inlineprotected
const std::string& CLAM::NetworkPlayer::SourceName ( unsigned  source) const
inlineprotected
std::string CLAM::NetworkPlayer::SourcesAndSinksToString ( )

Definition at line 31 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::PANetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::MonoOfflineNetworkPlayer.

Referenced by CLAM::Network::Start().

virtual void CLAM::NetworkPlayer::Stop ( )
pure virtual

Redefine it to deactivate the backend.

Implemented in CLAM::JACKNetworkPlayer, CLAM::PANetworkPlayer, CLAM::OfflineNetworkPlayer, and CLAM::MonoOfflineNetworkPlayer.

Referenced by CLAM::Network::Stop().


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