Login  Register

Re: playing audio from an AVI file...

Posted by Xerxes Rånby on Mar 17, 2014; 9:12pm
URL: https://forum.jogamp.org/playing-audio-from-an-AVI-file-tp4031894p4031943.html

You had forgotten to rewind the bytebuffer

in Audio.java use this and it will work with JOAL OpenAL:

public static Buffer[] getBuffers(byte[] _buffer)
{
  Buffer[] b=AudioSystem3D.generateBuffers(1);
  ByteBuffer bb=ByteBuffer.allocate(_buffer.length);
  bb.put(_buffer);
  bb.flip(); // dont forget to rewind the bytebuffer to the beginning!
  b[0].configure(bb,Buffer.FORMAT_MONO8,11024);
  return b;
}

cheers
Xerxes