Difference between revisions of "API Sound.QueueEx"
(XML import of updated API docs) |
(XML import) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | <sidebar>API Contents</sidebar> | |
− | |||
− | <sidebar>API | ||
Queues a sound for playing, with the format provided | Queues a sound for playing, with the format provided | ||
Line 75: | Line 73: | ||
==Detailed description== | ==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'' is explicitly declared, so the data may be read from a file and its format decided dynamically. | ||
+ | |||
+ | 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. | ||
+ | |||
+ | |||
+ | ''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. | ||
+ | |||
Latest revision as of 15:57, 16 January 2014
<sidebar>API Contents</sidebar> Queues a sound for playing, with the format provided
Contents
Parameters
HANDLE Sounds
- The handle of the sound object to queue to
BYTE[] Data
- The array to play data from
ULONG ByteOffset
- The byte-offset in the array to start at
UINT SampleFormat
- Format of the samples
- Typical values for this parameter:
Name Description Fmt_Signed8 Source data is in the range -128 to 127 Fmt_Unsigned8 Source data is in the range 0 to 255 Fmt_Signed16 Source data is in the range -32768 to 32767 Fmt_Unsigned16 Source data is in the range 0 to 65535 Fmt_Signed32 Source data is a signed 32-bit value Fmt_Unsigned32 Source data is an unsigned 32-bit value Fmt_Float32 Source data is a 32-bit float from 0 to 1 Fmt_Float64 Source data is a 64-bit float from 0 to 1 Fmt_Mono Set this flag to set a single source element per sample Fmt_Stereo Set this flag to two source elements per sample
ULONG Elements
- The number of sample elements to play
FLOAT RateMul
- A multiplier to the sounds sample rate
- The default value for this parameter is: 1
Return value
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 is explicitly declared, so the data may be read from a file and its format decided dynamically.
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.
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.QueueEx(sounds, _arraydata, byteoffset, ::Sound.Fmt_Signed8, elements, ratemul)
No additional examples