Difference between revisions of "API Sound.Queue"

From Flowcode Help
Jump to navigationJump to search
(XML import)
(XML import)
 
(12 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<sidebar>API contents</sidebar>
+
<sidebar>API Contents</sidebar>
 
Queues a sound for playing
 
Queues a sound for playing
  
 
<div style="width:25%; float:right" class="toc">
 
<div style="width:25%; float:right" class="toc">
===Class hierarchy===[[API |API ]]
+
====Class hierarchy====
:[[API Sound|Sound]]
+
[[API Sound|Sound]]
::Queue
+
:[[API Sound|Queue]]
 
</div>
 
</div>
 
__TOC__
 
__TOC__
  
 
==Parameters==
 
==Parameters==
''[[Variable types|HANDLE]] Sounds''
+
[[Variable Types|HANDLE]] ''Sounds''
 
:The handle of the sound object to queue to
 
:The handle of the sound object to queue to
  
''[[Variable types|ARRAY]] Data''
+
[[Variable Types|ARRAY]] ''Data''
 
:The array to play data from
 
:The array to play data from
  
''[[Variable types|ULONG]] Offset''
+
[[Variable Types|ULONG]] ''Offset''
 
:The element in the array to start at
 
:The element in the array to start at
 
:''The default value for this parameter is: '''''0'''
 
:''The default value for this parameter is: '''''0'''
  
''[[Variable types|ULONG]] Elements''
+
[[Variable Types|ULONG]] ''Elements''
 
:The number of elements to play
 
:The number of elements to play
 
:''The default value for this parameter is: '''''-1'''
 
:''The default value for this parameter is: '''''-1'''
  
''[[Variable types|FLOAT]] RateMul''
+
[[Variable Types|FLOAT]] ''RateMul''
 
:A multiplier to the sounds sample rate
 
:A multiplier to the sounds sample rate
 
:''The default value for this parameter is: '''''1'''
 
:''The default value for this parameter is: '''''1'''
 +
  
 
==Return value==
 
==Return value==
[[Variable types|BOOL]]
+
[[Variable Types|BOOL]]
 +
 
 +
Returns true if the operation is a success, else false
  
No additional information
 
  
 
==Detailed description==
 
==Detailed description==
''No additional information''
+
This adds a sound to the queue to be played when the currently playing sound completes. If no sound is currently playing this will play immediately.
 +
 
 +
 
 +
The ''Elements'' is a maximum, and will be bounded to the size of the input ''Array'' if too large. This means passing -1 (unsigned) is the equivalent of 'the full array'. The relevant contents of the ''Array'' are copied so the contents may be altered immediately after this call.
 +
 
 +
The format of each sample in ''Array'' depends on its data type. Floating point samples are assumed to be in the range 0 to 1. All integer values have their sign and bit size considered and are in a range from the minimum to the maximum of their type, so a signed 16 bit array has an expected range -32768 to 32767. To explicitly declare the data format use [[API Sound.QueueEx|Sound.QueueEx]].
 +
 
 +
 
 +
''RateMul'' can be used to adjust the sample rate for the sound in software. Linear interpolation is used to scale the input ''Array'' by this factor. This means to play at half the sample rate (so the sound plays twice as slow) set ''RateMul''=0.5.
 +
 
  
 
==Examples==
 
==Examples==
Line 40: Line 51:
 
* Declare a variable 'result' of type BOOL
 
* Declare a variable 'result' of type BOOL
 
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Sound.Queue(sounds, _arraydata, offset, elements, ratemul)</pre>
 
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Sound.Queue(sounds, _arraydata, offset, elements, ratemul)</pre>
 +
 +
''<span style="color:red;">No additional examples</span>''

Latest revision as of 15:57, 16 January 2014

<sidebar>API Contents</sidebar> Queues a sound for playing

Class hierarchy

Sound

Queue

Parameters

HANDLE Sounds

The handle of the sound object to queue to

ARRAY Data

The array to play data from

ULONG Offset

The element in the array to start at
The default value for this parameter is: 0

ULONG Elements

The number of elements to play
The default value for this parameter is: -1

FLOAT RateMul

A multiplier to the sounds sample rate
The default value for this parameter is: 1


Return value

BOOL

Returns true if the operation is a success, else false


Detailed description

This adds a sound to the queue to be played when the currently playing sound completes. If no sound is currently playing this will play immediately.


The Elements is a maximum, and will be bounded to the size of the input Array if too large. This means passing -1 (unsigned) is the equivalent of 'the full array'. The relevant contents of the Array are copied so the contents may be altered immediately after this call.

The format of each sample in Array depends on its data type. Floating point samples are assumed to be in the range 0 to 1. All integer values have their sign and bit size considered and are in a range from the minimum to the maximum of their type, so a signed 16 bit array has an expected range -32768 to 32767. To explicitly declare the data format use Sound.QueueEx.


RateMul can be used to adjust the sample rate for the sound in software. Linear interpolation is used to scale the input Array by this factor. This means to play at half the sample rate (so the sound plays twice as slow) set RateMul=0.5.


Examples

Calling in a calculation

  • Declare a variable 'result' of type BOOL
  • Add to a calculation icon:
    result = ::Sound.Queue(sounds, _arraydata, offset, elements, ratemul)

No additional examples