| Lahace |
| | bene ecco un programmino utile nel caso vogliate estrarre delle canzoni dall'ipod (se non fosse noto con iTunes non si può) è ancora da perfezionare (si può salvare una canzone alla volta e non si possono ordinare per nome :\) ma per il momento funziona benone crediti a me a ad aaly che mi ha spiegato come prendere la musica e le qualche funzione da cui prendere spunto se qualcuno sapesse aiutarmi riguardo al fatto dell'ordine nella lista gliene sarei grato source: CODICE #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=iPod Discover.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <ListBoxConstants.au3> #include <StaticConstants.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> #include <TabConstants.au3> #include <file.au3> #include <sound.au3> #include "audio.au3" If IniRead(@ScriptDir & "\settings.ini" , "istance" , "istance" , "no") = "si" Then MsgBox(0 , "iPod Discover! - Attention!" , "è ammessa solo un istanza di iPod Discover!") Exit EndIf IniWrite(@ScriptDir & "\settings.ini" , "istance" , "istance" , "si") Local $sOpen, $sPlay, $sett, $Buttonann, $Buttonapp, $Buttonok, $wState = False, $Pause = False, $elen = 0, $iPodDriver Local $IniDir = @ScriptDir & "\settings.ini" $wState = False $sState = False $totdriver = DriveGetDrive("REMOVABLE") If IsArray($totdriver) Then For $s = 1 To $totdriver[0] If FileExists($totdriver[$s] & "\iPod_Control\Music") Then Local $iPodDriver = $totdriver[$s] $s = $totdriver[0] EndIf Next EndIf If Not FileExists($IniDir) Then _FileCreate($IniDir) FileSetAttrib($IniDir , "H" , 1) If @error Then MsgBox(0 , "" , @error) EndIf $gui = GUICreate("iPod Discover! 1.1", 6a10, 261, 193, 125);, 0x00040000) $List1 = GUICtrlCreateListView("Titolo |Autore |Album ", 0, 56, 610, 175 , -1) ;, 0x00000010) GUICtrlSetState(-1 , $GUI_DROPACCEPTED) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) ;GUICtrlSetBkColor(-1 , 0xd1e7fb) If $iPodDriver <> "" Then $Entrata = GUICtrlCreateCombo(StringUpper($iPodDriver), 8, 16, 105, 25) $combostring = "A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:|" $repstring = StringReplace(StringLower($combostring) , "|" & $iPodDriver , "") $Hrepstring = StringUpper($repstring) GUICtrlSetData(-1, $Hrepstring) Else $Entrata = GUICtrlCreateCombo(StringUpper($iPodDriver), 8, 16, 105, 25) GUICtrlSetData(-1,"A:|B:|C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|X:|Y:|Z:|") EndIf $Button4 = GUICtrlCreateButton("Trova le canzoni!", 128, 16, 105, 17, 0) $Label1 = GUICtrlCreateLabel("Elementi:", 454, 6, 47, 17) $Label2 = GUICtrlCreateLabel("0", 500, 6, 20, 17) $Icon1 = GUICtrlCreateIcon(@ScriptDir & "\iPod Discover.ico", 0, 290, -5, 72, 72) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem3 = GUICtrlCreateMenuItem("Salva Canzone", $MenuItem1) ;$MenuItem4 = GUICtrlCreateMenuItem("Salva tutte", $MenuItem1) $MenuItem7 = GUICtrlCreateMenuItem("Informazioni dispositivo" , $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("Chiudi", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("Strumenti") $MenuItem6 = GUICtrlCreateMenuItem("Impostazioni...", $MenuItem2) $Progress1 = GUICtrlCreateProgress(0, 232, 610, 9) $sett = GUICreate("iPod Discover Settings", 304, 293, 361, 134) $Tab1 = GUICtrlCreateTab(0, 3, 302, 264) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT) GUICtrlCreateTabItem("Formati") $lab = GUICtrlCreateLabel("N.B. non tutti i formati sono riprodicibili", 15, 230, 182, 17) $Group1 = GUICtrlCreateGroup("Formati", 10, 25, 261, 226) $Checkbox1 = GUICtrlCreateCheckbox("Mp3", 25, 50, 41, 16) $Checkbox2 = GUICtrlCreateCheckbox("Mp4", 155, 50, 41, 16) $Checkbox3 = GUICtrlCreateCheckbox("FLAC", 25, 90, 51, 16) $Checkbox4 = GUICtrlCreateCheckbox("WMA", 155, 85, 46, 16) $Checkbox5 = GUICtrlCreateCheckbox("AAC", 25, 125, 41, 21) $Checkbox6 = GUICtrlCreateCheckbox("Mp2", 155, 125, 41, 21) $Checkbox7 = GUICtrlCreateCheckbox("MMF", 25, 160, 46, 21) $Checkbox8 = GUICtrlCreateCheckbox("AMR", 155, 160, 46, 21) $Checkbox9 = GUICtrlCreateCheckbox("WAV", 25, 205, 51, 21) $Checkbox10 = GUICtrlCreateCheckbox("OGG", 155, 205, 46, 21) GUICtrlCreateGroup("", -99, -99, 1, 1) GUICtrlCreateTabItem("Crediti") GUICtrlCreateLabel("iPod Discover! creato da Lahace e Aaly" & @CRLF & "N.B. non tutti i formati sono riproducibili", 50, 50) GUICtrlCreateTabItem("") $Buttonok = GUICtrlCreateButton("OK", 35, 270, 81, 21, 0) $Buttonapp = GUICtrlCreateButton("Applica", 120, 270, 86, 21, 0) $Buttonann = GUICtrlCreateButton("Annulla", 210, 270, 91, 21, 0) $pos = WinGetPos($gui) $Sgui = GUICreate("Sgui", 202, 147,$pos[0] + 415, $pos[1]-45 , $WS_POPUP, BitOR($WS_EX_MDICHILD,$WS_EX_DLGMODALFRAME), $gui) ;$pos[0] + 420, $pos[1] - 45 coord finali $Button1 = GUICtrlCreateButton("Play", 5, 20, 81, 31, 0) $Button2 = GUICtrlCreateButton("Pause", 5, 60, 81, 31, 0) $Button3 = GUICtrlCreateButton("Stop", 5, 100, 81, 31, 0) $Label3 = GUICtrlCreateLabel("00:00:00", 90, 5, 50, 15) GUICtrlSetBkColor(-1 , $GUI_BKCOLOR_TRANSPARENT) $Label4 = GUICtrlCreateLabel("/00:00:00", 135, 5, 50, 17) GUICtrlSetBkColor(-1 , $GUI_BKCOLOR_TRANSPARENT) $Slider1 = GUICtrlCreateSlider(105, 40, 26, 86, BitOR($TBS_VERT,$TBS_AUTOTICKS)) $Label5 = GUICtrlCreateLabel("0", 140, 70, 20, 17) GUICtrlSetBkColor(-1 , $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetData($Slider1 , _SoundGetWaveVolume()) WinSetTrans($sgui , "" , 0) GUISetState(@SW_SHOW , $sgui) GUISetState(@SW_SHOW , $gui) While 1 Sleep(25) SoundSetWaveVolume(GUICtrlRead($slider1)) GUICtrlSetData($Label5 , GUICtrlRead($Slider1)) GUICtrlSetData($Label3 , _SoundPos($sOpen)) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE If $wState = True Then GUIDelete($sett) $wState = False Else IniWrite(@ScriptDir & "\settings.ini" , "istance" , "istance" , "no") Exit EndIf Case $MenuItem5 IniWrite(@ScriptDir & "\settings.ini" , "istance" , "istance" , "no") Exit Case $Button4 $inirsec = IniReadSection($IniDir , "Format") For $o = 1 To $inirsec[0][0] If $inirsec[$o][1] = "si" Then _IpodSongSearch("." & $inirsec[$o][0]) EndIf next SoundPlay("C:\Windows\Media\tada.wav") If _Slidegetstate() = False Then _SlideAppear() EndIf Case $Button1 If GUICtrlRead(GUICtrlRead($List1)) <> "" Then If $Pause = False Then $read = GUICtrlRead(GUICtrlRead($List1)) $split = StringSplit($read, "|") $song = IniRead($IniDir, $split[2], $split[1], "") _SoundStop($sOpen) $sOpen = _SoundOpen($song) _SoundPlay($sOpen) GUICtrlSetData($label4 ,"/" & _SoundLength($sOpen)) ElseIf $Pause = True Then _SoundResume($sOpen) $Pause = False EndIf Else ; EndIf Case $MenuItem6 If IniRead($IniDir, "Format", "Mp3", "no") = "si" Then GUICtrlSetState($Checkbox1, 1) EndIf If IniRead($IniDir, "Format", "Mp4", "no") = "si" Then GUICtrlSetState($Checkbox2, 1) EndIf If IniRead($IniDir, "Format", "FLAC", "no") = "si" Then GUICtrlSetState($Checkbox3, 1) EndIf If IniRead($IniDir, "Format", "WMA", "no") = "si" Then GUICtrlSetState($Checkbox4, 1) EndIf If IniRead($IniDir, "Format", "AAC", "no") = "si" Then GUICtrlSetState($Checkbox5, 1) EndIf If IniRead($IniDir, "Format", "Mp2", "no") = "si" Then GUICtrlSetState($Checkbox6, 1) EndIf If IniRead($IniDir, "Format", "MMF", "no") = "si" Then GUICtrlSetState($Checkbox7, 1) EndIf If IniRead($IniDir, "Format", "AMR", "no") = "si" Then GUICtrlSetState($Checkbox8, 1) EndIf If IniRead($IniDir, "Format", "WAV", "no") = "si" Then GUICtrlSetState($Checkbox9, 1) EndIf If IniRead($IniDir, "Format", "OGG", "no") = "si" Then GUICtrlSetState($Checkbox10, 1) EndIf GUISetState(@SW_SHOW, $sett) $wState = True Case $Buttonann GUIDelete($sett) $wState = False Case $Buttonapp _app() Case $Buttonok _app() GUIDelete($sett) $wState = False Case $MenuItem3 _SaveOne() Case $Button2 _SoundPause($sOpen) $Pause = True Case $Button3 _SoundStop($sOpen) Case $MenuItem7 If GUICtrlRead($Entrata) <> "" Then MsgBox(0 , "Informazioni iPod" , "File system: " & DriveGetFileSystem(GUICtrlRead($Entrata)) & @CRLF & "Codice Seriale: " & DriveGetSerial(GUICtrlRead($Entrata)) & @CRLF & "Status: " & DriveStatus(GUICtrlRead($Entrata)) & @CRLF & "Spazio Totale: " & Round(DriveSpaceTotal(GUICtrlRead($Entrata))) & " MB" & @CRLF & "Spazio Disponibile: " & Round(DriveSpaceFree(GUICtrlRead($Entrata))) & " MB") EndIf EndSwitch WEnd
Func _IpodSongSearch($oFormat) GUICtrlSetData($Progress1, 0) Local $dir, $search, $propeties, $oMusdir For $i = 0 To 13 If $i < 10 Then $oMusdir = 'F0' & $i $search = FileFindFirstFile(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\*" & $oFormat) While 1 $next = FileFindNextFile($search) If @error Then ExitLoop $propeties1 = _GetExtProperty(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next, 13);artista If $propeties1 = "0" Then $propeties1 = "Artista Sconosciuto" $propeties2 = _GetExtProperty(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next, 21);titolo If $propeties2 = "0" Then $propeties2 = "Titolo Sconosciuto" $propeties3 = _GetExtProperty(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next, 14);album If $propeties3 = "0" Then $propeties3 = "Album Sconosciuto" GUICtrlCreateListViewItem($propeties2 & "|" & $propeties1 & "|" & $propeties3, $List1) GUICtrlSetBkColor(-1 , 0xdfe9f3) IniWrite($IniDir, $propeties1, $propeties2, GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next) $elen += 1 GUICtrlSetData($Label2, $elen) WEnd FileClose($search) $perc = ($i/13)*100 GUICtrlSetData($Progress1, $perc) Else $oMusdir = 'F' & $i $search = FileFindFirstFile(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\*" & $oFormat) While 1 $next = FileFindNextFile($search) If @error Then ExitLoop $propeties1 = _GetExtProperty(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next, 13) If $propeties1 = "0" Then $propeties1 = "Artista Sconosciuto" $propeties2 = _GetExtProperty(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next, 21) If $propeties2 = "0" Then $propeties2 = "Titolo Sconosciuto" $propeties3 = _GetExtProperty(GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next, 14) If $propeties3 = "0" Then $propeties3 = "Album Sconosciuto" GUICtrlCreateListViewItem($propeties2 & "|" & $propeties1 & "|" & $propeties3, $List1) GUICtrlSetBkColor(-1 , 0xdfe9f3);bfd9f1 IniWrite($IniDir, $propeties1, $propeties2, GUICtrlRead($Entrata) & "\iPod_Control\Music\" & $oMusdir & "\" & $next) $elen += 1 GUICtrlSetData($Label2, $elen) WEnd FileClose($search) $perc = ($i/13)*100 GUICtrlSetData($Progress1, $perc) EndIf Next GUICtrlSetData($Progress1, 100) EndFunc ;==>_IpodSongSearch
Func _app() If GUICtrlRead($Checkbox1) = 1 Then IniWrite($IniDir, "Format", "Mp3", "si") Else IniWrite($IniDir, "Format", "Mp3", "no") EndIf If GUICtrlRead($Checkbox2) = 1 Then IniWrite($IniDir, "Format", "Mp4", "si") Else IniWrite($IniDir, "Format", "Mp4", "no") EndIf If GUICtrlRead($Checkbox3) = 1 Then IniWrite($IniDir, "Format", "FLAC", "si") Else IniWrite($IniDir, "Format", "FLAC", "no") EndIf If GUICtrlRead($Checkbox4) = 1 Then IniWrite($IniDir, "Format", "WMA", "si") Else IniWrite($IniDir, "Format", "WMA", "no") EndIf If GUICtrlRead($Checkbox5) = 1 Then IniWrite($IniDir, "Format", "AAC", "si") Else IniWrite($IniDir, "Format", "AAC", "no") EndIf If GUICtrlRead($Checkbox6) = 1 Then IniWrite($IniDir, "Format", "Mp2", "si") Else IniWrite($IniDir, "Format", "Mp2", "no") EndIf If GUICtrlRead($Checkbox7) = 1 Then IniWrite($IniDir, "Format", "MMF", "si") Else IniWrite($IniDir, "Format", "MMF", "no") EndIf If GUICtrlRead($Checkbox8) = 1 Then IniWrite($IniDir, "Format", "AMR", "si") Else IniWrite($IniDir, "Format", "AMR", "no") EndIf If GUICtrlRead($Checkbox9) = 1 Then IniWrite($IniDir, "Format", "WAV", "si") Else IniWrite($IniDir, "Format", "WAV", "no") EndIf If GUICtrlRead($Checkbox10) = 1 Then IniWrite($IniDir, "Format", "OGG", "si") Else IniWrite($IniDir, "Format", "OGG", "no") EndIf EndFunc ;==>_app Func _SaveOne() Local $sav, $SavDir, $lSplit, $SavIniRead $sav = GUICtrlRead(GUICtrlRead($List1)) If $sav <> "" Then $k = 1 While $k = 1 $SavDir = FileSelectFolder("Seleziona Cartella Per il Salvataggio", "") If $SavDir <> "" Then $k = 0 Else MsgBox(0, "Errore", "Nessuna directory selezionata") EndIf WEnd $lSplit = StringSplit($sav, "|") $SavIniRead = IniRead($IniDir, $lSplit[2], $lSplit[1], "") If $SavIniRead <> "" Then $pSplit = StringSplit($SavIniRead, ".")
FileCopy($SavIniRead, $SavDir & "\" & $lSplit[1] & "." & $pSplit[$pSplit[0]]) Else MsgBox(0, "Errore!", "Errore nel salvataggio!") EndIf EndIf EndFunc ;==>_SaveOne
Func _SlideAppear() For $i = 0 to 255 step 25 WinSetTrans($sgui , "" , $i) Sleep(150) Next $sState = True EndFunc Func _SlideDisappear() For $i = 255 to 0 step -25 WinSetTrans($sgui , "" , $i) Sleep(150) Next $sState = False EndFunc Func _GetExtProperty($sPath, $iProp); presa dal forum ufficiale di autoit. Local $iExist, $sFile, $sDir, $oShellApp, $oDir, $oFile, $aProperty, $sProperty $iExist = FileExists($sPath) If $iExist = 0 Then SetError(1) Return 0 Else $sFile = StringTrimLeft($sPath, StringInStr($sPath, "\", 0, -1)) $sDir = StringTrimRight($sPath, (StringLen($sPath) - StringInStr($sPath, "\", 0, -1))) $oShellApp = ObjCreate("shell.application") $oDir = $oShellApp.NameSpace($sDir) $oFile = $oDir.Parsename($sFile) If $iProp = -1 Then Local $aProperty[35] For $i = 0 To 34 $aProperty[$i] = $oDir.GetDetailsOf($oFile, $i) Next Return $aProperty Else $sProperty = $oDir.GetDetailsOf($oFile, $iProp) If $sProperty = "" Then Return 0 Else Return $sProperty EndIf EndIf EndIf EndFunc ;==>_GetExtPropert
Func _Slidegetstate() Return $sState EndFunc source iFix (per riparare eventuali bug) CODICE #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=iFix.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3>
$Form1 = GUICreate("iFix", 155, 144) $Radio1 = GUICtrlCreateRadio("Istanza", 15, 10, 61, 16) $Radio2 = GUICtrlCreateRadio("Reset", 15, 35, 61, 16) $Radio3 = GUICtrlCreateRadio("Find Button Crash", 15, 60, 106, 16) $Button1 = GUICtrlCreateButton("Fix", 45, 115, 61, 21, 0) GUISetState(@SW_SHOW)
While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($radio1) = 1 Then IniWrite(@ScriptDir & "\settings.ini" , "istance" , "istance" , "no") If @error Then MsgBox(0 , "Errore" , "Id Errore: " & @error & " FIX_ISTANCE") Else MsgBox(0 , "iFix" , "Completato!") EndIf ElseIf GUICtrlRead($radio2) = 1 Then FileDelete(@ScriptDir & "\settings.ini") _FileCreate(@ScriptDir & "\settings.ini") IniWrite(@ScriptDir & "\settings.ini" , "istance" , "istance" , "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "Mp3", "si") IniWrite(@ScriptDir & "\settings.ini", "Format", "Mp4", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "FLAC", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "WMA", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "AAC", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "Mp2", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "MMF", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "AMR", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "WAV", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "OGG", "no") If @error Then MsgBox(0 , "Errore" , "Id Errore: " & @error & " FIX_RESET") Else MsgBox(0 , "iFix" , "Completato!") EndIf ElseIf GUICtrlRead($radio3) = 1 Then IniWrite(@ScriptDir & "\settings.ini", "Format", "Mp3", "si") IniWrite(@ScriptDir & "\settings.ini", "Format", "Mp4", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "FLAC", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "WMA", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "AAC", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "Mp2", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "MMF", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "AMR", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "WAV", "no") IniWrite(@ScriptDir & "\settings.ini", "Format", "OGG", "no") If @error Then MsgBox(0 , "Errore" , "Id Errore: " & @error & " FIX_F_BUTTON") Else MsgBox(0 , "iFix" , "Completato!") EndIf EndIf EndSwitch WEnd Include (audio.au3) CODICE #cs Audio.au3 Designed by Gary Frost, RazerM, and a little help from Volly Version info: 1.0.0.0 History: 1.0.0.0 - first release
------------------------------------------- Items to add: 1. Mute for master volume. 2. Mute for input Microphone 3. Mute for Wave 4. Balance on Master, Wave, Microphone ------------------------------------------- The following code is a proposed replacement for sound.au3. Current functions work as expected following testing on XP pc. No test have been performed on other operating systems. -------------------------------------------
Functions: _SoundSetMasterVolume($iVolume) - Sets the Master Volume. Does not control an application's volume _SoundGetMasterVolume - Gets the Master Volume level _SoundSetMicrophoneVolume - Sets the Microphone input volume _SoundGetMicrophoneVolume - Gets the Microphone volume level _SoundGetPhoneVolume - Gets the Phone volume on the modem _SoundSetVolumeCD - Sets the Volume level on the CDRom _SoundSetMasterWaveVolume - Sets the Master Wave Volume level
#ce
#region Const $MMSYSERR_NOERROR = 0 Const $WAVERR_BASE = 32 Const $WAVERR_BADFORMAT = ($WAVERR_BASE + 0) Const $MAXPNAMELEN = 32
Const $MIXERLINE_COMPONENTTYPE_DST_FIRST = 0 Const $MIXER_GETLINEINFOF_COMPONENTTYPE = 3 Const $MIXERLINE_COMPONENTTYPE_DST_UNDEFINED = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 0) Const $MIXERLINE_COMPONENTTYPE_DST_DIGITAL = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 1) Const $MIXERLINE_COMPONENTTYPE_DST_LINE = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 2) Const $MIXERLINE_COMPONENTTYPE_DST_MONITOR = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 3) Const $MIXERLINE_COMPONENTTYPE_DST_SPEAKERS= ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 4) Const $MIXERLINE_COMPONENTTYPE_DST_HEADPHONES = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 5) Const $MIXERLINE_COMPONENTTYPE_DST_TELEPHONE = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 6) Const $MIXERLINE_COMPONENTTYPE_DST_WAVEIN = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 7) Const $MIXERLINE_COMPONENTTYPE_DST_VOICEIN = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 8) Const $MIXERLINE_COMPONENTTYPE_DST_LAST = ($MIXERLINE_COMPONENTTYPE_DST_FIRST + 8)
Const $MIXERLINE_COMPONENTTYPE_SRC_FIRST = 0x1000 Const $MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 0) Const $MIXERLINE_COMPONENTTYPE_SRC_DIGITAL = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 1) Const $MIXERLINE_COMPONENTTYPE_SRC_LINE = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 2) Const $MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE= ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 3) Const $MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 4) Const $MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 5) Const $MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 6) Const $MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 7) Const $MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 8) Const $MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 9) Const $MIXERLINE_COMPONENTTYPE_SRC_ANALOG = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10) Const $MIXERLINE_COMPONENTTYPE_SRC_LAST = ($MIXERLINE_COMPONENTTYPE_SRC_FIRST + 10)
Const $MIXER_GETLINEINFOF_SOURCE = 1
Const $MIXER_GETLINEINFOF_DESTINATION = 0 Const $MIXER_GETLINEINFOF_LINEID = 2 Const $MIXERCONTROL_CT_SC_LIST_SINGLE = 0x00000000 Const $MIXERCONTROL_CT_CLASS_LIST = 0x70000000 Const $MIXERCONTROL_CT_SC_LIST_MULTIPLE = 0x01000000 Const $MIXERCONTROL_CT_UNITS_BOOLEAN = 0x00010000 Const $MIXERCONTROL_CT_CLASS_MASK = 0xF0000000 Const $MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT = BitOR($MIXERCONTROL_CT_CLASS_LIST, $MIXERCONTROL_CT_SC_LIST_MULTIPLE, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_MIXER = ($MIXERCONTROL_CONTROLTYPE_MULTIPLESELECT + 1) Const $MIXERCONTROL_CONTROLTYPE_SINGLESELECT = BitOR($MIXERCONTROL_CT_CLASS_LIST, $MIXERCONTROL_CT_SC_LIST_SINGLE, $MIXERCONTROL_CT_UNITS_BOOLEAN) Const $MIXERCONTROL_CONTROLTYPE_MUX = ($MIXERCONTROL_CONTROLTYPE_SINGLESELECT + 1) Const $MIXER_GETCONTROLDETAILSF_VALUE = 0 Const $MIXER_SETCONTROLDETAILSF_VALUE = 0 Const $MIXERCONTROL_CONTROLF_UNIFORM = 1 Const $MIXERCONTROL_CONTROLF_MULTIPLE = 2
Const $MIXERCONTROL_CT_SC_METER_POLLED = 0 Const $MIXERCONTROL_CT_CLASS_METER = 0x10000000 Const $MIXERCONTROL_CT_UNITS_SIGNED = 0x20000 Const $MIXERCONTROL_CT_UNITS_UNSIGNED = 0x30000 Const $MIXERCONTROL_CT_CLASS_FADER = 0x50000000 Const $MIXERCONTROL_CT_CLASS_NUMBER = 0x30000000 Const $MIXERCONTROL_CONTROLTYPE_FADER = BitOR($MIXERCONTROL_CT_CLASS_FADER, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_VOLUME= ($MIXERCONTROL_CONTROLTYPE_FADER + 1) Const $MIXERCONTROL_CONTROLTYPE_UNSIGNEDMETER = BitOR($MIXERCONTROL_CT_CLASS_METER, $MIXERCONTROL_CT_SC_METER_POLLED, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_UNSIGNED = BitOR($MIXERCONTROL_CT_CLASS_NUMBER, $MIXERCONTROL_CT_UNITS_UNSIGNED) Const $MIXERCONTROL_CONTROLTYPE_SIGNED = BitOR($MIXERCONTROL_CT_CLASS_NUMBER, $MIXERCONTROL_CT_UNITS_SIGNED)
Const $MIXER_OBJECTF_WAVEIN = 0x20000000 Const $MIXER_SHORT_NAME_CHARS = 16 Const $MIXER_LONG_NAME_CHARS = 64 Const $MIXER_GETLINECONTROLSF_ALL = 0 Const $MIXER_GETLINECONTROLSF_ONEBYID = 1 Const $MIXER_GETLINECONTROLSF_ONEBYTYPE = 2 Const $MIXER_OBJECTF_HANDLE = 0x80000000 Const $MIXER_OBJECTF_MIXER = 0 Const $MIXER_OBJECTF_HMIXER = BitOR($MIXER_OBJECTF_HANDLE, $MIXER_OBJECTF_MIXER) Const $MIXER_GETCONTROLDETAILSF_LISTTEXT = 1 Const $CALLBACK_NULL = 0 Const $WAVE_MAPPED = 4
Const $wMid = 1 Const $wPid = 2 Const $vDriverVersion = 3 Const $szPname = 4 Const $dwFormats = 5 Const $wChannels = 6 Const $wReserved1 = 7 Const $AWICAPS_SIZEOF = $wReserved1 + 1
;mixer Const $fdwSupport = 5 Const $cDestinations = 6 Const $AMXCAPS_SIZEOF = $cDestinations + 2 ;leave room for num cells
;line struct Const $cbStruct = 1 Const $dwDestination = 2 Const $dwSource = 3 Const $dwLineID = 4 Const $fdwLine = 5 Const $dwUser = 6 Const $dwComponentType = 7 Const $cChannels = 8 Const $cConnections = 9 Const $cControls = 10 Const $szShortName = 11 Const $szName = 12 Const $dwType = 13 Const $dwDeviceID = 14 Const $wMMid = 15 Const $wMPid = 16 Const $vMDriverVersion = 17 Const $szMPname = 18 $AMXLINE_SIZEOF = $szMPname + 2
Const $cbCStruct = 1 Const $dwCLineID = 2 Const $dwControlID = 3 Const $dwControlType = 4 Const $cCControls = 5 Const $cbmxctrl = 6 Const $pamxctrl = 7 Const $MXXTRLS_SIZEOF = $pamxctrl + 2
Const $lst_destname = 1 Const $lst_dwComponentType = 2 Const $lst_ctrid = 3
Const $MIX_HMXOBJ = 1 Const $MIX_DEVNAME = 2 Const $MIX_CAPCDEST = 3 Const $MIX_RECNAME = 4 Const $MIX_CCONNECTIONS = 5 Const $MIX_INCCONTROLS = 6 Const $MIX_DWLINEID = 7 Const $MIX_INCHANNELS = 8 Const $MIX_INMULTIITEMS = 9 Const $MIX_INCTRLID = 10 Const $MIX_OUTCHANNELS = 11 Const $MIX_OUTMULTIEMS = 12 Const $MIX_OUTCTRLID = 13 Const $MIX_LAST = $MIX_OUTCTRLID + 1 Const $AMIX_SIZEOF = $MIX_LAST + 1 Dim $mxline[$AMXLINE_SIZEOF] Dim $mixers[1][$AMIX_SIZEOF] Dim $mxInList[2][4] $mixernames = "" $FormSelectInput = 0 $TV_SelectInput = 0 $CMB_DevName = 0 $CKB_EnableLinefocus = 0 $defaultmixer = 0 $lastlinesrc = -1 $curmixer = $defaultmixer ;=============================================================================== #endregion ;=============================================================================== ; ; Function Name: _SoundSetMasterVolume ; Description:: Sets the Master Volume. Does not control an application's volume ; Parameter(s): $$iVolume - % to set ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 - Success, 0 - Failure ; Author(s): Volly ; Example: _SoundSetMasterVolume(100) ; ;=============================================================================== ; func _SoundSetMasterVolume($iVolume) _SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, $iVolume) If @error Then SetExtended(0) Return(@extended) else SetExtended(1) Return(@extended) endif EndFunc
;=============================================================================== ; ; Function Name: _SoundGetMasterVolume ; Description:: Gets the Master Volume level ; Parameter(s): none ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 to 100 - Success, -1 - Failure ; Author(s): Volly ; Example: _SoundGetMasterVolume() ; ;=============================================================================== ; func _SoundGetMasterVolume() $percent = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_SPEAKERS) If @error Then SetExtended(-1) Return(@extended) else SetExtended($percent) Return(@extended) endif EndFunc
;=============================================================================== ; ; Function Name: _SoundSetMicrophoneVolume ; Description:: Sets the Microphone input volume ; Parameter(s): $iVolume - % to set ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 - Success, 0 and @error = 1 - Failure ; Author(s): Volly ; Example: _SoundSetMicrophoneVolume(50) ; ;=============================================================================== ; func _SoundSetMicrophoneVolume($iVolume) _SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, $iVolume) If @error Then Exit else SetExtended(1) Return(@extended) endif EndFunc
;=============================================================================== ; ; Function Name: _SoundGetMicrophoneVolume ; Description:: Gets the Microphone volume level ; Parameter(s): none ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 to 100 - Success, -1 - Failure ; Author(s): Volly ; Example: _SoundGetMicrophoneVolume() ; ;=============================================================================== ; func _SoundGetMicrophoneVolume() $percent = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE) If @error Then SetExtended(-1) Return(@extended) else SetExtended($percent) Return(@extended) endif EndFunc
;=============================================================================== ; ; Function Name: _SoundGetPhoneVolume ; Description:: Gets the Phone volume on the modem ; Parameter(s): none ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 to 100 - Success, -1 - Failure ; Author(s): Volly ; Example: _SoundGetPhoneVolume() ; Notes: Some modems may not report volume levels. You will need to test. ; ;=============================================================================== ; func _SoundGetPhoneVolume() $percent = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE) If @error Then SetExtended(-10) Return(@extended) else SetExtended($percent) Return(@extended) endif EndFunc
;=============================================================================== ; ; Function Name: _SoundSetVolumeCD ; Description:: Sets the Volume level on the CDRom ; Parameter(s): $iVolume - % to set ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 to 100 - Success, -1 - Failure ; Author(s): Volly ; Example: _SoundSetVolumeCD(45) ; ;=============================================================================== func _SoundSetVolumeCD($iVolume) _SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC, $iVolume) If @error Then Exit else SetExtended(1) Return(@extended) endif EndFunc
;=============================================================================== ; ; Function Name: _SoundSetMasterWaveVolume ; Description:: Sets the Master Wave Volume level. ; Parameter(s): $iVolume - % to set ; Requirement(s): AutoIt 3.2 ++ ; Return Value(s): 1 to 100 - Success, -1 - Failure ; Author(s): Volly ; Example: _SoundSetMasterWaveVolume(60) ; ;=============================================================================== func _SoundSetMasterWaveVolume($iVolume) _SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, $iVolume) If @error Then Exit else SetExtended(1) Return(@extended) endif EndFunc
;=============================================================================== ; ; Internal Functions ; ;=============================================================================== Func mciSendString($string) Local $iRet $iRet = DllCall("winmm.dll", "int", "mciSendStringA", "str", $string, "str", "", "int", 65534, "hwnd", 0) If Not @error Then Return $iRet[2] EndFunc ;==>mciSendString
Func RandomStr($len) Local $string For $iCurrentPos = 1 To $len $string &= Chr(Random(97, 122, 1)) Next Return $string EndFunc ;==>RandomStr
Func _SetMixerVolume($MixerDevice, $percent) ;default mixer is always 0 (so far) which is last audio device installed or prefered deviced selected by user SetExtended(10) $curmixer = 0 Const $MM_MIXM_CONTROL_CHANGE = 0x3D1 Const $CALLBACK_WINDOW = 0x10000 OpenAllMixers($mixers) If @error Then Exit $hmxobj = MixerOpen($curmixer, 0, $MM_MIXM_CONTROL_CHANGE, BitOR($CALLBACK_WINDOW, $MIXER_OBJECTF_MIXER)) GetMXWaveoutID($mixers, $curmixer, $MixerDevice) _SetVolume($mixers, $curmixer, $percent) MixerClose($hmxobj) CloseAllMixers($mixers) SetExtended(1) Return(@extended) EndFunc ;==>_SetMixerVolume
Func _GetMixerVolume($MixerDevice) ;default mixer is always 0 (so far) which is last audio device installed or prefered deviced selected by user $curmixer = 0 Const $MM_MIXM_CONTROL_CHANGE = 0x3D1 Const $CALLBACK_WINDOW = 0x10000 OpenAllMixers($mixers) If @error Then Exit $hmxobj = MixerOpen($curmixer, 0, $MM_MIXM_CONTROL_CHANGE, BitOR($CALLBACK_WINDOW, $MIXER_OBJECTF_MIXER)) GetMXWaveoutID($mixers, $curmixer, $MixerDevice) $savevolume = GetSetOutVolume($mixers, $curmixer, 0, 0) $savevolume = BitAND($savevolume / 0xFFFF * 100, 0xffff)
MixerClose($hmxobj) CloseAllMixers($mixers) Return $savevolume EndFunc ;==>_GetMixerVolume
Func _SetVolume(ByRef $mixers, ByRef $curmixer, ByRef $percent) $x = Mod($percent * 0xffff, 100) $percent = BitAND($percent * 0xffff / 100, 0xffff) $percent = $percent + $x GetSetOutVolume($mixers, $curmixer, $percent) ;this will also trigger callback routine EndFunc ;==>_SetVolume
Func GetSetOutVolume($mixers, $index, $vol = 0, $doset = 1) Local $i, $x, $arraysize, $channels, $mtiems Const $MIXERCONTROLDETAILS_UNSIGNED_SIZEOF = 4 Local $mixercontroldetails = DllStructCreate( _ "dword;" & _ ;DWORD cbStruct "dword;" & _ ;DWORD dwControlID "dword;" & _ ;DWORD cChannels; "dword;" & _ ;HWND hwndOwner DWORD cMultipleItems; "dword;" & _ ;DWORD cbDetails; "dword") ;LPVOID paDetails; If @error Then Return False $mitems = $mixers[$index][$MIX_OUTMULTIEMS] $channels = $mixers[$index][$MIX_OUTCHANNELS] $arraysize = $channels If $mitems Then $arraysize = $channels * $mitems Local $plistbool = DllStructCreate("dword[" & $arraysize + 1 & "]") ;give me one mroe than needed If @error Then Return False $hmxobj = $mixers[$index][$MIX_HMXOBJ] $mxcd = $mixercontroldetails DllStructSetData($mxcd, $cbStruct, DllStructGetSize($mxcd)) DllStructSetData($mxcd, 2, $mixers[$index][$MIX_OUTCTRLID]) DllStructSetData($mxcd, 3, $mixers[$index][$MIX_OUTCHANNELS]) DllStructSetData($mxcd, 4, $mixers[$index][$MIX_OUTMULTIEMS]) DllStructSetData($mxcd, 5, $MIXERCONTROLDETAILS_UNSIGNED_SIZEOF) ;cbDetails to sizeof one unsigned struct DllStructSetData($mxcd, 6, DllStructGetPtr($plistbool)) ;paDetails set ptr $ret = DllCall("winmm.dll", "long", "mixerGetControlDetails", "hwnd", $hmxobj, "ptr", DllStructGetPtr($mxcd), "long", BitOR($MIXER_OBJECTF_HMIXER, $MIXER_GETCONTROLDETAILSF_VALUE)) If @error Then Return False If $ret[0] = $MMSYSERR_NOERROR Then $x = DllStructGetData($plistbool, 1, 1) ;just return right channel For $i = 1 To $arraysize DllStructSetData($plistbool, 1, $vol, $i) ;set left right to same value Next ;i If $doset Then $ret = DllCall("winmm.dll", "long", "mixerSetControlDetails", "hwnd", $hmxobj, "ptr", DllStructGetPtr($mxcd), "long", BitOR($MIXER_OBJECTF_HMIXER, $MIXER_SETCONTROLDETAILSF_VALUE)) Return $x EndIf Return False EndFunc ;==>GetSetOutVolume
Func GetMXWaveoutID(ByRef $mixers, $index, $linetype) Local $mitems, $chans, $hmxobj, $x, $ret, $lineid ;local structures are nuked on exit...so i have read..LOL Local $mixercontrol = DllStructCreate( _ "dword;" & _ ; DWORD cbStruct; "dword;" & _ ; DWORD dwControlID; "dword;" & _ ; DWORD dwControlType; "dword;" & _ ; DWORD fdwControl; "dword;" & _ ; DWORD cMultipleItems; "char[16];" & _ ;szShortName[MIXER_SHORT_NAME_CHARS]; "char[64];" & _ ;szName[MIXER_LONG_NAME_CHARS]; "dword;" & _ ;lMinimum "dword;" & _ ;lMaximum "dword[4];" & _ ;dwReserved[4]; "dword;" & _ ;cSteps "dword[5]") ; DWORD dwReserved[6]; If @error Then Return False Local $mixerlinecontrols = DllStructCreate( _ "dword;" & _ ; cbStruct; "dword;" & _ ; DWORD dwLineID; "dword;" & _ ; DWORD dwControlID DWORD dwControlType; "dword;" & _ ; DWORD cControls; "dword;" & _ ; DWORD cbmxctrl; "ptr") ; LPMIXERCONTROL pamxctrl; If @error Then Return False $hmxobj = $mixers[$index][$MIX_HMXOBJ] zeroline($mxline) $mxline[$dwLineID] = BitOR($index, 0xFFFF0000) $mxline[$dwComponentType] = $linetype MixerGetLineInfo($hmxobj, $mxline, $MIXER_GETLINEINFOF_COMPONENTTYPE) $lineid = $mxline[$dwLineID] DllStructSetData($mixerlinecontrols, $cbStruct, DllStructGetSize($mixerlinecontrols)) DllStructSetData($mixerlinecontrols, 2, $lineid) DllStructSetData($mixerlinecontrols, 3, $MIXERCONTROL_CONTROLTYPE_VOLUME) DllStructSetData($mixerlinecontrols, 4, 1) DllStructSetData($mixerlinecontrols, 5, DllStructGetSize($mixercontrol)) DllStructSetData($mixerlinecontrols, 6, DllStructGetPtr($mixercontrol)) $ret = DllCall("winmm.dll", "long", "mixerGetLineControls", "hwnd", $hmxobj, "ptr", DllStructGetPtr($mixerlinecontrols), "long", BitOR($MIXER_OBJECTF_HMIXER, $MIXER_GETLINECONTROLSF_ONEBYTYPE)) If $ret[0] <> $MMSYSERR_NOERROR Then Return False $chans = $mxline[$cChannels] $x = DllStructGetData($mixercontrol, 4) ;fwControl If BitAND($x, $MIXERCONTROL_CONTROLF_UNIFORM) Then $chans = 1 $mitems = 0 If BitAND($x, $MIXERCONTROL_CONTROLF_MULTIPLE) Then $mitems = DllStructGetData($mixercontrol, 5) $x = DllStructGetData($mixercontrol, 3) ;fwControl If BitAND($x, $MIXERCONTROL_CT_CLASS_FADER) Then $mixers[$index][$MIX_OUTCHANNELS] = $chans $mixers[$index][$MIX_OUTMULTIEMS] = $mitems $mixers[$index][$MIX_OUTCTRLID] = DllStructGetData($mixercontrol, 2) Return True EndIf Return False EndFunc ;==>GetMXWaveoutID
Func zeroline(ByRef $line) Local $i For $i = 0 To UBound($line) - 1 $line[$i] = 0 Next ;i EndFunc ;==>zeroline
Func MixerGetLineInfo($hmxobj, ByRef $line, $flag) Local $mixerline = DllStructCreate ("dword;dword;dword;dword;dword;dword;dword;dword;dword;dword;char[16];char[64];dword;dword;short;short;dword;char[32]") If @error Then SetError(1) Return False EndIf Local $i For $i = 1 To UBound($line) - 1 DllStructSetData($mixerline, $i, $line[$i]) Next ;i DllStructSetData($mixerline, $cbStruct, DllStructGetSize($mixerline)) $ret = DllCall("winmm.dll", "long", "mixerGetLineInfo", "hwnd", $hmxobj, "ptr", DllStructGetPtr($mixerline), "int", $flag) If @error Then SetError(1) Return False EndIf For $i = 1 To $szMPname $line[$i] = DllStructGetData($mixerline, $i) Next ;i If $ret[0] = $MMSYSERR_NOERROR Then Return True SetError(1) Return False EndFunc ;==>MixerGetLineInfo
;On Exit: MIX_HMXOBJ set to return value from mixeropn...check for @error Func OpenAllMixers(ByRef $mixers) Local $i, $mxnumdevs, $hmxobj $mxnumdevs = mixerGetNumDevs() If $mxnumdevs Then ReDim $mixers[$mxnumdevs + 1][$AMIX_SIZEOF] For $i = 0 To $mxnumdevs - 1 $hmxobj = MixerOpen($i, 0, 0, $MIXER_OBJECTF_MIXER) If @error Then SetError(1) Return False EndIf $mixers[$i][$MIX_HMXOBJ] = $hmxobj Next ;i EndIf $mixers[0][0] = $mxnumdevs EndFunc ;==>OpenAllMixers
;On ENtry: mixer id and flag(s) , if no id passed then the preffered id is used (0) ditto for flag ;on exit: mixer handle Func MixerOpen($uMxid = 0, $hwnd = 0, $instance = 0, $fdwOpen = 0) Local $x, $h_struct $h_struct = DllStructCreate("udword") ;since a local will be deleted on exit of function If @error Then SetError(1) Return False EndIf $ret = DllCall("winmm.dll", "long", "mixerOpen", "ptr", DllStructGetPtr($h_struct), "int", $uMxid, "int", $hwnd, "int", $instance, "int", $fdwOpen) If Not @error Then If $ret[0] <> $MMSYSERR_NOERROR Then Return -1 $x = DllStructGetData($h_struct, 1) Return $x EndIf SetError(1) Return False EndFunc ;==>MixerOpen
Func CloseAllMixers($mixers) Local $i, $cnt $cnt = $mixers[0][0] For $i = 0 To $cnt - 1 MixerClose($mixers[$i][$MIX_HMXOBJ]) Next ;i EndFunc ;==>CloseAllMixers
;On Entry: mixer handle Func MixerClose($hmxobj) $ret = DllCall("winmm.dll", "long", "mixerClose", "long", $hmxobj) If Not @error Then Return True Return False EndFunc ;==>MixerClose
Func mixerGetNumDevs() $ret = DllCall("winmm.dll", "long", "mixerGetNumDevs") If Not @error Then Return $ret[0] SetError(1) Return False EndFunc ;==>mixerGetNumDevs
Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret $p = DllStructCreate ("dword") If @error Then SetError(2) Return -2 EndIf $ret = DllCall("winmm.dll", "long", "waveOutGetVolume", "long", -1, "long", DllStructGetPtr ($p)) If ($ret[0] == $MMSYSERR_NOERROR) Then $WaveVol = Round(Dec(StringRight(Hex(DllStructGetData ($p, 1), 8), 4)) / 0xFFFF * 100) Else SetError(1) EndIf $p = 0 Return $WaveVol EndFunc ;==>_SoundGetWaveVolume pacchetto completo: www.megaupload.com/?d=36XAILQMEdited by Lahace - 4/5/2010, 21:18
| | |
| |
|