VCX. Volume control

Subscribe to RSS news feed

Describes how to implement a volume control in your application using Visual Studio (C#, Visual Basic .NET, Visual Basic 6.0 or Visual C++ 6.0).


Binary : sample_volume_control.zip
C#: sample_volume_control_source_csharp.zip
VB.NET: sample_volume_control_source_vbnet.zip
VB: sample_volume_control_source_vb.zip
C++: sample_volume_control_source_vc.zip

Introduction

In some cases you have to control sound volume in your application. You may need to select a particular recording source, e.g. microphone, CD audio, etc., or change the recording/playback volume of some channels, e.g. total, wave, etc.

Click for full sized image

Simple volume control

The simple volume control approach implies that you use a number of pre-defined channels such as Microphone, CD Audio, Wave, etc.

Recording channels are represented by the vcRecSource enumeration. Playback channels are represented by vcPlayDest one.

This demo uses the VolumeControl component.

Change RecSource property to select a default recording channel (microphone, CD audio, etc.)

Call the GetPlayVolume/GetRecVolume methods passing a channel constant to get playback or recording volume of the corresponding channel.

Similarly, call the SetPlayVolume/SetRecVolume methods to set playback or recording volume of a channel.

Complete volume control

Use the IvcproVolumeControl2X interface of the VolumeControl component to access the methods which provides you full control over your sound card playback/recording channels.

VolumeControl component reference