001package bradleyross.coremidi4j.samples; 002import uk.co.xfactorylibrarians.coremidi4j.CoreMidiDeviceProvider; 003import uk.co.xfactorylibrarians.coremidi4j.CoreMidiNotification; 004import uk.co.xfactorylibrarians.coremidi4j.CoreMidiException; 005import javax.sound.midi.MidiDevice; 006/** 007 * Class used by {@link Available}. 008 * @author Derek Cook 009 * 010 */ 011public class Example { 012 public static boolean isCoreMidiLoaded() throws CoreMidiException { 013 return CoreMidiDeviceProvider.isLibraryLoaded(); 014 } 015 016 public static void watchForMidiChanges() throws CoreMidiException { 017 CoreMidiDeviceProvider.addNotificationListener(new CoreMidiNotification() { 018 public void midiSystemUpdated() { 019 System.out.println("The MIDI environment has changed."); 020 } 021 }); 022 } 023 024 public static MidiDevice.Info[] getWorkingDeviceInfo() { 025 return CoreMidiDeviceProvider.getMidiDeviceInfo(); 026 } 027}