Condividi tramite


Adding Properties to the Sample Audio DSP Plug-in

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The audio DSP sample code that the Windows Media Player Plug-in Wizard generates uses a single property that represents the scale factor for the audio volume. Your plug-in may require more than one property. You can easily add properties to your DSP plug-in in Visual Studio using the following steps:

  • Define the methods in the interface definition code in the IDL file that is part of the proxy-stub project.

    • Add the method implementations to the project's main CPP file:
    STDMETHODIMP CYourProject::get_color(COLORREF *pColor)
    {
        if ( NULL == pColor )
        {
            return E_POINTER;
        }
    
        *pColor = m_Color;
    
        return S_OK;
    }
    
    STDMETHODIMP CYourProject::put_color(COLORREF newColor)
    {
        m_Color = newColor;
    
        return S_OK;
    }
    
    

Finally, to make the properties accessible to the user, you'll want to make changes to the property page implementation.

Implementing an Audio DSP Plug-in