Difference between revisions of "API Sound.Create"
(XML import) |
(XML import) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <sidebar>API | + | <sidebar>API Contents</sidebar> |
Creates a sound object that data can be played through | Creates a sound object that data can be played through | ||
Line 10: | Line 10: | ||
==Parameters== | ==Parameters== | ||
− | [[Variable | + | [[Variable Types|ULONG]] ''SampleRate'' |
:The number of samples per second | :The number of samples per second | ||
:''The default value for this parameter is: '''''44100''' | :''The default value for this parameter is: '''''44100''' | ||
− | [[Variable | + | [[Variable Types|BYTE]] ''SampleBits'' |
:The number of bits per sample - either 8 or 16 | :The number of bits per sample - either 8 or 16 | ||
:''The default value for this parameter is: '''''8''' | :''The default value for this parameter is: '''''8''' | ||
− | [[Variable | + | [[Variable Types|BOOL]] ''Stereo'' |
:True to treat each pair of samples as a stereo sample | :True to treat each pair of samples as a stereo sample | ||
:''The default value for this parameter is: '''''0''' | :''The default value for this parameter is: '''''0''' | ||
Line 24: | Line 24: | ||
==Return value== | ==Return value== | ||
− | [[Variable | + | [[Variable Types|HANDLE]] |
− | + | ||
+ | A handle to an object suitable for playing sounds through | ||
==Detailed description== | ==Detailed description== | ||
− | + | Sounds can only be played directly through the [[API Sound.Play|Sound.Play]] call or through a handle to a sound channel. Sounds played through a handle can be [[API Sound.Queue|queued]] and played in sequence, allowing multiple sounds to be played seamlessly. | |
+ | |||
+ | |||
+ | Sounds can be queued on an event, [[Event Sound.Complete|Sound.Complete]], which is a notification that any sound played through this mechanism has finished. | ||
+ | |||
+ | |||
+ | The parameters used here will define the basics of the sound and are used to define the underlying system. Any sounds played have their values adjusted by Flowcode to conform to these values - a sound played which has a native sample rate and details matching the parameters of this call will in general be more efficient and clearer than a sound where the sample rate has to be adjusted to fit. | ||
Line 37: | Line 44: | ||
* Add to a calculation icon: <pre class="brush:[cpp]">result = ::Sound.Create(samplerate, samplebits, false)</pre> | * Add to a calculation icon: <pre class="brush:[cpp]">result = ::Sound.Create(samplerate, samplebits, false)</pre> | ||
− | ''<span style="color:red;">No additional | + | ''<span style="color:red;">No additional examples</span>'' |
Latest revision as of 15:57, 16 January 2014
<sidebar>API Contents</sidebar> Creates a sound object that data can be played through
Contents
Parameters
ULONG SampleRate
- The number of samples per second
- The default value for this parameter is: 44100
BYTE SampleBits
- The number of bits per sample - either 8 or 16
- The default value for this parameter is: 8
BOOL Stereo
- True to treat each pair of samples as a stereo sample
- The default value for this parameter is: 0
Return value
A handle to an object suitable for playing sounds through
Detailed description
Sounds can only be played directly through the Sound.Play call or through a handle to a sound channel. Sounds played through a handle can be queued and played in sequence, allowing multiple sounds to be played seamlessly.
Sounds can be queued on an event, Sound.Complete, which is a notification that any sound played through this mechanism has finished.
The parameters used here will define the basics of the sound and are used to define the underlying system. Any sounds played have their values adjusted by Flowcode to conform to these values - a sound played which has a native sample rate and details matching the parameters of this call will in general be more efficient and clearer than a sound where the sample rate has to be adjusted to fit.
Examples
Calling in a calculation
- Declare a variable 'result' of type HANDLE
- Add to a calculation icon:
result = ::Sound.Create(samplerate, samplebits, false)
No additional examples