Jump to content

API Sound.SetRate: Difference between revisions

From Flowcode Help
Admin (talk | contribs)
XML import API auto-gen
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
API contents
{| class="mtx-class-macrotable wikitable"
Sets the current sample rate for the sound - this will stop the playing sound
|-
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" class="mtx-class-macrohead" | '''SetRate'''
|-
| colspan="2" | Sets the current sample rate for the sound - this will stop the playing sound 
|-
|-
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
| width="90%" | Sounds
|-
| colspan="2" | The handle of the sound object to modify 
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | Rate
|-
| colspan="2" | The sample rate to set 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - NONE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}




===Parameters===
==Detailed description==
''[[Variable types|HANDLE]] Sounds''
The base sample is specified in creation through [[API Sound.Create|Sound.Create]]. This call stops the current playing sound and resets that rate. Subsequent sounds played through this handle will play at the given rate.
:The handle of the sound object to modify


''[[Variable types|ULONG]] Rate''
:The sample rate to set


===Return value===
If the sound handle is currently playing samples, these will be cleared meaning noticeable glitches may occur. To avoid this, use the ''RateMul'' parameter in [[API Sound.Queue|Sound.Queue]] or [[API Sound.QueueEx|Sound.QueueEx]] to perform software conversion per wave, which will not glitch.
''This call does not return a value''


===Detailed description===
''No additional information''


===Examples===
==Examples==
====Calling in a calculation====
===Calling in a calculation===
* Add to a calculation icon: ::Sound.SetRate(sounds, rate)
* Add to a calculation icon: <pre class="brush:[cpp]">::Sound.SetRate(sounds, rate)</pre>

Latest revision as of 13:17, 13 July 2026

SetRate
Sets the current sample rate for the sound - this will stop the playing sound 
- HANDLE Sounds
The handle of the sound object to modify 
- ULONG Rate
The sample rate to set 
- NONE Return


Detailed description

The base sample is specified in creation through Sound.Create. This call stops the current playing sound and resets that rate. Subsequent sounds played through this handle will play at the given rate.


If the sound handle is currently playing samples, these will be cleared meaning noticeable glitches may occur. To avoid this, use the RateMul parameter in Sound.Queue or Sound.QueueEx to perform software conversion per wave, which will not glitch.


Examples

Calling in a calculation

  • Add to a calculation icon:
    ::Sound.SetRate(sounds, rate)