Jump to content

Volume Leveler?


Go to solution Solved by DatMCEyeBall,

Recommended Posts

I managed to dig up some old movies from my old hard drive, Turns out that the background music isn't really background music at all.

What happens is that the voices of people are very soft and the "background" music is so loud that I have to turn my speakers down.

I came up with the idea to level the master volume and here it is:

HotKeySet("{ESC}", "_Exit")

Global $iLimit = 60 ; Limit in Db

While 1
    $iCurVol = _Function_To_Get_Current_Playback_Volume() ; Gets the current playback volume in Db (loudness)
    If $iCurVol > $iLimit Then
        Do
            $iVol = _Function_To_Get_Master_Volume() ; Returns the master vol in %
            _Function_To_Set_Master_Volume($iVol - 1) ; Sets the master vol in %
        Until _Function_To_Get_Current_Playback_Volume() = $iLimit
    ElseIf $iCurVol < $iLimit Then
        Do
            $iVol = _Function_To_Get_Master_Volume() ; Returns the master vol in %
            _Function_To_Set_Master_Volume($iVol - 1) ; Sets the master vol in %
        Until _Function_To_Get_Current_Playback_Volume() = $iLimit
    EndIf
    Sleep(100) ; Check every 100 ms to reduce CPU load
WEnd

Func _Exit()
    Exit
EndFunc   ;==>_Exit

As you can see I need 3 functions:

  1. One to get the current DB of the playback volume
  2. A second one to get the master volume
  3. And a third one to set the master volume
Edited by DatMCEyeBall

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

That's a lovely story.

Please keep us updated with your progress.

I could tell you another one :P

"Just be fred, all we gotta do, just be fred."  -Vocaliod

"That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha

@tabhooked

Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...