PLAY (function): Difference between revisions

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




{{PageSyntax}}
{{PageSyntax}}
: {{Parameter|resVar with type suffix}} = '''PLAY''' ({{Parameter|arguments with suffix}})
: {{Parameter|notesLeft&}} = '''PLAY''' ({{Parameter|ignored%}})




{{PageParameters}}
{{PageParameters}}
* describe {{Parameter|resVar}}
* {{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.'''
* descibe {{Parameter|argument}}
* {{Parameter|ignored%}} can be any numeric expression. This is ignored.




{{PageDescription}}
{{PageDescription}}
* Full description here, use as many dots you need.
* 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.




{{PageExamples}}
{{PageExamples}}
* Place the example desciption here
{{CodeStart}}
{{CodeStart}}
Inside this block place keywords in Cl templates
{{Cl|PLAY}} "mb l4cf.l8el4fag.l8fl4gl8agl4f.l8fl4a>cl2dl4dl4c.<l8al4afg.l8fl4gl8agl4f.l8dl4dcl2f>l4dc.<l8al4afg.l8fl4g>dc.<l8al4a>cl2dl4dc.<l8al4afg.l8fl4gl8agl4f.l8dl4dcl1f"
{{Cl|Keyword}} where the keyword=page link eg. {{Cl|PLAY}} for the PLAY statement
 
or
{{Cl|PRINT}} "Playing tune..."
{{Cl|page link|Keyword}} where the link is different from keyword
 
eg. {{Cl|PLAY (function)|PLAY}} for the PLAY function
{{Cl|DO}}
or {{Cl|IF...THEN|IF}} for the IF clause
    playLeft& = {{Cl|PLAY (function)|PLAY}}(0)
    {{Cl|LOCATE}} , 1: {{Cl|PRINT}} "Left to play ="; playLeft&; " ";
{{Cl|LOOP}} {{Cl|WHILE}} playLeft&
 
{{Cl|PRINT}}: {{Cl|PRINT}} "And we are done!"
 
{{Cl|END}}
{{CodeEnd}}
{{CodeEnd}}


{{PageSeeAlso}}
{{PageSeeAlso}}
* [[keyword]]
* [[PLAY]] (statement)
* [[link|keyword]]
* [[SOUND]]
* [[BEEP]]
* [[_SNDOPEN]] (play sound files)
* [[_SNDRAW]] (play frequency waves)




{{PageNavigation}}
{{PageNavigation}}

Revision as of 12:53, 27 August 2022

Returns the number of 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.


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