Skip to content

Commit

Permalink
Experimental audio engine optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin committed Jan 30, 2021
1 parent 9d42533 commit bffe350
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/engine/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,7 @@ class Runtime extends EventEmitter {
*/
attachAudioEngine (audioEngine) {
this.audioEngine = audioEngine;
require('./tw-experimental-audio-optimizations')(audioEngine);
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/engine/tw-experimental-audio-optimizations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const optimize = audioEngine => {
audioEngine.effects.forEach(Effect => {
const originalSet = Effect.prototype._set;
Effect.prototype._set = function (value) {
if (this.__value === value) {
return;
}
this.__value = value;
originalSet.call(this, value);
};
});
};

module.exports = optimize;

0 comments on commit bffe350

Please sign in to comment.