Share via


Removing the Code to Process Greater than 16 Bits

[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.]

Because this sample only processes 8-bit or 16-bit audio, you need to modify the code in CEcho::ValidateMediaType to return DMO_E_TYPE_NOT_ACCEPTED for media types greater than 16 bits. To accomplish this, you must change the code in the switch block that tests formats of type WAVE_FORMAT_EXTENSIBLE. Replace the wizard code with the following example code:

case WAVE_FORMAT_EXTENSIBLE:
    {
         // Sample size is greater than 16-bit or is multichannel.
        WAVEFORMATEXTENSIBLE *pWaveXT = (WAVEFORMATEXTENSIBLE *) pWave;

        if (KSDATAFORMAT_SUBTYPE_PCM != pWaveXT->SubFormat)
        {
            return DMO_E_TYPE_NOT_ACCEPTED;
        }
    }
    break;

Next, delete or comment out the sections of code in DoProcessOutput that handle high bit resolution audio. These are the sections that begin with case 24 and case 32.

Implementing CEcho::DoProcessOutput