AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SoundPause...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Apr 20, 2008 3:27 pm    Post subject: SoundPause... Reply with quote

I need help creating some sort of SoundPause.

If you know how please reply.

Thanks in advance.
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:40 pm    Post subject: Reply with quote

Wouldn't it be easy to just pause the script?

Code:
Like p::pause
or label a button gPause
Pause:
pause
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Apr 20, 2008 3:42 pm    Post subject: Reply with quote

I tried that but it wouldnt stop the sound for some reason.
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:43 pm    Post subject: Reply with quote

Really? Thats weird...let me test a script out real quick.
Back to top
View user's profile Send private message
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:46 pm    Post subject: Reply with quote

I see what you mean. I'm going to mess around with it.
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Apr 20, 2008 3:47 pm    Post subject: Reply with quote

Okay, reply back with your findings
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1224
Location: Enterprise, Alabama

PostPosted: Sun Apr 20, 2008 3:49 pm    Post subject: Reply with quote

There are some great sound functions posted by Jero3n.

Fusion MediaSuite 0.2 [BETA] [Jero3n]

Edit: The only downfall to using this is that all sound must be handled with the functions.

Functions:

Code:
Sound_Open(File, Alias=""){
   IfNotExist, %File%
   {
      ErrorLevel = 2
      Return 0
   }
   If Alias =
   {
      Random, rand, 10, 10000000000000000000000000000000000000
      Alias = AutoHotkey%rand%
   }
   Loop, %File%
      File_Short = %A_LoopFileShortPath%
   r := Sound_SendString("open " File_Short " alias " Alias)
   If r
   {
      ErrorLevel = 1
      Return 0
   }Else{
      ErrorLevel = 0
      Return %Alias%
   }
}

Sound_Close(SoundHandle){
   r := Sound_SendString("close " SoundHandle)
   Return NOT r
}

Sound_Play(SoundHandle, Wait=0){
   If(Wait <> 0 AND Wait <> 1)
      Return 0
   If Wait
      r := Sound_SendString("play " SoundHandle " wait")
   Else
      r := Sound_SendString("play " SoundHandle)
   Return NOT r
}

Sound_Stop(SoundHandle){
   r := Sound_SendString("seek " SoundHandle " to start")
   r2 := Sound_SendString("stop " SoundHandle)
   If(r AND r2)
   {
      Return 0
   }Else{
      Return 1
   }
}

Sound_Pause(SoundHandle){
   r := Sound_SendString("pause " SoundHandle)
   Return NOT r
}

Sound_Resume(SoundHandle){
   r := Sound_SendString("resume " SoundHandle)
   Return NOT r
}

Sound_Length(SoundHandle){
   r := Sound_SendString("set time format miliseconds", 1)
   If r
      Return 0
   r := Sound_SendString("status " SoundHandle " length", 1, 1)
   Return %r%
}

Sound_Seek(SoundHandle, Hour, Min, Sec){
   milli := 0
   r := Sound_SendString("set time format milliseconds", 1)
   If r
      Return 0
   milli += Sec  * 1000
   milli += Min  * 1000 * 60
   milli += Hour * 1000 * 60 * 60
   r := Sound_SendString("seek " SoundHandle " to " milli)
   Return NOT r
}

Sound_Status(SoundHandle){
   Return Sound_SendString("status " SoundHandle " mode", 1, 1)
}

Sound_Pos(SoundHandle){
   r := Sound_SendString("set time format miliseconds", 1)
   If r
      Return 0
   r := Sound_SendString("status " SoundHandle " position", 1, 1)
   Return %r%
}

Sound_SeekSeconds(SoundHandle, Sec){
   r := Sound_SendString("seek " SoundHandle " to " Sec)
   Return NOT r
}

Sound_SetBass(SoundHandle){
   r := Sound_SendString("setaudio " SoundHandle " bass to 1000")
   Return
}

Sound_SendString(string, UseSend=0, ReturnTemp=0){
   If UseSend
   {
      VarSetCapacity(stat1, 32, 32)
      DllCall("winmm.dll\mciSendStringA", "UInt", &string, "UInt", &stat1, "Int", 32, "Int", 0)
   }Else{
      DllCall("winmm.dll\mciExecute", "str", string)
   }
   If(UseSend And ReturnTemp)
      Return stat1
   Else
      Return %ErrorLevel%
}


Last edited by Trikster on Sun Apr 20, 2008 3:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 666
Location: MN, USA

PostPosted: Sun Apr 20, 2008 3:51 pm    Post subject: Reply with quote

AHK Help File wrote:
To stop a file that is currently playing, use SoundPlay on a nonexistent filename as in this example: SoundPlay, Nonexistent.avi

_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
Trikster



Joined: 15 Jul 2007
Posts: 1224
Location: Enterprise, Alabama

PostPosted: Sun Apr 20, 2008 3:52 pm    Post subject: Reply with quote

He wants to pause it, not stop it.
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Apr 20, 2008 3:52 pm    Post subject: Reply with quote

@jaco0646
I want SoundPause meaning to stop the song at a current spot then be able to resume it not just stop it completely
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Apr 20, 2008 3:55 pm    Post subject: Reply with quote

@Ian

I would prefer not to use functions or maybe jsut one function to pause the song
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 666
Location: MN, USA

PostPosted: Sun Apr 20, 2008 3:57 pm    Post subject: Reply with quote

Pausing sound (as Ian noted) will be totally dependent on the default media player.
_________________
http://autohotkey.net/~jaco0646/
Back to top
View user's profile Send private message Visit poster's website
Epuls56



Joined: 19 Apr 2008
Posts: 33

PostPosted: Sun Apr 20, 2008 3:57 pm    Post subject: Reply with quote

So far, no luck. Everything stops the song rather than pausing it x.x
Back to top
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Sun Apr 20, 2008 4:07 pm    Post subject: Reply with quote

The mci command is simply: pause

Check and adapt the mentioned mci script, you should be able to use pause alias/play alias
Back to top
Fry



Joined: 01 Nov 2007
Posts: 689

PostPosted: Sun Apr 20, 2008 4:47 pm    Post subject: Reply with quote

n-l-i-d please explain more
_________________
check out my site
www.eliteknifesquad.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group