LxP Posted November 21, 2005 Posted November 21, 2005 Hi all,I've come across some VB code to manipulate things like master volume, WAVE, CD, MIDI etc. I've had a crack at converting it to AutoIt. Because it relies so heavily on pointers and DLL structures and Kernel32 calls, I'm not sure if I can trust myself to finish it.Am I on the right track? Would it be worth asking for this functionality to be incorporated as a set of AutoIt functions?Is anyone aware of an easier way to achieve this perhaps? Opening a mixer via WinMM seems to be the 'proper' way to do it (if the fact that the sliders in SndVol32 update with changes by the code is anything to go by). Ultimately I'm wanting to be able to set MIDI volume but it seems that only a small amount of extra work is needed to have the others controllable.
Somerset Posted November 23, 2005 Posted November 23, 2005 don't know if it is any easier but seems intresting... download the volume ziphttp://www.mentalis.org/vbexamples/vbexamp...bexample=VOLUME
LxP Posted November 24, 2005 Author Posted November 24, 2005 Thanks beerman. You know, I never thought that something like this would be so complicated under the hood. This kind of code scares me with its talk of allocating memory on the heap and creating all sorts of structures... I really want this functionality though. So I guess I'll try to keep heading towards it.
GaryFrost Posted November 24, 2005 Posted November 24, 2005 Thanks beerman.You know, I never thought that something like this would be so complicated under the hood. This kind of code scares me with its talk of allocating memory on the heap and creating all sorts of structures...I really want this functionality though. So I guess I'll try to keep heading towards it. Here's one part for you http://www.autoitscript.com/forum/index.ph...indpost&p=82967 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Valuater Posted November 24, 2005 Posted November 24, 2005 (edited) maybe this could help expandcollapse popup#include <GUIConstants.au3> MsgBox(0,"", _SoundGetWaveVolume()) Func _SoundGetWaveVolume() Local $WaveVol = -1, $p, $ret Const $MMSYSERR_NOERROR = 0 $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 DllStructDelete ($p) Return $WaveVol EndFunc ;==>_SoundGetWaveVolume run("sndvol32.exe") WinWait("") ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGUP}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") sleep(1000) ControlSend("Volume Control", "", "msctls_trackbar322", "{PGDN}") Global Const $TBM_GETPOS = $TWM_USER Func _GUICtrlSliderGetPos($h_slider) Local $ret $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) Return $ret[0] EndFunc ;==>_GUICtrlSliderGetPos $ret = DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_slider, "int", $TBM_GETPOS, "int", 0, "int", 0) 8) Edited November 24, 2005 by Valuater
GaryFrost Posted November 24, 2005 Posted November 24, 2005 Looks familiar SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
LxP Posted November 24, 2005 Author Posted November 24, 2005 Thanks for that extra code, guys. Actually, there appears to be a similar call for MIDI in WinMM.dll. I'll take a look at that.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now