feat: updated engine version to 4.4-rc1
This commit is contained in:
parent
ee00efde1f
commit
21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions
|
|
@ -11,6 +11,7 @@
|
|||
var playback # Will hold the AudioStreamGeneratorPlayback.
|
||||
@onready var sample_hz = $AudioStreamPlayer.stream.mix_rate
|
||||
var pulse_hz = 440.0 # The frequency of the sound wave.
|
||||
var phase = 0.0
|
||||
|
||||
func _ready():
|
||||
$AudioStreamPlayer.play()
|
||||
|
|
@ -18,7 +19,6 @@
|
|||
fill_buffer()
|
||||
|
||||
func fill_buffer():
|
||||
var phase = 0.0
|
||||
var increment = pulse_hz / sample_hz
|
||||
var frames_available = playback.get_frames_available()
|
||||
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
private AudioStreamGeneratorPlayback _playback; // Will hold the AudioStreamGeneratorPlayback.
|
||||
private float _sampleHz;
|
||||
private float _pulseHz = 440.0f; // The frequency of the sound wave.
|
||||
private double phase = 0.0;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -46,7 +47,6 @@
|
|||
|
||||
public void FillBuffer()
|
||||
{
|
||||
double phase = 0.0;
|
||||
float increment = _pulseHz / _sampleHz;
|
||||
int framesAvailable = _playback.GetFramesAvailable();
|
||||
|
||||
|
|
@ -73,6 +73,25 @@
|
|||
The sample rate to use (in Hz). Higher values are more demanding for the CPU to generate, but result in better quality.
|
||||
In games, common sample rates in use are [code]11025[/code], [code]16000[/code], [code]22050[/code], [code]32000[/code], [code]44100[/code], and [code]48000[/code].
|
||||
According to the [url=https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem]Nyquist-Shannon sampling theorem[/url], there is no quality difference to human hearing when going past 40,000 Hz (since most humans can only hear up to ~20,000 Hz, often less). If you are generating lower-pitched sounds such as voices, lower sample rates such as [code]32000[/code] or [code]22050[/code] may be usable with no loss in quality.
|
||||
[b]Note:[/b] [AudioStreamGenerator] is not automatically resampling input data, to produce expected result [member mix_rate_mode] should match the sampling rate of input data.
|
||||
[b]Note:[/b] If you are using [AudioEffectCapture] as the source of your data, set [member mix_rate_mode] to [constant MIX_RATE_INPUT] or [constant MIX_RATE_OUTPUT] to automatically match current [AudioServer] mixing rate.
|
||||
</member>
|
||||
<member name="mix_rate_mode" type="int" setter="set_mix_rate_mode" getter="get_mix_rate_mode" enum="AudioStreamGenerator.AudioStreamGeneratorMixRate" default="2">
|
||||
Mixing rate mode. If set to [constant MIX_RATE_CUSTOM], [member mix_rate] is used, otherwise current [AudioServer] mixing rate is used.
|
||||
</member>
|
||||
</members>
|
||||
<constants>
|
||||
<constant name="MIX_RATE_OUTPUT" value="0" enum="AudioStreamGeneratorMixRate">
|
||||
Current [AudioServer] output mixing rate.
|
||||
</constant>
|
||||
<constant name="MIX_RATE_INPUT" value="1" enum="AudioStreamGeneratorMixRate">
|
||||
Current [AudioServer] input mixing rate.
|
||||
</constant>
|
||||
<constant name="MIX_RATE_CUSTOM" value="2" enum="AudioStreamGeneratorMixRate">
|
||||
Custom mixing rate, specified by [member mix_rate].
|
||||
</constant>
|
||||
<constant name="MIX_RATE_MAX" value="3" enum="AudioStreamGeneratorMixRate">
|
||||
Maximum value for the mixing rate mode enum.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue