eigene Lautstärkeregelung einblendbar

    • Offizieller Beitrag

    Hi,
    kein Großes Werk - aber da mir der Standardregler von Windows zu mickrig ist für eine saubere Lautstärkeregelung und ich auch keine Lust habe erst in meiner Trayleiste zu "wühlen" :D , habe ich mal schnell einen eigenen Regler erstellt der sich sofort einblendet, wenn ich mit der Maus den Desktopbereich nach rechts verlasse und auch selbständig wieder verschwindet ;)
    Vielleicht ist es ja auch für jemand anderen von Interesse.
    Benötigt wird dafür die audio.au3 von hier

    Edit:
    Hier noch eine Version mit Switch auf Mikroeinstellung.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <WindowsConstants.au3>
    #include <audio.au3>
    Opt("GUIOnEventMode", 1)
    HotKeySet("^+{F6}", "_exitVol")

    [/autoit] [autoit][/autoit] [autoit]

    Global $pos1[2] = [@DesktopWidth, @DesktopHeight/2 -108]
    Global $pos2[2] = [@DesktopWidth-45, @DesktopHeight/2 -108]
    Global $moved = False

    [/autoit] [autoit][/autoit] [autoit]

    $guiSpeaker = GUICreate("Ton", 38, 216, $pos1[0], $pos1[1], BitOR($WS_MINIMIZEBOX,$WS_CAPTION, _
    $WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
    $slVol = GUICtrlCreateSlider(8, 16, 20, 150, BitOR($TBS_VERT,$TBS_TOP,$TBS_LEFT,$TBS_NOTICKS))
    GUICtrlSetOnEvent(-1, "slVolChange")
    GUICtrlSetData(-1, 100-_SoundGetMasterVolume())
    $cbMute = GUICtrlCreateCheckbox("", 11, 173, 17, 17)
    GUICtrlSetOnEvent(-1, "cbMuteClick")
    If _isMute() Then
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetState($slVol, $GUI_DISABLE)
    EndIf
    $Label1 = GUICtrlCreateLabel("Aus", 9, 194, 22, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    _checkPos()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _exitVol()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func cbMuteClick()
    If BitAND(GUICtrlRead($cbMute), $GUI_CHECKED) Then
    GUICtrlSetState($slVol, $GUI_DISABLE)
    Else
    GUICtrlSetState($slVol, $GUI_ENABLE)
    EndIf
    _ToggleMuteMaster()
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func slVolChange()
    _SoundSetMasterVolume(100- GUICtrlRead($slVol))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _checkPos()
    Local $mouse = MouseGetPos()
    If ($mouse[0]+3 > $pos1[0]) Then
    WinMove($guiSpeaker, '', $pos2[0], $pos2[1])
    $moved = True
    ElseIf $moved And ($mouse[0] < $pos1[0]-50) Then
    WinMove($guiSpeaker, '', $pos1[0], $pos1[1])
    $moved = False
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToggleMuteMaster($opt = 1000)
    Local $retVal = 0, $ex = False
    If Not WinExists('[CLASS:Volume Control]') Then
    Run('sndvol32', '', @SW_HIDE)
    $ex = True
    EndIf
    If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1
    $retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked')
    If @error Then Return -2
    If $retVal Then
    ControlCommand('[CLASS:Volume Control]', '', $opt, 'UnCheck')
    If @error Then Return -2
    Else
    ControlCommand('[CLASS:Volume Control]', '', $opt, 'Check')
    If @error Then Return -2
    EndIf
    If $ex = True Then WinClose('[CLASS:Volume Control]')
    Return
    EndFunc ;==>_ToggleMuteMaster

    [/autoit]
  • /slapself !!!!

    ok habs gelesen

    Zitat

    Laughing Man

    "I thought, what I'd do was, I'd pretend I was one of those deaf-mutes"

    Einmal editiert, zuletzt von ctec (15. Oktober 2008 um 13:10)

  • ups und überschrieben...

    eh Sauber BugFix !

    das ist 1A - wenn Du langeweile hast - könntest du das vielleicht noch für Mic + mute erweitern ? Das könnte man dann ideal für z.B. Teamspeak nutzen :thumbup:

    denke das würde großen Zuspruch finden :love:

    Zitat

    Laughing Man

    "I thought, what I'd do was, I'd pretend I was one of those deaf-mutes"

    • Offizieller Beitrag

    Hab mal die Erweiterung für MIC gemacht, einfach über CheckBox auf Mikro switchen.

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <WindowsConstants.au3>
    #include <audio.au3>
    Opt("GUIOnEventMode", 1)
    HotKeySet("^+{F6}", "_exitVol")

    [/autoit] [autoit][/autoit] [autoit]

    Global $pos1[2] = [@DesktopWidth-3, @DesktopHeight/2 -108]
    Global $pos2[2] = [@DesktopWidth-43, @DesktopHeight/2 -108]
    Global $moved = False

    [/autoit] [autoit][/autoit] [autoit]

    $guiSpeaker = GUICreate("PC", 38, 256, $pos1[0], $pos1[1], BitOR($WS_MINIMIZEBOX,$WS_CAPTION, _
    $WS_POPUP,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS))
    $slVol = GUICtrlCreateSlider(8, 16, 20, 150, BitOR($TBS_VERT,$TBS_TOP,$TBS_LEFT,$TBS_NOTICKS))
    GUICtrlSetOnEvent(-1, "slVolChange")
    GUICtrlSetData(-1, 100-_SoundGetMasterVolume())
    $cbMute = GUICtrlCreateCheckbox("", 11, 173, 17, 17)
    GUICtrlSetOnEvent(-1, "cbMuteClick")
    If _isMute() Then
    GUICtrlSetState(-1, $GUI_CHECKED)
    GUICtrlSetState($slVol, $GUI_DISABLE)
    EndIf
    $Label1 = GUICtrlCreateLabel("Aus", 9, 194, 22, 17)
    $cbMic = GUICtrlCreateCheckbox("", 11, 215, 17, 17)
    GUICtrlSetOnEvent(-1, "cbMicClick")
    $LabelMic = GUICtrlCreateLabel("Mic", 9, 234, 22, 17)
    GUISetState(@SW_SHOW)

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    Sleep(100)
    _checkPos()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _exitVol()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func cbMuteClick()
    Local $id
    If BitAND(GUICtrlRead($cbMic), $GUI_CHECKED) Then
    $id = 5000
    Else
    $id = 1000
    EndIf
    If BitAND(GUICtrlRead($cbMute), $GUI_CHECKED) Then
    GUICtrlSetState($slVol, $GUI_DISABLE)
    _MuteVol($id)
    Else
    GUICtrlSetState($slVol, $GUI_ENABLE)
    _UnMuteVol($id)
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func cbMicClick()
    If BitAND(GUICtrlRead($cbMic), $GUI_CHECKED) Then
    WinSetTitle($guiSpeaker, '', 'MIC')
    If Not _isMute(5000) Then
    GUICtrlSetState($cbMute, $GUI_UNCHECKED)
    Else
    GUICtrlSetState($cbMute, $GUI_CHECKED)
    EndIf
    GUICtrlSetData($slVol, 100-_SoundGetMicrophoneVolume())
    Else
    WinSetTitle($guiSpeaker, '', 'PC')
    If Not _isMute() Then
    GUICtrlSetState($cbMute, $GUI_UNCHECKED)
    Else
    GUICtrlSetState($cbMute, $GUI_CHECKED)
    EndIf
    GUICtrlSetData($slVol, 100-_SoundGetMasterVolume())
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func slVolChange()
    If BitAND(GUICtrlRead($cbMic), $GUI_CHECKED) Then
    _SoundSetMicrophoneVolume(100- GUICtrlRead($slVol))
    Else
    _SoundSetMasterVolume(100- GUICtrlRead($slVol))
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _checkPos()
    Local $mouse = MouseGetPos()
    If ($mouse[0] > $pos1[0]) Then
    WinMove($guiSpeaker, '', $pos2[0], $pos2[1])
    $moved = True
    ElseIf $moved And ($mouse[0] < $pos1[0]-50) Then
    WinMove($guiSpeaker, '', $pos1[0], $pos1[1])
    $moved = False
    EndIf
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _MuteVol($opt = 1000)
    Local $retVal = 0, $ex = False
    If Not WinExists('[CLASS:Volume Control]') Then
    Run('sndvol32', '', @SW_HIDE)
    $ex = True
    EndIf
    If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1
    $retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked')
    If @error Then Return -2
    If Not $retVal Then
    ControlCommand('[CLASS:Volume Control]', '', $opt, 'Check')
    If @error Then Return -2
    EndIf
    If $ex = True Then WinClose('[CLASS:Volume Control]')
    Return
    EndFunc ;==>_MuteVol

    [/autoit] [autoit][/autoit] [autoit]

    Func _UnMuteVol($opt = 1000)
    Local $retVal = 0, $ex = False
    If Not WinExists('[CLASS:Volume Control]') Then
    Run('sndvol32', '', @SW_HIDE)
    $ex = True
    EndIf
    If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1
    $retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked')
    If @error Then Return -2
    If $retVal Then
    ControlCommand('[CLASS:Volume Control]', '', $opt, 'UnCheck')
    If @error Then Return -2
    EndIf
    If $ex = True Then WinClose('[CLASS:Volume Control]')
    Return
    EndFunc ;==>_UnMuteVol

    [/autoit]
  • wenn ich mic mute, wird auch ein Haken bei "AUS" gesetzt - allerdings bleibt der Ton an *hmmm*

    das entmuten geht dann auch nichtmehr richtig, wenn der Haken rausgenommen wird, bleibt es stumm

    Zitat

    Laughing Man

    "I thought, what I'd do was, I'd pretend I was one of those deaf-mutes"