| Programming C# C++ (7) Delphi (618) .NET (2) Database (71) Delphi IDE (90) Network (39) Printing (3) Strings (12) VCL (83) Windows with Delphi (280) Java (8) JavaScript (29) perl (9) php (4) VBScript (1) Visual Basic (1)
|
Change left and right channel volume individually from Delphi
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.
Comments:
|