MinecraftForge/FML@a381874bb9 Delay sound system backend initalization to speed up startup and prevent race condition on some computers.

This commit is contained in:
Lex Manos 2013-10-06 11:20:09 -07:00
parent fc1089713f
commit c8df5b832e
3 changed files with 24 additions and 24 deletions

2
fml

@ -1 +1 @@
Subproject commit 55525f6d2eb24f42c26a291b8ce98feb4d4498c9 Subproject commit a381874bb9c3bdeeb508bb81719b4d210eb29696

View file

@ -26,7 +26,7 @@
} }
catch (LWJGLException lwjglexception) catch (LWJGLException lwjglexception)
{ {
@@ -497,7 +507,7 @@ @@ -498,7 +508,7 @@
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine); this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
FMLClientHandler.instance().finishMinecraftLoading(); FMLClientHandler.instance().finishMinecraftLoading();
this.checkGLError("Post startup"); this.checkGLError("Post startup");
@ -35,7 +35,7 @@
if (this.serverName != null) if (this.serverName != null)
{ {
@@ -679,11 +689,6 @@ @@ -680,11 +690,6 @@
*/ */
public void displayGuiScreen(GuiScreen par1GuiScreen) public void displayGuiScreen(GuiScreen par1GuiScreen)
{ {
@ -47,7 +47,7 @@
this.statFileWriter.syncStats(); this.statFileWriter.syncStats();
if (par1GuiScreen == null && this.theWorld == null) if (par1GuiScreen == null && this.theWorld == null)
@@ -693,6 +698,20 @@ @@ -694,6 +699,20 @@
else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F) else if (par1GuiScreen == null && this.thePlayer.getHealth() <= 0.0F)
{ {
par1GuiScreen = new GuiGameOver(); par1GuiScreen = new GuiGameOver();
@ -68,7 +68,7 @@
} }
if (par1GuiScreen instanceof GuiMainMenu) if (par1GuiScreen instanceof GuiMainMenu)
@@ -1300,7 +1319,7 @@ @@ -1301,7 +1320,7 @@
if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l)) if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l))
{ {
@ -77,7 +77,7 @@
this.thePlayer.swingItem(); this.thePlayer.swingItem();
} }
} }
@@ -1366,7 +1385,8 @@ @@ -1367,7 +1386,8 @@
{ {
int j1 = itemstack != null ? itemstack.stackSize : 0; int j1 = itemstack != null ? itemstack.stackSize : 0;
@ -87,7 +87,7 @@
{ {
flag = false; flag = false;
this.thePlayer.swingItem(); this.thePlayer.swingItem();
@@ -1392,7 +1412,8 @@ @@ -1393,7 +1413,8 @@
{ {
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem(); ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
@ -97,7 +97,7 @@
{ {
this.entityRenderer.itemRenderer.resetEquippedProgress2(); this.entityRenderer.itemRenderer.resetEquippedProgress2();
} }
@@ -1574,6 +1595,8 @@ @@ -1575,6 +1596,8 @@
while (Mouse.next()) while (Mouse.next())
{ {
@ -106,7 +106,7 @@
i = Mouse.getEventButton(); i = Mouse.getEventButton();
if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157))) if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157)))
@@ -2046,6 +2069,11 @@ @@ -2047,6 +2070,11 @@
{ {
this.statFileWriter.syncStats(); this.statFileWriter.syncStats();
@ -118,7 +118,7 @@
if (par1WorldClient == null) if (par1WorldClient == null)
{ {
NetClientHandler netclienthandler = this.getNetHandler(); NetClientHandler netclienthandler = this.getNetHandler();
@@ -2063,6 +2091,18 @@ @@ -2064,6 +2092,18 @@
if (this.theIntegratedServer != null) if (this.theIntegratedServer != null)
{ {
this.theIntegratedServer.initiateShutdown(); this.theIntegratedServer.initiateShutdown();
@ -137,7 +137,7 @@
} }
this.theIntegratedServer = null; this.theIntegratedServer = null;
@@ -2225,7 +2265,7 @@ @@ -2226,7 +2266,7 @@
*/ */
public boolean handleClientCommand(String par1Str) public boolean handleClientCommand(String par1Str)
{ {
@ -146,7 +146,7 @@
} }
/** /**
@@ -2236,107 +2276,12 @@ @@ -2237,107 +2277,12 @@
if (this.objectMouseOver != null) if (this.objectMouseOver != null)
{ {
boolean flag = this.thePlayer.capabilities.isCreativeMode; boolean flag = this.thePlayer.capabilities.isCreativeMode;
@ -258,7 +258,7 @@
if (flag) if (flag)
{ {
@@ -2419,11 +2364,18 @@ @@ -2420,11 +2365,18 @@
par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize())); par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize()));
} }
@ -277,7 +277,7 @@
for (int i = 16384; i > 0; i >>= 1) for (int i = 16384; i > 0; i >>= 1)
{ {
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null); GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
@@ -2431,6 +2383,7 @@ @@ -2432,6 +2384,7 @@
if (j != 0) if (j != 0)
{ {

View file

@ -10,7 +10,7 @@
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import java.io.File; import java.io.File;
@@ -61,9 +65,11 @@ @@ -62,9 +66,11 @@
private Random rand = new Random(); private Random rand = new Random();
private int ticksBeforeMusic; private int ticksBeforeMusic;
@ -23,7 +23,7 @@
this.options = par2GameSettings; this.options = par2GameSettings;
this.fileAssets = par3File; this.fileAssets = par3File;
this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true); this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true);
@@ -75,6 +81,7 @@ @@ -76,6 +82,7 @@
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class); SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class); SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
SoundSystemConfig.setCodec("wav", CodecWav.class); SoundSystemConfig.setCodec("wav", CodecWav.class);
@ -31,7 +31,7 @@
} }
catch (SoundSystemException soundsystemexception) catch (SoundSystemException soundsystemexception)
{ {
@@ -90,6 +97,7 @@ @@ -92,6 +99,7 @@
this.stopAllSounds(); this.stopAllSounds();
this.cleanup(); this.cleanup();
this.tryToSetLibraryAndCodecs(); this.tryToSetLibraryAndCodecs();
@ -39,7 +39,7 @@
} }
private void loadSounds() private void loadSounds()
@@ -236,10 +244,11 @@ @@ -238,10 +246,11 @@
else else
{ {
SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound(); SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound();
@ -52,7 +52,7 @@
this.sndSystem.backgroundMusic("BgMusic", soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false); this.sndSystem.backgroundMusic("BgMusic", soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false);
this.sndSystem.setVolume("BgMusic", this.options.musicVolume); this.sndSystem.setVolume("BgMusic", this.options.musicVolume);
this.sndSystem.play("BgMusic"); this.sndSystem.play("BgMusic");
@@ -307,6 +316,7 @@ @@ -309,6 +318,7 @@
if (par1Str != null) if (par1Str != null)
{ {
SoundPoolEntry soundpoolentry = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str); SoundPoolEntry soundpoolentry = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
@ -60,7 +60,7 @@
if (soundpoolentry != null) if (soundpoolentry != null)
{ {
@@ -317,6 +327,7 @@ @@ -319,6 +329,7 @@
this.sndSystem.newStreamingSource(true, s1, soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false, par2, par3, par4, 2, 64.0F); this.sndSystem.newStreamingSource(true, s1, soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false, par2, par3, par4, 2, 64.0F);
this.sndSystem.setVolume(s1, 0.5F * this.options.soundVolume); this.sndSystem.setVolume(s1, 0.5F * this.options.soundVolume);
@ -68,7 +68,7 @@
this.sndSystem.play(s1); this.sndSystem.play(s1);
} }
} }
@@ -485,6 +496,7 @@ @@ -487,6 +498,7 @@
if (this.loaded && this.options.soundVolume != 0.0F) if (this.loaded && this.options.soundVolume != 0.0F)
{ {
SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
@ -76,7 +76,7 @@
if (soundpoolentry != null && par5 > 0.0F) if (soundpoolentry != null && par5 > 0.0F)
{ {
@@ -506,6 +518,7 @@ @@ -508,6 +520,7 @@
this.sndSystem.setPitch(s1, par6); this.sndSystem.setPitch(s1, par6);
this.sndSystem.setVolume(s1, par5 * this.options.soundVolume); this.sndSystem.setVolume(s1, par5 * this.options.soundVolume);
@ -84,7 +84,7 @@
this.sndSystem.play(s1); this.sndSystem.play(s1);
} }
} }
@@ -520,6 +533,7 @@ @@ -522,6 +535,7 @@
if (this.loaded && this.options.soundVolume != 0.0F) if (this.loaded && this.options.soundVolume != 0.0F)
{ {
SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str); SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
@ -92,7 +92,7 @@
if (soundpoolentry != null && par2 > 0.0F) if (soundpoolentry != null && par2 > 0.0F)
{ {
@@ -535,6 +549,7 @@ @@ -537,6 +551,7 @@
par2 *= 0.25F; par2 *= 0.25F;
this.sndSystem.setPitch(s1, par3); this.sndSystem.setPitch(s1, par3);
this.sndSystem.setVolume(s1, par2 * this.options.soundVolume); this.sndSystem.setVolume(s1, par2 * this.options.soundVolume);