How to: Add Run-time Parameter Support to an XAPO

You can add run-time parameter support to an XAPO by implementing the IXAPOParameters interface. Run-time parameter support allows an XAPO to change its behavior based on the parameters passed to it at run time.

  1. Follow the steps in How to: Create an XAPO.

  2. Change the XAPO to derive from CXAPOParametersBase and CXAPOBase.

  3. Add calls to the methods CXAPOParametersBase::BeginProcess and CXAPOParametersBase::EndProcess to the implementation of IXAPO::Process.

    Note

    Adding these methods to IXAPO::Process allows CXAPOParametersBase to keep its copies of the effect parameters in a thread-safe state. Call CXAPOParametersBase::BeginProcess at the beginning of IXAPO::Process, and CXAPOParametersBase::EndProcess at the end of IXAPO::Process.

     

  4. Add more code to the IXAPO::Process implementation to change its behavior according to values stored by the SetParameters method.

    Note

    Adding code to the IXAPO::Process method to use the parameters specified by SetParameters allows the XAPO's behavior to be changed throughout its life.

     

  5. When you create an instance of the effect, allocate a buffer of three of the structures that will represent the effect's parameters, and pass it to the CXAPOParametersBase constructor.

    Note

    The CXAPOParametersBase instance internally uses this buffer to manage effect parameters passed to it when you call SetParameters. You must initialize all the process parameter blocks in pParameterBlocks to the same default value before you call any of the IXAPO::Process, IXAPOParameters::GetParameters, and IXAPOParameters::SetParameters methods. Usually this initialization is handled in IXAPO::Initialize or in IXAPO::LockForProcess.

     

Audio Effects

XAPO Overview