Jump to content

SoundSetVolume in sound.au3


nobbe
 Share

Recommended Posts

hi

i added a function to the sound.au3

_SoundSetVolume($media, GUICtrlRead($sl), "BASS") ;

_SoundSetVolume($media, GUICtrlRead($sl), "TREBLE") ;

_SoundSetVolume($media, GUICtrlRead($sl), "LEFT") ;

_SoundSetVolume($media, GUICtrlRead($sl), "RIGHT") ;

_SoundSetVolume($media, GUICtrlRead($sl)) ;

where bass and treble dont always seem to work ..

;===============================================================================
;
; Function Name:   _SoundSetVolume
; Description::    Set the Volume and Bass / Treble for a soundfile
; Parameter(s):    $sSnd_id     - Sound ID returned by _SoundOpen
;                  $iVol        - the volume for the file 0-100
;                   $sName = "" : (default) set both channel
;                           LEFT    :  set left channel
;                           RIGHT   :  set right channel
;                           BASS    :  set BASS 0 - 100
;                           TREBLE  :  set TREBLE 0 - 100
;
; Requirement(s):  AutoIt 3.2 ++
; Author(s):       Nobbe
;
;===============================================================================
Func _SoundSetVolume($sSnd_id, $iVol, $sName = "")
    
    ;Declare variables
    Local $iRet

    If $iVol >= 0 And $iVol <= 100 Then
        $iVol *= 10 ; vol goes here from 0 - 1000
    EndIf

    Switch $sName
        Case "LEFT"
            $iRet = mciSendString("setaudio " & $sSnd_id & " left volume to " & $iVol & " wait")

        Case "RIGHT"
            $iRet = mciSendString("setaudio " & $sSnd_id & " right volume to " & $iVol & " wait")

        Case "BASS"
            $iRet = mciSendString("setaudio " & $sSnd_id & " bass to " & $iVol & " wait")

        Case "TREBLE"
            $iRet = mciSendString("setaudio " & $sSnd_id & " treble to " & $iVol & " wait")

        Case Else ; default 0 "" 
            $iRet = mciSendString("setaudio " & $sSnd_id & " volume to " & $iVol & " wait")
    EndSwitch

    ;return
    If $iRet = 0 Then
        Return 1
    Else
        Return SetError(1, 0, 0)
    EndIf
EndFunc   ;==>_SoundSetVolume
Edited by nobbe
Link to comment
Share on other sites

This looks very good. I am using my PSP at the moment so I will test later.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

Unfortunately this command is only meant for Digital Video and VCR devices. It does not work for me anyway.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
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...