Difference between revisions of "API Sound.SetRate"

From Flowcode Help
Jump to navigationJump to search
(XML import of API auto-gen)
 
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
wiki page name
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
==SoundSetRate==
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''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''
 +
|}
  
Sets the current sample rate for the sound - this will stop the playing sound
 
----
 
  
===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 11:55, 16 January 2023

Fc9-comp-macro.png SetRate
Sets the current sample rate for the sound - this will stop the playing sound 
Fc9-h32-icon.png - HANDLE Sounds
The handle of the sound object to modify 
Fc9-u32-icon.png - ULONG Rate
The sample rate to set 
Fc9-void-icon.png - 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)