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 

Playing loop sound files

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Smurth



Joined: 13 Dec 2006
Posts: 10

PostPosted: Thu Feb 28, 2008 8:03 am    Post subject: Playing loop sound files Reply with quote

Hi,

It could be interresting to play a sound file as a loop but, currently, doing this via a script's loop doesn't sound good.
So, an option to the SoundPlay command would be great.
Back to top
View user's profile Send private message
SKAN



Joined: 26 Dec 2005
Posts: 5298

PostPosted: Sat Mar 01, 2008 1:30 pm    Post subject: Reply with quote

Support+, should not be hard to implement - I guess. Smile

Code:

Flags := (SND_ASYNC := 0x1) | (SND_FILENAME := 0x20000) | (SND_LOOP := 0x8)   
SoundPlay( A_WinDir "\Media\notify.wav", Flags )

Loop
 Tooltip, % A_Index . DllCall("Sleep", UInt,1)

Return

SoundPLay( File="", Flags=0x0, hMod=0 ) {
Return DllCall( "winmm.dll\PlaySoundA", Str,File, UInt,hMod, UInt,Flags )



/*

Flags for playing the sound. The following values are defined:

SND_APPLICATION := 0x80
The sound is played using an application-specific association.

SND_ALIAS := 0x10000
The pszSound parameter is a system-event alias in the registry or the WIN.INI file. Do not use with either SND_FILENAME or SND_RESOURCE.

SND_ALIAS_ID := 0x110000
The pszSound parameter is a predefined sound identifier.

SND_ASYNC := 0x1
The sound is played asynchronously and PlaySound returns immediately after beginning the sound. To terminate an asynchronously played waveform sound, call PlaySound with pszSound set to NULL.

SND_FILENAME := 0x20000
The pszSound parameter is a filename.

SND_LOOP := 0x8
The sound plays repeatedly until PlaySound is called again with the pszSound parameter set to NULL. You must also specify the SND_ASYNC flag to indicate an asynchronous sound event.

SND_MEMORY := 0x4
A sound event’s file is loaded in RAM. The parameter specified by pszSound must point to an image of a sound in memory.

SND_NODEFAULT := 0x2
No default sound event is used. If the sound cannot be found, PlaySound returns silently without playing the default sound.

SND_NOSTOP := 0x10
The specified sound event will yield to another sound event that is already playing. If a sound cannot be played because the resource needed to generate that sound is busy playing another sound, the function immediately returns FALSE without playing the requested sound.
If this flag is not specified, PlaySound attempts to stop the currently playing sound so that the device can be used to play the new sound.

SND_NOWAIT := 0x2000
If the driver is busy, return immediately without playing the sound.

SND_PURGE := 0x40
Sounds are to be stopped for the calling task. If pszSound is not NULL, all instances of the specified sound are stopped. If pszSound is NULL, all sounds that are playing on behalf of the calling task are stopped.
You must also specify the instance handle to stop SND_RESOURCE events.

SND_RESOURCE := 0x40004
The pszSound parameter is a resource identifier; hmod must identify the instance that contains the resource.

SND_SYNC := 0x0
Synchronous playback of a sound event. PlaySound returns after the sound event completes.

*/
Back to top
View user's profile Send private message
Smurth



Joined: 13 Dec 2006
Posts: 10

PostPosted: Sun Mar 02, 2008 2:56 am    Post subject: Reply with quote

Ok, thanks; I'll play with this Wink
Back to top
View user's profile Send private message
dlldeaf
Guest





PostPosted: Fri Apr 25, 2008 12:43 pm    Post subject: Reply with quote

I've read: http://www.autohotkey.com/forum/viewtopic.php?p=185919#185919
but I have no idea how to dllcall, load and play a mp3.

How to loop files using mp3?

Thanks in advance
Back to top
corrupt



Joined: 29 Dec 2004
Posts: 2328

PostPosted: Tue Apr 29, 2008 7:29 am    Post subject: Reply with quote

dlldeaf wrote:
I've read: http://www.autohotkey.com/forum/viewtopic.php?p=185919#185919
but I have no idea how to dllcall, load and play a mp3.

http://www.autohotkey.com/forum/viewtopic.php?t=11201
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
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