Sound framework improvements

This commit is contained in:
Anuken
2020-11-12 18:07:26 -05:00
parent d163cacb6a
commit d1d3ef0c67
24 changed files with 162 additions and 355 deletions

View File

@@ -1,5 +1,6 @@
package mindustry.audio;
import arc.*;
import arc.audio.*;
import arc.math.*;
import arc.util.*;
@@ -31,19 +32,19 @@ public class SoundLoop{
}else{
volume = Mathf.clamp(volume - fadeSpeed * Time.delta);
if(volume <= 0.001f){
sound.stop(id);
Core.audio.stop(id);
id = -1;
return;
}
}
sound.set(id, sound.calcPan(x, y), sound.calcVolume(x, y) * volume * baseVolume);
Core.audio.set(id, sound.calcPan(x, y), sound.calcVolume(x, y) * volume * baseVolume);
}
}
public void stop(){
if(id != -1){
sound.stop(id);
Core.audio.stop(id);
id = -1;
volume = baseVolume = -1;
}