Required Interfaces - Custom Audio Effects in Windows Vista Custom Audio Effects in Windows Vista

Required Interfaces
An sAPO must export three required interfaces in addition to IUnknown:
IAudioProcessingObject. An interface that handles setup tasks such as initialization and format negotiation.
IAudioProcessingObjectRT. A real-time interface that handles audio processing. It can be called from a real-time processing thread.
IAudioProcessingObjectConfiguration. The configuration interface.
For detailed documentation of the required interfaces, see AudioEngineBaseAPO.idl.
Note: Custom sAPOs should not export the IAudioProcessingObjectVBR interface.
The CBaseAudioProcessingObject Class
CBaseAudioProcessingObject is a base class that implements much of the functionality that an sAPO requires. It provides default implementations for most of the methods in the three required interfaces. The primary exception is IAudioProcessingObjectRT::APOProcess, which is where the custom signal processing algorithms are implemented. The class declaration is contained in BaseAudioProcessingObject.h, which is included with the Windows Driver Kit (WDK).
Using CBaseAudioProcessingObject can significantly reduce the effort that is required to implement an sAPO. If an sAPO has no special format requirements and operates on the default float32 format, the default implementations of the interface methods that are included in CBaseAudioProcessingObject should be sufficient and only two methods must be implemented: IAudioProcessingObjectRT::APOProcess and ValidateAndCacheConnectionInfo. However, CBaseAudioProcessingObject is not suitable for all sAPOs.
If an sAPO processes only uncompressed PCM data, using CBaseAudioProcessingObject is strongly recommended.
If an sAPO must support non-PCM formats such as AC3 or MP3, it cannot use CBaseAudioProcessingObject. Vendors must provide their own implementations of the required interfaces.
To use CBaseAudioProcessingObject, create a custom class that inherits from CBaseAudioProcessingObject and implement two of its methods.
IAudioProcessingObjectRT::APOProcess. This method handles the actual signal processing and contains the custom signal processing algorithms.
ValidateAndCacheConnectionInfo. The graph builder calls IAudioProcessingObjectConfiguration::LockForProcess to finalize format negotiation and lock the sAPO for processing. The default implementation of this method that is included in CBaseAudioProcessingObject has no specific knowledge of the sAPO. It does some standard connection checking and essentially forwards the query to ValidateAndCacheConnectionInfo. The sAPO’s implementation of ValidateAndCacheConnectionInfo should allocate memory and store any details about format that might be required later. Format details typically include items such as channel count, sampling rate, sample depth, channel mask, and so on.
AudioEngineBaseApo.idl is included in the WDK and contains detailed comments on how to implement all of the required interfaces. In particular, examine the comments for IAudioProcessingObjectConfiguration::LockForProcess. ValidateAndCacheConnectionInfo has an identical signature and must perform essentially the same tasks, so the comments are also relevant for that method.
|