Jump to content

API Sound.SetRate: Difference between revisions

From Flowcode Help
JonnyW (talk | contribs)
XML import of updated API docs
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{| class="mtx-class-macrotable wikitable"
|-
| 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''
|}




<sidebar>API contents</sidebar>
==Detailed description==
Sets the current sample rate for the sound - this will stop the playing sound
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.
 
<div style="width:25%; float:right" class="toc">
====Class hierarchy====
[[API Sound|Sound]]
:[[API Sound|SetRate]]
</div>
__TOC__
 
==Parameters==
[[Variable Types|HANDLE]] ''Sounds''
:The handle of the sound object to modify
 
[[Variable Types|ULONG]] ''Rate''
:The sample rate to set
 
 
==Return value==
''This call does not return a value''




==Detailed description==
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.
''<span style="color:red;">No additional information</span>''




Line 30: Line 32:
===Calling in a calculation===
===Calling in a calculation===
* Add to a calculation icon: <pre class="brush:[cpp]">::Sound.SetRate(sounds, rate)</pre>
* Add to a calculation icon: <pre class="brush:[cpp]">::Sound.SetRate(sounds, rate)</pre>
''<span style="color:red;">No additional examples</span>''

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)