- Edited
Hallo,
i'm experimenting with AudioEffectRecord and audiogenerator.
Do i miss some sort of initializazion step? Like linking the AudioEffectRecord to the AudioStreamPlayer for example? The save produces actually no file saving at all.
#Declaration
var rec : AudioEffectRecord = null
func _process(_delta):
_get_input()
_fill_buffer()
func _ready():
rec = AudioEffectRecord.new()
$Player.stream.mix_rate = sample_hz # Setting mix rate is only possible before play().
playback = $Player.get_stream_playback()
_fill_buffer() # Prefill, do before play() to avoid delay.
$Player.play()
func _get_input():
if Input.is_action_pressed("ui_up"):
pulse_hz += 0.1
if Input.is_action_pressed("ui_down"):
pulse_hz -= 0.1
if Input.is_action_pressed("ui_right"):
pivar += 0.1
if Input.is_action_pressed("ui_left"):
pivar -= 0.1
if Input.is_action_just_pressed("ui_page_up"):
rec.set_recording_active(true)
if Input.is_action_just_pressed("ui_page_down"):
#rec.set_recording_active(false)
rec.get_recording().save_to_wav("res://1.wav")
Any hints is appreciated. P.s I've skipped other irrelevant code.
Thanks