Source language: Translate to:

TrackBar Volume Control

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

TrackBar Volume Control

Postby Jim Brammer » Thu Apr 04, 2002 12:12 pm

It might not be widely known that the Windows volume levels are on a scale from 0 to 255. So if you make a TrackBar control on your Pub to control a volume level you could set the Min Value to 0 and the Max Value to 255.

At the startup of your pub use GetVolume to set the TrackBar to the current level of whichever volume you want to control...

GetVolume "Wave" "[TrackBar1]"

Then, in the "Value Changed" action editor of the TrackBar, use SetVolume like this...

SetVolume "Wave" "[TrackBar1]"

Or, if for some reason you need your TrackBar to use a scale from 0 to 100 then you can calculate the value to set the level control...

Math "[TrackBar1]*2.55" "" "[WavLevel]"
SetVolume "Wave" "[WavLevel]"

...that way you can use the raw 0-100 TrackBar value for display purposes if you need to. You know, like a percentage of level.
Jim Brammer

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: No registered users and 2 guests