Hardware connection and startup
A connection has to be established with the hardware acceleration unit via XDspConnect or XDspConnectWithMaximumStreamLimit. The caller sets the requirements for the connection by using the following parameters:-
baseBuffer - A pointer to the user allocated memory enough to hold input, output, envelope buffer and/or block multiplier buffers that will be passed to the hardware. This memory should be allocated via XMemAlloc with these attributes: XALLOC_MEMTYPE_PHYSICAL_CACHEABLE, XALLOC_PAGESIZE_64KB, XALLOC_ALIGNMENT_64K. These attributes should be set using
MAKE_XALLOC_ATTRIBUTES(), as shown in the example below. This memory should not be freed until XDspDisconnect call succeeds. This buffer should be at least 64KB in size. - baseBufferLength - The length of the baseBuffer in bytes. This buffer should be at least 64KB and no more than 500 MB.
- aggregateImpulseResponseInSeconds - It represents the overall duration of all the individual impulse responses that will be activated simultaneously using XDspActivate with XDspProcessType::Convolution. If this value is 0, no streams with XDspProcessType::Convolution can be activated.
- handle - a pointer to the XDspClientHandle to hold the handle returned by this call.
Activation and deactivation of streams
After the connection is established with the device, the caller should send a stream activation command to engage a convolution, FFT or IFFT. The caller must specify the XDspProcessType, block frame count, channel count, impulse response length in floats and a pointer to the impulse response data in frequency domain in the XDspActivationParameters. Only mono or stereo streams are allowed. For XDspProcessType::ForwardFourierTransform and XDspProcessType::inverseFourierTransform, XDspActivationParameters::impulseResponse should be nullptr and XDspActivationParameters::impulseResponseLengthInFloats = 0. XDspActivationOptions should be set appropriately. Following is the code to activate one stream for convolution.- Fill the input buffer with exactly blockFrameCount of data.
- Fill in the XDspCommand with appropriate values and input and output buffers that are 16 byte aligned.
- Call XDspSubmitCommand to submit the command to the hardware. This function returns a command sequence number that can be used to track the number of commands sent to the hardware.
- To apply an envelope, fill the envelope buffer with gain values for each block of the impulse response filter and call XDspSubmitCommandWithEnvelope and continue making this call with the same envelope buffer until enveloping is no longer needed or the envelope needs to be changed.
- When enveloping is no longer required, call XDspSubmitCommand or XDspSubmitCommandWithEnvelope with a nullptr for envelopeBuffer. Note that XDspSubmitCommandWithEnvelope with a nullptr for envelopeBuffer is equivalent to XDspSubmitCommand.
- When switching the envelope, the current envelopeBuffer can only be updated for the next envelope if the hardware processed all the commands using that envelope and the results have been picked up. If not, please use a different envelope buffer.
