|
@@ -1,4 +1,4 @@
|
|
|
-extends Node2D
|
|
|
+extends Node
|
|
|
|
|
|
var effect
|
|
|
var recording
|
|
@@ -8,17 +8,19 @@ func _ready():
|
|
|
effect = AudioServer.get_bus_effect(idx, 0)
|
|
|
|
|
|
func _on_RecordButton_pressed():
|
|
|
- if (effect.is_recording_active()):
|
|
|
+ if effect.is_recording_active():
|
|
|
recording = effect.get_recording()
|
|
|
$PlayButton.disabled = false
|
|
|
$SaveButton.disabled = false
|
|
|
effect.set_recording_active(false)
|
|
|
$RecordButton.text = "Record"
|
|
|
+ $Status.text = ""
|
|
|
else:
|
|
|
$PlayButton.disabled = true
|
|
|
$SaveButton.disabled = true
|
|
|
effect.set_recording_active(true)
|
|
|
$RecordButton.text = "Stop"
|
|
|
+ $Status.text = "Recording..."
|
|
|
|
|
|
func _on_PlayButton_pressed():
|
|
|
print(recording)
|
|
@@ -32,7 +34,7 @@ func _on_PlayButton_pressed():
|
|
|
$AudioStreamPlayer.play()
|
|
|
|
|
|
func _on_Play_Music_pressed():
|
|
|
- if ($AudioStreamPlayer2.playing):
|
|
|
+ if $AudioStreamPlayer2.playing:
|
|
|
$AudioStreamPlayer2.stop()
|
|
|
$PlayMusic.text = "Play Music"
|
|
|
else:
|
|
@@ -40,4 +42,6 @@ func _on_Play_Music_pressed():
|
|
|
$PlayMusic.text = "Stop Music"
|
|
|
|
|
|
func _on_SaveButton_pressed():
|
|
|
- recording.save_to_wav($SaveButton/Filename.text)
|
|
|
+ var save_path = $SaveButton/Filename.text
|
|
|
+ recording.save_to_wav(save_path)
|
|
|
+ $Status.text = "Saved WAV file to: %s\n(%s)" % [save_path, ProjectSettings.globalize_path(save_path)]
|