Compare commits

..

No commits in common. "e1dc2d2be6b70bfb54e8fa1ad59d0eec9699cc06" and "6b61262f44362b0fd331611239e3363f3de94b7a" have entirely different histories.

12 changed files with 11 additions and 460 deletions

View File

@ -1,19 +0,0 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var spectrum_record
# Called when the node enters the scene tree for the first time.
func _ready():
var idx = AudioServer.get_bus_index("Record")
spectrum_record = AudioServer.get_bus_effect_instance(1,1)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var magnitude = spectrum_record.get_magnitude_for_frequency_range(0,11050.0).length()
var energy = clamp((60 + linear2db(magnitude)) / 60, 0, 1)
$RecordMeter.value = energy * 100

View File

@ -1,31 +0,0 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://UI/src/meter.png" type="Texture" id=1]
[ext_resource path="res://Components/MicMeterHoriz.gd" type="Script" id=2]
[sub_resource type="AudioStreamMicrophone" id=1]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RecordMeter" type="TextureProgress" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
rect_min_size = Vector2( 0, 16 )
size_flags_horizontal = 3
size_flags_vertical = 0
texture_progress = ExtResource( 1 )
nine_patch_stretch = true
__meta__ = {
"_edit_use_anchors_": false
}
[node name="AudioStreamRecorder" type="AudioStreamPlayer" parent="."]
stream = SubResource( 1 )
autoplay = true
bus = "Record"

View File

@ -1,106 +0,0 @@
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var spectrum_play
var spectrum_record
var recorder
var populated_devices
func capture_device_name_to_id(find_device_name):
var capture_devices = AudioServer.capture_get_device_list()
var current_device_id = 0
for device in capture_devices:
if device == find_device_name:
return current_device_id
current_device_id += 1
func capture_id_to_device_name(find_device_id):
var capture_devices = AudioServer.capture_get_device_list()
var current_device_id = 0
for device in capture_devices:
if current_device_id == find_device_id:
return device
current_device_id += 1
func playback_device_name_to_id(find_device_name):
var playback_devices = AudioServer.get_device_list()
var current_device_id = 0
for device in playback_devices:
if device == find_device_name:
return current_device_id
current_device_id += 1
func playback_id_to_device_name(find_device_id):
var playback_devices = AudioServer.get_device_list()
var current_device_id = 0
for device in playback_devices:
if current_device_id == find_device_id:
return device
current_device_id += 1
# Called when the node enters the scene tree for the first time.
func _ready():
Globals.loadConfig() # noop if startup has done it.
populated_devices = false
var capture_device_list = $MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer/RecordDeviceDropdown
var playback_device_list = $MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer3/PlaybackDeviceDropdown
capture_device_list.clear()
playback_device_list.clear()
var capture_devices = AudioServer.capture_get_device_list()
print(capture_devices)
var current_device_id = 0
for device in capture_devices:
capture_device_list.add_item(device, current_device_id)
current_device_id += 1
if Globals.capture_device != "":
capture_device_list.select(capture_device_name_to_id(Globals.capture_device))
var playback_devices = AudioServer.get_device_list()
print(playback_devices)
current_device_id = 0
for device in playback_devices:
playback_device_list.add_item(device, current_device_id)
current_device_id += 1
if Globals.playback_device != "":
playback_device_list.select(playback_device_name_to_id(Globals.playback_device))
var idx = AudioServer.get_bus_index("Record")
recorder = AudioServer.get_bus_effect(idx, 0)
spectrum_play = AudioServer.get_bus_effect_instance(0,0)
spectrum_record = AudioServer.get_bus_effect_instance(1,1)
populated_devices = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_Quit_pressed():
get_tree().change_scene("res://main_menu.tscn")
func _on_DecordDeviceDropdown_item_selected(index):
if !populated_devices:
return
var deviceString = capture_id_to_device_name(index)
AudioServer.capture_set_device(deviceString)
Globals.capture_device = deviceString
Globals.saveConfig()
func _on_TestPlaybackButton_pressed():
$AudioStreamPlayer.play()
func _on_PlaybackDeviceDropdown_item_selected(index):
if !populated_devices:
return
var deviceString = playback_id_to_device_name(index)
AudioServer.set_device(deviceString)
Globals.playback_device = deviceString
Globals.saveConfig()

View File

@ -1,202 +0,0 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://main_menu.gd" type="Script" id=1]
[ext_resource path="res://GlobalSettings.gd" type="Script" id=2]
[ext_resource path="res://Components/MicMeterHoriz.tscn" type="PackedScene" id=3]
[ext_resource path="res://UI/src/165316__ani-music__synthesizer-echo-plinks-2.wav" type="AudioStream" id=4]
[node name="Control" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 5.0
margin_top = 5.0
margin_right = -5.0
margin_bottom = -5.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
margin_right = 1014.0
margin_bottom = 590.0
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"]
margin_right = 1014.0
margin_bottom = 20.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
margin_top = 3.0
margin_right = 20.0
margin_bottom = 17.0
rect_min_size = Vector2( 20, 0 )
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
margin_left = 24.0
margin_right = 990.0
margin_bottom = 20.0
size_flags_horizontal = 3
[node name="RichTextLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2/VBoxContainer"]
margin_right = 966.0
margin_bottom = 14.0
size_flags_horizontal = 3
text = "SETTINGS MENU"
align = 1
[node name="Quit" type="Button" parent="MarginContainer/VBoxContainer/HBoxContainer2"]
margin_left = 994.0
margin_right = 1014.0
margin_bottom = 20.0
text = "X"
script = ExtResource( 1 )
[node name="TabContainer" type="TabContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 24.0
margin_right = 1014.0
margin_bottom = 590.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="Audio" type="Tabs" parent="MarginContainer/VBoxContainer/TabContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio"]
anchor_right = 1.0
margin_left = 5.0
margin_top = 32.0
margin_right = -5.0
margin_bottom = 32.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer"]
margin_right = 996.0
margin_bottom = 20.0
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer"]
margin_top = 3.0
margin_right = 115.0
margin_bottom = 17.0
rect_min_size = Vector2( 115, 0 )
text = "Capture Device : "
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RecordDeviceDropdown" type="OptionButton" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer"]
margin_left = 119.0
margin_right = 892.0
margin_bottom = 20.0
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer"]
margin_left = 896.0
margin_top = 3.0
margin_right = 996.0
margin_bottom = 17.0
rect_min_size = Vector2( 100, 0 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer"]
margin_top = 24.0
margin_right = 996.0
margin_bottom = 39.0
size_flags_horizontal = 3
[node name="Recordlabel" type="RichTextLabel" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer2"]
margin_right = 115.0
margin_bottom = 15.0
rect_min_size = Vector2( 115, 0 )
text = "Record meter :"
fit_content_height = true
[node name="Control" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer2" instance=ExtResource( 3 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 119.0
margin_right = 892.0
margin_bottom = 15.0
size_flags_horizontal = 3
[node name="Label3" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer2"]
margin_left = 896.0
margin_right = 996.0
margin_bottom = 14.0
rect_min_size = Vector2( 100, 0 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxContainer3" type="HBoxContainer" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer"]
margin_top = 43.0
margin_right = 996.0
margin_bottom = 63.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer3"]
margin_top = 3.0
margin_right = 115.0
margin_bottom = 17.0
rect_min_size = Vector2( 110, 0 )
text = "Playback Device : "
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PlaybackDeviceDropdown" type="OptionButton" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer3"]
margin_left = 119.0
margin_right = 892.0
margin_bottom = 20.0
size_flags_horizontal = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TestPlaybackButton" type="Button" parent="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer3"]
margin_left = 896.0
margin_right = 996.0
margin_bottom = 20.0
rect_min_size = Vector2( 100, 0 )
text = "Test Playback"
[node name="Providers" type="Tabs" parent="MarginContainer/VBoxContainer/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Quit" to="." method="_on_Quit_pressed"]
[connection signal="item_selected" from="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer/RecordDeviceDropdown" to="." method="_on_DecordDeviceDropdown_item_selected"]
[connection signal="item_selected" from="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer3/PlaybackDeviceDropdown" to="." method="_on_PlaybackDeviceDropdown_item_selected"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/TabContainer/Audio/GridContainer/HBoxContainer3/TestPlaybackButton" to="." method="_on_TestPlaybackButton_pressed"]

View File

@ -1,11 +1,6 @@
extends Node2D
var pid_of_dlserver = 0
var capture_device = "Default"
var playback_device = "Default"
var audio_delay_seconds = 0.0
var config_loaded = false
var config = ConfigFile.new()
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
@ -25,28 +20,3 @@ func _notification(what):
print("Killing dl-server, pid ",pid_of_dlserver)
OS.kill(pid_of_dlserver)
get_tree().quit() # default behavior
func loadConfig():
if !config_loaded:
config.load("user://settings.cfg")
if not config.has_section_key("audio","playback_device"):
config.set_value("audio","playback_device","Default")
playback_device = config.get_value("audio","playback_device","Default")
AudioServer.set_device(playback_device)
if not config.has_section_key("audio","capture_device"):
config.set_value("audio","capture_device","Default")
capture_device = config.get_value("audio","capture_device","Default")
AudioServer.capture_set_device(capture_device)
if not config.has_section_key("audio","audio_delay_seconds"):
config.set_value("audio","audio_delay_seconds",0.0)
audio_delay_seconds = config.get_value("audio","audio_delay_seconds",0.0)
config.save("user://settings.cfg")
config_loaded = true
func saveConfig():
config.load("user://settings.cfg")
config.set_value("audio","playback_device",playback_device)
config.set_value("audio","capture_device",capture_device)
config.set_value("audio","audio_delay_seconds",audio_delay_seconds)
config.save("user://settings.cfg")

View File

@ -16,40 +16,20 @@ var position_changing_by_code
# Called when the node enters the scene tree for the first time.
func _ready():
Globals.loadConfig() # noop if startup has done it.
## This SHOULD be how the native support works :
#var stream = VideoStreamGDNative.new()
#$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.set_stream(load(OS.get_user_data_dir()+"/converted.webm"))
#var file = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.stream.get_file()
#print(file)
#stream.set_file(file)
#var vp = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer
#vp.stream = stream
#print(vp.stream.to_string())
#vp.stream_position = -1
#var duration = vp.stream_position
#vp.stream_position = 0
#$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider.max_value = duration
## So we're back to VideoStreamWebM
#var GDS = VideoStreamGDNative.new()
#GDS.set_file(OS.get_user_data_dir()+"/converted.mpg")
#$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.set_stream(load(GDS.get_file()))
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.set_stream(load(OS.get_user_data_dir()+"/converted.webm"))
var vp = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer
print(vp.stream.to_string())
vp.stream_position = -1
#var duration = Globals.video_duration
var duration = 313.701
vp.stream_position = 0
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider.max_value = duration
print(duration)
# And set up the recording bus and meters
print($MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.stream.to_string())
#$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider.max_value = 364
#print($MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.to_string())
var idx = AudioServer.get_bus_index("Record")
recorder = AudioServer.get_bus_effect(idx, 0)
spectrum_play = AudioServer.get_bus_effect_instance(0,0)
spectrum_record = AudioServer.get_bus_effect_instance(1,1)
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer/DelaySlider.value = Globals.audio_delay_seconds * 1000
position_changing_by_code = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var magnitude: float = spectrum_play.get_magnitude_for_frequency_range(0,11050.0).length()
@ -62,7 +42,7 @@ func _process(delta):
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer2/AudioPos.text = "Audio Pos : "+String($AudioStreamPlayer.get_playback_position())
if !position_changing_by_code:
position_changing_by_code = true
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider.value = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.stream_position
#$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider.value = $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.stream_position
position_changing_by_code = false
@ -87,9 +67,6 @@ func _on_PlayButton_pressed():
$AudioStreamPlayer.stream = raw_recording
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.play()
$AudioStreamPlayer.play()
$AudioStreamPlayer.stream_paused = true
$AudioStreamPlayer.seek($MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer/DelaySlider.value/1000)
$AudioStreamPlayer.stream_paused = false
#$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider.editable = true
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer/DelaySlider.editable = true
@ -109,8 +86,7 @@ func _on_DelaySlider_value_changed(value):
$AudioStreamPlayer.seek($MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.stream_position + value/1000)
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.paused = false
$AudioStreamPlayer.stream_paused = false
Globals.audio_delay_seconds = value/1000
Globals.saveConfig()
pass # Replace with function body.
func _on_VideoPosSlider_value_changed(value):
@ -123,7 +99,3 @@ func _on_VideoPosSlider_value_changed(value):
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPlayer.paused = false
position_changing_by_code = false
$AudioStreamPlayer.stream_paused = false
func _on_Quit_pressed():
get_tree().change_scene("res://main_menu.tscn")

View File

@ -271,7 +271,7 @@ autoplay = true
bus = "Record"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Quit" to="." method="_on_Quit_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Quit" to="MarginContainer/VBoxContainer/HBoxContainer2/Quit" method="_on_Quit_pressed"]
[connection signal="value_changed" from="MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/VideoPosSlider" to="." method="_on_VideoPosSlider_value_changed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/RecordButton" to="." method="_on_RecButton_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton" to="." method="_on_PlayButton_pressed"]

View File

@ -1,21 +0,0 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/165316__ani-music__synthesizer-echo-plinks-2.wav-afa2dc51ff12b588ed3e47656e3c5d27.sample"
[deps]
source_file="res://UI/src/165316__ani-music__synthesizer-echo-plinks-2.wav"
dest_files=[ "res://.import/165316__ani-music__synthesizer-echo-plinks-2.wav-afa2dc51ff12b588ed3e47656e3c5d27.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop=false
compress/mode=0

View File

@ -50,7 +50,6 @@ func _on_HTTPRequest_request_completed(result, response_code, headers, body):
if json.result != null:
$VBoxContainer2/DownloadProgress.value = json.result["percentage"]
if json.result["percentage"] == 100:
#Globals.video_duration = json.result["duration_seconds"]
get_tree().change_scene("res://justplayer.tscn")
#print(json.result)
#print(json.result["percentage"])

View File

@ -29,7 +29,3 @@ func _on_MicTest_pressed():
func _on_DownloadPlayVid2_pressed():
get_tree().change_scene("res://PlayVideoRecordAudio.tscn")
func _on_Settings_pressed():
get_tree().change_scene("res://GlobalSettings.tscn")

View File

@ -57,7 +57,7 @@ script = ExtResource( 1 )
[node name="GridContainer" type="GridContainer" parent="MarginContainer/VBoxContainer"]
margin_top = 24.0
margin_right = 1014.0
margin_bottom = 135.0
margin_bottom = 111.0
__meta__ = {
"_edit_use_anchors_": false
}
@ -91,14 +91,7 @@ margin_top = 67.0
margin_right = 1014.0
margin_bottom = 87.0
text = "Mic Test"
[node name="Settings" type="Button" parent="MarginContainer/VBoxContainer/GridContainer"]
margin_top = 91.0
margin_right = 1014.0
margin_bottom = 111.0
text = "Settings"
[connection signal="pressed" from="MarginContainer/VBoxContainer/HBoxContainer2/Quit" to="MarginContainer/VBoxContainer/HBoxContainer2/Quit" method="_on_Quit_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/GridContainer/DownloadPlayVid" to="." method="_on_Button_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/GridContainer/DownloadPlayVid2" to="." method="_on_DownloadPlayVid2_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/GridContainer/MicTest" to="." method="_on_MicTest_pressed"]
[connection signal="pressed" from="MarginContainer/VBoxContainer/GridContainer/Settings" to="." method="_on_Settings_pressed"]