Audio engine improvements (WIP)
This commit is contained in:
@@ -10,6 +10,7 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.ai.*;
|
import mindustry.ai.*;
|
||||||
|
import mindustry.audio.*;
|
||||||
import mindustry.core.*;
|
import mindustry.core.*;
|
||||||
import mindustry.ctype.*;
|
import mindustry.ctype.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
@@ -233,6 +234,7 @@ public abstract class ClientLauncher extends ApplicationCore implements Platform
|
|||||||
if(assets.update(1000 / loadingFPS)){
|
if(assets.update(1000 / loadingFPS)){
|
||||||
loader.dispose();
|
loader.dispose();
|
||||||
loader = null;
|
loader = null;
|
||||||
|
SoundPriority.init();
|
||||||
for(ApplicationListener listener : modules){
|
for(ApplicationListener listener : modules){
|
||||||
listener.init();
|
listener.init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,10 @@ public class SoundControl{
|
|||||||
|
|
||||||
Events.on(ResetEvent.class, e -> {
|
Events.on(ResetEvent.class, e -> {
|
||||||
lastPlayed = Time.millis();
|
lastPlayed = Time.millis();
|
||||||
|
|
||||||
|
//stop all in-game voices
|
||||||
|
Core.audio.soundBus.stop();
|
||||||
|
Core.audio.soundBus.play();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
50
core/src/mindustry/audio/SoundPriority.java
Normal file
50
core/src/mindustry/audio/SoundPriority.java
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package mindustry.audio;
|
||||||
|
|
||||||
|
import arc.*;
|
||||||
|
import arc.audio.*;
|
||||||
|
import arc.struct.*;
|
||||||
|
import mindustry.gen.*;
|
||||||
|
|
||||||
|
import static mindustry.gen.Sounds.*;
|
||||||
|
|
||||||
|
/** Sets up priorities and groups for various sounds. */
|
||||||
|
public class SoundPriority{
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
|
//priority 2: long weapon loops
|
||||||
|
set(
|
||||||
|
2f,
|
||||||
|
laserbig,
|
||||||
|
beam
|
||||||
|
);
|
||||||
|
|
||||||
|
//priority 1.5: big weapon sounds, not loops
|
||||||
|
set(1.5f,
|
||||||
|
railgun
|
||||||
|
);
|
||||||
|
|
||||||
|
//priority 1: ambient noises
|
||||||
|
set(
|
||||||
|
1f,
|
||||||
|
conveyor,
|
||||||
|
smelter,
|
||||||
|
drill,
|
||||||
|
extractLoop,
|
||||||
|
flux,
|
||||||
|
hum,
|
||||||
|
respawning
|
||||||
|
);
|
||||||
|
|
||||||
|
//this is spammed a LOT
|
||||||
|
Sounds.shootBig.setMinConcurrentInterrupt(shootBig.getLength() * 0.9f);
|
||||||
|
|
||||||
|
for(var sound : Core.assets.getAll(Sound.class, new Seq<>())){
|
||||||
|
sound.setMinConcurrentInterrupt(Math.min(0.25f, sound.getLength() * 0.5f));
|
||||||
|
sound.setMaxConcurrent(7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void set(float value, Sound... sounds){
|
||||||
|
for(var s : sounds) s.setPriority(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,4 +26,4 @@ org.gradle.caching=true
|
|||||||
org.gradle.internal.http.socketTimeout=100000
|
org.gradle.internal.http.socketTimeout=100000
|
||||||
org.gradle.internal.http.connectionTimeout=100000
|
org.gradle.internal.http.connectionTimeout=100000
|
||||||
android.enableR8.fullMode=false
|
android.enableR8.fullMode=false
|
||||||
archash=d677d2a72c
|
archash=f871345050
|
||||||
|
|||||||
Reference in New Issue
Block a user