diff --git a/android/build.gradle b/android/build.gradle index 6f349ef7b7..c6349e2916 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -125,11 +125,10 @@ dependencies{ natives "com.github.Anuken.Arc:natives-android:$arcHash" natives "com.github.Anuken.Arc:natives-freetype-android:$arcHash" - def version; - def highestVersion; + def version, highestVersion new File((String)findSdkDir(), "/platforms").eachFileMatch ~/android-\d+/, { - version = it.name.find(/\d+/).toInteger(); - highestVersion = version > highestVersion ? version : highestVersion; + version = it.name.find(/\d+/).toInteger() + highestVersion = version > highestVersion ? version : highestVersion } def sdkFile = new File((String)findSdkDir(), "/platforms/android-${highestVersion}/android.jar") diff --git a/core/assets/music/coreLaunch.ogg b/core/assets/music/coreLaunch.ogg deleted file mode 100644 index 4dd82b35b8..0000000000 Binary files a/core/assets/music/coreLaunch.ogg and /dev/null differ diff --git a/core/assets/sounds/block/coreLand.ogg b/core/assets/sounds/block/coreLand.ogg new file mode 100644 index 0000000000..ead00b2e65 Binary files /dev/null and b/core/assets/sounds/block/coreLand.ogg differ diff --git a/core/assets/sounds/block/coreLaunch.ogg b/core/assets/sounds/block/coreLaunch.ogg new file mode 100644 index 0000000000..93654e5a70 Binary files /dev/null and b/core/assets/sounds/block/coreLaunch.ogg differ diff --git a/core/src/mindustry/audio/SoundPriority.java b/core/src/mindustry/audio/SoundPriority.java index e052608b1a..bb351f0042 100644 --- a/core/src/mindustry/audio/SoundPriority.java +++ b/core/src/mindustry/audio/SoundPriority.java @@ -3,6 +3,7 @@ package mindustry.audio; import arc.*; import arc.audio.*; import arc.struct.*; +import mindustry.*; import static mindustry.gen.Sounds.*; @@ -11,12 +12,15 @@ public class SoundPriority{ static int lastGroup = 1; public static void init(){ + //launching should not get interrupted by the loading screen + coreLaunch.setBus(Vars.control.sound.uiBus); + max(7, beamPlasma, shootMeltdown, beamMeltdown); //priority 3: absolutely do not interrupt these set( 3f, - acceleratorLaunch, acceleratorCharge + acceleratorLaunch, acceleratorCharge, coreLand, coreLaunch ); //priority 2: long weapon loops and big explosions diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 667a87317c..cc2b5281c0 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -1190,7 +1190,7 @@ public class Blocks{ size = 2; ambientSound = Sounds.loopMachineSpin; - ambientSoundVolume = 0.09f; + ambientSoundVolume = 0.1f; consumePower(0.20f); consumeItems(with(Items.coal, 1, Items.lead, 2, Items.sand, 2)); @@ -1204,7 +1204,7 @@ public class Blocks{ size = 2; envEnabled |= Env.space; ambientSound = Sounds.loopMachineSpin; - ambientSoundVolume = 0.1f; + ambientSoundVolume = 0.12f; consumeItems(with(Items.pyratite, 1, Items.sporePod, 1)); consumePower(0.40f); @@ -1936,7 +1936,7 @@ public class Blocks{ consumePower(3.50f); size = 2; consumeItem(Items.phaseFabric).boost(); - ambientSoundVolume = 0.05f; + ambientSoundVolume = 0.08f; }}; overdriveDome = new OverdriveProjector("overdrive-dome"){{ @@ -1946,6 +1946,7 @@ public class Blocks{ range = 200f; speedBoost = 2.5f; useTime = 300f; + ambientSoundVolume = 0.12f; hasBoost = false; consumeItems(with(Items.phaseFabric, 1, Items.silicon, 1)); }}; diff --git a/core/src/mindustry/core/Control.java b/core/src/mindustry/core/Control.java index 0d24559b85..b47359f111 100644 --- a/core/src/mindustry/core/Control.java +++ b/core/src/mindustry/core/Control.java @@ -216,9 +216,11 @@ public class Control implements ApplicationListener, Loadable{ if(settings.getInt("musicvol") > 0){ //TODO what to do if another core with different music is already playing? Music music = core.landMusic(); - music.stop(); - music.play(); - music.setVolume(settings.getInt("musicvol") / 100f); + if(music != null){ + music.stop(); + music.play(); + music.setVolume(settings.getInt("musicvol") / 100f); + } } renderer.showLanding(core); diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 3ad9a36242..d13e3e9d72 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -2,7 +2,6 @@ package mindustry.core; import arc.*; import arc.assets.loaders.TextureLoader.*; -import arc.audio.*; import arc.files.*; import arc.graphics.*; import arc.graphics.Texture.*; @@ -568,11 +567,6 @@ public class Renderer implements ApplicationListener{ launching = true; landTime = landCore.launchDuration(); - Music music = landCore.launchMusic(); - music.stop(); - music.play(); - music.setVolume(settings.getInt("musicvol") / 100f); - landCore.beginLaunch(true); } diff --git a/core/src/mindustry/world/blocks/LaunchAnimator.java b/core/src/mindustry/world/blocks/LaunchAnimator.java index 62a3366ff3..6d9ff2634d 100644 --- a/core/src/mindustry/world/blocks/LaunchAnimator.java +++ b/core/src/mindustry/world/blocks/LaunchAnimator.java @@ -1,6 +1,7 @@ package mindustry.world.blocks; import arc.audio.*; +import arc.util.*; import mindustry.gen.*; public interface LaunchAnimator{ @@ -17,13 +18,9 @@ public interface LaunchAnimator{ float launchDuration(); - default Music landMusic(){ + default @Nullable Music landMusic(){ return Musics.land; } - default Music launchMusic(){ - return Musics.launch; - } - float zoomLaunch(); } diff --git a/core/src/mindustry/world/blocks/campaign/Accelerator.java b/core/src/mindustry/world/blocks/campaign/Accelerator.java index c274d84d47..3c570aead2 100644 --- a/core/src/mindustry/world/blocks/campaign/Accelerator.java +++ b/core/src/mindustry/world/blocks/campaign/Accelerator.java @@ -40,9 +40,8 @@ public class Accelerator extends Block{ /** Override for planets that this block can launch to. If null, the planet's launch candidates are used. */ public @Nullable Seq launchCandidates; - public Music launchMusic = Musics.coreLaunch; public Sound lightningSound = new RandomSound(Sounds.acceleratorLightning1, Sounds.acceleratorLightning2, Sounds.shootArc); - public float lightningSoundVolume = 0.9f; + public float lightningSoundVolume = 0.85f; public Sound chargeSound = Sounds.acceleratorCharge; public Sound launchSound = Sounds.acceleratorLaunch; public Sound constructSound = Sounds.acceleratorConstruct; @@ -311,13 +310,7 @@ public class Accelerator extends Block{ @Override public Music landMusic(){ - //unused - return launchMusic; - } - - @Override - public Music launchMusic(){ - return launchMusic; + return null; } @Override diff --git a/core/src/mindustry/world/blocks/storage/CoreBlock.java b/core/src/mindustry/world/blocks/storage/CoreBlock.java index 47246c9f88..f43ae7a278 100644 --- a/core/src/mindustry/world/blocks/storage/CoreBlock.java +++ b/core/src/mindustry/world/blocks/storage/CoreBlock.java @@ -56,7 +56,9 @@ public class CoreBlock extends StorageBlock{ public UnitType unitType = UnitTypes.alpha; public float landDuration = 160f; public Music landMusic = Musics.land; - public Music launchMusic = Musics.coreLaunch; + public float launchSoundVolume = 1f, landSoundVolume = 1f; + public Sound launchSound = Sounds.coreLaunch; + public Sound landSound = Sounds.coreLand; public Effect launchEffect = Fx.launch; public Interp landZoomInterp = Interp.pow3; @@ -303,11 +305,6 @@ public class CoreBlock extends StorageBlock{ return landMusic; } - @Override - public Music launchMusic(){ - return launchMusic; - } - @Override public void beginLaunch(boolean launching){ cloudSeed = Mathf.random(1f); @@ -316,6 +313,7 @@ public class CoreBlock extends StorageBlock{ } if(!headless){ + (launching ? launchSound : landSound).play(launchSoundVolume); // Add fade-in and fade-out foreground when landing or launching. if(renderer.isLaunching()){ float margin = 30f; diff --git a/core/src/mindustry/world/blocks/units/UnitFactory.java b/core/src/mindustry/world/blocks/units/UnitFactory.java index f97d11a466..15a82d6226 100644 --- a/core/src/mindustry/world/blocks/units/UnitFactory.java +++ b/core/src/mindustry/world/blocks/units/UnitFactory.java @@ -51,6 +51,7 @@ public class UnitFactory extends UnitBlock{ regionRotated1 = 1; commandable = true; ambientSound = Sounds.loopUnitBuilding; + ambientSoundVolume = 0.09f; config(Integer.class, (UnitFactoryBuild build, Integer i) -> { if(!configurable) return; diff --git a/gradle.properties b/gradle.properties index 24020d2b5c..148fb9e631 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,4 +26,4 @@ org.gradle.caching=true org.gradle.internal.http.socketTimeout=100000 org.gradle.internal.http.connectionTimeout=100000 android.enableR8.fullMode=false -archash=ce729c4fe4 +archash=ec20fc49b9