Jump to content

Possible to mute your own script?


Rad
 Share

Recommended Posts

I dont know if anyone's made a _SoundSetVolume or anything for the UDF sounds, but the SoundSetWaveVolume turns down the volume for all programs... I dont want this

I'll use it if I have to, I did a search and didnt find anything :whistle:

And another thing that would be useful, is there a way to set a label to the top level of your GUI? I have label-borders for my window which doesnt use the windows default border, but when you click on the slider the empty space overlaps the label and it looks like crap :/

Edited by Rad
Link to comment
Share on other sites

Well the sound can be turned down in my program, but it turns down the entire computers volume... And I cant use Beep() because my motherboard speaker doesnt work

And the sounds dont pause when they get muted, they should still run for when it gets unmuted... Its a media player lol

Edited by Rad
Link to comment
Share on other sites

Put it this way:

You press Play, and some music starts to play, but its to loud so you turn it down with the volume bar.

Maybe you have your own music playing and dont want to hear it, so you mute it...

But with SoundSetWaveVolume that mutes the entire computer thats running through the wave sound (ex: windows media player)

It wouldnt make much sense if the mute button muted that too

But if mute pauses or stops the sound, then when you unmute it its still there, which isnt right... because its mute

Link to comment
Share on other sites

uhh not sure why you can't understand this guy...

he wants a seperate volume control for his program, that doesn't affect the volume of any other programs. Is it so hard to understand?

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

I'm looking for something like this as well that can control the individual volumes of any (multiple) applications. Don't know if it's possible but I would really like to see this sort of functionality.

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

Or to turn that into a function with a volume parameter:

playsound(@scriptdir & "\file.mp3",50)

func playsound($file,$volume = 50)
    $oPlayer = ObjCreate("WMPlayer.OCX" )
    $oPlayer.URL = $file
    $oPlayer.settings.volume = 50
    while $oPlayer.playState <> 3
        sleep(100)
    WEnd
    while 1
        if $oPlayer.playState <> 3 then exitloop
    WEnd
    $oPlayer = 0
EndFunc
You can do a lot with the Windows Media Player object:

http://windowssdk.msdn.microsoft.com/en-us...y/aa392281.aspx

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

I really dont understand MSDN at all, not at all...

I need to use the _Sound commands since it can pause, seek, return status etc... If you can do that through WMP that would be great

I just have a real hard time trying to connect:

$oPlayer = ObjCreate("WMPlayer.OCX" )

$oPlayer.URL = $file

$oPlayer.settings.volume = 50

with... well the entire treeview on msdn. I dont see how you can get "WMPlayer.ocx" .settings.volume from page after page of just random topics that I dont really see connect to changing the volume

Maybe it would help if I knew a different language or something, but I dont I know autoit because it is easy, but this is hard... so i cant learn it? IDK I just cant figure out how to put it together

Im so lost looking at this, where to start, theres no button or control section its totally out of context from autoit, i feel like im in a different country :whistle:

Link to comment
Share on other sites

Okay, here are some functions. Not sure if anyone else has already done this. If so, my apologies.

global $oPlayer = ObjCreate("WMPlayer.OCX" )

; example usage

$song = @scriptdir & "\song.mp3"
WMLoadFile($oPlayer,$song)

; turns the volume down and back up slowly...
For $i = 100 to 0 step -1
    WMSetVolume($oPlayer,$i)
    sleep(100)
Next
For $i = 0 to 100
    WMSetVolume($oPlayer,$i)
    sleep(100)
Next

WMPause($oPlayer)
    sleep(3000)
WMPlay($oPlayer)
    sleep(3000)
WMStop($oPlayer)
    
Exit
    
    
; some functions 

func WMLoadFile($wm_obj,$sFilename)
    $wm_obj.url = $sFilename
    while not WMGetState($wm_obj) = "Playing"
        sleep(100)
    WEnd
EndFunc

func WMSetVolume($wm_obj,$iVol)
    ;iVol can be between 0 and 100
    $wm_obj.settings.volume = $iVol
EndFunc

func WMFastForward($wm_obj)
    $wm_obj.controls.fastForward()
EndFunc

func WMReverse($wm_obj)
    $wm_obj.controls.fastReverse()
EndFunc

func WMPause($wm_obj)
    $wm_obj.controls.pause()
EndFunc

func WMPlay($wm_obj)
    $wm_obj.controls.play()
EndFunc

func WMStop($wm_obj)
    $wm_obj.controls.stop()
EndFunc

func WMGetPosition($wm_obj)
    $wm_obj.controls.currentPosition()
EndFunc

func WMGetDuration($wm_obj)
    $wm_obj.currentMedia.duration
EndFunc



func WMGetState($wm_obj)
    $sStates = "Undefined,Stopped,Paused,Playing,ScanForward,ScanReverse,Buffering,"
    $sStates &= "Waiting,MediaEnded,Transitioning,Ready,Reconnecting"
    $aStates = StringSplit($sStates,",")
    $iState = $wm_obj.playState()
    return $aStates[$iState]
EndFunc

Edited by lod3n

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

Nice work! The only thing thats missing is SetPosition, though

Would you just do:

func WMSetPosition($wm_obj)
    $wm_obj.controls.currentPosition = xxx
EndFunc

?

These would make a great include :whistle:

Ill mess with them now

Edited by Rad
Link to comment
Share on other sites

Oops! Sorry about that. Try these:

func WMGetPosition($wm_obj)
    return $wm_obj.controls.currentPosition.value
EndFunc

func WMGetDuration($wm_obj)
    return $wm_obj.currentMedia.duration
EndFunc
I apologise, these are completely untested, I'm just basically translating what I'm reading in MSDN without thinking too much... I will post it as an include once we're sure it's kinda working. I ought to make them all return something for testing purposes.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

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