SNDRAWLEN: 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 |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:_SNDRAWLEN}} | {{DISPLAYTITLE:_SNDRAWLEN}} | ||
The [[_SNDRAWLEN]] function returns the length, in seconds, of a [[_SNDRAW]] sound currently queued. | The [[_SNDRAWLEN]] function returns the length, in seconds, of a [[_SNDRAW]]/[[_SNDRAWBATCH]] sound currently queued. | ||
Line 13: | Line 13: | ||
{{PageDescription}} | {{PageDescription}} | ||
* Use [[_SNDRAWLEN]] to determine the length of a sound queue during creation and when to stop playing the sound. | * Use [[_SNDRAWLEN]] to determine the length of a sound queue during creation and when to stop playing the sound. | ||
* Ensure that [[_SNDRAWLEN]] is comfortably above 0 (until you've | * Ensure that [[_SNDRAWLEN]] is comfortably above 0 (until you've finished playing sound). | ||
* If you | * If you get occasional random clicks, this generally means that [[_SNDRAWLEN]] has dropped to 0. | ||
* The [[_SNDRATE]] determines how many samples are played per second. However, the timing is achieved by the sound card and [[_SNDRAWLEN]], not your program. | * The [[_SNDRATE]] determines how many samples are played per second. However, the timing is achieved by the sound card and [[_SNDRAWLEN]], not your program. | ||
* '''Do not attempt to use [[_TIMER]] or [[_DELAY]] or [[_LIMIT]] to control the timing of [[_SNDRAW]] sounds. You may use them as usual for delays or to limit your program's CPU usage, but the decision of how much sound to queue should only be based on the remaining _SNDRAWLEN'''. | * '''Do not attempt to use [[_TIMER]] or [[_DELAY]] or [[_LIMIT]] to control the timing of [[_SNDRAW]] sounds. You may use them as usual for delays or to limit your program's CPU usage, but the decision of how much sound to queue should only be based on the remaining _SNDRAWLEN'''. | ||
{{PageAvailability}} | |||
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no --> | |||
<gallery widths="48px" heights="48px" mode="nolines"> | |||
File:Qb64.png|'''v0.927''' | |||
File:Qbpe.png|'''all''' | |||
File:Apix.png | |||
File:Win.png|'''yes''' | |||
File:Lnx.png|'''yes''' | |||
File:Osx.png|'''yes''' | |||
</gallery> | |||
<!-- Additional availability notes go below here --> | |||
Line 24: | Line 37: | ||
{{PageSeeAlso}} | {{PageSeeAlso}} | ||
* [[_SNDRAW]] | * [[_SNDRAW]], [[_SNDRAWBATCH]] | ||
* [[_SNDRATE]] | * [[_SNDRATE]] | ||
{{PageNavigation}} | {{PageNavigation}} |
Latest revision as of 13:30, 8 December 2024
The _SNDRAWLEN function returns the length, in seconds, of a _SNDRAW/_SNDRAWBATCH sound currently queued.
Syntax
- length# = _SNDRAWLEN [pipeHandle&]
Parameters
- The optional pipeHandle& parameter refers to the sound pipe opened using _SNDOPENRAW.
Description
- Use _SNDRAWLEN to determine the length of a sound queue during creation and when to stop playing the sound.
- Ensure that _SNDRAWLEN is comfortably above 0 (until you've finished playing sound).
- If you get occasional random clicks, this generally means that _SNDRAWLEN has dropped to 0.
- The _SNDRATE determines how many samples are played per second. However, the timing is achieved by the sound card and _SNDRAWLEN, not your program.
- Do not attempt to use _TIMER or _DELAY or _LIMIT to control the timing of _SNDRAW sounds. You may use them as usual for delays or to limit your program's CPU usage, but the decision of how much sound to queue should only be based on the remaining _SNDRAWLEN.
Availability
Examples
- See the example in _SNDRAW
See also