summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrant Shangreaux <grant@unabridgedsoftware.com>2021-12-17 23:00:28 -0600
committerGrant Shangreaux <grant@unabridgedsoftware.com>2021-12-17 23:00:28 -0600
commit4c568adf10dbfc5cfadf2f2579864824e9a77332 (patch)
tree49dc5c4265867790715564ffe9e3441f166b0257
parent3eb0824c6477bc7720b3ed0ac49f58a34cfa0546 (diff)
Feature: complete Bell GUI interface!! 🔔
-rw-r--r--klangfarb/Main.tscn85
-rw-r--r--klangfarb/assets/bell.jpegbin0 -> 237390 bytes
-rw-r--r--klangfarb/assets/logo.pngbin0 -> 12911 bytes
-rw-r--r--klangfarb/main.gd30
4 files changed, 85 insertions, 30 deletions
diff --git a/klangfarb/Main.tscn b/klangfarb/Main.tscn
index a5f123c..f83e045 100644
--- a/klangfarb/Main.tscn
+++ b/klangfarb/Main.tscn
@@ -1,33 +1,98 @@
-[gd_scene load_steps=5 format=2]
+[gd_scene load_steps=8 format=2]
-[ext_resource path="res://assets/moog.JPG" type="Texture" id=1]
+[ext_resource path="res://assets/bell.jpeg" type="Texture" id=1]
[ext_resource path="res://main.gd" type="Script" id=2]
[ext_resource path="res://Power.gd" type="Script" id=3]
+[ext_resource path="res://Duration.gd" type="Script" id=4]
+[ext_resource path="res://assets/logo.png" type="Texture" id=5]
[sub_resource type="AudioStreamGenerator" id=1]
+[sub_resource type="AtlasTexture" id=2]
+
[node name="Audio" type="AudioStreamPlayer"]
stream = SubResource( 1 )
-volume_db = -13.216
+volume_db = -27.491
script = ExtResource( 2 )
+play_instrument = true
continuous = false
+duration = 2600
decay = 1000
release = 500
fm_index = 100.0
-[node name="Moog" type="Sprite" parent="."]
-position = Vector2( 512, 306 )
+[node name="bell" type="Sprite" parent="."]
+position = Vector2( 509.571, 302.973 )
+scale = Vector2( 0.679757, 0.442065 )
texture = ExtResource( 1 )
__meta__ = {
"_edit_lock_": true
}
-[node name="Control" type="Control" parent="."]
-margin_left = 900.0
-margin_top = 73.0
-margin_right = 940.0
-margin_bottom = 113.0
+[node name="Control" type="CheckButton" parent="."]
+show_behind_parent = true
+margin_left = 793.041
+margin_top = 103.156
+margin_right = 870.041
+margin_bottom = 143.156
+icon = SubResource( 2 )
script = ExtResource( 3 )
__meta__ = {
"_edit_use_anchors_": false
}
+
+[node name="VSlider" type="VSlider" parent="."]
+anchor_left = 0.069
+anchor_right = 0.201
+anchor_bottom = 0.986
+margin_left = -61.656
+margin_top = 2.0
+margin_right = -161.824
+margin_bottom = 7.39996
+rect_scale = Vector2( 3, 1 )
+min_value = 100.0
+max_value = 10000.0
+step = 100.0
+value = 100.0
+script = ExtResource( 4 )
+__meta__ = {
+"_edit_lock_": true,
+"_edit_use_anchors_": false
+}
+
+[node name="VSlider2" type="VSlider" parent="."]
+anchor_left = 0.069
+anchor_right = 0.201
+anchor_bottom = 0.986
+margin_left = 826.84
+margin_top = -2.49493
+margin_right = 726.672
+margin_bottom = 2.90503
+rect_scale = Vector2( 3, 1 )
+min_value = 20.0
+max_value = 8000.0
+step = 5.0
+value = 100.0
+script = ExtResource( 4 )
+__meta__ = {
+"_edit_lock_": true,
+"_edit_use_anchors_": false
+}
+
+[node name="Control2" type="Control" parent="."]
+margin_left = 135.502
+margin_top = 148.729
+margin_right = 893.502
+margin_bottom = 595.729
+__meta__ = {
+"_edit_lock_": true,
+"_edit_use_anchors_": false
+}
+
+[node name="logo" type="Sprite" parent="."]
+position = Vector2( 517.062, 56.5018 )
+texture = ExtResource( 5 )
+
+[connection signal="value_changed" from="VSlider" to="." method="_on_duration_value_changed"]
+[connection signal="value_changed" from="VSlider2" to="." method="_on_pitch_value_changed"]
+[connection signal="gui_input" from="Control2" to="." method="_on_bell_click"]
diff --git a/klangfarb/assets/bell.jpeg b/klangfarb/assets/bell.jpeg
new file mode 100644
index 0000000..e9e6c85
--- /dev/null
+++ b/klangfarb/assets/bell.jpeg
Binary files differ
diff --git a/klangfarb/assets/logo.png b/klangfarb/assets/logo.png
new file mode 100644
index 0000000..9d1d5dc
--- /dev/null
+++ b/klangfarb/assets/logo.png
Binary files differ
diff --git a/klangfarb/main.gd b/klangfarb/main.gd
index d36a49e..564c41d 100644
--- a/klangfarb/main.gd
+++ b/klangfarb/main.gd
@@ -60,19 +60,12 @@ func _check_waveform():
func _process(_delta):
if self.is_playing():
- synth.apply_bend(apply_bend)
- synth.frequency(freq)
- synth.phasor_bend(phasor_bend)
- synth.frequency_modulation(frequency_modulation)
- synth.fm_frequency(fm_multiplier * freq)
- synth.fm_depth(fm_index)
synth.continuous(continuous)
synth.set_attack(attack)
synth.set_decay(decay)
synth.set_sustain(sustain)
synth.set_release(release)
synth.play_instrument(play_instrument)
- synth.duration(duration)
_check_waveform()
_fill_buffer()
@@ -87,18 +80,15 @@ func _ready() -> void:
_check_waveform()
_fill_buffer()
-func _input(event):
- # Mouse in viewport coordinates.
- if event is InputEventMouseButton && event.is_pressed():
- print("Mouse Click/Unclick at: ", event.position)
- synth.trigger()
- elif event is InputEventMouseMotion:
- freq = event.position.x
- synth.frequency(freq)
-# phasor_bend.x = event.position.x / 1024
-# phasor_bend.y = event.position.y / 600
- fm_multiplier = 600 / (event.position.y + 1)
- synth.fm_frequency(fm_multiplier * freq)
-
func toggle_playback():
self._set_playing(!self.is_playing())
+
+func _on_duration_value_changed(value):
+ synth.duration(int(value))
+
+func _on_pitch_value_changed(value):
+ synth.frequency(value)
+
+func _on_bell_click(event):
+ if event is InputEventMouseButton && event.is_pressed():
+ synth.trigger()