Jump to content

Audio slider


Nova
 Share

Recommended Posts

Im trying to create a guictrlslider which will change the wavevolumeoutput

Problem:When the slider is moved the volume dosent change !

Possible reason:I think the problem is with GUICtrlSetLimit($min,$max,0)

the varibles $min and $max are d_word values as required by the dllcall but I dont think GUICtrlSetLimit will adcept d_word values

Am I right ?

#include <GUIConstants.au3>
Opt("GuiOnEventMode", 1)

$min = "0x0000"
$max = "0xffff"
$start_value = "0x0000"

GUICreate("Volume",220,100, 100,200)
$slider = GuiCtrlCreateSlider (10,10,200,20)
GUICtrlSetLimit($min,$max,0)   
GUICtrlSetData($slider, $start_value)   
$lable = GUICtrlCreateLabel ("Volume is @ 50%",  50, 60, 200) 
$lable_font = GUICtrlSetFont ($lable, 9, 600, -1, "Comic Sans MS")
GuiSetOnEvent($GUI_EVENT_CLOSE, "close")
GuiSetState()

$volume = GuiCtrlRead($slider)

$current_selecter_pos = GuiCtrlRead($slider)
$last_selecter_pos = $current_selecter_pos 

While 1
   Sleep(10)
   $current_selecter_pos = GuiCtrlRead($slider)
   If $last_selecter_pos = $current_selecter_pos Then
   Else
      $volume = GuiCtrlRead($slider)
      DllCall ( "Winmm.dll", "int", "waveOutSetVolume", "int", 0 , "int", $volume)
      $lable = GUICtrlCreateLabel ("Volume is @ "& $volume & "%",  50, 60, 200)    
      $lable_font = GUICtrlSetFont ($lable, 9, 600, -1, "Comic Sans MS")
      $last_selecter_pos = $current_selecter_pos
   EndIf
wend

Func close()
   Exit
EndFunc

Little help ?

Edited by Nova
Link to comment
Share on other sites

AFIAK

Not sure what that means, something like RTFM no doubt.

The slider only notifies when releasing it

Have you run the script ?

I would consider refreshing the lable to be a form of notification,dosent require release.

There were some comments along the same lines in the support forum as well.

This is the support forum.

Edited by Nova
Link to comment
Share on other sites

@Nova: But, you can read the value everytime when the slider change. (I did it with XDrop)

I though my code already did that ! The lable text changes everytime the slider is moved and it changes while it is moving.

If this is not what u ment plz explain in more detailm maby its just passing over my head.

@this-is-me sry.....TBH I though u wer silently cursing at me :idiot:

Edited by Nova
Link to comment
Share on other sites

I though my code already did that ! The lable text changes everytime the slider is moved and it changes while it is moving.

Opps! Yes..sorry.

What value does it return doing that, there? :idiot:

$out = DllCall ("Winmm.dll", "int", "waveOutSetVolume", "int", 0, "int", $volume)
Msgbox(0, "", $out[0])
Link to comment
Share on other sites

$out = DllCall ("Winmm.dll", "int", "waveOutSetVolume", "int", 0, "int", $volume)
Msgbox(0, "", $out[0])
The above code always returns 0, I dont understand what your trying to do.

http://www.autoitscript.com/forum/index.ph...topic=7087&st=0

Please read post 6

The varible $Volume holds a D_Word value. Can GUICtrlSetLimit($min,$max,0) take D_Word values for its max and min values ?

Or do they have to be integers ?

Edited by Nova
Link to comment
Share on other sites

Why not use SoundSetWaveVolume?

You said that earlier in another topic also.

I have looked on MSDN twice now and cannot find any reference to it !

Point me in the right direction ?

Nova go here ------------->

Edit:Just realised u ment the autoit function SoundSetWaveVolume

becasue Im trying to learn how to use dlls

Edited by Nova
Link to comment
Share on other sites

The above code always returns 0, I dont understand what your trying to do.

...

<{POST_SNAPBACK}>

Ok, was thinking a possible error.

Returns MMSYSERR_NOERROR if successful or an error otherwise. Possible error values include the following.

MMSYSERR_BASE = 0

MMSYSERR_NOERROR = 0

MMSYSERR_NOTSUPPORTED = [MMSYSERR_BASE + 8]MMSYSERR_INVALHANDLE = [MMSYSERR_BASE + 5]

MMSYSERR_NODRIVER = [MMSYSERR_BASE + 6]

MMSYSERR_NOMEM = [MMSYSERR_BASE + 7]

You tried with these values ?
Link to comment
Share on other sites

UP NORTH your completly missing the point Im trying to learn about dllcall

read post #9 becasue Im trying to learn how to use dlls

I wrote a version which uses SoundSetWaveVolume ages ago.

I mean all ud have to do is take the above code and swap the line

dllcall with SoundSetWaveVolume.

@josbe

You tried with these values ?

in all of my testing it apears that GUICtrlSetLimit wont take D_Word values for min and max.

Edited by Nova
Link to comment
Share on other sites

Would it be possible to make a volume control that looks like this:

doxiex.bravehost.com/volume.JPG

Copy/paste the url above

And preferly attached to the desktop.

I asked about this a couple of month ago, but now when you bring it up, i need to ask again :idiot:

http://www.autoitscript.com/forum/index.ph...wtopic=5741&hl=

Edited by Doxie

Were ever i lay my script is my home...

Link to comment
Share on other sites

I'm not at home, so I can't check this... but it looks to me like your syntax is a little confused.

Shouldn't this:

GUICtrlSetLimit($min,$max,0)

Be this:

GUICtrlSetLimit($ctrlID, $min, $max)

??

*Edit: And actually, I thought the order was $max, $min. I seem to remember wondering about that...

Edited by Saunders
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...