Jump to content

[SOLVED] Windows 7 sound


Recommended Posts

Hello, I am having a bit of trouble with a script.

not sure if this function is supported in Windows 7 but here it is.

I have a volume control slider, when I move the slider the volume mixer's slider moves but the volume does not apply.

This works for Win Vista (all ver and arch) and Win XP (all ver and arch)

the code I am using is

SoundSetWaveVolume(GUICtrlRead($Slider1))

Would anyone be able to help me with this issues?

Thanks, Tom.

Edited by TomDuDolan

My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.

Link to comment
Share on other sites

The Windows mixer architecture changed with Vista, so the built-in functions will not work as expected. As you noticed they cannot change the system master volume. I wrote a plugin to help. You'll either need to use it, or a AutoItObject based solution. Note that it's 32-bit only, I haven't got around to building a 64-bit dll.

Link to comment
Share on other sites

I'm confused now. Are you trying to adjust the volume just for your application, or the master volume for the whole system? If the former, then ignore my above post because it will not help you. If the latter, then I cannot provide any support for Windows 8 and you're on your own.

Link to comment
Share on other sites

I'm confused now. Are you trying to adjust the volume just for your application, or the master volume for the whole system? If the former, then ignore my above post because it will not help you. If the latter, then I cannot provide any support for Windows 8 and you're on your own.

Yeah just the apps volume, don't suppose you'd like something like a updatedata or something? It moves the slider, just not applying it.

My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.

Link to comment
Share on other sites

Here you go, it's kinda sloppy but the only thing that works with 7 as far as I know

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>

$s = 0
Do
    Send("{Volume_down}")
    $s += 1
Until $s = 99
$s2 = 0
$v = 0

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Volume Kon", 152, 48, 192, 114)
$Slider1 = GUICtrlCreateSlider(0, 0, 150, 45)
GUICtrlSetLimit($Slider1, 100, 0)
GUICtrlSetData($Slider1, 0)
$hSlider = GUICtrlGetHandle($Slider1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg($WM_HSCROLL,"hscroll")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func hscroll($hWnd, $iMsg, $iwParam, $ilParam)
    If $ilParam = $hSlider Then
        $sr = GUICtrlRead($Slider1)
        If $sr > $v Then
            Do
                $v += 1
                Send("{Volume_up}")
            Until $v = $sr
        ElseIf $sr < $v Then
            Do
                $v -= 1
                Send("{Volume_down}")
            Until $v = $sr
        EndIf
    EndIf
    Return "GUI_RUNDEFMSG"
EndFunc
Link to comment
Share on other sites

Here you go, it's kinda sloppy but the only thing that works with 7 as far as I know

#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <WindowsConstants.au3>

$s = 0
Do
    Send("{Volume_down}")
    $s += 1
Until $s = 99
$s2 = 0
$v = 0

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Volume Kon", 152, 48, 192, 114)
$Slider1 = GUICtrlCreateSlider(0, 0, 150, 45)
GUICtrlSetLimit($Slider1, 100, 0)
GUICtrlSetData($Slider1, 0)
$hSlider = GUICtrlGetHandle($Slider1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

GUIRegisterMsg($WM_HSCROLL,"hscroll")

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

Func hscroll($hWnd, $iMsg, $iwParam, $ilParam)
    If $ilParam = $hSlider Then
        $sr = GUICtrlRead($Slider1)
        If $sr > $v Then
            Do
                $v += 1
                Send("{Volume_up}")
            Until $v = $sr
        ElseIf $sr < $v Then
            Do
                $v -= 1
                Send("{Volume_down}")
            Until $v = $sr
        EndIf
    EndIf
    Return "GUI_RUNDEFMSG"
EndFunc

Thanks Klovis, integrated this yesterday, works a charm on 7 -32 and x64 :)

Thanks!

My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.

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