• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Get the exact windows volume and control it with a track

Hello,

I got a way to do that but the problem is that I would like to control it with a track bar where

min = 0
max = 100
step = 10

I got the solution here:

https://answers.yahoo.com/question/index?qid=20080322220454AA7clOIVolume track bar

I changed the function to this

Function LerVolume(): Integer;
Var
  Vol : DWORD;
begin
  waveOutGetVolume(Integer(WAVE_MAPPER),@Vol);
  Result := Round(loWord(Vol) / 655.35);
End;

Open in new window


I thank in advanced a help
Alex
0
hidrau
Asked:
hidrau
1 Solution
 
Sinisa VukCommented:
because full volume is 65535 and silence is 0 - you must translate your range 0..100 to 0..65535:

SetWaveVolume(muldiv(65535, trackbar.position, 100));

Open in new window



...get value for trackbar:
Var
  Vol : DWORD;
begin
  waveOutGetVolume(Integer(WAVE_MAPPER),@Vol);
  Result := (100 * loWord(Vol)) div 65535;

Open in new window

0
 
hidrauAuthor Commented:
Once again, Thanks very much Sinsav.

I understood :)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now