Jump to content

API Sound.SetRate: Difference between revisions

From Flowcode Help
JonnyW (talk | contribs)
XML import of API documentation
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{| class="mtx-class-macrotable wikitable"
 
|-
<sidebar>API Contents</sidebar>
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
Sets the current sample rate for the sound - this will stop the playing sound
| width="90%" class="mtx-class-macrohead" | '''SetRate'''
 
|-
<div style="width:25%; float:right" class="toc">
| colspan="2" | Sets the current sample rate for the sound - this will stop the playing sound&nbsp;
====Class hierarchy====
|-
[[API Sound|Sound]]
|-
:[[API Sound|SetRate]]
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
</div>
| width="90%" | Sounds
__TOC__
|-
 
| colspan="2" | The handle of the sound object to modify&nbsp;
==Parameters==
|-
[[Variable Types|HANDLE]] ''Sounds''
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
:The handle of the sound object to modify
| width="90%" | Rate
 
|-
[[Variable Types|ULONG]] ''Rate''
| colspan="2" | The sample rate to set&nbsp;
: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''
==Return value==
|}
''This call does not return a value''




Line 33: 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)