summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXerxes Rånby <xerxes@zafena.se>2012-12-06 12:03:22 +0100
committerXerxes Rånby <xerxes@zafena.se>2012-12-06 12:03:22 +0100
commitf2745f2faf603bdc5d90dd1898315c0548bf8203 (patch)
treeee298153c11a5093899c2ce3ddaea8a40989fe30
parentd75b7a11ba5e32dcbcfd824b702e23a380adefc7 (diff)
Fix JOAL alGenSources channel initialization.
Negative sourceId is ok. Use alGetError to detect failed initialization. Signed-off-by: Xerxes Rånby <xerxes@zafena.se>
-rw-r--r--src/jake2/sound/joal/Channel.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/jake2/sound/joal/Channel.java b/src/jake2/sound/joal/Channel.java
index d786a56..182cc44 100644
--- a/src/jake2/sound/joal/Channel.java
+++ b/src/jake2/sound/joal/Channel.java
@@ -115,12 +115,15 @@ public class Channel {
for (int i = 0; i < MAX_CHANNELS; i++) {
try {
+ al.alGetError(); //Clear al error
al.alGenSources(1, tmp, 0);
sourceId = tmp[0];
+ int errorCode = al.alGetError();
// can't generate more sources
- if (sourceId <= 0) {
+ if (errorCode != AL.AL_NO_ERROR) {
Com.Println("can't generate more sources: channel="+
- i +" sourceId<=0");
+ i +" sourceId=" + sourceId +
+ " alError:" + errorCode);
break;
}
} catch (ALException e) {