API Sound.Queue

From Flowcode Help
Jump to navigationJump to search
Fc9-comp-macro.png Queue
Queues a sound for playing 
Fc9-h32-icon.png - HANDLE Sounds
The handle of the sound object to queue to 
Fc9-void-icon.png - ARRAY Data
The array to play data from 
Fc9-u32-icon.png - ULONG Offset
The element in the array to start at 
Fc9-u32-icon.png - ULONG Elements
The number of elements to play 
Fc9-f32-icon.png - FLOAT RateMul
A multiplier to the sounds sample rate 
Fc9-bool-icon.png - BOOL Return


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)