mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-22 22:12:48 -05:00
effects are managed by vm target and audio engine
This commit is contained in:
parent
263f614ef8
commit
42f231858a
1 changed files with 7 additions and 31 deletions
38
src/index.js
38
src/index.js
|
@ -189,51 +189,27 @@ AudioPlayer.prototype.setPitchEffect = function (value) {
|
|||
|
||||
AudioPlayer.prototype.setEffect = function (effect, value) {
|
||||
switch (effect) {
|
||||
case 'PITCH':
|
||||
this.pitchEffect.set(value, this.soundPlayers);
|
||||
case 'pitch':
|
||||
this.pitchEffect.set(value, this.activeSoundPlayers);
|
||||
break;
|
||||
case 'PAN':
|
||||
case 'pan':
|
||||
this.panEffect.set(value);
|
||||
break;
|
||||
case 'ECHO':
|
||||
case 'echo':
|
||||
this.audioEngine.echoEffect.set(value);
|
||||
break;
|
||||
case 'REVERB':
|
||||
case 'reverb':
|
||||
this.audioEngine.reverbEffect.set(value);
|
||||
break;
|
||||
case 'FUZZ' :
|
||||
case 'fuzz' :
|
||||
this.audioEngine.fuzzEffect.set(value);
|
||||
break;
|
||||
case 'ROBOT' :
|
||||
case 'robot' :
|
||||
this.audioEngine.roboticEffect.set(value);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
AudioPlayer.prototype.changeEffect = function (effect, value) {
|
||||
switch (effect) {
|
||||
case 'PITCH':
|
||||
this.pitchEffect.changeBy(value, this.soundPlayers);
|
||||
break;
|
||||
case 'PAN':
|
||||
this.panEffect.changeBy(value);
|
||||
break;
|
||||
case 'ECHO':
|
||||
this.audioEngine.echoEffect.changeBy(value);
|
||||
break;
|
||||
case 'REVERB':
|
||||
this.audioEngine.reverbEffect.changeBy(value);
|
||||
break;
|
||||
case 'FUZZ' :
|
||||
this.audioEngine.fuzzEffect.changeBy(value);
|
||||
break;
|
||||
case 'ROBOT' :
|
||||
this.audioEngine.roboticEffect.changeBy(value);
|
||||
break;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
AudioPlayer.prototype.clearEffects = function () {
|
||||
this.panEffect.set(0);
|
||||
this.pitchEffect.set(0, this.activeSoundPlayers);
|
||||
|
|
Loading…
Reference in a new issue