private int getOpenALFormat(AudioData audioData) {

        int channels = audioData.getChannels();
        int bitsPerSample = audioData.getBitsPerSample();

        if (channels == 1) {
            if (bitsPerSample == 8) {
                return AL_FORMAT_MONO8;
            } else if (bitsPerSample == 16) {
                return AL_FORMAT_MONO16;
            }
        } else if (channels == 2) {
            if (bitsPerSample == 8) {
                return AL_FORMAT_STEREO8;
            } else if (bitsPerSample == 16) {
                return AL_FORMAT_STEREO16;
            }
        }

        throw new UnsupportedOperationException("Unsupported audio format: "
                + channels + " channels, " + bitsPerSample + " bits per sample.");
    }
Gets the corresponding OpenAL format enum for the audio data properties.
@param audioData The AudioData.
@return The OpenAL format enum.
@throws UnsupportedOperationException if the format is not supported.
jme3-core/src/main/java/com/jme3/audio/openal/ALAudioRenderer.java