Delphi IDE (89)
Windows with Delphi (280)
Visual Basic (1)
Change left and right channel volume individually from Delphi
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question:I want to change the volume of the left and right channel individually from my Delphi application. How do I do this?
Answer:The current volume settings can be retrieved with WaveoutGetVolume. Windows represents this as a 64-bit unsigned integer. (DWord)
The upper two bytes are the right channel (unsigned 32 bit integer, Word) and the lower two bytes are the left channel.
After retrieving the current settings, you can update each channel individually and then use WaveoutSetVolume to save your setting.
Below are two procedures that demonstrate how this can be done. Each channel can be set to a value between 0 and 64k (0 .. 65535).
The necessary Windows functions WaveoutGetVolume, WaveoutSetVolume are interfaced in unit MMSystem.