More mastodon stuff
continuous-integration/drone/push Build was killed Details

This commit is contained in:
Martyn 2020-10-09 12:19:56 +02:00
parent d480f43f63
commit 54626c9f08
8 changed files with 156 additions and 29 deletions

View File

@ -24,6 +24,14 @@ enum CompletionTypeOptions {
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
print(unBundle("""Hey, I sang part of Don't Give Up by Peter Gabriel at https://no.where and it's not complete until you sing the rest of it with me!
With #ASingCrow, you can join it and other songs.
The audio track(s) are attached.
Backing volume recommendation: 1db.
Parts volume recommendations: 40db, 40db.
Audio delay recommendations: 0.166s
#test #ignore
"""))
pass # Replace with function body. pass # Replace with function body.
func setSongTitle(value): func setSongTitle(value):
@ -56,6 +64,7 @@ func setBackVolume(value):
func getFinalText(): func getFinalText():
var completiontext = "" var completiontext = ""
var partof = "" var partof = ""
var i = 0
match CompletionType : match CompletionType :
CompletionTypeOptions.OpenSeed: CompletionTypeOptions.OpenSeed:
completiontext = " and it's not complete until you sing the rest of it with me!" completiontext = " and it's not complete until you sing the rest of it with me!"
@ -70,21 +79,66 @@ func getFinalText():
CompletionTypeOptions.AllMelody: CompletionTypeOptions.AllMelody:
partof = "only the melody of " partof = "only the melody of "
completiontext = " and would love someone to put some harmonies underneath!" completiontext = " and would love someone to put some harmonies underneath!"
var partstext = "The audio track are attached" var partstext = "The audio track(s) are attached"
if len(PartsURLs) > 0: if len(PartsURLs) > 0:
partstext = "The audio track urls are :" partstext = "The audio track urls are :"
for parturl in PartsURLs: for parturl in PartsURLs:
partstext += " "+parturl partstext += " "+parturl
partstext += ".\n" partstext += ".\n"
var volumetext = "Backing volume recommendation: "+String(BackVolume)+"db. Parts volume recommendations: " var volumetext = "Backing volume recommendation: "+String(BackVolume)+"db.\nParts volume recommendations: "
i = 0
for partvolume in PartsVolumes: for partvolume in PartsVolumes:
volumetext += String(partvolume)+"db, " volumetext += String(partvolume)+"db"
if len(PartsVolumes) > i+1:
volumetext += ", "
i += 1
volumetext += ".\n" volumetext += ".\n"
var partdelaytext = "Audio delay recommendations: " var partdelaytext = "Audio delay recommendations: "
i = 0
for partDelay in PartsDelays: for partDelay in PartsDelays:
partdelaytext += String(partDelay)+"s, " partdelaytext += String(partDelay)+"s"
if len(PartsDelays) > i+1:
partdelaytext += ", "
return "Hey, I sang "+partof+SongTitle+" by "+SongArtist+" at "+OriginalURL+completiontext+" "+\ return "Hey, I sang "+partof+SongTitle+" by "+SongArtist+" at "+OriginalURL+completiontext+" "+\
"\nWith #ASingCrow, you can join it and other songs.\n"+partstext+volumetext+partdelaytext+" "+Tags "\nWith #ASingCrow, you can join it and other songs.\n"+partstext+volumetext+partdelaytext+"\n"+Tags
func unBundle(text):
var result = {}
var regex = RegEx.new()
regex.compile("(part of|only the (?<parttype>\\w) of) (?<trackname>.+) by (?<originalartist>.+) at (?<trackurl>[^ ]*) (and[^!]*!|let[^!]*!|with[^!]*!)")
var search = regex.search(text)
result.parttype = search.get_string("parttype")
result.trackname = search.get_string("trackname")
result.originalartist = search.get_string("originalartist")
result.trackurl = search.get_string("trackurl")
regex.compile("(?<embeddedaudio>audio track(s|\\(s\\))? are attached)|audio track urls are : (?<trackurls>.*)")
search = regex.search(text)
if search.get_string("embeddedaudio"):
result.embeddedaudio = true
else:
result.embeddedaudio = false
regex.compile("Backing volume recommendation: (?<mainvol>[^d]+)db")
search = regex.search(text)
result.mainvol = search.get_string("mainvol")
regex.compile("Parts volume recommendations: (?<partvol>([^d]+db(, )?)+)")
search = regex.search(text)
var partsstr = search.get_string("partvol")
regex.compile("(?<db>[\\d\\.]+)db")
search = regex.search_all(partsstr)
var partvols = []
for each in search:
partvols.append(each.get_string("db"))
result.partvols = partvols
regex.compile("Audio delay recommendations: (?<partsdelays>([\\d\\.]+s(, )?)+)")
search = regex.search(text)
partsstr = search.get_string("partsdelays")
regex.compile("(?<seconds>[\\d\\.]+)s")
search = regex.search_all(partsstr)
var partsdelays = []
for each in search:
partsdelays.append(each.get_string("seconds"))
result.partsdelays = partsdelays
return result
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta): #func _process(delta):

View File

@ -19,7 +19,7 @@ func set_count(value):
sliders = [] sliders = []
for i in range(0,value): for i in range(0,value):
if len(values) < value+1: if len(values) < value+1:
values.append(50) values.append(100)
var slice = VBoxContainer.new() var slice = VBoxContainer.new()
var slider = VSlider.new() var slider = VSlider.new()
slider.hint_tooltip = "Vocal mix "+String(i+1) slider.hint_tooltip = "Vocal mix "+String(i+1)

View File

@ -1,20 +1,63 @@
extends Control extends Control
# Declare member variables here. Examples: # Declare member variables here. Examples:
# var a = 2 # var a = 2
# var b = "text" # var b = "text"
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta): #func _process(delta):
# pass # pass
var SongTitle = ""
var SongArtist = ""
var CompletionType
var Tags = ""
var OriginalURL = ""
var PartsURLs = []
var PartsVolumes = []
var PartsDelays = []
var PartsOthers = []
var BackVolume = 0
func setSongTitle(value):
SongTitle = value
BundlePost.setSongTitle(value)
func setSongArtist(value):
SongArtist = value
BundlePost.setSongArtist(value)
func setCompletionType(value):
CompletionType = value
BundlePost.setCompletionType(value)
func setTags(value):
Tags = value
BundlePost.setTags(value)
func setOriginalURL(value):
OriginalURL = value
BundlePost.setOriginalURL(value)
func setPartsURLs(value):
PartsURLs = value
BundlePost.setPartsURLs(value)
func setPartsVolumes(value):
PartsVolumes = value
BundlePost.setPartsVolumes(value)
func setPartsDelays(value):
PartsDelays = value
BundlePost.setPartsDelays(value)
func setBackVolume(value):
BackVolume = value
BundlePost.setBackVolume(value)
func _on_any_text_changed(new_text): func _on_any_text_changed(new_text):
BundlePost.setSongArtist($HBoxContainer/GridContainer/GridContainer/ArtistEdit.text) BundlePost.setSongArtist($HBoxContainer/GridContainer/GridContainer/ArtistEdit.text)
@ -33,9 +76,9 @@ func _on_any_text_changed(new_text):
BundlePost.setSongTitle($HBoxContainer/GridContainer/GridContainer/SongEdit.text) BundlePost.setSongTitle($HBoxContainer/GridContainer/GridContainer/SongEdit.text)
BundlePost.setTags($HBoxContainer/GridContainer/GridContainer/TagsEdit.text) BundlePost.setTags($HBoxContainer/GridContainer/GridContainer/TagsEdit.text)
$HBoxContainer/Panel/GridContainer/PostContent.text = BundlePost.getFinalText() $HBoxContainer/Panel/GridContainer/PostContent.text = BundlePost.getFinalText()
print(BundlePost.getFinalText())
pass # Replace with function body. pass # Replace with function body.
func _on_Control_ready(): func _on_Control_ready():
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Open Seed - part of a duet") $HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Open Seed - part of a duet")
$HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Solo Completion") $HBoxContainer/GridContainer/GridContainer/CompletionDropdown.add_item("Solo Completion")

View File

@ -96,9 +96,6 @@ margin_right = 510.0
margin_bottom = 14.0 margin_bottom = 14.0
size_flags_horizontal = 3 size_flags_horizontal = 3
text = "Post looks like :" text = "Post looks like :"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="PostContent" type="Label" parent="HBoxContainer/Panel/GridContainer"] [node name="PostContent" type="Label" parent="HBoxContainer/Panel/GridContainer"]
margin_top = 18.0 margin_top = 18.0
@ -108,6 +105,20 @@ autowrap = true
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Button" type="Button" parent="."]
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -130.0
margin_top = -38.0
margin_right = -10.0
margin_bottom = -10.0
text = "Post to Mastodon"
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="ready" from="." to="." method="_on_Control_ready"] [connection signal="ready" from="." to="." method="_on_Control_ready"]
[connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/ArtistEdit" to="." method="_on_any_text_changed"] [connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/ArtistEdit" to="." method="_on_any_text_changed"]
[connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/SongEdit" to="." method="_on_any_text_changed"] [connection signal="text_changed" from="HBoxContainer/GridContainer/GridContainer/SongEdit" to="." method="_on_any_text_changed"]

View File

@ -18,6 +18,8 @@ var streams_recorded_here = []
var stream_data = [] var stream_data = []
var position_changing_by_code var position_changing_by_code
var delays = [] var delays = []
var volumes = []
var backvolume = 1.0
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
@ -66,6 +68,8 @@ func _on_RecButton_pressed():
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.stop() $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.stop()
raw_recording = recorder.get_recording() raw_recording = recorder.get_recording()
stream_data.append(raw_recording) stream_data.append(raw_recording)
delays.append(Globals.audio_delay_seconds)
volumes.append(linear2db(1))
current_stream_added = false current_stream_added = false
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton.disabled = false $MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton.disabled = false
recorder.set_recording_active(false) recorder.set_recording_active(false)
@ -96,6 +100,7 @@ func _on_PlayButton_pressed():
else: else:
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton.text = "Stop" $MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton.text = "Stop"
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/RecordButton.text = "Record another layer (part)" $MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/RecordButton.text = "Record another layer (part)"
$MarginContainer/VBoxContainer/HBoxContainer4/PublishButton.disabled = false
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/RecordButton.disabled = true $MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/RecordButton.disabled = true
if !current_stream_added: if !current_stream_added:
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.add_audio_stream(raw_recording,Globals.audio_delay_seconds) $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.add_audio_stream(raw_recording,Globals.audio_delay_seconds)
@ -115,22 +120,11 @@ func _on_PlayButton_pressed():
func _on_BackgroundaudioSlider_changed(value): func _on_BackgroundaudioSlider_changed(value):
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_volume_db(linear2db(value/100)) $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_volume_db(linear2db(value/100))
backvolume = linear2db(value/100)
func _on_VocalSlider_value_changed(value): func _on_VocalSlider_value_changed(value):
$AudioStreamPlayer.volume_db = linear2db(value/100) $AudioStreamPlayer.volume_db = linear2db(value/100)
func _on_DelaySlider_value_changed(value):
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer/Label.text = "Audio Delay: "+String(value/1000)+"s"
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_paused(true)
$AudioStreamPlayer.stream_paused = true
$AudioStreamPlayer.seek($MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.get_stream_position() + value/1000)
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_paused(false)
$AudioStreamPlayer.stream_paused = false
Globals.audio_delay_seconds = value/1000
Globals.saveConfig()
func _on_Quit_pressed(): func _on_Quit_pressed():
get_tree().change_scene("res://main_menu.tscn") get_tree().change_scene("res://main_menu.tscn")
@ -139,6 +133,8 @@ func _on_MultiStreamVideoPlayer_finished():
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.stop() $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.stop()
raw_recording = recorder.get_recording() raw_recording = recorder.get_recording()
stream_data.append(raw_recording) stream_data.append(raw_recording)
delays.append(Globals.audio_delay_seconds)
volumes.append(linear2db(1))
current_stream_added = false current_stream_added = false
$MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton.disabled = false $MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/PlayButton.disabled = false
recorder.set_recording_active(false) recorder.set_recording_active(false)
@ -151,11 +147,19 @@ func _on_MultiStreamVideoPlayer_finished():
func _on_VBoxContainer2_volume_changed(slider, value): func _on_VBoxContainer2_volume_changed(slider, value):
print("Slider "+String(slider)+" changed to "+String(value)) print("Slider "+String(slider)+" changed to "+String(value))
if len(volumes) <= slider:
volumes.append(value)
else:
volumes[slider] = value
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_audio_volume_db(slider,linear2db(value/100)) $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_audio_volume_db(slider,linear2db(value/100))
pass # Replace with function body. pass # Replace with function body.
func _on_MultiDelaySlider_delay_changed(slider, value): func _on_MultiDelaySlider_delay_changed(slider, value):
if len(delays) <= slider:
delays.append(value)
else:
delays[slider] = value/1000
$MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_stream_delay(slider,value/1000) $MarginContainer/VBoxContainer/HBoxContainer/VBoxContainer/MultiStreamVideoPlayer.set_stream_delay(slider,value/1000)
Globals.audio_delay_seconds = value/1000 Globals.audio_delay_seconds = value/1000
Globals.saveConfig() Globals.saveConfig()
@ -168,4 +172,9 @@ func _on_SaveButton_pressed():
func _on_PublishButton_pressed(): func _on_PublishButton_pressed():
$MarginContainer/VBoxContainer.visible = false
$MarginContainer/PublishPanel.visible = true
$MarginContainer/PublishPanel.setBackVolume(backvolume)
$MarginContainer/PublishPanel.setPartsVolumes(volumes)
$MarginContainer/PublishPanel.setPartsDelays(delays)
pass # Replace with function body. pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://Components/MultiStreamPlayer.tscn" type="PackedScene" id=1] [ext_resource path="res://Components/MultiStreamPlayer.tscn" type="PackedScene" id=1]
[ext_resource path="res://main_menu.gd" type="Script" id=2] [ext_resource path="res://main_menu.gd" type="Script" id=2]
@ -6,6 +6,7 @@
[ext_resource path="res://UI/src/meter.png" type="Texture" id=4] [ext_resource path="res://UI/src/meter.png" type="Texture" id=4]
[ext_resource path="res://Components/MultiVolumeSlider.tscn" type="PackedScene" id=5] [ext_resource path="res://Components/MultiVolumeSlider.tscn" type="PackedScene" id=5]
[ext_resource path="res://Components/MultiDelaySlider.tscn" type="PackedScene" id=6] [ext_resource path="res://Components/MultiDelaySlider.tscn" type="PackedScene" id=6]
[ext_resource path="res://Components/PublishDetails.tscn" type="PackedScene" id=7]
[sub_resource type="AudioStreamMicrophone" id=1] [sub_resource type="AudioStreamMicrophone" id=1]
@ -30,6 +31,13 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="PublishPanel" parent="MarginContainer" instance=ExtResource( 7 )]
visible = false
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1013.0
margin_bottom = 590.0
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
margin_right = 1013.0 margin_right = 1013.0
margin_bottom = 590.0 margin_bottom = 590.0
@ -184,7 +192,7 @@ margin_bottom = 118.0
margin_right = 16.0 margin_right = 16.0
margin_bottom = 100.0 margin_bottom = 100.0
rect_min_size = Vector2( 0, 100 ) rect_min_size = Vector2( 0, 100 )
value = 50.0 value = 100.0
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer3"] [node name="Label" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer3/VBoxContainer/HBoxContainer3/HBoxContainer/VBoxContainer3"]
margin_top = 104.0 margin_top = 104.0
@ -242,6 +250,7 @@ text = "Save"
margin_left = 954.0 margin_left = 954.0
margin_right = 1013.0 margin_right = 1013.0
margin_bottom = 20.0 margin_bottom = 20.0
disabled = true
text = "Publish" text = "Publish"
[node name="AudioStreamRecorder" type="AudioStreamPlayer" parent="."] [node name="AudioStreamRecorder" type="AudioStreamPlayer" parent="."]

View File

@ -3,7 +3,7 @@
[sub_resource type="AudioEffectSpectrumAnalyzer" id=1] [sub_resource type="AudioEffectSpectrumAnalyzer" id=1]
resource_name = "SpectrumAnalyzer" resource_name = "SpectrumAnalyzer"
[sub_resource type="AudioEffectRecord" id=4] [sub_resource type="AudioEffectRecord" id=2]
[sub_resource type="AudioEffectSpectrumAnalyzer" id=3] [sub_resource type="AudioEffectSpectrumAnalyzer" id=3]
resource_name = "SpectrumAnalyzer" resource_name = "SpectrumAnalyzer"
@ -17,7 +17,7 @@ bus/1/mute = true
bus/1/bypass_fx = false bus/1/bypass_fx = false
bus/1/volume_db = 0.0 bus/1/volume_db = 0.0
bus/1/send = "Master" bus/1/send = "Master"
bus/1/effect/0/effect = SubResource( 4 ) bus/1/effect/0/effect = SubResource( 2 )
bus/1/effect/0/enabled = true bus/1/effect/0/enabled = true
bus/1/effect/1/effect = SubResource( 3 ) bus/1/effect/1/effect = SubResource( 3 )
bus/1/effect/1/enabled = true bus/1/effect/1/enabled = true

View File

@ -18,6 +18,7 @@ _global_script_class_icons={
config/name="ASingCrow" config/name="ASingCrow"
run/main_scene="res://startup.tscn" run/main_scene="res://startup.tscn"
config/icon="res://icon.png" config/icon="res://icon.png"
config/windows_native_icon="res://icon.ico"
[audio] [audio]