Created
November 2, 2016 18:18
-
-
Save bfgeek/2a686e091bee964dc3cd03e3909b2e6a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const source = ???; | |
| const audioWorkletNode = new AudioWorkletNode('filter'); | |
| source.connect(audioWorkletNode); | |
| audioWorkletNode.connect(ctx.destination); | |
| |----------| | |
| |---| | |
| tailTime called | |
| - reconnected during tailTime (process) | |
| - reconnected after tailTime (process) | |
| - drop JS ref (GC'd after tailTime). | |
| // <lazy-created> input - {node} - destination | |
| // (no-input) & (yes-main-js-ref) - {node}(keepAlive - 100ms) - destination | |
| // no-GC | |
| // (input) & (yes-main-js-ref) - {node} - destination | |
| // (no-input) & (no-main-js-ref) - {node}(keepAlive - 100ms) - destination | |
| // GC'd. | |
| class { | |
| static isSourceNode = true; | |
| process() { | |
| return true; | |
| } | |
| tailTime() { | |
| return Infinity; | |
| } | |
| onSuspend() { | |
| return { interalbuffers: this.internalBuffers_ }; | |
| } | |
| onResume(ojb) { | |
| this.in... = obj.in...; | |
| } | |
| }) | |
| source.disconnect(); | |
| // audio-frame audioWorkletNode still getting called. TODO | |
| // audioWorkletNode = null; | |
| source2.connect(audioWorkletNode); // new AudioWorkletProcessor(); - worklet. | |
| process(..., ..., map, audioPararms) { | |
| } | |
| source.disconnect(); // keepAlive() (audioWorkletNode - 0 - inputs) | |
| // -------------------- | |
| const foo = new AWN('foo'); | |
| const foo2 = new AWN('foo'); | |
| foo.set(); | |
| foo2.set(); | |
| source1.connect(foo); | |
| source1.disconnect(); | |
| source2.connect(foo2); | |
| source3.connect(foo); | |
| ////// | |
| mainRefMap.prototype.set = function(key, val) { | |
| thread.postTask({id, key, val}); | |
| }; | |
| //// OTHER THREAD \o/ | |
| audioRefMap.prototype.onMainThreadSet = functioN(key, val) { | |
| this.internalMap_[key] = val; | |
| } | |
| process( map /* readonly */ ) { | |
| const something = map.get('key'); | |
| // something.foo == 5; | |
| something.foo = 5; | |
| } | |
| /// Render quantum | |
| // PROCESS - (1) | |
| // APPLY - POSTTASK(1) & (2) | |
| // PROCESS - (2) | |
| //// END render quantum | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment