mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-16 12:04:06 +00:00
aeb9c0668b
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
47 lines
1.3 KiB
Text
47 lines
1.3 KiB
Text
{{QBDLDATE:05-20-2022}}
|
|
{{QBDLTIME:23:11:05}}
|
|
{{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 1 (full volume).
|
|
|
|
|
|
{{PageDescription}}
|
|
*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.
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example 1:'' Playing a previously opened sound at half volume.
|
|
{{CodeStart}}
|
|
{{Cl|_SNDPLAYCOPY}} applause&, 0.5
|
|
{{CodeEnd}}
|
|
|
|
|
|
''Example 2:'' Playing a song at random volumes.
|
|
{{CodeStart}}
|
|
chomp& = _SNDOPEN("chomp.wav")
|
|
_SNDPLAYCOPY chomp&, 0.5 + RND * 0.49
|
|
{{CodeEnd}}
|
|
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_SNDOPEN]]
|
|
* [[_SNDCOPY]]
|
|
* [[_SNDPLAYFILE]]
|
|
|
|
|
|
{{PageNavigation}}
|
|
|