CRPlugIn Class Reference

"render" plugin base class More...

List of all members.

Public Member Functions

Plugin Functions
virtual bool Init (void *pParams, void **ppDesc)
 performs one-time constructor initialization
virtual bool Process (void)=0
 processes a frame of input samples
virtual bool Begin (void)
 performs plugged-in initialization
virtual bool End (void)
 frees plugged-in allocation

Private Attributes

Error Attributes
char m_strError [PIESL]
 for internal use only
bool m_bError
 for internal use only

Error Functions

bool ErrorSet (char *strError)
 sets error string
void ErrorClear ()
 clears error state
char * ErrorString ()
 returns error string
bool ErrorState ()
 returns error state


Detailed Description

The CRPlugIn class is the base class of slab3d Render Plugins. Render Plugins perform all audio rendering in slab3d. In SRAPI, they are given access to SRAPI's Scene information, input delay lines, and output stream.

See also:
CSRAPI
Header: rplugin.h
Library: none

Member Function Documentation

bool CRPlugIn::ErrorSet ( char *  strError  )  [inline, protected]

The ErrorSet() function sets the plugin error string, signaling an error. slab3d will catch the error, stop rendering, and report the error to the user. Plugin developers should call this function when they need to signal an error condition.

Returns:
false = error
See also:
Error Functions
Parameters:
strError error string (max length = PIESL)

References m_bError, m_strError, and PIESL.

void CRPlugIn::ErrorClear (  )  [inline]

The ErrorClear() function clears the error state.

In SRAPI, ErrorClear() is called internally by SRAPI when the user clears the error. SRAPI plugin developers typically do not need to call this function.

Returns:
none
See also:
Error Functions

References m_bError, and m_strError.

char* CRPlugIn::ErrorString (  )  [inline]

The ErrorString() function returns the error string.

In SRAPI, ErrorString() is called internally by SRAPI to retrieve the error string when a plugin signals an error. SRAPI plugin developers typically do not need to call this function.

Returns:
error string
See also:
Error Functions

References m_strError.

bool CRPlugIn::ErrorState (  )  [inline]

The ErrorState() function returns the current error state.

Returns:
false = error, true = no error
See also:
Error Functions

References m_bError.

virtual bool CRPlugIn::Init ( void *  pParams,
void **  ppDesc 
) [inline, virtual]

The Init() function is intended for one-time plugin initialization (e.g., similar to a constructor). It can also be used to provide plugin description information to the app accessing the plugin. This function is not accessed by the slabwire architecture. It is provided for instances where the plugin is implemented in a DLL (e.g., SRAPI).

In SRAPI, the plugin developer must override this function to: (1) access SRAPI via the pParams CSRAPI pointer and (2) return a description struct. This function can be used in place of a constructor to set defaults based on default Scene parameters or to return error information. All plugins are loaded when the CSRAPI object is allocated. After a plugin is loaded, its Init() function is called to initialize the plugin. This is the only time the Init() function is called. Initialization that must occur every time a plugin is plugged-in should be performed in Begin().

Returns:
true = success, false = failure
See also:
Plugin Functions, CSRAPI, Desc
Parameters:
pParams plugin parameters
ppDesc description struct set by plugin

virtual bool CRPlugIn::Process ( void   )  [pure virtual]

The Process() function processes a frame of input samples. The plugin developer must override this function to implement their own audio renderer.

In slabwire, Process() processes SSI stream input to SSO stream output. The I/O objects are not members of CRPlugIn because they are sometimes accessed via the Init() plugin parameter data structure maintained by the slabwire user (e.g., CSRAPI*). In the simplest implementation, the user would add SSI and SSO member variables in the CRPlugIn subclass and set them before starting the DSP thread with BeginThread().

SRAPI Use:

Except for extremely simple renderers, the following code should be included at the beginning of Process:

 if( m_pSRAPI->Updated() )
 {
   m_pSRAPI->Recalc();
   if( !SceneToSigProc() )
     return false;
 }

This code fragment checks if any scene parameters have been updated. If so, the scene is recalculated (e.g. new listener-relative parameters are computed). The plugin developer then calls their own function (SceneToSigProc()) to convert the scene parameters to their renderer's signal processing parameters (e.g., FIR coefficients).

An SRAPI plugin accesses the scene parameters, the input delay lines, and the output stream through the CSRAPI object passed in Init().

Returns:
true = success, false = failure
See also:
Plugin Functions, CSRAPI

virtual bool CRPlugIn::Begin ( void   )  [inline, virtual]

The Begin() function is called every time the plugin is plugged-in. Override this function to initialize the plugin. Note, one-time constructor-like initialization can occur in Init().

Returns:
true = success, false = failure
See also:
Plugin Functions, Init, End()

virtual bool CRPlugIn::End ( void   )  [inline, virtual]

The End() function is called every time the plugin is plugged-out. Override this function to free data allocated during Begin().

Returns:
true = success, false = failure
See also:
Plugin Functions, Begin()


Member Data Documentation

char CRPlugIn::m_strError[PIESL] [private]

m_strError is for internal use only. This member variable should only be accessed through the Error Functions.

Referenced by ErrorClear(), ErrorSet(), and ErrorString().

bool CRPlugIn::m_bError [private]

m_bError is for internal use only. This member variable should only be accessed through the Error Functions.

Referenced by ErrorClear(), ErrorSet(), and ErrorState().


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