@Override
    public void setAudioFormat( AudioFormat audioFormat )
    {
        int soundFormat = 0;
        if( audioFormat.getChannels() == 1 )
        {
            if( audioFormat.getSampleSizeInBits() == 8 )
            {
                soundFormat = AL10.AL_FORMAT_MONO8;
            }
            else if( audioFormat.getSampleSizeInBits() == 16 )
            {
                soundFormat = AL10.AL_FORMAT_MONO16;
            }
            else
            {
                errorMessage( "Illegal sample size in method " +
                              "'setAudioFormat'" );
                return;
            }
        }
        else if( audioFormat.getChannels() == 2 )
        {
            if( audioFormat.getSampleSizeInBits() == 8 )
            {
                soundFormat = AL10.AL_FORMAT_STEREO8;
            }
            else if( audioFormat.getSampleSizeInBits() == 16 )
            {
                soundFormat = AL10.AL_FORMAT_STEREO16;
            }
            else
            {
                errorMessage( "Illegal sample size in method " +
                              "'setAudioFormat'" );
                return;
            }
        }
        else
        {
            errorMessage( "Audio data neither mono nor stereo in " +
                          "method 'setAudioFormat'" );
            return;
        }
        ALformat = soundFormat;
        sampleRate = (int) audioFormat.getSampleRate();
    }