SNDPLAYCOPY: 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
(Created page with "{{DISPLAYTITLE:_SNDPLAYCOPY}} The _SNDPLAYCOPY statement copies a sound, plays it, and automatically closes the copy using a handle parameter passed from _SNDOPEN or _SNDCOPY {{PageSyntax}} : _SNDPLAYCOPY {{Parameter|handle&}}[, {{Parameter|volume!}}] {{Parameters}} * The LONG {{Parameter|handle&}} value is returned by _SNDOPEN using a specific sound file. * The {{Parameter|volume!}} parameter can be any SINGLE value from 0 (no volume) to...") |
No edit summary |
||
Line 31: | Line 31: | ||
{{CodeStart}} '' '' | {{CodeStart}} '' '' | ||
chomp& = _SNDOPEN("chomp.wav") | chomp& = _SNDOPEN("chomp.wav") | ||
_SNDPLAYCOPY chomp&, 0.5 + RND * 0.49 | _SNDPLAYCOPY chomp&, 0.5 + RND * 0.49 | ||
{{CodeEnd}} | {{CodeEnd}} | ||
Revision as of 23:03, 18 May 2022
The _SNDPLAYCOPY statement copies a sound, plays it, and automatically closes the copy using a handle parameter passed from _SNDOPEN or _SNDCOPY
Syntax
- _SNDPLAYCOPY handle&[, volume!]
- The LONG handle& value is returned by _SNDOPEN using a specific sound file.
- The volume! parameter can be any SINGLE value from 0 (no volume) to 1 (full volume).
Description
- Makes coding easier by doing all of the following automatically:
- Copies/duplicates the source handle (see _SNDCOPY).
- Changes the volume of the copy if volume is passed.
- Plays the copy.
- Closes the copy.
- This statement is a better choice than _SNDPLAYFILE if the sound will be played often, reducing the burden on the computer.
Examples
Example 1: Playing a previously opened sound at half volume.
_SNDPLAYCOPY applause&, 0.5 |
Example 2: Playing a song at random volumes.
chomp& = _SNDOPEN("chomp.wav") _SNDPLAYCOPY chomp&, 0.5 + RND * 0.49 |
See also