1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-03 08:51:22 +00:00
qb64/internal/help/_SNDPLAYCOPY.txt

45 lines
1.3 KiB
Plaintext
Raw Normal View History

2016-03-18 11:36:04 +00:00
{{DISPLAYTITLE:_SNDPLAYCOPY}}
2017-10-10 14:55:21 +00:00
The [[_SNDPLAYCOPY]] statement copies a sound, plays it, and automatically closes the copy using a handle parameter passed from [[_SNDOPEN]] or [[_SNDCOPY]]
{{PageSyntax}}
2017-10-10 14:55:21 +00:00
: [[_SNDPLAYCOPY]] {{Parameter|handle&}}[, {{Parameter|volume!}}]
{{PageParameters}}
2017-10-10 14:55:21 +00:00
* 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).
2016-03-18 11:36:04 +00:00
{{PageDescription}}
*Makes coding easier by doing all of the following automatically:
2017-10-10 14:55:21 +00:00
:#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.
2016-03-18 11:36:04 +00:00
{{CodeStart}} '' ''
{{Cl|_SNDPLAYCOPY}} applause&, 0.5 '' ''
{{CodeEnd}}
''Example 2:'' Playing a song at random volumes.
2016-03-18 11:36:04 +00:00
{{CodeStart}} '' ''
2019-04-15 01:15:33 +00:00
chomp& = _SNDOPEN("chomp.wav")
2016-03-18 11:36:04 +00:00
_SNDPLAYCOPY chomp&, 0.5 + RND * 0.49 '' ''
{{CodeEnd}}
{{PageSeeAlso}}
2016-03-18 11:36:04 +00:00
* [[_SNDOPEN]]
* [[_SNDCOPY]]
2017-10-10 14:55:21 +00:00
* [[_SNDPLAYFILE]]
2019-04-15 01:15:33 +00:00
{{PageNavigation}}