Hey,
my library is only a wrapper around JOAL and does provide some additional management tasks and tie it in with the Vec3D class, so you can apply the usual vector maths directly on the sound sources...
Because it is a wrapper only, you can still do everything JOAL offers. You can get a direct handle to the AL instance like this:
Code:AL al = JOALUtil.getInstance().getAL();
Having said this, I'm not using the ALut class at all and looking at the Javadocs for JOAL
it doesn't list that function you're mentioning above, so I guess there's a discrepancy between the C implementation of ALut and the JOAL one. However, you could have a look at the C version of the source and figure out the actual AL calls it does to populate the buffer.
Using the AudioBuffer class from my audioutils, you could synthesize a waveform with other outside means (e.g. the
wave generators in toxiclibscore) and then convert these into the PWM format used by WAV files and then set this as buffer data:
Code:import java.nio.*;
import toxi.math.waves.*;
import toxi.geom.*;
import toxi.math.*;
import toxi.audio.*;
int SAMPLE_FREQ=44100;
JOALUtil audio;
AudioBuffer buffer;
AudioSource source;
void setup() {
size(100,100);
// create an array for stereo samples
byte[] sample=new byte[SAMPLE_FREQ*2];
// calculate the base frequency in radians
float freq=AbstractWave.hertzToRadians(220,SAMPLE_FREQ);
// create an oscillator for the left channel
AbstractWave osc=new FMSawtoothWave(0,freq,127,128);
// and another for the right one (at 1/2 the base freq)
AbstractWave osc2=new SineWave(0,freq/2,127,128);
// populate the sample buffer
for(int i=0; i<sample.length; i+=2) {
sample[i]=(byte)osc.update();
sample[i+1]=(byte)osc2.update();
}
// init the audio library
audio=JOALUtil.getInstance();
audio.init();
// allocate a buffer via JOAL
buffer=audio.generateBuffers(1)[0];
// set the computed sample as buffer data
buffer.configure(ByteBuffer.wrap(sample),AudioBuffer.FORMAT_STEREO8,SAMPLE_FREQ);
// create a sound source, enable looping & play it
source=audio.generateSource();
source.setBuffer(buffer);
source.setLooping(true);
source.setReferenceDistance(width/2);
source.play();
}
This example will be part of the upcoming release. I still have to do more testing in regards to 16bit samples, but the principle works...
Hth!