public static synchronized void setCodec( String extension,
                                              Class iCodecClass )
                                                     throws SoundSystemException
    {
        if( extension == null )
            throw new SoundSystemException( "Parameter 'extension' null in " +
                                          "method 'setCodec'.",
                                          SoundSystemException.NULL_PARAMETER );
        if( iCodecClass == null )
            throw new SoundSystemException( "Parameter 'iCodecClass' null in " +
                                          "method 'setCodec'.",
                                          SoundSystemException.NULL_PARAMETER );
        if( !ICodec.class.isAssignableFrom( iCodecClass ) )
            throw new SoundSystemException( "The specified class does " +
                        "not implement interface 'ICodec' in method 'setCodec'",
                        SoundSystemException.CLASS_TYPE_MISMATCH );

        if( codecs == null )
            codecs = new LinkedList<Codec>();
        
        ListIterator<Codec> i = codecs.listIterator();
        Codec codec;
        
        while( i.hasNext() )
        {
            codec = i.next();
            if( extension.matches( codec.extensionRegX ) )
                i.remove();
        }
        codecs.add( new Codec( extension, iCodecClass ) );

        // Let SoundSystem know if this is a MIDI codec, so it won't use
        // javax.sound.midi anymore:
        if( extension.matches( EXTENSION_MIDI ) )
            midiCodec = true;
    }