private void updateAudioBuffer(AudioBuffer ab) {
        int id = ab.getId();
        if (ab.getId() == -1) {
            ib.clear().limit(1);
            al.alGenBuffers(1, ib);
            id = ib.get(0);
            ab.setId(id);

            // Register for automatic cleanup if unused
            objManager.registerObject(ab);
        }

        ByteBuffer data = ab.getData();

        data.clear(); // Ensure buffer is ready for reading
        int format = getOpenALFormat(ab);
        int sampleRate = ab.getSampleRate();

        al.alBufferData(id, format, data, data.capacity(), sampleRate);
        ab.clearUpdateNeeded();
    }
Uploads buffer data to OpenAL. Generates buffer ID if needed.
@param ab The AudioBuffer.
jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java