From b5dbf192ae62b67dd86ccd063d14fd1add7c0829 Mon Sep 17 00:00:00 2001 From: Sergey Yuferev Date: Fri, 29 Dec 2023 16:43:54 +0300 Subject: [PATCH] $mol_audio_scheduled moved duration --- audio/room/room.ts | 2 +- audio/sample/sample.ts | 2 +- audio/scheduled/scheduled.ts | 4 ++++ audio/vibe/vibe.ts | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/audio/room/room.ts b/audio/room/room.ts index f885894d9cc..1a258518b6e 100644 --- a/audio/room/room.ts +++ b/audio/room/room.ts @@ -13,7 +13,7 @@ namespace $ { let duration = 0 for (const input of this.input_connected()) { if (input instanceof $mol_audio_room) duration += input.duration() - if (input instanceof $mol_audio_sample) duration += input.duration() + if (input instanceof $mol_audio_scheduled) duration += input.duration() } return duration || this.duration_default() } diff --git a/audio/sample/sample.ts b/audio/sample/sample.ts index 1287e78d64c..25e112adfde 100644 --- a/audio/sample/sample.ts +++ b/audio/sample/sample.ts @@ -3,7 +3,7 @@ namespace $ { @ $mol_mem override node() { return this.context().createBufferSource() } - duration() { + override duration() { return this.audio_buffer().duration * 1000 } diff --git a/audio/scheduled/scheduled.ts b/audio/scheduled/scheduled.ts index 19afa500d45..06a38d087a0 100644 --- a/audio/scheduled/scheduled.ts +++ b/audio/scheduled/scheduled.ts @@ -5,6 +5,10 @@ namespace $ { throw new Error('implement') } + duration() { + return 1000 + } + @ $mol_mem node_configured() { return this.node() diff --git a/audio/vibe/vibe.ts b/audio/vibe/vibe.ts index 00f13f9cf60..22cb2f1f430 100644 --- a/audio/vibe/vibe.ts +++ b/audio/vibe/vibe.ts @@ -14,7 +14,7 @@ namespace $ { @ $mol_mem override node() { return this.context().createOscillator() } - + @ $mol_mem freq( next = 440 ) { return next }