FileDocCategorySizeDatePackage
MidiSystem.javaAPI DocAndroid 1.5 API37290Wed May 06 22:41:02 BST 2009javax.sound.midi

MidiSystem

public class MidiSystem extends Object

Fields Summary
private static final String
midiDeviceProviderPath
private static final String
midiFileReaderPath
private static final String
midiFileWriterPath
private static final String
soundbankReaderPath
private static final String
receiverName
private static final String
sequencerName
private static final String
synthesizerName
private static final String
transmitterName
Constructors Summary
Methods Summary
public static javax.sound.midi.MidiDevicegetMidiDevice(javax.sound.midi.MidiDevice.Info info)

    
        
              
        //FIXME
        /*
         * this method must to throw out MidiUnavailableException if requested device
         * is not available
         */
        
        /* 
         * obtain the list of MidiDeviceProviders
         */
        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
        /*
         * find device that describes by parameter info and return it
         */
        for (int i = 0; i < deviceProviders.size(); i++) {
            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
            for (Info element : deviceInfo) {
                if (element.equals(info)) {
                    return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(info);
                }
            }
        }
        /*
         * if we can't find device with requested info, we throw out IllegalArgumentException
         */
        throw new IllegalArgumentException("Requested device not installed: " + info.getName());
    
public static javax.sound.midi.MidiDevice.Info[]getMidiDeviceInfo()

        /*
         * obtain the list of MidiDeviceProviders
         */
        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
        //variable to save MidiDevice.Info
        List<MidiDevice.Info> infos = new ArrayList<MidiDevice.Info>();
        /*
         * look through list of providers and save info of devices
         */
        for (int i = 0; i < deviceProviders.size(); i++) {
            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
            for (Info element : deviceInfo) {
                infos.add(element);
            }
        }
        
        MidiDevice.Info[] temp = new MidiDevice.Info[infos.size()];
        return infos.toArray(temp);
    
public static javax.sound.midi.MidiFileFormatgetMidiFileFormat(java.io.File file)

        /*
         * obtain the list of MidiFileReaderProviders
         */
        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
        if (fileReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileReader) fileReaderProviders.get(0)).getMidiFileFormat(file);
    
public static javax.sound.midi.MidiFileFormatgetMidiFileFormat(java.io.InputStream stream)

        /*
         * obtain the list of MidiFileReaderProviders
         */
        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
        if (fileReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileReader) fileReaderProviders.get(0)).getMidiFileFormat(stream);
    
public static javax.sound.midi.MidiFileFormatgetMidiFileFormat(java.net.URL url)

        /*
         * obtain the list of MidiFileReaderProviders
         */
        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
        if (fileReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileReader) fileReaderProviders.get(0)).getMidiFileFormat(url);
    
public static int[]getMidiFileTypes()

        /*
         * obtain the list of MidiFileWriterProviders
         */
        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
        if (fileWriterProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileWriterProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileWriter) fileWriterProviders.get(0)).getMidiFileTypes();
    
public static int[]getMidiFileTypes(javax.sound.midi.Sequence sequence)

        /*
         * obtain the list of MidiFileWriterProviders
         */
        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
        if (fileWriterProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileWriterProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileWriter) fileWriterProviders.get(0)).getMidiFileTypes(sequence);
    
public static javax.sound.midi.ReceivergetReceiver()

        /*
         * description of the default device for javax.sound.midi.Receiver
         */
        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(receiverName);
        /*
         * obtain the list of MidiDeviceProviders
         */
        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
        String provName;
        int deviceNum = -1;
        /*
         * defaultDevice.get(0) --> provider
         * defaultDevice.get(1) --> name
         */      
        if (defaultDevice.size() != 0) {
            /*
             * obtain the provider number in the list of deviceProviders that is provider for default device
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                provName = deviceProviders.get(i).toString();
                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
                    deviceNum = i;
                    break;
                }
            }
            /*
             * the first case: find the same provider and name that describes by default device
             */
            if (deviceNum != -1) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        try {
                            return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getReceiver();
                        } catch (MidiUnavailableException e) {}
                    }
                }
            for (Info element : deviceInfo) {
                    try {
                        return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getReceiver();
                    } catch (MidiUnavailableException e) {}
                }
            }
            /*
             * if we don't find again, find any receivers describe by name
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        try {
                            return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getReceiver();
                        } catch (MidiUnavailableException e) {}
                    }
                }
            }
        }
        /*
         * in the last case we look throw all providers and find any receiver
         */
        for (int i = 0; i < deviceProviders.size(); i++) {
            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
            for (Info element : deviceInfo) {
                try {
                    return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getReceiver();
                } catch (MidiUnavailableException e) {}
            }
        }
        /*
         * if we don't find anyway, we throw out MidiUnavailableException
         */
        throw new MidiUnavailableException("There are no Recivers installed on your system!");
    
public static javax.sound.midi.SequencegetSequence(java.io.InputStream stream)

        /*
         * obtain the list of MidiFileReaderProviders
         */
        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
        // BEGIN android-added
        try {
            ((List)fileReaderProviders).add(Class.forName("com.android.internal.sound.midi.AndroidMidiFileReader").newInstance());
        } catch (Exception ex) {
            // Ignore
        }
        // END android-added
        if (fileReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileReader) fileReaderProviders.get(0)).getSequence(stream);
    
public static javax.sound.midi.SequencegetSequence(java.net.URL url)

        /*
         * obtain the list of MidiFileReaderProviders
         */
        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
        // BEGIN android-added
        try {
            ((List)fileReaderProviders).add(Class.forName("com.android.internal.sound.midi.AndroidMidiFileReader").newInstance());
        } catch (Exception ex) {
            // Ignore
        }
        // END android-added
        if (fileReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileReader) fileReaderProviders.get(0)).getSequence(url);
    
public static javax.sound.midi.SequencegetSequence(java.io.File file)

        /*
         * obtain the list of MidiFileReaderProviders
         */
        List<?> fileReaderProviders = ProviderService.getProviders(midiFileReaderPath);
        // BEGIN android-added
        try {
            ((List)fileReaderProviders).add((Object)Class.forName("com.android.internal.sound.midi.AndroidMidiFileReader").newInstance());
        } catch (Exception ex) {
            // Ignore
        }
        // END android-added
        if (fileReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileReader) fileReaderProviders.get(0)).getSequence(file);
    
public static javax.sound.midi.SequencergetSequencer()

        /*
         * this method is equals to method MidiSystem.getSequencer(true)
         */
        return getSequencer(true);
    
public static javax.sound.midi.SequencergetSequencer(boolean connected)

        /*
         * description of the default device for javax.sound.midi.Sequencer
         */
        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(sequencerName);
        /*
         * obtain the list of MidiDeviceProviders
         */
        List<?>  deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
        
        Sequencer sequencer;
        Transmitter seqTrans;
        Synthesizer synth;
        Receiver recv;
        String provName;
        int deviceNum = -1;
        /*
         * defaultDevice.get(0) --> provider
         * defaultDevice.get(1) --> name
         */      
        if (defaultDevice.size() != 0) {
            /*
             * obtain the provider number in the list of deviceProviders that is provider for default device
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                provName = deviceProviders.get(i).toString();
                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
                    deviceNum = i;
                    break;
                }
            }
            /*
             * the first case: find the same provider and name that describes by default device
             */
            if (deviceNum != -1) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Sequencer) {
                            if (connected) {
                                sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
                                seqTrans = sequencer.getTransmitter();
                                try {
                                    synth = MidiSystem.getSynthesizer();
                                    recv = synth.getReceiver();                                    
                                } catch (MidiUnavailableException e) {
                                    /*
                                     * if we haven't Synthesizer in the system, we use default receiver
                                     */
                                    recv = MidiSystem.getReceiver();
                                }
                                seqTrans.setReceiver(recv);
                                return sequencer;
                            }
                            return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
                        }
                    }
                }
                for (Info element : deviceInfo) {
                    if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Sequencer) {
                        if (connected) {
                            sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
                            seqTrans = sequencer.getTransmitter();
                            try {
                                synth = MidiSystem.getSynthesizer();
                                recv = synth.getReceiver();                                    
                            } catch (MidiUnavailableException e) {
                                /*
                                 * if we haven't Synthesizer in the system, we use default receiver
                                 */
                                recv = MidiSystem.getReceiver();
                            }
                            seqTrans.setReceiver(recv);
                            return sequencer;
                        }
                        return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
                    }
                }
            }
            /*
             * if we don't find again, find any receivers describe by name
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Sequencer) {
                            if (connected) {
                                sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
                                seqTrans = sequencer.getTransmitter();
                                try {
                                    synth = MidiSystem.getSynthesizer();
                                    recv = synth.getReceiver();                                    
                                } catch (MidiUnavailableException e) {
                                    /*
                                     * if we haven't Synthesizer in the system, we use default receiver
                                     */
                                    recv = MidiSystem.getReceiver();
                                }
                                seqTrans.setReceiver(recv);
                                return sequencer;
                            }
                            return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
                        }
                    }
                }
            }
        }
        /*
         * in the last case we look throw all providers and find any receiver
         */
        for (int i = 0; i < deviceProviders.size(); i++) {
            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
            for (Info element : deviceInfo) {
                if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Sequencer) {
                    if (connected) {
                        sequencer = (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
                        seqTrans = sequencer.getTransmitter();
                        try {
                            synth = MidiSystem.getSynthesizer();
                            recv = synth.getReceiver();                                    
                        } catch (MidiUnavailableException e) {
                            /*
                             * if we haven't Synthesizer in the system, we use default receiver
                             */
                            recv = MidiSystem.getReceiver();
                        }
                        seqTrans.setReceiver(recv);
                        return sequencer;
                    }
                    return (Sequencer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
                }
            }
        }
        // BEGIN android-added
        try {
            return (Sequencer)(Class.forName("com.android.internal.sound.midi.AndroidSequencer").newInstance());
        } catch (Exception ex) {
            // Ignore
        }
        // END android-added
        /*
         * if we don't find anyway, we throw out MidiUnavailableException
         */
        throw new MidiUnavailableException("There are no Synthesizers installed on your system!");
    
public static javax.sound.midi.SoundbankgetSoundbank(java.io.File file)

        /*
         * obtain the list of SoundbankReaderProviders
         */
        List<?> soundbankReaderProviders = ProviderService.getProviders(soundbankReaderPath);
        if (soundbankReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no SoundbankReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((SoundbankReader) soundbankReaderProviders.get(0)).getSoundbank(file);
    
public static javax.sound.midi.SoundbankgetSoundbank(java.io.InputStream stream)

        /*
         * obtain the list of SoundbankReaderProviders
         */
        List<?> soundbankReaderProviders = ProviderService.getProviders(soundbankReaderPath);
        if (soundbankReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no SoundbankReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((SoundbankReader) soundbankReaderProviders.get(0)).getSoundbank(stream);
    
public static javax.sound.midi.SoundbankgetSoundbank(java.net.URL url)

        /*
         * obtain the list of SoundbankReaderProviders
         */
        List<?> soundbankReaderProviders = ProviderService.getProviders(soundbankReaderPath);
        if (soundbankReaderProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no SoundbankReaderProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((SoundbankReader) soundbankReaderProviders.get(0)).getSoundbank(url);
    
public static javax.sound.midi.SynthesizergetSynthesizer()

        /*
         * description of the default device for javax.sound.midi.Synthesizer
         */
        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(synthesizerName);
        /*
         * obtain the list of MidiDeviceProviders
         */
        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
        String provName;
        int deviceNum = -1;
        
        /*
         * defaultDevice.get(0) --> provider
         * defaultDevice.get(1) --> name
         */      
        if (defaultDevice.size() != 0) {
            /*
             * obtain the provider number in the list of deviceProviders that is provider for default device
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                provName = deviceProviders.get(i).toString();
                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
                    deviceNum = i;
                    break;
                }
            }
            /*
             * the first case: find the same provider and name that describes by default device
             */
            if (deviceNum != -1) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Synthesizer) {
                            return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
                        }
                    }
                }
                for (Info element : deviceInfo) {
                    if (((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element) instanceof Synthesizer) {
                        return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element);
                    }
                }
            }
            /*
             * if we don't find again, find any receivers describe by name
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Synthesizer) {
                            return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
                        }
                    }
                }
            }
        }
        /*
         * in the last case we look throw all providers and find any receiver
         */
        for (int i = 0; i < deviceProviders.size(); i++) {
            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
            for (Info element : deviceInfo) {
                if (((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element) instanceof Synthesizer) {
                    return (Synthesizer) ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element);
                }
            }
        }
        /*
         * if we don't find anyway, we throw out MidiUnavailableException
         */
        throw new MidiUnavailableException("There are no Synthesizers installed on your system!");
    
public static javax.sound.midi.TransmittergetTransmitter()

        /*
         * description of the default device for javax.sound.midi.Transmitter
         */
        List<String> defaultDevice = ProviderService.getDefaultDeviceDescription(transmitterName);
        /*
         * obtain the list of MidiDeviceProviders
         */
        List<?> deviceProviders = ProviderService.getProviders(midiDeviceProviderPath);
        String provName;
        int deviceNum = -1;
        /*
         * defaultDevice.get(0) --> provider
         * defaultDevice.get(1) --> name
         */      
        if (defaultDevice.size() != 0) {
            /*
             * obtain the provider number in the list of deviceProviders that is provider for default device
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                provName = deviceProviders.get(i).toString();
                if (provName.substring(0, provName.indexOf("@")).equals(defaultDevice.get(0))) {
                    deviceNum = i;
                    break;
                }
            }
            /*
             * the first case: find the same provider and name that describes by default device
             */
            if (deviceNum != -1) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        try {
                            return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getTransmitter();
                        } catch (MidiUnavailableException e) {}
                    }
                }
                for (Info element : deviceInfo) {
                    try {
                        return ((MidiDeviceProvider) deviceProviders.get(deviceNum)).getDevice(element).getTransmitter();
                    } catch (MidiUnavailableException e) {}
                }
            }
            /*
             * if we don't find again, find any receivers describe by name
             */
            for (int i = 0; i < deviceProviders.size(); i++) {
                MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
                for (Info element : deviceInfo) {
                    if (element.getName().equals(defaultDevice.get(1))) {
                        try {
                            return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getTransmitter();
                        } catch (MidiUnavailableException e) {}
                    }
                }
            }
        }
        /*
         * in the last case we look throw all providers and find any receiver
         */
        for (int i = 0; i < deviceProviders.size(); i++) {
            MidiDevice.Info[] deviceInfo = ((MidiDeviceProvider) deviceProviders.get(i)).getDeviceInfo();
            for (Info element : deviceInfo) {
                try {
                    return ((MidiDeviceProvider) deviceProviders.get(i)).getDevice(element).getTransmitter();
                } catch (MidiUnavailableException e) {}
            }
        }
        /*
         * if we don't find anyway, we throw out MidiUnavailableException
         */
        throw new MidiUnavailableException("There are no Transmitters installed on your system!");
    
public static booleanisFileTypeSupported(int fileType)

        /*
         * obtain the list of MidiFileWriterProviders;
         * if we already obtain the list of providers, we don't obtain it again
         */
        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
        if (fileWriterProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileWriterProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileWriter) fileWriterProviders.get(0)).isFileTypeSupported(fileType);
    
public static booleanisFileTypeSupported(int fileType, javax.sound.midi.Sequence sequence)

        /*
         * obtain the list of MidiFileWriterProviders
         */
        List<?> fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
        if (fileWriterProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileWriterProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileWriter) fileWriterProviders.get(0)).isFileTypeSupported(fileType, sequence);
    
public static intwrite(javax.sound.midi.Sequence in, int type, java.io.File out)

        /*
         * obtain the list of MidiFileWriterProviders
         */
        List<?>  fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
        if (fileWriterProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileWriterProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileWriter) fileWriterProviders.get(0)).write(in, type, out);
    
public static intwrite(javax.sound.midi.Sequence in, int fileType, java.io.OutputStream out)

        /*
         * obtain the list of MidiFileWriterProviders
         */
        List<?>  fileWriterProviders = ProviderService.getProviders(midiFileWriterPath);
        if (fileWriterProviders.size() == 0) {
            //FIXME
            /*
             * I don't understand what type of exception we should throw out if we haven't
             * appropriate providers...
             * Maybe here is should be MidiUnavailableException
             */
            throw new Error("There is no MidiFileWriterProviders on your system!!!");
        }
        /*
         * It's not determine what provider for this service I should to use, and so
         * I use the first one
         */
        return ((MidiFileWriter) fileWriterProviders.get(0)).write(in, fileType, out);