Sound framework improvements
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user