SNDRAWLEN: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:


{{PageSyntax}}
{{PageSyntax}}
: {{Parameter|length#}} = [[_SNDRAWLEN]][{{Parameter|pipeHandle&}}]
: {{Parameter|length#}} = [[_SNDRAWLEN]] [{{Parameter|pipeHandle&}}]




{{PageDescription}}
{{PageParameters}}
* The optional {{Parameter|pipeHandle&}} parameter refers to the sound pipe opened using [[_SNDOPENRAW]].  
* The optional {{Parameter|pipeHandle&}} parameter refers to the sound pipe opened using [[_SNDOPENRAW]].




{{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 actually finished playing sound).  
* Ensure that [[_SNDRAWLEN]] is comfortably above 0 (until you've actually finished playing sound).
* If you are getting occasional random clicks, this generally means that [[_SNDRAWLEN]] has dropped to 0.
* If you are getting 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.

Latest revision as of 02:44, 23 January 2023

The _SNDRAWLEN function returns the length, in seconds, of a _SNDRAW 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 actually finished playing sound).
  • If you are getting 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.


Examples


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link