mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2025-01-09 14:22:53 -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) {
|
AudioPlayer.prototype.setEffect = function (effect, value) {
|
||||||
switch (effect) {
|
switch (effect) {
|
||||||
case 'PITCH':
|
case 'pitch':
|
||||||
this.pitchEffect.set(value, this.soundPlayers);
|
this.pitchEffect.set(value, this.activeSoundPlayers);
|
||||||
break;
|
break;
|
||||||
case 'PAN':
|
case 'pan':
|
||||||
this.panEffect.set(value);
|
this.panEffect.set(value);
|
||||||
break;
|
break;
|
||||||
case 'ECHO':
|
case 'echo':
|
||||||
this.audioEngine.echoEffect.set(value);
|
this.audioEngine.echoEffect.set(value);
|
||||||
break;
|
break;
|
||||||
case 'REVERB':
|
case 'reverb':
|
||||||
this.audioEngine.reverbEffect.set(value);
|
this.audioEngine.reverbEffect.set(value);
|
||||||
break;
|
break;
|
||||||
case 'FUZZ' :
|
case 'fuzz' :
|
||||||
this.audioEngine.fuzzEffect.set(value);
|
this.audioEngine.fuzzEffect.set(value);
|
||||||
break;
|
break;
|
||||||
case 'ROBOT' :
|
case 'robot' :
|
||||||
this.audioEngine.roboticEffect.set(value);
|
this.audioEngine.roboticEffect.set(value);
|
||||||
break;
|
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 () {
|
AudioPlayer.prototype.clearEffects = function () {
|
||||||
this.panEffect.set(0);
|
this.panEffect.set(0);
|
||||||
this.pitchEffect.set(0, this.activeSoundPlayers);
|
this.pitchEffect.set(0, this.activeSoundPlayers);
|
||||||
|
|
Loading…
Reference in a new issue