From 08969b2e910c8135ac8b6972f1d9c714998312ab Mon Sep 17 00:00:00 2001 From: Quicksticks-oss Date: Sat, 23 Mar 2024 15:13:34 -0400 Subject: [PATCH 1/4] added audio engine. --- .../datastructures/clips/audio_track_clip.ts | 36 ++++++++-- app/pages/PageEnigma/js/audio_engine.ts | 65 +++++++++---------- app/pages/PageEnigma/js/editor.js | 18 ++--- 3 files changed, 65 insertions(+), 54 deletions(-) diff --git a/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts b/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts index a6a897e57a..56b21a029d 100644 --- a/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts +++ b/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts @@ -1,21 +1,47 @@ export interface AudioTrackClip { version: number; - media_id: number; + media_id: string; type: "audio"; volume: number; } -export class AudioTrackClipClass implements AudioTrackClip { +export class AudioTrackClip implements AudioTrackClip { version: number; - media_id: number; - type: "audio"; + media_id: string; + type: "audio" = "audio"; volume: number; + buffer: AudioBufferSourceNode | undefined; - constructor(version: number, media_id: number, volume: number) { + constructor(version: number, media_id: string, volume: number) { this.version = version; this.media_id = media_id; this.type = "audio"; this.volume = volume; + this.download_audio().then(data => { + this.buffer = data; + }); + } + + get_media_url() { + // This is for prod when we have the proper info on the url. + // let baseUrl = "https://api.fakeyou.com"; + // let url = `${baseUrl}/media/${this.media_id}` + // return url; + + return "/resources/sound/2pac.wav"; + } + + async download_audio() { + let new_audio_context = new AudioContext(); + let url = this.get_media_url(); + const audioContext = new AudioContext(); + const response = await fetch(url); + const arrayBuffer = await response.arrayBuffer(); + const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); + const source = audioContext.createBufferSource(); + source.buffer = audioBuffer; + source.connect(audioContext.destination); + return source; } toJSON(): string { diff --git a/app/pages/PageEnigma/js/audio_engine.ts b/app/pages/PageEnigma/js/audio_engine.ts index 71eb36e906..0a1fc0d2ac 100644 --- a/app/pages/PageEnigma/js/audio_engine.ts +++ b/app/pages/PageEnigma/js/audio_engine.ts @@ -1,43 +1,38 @@ -import * as THREE from "three"; +import { AudioTrackClip } from "../datastructures/clips/audio_track_clip"; + class AudioEngine { - constructor() { - this.listener = new THREE.AudioListener(); - this.clips = {}; - } + clips: { [key: string]: AudioTrackClip } = {}; + audio_sources: { [key: string]: AudioBufferSourceNode } = {}; + version: number; - addCamera(camera) { - // Assuming you have a camera and you want to add the listener to it - camera.add(this.listener); - } + constructor() { + this.clips = {}; + this.audio_sources = {}; + this.version = 1.0; + } - loadClip(id, audioURL) { - if (this.clips[id]) { - console.warn(`AudioManager: AudioClip already exists with id "${id}".`); - return; - } + loadClip(audio_media_id: string) { + this.clips[audio_media_id] = new AudioTrackClip(this.version, audio_media_id, 1.0); + } - const clip = new AudioClip(this.listener, audioURL); - this.clips[id] = clip; - } + playClip(audio_media_id: string) { + const clip = this.clips[audio_media_id]; + if (clip.buffer) { + clip.buffer.start(); + } else { + console.warn(`AudioManager: AudioClip buffer with id "${audio_media_id}" not found.`); + } + } - playClip(id) { - const clip = this.clips[id]; - if (clip) { - clip.play(); - } else { - console.warn(`AudioManager: AudioClip with id "${id}" not found.`); - } - } - - stopClip(id) { - const clip = this.clips[id]; - if (clip) { - clip.stop(); - } else { - console.warn(`AudioManager: AudioClip with id "${id}" not found.`); - } - } + stopClip(audio_media_id: string) { + const clip = this.clips[audio_media_id]; + if (clip.buffer) { + clip.buffer.stop(); + } else { + console.warn(`AudioManager: AudioClip with id "${audio_media_id}" not found.`); + } + } } -export default AudioManager; +export default AudioEngine; diff --git a/app/pages/PageEnigma/js/editor.js b/app/pages/PageEnigma/js/editor.js index 7e26c4287c..5eae0f8814 100644 --- a/app/pages/PageEnigma/js/editor.js +++ b/app/pages/PageEnigma/js/editor.js @@ -14,6 +14,8 @@ import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js' import { BokehPass } from 'three/addons/postprocessing/BokehPass.js'; import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg'; +import AudioEngine from './audio_engine.ts'; + if (typeof window !== 'undefined') { import('ccapture.js').then(module => { const CCapture = module.CCapture; @@ -28,7 +30,6 @@ class Editor { // Default params. constructor() { - // For making sure the editor only gets created onece. this.can_initailize = false; let one_element = document.getElementById("created-one-element"); @@ -36,10 +37,8 @@ class Editor { let newElement = document.createElement("div"); newElement.id = "created-one-element"; document.body.appendChild(newElement); - // Version and name. this.version = "v0.1"; - // Clock, scene and camera essentials. this.activeScene = null; this.camera = null; @@ -55,7 +54,6 @@ class Editor { this.bloomPass; this.smaaPass; this.bokehPass; - // Transform control and selection. this.control = null; this.raycaster = null; @@ -64,41 +62,35 @@ class Editor { this.last_selected = null; this.transform_interaction; this.rendering = false; - // API. this.api_manager = new MediaUploadManager(); - // Debug & Movement. this.stats = null; this.orbit = null; this.locked = false; - // Recording params. this.capturer = null; this.frame_buffer = []; this.render_timer = 0; this.fps_number = 60; this.cap_fps = 60; - // Timeline settings. this.playback = false; this.playback_location = 0; this.max_length = 10; this.timeline = null; - // Save & Load. this.save_manager = new SaveManager(this.version); + // Audio Engine Test. - console.log("Created Editor."); + this.audio_engine = new AudioEngine(); } // Initializes the main scene and ThreeJS essentials. initialize() { //if (this.can_initailize == false) { return; } - // Gets the canvas. this.canvReference = document.getElementById("video-scene"); - // Base width and height. let width = this.canvReference.width; let height = this.canvReference.height; @@ -126,10 +118,8 @@ class Editor { // OnClick and MouseMove events. window.addEventListener('mousemove', this.onMouseMove.bind(this), false); window.addEventListener('click', this.onMouseClick.bind(this), false); - // Base control and debug stuff remove debug in prod. this._initialize_control(); - // Resets canvas size. this.onWindowResize(); // Creates the main update loop. From 25d6df041cfb4c0f8d0590c0e53ec0d6f7e0fb63 Mon Sep 17 00:00:00 2001 From: Quicksticks-oss Date: Sat, 23 Mar 2024 15:33:45 -0400 Subject: [PATCH 2/4] working audio engine not downloading from server yet. --- .../datastructures/clips/audio_track_clip.ts | 29 ++++++++++++++----- app/pages/PageEnigma/js/audio_engine.ts | 11 ++++--- app/pages/PageEnigma/js/editor.js | 14 +++++---- 3 files changed, 37 insertions(+), 17 deletions(-) diff --git a/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts b/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts index 56b21a029d..3b716e8c07 100644 --- a/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts +++ b/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts @@ -1,3 +1,19 @@ +interface AudioData { + audioContext: AudioContext; + audioBuffer: AudioBuffer; +} + +class AudioData implements AudioData{ + audioContext: AudioContext; + audioBuffer: AudioBuffer; + source: AudioBufferSourceNode | undefined + + constructor (audioContext: AudioContext, audioBuffer: AudioBuffer) { + this.audioContext = audioContext; + this.audioBuffer = audioBuffer; + } +} + export interface AudioTrackClip { version: number; media_id: string; @@ -10,7 +26,7 @@ export class AudioTrackClip implements AudioTrackClip { media_id: string; type: "audio" = "audio"; volume: number; - buffer: AudioBufferSourceNode | undefined; + audio_data: AudioData | undefined; constructor(version: number, media_id: string, volume: number) { this.version = version; @@ -18,7 +34,7 @@ export class AudioTrackClip implements AudioTrackClip { this.type = "audio"; this.volume = volume; this.download_audio().then(data => { - this.buffer = data; + this.audio_data = data; }); } @@ -32,16 +48,15 @@ export class AudioTrackClip implements AudioTrackClip { } async download_audio() { - let new_audio_context = new AudioContext(); let url = this.get_media_url(); const audioContext = new AudioContext(); const response = await fetch(url); const arrayBuffer = await response.arrayBuffer(); const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); - const source = audioContext.createBufferSource(); - source.buffer = audioBuffer; - source.connect(audioContext.destination); - return source; + // const source = audioContext.createBufferSource(); + // source.buffer = audioBuffer; + // source.connect(audioContext.destination); + return new AudioData(audioContext, audioBuffer); } toJSON(): string { diff --git a/app/pages/PageEnigma/js/audio_engine.ts b/app/pages/PageEnigma/js/audio_engine.ts index 0a1fc0d2ac..1dff3ee3c6 100644 --- a/app/pages/PageEnigma/js/audio_engine.ts +++ b/app/pages/PageEnigma/js/audio_engine.ts @@ -18,8 +18,11 @@ class AudioEngine { playClip(audio_media_id: string) { const clip = this.clips[audio_media_id]; - if (clip.buffer) { - clip.buffer.start(); + if (clip.audio_data?.audioContext) { + clip.audio_data.source = clip.audio_data.audioContext.createBufferSource(); + clip.audio_data.source.buffer = clip.audio_data.audioBuffer; + clip.audio_data.source.connect(clip.audio_data.audioContext.destination); + clip.audio_data.source.start(); } else { console.warn(`AudioManager: AudioClip buffer with id "${audio_media_id}" not found.`); } @@ -27,8 +30,8 @@ class AudioEngine { stopClip(audio_media_id: string) { const clip = this.clips[audio_media_id]; - if (clip.buffer) { - clip.buffer.stop(); + if (clip.audio_data?.source) { + clip.audio_data.source.stop(); } else { console.warn(`AudioManager: AudioClip with id "${audio_media_id}" not found.`); } diff --git a/app/pages/PageEnigma/js/editor.js b/app/pages/PageEnigma/js/editor.js index 5eae0f8814..bda5ed165a 100644 --- a/app/pages/PageEnigma/js/editor.js +++ b/app/pages/PageEnigma/js/editor.js @@ -124,6 +124,7 @@ class Editor { this.onWindowResize(); // Creates the main update loop. this.renderer.setAnimationLoop(this.update_loop.bind(this)); + this.audio_engine.loadClip("awd"); } // Configure post processing. @@ -199,12 +200,13 @@ class Editor { } save() { - console.log(this.control); - if(this.selected != null){ this.control.detach(this.selected); } - this.activeScene.scene.remove(this.control); - this.activeScene.scene.remove(this.activeScene.gridHelper); - this.save_manager.save(this.activeScene.scene, this._save_to_cloud.bind(this), this.audio_manager, this.timeline, this.activeScene.animations); - this.activeScene._createGrid(); + //console.log(this.control); + //if(this.selected != null){ this.control.detach(this.selected); } + //this.activeScene.scene.remove(this.control); + //this.activeScene.scene.remove(this.activeScene.gridHelper); + //this.save_manager.save(this.activeScene.scene, this._save_to_cloud.bind(this), this.audio_manager, this.timeline, this.activeScene.animations); + //this.activeScene._createGrid(); + this.audio_engine.playClip("awd"); } _save_to_cloud(blob) { From f8763d10650d60df526b646d1f594d19c89b389b Mon Sep 17 00:00:00 2001 From: Quicksticks-oss Date: Sat, 23 Mar 2024 15:53:31 -0400 Subject: [PATCH 3/4] completed audio engine. --- .../datastructures/clips/audio_track_clip.ts | 22 +++++++++---------- app/pages/PageEnigma/js/editor.js | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts b/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts index 3b716e8c07..805741b550 100644 --- a/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts +++ b/app/pages/PageEnigma/datastructures/clips/audio_track_clip.ts @@ -38,24 +38,24 @@ export class AudioTrackClip implements AudioTrackClip { }); } - get_media_url() { - // This is for prod when we have the proper info on the url. - // let baseUrl = "https://api.fakeyou.com"; - // let url = `${baseUrl}/media/${this.media_id}` - // return url; - - return "/resources/sound/2pac.wav"; + async get_media_url() { + //This is for prod when we have the proper info on the url. + let api_base_url = "https://api.fakeyou.com"; + let url = `${api_base_url}/v1/media_files/file/${this.media_id}` + let responce = await fetch(url); + let json = await JSON.parse(await responce.text()); + let bucketPath = json["media_file"]["public_bucket_path"]; + let media_base_url = "https://storage.googleapis.com/vocodes-public" + let media_url = `${media_base_url}${bucketPath}` + return media_url; } async download_audio() { - let url = this.get_media_url(); + let url = await this.get_media_url(); const audioContext = new AudioContext(); const response = await fetch(url); const arrayBuffer = await response.arrayBuffer(); const audioBuffer = await audioContext.decodeAudioData(arrayBuffer); - // const source = audioContext.createBufferSource(); - // source.buffer = audioBuffer; - // source.connect(audioContext.destination); return new AudioData(audioContext, audioBuffer); } diff --git a/app/pages/PageEnigma/js/editor.js b/app/pages/PageEnigma/js/editor.js index bda5ed165a..aec46ad9bf 100644 --- a/app/pages/PageEnigma/js/editor.js +++ b/app/pages/PageEnigma/js/editor.js @@ -124,7 +124,7 @@ class Editor { this.onWindowResize(); // Creates the main update loop. this.renderer.setAnimationLoop(this.update_loop.bind(this)); - this.audio_engine.loadClip("awd"); + this.audio_engine.loadClip("m_f7jnwt3d1ddchatdk5vaqt0n4mb1hg"); } // Configure post processing. @@ -206,7 +206,7 @@ class Editor { //this.activeScene.scene.remove(this.activeScene.gridHelper); //this.save_manager.save(this.activeScene.scene, this._save_to_cloud.bind(this), this.audio_manager, this.timeline, this.activeScene.animations); //this.activeScene._createGrid(); - this.audio_engine.playClip("awd"); + this.audio_engine.playClip("m_f7jnwt3d1ddchatdk5vaqt0n4mb1hg"); } _save_to_cloud(blob) { From 77e53da58c009f11db872b98b9d0bed1e7abd1f9 Mon Sep 17 00:00:00 2001 From: Michael Chung <6252325+ArEnSc@users.noreply.github.com> Date: Sat, 23 Mar 2024 15:55:25 -0400 Subject: [PATCH 4/4] Pushing timeline alpha --- app/pages/PageEnigma/js/timeline.ts | 287 ++++++++++++++++++---------- test/test_bench.tsx | 46 ++--- 2 files changed, 210 insertions(+), 123 deletions(-) diff --git a/app/pages/PageEnigma/js/timeline.ts b/app/pages/PageEnigma/js/timeline.ts index c4ced3da0e..8f129a1c42 100644 --- a/app/pages/PageEnigma/js/timeline.ts +++ b/app/pages/PageEnigma/js/timeline.ts @@ -1,106 +1,193 @@ -// Write unsubcribe and run the remainder of the clip tech. +import { AnyJson } from "three/examples/jsm/nodes/core/constants.js" +import { ClipOffset } from "../datastructures/clips/clip_offset" -// export class Clip { -// version: number; -// clip_id: number; +export class TimelineCurrentReactState { + isEditable:boolean + constructor() { + this.isEditable = true // can add clips to it + } +} + +export class TimeLine { + timelineItems: ClipOffset[] + runningClips: ClipOffset[] + + //timerID: NodeJS.Timeout | null + timeLineLimit: number + scrubberPosition: number + isPlaying: boolean + + timelineState: TimelineCurrentReactState -// media_token_id: number; -// type: 'animation' | 'audio' | 'position_rotation'; -// time_start_offset: number; -// length_override: number | null; + constructor() { + this.timelineItems = [] + // this.timerID = null + this.timeLineLimit = 1000 * 10 // 10 seconds + this.runningClips = [] + this.isPlaying = false + this.scrubberPosition = 0 // in ms into the tl + this.timelineState = new TimelineCurrentReactState() + } -// constructor( -// version: number, -// clip_id: number, -// media_token_id: number, -// type: 'animation' | 'audio' | 'position_rotation', -// time_start_offset: number, -// length_override: number | null -// ) { -// this.version = version; -// this.clip_id = clip_id; -// this.media_token_id = media_token_id; -// this.type = type; -// this.time_start_offset = time_start_offset; -// this.length_override = length_override; -// } -// } - - -// export class Clip2 { -// name: string -// startOffset: number -// timerID: NodeJS.Timeout | null -// lengthOfClip: number -// scrubberEndingPosition: number - -// constructor(name: string, startOffset: number, lengthOfClip: number) { -// this.startOffset = startOffset -// this.lengthOfClip = lengthOfClip -// this.name = name -// this.timerID = null - -// this.scrubberEndingPosition = 100 -// } - -// async play(): Promise { -// console.log(`Playing ${this.name}`) -// this.timerID = setInterval(async () => { -// console.log(`Running async ${this.name}`) -// this.stop() -// }, this.lengthOfClip) -// } - -// async stop(): Promise { -// clearInterval(this.timerID!) -// console.log(`Stopping ${this.name}`) -// } -// } - -// export class API2 { -// timelineItems: Clip[] -// timerID: NodeJS.Timeout | null -// timeLineLimit: number - -// runningClips: Clip[] - -// constructor() { -// this.timelineItems = [] -// this.timerID = null -// this.timeLineLimit = 1000 * 10 -// this.runningClips = [] -// } - -// async addPlayableClip(clip: Clip): Promise { -// this.timelineItems.push(clip) -// } - -// async start(): Promise { -// let start = 0 -// const updateInterval = 100 -// const timerID = setInterval(async () => { -// console.log(`Current Time:${start}`) - -// // get last updated time when stopped -// for (const element of this.timelineItems) { -// if (element.startOffset >= start) { -// element.play() -// // remove the element -// this.timelineItems = this.timelineItems.filter(item => item !== element) -// } -// } -// if (start == this.timeLineLimit || this.timelineItems.length == 0) { -// this.stop() -// } - -// start += updateInterval -// }, updateInterval) + // public streaming events into the timeline from + async setScrubberPosition(offset:number) { + this.scrubberPosition = offset // in ms + } -// this.timerID = timerID -// } + async addPlayableClip(clip: ClipOffset): Promise { + this.timelineItems.push(clip) + } -// async stop(): Promise { -// console.log(`Stopping Timeline`) -// clearInterval(this.timerID!) -// } + async deleteClip(clip_uuid: string): Promise { + + } + + // this will update the state of the clips based off uuid + async modifyClip(clip_uuid: string, updates: AnyJson): Promise { + + } + + // timeline controls this. + async scrub(offset_in_ms:number): Promise { + // only stream through to the position and rotation keyframes + } + + // should play from the clip that is closest to the to scrubber + async play(): Promise { + console.log(`Starting Timeline`) + this.isPlaying = true + // const updateInterval = 100 + // const timerID = setInterval(async () => { + // console.log(`Current Time:${start}`) + + // // get last updated time when stopped + // for (const element of this.timelineItems) { + // if (element.start_offset >= start) { + // // run async + // // element.play() + // // remove the element + // this.timelineItems = this.timelineItems.filter(item => item !== element) + // } + // } + // if (start == this.timeLineLimit || this.timelineItems.length == 0) { + // this.stop() + // } + + // start += updateInterval + // }, updateInterval) + + // this.timerID = timerID + } + + + // called by the editor update loop on each frame + async update() { + if (this.isPlaying == false) return; // start and stop + + for (const element of this.timelineItems) { + if (element.start_offset >= this.scrubberPosition) { + // run async + // element.play() + // remove the element from the list + this.timelineItems = this.timelineItems.filter(item => item !== element) + } + if (this.scrubberPosition == this.timeLineLimit) { // stops at where clips should // cannot throw clip + this.stop() + } + } + } + + async stop(): Promise { + this.isPlaying = false + console.log(`Stopping Timeline`) + } +} + +// How much timeline precision we have +const percision = 100 // using a fake update loop mock + +// Visual verification tests. +function CheckIfBasicAudioClipWorks() { + const api = new TimeLine() + api.addPlayableClip(new ClipOffset(1.0,'audio',1,0)) + api.play() +} + +function CheckIfBasicTransformClipWorks() { + const api = new TimeLine() + api.addPlayableClip(new ClipOffset(1.0,'transform',2,0)) + api.play() +} + +function CheckIfBasicClipWorks() { + const api = new TimeLine() + api.addPlayableClip(new ClipOffset(1.0,'animation',3,0)) + api.play() +} + +// function CheckIfBasicClipWorks3SecondsAfterTimelineStops() { +// const api = new TimeLine() +// api.addPlayableClip(new ClipOffset("clip1", 0, 10000)) +// api.play() // } + +// function CheckIfTwoClipsAtTheSameTimeWorks() { +// const api = new TimeLine() +// api.addPlayableClip(new ClipOffset("clip1", 0, 1000)) +// api.play() +// } + +// function CheckIfTwoClipsOneAfterAnotherWorks() { +// const api = new TimeLine() +// api.addPlayableClip(new ClipOffset("clip1", 0, 1000)) +// api.addPlayableClip(new ClipOffset("clip2", 0, 2000)) +// api.play() +// } + +// function CheckIfTimeLineStopBeforeClipPlays() { +// const api = new TimeLine() +// api.addPlayableClip(new ClipOffset("clip3",0,1000)) +// api.play() +// setInterval(async ()=> { +// api.stop() +// },1100) +// console.log("Stopped") +// } + +// function CheckIfTimeLineStartAfterClipPlays() { +// const api = new TimeLine() +// api.addPlayableClip(new ClipOffset("clip3",0,1000)) +// api.play() +// setInterval(async ()=> { +// api.stop() +// },500) +// console.log("Stopped") +// } + +// function CheckIfClipsPlayAllTogetherConcurrently() { +// const api = new TimeLine() +// api.addPlayableClip(new ClipOffset("clip1",0,1000)) +// api.addPlayableClip(new ClipOffset("clip2",0,1000)) +// api.addPlayableClip(new ClipOffset("clip3",0,1000)) +// api.addPlayableClip(new ClipOffset("clip4",0,1000)) +// api.play() +// } + +// function CheckIfClipsPlayAllTogether() { +// const api = new TimeLine() +// api.addPlayableClip(new TrackClip("clip1",0,1000)) +// api.addPlayableClip(new TrackClip("clip2",0,1000)) +// api.addPlayableClip(new TrackClip("clip3",0,1000)) +// api.addPlayableClip(new TrackClip("clip4",0,1000)) +// api.play() +// } + +CheckIfBasicClipWorks() +//CheckIfTwoClipsAtTheSameTimeWorks() +// CheckIfTwoClipsOneAfterAnotherWorks() +// CheckIfTimeLineStopBeforeClipPlays() +// CheckIfTimeLineStartAfterClipPlays() +// CheckIfClipsPlayAllTogetherConcurrently() + +// CheckIfClipsPlayAllTogether() + diff --git a/test/test_bench.tsx b/test/test_bench.tsx index 158ad05afc..2fc87ea0b2 100644 --- a/test/test_bench.tsx +++ b/test/test_bench.tsx @@ -1,30 +1,30 @@ // Write unsubcribe and run the remainder of the clip tech. -class TrackClip { - name: string - startOffset: number // ms in the 0 100 | 10 second clip - timerID: NodeJS.Timeout | null - lengthOfClip: number +// class TrackClip { +// name: string +// startOffset: number // ms in the 0 100 | 10 second clip +// timerID: NodeJS.Timeout | null +// lengthOfClip: number - constructor(name: string, startOffset: number, lengthOfClip: number) { - this.startOffset = startOffset - this.lengthOfClip = lengthOfClip - this.name = name - this.timerID = null - } +// constructor(name: string, startOffset: number, lengthOfClip: number) { +// this.startOffset = startOffset +// this.lengthOfClip = lengthOfClip +// this.name = name +// this.timerID = null +// } - async play(): Promise { - console.log(`Playing ${this.name}`) - this.timerID = setInterval(async () => { - console.log(`Running async ${this.name}`) - this.stop() - }, this.lengthOfClip) - } +// async play(): Promise { +// console.log(`Playing ${this.name}`) +// this.timerID = setInterval(async () => { +// console.log(`Running async ${this.name}`) +// this.stop() +// }, this.lengthOfClip) +// } - async stop(): Promise { - clearInterval(this.timerID!) - console.log(`Stopping ${this.name}`) - } -} +// async stop(): Promise { +// clearInterval(this.timerID!) +// console.log(`Stopping ${this.name}`) +// } +// } class TimeLine { timelineItems: TrackClip[]