summaryrefslogtreecommitdiff
path: root/klangfarb/main.gd
diff options
context:
space:
mode:
Diffstat (limited to 'klangfarb/main.gd')
-rw-r--r--klangfarb/main.gd12
1 files changed, 2 insertions, 10 deletions
diff --git a/klangfarb/main.gd b/klangfarb/main.gd
index d88d431..806850d 100644
--- a/klangfarb/main.gd
+++ b/klangfarb/main.gd
@@ -3,23 +3,17 @@ var playback: AudioStreamPlayback = null
var MonoBuffer = preload("res://MonoBuffer.gdns")
var buffer = MonoBuffer.new()
-var samples = buffer.frames
+var duration = 3
+var samples = buffer.frames(440.0, 44100.0, duration)
var sample_count = samples.size()
var current_count = 0
-#func _create_generator() -> void:
-# stream = AudioStreamGenerator.new()
-# stream.mix_rate = 44100.0 # Setting mix rate is only possible before play().
-# playback = get_stream_playback()
-
func _fill_buffer() -> void:
var to_fill = playback.get_frames_available()
while to_fill > 0 && current_count != sample_count:
var sample_index = current_count
playback.push_frame(Vector2.ONE * samples[sample_index]) # Audio frames are stereo.
-# _phase = fmod(_phase + frequency() / GDawConfig.sample_rate, 1.0)
-# _update_state()
to_fill -= 1
current_count += 1
@@ -34,5 +28,3 @@ func _ready() -> void:
playback = self.get_stream_playback()
_fill_buffer()
self.play()
-# _update_envelope()
-