CLAM-Development  1.4.0
Classes | Public Member Functions | Protected Attributes
CLAM::InControl< ControlDataType > Class Template Reference

An InControl receives values of the template type in an asyncronous pace. More...

#include <InControl.hxx>

List of all members.

Classes

class  Callback
class  MethodCallback
 Processing method callback wrapper. Calls a processing method that receives the value as const reference.
class  MethodCallbackByCopy
 Processing method callback wrapper by copy. Calls a processing method that receives the control value by copy. To use with basic (cheap copy) objects (ints, bools, floats...)
class  MethodCallbackByCopyWithId
 Processing method callback wrapper by copy with control id. Calls a processing method that receives the control value by copy. To use with basic (cheap copy) objects (ints, bools, floats...) The id enables reusing the same callback for different controls, but still knowing the originating control.
class  MethodCallbackWithId
 Processing method callback wrapper with control id. Calls a processing method that receives the value as const reference. The id enables reusing the same callback for different controls, but still knowing the originating control.
class  NullCallback
 Null control callback wrapper. Just do nothing.

Public Member Functions

 InControl (const std::string &name="unnamed in control", Processing *proc=0)
 Constructor to use when no callback is used.
template<typename ProcessingType , typename ParameterType >
 InControl (const std::string &name, ProcessingType *proc, void(ProcessingType::*callback)(const ParameterType &))
 Constructor to use a callback by const reference.
template<typename ProcessingType , typename ParameterType >
 InControl (unsigned id, const std::string &name, ProcessingType *proc, void(ProcessingType::*callback)(unsigned, const ParameterType &))
 Constructor to use a callback by const reference plus a port id to distinguish different caller controls in a single serving callback.
template<typename ProcessingType , typename ParameterType >
 InControl (const std::string &name, ProcessingType *proc, void(ProcessingType::*callback)(ParameterType))
 Constructor to use a callback by copy.
template<typename ProcessingType , typename ParameterType >
 InControl (unsigned id, const std::string &name, ProcessingType *proc, void(ProcessingType::*callback)(unsigned, ParameterType))
 Constructor to use a callback by copy plus a port id to distinguish different caller controls in a single serving callback.
virtual ~InControl ()
virtual void DoControl (const ControlDataType &val)
 The control receives a value when this method gets called. Associated callback if any, gets triggered on result. Connected OutControl may trigger it but it also may be called directly, for example to set the initial value.
virtual const ControlDataType & GetLastValue () const
 Returns the last received value.
const std::string GetLastValueAsString ()
 Convenience method to get the string representation of the last value. This just works if the token is storable as XML leaf, if not a "Not printable" string is given.
virtual const std::type_info & GetTypeId () const
 Concrete InControls must overload this method by returning the typeid of the kind of data they communicate.
template<>
const std::string GetLastValueAsString ()
- Public Member Functions inherited from CLAM::InControlBase
bool HasBeenRead () const
 InControlBase (const std::string &name, Processing *processing=0)
 Class constructor.
virtual ~InControlBase ()
 Class destructor.
const std::string & GetName () const
ProcessingGetProcessing () const
bool IsConnected () const
bool IsConnectedTo (OutControlBase &out)
void OutControlInterface_AddLink (OutControlBase &outControl)
 Implementation detail just to be used just from OutControlBase.
void OutControlInterface_RemoveLink (OutControlBase &outControl)
 Implementation detail just to be used just from OutControlBase.
bool IsBounded () const
TControlData UpperBound () const
TControlData LowerBound () const
TControlData DefaultValue () const
 Returns the bounds mean or the value set with SetDefaultValue() if its the case.
void SetDefaultValue (TControlData val)
void SetBounds (TControlData lower, TControlData upper)

Protected Attributes

ControlDataType mLastValue
- Protected Attributes inherited from CLAM::InControlBase
ProcessingmProcessing
Peers mLinks
 Stores the pointers to the connected outcontrols.
TControlData mDefaultValue
TControlData mUpperBound
TControlData mLowerBound
bool mBounded
bool mHasDefaultValue
bool _hasBeenRead

Additional Inherited Members

- Protected Types inherited from CLAM::InControlBase
typedef std::list
< OutControlBase * > 
Peers

Detailed Description

template<class ControlDataType>
class CLAM::InControl< ControlDataType >

An InControl receives values of the template type in an asyncronous pace.

A processing method can be set as callback to respond to incoming events. You can also consult GetLastValue to get the last received value.

Definition at line 46 of file InControl.hxx.


Constructor & Destructor Documentation

template<class ControlDataType>
CLAM::InControl< ControlDataType >::InControl ( const std::string &  name = "unnamed in control",
Processing proc = 0 
)
inline

Constructor to use when no callback is used.

Definition at line 56 of file InControl.hxx.

template<class ControlDataType>
template<typename ProcessingType , typename ParameterType >
CLAM::InControl< ControlDataType >::InControl ( const std::string &  name,
ProcessingType *  proc,
void(ProcessingType::*)(const ParameterType &)  callback 
)
inline

Constructor to use a callback by const reference.

Definition at line 63 of file InControl.hxx.

template<class ControlDataType>
template<typename ProcessingType , typename ParameterType >
CLAM::InControl< ControlDataType >::InControl ( unsigned  id,
const std::string &  name,
ProcessingType *  proc,
void(ProcessingType::*)(unsigned, const ParameterType &)  callback 
)
inline

Constructor to use a callback by const reference plus a port id to distinguish different caller controls in a single serving callback.

Definition at line 70 of file InControl.hxx.

template<class ControlDataType>
template<typename ProcessingType , typename ParameterType >
CLAM::InControl< ControlDataType >::InControl ( const std::string &  name,
ProcessingType *  proc,
void(ProcessingType::*)(ParameterType)  callback 
)
inline

Constructor to use a callback by copy.

Definition at line 77 of file InControl.hxx.

template<class ControlDataType>
template<typename ProcessingType , typename ParameterType >
CLAM::InControl< ControlDataType >::InControl ( unsigned  id,
const std::string &  name,
ProcessingType *  proc,
void(ProcessingType::*)(unsigned, ParameterType)  callback 
)
inline

Constructor to use a callback by copy plus a port id to distinguish different caller controls in a single serving callback.

Definition at line 84 of file InControl.hxx.

template<class ControlDataType>
virtual CLAM::InControl< ControlDataType >::~InControl ( )
inlinevirtual

Definition at line 91 of file InControl.hxx.


Member Function Documentation

template<class ControlDataType>
virtual void CLAM::InControl< ControlDataType >::DoControl ( const ControlDataType &  val)
inlinevirtual

The control receives a value when this method gets called. Associated callback if any, gets triggered on result. Connected OutControl may trigger it but it also may be called directly, for example to set the initial value.

Reimplemented in CLAM::InControlPublisher.

Definition at line 100 of file InControl.hxx.

Referenced by CLAM::SegmentSMSTimeStretch::ConcreteConfigure(), CLAM::CircularShift::ConcreteConfigure(), CLAM::ControlSelector::ConcreteConfigure(), CLAM::SMSResidualGain::ConcreteConfigure(), CLAM::ControlSum::ConcreteConfigure(), CLAM::SMSSinusoidalGain::ConcreteConfigure(), CLAM::ControlScaler::ConcreteConfigure(), CLAM::Robotization::ConcreteConfigure(), CLAM::SMSTranspose::ConcreteConfigure(), CLAM::ControlComparison::ConcreteConfigure(), CLAM::ControlFade::ConcreteConfigure(), CLAM::SMSGenderChange::ConcreteConfigure(), CLAM::OscillatingSpectralNotch::ConcreteConfigure(), CLAM::SpectralDelay::ConcreteConfigure(), CLAM::SMSPitchShift::ConcreteConfigure(), CLAM::ThreeBandFilter::ConcreteConfigure(), CLAM::SegmentSMSHarmonizer::ConcreteConfigure(), CLAM::AudioAmplifier::ConcreteConfigure(), CLAM::AudioBufferAmplifier::ConcreteConfigure(), CLAM::Control2Data::ConcreteConfigure(), CLAM::SimpleOscillator::ConcreteConfigure(), CLAM::SMSHarmonizer::ConcreteConfigure(), CLAM::PhaseManagement::Do(), CLAM::SegmentSMSTimeStretch::Do(), CLAM::FrameInterpolator::Do(), CLAM::SMSPitchShift::Do(), CLAM::SinusoidalSynthesis::Do(), CLAM::SMSSynthesis::Do(), CLAM::InControlPublisher::DoControl(), CLAM::FDCombFilter::FDCombFilter(), CLAM::SegmentSMSMorph::FindInterpolatedFrameFromSegment2Morph(), CLAM::SegmentSMSHarmonizer::IgnoreResidual(), CLAM::SMSHarmonizer::IgnoreResidual(), CLAM::FrameTransformation::InitControls(), CLAM::SpectralReverse::InitControls(), CLAM::SpectralGate::InitControls(), CLAM::SpectralAverage::InitControls(), CLAM::SpectralCombTriang::InitControls(), CLAM::Partializer::InitControls(), CLAM::SpectralCombDelta::InitControls(), CLAM::Peakalizer::InitControls(), CLAM::SpectralExciter::InitControls(), CLAM::SampleAndHold::InitControls(), CLAM::HumRemover::InitControls(), CLAM::SpectralNotch::InitControls(), CLAM::SpectralRingModulation::InitControls(), CLAM::SpectralAmplitudeModulation::InitControls(), CLAM::Deesser::InitControls(), CLAM::SpectralPhaseModulation::InitControls(), CLAM::ThreeBandGate::InitControls(), CLAM::Vocoder::InitControls(), CLAM::ThreeBandAM::InitControls(), CLAM::SpectralSpread::InitControls(), CLAM::SpectralFocus::InitControls(), CLAM::ThreeBandCompressor::InitControls(), CLAM::OutControl< ControlDataType >::SendControl(), CLAM::CircularShift::SetAmount(), CLAM::WindowGenerator::SetSize(), CLAM::SegmentSMSMorph::UpdateControlValueFromBPF(), and CLAM::SegmentSMSMorph::UpdateFrameInterpolatorFactors().

template<class ControlDataType>
virtual const ControlDataType& CLAM::InControl< ControlDataType >::GetLastValue ( ) const
inlinevirtual

Returns the last received value.

Reimplemented in CLAM::InControlPublisher.

Definition at line 108 of file InControl.hxx.

Referenced by CLAM::SimpleOscillator::ApplyFreqAndAmpControls(), CLAM::MonoAudioFileReader::Do(), CLAM::AudioFileMemoryLoader::Do(), CLAM::MIDIKeyboard::Do(), CLAM::SpectralLimiter::Do(), CLAM::FDCombFilter::Do(), CLAM::RandomPhase::Do(), CLAM::SpectralReject::Do(), CLAM::FreqShift::Do(), CLAM::NoSpectralTransformation::Do(), CLAM::SMSFreqShift::Do(), CLAM::SMSOddEvenHarmonicRatio::Do(), CLAM::SegmentSMSMorph::Do(), CLAM::ControlFade::Do(), CLAM::SpectralReverse::Do(), CLAM::SpectralGate::Do(), CLAM::CircularShift::Do(), CLAM::SampleAndHold::Do(), CLAM::SMSDeesser::Do(), CLAM::SMSResidualGain::Do(), CLAM::SMSSinusoidalGain::Do(), CLAM::SpectralAverage::Do(), CLAM::SMSSpectralShapeShift::Do(), CLAM::SMSTranspose::Do(), CLAM::Robotization::Do(), CLAM::SpectralPeakArrayInterpolator::Do(), CLAM::Control2Data::Do(), CLAM::Peakalizer::Do(), CLAM::SpectralCombDelta::Do(), CLAM::SpectralCombTriang::Do(), CLAM::Partializer::Do(), CLAM::SpectralRingModulation::Do(), CLAM::SpectralAmplitudeModulation::Do(), CLAM::SpectralNotch::Do(), CLAM::SpectralPhaseModulation::Do(), CLAM::SpectralExciter::Do(), CLAM::HumRemover::Do(), CLAM::Deesser::Do(), CLAM::Vocoder::Do(), CLAM::AudioAmplifier::Do(), CLAM::AudioBufferAmplifier::Do(), CLAM::FrameInterpolator::Do(), CLAM::ThreeBandGate::Do(), CLAM::SpectralSpread::Do(), CLAM::SinTracking::Do(), CLAM::ThreeBandAM::Do(), CLAM::SpectralShapeShift::Do(), CLAM::SpectralFocus::Do(), CLAM::SMSPitchShift::Do(), CLAM::OscillatingSpectralNotch::Do(), CLAM::ThreeBandCompressor::Do(), CLAM::SpectralDelay::Do(), CLAM::SMSGenderChange::Do(), CLAM::WindowGenerator::Do(), CLAM::ThreeBandFilter::Do(), CLAM::SinusoidalSynthesis::Do(), CLAM::SMSSynthesis::Do(), CLAM::SMSMorph::Do(), CLAM::SMSHarmonizer::Do(), CLAM::SimpleOscillator::Do(), CLAM::FDFilterGen::Do(), CLAM::PhaseManagement::DoPhaseAlignment(), CLAM::PhaseManagement::DoPhaseContinuation(), CLAM::SegmentSMSMorph::FindInterpolatedFrameFromSegment2Morph(), CLAM::MIDI2Melody::GenerateOutputData(), CLAM::ControlSink::GetControlValue(), CLAM::GetFloatFromInControl(), CLAM::InControlPublisher::GetLastValue(), CLAM::TokenDelay< Spectrum >::GivenDelay(), CLAM::ControlSelector::InControlCallback(), CLAM::SegmentSMSHarmonizer::UpdateBPF(), CLAM::SegmentSMSMorph::UpdateControlValueFromBPF(), CLAM::SegmentSMSMorph::UpdateFrameInterpolatorFactors(), and CLAM::SegmentSMSTimeStretch::UpdateTimeAndIndex().

template<>
const std::string CLAM::InControl< MIDI::Message >::GetLastValueAsString ( )
virtual

Reimplemented from CLAM::InControlBase.

Definition at line 33 of file InControl.cxx.

template<class ControlDataType>
const std::string CLAM::InControl< ControlDataType >::GetLastValueAsString ( )
inlinevirtual

Convenience method to get the string representation of the last value. This just works if the token is storable as XML leaf, if not a "Not printable" string is given.

Reimplemented from CLAM::InControlBase.

Definition at line 116 of file InControl.hxx.

Referenced by CLAM::InControl< MIDI::Message >::GetLastValueAsString().

template<class ControlDataType>
virtual const std::type_info& CLAM::InControl< ControlDataType >::GetTypeId ( ) const
inlinevirtual

Concrete InControls must overload this method by returning the typeid of the kind of data they communicate.

             This method is used internanlly in order to assure type
             compatibility between an input an an output control.
             There are some other uses like the NetworkEditor assigning
             different colors to connectors depending on this type.
Todo:
Add a link to the

Implements CLAM::InControlBase.

Definition at line 121 of file InControl.hxx.


Member Data Documentation

template<class ControlDataType>
ControlDataType CLAM::InControl< ControlDataType >::mLastValue
protected

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