summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--klangfarb/main.gd8
-rw-r--r--klangfarbrs/src/lib.rs3
2 files changed, 11 insertions, 0 deletions
diff --git a/klangfarb/main.gd b/klangfarb/main.gd
index 9735c5f..cf3d8c1 100644
--- a/klangfarb/main.gd
+++ b/klangfarb/main.gd
@@ -48,3 +48,11 @@ func _ready() -> void:
# prefill the stream's sample buffer (which feeds DAC)
_check_waveform()
_fill_buffer()
+
+func _input(event):
+ # Mouse in viewport coordinates.
+ if event is InputEventMouseButton:
+ print("Mouse Click/Unclick at: ", event.position)
+ elif event is InputEventMouseMotion:
+ freq = event.position.x
+ print("Mouse Motion at: ", event.position)
diff --git a/klangfarbrs/src/lib.rs b/klangfarbrs/src/lib.rs
index 059d59f..8fb773d 100644
--- a/klangfarbrs/src/lib.rs
+++ b/klangfarbrs/src/lib.rs
@@ -39,6 +39,7 @@ fn generate_sample(osc: &Osc) -> f32 {
Waveform::Sine => {
(TAU * phase).sin()
},
+
Waveform::Square => {
if phase < 0.5 {
-1.0
@@ -46,6 +47,7 @@ fn generate_sample(osc: &Osc) -> f32 {
1.0
}
},
+
Waveform::Triangle => {
if phase < 0.5 {
4.0 * phase - 1.0
@@ -53,6 +55,7 @@ fn generate_sample(osc: &Osc) -> f32 {
4.0 * (1.0 - phase) - 1.0
}
},
+
Waveform::Sawtooth => {
2.0 * phase - 1.0
}