Share via


Presets

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

Presets are provided as a way to have different effects coming from the same visualization. For example, you could create a glow effect that was generated by one block of code, but use a preset to determine the color of the glow. Your preset names might be Red, Green, and Blue.

The wizard defines two presets for the code it generates. One is called Bars and the other is called Wave. The Bars preset displays bars that show the activity in the audio spectrum, and use the waveform data. The Wave preset displays a wiggling line that shows the audio power of the waveform.

If you change any of the preset information, you must also change the following parts of the generated code.

Render function

The IWMPEffects::Render function is in the file projectname.cpp, where projectname is the project name you chose when you ran the wizard.

The generated code in the Render function uses a switch statement to choose between two presets. The current preset is whatever the user selects in Windows Media Player. If you want to change which code runs for a particular preset or add or subtract a preset, modify the switch statement accordingly.

The two presets are defined by the PRESET_BARS and PRESET_SCOPE enumerations. The choice of which preset will be called is defined by m_nPreset.

GetPresetTitle

The IWMPEffects::GetPresetTitle function is in the file projectname.cpp, where projectname is the project name you chose when you ran the wizard.

The GetPresetTitle function sets up the relationships between the preset enumerations and the string resources. The enumerations PRESET_BARS and PRESET_SCOPE are generated by the wizard and are using the string resources IDS_BARSPRESETNAME and IDS_SCOPEPRESETNAME.

You need to change the enumerations and string resources if you add, subtract, or change presets.

Preset Enumerations

The preset enumeration is defined in the file projectname.h, where projectname is the project name you chose when you ran the wizard.

The enumeration defines the current two presets and the count. If you add or subtract presets or change the enumeration, be sure you change this enumeration so that the count and order of presets is correct. This enumeration is used to make sure that you call the correct preset in the Render function.

Resource Header

You must set the resources for names of your preset in the resource.h header file. The current presets are defined as:

#define IDS_BARSPRESETNAME              102
#define IDS_SCOPEPRESETNAME             103

If you add or subtract presets, you must change the resource header and the numbers for them.

Resource Strings

The actual names of the presets are defined in the resource file projectname dll.rc, where projectname is the project name you chose when you ran the wizard. You can edit this file by hand or use the resource editor included with Microsoft Visual C++.

The names generated are the name of the visualization plus the specific preset. The resource file for the generated code will define them as:

IDS_BARSPRESETNAME      "projectname Bars"
IDS_SCOPEPRESETNAME     "projectname Wave"

where projectname is the name of the project name you chose when you ran the wizard. This is where you will change the actual names of the presets and this is how they will be referred to and displayed by Windows Media Player.

Implementing Your Code