LWJGL
May 21, 2012, 01:23:28
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
LWJGL 2.8.3 released!
Home
Help
Search
Login
Register
LWJGL
>
Programming
>
OpenAL
>
no sound while source is in state playing
Pages: [
1
]
« previous
next »
Print
Author
Topic: no sound while source is in state playing (Read 2521 times)
damencho
Newbie
Posts: 1
no sound while source is in state playing
«
on:
September 12, 2007, 00:53:24 »
Hi,
I'm trying to integrate openal into JMF Renderer. I've made a simple console app which reads bytes from file and pass it to the buffers to be played. the app runs ok.
The same code is used in the Renderer but no sound is produced. While waiting for some buffer to be processed, which never happens I print the state of the source and
it says : AL_PLAYING.
Can you give some advice what can be wrong ? I'm testing this on Windows.
Here is the sample code which works in standalone app but not if used with JMf in a Renderer
int numberOfBuffers = 2;
int numberOfFilledBuffers = 0;
IntBuffer buffers = BufferUtils.createIntBuffer(numberOfBuffers);
boolean stopped;
boolean playing = false;
int alInputFormat;
// open
IntBuffer sources = BufferUtils.createIntBuffer(1);
AL10.alGenSources(sources);
int source = sources.get(0);
AL10.alGenBuffers(buffers);
FileInputStream in = new FileInputStream("testfile.wav");
byte[] buff = new byte[1000];
while(in.read(buff) != -1)
{
// play
if(!playing)
{
fillInBuffer(buffers.get(numberOfFilledBuffers), buff, 0, buff.length);
numberOfFilledBuffers++;
if(numberOfFilledBuffers == numberOfBuffers)
{
AL10.alSourceQueueBuffers(source, buffers);
check();
AL10.alSourcePlay(source);
check();
playing = true;
}
continue;
}
while(AL10.alGetSourcei(source, AL10.AL_BUFFERS_PROCESSED) == 0)
{
System.out.println("state : " + AL10.alGetSourcei(source, AL10.AL_SOURCE_STATE));
Thread.sleep(3);
}
// update
IntBuffer unqueueBuffer = BufferUtils.createIntBuffer(1);
AL10.alSourceUnqueueBuffers(source, unqueueBuffer);
fillInBuffer(unqueueBuffer.get(0), buff, 0, buff.length);
unqueueBuffer.rewind();
AL10.alSourceQueueBuffers(source, unqueueBuffer);
}
Thanks in advance
damencho
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Programming
-----------------------------
=> Lightweight Java Library Game Development
=> LWJGL Documentation
=> Bug Reports / RFE
=> OpenGL
=> OpenAL
=> General Java Game Development
-----------------------------
Archive
-----------------------------
=> Resolved Bugs/RFE
=> DirectX
=> DevIL
=> FMOD
Loading...