@Override
    public float millisecondsPlayed()
    {
        // get number of samples played in current buffer
        float offset = (float)AL10.alGetSourcei( ALSource.get( 0 ),
                                               AL11.AL_BYTE_OFFSET );

        float bytesPerFrame = 1f;
        switch( ALformat )
        {
            case AL10.AL_FORMAT_MONO8 :
                bytesPerFrame = 1f;
                break;
            case AL10.AL_FORMAT_MONO16 :
                bytesPerFrame = 2f;
                break;
            case AL10.AL_FORMAT_STEREO8 :
                bytesPerFrame = 2f;
                break;
            case AL10.AL_FORMAT_STEREO16 :
                bytesPerFrame = 4f;
                break;
            default :
                break;
        }

        offset = ( ( (float) offset / bytesPerFrame ) / (float) sampleRate )
                                                                         * 1000;

        // add the milliseconds from stream-buffers that played previously
        if( channelType == SoundSystemConfig.TYPE_STREAMING )
            offset += millisPreviouslyPlayed;

        // Return millis played:
        return( offset );
    }