 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Smurth
Joined: 13 Dec 2006 Posts: 10
|
Posted: Thu Feb 28, 2008 8:03 am Post subject: Playing loop sound files |
|
|
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 |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 5298
|
Posted: Sat Mar 01, 2008 1:30 pm Post subject: |
|
|
Support+, should not be hard to implement - I guess.
| 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 |
|
 |
Smurth
Joined: 13 Dec 2006 Posts: 10
|
Posted: Sun Mar 02, 2008 2:56 am Post subject: |
|
|
Ok, thanks; I'll play with this  |
|
| Back to top |
|
 |
dlldeaf Guest
|
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2328
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|