PLAY (function): Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Added initial documentation for Play function)
No edit summary
Line 1: Line 1:
Returns the number of notes in the background music queue.
The '''PLAY''' function returns the number of remaining notes in the background music queue.




Line 7: Line 7:


{{PageParameters}}
{{PageParameters}}
* {{Parameter|notesLeft&}} is the number of notes left to play in the background music queue. '''In QB64-PE, this is the number of audio samples left to play in the background music queue.'''
* {{Parameter|notesLeft&}} is the number of notes left to play in the background music queue.
;In QB64-PE:this is the number of audio samples left to play in the background music queue.
* {{Parameter|ignored%}} can be any numeric expression. This is ignored.
* {{Parameter|ignored%}} can be any numeric expression. This is ignored.


Line 15: Line 16:
* Unlike QuickBASIC, this does not return the number of notes left but the number of audio samples.
* Unlike QuickBASIC, this does not return the number of notes left but the number of audio samples.
* When there is nothing left to play, this returns zero.
* When there is nothing left to play, this returns zero.
{{PageAvailability}}
* '''QB64-PE v3.1 and up''' (QB64 Phoenix Edition)





Revision as of 13:42, 27 August 2022

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


Syntax

notesLeft& = PLAY (ignored%)


Parameters

  • notesLeft& is the number of notes left to play in the background music queue.
In QB64-PE
this is the number of audio samples left to play in the background music queue.
  • ignored% can be any numeric expression. This is ignored.


Description

  • Use this to detect if the background music queue is still playing.
  • Unlike QuickBASIC, this does not return the number of notes left but the number of audio samples.
  • When there is nothing left to play, this returns zero.


Availability

  • QB64-PE v3.1 and up (QB64 Phoenix Edition)


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