CGPlugIn Class Reference

signal "generator" plugin base class More...

List of all members.

Public Member Functions

char * ErrorString ()
 returns error string
bool ErrorState ()
 returns true if in error state
GPList * GetPList ()
 returns a pointer to the generator plugin parameter list
bool Set (int nParam, float fValue, bool bApply=false)
 sets plugin parameter value
virtual void Reset ()
 reset plugin to initial state
virtual GDescGetDesc ()
 returns a pointer to the plugin generator description struct
void Start ()
 starts sample generation
void Stop ()
 stops sample generation
virtual bool Init ()
 override to init plugin
virtual bool Apply ()
 informs plugin to apply parameters
virtual bool Command (void *pVoid=NULL)
 passes custom commands to the plugin

Protected Member Functions

void ErrorSet (const char *strError)
 set plugin error
void InitPList (GPList *plist, int nBytes)
 initialize parameter list
void SetAmp (float fAmp)
 set plugin amplitude
virtual float GenSample ()
 generate sample

Protected Attributes

char m_strError [GPIESL]
 error string
char m_pDir [GPI_DIRLEN]
 plugin directory
bool m_bStarted
 sample generation started
float m_fFs
 sample rate (set by slabwire)
float m_fAmp
 amplitude (see SetAmp())
GPList * m_plist
 generator parameter list
int m_nNumParams
 number of parameters


Detailed Description

The CGPlugIn class is the base class of slab3d Generator Plugins (gplugins). Generator plugins can be selected as sample stream input in slabwire and sound source input in SRAPI.

See also:
See gslab.cpp for an example of how to create a plugin using CGPlugIn.
Header: gplugin.h
Library: none

Member Function Documentation

char* CGPlugIn::ErrorString (  )  [inline]

The ErrorString() function returns the current error string.

Returns:
error string
See also:
ErrorSet(), ErrorState()

References m_strError.

bool CGPlugIn::ErrorState (  )  [inline]

The ErrorState() function can be used to query error state.

Returns:
true = in error state, false = not in error state
See also:
ErrorSet(), ErrorString()

References m_strError.

GPList* CGPlugIn::GetPList (  )  [inline]

The GetPList() function returns a pointer to the generator plugin parameter list. If the plugin includes a header file (e.g., gslab.h), Set() and the header file information can sometimes serve as an alternative to GPList access.

Returns:
signal generator parameter list
See also:
GPList struct

References m_plist.

Referenced by CSIGen::GenPList().

bool CGPlugIn::Set ( int  nParam,
float  fValue,
bool  bApply = false 
) [inline]

Set() sets a parameter value. Typically, this value isn't applied to the signal generation algorithm until Apply() is called. This allows several parameter values to be applied at once. This behavior can also be used to allow the value to change faster than it is applied, e.g., from a slider with an accept button or another downsampling method.

Returns:
true = success, false = failure
Parameters:
nParam parameter (plist) index
fValue parameter value
bApply call Apply() to apply parameter

References Apply(), m_nNumParams, and m_plist.

Referenced by CSIGen::GenSet().

virtual void CGPlugIn::Reset (  )  [inline, virtual]

Override Reset() to support the slabwire rewind feature. The generator should reset itself to its initial state.

virtual GDesc* CGPlugIn::GetDesc (  )  [inline, virtual]

The GetDesc() function returns a pointer to the plugin generator description struct.

Plugin Developers:

Override GetDesc() to return a pointer to your description struct.

Returns:
signal generator description struct
See also:
GDesc struct

Referenced by CSIGen::GenDesc().

void CGPlugIn::Start (  )  [inline]

Start() starts sample generation (i.e., GetSample() returns GenSample()).

See also:
Stop()

References m_bStarted.

Referenced by CSIGen::GenStart().

void CGPlugIn::Stop (  )  [inline]

Stop() stops sample generation (i.e., GetSample() returns 0).

See also:
Start()

References m_bStarted.

Referenced by CSIGen::GenStop().

virtual bool CGPlugIn::Init (  )  [inline, virtual]

Init() should be overridden to init plugin.

Returns:
true = success, false = failure

virtual bool CGPlugIn::Apply (  )  [inline, virtual]

The Apply() function informs a generator plugin to apply parameters.

Plugin Developers:

Apply() should be overridden to apply plugin parameters.

Returns:
true = success, false = failure
See also:
Set(), GetPList()

Referenced by CSIGen::GenApply(), and Set().

virtual bool CGPlugIn::Command ( void *  pVoid = NULL  )  [inline, virtual]

Command() can be overridden to pass custom commands and/or data to the plugin. A header file defining the command should be provided. Note, the parameter list is the preferred method of passing data to a generator plugin.

Returns:
true = success, false = failure
See also:
GenPList(), Set(), Apply()
Parameters:
pVoid custom command and/or data

Referenced by CSIGen::GenCommand().

void CGPlugIn::ErrorSet ( const char *  strError  )  [inline, protected]

The ErrorSet() function can be used by your plugin to notify of an error.

See also:
ErrorString(), ErrorState()

References GPIESL, and m_strError.

void CGPlugIn::InitPList ( GPList *  plist,
int  nBytes 
) [inline, protected]

InitPList() is called from the generator plugin constructor to allocate and initialize the plugin's parameter list.

References m_nNumParams, and m_plist.

void CGPlugIn::SetAmp ( float  fAmp  )  [inline, protected]

SetAmp() sets the m_fAmp member variable, limiting the value between 0.0 and 1.0. This function is available for use by your plugin.

References m_fAmp.

virtual float CGPlugIn::GenSample (  )  [inline, protected, virtual]

GenSample() generates a sample. Override to generate samples for your generator. The override will be called to generate samples when the generator is in a "started" state (Start()). When the plugin is in a "stopped" state (Stop()), the override will not be called and zeroes will be generated by CGPlugIn.


slabwire Reference Manual generated Fri Nov 20 18:49:59 2009 by doxygen 1.5.9