Jump to content

Playing with Mixer Device


wiredbits
 Share

Recommended Posts

I`ve been trying to disect WireBits code to do something a bit simpler, but I`m having a problem getting my head around the way the various arrays are set up.

What I have so far writes a list of the mixer names to notepad.

If GetAllRecordDevs($mixers,$mxline) Then GetLineConnectionsNames($mixers,$mxInList,$curmixer)
    
NotepadWrite("Number of Mixers " &Ubound ($mxInList))
;MsgBox(0,"",UBound($mxInList))

    For $i=0 To UBound($mxInList)-1
        NotepadWrite ($mxInList[$i][$lst_destname])
    Next

I think I need to use GetSetLineSrc($mixers,$index,$srcindex,$doset=1) somehow to set the input source, I just can`t work how.. :D

$doset = 1 means set a mixer and $doset =0 just gets current mixer?

This is supposed to step through the input mixers, but of course, do`nt work, cuase I do`nt really know what I`m doing here... :P

For $Curmixer = $i to 0
    $i=GetSetLineSrc($mixers,$curmixer,0,0)
;If $i<>$src  Then $Source =GetSetLineSrc($mixers,$curmixer,$src)
MsgBox(0,"",$i)
Next

Any help would be appricated. :)

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

Still playing with this, so I went back to Mr Frosty`s example...

This tests all the mixer controls in the PLAY panel.

CODE
#include <Mixer.au3>

$sounds = "Sounds and Audio Devices Properties"

$Advan = 6667

Run(@ComSpec & " /c " & 'mmsys.cpl', "", @SW_HIDE)

;Display PLAY Mixer panel

WinWait ("Sounds and Audio Devices Properties")

ControlClick($sounds,"","Button4")

ControlClick($sounds,"","Button9")

$Mainvol = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_SPEAKERS) ;Changes main Volume Control slider

For $n = 1 to 4

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, 1)

Sleep (1000)

beep(400,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_SPEAKERS, $MainVol)

Sleep (1000)

next

#cs

$Wave = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_WAVEIN); same as main vol control

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_WAVEIN, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_WAVEIN, $Wave)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Voice = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_VOICEIN); Does`nt do anything on my play panel (expected really)

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_VOICEIN, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_VOICEIN, $Voice)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$DigitalSrc = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_DIGITAL); S/PDIF-in

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_DIGITAL, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_DIGITAL, $DigitalSrc)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$LineIn = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_LINE); Line - in/Mic-in2

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_LINE, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_LINE, $LineIn)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Mic = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE);Mic

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE, $Mic)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Synth = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER);Midi Synth

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER, $Synth)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$CD = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC);Compact disc of Course! :P

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC, $CD)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$PcSpkr = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER);I have a PC Speaker on my mixer, but this has no effect..

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER, $PcSpkr)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Wave = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT); Wave

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT, $Wave)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Alog = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_ANALOG);Aux2 on my panel

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_ANALOG, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_ANALOG, $Alog)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$UDef = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED);Wave on record Panel!

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED, $UDef)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$UDef = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_LAST);Aux 2 again

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_LAST, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_LAST, $UDef)

Sleep (1000)

beep(400,100)

next

#ce

Exit ;Stop Here!!

#cs

$Line = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_LINE); Does`nt do anything on my play panel

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_LINE, 50)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_LINE, $Line)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Digital = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_DIGITAL); Does`nt do anything on my play panel

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_DIGITAL, 50)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_DIGITAL, $Digital)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Monitor = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_MONITOR); Does`nt do anything on my play panel

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_MONITOR, 50)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_MONITOR, $Monitor)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Phones = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_HEADPHONES); Does`nt do anything on my play panel

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_HEADPHONES, 50)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_HEADPHONES, $Phones)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Tele = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_TELEPHONE); Does`nt do anything on my play panel

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_TELEPHONE, 50)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_DST_TELEPHONE, $Tele)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$Aux = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY); No effect on mine

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY, $Aux)

Sleep (1000)

beep(400,100)

next

#ce

#cs

$TeleIn = _GetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE);nothing for this of course on mine

For $n = 1 to 5

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE, 1)

Sleep (1000)

beep(200,100)

_SetMixerVolume($MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE, $TeleIn)

Sleep (1000)

beep(400,100)

next

#ce

Now, If only I could do the same with the record panel...

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

I think I`ve got my head around this now, here`s a simpler version of WiredBits code without a GUI.

CODE

#include <GUIConstants.au3>

#include <Mixer.au3>

$Prop = "Properties"

$play = "Play Control"

$sounds = "Sounds and Audio Devices Properties"

$Advan = 6667

Run(@ComSpec & " /c " & 'mmsys.cpl', "", @SW_HIDE)

;Display Record Mixer panel

WinWait ("Sounds and Audio Devices Properties")

ControlClick($sounds,"","Button4")

ControlClick($sounds,"","Button9")

WinActivate($play)

WinWaitActive($play)

send("{ALT}{P}{R}") ;Had to do it this way as no control ID for the menu on the Mixer Panel.

WinWaitActive("Properties")

ControlClick($Prop,"","Button3")

ControlClick($Prop,"","Button5")

$NotePad = "Untitled - Notepad"

$NPad = "Edit1"

$LF = Chr(10)

$CR = Chr(13)

$CRLF = ""&$CR &$LF

run("notepad.exe"); < ----------- Open NotePad

WinWait("Untitled - Notepad")

$mixernames=""

$FormSelectInput =0

$TV_SelectInput = 0

$CMB_DevName=0

$CKB_EnableLinefocus =0

;default mixer is always 0 (so far) which is last audio device installed or prefered deviced selected by user

$lastlinesrc=-1

$curmixer= 0

$Index = 0

GetAllRecordDevs($mixers,$mxline) ;this also gets the "MIX_HMXOBJ" ID which is needed for all the other functions

GetLineConnectionsNames($mixers,$mxInList,0)

;MsgBox(0," ",$Mixernames) ;Mixer Device Name, Eg: SoundBlaster Etc

NotepadWrite("Mixer Device is a "&$MixerNames)

NotepadWrite("")

NotepadWrite("Number of Mixers " &Ubound ($mxInList))

NotepadWrite("")

;MsgBox(0,"",UBound($mxInList))

For $i=0 To UBound($mxInList)-1

NotepadWrite ($mxInList[$i][$lst_destname])

Next

$i=GetSetLineSrc($mixers,$index,0,0) ;get current input line

;MsgBox(0,"",$i)

MsgBox(0,"","Current Mixer is " &($mxInList[$i][$lst_destname]))

GetSetLineSrc($mixers,$curmixer,4) ;Changes from the current Mixer Device to number 4 which is "What you hear" on my Mixer"

$i=GetSetLineSrc($mixers,$index,0,0) ;get current input line

MsgBox(0,"","Current Mixer is Now " &($mxInList[$i][$lst_destname]))

GetSetLineSrc($mixers,$curmixer,7) ;Changes back to Mixer Device number 7 which is "Mic" on my Mixer"

$i=GetSetLineSrc($mixers,$index,0,0) ;get current input line

MsgBox(0,"","Current Mixer is Now " &($mxInList[$i][$lst_destname]))

; ==================== Fuction Get All Record Devices ======================

Func GetAllRecordDevs(ByRef $mixers,ByRef $line)

Local $i,$hmxobj,$name

OpenAllMixers($mixers) ;Opens all Mixer Devices

If $mixers[0][0]=0 Then Return False

For $i=0 To $mixers[0][0]-1

$hmxobj=$mixers[$i][$MIX_HMXOBJ]

zeroline($line) ;All Lines = 0 to start with

$line[$dwLineID]=BitOR($i,0xFFFF0000)

$line[$dwComponentType]=$MIXERLINE_COMPONENTTYPE_DST_WAVEIN

MixerGetLineInfo($hmxobj,$line,$MIXER_GETLINEINFOF_COMPONENTTYPE) ;Get Line avialable Line Info for each Device

If @error Then Return False

$mixers[$i][$MIX_RECNAME]=$line[$szName] ;wave in ccontrol name

$mixers[$i][$MIX_CCONNECTIONS]=$line[$cConnections] ;number of destination lines

$mixers[$i][$MIX_INCCONTROLS]=$line[$cControls] ;number of Controls

$mixers[$i][$MIX_DWLINEID]=$line[$dwLineID] ;line id

$mixers[$i][$MIX_INCHANNELS]=$line[$cChannels] ;number of Input Channels

If NOT GetMxCtrlDetails($mixers,$i) Then Return False

$name=MixerGetDevName($mixers[$i][$MIX_HMXOBJ])

If @error Then Return False

$mixers[$i][$MIX_DEVNAME]=$name ;Name of Mixer Device Eg: SoundBlaster etc

If $mixernames="" Then

$mixernames=$name

Else

$mixernames=$mixernames&"|"&$name

EndIf

Next ;i

Return True

EndFunc

; ==========================================================================

;===================== Get Controls For Each Mixer ========================

Func GetMxCtrlDetails(ByRef $mixers,$index)

Local $mitems,$chans,$hmxobj,$x,$ret

;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[6];" & _ ; DWORD dwReserved[6];

"dword[6]") ; 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]

DllStructSetData($mixerlinecontrols,$cbStruct,DllStructGetSize($mixerlinecontrols))

DllStructSetData($mixerlinecontrols,2,$mixers[$index][$MIX_DWLINEID])

DllStructSetData($mixerlinecontrols,3,$MIXERCONTROL_CONTROLTYPE_MUX)

DllStructSetData($mixerlinecontrols,4,0)

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 @error Then return False

If $ret[0]<>$MMSYSERR_NOERROR Then

DllStructSetData($mixerlinecontrols,3,$MIXERCONTROL_CONTROLTYPE_SINGLESELECT)

$ret = DLLCall("winmm.dll","long","mixerGetLineControls","hwnd",$hmxobj,"ptr",DllStructGetPtr($mixerlinecontrols),"long",BitOR($MIXER_OBJECTF_HMIXER,$MIXER_GETLINECONTROLSF_ONEBYTYPE ))

If @error Then return False

EndIf

If $ret[0]<>$MMSYSERR_NOERROR Then Return False

$x=DllStructGetData($mixercontrol,3) ;dwControlType get type of control

If BitAND($x,$MIXERCONTROL_CT_CLASS_MASK)=$MIXERCONTROL_CT_CLASS_LIST Then

$chans=$mixers[$index][$MIX_INCHANNELS]

$x=DllStructGetData($mixercontrol,4) ;fwControl

If BitAND($x,$MIXERCONTROL_CONTROLF_UNIFORM) Then $chans=1

$mixers[$index][$MIX_INCHANNELS]=$chans

$x=DllStructGetData($mixercontrol,4) ;fwControl

$mitems= 0

If BitAND($x,$MIXERCONTROL_CONTROLF_MULTIPLE) Then $mitems=DllStructGetData($mixercontrol,5)

$mixers[$index][$MIX_INMULTIITEMS]=$mitems

$mixers[$index][$MIX_INCTRLID]=DllStructGetData($mixercontrol,2)

If $mitems Then Return True

EndIf

Return False

EndFunc

;==============================================================================================

;==================================Get Device Name for Mixer ==================================

Func MixerGetDevName($uMxId)

Local $mxcaps,$i

$mxcaps=DllStructCreate("short;short;dword;char[32];dword;dword")

$ret = DLLCall("winmm.dll","long","mixerGetDevCaps","int",$uMxId,"ptr",DllStructGetPtr($mxcaps),"int",DllStructGetSize($mxcaps))

If @error Then

SetError(1)

Return False

EndIf

If $ret[0]=$MMSYSERR_NOERROR Then Return DllStructGetData($mxcaps,4)

SetError(2)

return False

EndFunc

;=============================================================================================

;======================== Get names for Each Mixer ===========================================

Func GetLineConnectionsNames(ByRef $mixers,ByRef $mxInList,$index)

Local $i,$x,$n,$hmxobj,$ret

If $mixers[0][0] Then

$hmxobj=$mixers[$index][$MIX_HMXOBJ] ;Mixer Obj ID

$x=0

For $n=0 To $mixers[$index][$MIX_CCONNECTIONS]-1 ;0 to the Number of Mixer Connections (Obtained from Get all Rec Devs Func)

zeroline($mxline) ;Make all of these = 0

$mxline[$dwDestination]=$mixers[$index][$MIX_DWLINEID]

$mxline[$dwSource]=$n

$ret=MixerGetLineInfo($hmxobj,$mxline,BitOR($MIXER_OBJECTF_HMIXER,$MIXER_GETLINEINFOF_SOURCE)) ;ask for source lines

;Until $Ret = NOT True

If NOT @error Then

$mxInList[$x][$lst_destname]=$mxline[$szName] ;Name of Source Line

$mxInList[$x][$lst_dwComponentType]=$mxline[$dwComponentType] ;Type of Source Line

$x=$x+1

If UBound($mxInList)<$x+1 Then ReDim $mxInList[$x+2][uBound($mxInList,2)]

Else

SetError(1)

Return False

EndIf

Next ;n

$mxInList[0][0]=$x

Return True

Else

SetError(1)

Return False

EndIf

EndFunc

;===============================================================================================

;============================= Gets the Status of the Current Line or Sets the Current Line to a Different one =====================

Func GetSetLineSrc($mixers,$index,$srcindex,$doset=1)

Local $i,$x,$arraysize,$channels,$mtiems

CONST $MIXERCONTROLDETAILS_BOOLEAN_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;

Local CONST $dwControlID=1

If @error Then Return False

$mitems=$mixers[$index][$MIX_INMULTIITEMS]

$channels=$mixers[$index][$MIX_INCHANNELS]

$arraysize=$channels*$mixers[$index][$MIX_INMULTIITEMS]

$srcindex=$mitems-$srcindex ;reverse array index

If $mitems=0 Then Return False;if no items then no need to display

;the folowing =array of values, array order is reverse of itmes displayed in treeview

Local $plistbool=DllStructCreate("dword["&$arraysize+1 &"]") ;give me one more than needed

If @error Then Return False

$hmxobj=$mixers[$index][$MIX_HMXOBJ]

DllStructSetData($mixercontroldetails,$cbStruct,DllStructGetSize($mixercontroldetails))

DllStructSetData($mixercontroldetails,2,$mixers[$index][$MIX_INCTRLID])

DllStructSetData($mixercontroldetails,3,$mixers[$index][$MIX_INCHANNELS])

DllStructSetData($mixercontroldetails,4,$mixers[$index][$MIX_INMULTIITEMS])

DllStructSetData($mixercontroldetails,5,$MIXERCONTROLDETAILS_BOOLEAN_SIZEOF) ;cbDetails to sizeof one bool struct

DllStructSetData($mixercontroldetails,6,DllStructGetPtr($plistbool)) ;paDetails set ptr

$ret = DLLCall("winmm.dll","long","mixerGetControlDetails","hwnd",$hmxobj,"ptr",DllStructGetPtr($mixercontroldetails),"long",BitOR($MIXER_OBJECTF_HMIXER,$MIXER_GETCONTROLDETAILSF_VALUE))

If NOT @error Then

If $ret[0]=$MMSYSERR_NOERROR Then

For $i= 1 To $mitems Step $channels ;

If DllStructGetData($plistbool,1,$i+$channels-1)<>0 then $x=$i

DllStructSetData($plistbool,1,0,$i+$channels-1)

Next ;i

DllStructSetData($plistbool,1,1,$srcindex+$channels-1)

If $doset Then $ret = DLLCall("winmm.dll","long","mixerSetControlDetails","hwnd",$hmxobj,"ptr",DllStructGetPtr($mixercontroldetails),"long",BitOR($MIXER_OBJECTF_HMIXER,$MIXER_SETCONTROLDETAILSF_VALUE))

If NOT @error Then

If $ret[0] =$MMSYSERR_NOERROR Then return $mixers[$index][$MIX_INMULTIITEMS]- $x

EndIf

EndIf

EndIf

Return False

EndFunc

;===================================================================================================

====================================

Func NotepadWrite($String)

ControlCommand("Untitled - Notepad", "", "Edit1", "EditPaste", $String &$CR &$LF)

EndFunc

I`ve added some extra comments to the functions, let me know if I`ve got anything wrong... :P

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

  • 1 month later...

Hi All,

I have been using wiredbits code as a basis for a little program I run, and it has worked fine, until now.

I just upgraded my motherboard, and the new motherboard has the realtek audio chip in it.

[Edited] Irrelevant code and info removed!

Edited by photonbuddy
Link to comment
Share on other sites

  • 2 weeks later...

After much stress and hair pulling, I have found the problem!

It seems that the realtek drivers place the audio output mixer last on the list.

This means the default value of 0 for $curmixer was trying to access an input mixer instead.

I discovered this when setting-up a new program I downloaded to replace the one I had written using wiredbits routines.

After a bit of testing, I got the code to work again by changing the value of $curmixer.

Now, can anyone help me convert the mixer numbers into the actual mixer text?

Link to comment
Share on other sites

  • 1 month later...

I've been using this to make an mp3 player and it works really great for now. but is there a way of changing the volume of whats playing without affecting the system or wave volumes?

Edited by CFire

[u]Scripts and UDF's[/u]WMMedia - UDF full of functions to Control Media Output.

Link to comment
Share on other sites

  • 3 years later...

Hey guys, i tried this on Windows 7 64bit and didnt notice anything going on.

1st 3 ended up with ton of errors and Mixer.au3 ended OK but nothing changed.

I would assume it didnt becuase code was based on a DllCall which usualy results capability problem

Link to comment
Share on other sites

  • 3 months later...

Seems to be broken with latest version of Autoit?, Audio.au3 uses the same code and that does`nt work either, I`m guessing something to do with the dll calls as well.

Windows Xp SP3 Autoit v3.3.6.1

EDIT:

ok, got it working, replace udword here with dword

Func MixerOpen($uMxid = 0, $hwnd = 0, $instance = 0, $fdwOpen = 0)
    Local $x, $h_struct,$ret
    $h_struct = DllStructCreate("dword") ;since a local will be deleted on exit of function

also delete the ";" in line

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]")

That gets added cause of wordwrap I think.

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

  • 4 years later...
  • 1 year later...
3 hours ago, ViciousXUSMC said:

Anybody have a copy of the Mixer.au3 that they can repost in this thread?

... seems that audio.au3 can replace mixer.au3 -->

seems also that, SoundGetSetQuery.au3, found in above post as well, works with recent OSes too.  (?) (I do not know)

Edited by Chimp
corrected assertion

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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