Jump to content

SoundSetWaveVolume


Go to solution Solved by Melba23,

Recommended Posts

Hello guys,

This is my first post, sorry if I'm doing something wrong.

This is the code:

MsgBox(32,"Information","F6 - Volume down" & @CR & "F7 - Volume up")
HotKeySet("F6","volumedown")
HotKeySet("F7","volumeup")

$vold = -5
$volu = +5
Func volumedown()
   SoundSetWaveVolume($vold)
EndFunc

Func volumeup()
   SoundSetWaveVolume($volu)
EndFunc

The problem: When I press F6 or F7 a several times, the volume isn't in- or decreasing.
What am I doing wrong?

Thanks in advance.

Link to comment
Share on other sites

  • Moderators
  • Solution

Belgium,

 

What am I doing wrong?

Quite lot, unfortunately! ;)

You need to set a master value for the volume which you then change when you press the HotKeys and you need to keep the script alive by adding a loop. Take a look at this example and see if you can work out why I have changed it as I have:

HotKeySet("a","volumedown")
HotKeySet("b","volumeup")
HotKeySet("{ESC}", "On_Exit")

Global $vol = 100 ; Here is the initial setting which is used everywhere

While 1
    Sleep(10)
WEnd

Func volumedown()
    If $vol > 0 Then
        $vol -= 5 ; Decrease if we are not already at 0
    EndIf
   SoundSetWaveVolume($vol)
EndFunc

Func volumeup()
    If $vol < 100 Then
        $vol += 5 ; Increase if we are not already at 100
    EndIf
   SoundSetWaveVolume($vol)
EndFunc

Func On_Exit()
    Exit
EndFunc
I also changed the HotKeys so they so not conflict with SciTE and added a way of exiting. Please ask if you have any questions. :)

And finally, if you run Vista+ than you only affect the volume of this process and not the overall volume - open the volume applet and you will see that is what is happening. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Belgium,

 

a way to adjust the overall volume

This thread should do the trick. :)

By the way, there is a forum "Search" function at top right - that is how I found this thread (even though I knew it was there somewhere). ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...