CLAM-Development  1.4.0
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
CLAM::SegmentTransformation Class Reference

#include <SegmentTransformation.hxx>

List of all members.

Public Member Functions

void AttachIn (Segment &data)
void AttachOut (Segment &data)
void WrapFrameTransformation (FrameTransformation *)
virtual bool ConcreteConfigure (const ProcessingConfig &c)
 Configuration change method.
const ProcessingConfigGetConfig () const
 Configuration getter.
 SegmentTransformation ()
 Base constructor of class.
 SegmentTransformation (const SegmentTransformationConfig &c)
 Constructor with an object of SegmentTransformationConfig class by parameter.
virtual ~SegmentTransformation ()
virtual bool DoWithSegments (void)
 Supervised Do() function.
virtual bool UpdateControlValueFromBPF (TData pos)
 Method to update the Amount control from an existing BPF configured in the configuration phase.
virtual bool IsLastFrame ()
 Returns true if there are no more frames to read from input.
bool ConcreteStart ()
 Overriding default method to initialize input frame counter.
- Public Member Functions inherited from CLAM::Processing
bool Configure (const ProcessingConfig &config)
 Configuration change method.
void Start (void)
 Method to turn the object into running state.
void Stop (void)
 Method to put the object out of running state When in execution mode, this method must be called before any further call to Configure() methods.
 Processing ()
virtual ~Processing ()
virtual bool CanProcessInplace ()
 Override this method if your processing cannot process inplace.
bool CanConsumeAndProduce ()
 Check that Supervised Do() can be safely called.
void ConsumeAndProduce ()
 Acknoledges data tokens in published ports as read/writen by calling Produce() for all registered OutPorts and Consume() to all registered InPorts.
std::string GetExecStateString () const
bool IsConfigured () const
bool IsRunning () const
void RegisterOutPort (OutPortBase *out)
void RegisterInPort (InPortBase *in)
void RegisterOutControl (OutControlBase *out)
void RegisterInControl (InControlBase *in)
void SetParent (Processing *p)
void SetNetworkBackLink (Network *network)
virtual bool ModifiesPortsAndControlsAtConfiguration ()
 This method is used to determine if a given processing can change its interface of ports/controls after its construction (i.e.
bool HasInPort (const std::string &name)
bool HasOutPort (const std::string &name)
bool HasInControl (const std::string &name)
bool HasOutControl (const std::string &name)
InPortBaseGetInPort (const std::string &name)
OutPortBaseGetOutPort (const std::string &name)
InControlBaseGetInControl (const std::string &name)
OutControlBaseGetOutControl (const std::string &name)
InPortBaseGetInPort (unsigned index)
OutPortBaseGetOutPort (unsigned index)
InControlBaseGetInControl (unsigned index)
OutControlBaseGetOutControl (unsigned index)
unsigned GetNInPorts () const
unsigned GetNOutPorts () const
unsigned GetNInControls () const
unsigned GetNOutControls () const
const std::string & GetConfigErrorMessage () const
 Returns a string describing configuration errors if any.
virtual bool IsSyncSource () const
 Wether the processing is a sync source such as audio i/o device, or an audio callback hook (i.e.
virtual bool SupportsVariableAudioSize () const
 This method reports whether the processing supports dynamic buffer-size host.

Public Attributes

InControlPublisher mAmountCtrl
 Control for the amount of the concrete transformation that will be applied.

Protected Member Functions

virtual bool Do (const Frame &in, Frame &out)
bool Do ()
 Supervised mode execution method (using ports)
const char * GetClassName () const
 Override it in every subclass and retur the name of that class.
void AddFramesToOutputIfInputIsLonger (int frameindex, const Segment &in, Segment &out)
virtual bool Do (const Segment &in, Segment &out)
 Unsupervised Do function, receives a Segment as input and output.
virtual const FrameGetCurrentFrame (const Segment &in)
 formerly corresponded to UnwrappedProcessingData
virtual FrameGetCurrentFrame (Segment &out)
 formerly corresponded to UnwrappedProcessingData
- Protected Member Functions inherited from CLAM::Processing
virtual bool ConcreteStop ()
 Processing objects have to redefine this method when stoping them implies some internal changes.
unsigned BackendBufferSize ()
 Given by the NetworkPlayer (backend) if exists.
unsigned BackendSampleRate ()
 Given by the NetworkPlayer (backend) if exists.
InControlRegistryGetInControls ()
 Accessor to published Controls manager.
OutControlRegistryGetOutControls ()
 Accessor to published Controls manager.
InPortRegistryGetInPorts ()
 Accessor to published Ports manager.
OutPortRegistryGetOutPorts ()
 Accessor to published Portss manager.
bool AddConfigErrorMessage (const std::string &msg)
 Use this method to append a configuration errors to the processing when implementing ConcreteConfigure.
bool AbleToExecute (void) const
 In debug-mode checks that the processing is configured and started.
template<typename ConcreteConfig >
void CopyAsConcreteConfig (ConcreteConfig &concrete, const ProcessingConfig &abstract) const
 Helper template to convert a reference to a ProcessingConfig to the concrete ProcessingConfig specified on the first parameter.
void SetExecState (ExecState state)

Protected Attributes

SegmentTransformationConfig mConfig
 Internally stored configuration.
bool mUseTemporalBPF
 Boolean member that indicates whether BPF or single value is to be used.
FloatInControl mOnCtrl
 Control to state whether a particular transformation is on or off.
SegmentmInput
SegmentmOutput
int mCurrentInputFrame
- Protected Attributes inherited from CLAM::Processing
ProcessingCompositempParent
 Pointer to the parent (composite) processing object, or 0.
Network_network
 The parent network if any.

Additional Inherited Members

- Public Types inherited from CLAM::Processing
enum  ExecState { Unconfigured = 0, Ready, Running }
 Processing Object possible execution states. More...
typedef NullProcessingConfig Config

Detailed Description

Definition at line 42 of file SegmentTransformation.hxx.


Constructor & Destructor Documentation

CLAM::SegmentTransformation::SegmentTransformation ( )

Base constructor of class.

Calls Configure method with a SegmentTransformationConfig initialised by default

Definition at line 32 of file SegmentTransformation.cxx.

References mCurrentInputFrame, mInput, mOutput, and mUseTemporalBPF.

CLAM::SegmentTransformation::SegmentTransformation ( const SegmentTransformationConfig c)

Constructor with an object of SegmentTransformationConfig class by parameter.

Parameters:
cSegmentTransformationConfig object created by the user

Definition at line 43 of file SegmentTransformation.cxx.

References CLAM::Processing::Configure(), mCurrentInputFrame, mInput, mOutput, and mUseTemporalBPF.

CLAM::SegmentTransformation::~SegmentTransformation ( )
virtual

Definition at line 55 of file SegmentTransformation.cxx.


Member Function Documentation

void CLAM::SegmentTransformation::AddFramesToOutputIfInputIsLonger ( int  frameindex,
const Segment in,
Segment out 
)
inlineprotected
void CLAM::SegmentTransformation::AttachIn ( Segment data)
inline

Definition at line 73 of file SegmentTransformation.hxx.

References mInput.

Referenced by CLAM::SMSTransformationChain::ConcreteStart().

void CLAM::SegmentTransformation::AttachOut ( Segment data)
inline

Definition at line 74 of file SegmentTransformation.hxx.

References mOutput.

Referenced by CLAM::SMSTransformationChain::ConcreteStart().

bool CLAM::SegmentTransformation::ConcreteConfigure ( const ProcessingConfig c)
virtual

Configuration change method.

Note that the Amount Control is initialized from the the values in the configuration. Appart from that the member boolean variable that indicates whether a BPF is used is also initialized and the On/Off control also.

Parameters:
TheProcessingConfig object
Returns:
True if the cast has been commited correctly

Reimplemented from CLAM::Processing.

Reimplemented in CLAM::SegmentSMSMorph, and CLAM::SegmentSMSTimeStretch.

Definition at line 94 of file SegmentTransformation.cxx.

References CLAM::Processing::CopyAsConcreteConfig(), CLAM::InControlPublisher::DoControl(), mAmountCtrl, mConfig, and mUseTemporalBPF.

bool CLAM::SegmentTransformation::ConcreteStart ( void  )
virtual

Overriding default method to initialize input frame counter.

Reimplemented from CLAM::Processing.

Reimplemented in CLAM::SegmentSMSMorph, and CLAM::SegmentSMSTimeStretch.

Definition at line 139 of file SegmentTransformation.cxx.

virtual bool CLAM::SegmentTransformation::Do ( const Frame in,
Frame out 
)
inlineprotectedvirtual
bool CLAM::SegmentTransformation::Do ( )
inlineprotectedvirtual

Supervised mode execution method (using ports)

Returns:
A boolean telling whether it has been output

Implements CLAM::Processing.

Reimplemented in CLAM::SegmentSMSMorph, CLAM::SMSTransformationChainIO, and CLAM::SegmentSMSTimeStretch.

Definition at line 124 of file SegmentTransformation.hxx.

Referenced by Do(), and DoWithSegments().

bool CLAM::SegmentTransformation::Do ( const Segment in,
Segment out 
)
protectedvirtual

Unsupervised Do function, receives a Segment as input and output.

This overload is the one called from the supervised Do(). Note that if BPF parameter is used, the Amount control is also updated.

Parameters:
inputthe Segment that is input to the transformation
outthe Segment that is output from the transformation.
Returns:
Boolean value, whether the process has finished successfully or not.

Reimplemented in CLAM::SegmentSMSMorph, and CLAM::SegmentSMSTimeStretch.

Definition at line 61 of file SegmentTransformation.cxx.

References AddFramesToOutputIfInputIsLonger(), CLAM_ASSERT, CLAM::FrameTransformation::Do(), Do(), CLAM::Segment::GetFrame(), CLAM::Segment::GetnFrames(), CLAM::Segment::mCurrentFrameIndex, mCurrentInputFrame, mInput, mUseTemporalBPF, and UpdateControlValueFromBPF().

virtual bool CLAM::SegmentTransformation::DoWithSegments ( void  )
inlinevirtual

Supervised Do() function.

It calls the non-supervised Do that receives Segment as input and output.

Definition at line 104 of file SegmentTransformation.hxx.

References Do(), mInput, and mOutput.

Referenced by CLAM::SMSTransformationChain::DoChildren().

const char* CLAM::SegmentTransformation::GetClassName ( ) const
inlineprotectedvirtual

Override it in every subclass and retur the name of that class.

Implements CLAM::Processing.

Reimplemented in CLAM::SegmentSMSMorph, and CLAM::SegmentSMSTimeStretch.

Definition at line 125 of file SegmentTransformation.hxx.

const ProcessingConfig& CLAM::SegmentTransformation::GetConfig ( ) const
inlinevirtual

Configuration getter.

Gets the configuration parameters used to create the object.

Returns:
Const reference to the configuration object. The usual way to perform a configuration change in the processing object is to take a copy of this reference, to change it and to send it with the Configure method. If not overriden, it returns a NullProcessingConfig.

Reimplemented from CLAM::Processing.

Reimplemented in CLAM::SegmentSMSMorph.

Definition at line 86 of file SegmentTransformation.hxx.

References mConfig.

virtual const Frame& CLAM::SegmentTransformation::GetCurrentFrame ( const Segment in)
inlineprotectedvirtual

formerly corresponded to UnwrappedProcessingData

Reimplemented in CLAM::SegmentSMSTimeStretch.

Definition at line 145 of file SegmentTransformation.hxx.

References CLAM::Segment::GetFrame(), and mCurrentInputFrame.

virtual Frame& CLAM::SegmentTransformation::GetCurrentFrame ( Segment out)
inlineprotectedvirtual

formerly corresponded to UnwrappedProcessingData

Reimplemented in CLAM::SegmentSMSTimeStretch.

Definition at line 151 of file SegmentTransformation.hxx.

References CLAM::Segment::AddFrame(), CLAM::Segment::GetFrame(), CLAM::Segment::GetnFrames(), mCurrentInputFrame, and mInput.

bool CLAM::SegmentTransformation::IsLastFrame ( )
virtual

Returns true if there are no more frames to read from input.

Reimplemented in CLAM::SegmentSMSTimeStretch.

Definition at line 125 of file SegmentTransformation.cxx.

References CLAM::Segment::DeleteFrame(), CLAM::Segment::GetnFrames(), CLAM::Segment::mCurrentFrameIndex, mInput, and mOutput.

bool CLAM::SegmentTransformation::UpdateControlValueFromBPF ( TData  pos)
virtual

Method to update the Amount control from an existing BPF configured in the configuration phase.

Reimplemented in CLAM::SegmentSMSMorph.

Definition at line 114 of file SegmentTransformation.cxx.

References CLAM::InControlPublisher::DoControl(), mAmountCtrl, and mConfig.

Referenced by CLAM::SegmentSMSTimeStretch::Do(), and Do().

void CLAM::SegmentTransformation::WrapFrameTransformation ( FrameTransformation trans)

Definition at line 26 of file SegmentTransformation.cxx.

References CLAM_ASSERT.


Member Data Documentation

InControlPublisher CLAM::SegmentTransformation::mAmountCtrl

Control for the amount of the concrete transformation that will be applied.

This control value can be manually updated or automatically from the values in the BPF envelope-like configuration parameter.

Definition at line 69 of file SegmentTransformation.hxx.

Referenced by ConcreteConfigure(), and UpdateControlValueFromBPF().

SegmentTransformationConfig CLAM::SegmentTransformation::mConfig
protected

Internally stored configuration.

Reimplemented in CLAM::SegmentSMSMorph.

Definition at line 50 of file SegmentTransformation.hxx.

Referenced by ConcreteConfigure(), GetConfig(), and UpdateControlValueFromBPF().

int CLAM::SegmentTransformation::mCurrentInputFrame
protected
Segment* CLAM::SegmentTransformation::mInput
protected
FloatInControl CLAM::SegmentTransformation::mOnCtrl
protected

Control to state whether a particular transformation is on or off.

This control may be used as a bypass when the transformation is connected in a Chain.

Definition at line 60 of file SegmentTransformation.hxx.

Segment* CLAM::SegmentTransformation::mOutput
protected
bool CLAM::SegmentTransformation::mUseTemporalBPF
protected

Boolean member that indicates whether BPF or single value is to be used.

This is not a control because it is not supposed to change un run-time. It is rather a configuration parameter that can be automatically extracted from mConfig but it is placed here to make it more explicit.

Definition at line 56 of file SegmentTransformation.hxx.

Referenced by CLAM::SegmentSMSTimeStretch::ConcreteConfigure(), ConcreteConfigure(), Do(), CLAM::SegmentSMSMorph::SegmentSMSMorph(), and SegmentTransformation().


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