public void init() {
        if (inited) {
            return;
        }
        Log.info("Initialising sounds..");
        inited = true;

        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                try {
                    AL.create();
                    soundWorks = true;
                    sounds = true;
                    music = true;
                    Log.info("- Sound works");
                } catch (Exception e) {
                    Log.error("Sound initialisation failure.");
                    Log.error(e);
                    soundWorks = false;
                    sounds = false;
                    music = false;
                }

                return null;
            }

        });

        if (soundWorks) {
            sourceCount = 0;
            sources = BufferUtils.createIntBuffer(maxSources);
            while (AL10.alGetError() == AL10.AL_NO_ERROR) {
                IntBuffer temp = BufferUtils.createIntBuffer(1);

                try {
                    AL10.alGenSources(temp);

                    if (AL10.alGetError() == AL10.AL_NO_ERROR) {
                        sourceCount++;
                        sources.put(temp.get(0));
                        if (sourceCount > maxSources - 1) {
                            break;
                        }
                    }
                } catch (OpenALException e) {
                    // expected at the end
                    break;
                }
            }
            Log.info("- " + sourceCount + " OpenAL source available");

            if (AL10.alGetError() != AL10.AL_NO_ERROR) {
                sounds = false;
                music = false;
                soundWorks = false;
                Log.error("- AL init failed");
            } else {
                FloatBuffer listenerOri = BufferUtils.createFloatBuffer(6).put(new float[]{0.0f, 0.0f, -1.0f, 0.0f,
                        1.0f, 0.0f});
                FloatBuffer listenerVel = BufferUtils.createFloatBuffer(3).put(new float[]{0.0f, 0.0f, 0.0f});
                FloatBuffer listenerPos = BufferUtils.createFloatBuffer(3).put(new float[]{0.0f, 0.0f, 0.0f});
                listenerPos.flip();
                listenerVel.flip();
                listenerOri.flip();
                AL10.alListener(AL10.AL_POSITION, listenerPos);
                AL10.alListener(AL10.AL_VELOCITY, listenerVel);
                AL10.alListener(AL10.AL_ORIENTATION, listenerOri);

                Log.info("- Sounds source generated");
            }
        }
    }