Fixes Music Ended (hopefully)

This commit is contained in:
fd 2015-02-21 20:20:57 -05:00
parent 2825f4c885
commit 27f5454afb

View File

@ -36,7 +36,6 @@ import java.nio.IntBuffer;
import org.lwjgl.BufferUtils; import org.lwjgl.BufferUtils;
import org.lwjgl.openal.AL10; import org.lwjgl.openal.AL10;
import org.lwjgl.openal.OpenALException; import org.lwjgl.openal.OpenALException;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.util.Log; import org.newdawn.slick.util.Log;
import org.newdawn.slick.util.ResourceLoader; import org.newdawn.slick.util.ResourceLoader;
@ -182,10 +181,6 @@ public class OpenALStreamPlayer {
while (AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED) > 0) { while (AL10.alGetSourcei(source, AL10.AL_BUFFERS_QUEUED) > 0) {
AL10.alSourceUnqueueBuffers(source, buffer); AL10.alSourceUnqueueBuffers(source, buffer);
buffer.clear(); buffer.clear();
int exc = AL10.alGetError();
if (exc != AL10.AL_NO_ERROR) {
System.out.println("removeBuffers AL ERROR, err: " + exc);
}
} }
} }
@ -196,7 +191,6 @@ public class OpenALStreamPlayer {
* @throws IOException Indicates a failure to read from the stream * @throws IOException Indicates a failure to read from the stream
*/ */
public synchronized void play(boolean loop) throws IOException { public synchronized void play(boolean loop) throws IOException {
this.loop = loop; this.loop = loop;
initStreams(); initStreams();
@ -268,10 +262,6 @@ public class OpenALStreamPlayer {
if (state != AL10.AL_PLAYING) { if (state != AL10.AL_PLAYING) {
AL10.alSourcePlay(source); AL10.alSourcePlay(source);
} }
int exc = AL10.alGetError();
if (exc != AL10.AL_NO_ERROR) {
System.out.println("update AL ERROR, err: " + exc);
}
} }
/** /**
@ -293,10 +283,6 @@ public class OpenALStreamPlayer {
int format = audio.getChannels() > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16; int format = audio.getChannels() > 1 ? AL10.AL_FORMAT_STEREO16 : AL10.AL_FORMAT_MONO16;
try { try {
AL10.alBufferData(bufferId, format, bufferData, audio.getRate()); AL10.alBufferData(bufferId, format, bufferData, audio.getRate());
int exc = AL10.alGetError();
if (exc != AL10.AL_NO_ERROR) {
System.out.println("stream AL ERROR, err: " + exc);
}
} catch (OpenALException e) { } catch (OpenALException e) {
Log.error("Failed to loop buffer: "+bufferId+" "+format+" "+count+" "+audio.getRate(), e); Log.error("Failed to loop buffer: "+bufferId+" "+format+" "+count+" "+audio.getRate(), e);
return false; return false;