SNDPLAYFILE: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_SNDPLAYFILE}} | {{DISPLAYTITLE:_SNDPLAYFILE}} | ||
The [[_SNDPLAYFILE]] statement is used to play a sound file without generating a handle, automatically closing it after playback finishes. | The [[_SNDPLAYFILE]] statement is used to play a sound file without generating a handle, automatically closing it after playback finishes. | ||
Line 8: | Line 8: | ||
{{PageDescription}} | {{PageDescription}} | ||
* Supported file formats are '''WAV, OGG | * Supported file formats are '''WAV, FLAC, OGG, MP3, MID, IT, XM, S3M, MOD or RAD (v2 only)'''. See [[_SNDOPEN]]. | ||
* {{Parameter|ignored%}} is an optional parameter , accepted for historical reasons. | * {{Parameter|ignored%}} is an optional parameter , accepted for historical reasons. | ||
** In versions prior to '''build 20170811/60''', {{Parameter|ignored%}} identified if a sound was to be loaded with [[_SNDOPEN|"SYNC" capabilities]], (-1 for true, 0 for false). This is true for all sound files in the latest versions, making this parameter safe to be ignored. | ** In versions prior to '''build 20170811/60''', {{Parameter|ignored%}} identified if a sound was to be loaded with [[_SNDOPEN|"SYNC" capabilities]], (-1 for true, 0 for false). This is true for all sound files in the latest versions, making this parameter safe to be ignored. | ||
Line 20: | Line 20: | ||
''Example:'' Playing a sound file at half volume. | ''Example:'' Playing a sound file at half volume. | ||
{{CodeStart}} | {{CodeStart}} | ||
{{Cl|_SNDPLAYFILE}} "dog.wav", , .5 | {{Cl|_SNDPLAYFILE}} "dog.wav", , .5 | ||
{{CodeEnd}} | {{CodeEnd}} | ||
Line 30: | Line 30: | ||
{{PageNavigation}} | {{PageNavigation}} | ||
Latest revision as of 02:43, 23 January 2023
The _SNDPLAYFILE statement is used to play a sound file without generating a handle, automatically closing it after playback finishes.
Syntax
- _SNDPLAYFILE filename$[, ignored%][, volume!]
Description
- Supported file formats are WAV, FLAC, OGG, MP3, MID, IT, XM, S3M, MOD or RAD (v2 only). See _SNDOPEN.
- ignored% is an optional parameter , accepted for historical reasons.
- In versions prior to build 20170811/60, ignored% identified if a sound was to be loaded with "SYNC" capabilities, (-1 for true, 0 for false). This is true for all sound files in the latest versions, making this parameter safe to be ignored.
- volume! is a SINGLE value from 0 (silence) to 1 (full volume). If not used or outside this range, the sound will be played at full volume.
- _SNDPLAYFILE never creates an error. If the sound cannot be played it takes no further action.
- The sound is closed automatically after it finishes playing.
- When a sound will be used often, open the file with _SNDOPEN and use _SNDPLAYCOPY to play the handle instead to reduce the burden on the computer.
Examples
Example: Playing a sound file at half volume.
_SNDPLAYFILE "dog.wav", , .5 |
See also