PLAY (function): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 9: Line 9:
* {{Parameter|remaining&}} is the number of notes/samples/seconds left to play in the background music queue.
* {{Parameter|remaining&}} is the number of notes/samples/seconds left to play in the background music queue.
* {{Parameter|numericExpression&}} can be any numeric expression.
* {{Parameter|numericExpression&}} can be any numeric expression.
* See also the important version dependent notes in the Availability section.
* '''See also the important version dependent notes in the Availability section.'''





Revision as of 16:23, 18 June 2023

The PLAY function returns the number of remaining notes/samples/seconds in the background music queue.


Syntax

remaining& = PLAY (numericExpression&)


Parameters

  • remaining& is the number of notes/samples/seconds left to play in the background music queue.
  • numericExpression& can be any numeric expression.
  • See also the important version dependent notes in the Availability section.


Description

  • This function may be used to detect, if the background music queue is still playing.
  • When there is nothing left to play, then this function returns zero.


Availability

  • In QB64 and early QB64-PE, this was just implemented as stub function which always returned zero.
  • Since QB64-PE v3.1.0 the function is fully implemented, but unlike QuickBASIC, in QB64-PE this function does not return the number of notes left, but the number of audio samples.
  • In QB64-PE v3.8.0, if numericExpression& is a number other than zero, then the function will return the amount of time (seconds) left to play.


Examples

PLAY "mb l4cf.l8el4fag.l8fl4gl8agl4f.l8fl4a>cl2dl4dl4c.<l8al4afg.l8fl4gl8agl4f.l8dl4dcl2f>l4dc.<l8al4afg.l8fl4g>dc.<l8al4a>cl2dl4dc.<l8al4afg.l8fl4gl8agl4f.l8dl4dcl1f"

PRINT "Playing tune..."

DO
    playLeft& = PLAY(0)
    LOCATE , 1: PRINT "Left to play ="; playLeft&; " ";
LOOP WHILE playLeft&

PRINT: PRINT "And we are done!"

END


See also



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