Windows hardware
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.


This sample application uses the Core Audio APIs to change the volume of the device, as specified by the user.

This topic contains the following sections.


This sample demonstrates the following features.


Windows SDKWindows 7
Visual Studio2008


Downloading the Sample

This sample is available in the following locations.

Windows SDK\Program Files\Microsoft SDKs\Windows\v7.0\Samples\Multimedia\Audio\EndpointVolume\...


Building the Sample

To build the x sample, use the following steps:

To build the EndpointVolumeChanger sample, use the following steps:

  1. Open the CMD shell for the Windows SDK and change to the EndpointVolume sample directory.
  2. Run the command start EndpointVolumeChanger.sln in the EndpointVolume directory to open the EndpointVolumeChanger project in the Visual Studio window.
  3. From within the window, select the Debug or Release solution configuration, select the Build menu from the menu bar, and select the Build option. If you do not open Visual Studio from the CMD shell for the SDK, Visual Studio will not have access to the SDK build environment. In that case, the sample will not build unless you explicitly set environment variable MSSdk, which is used in the project file, WASAPIEndpointVolume.vcproj.

Running the Sample

If you build the demo application successfully, an executable file, EndpointVolumeChanger.exe, is generated. To run it, type EndpointVolumeChanger in a command window followed by required or optional arguments. The following example shows how to toggle the mute setting on the default console device.

EndpointVolumeChanger.exe -console -m

The following table shows the arguments.

-? Shows help.
-h Shows help.
-+Increments the volume level on audio endpoint device by one step. .
-up Increments the volume level on audio endpoint device by one step.
-- Decrements the volume level on audio endpoint device by one step.
-downDecrements the volume level on audio endpoint device by one step.
-vSets the master volume level on the audio endpoint device.
-consoleUse the default console device.
-communicationsUse the default communication device.
-multimediaUse the default multimedia device.
-endpoint Use the endpoint identifier specified in the switch value.


If the application is run without arguments, it enumerates the available devices and prompts the user to select a device. After the user specifies the device, the application displays the current volume settings for the endpoint. The volume can be controlled by using the switches described in the preceding table.

For more information about controlling the volume levels of audio endpoint devices, see EndpointVolume API.

Related topics

SDK Samples That Use the Core Audio APIs



© 2016 Microsoft