All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.nosuch.midi.MidiSystem

java.lang.Object
   |
   +----com.nosuch.midi.MidiSystem

public class MidiSystem
extends Object
MidiSystem is the main class for controlling the Midi package. All definitions and methods are static. To use MIDI, invoke:
MidiSystem.start();
and then you can schedule MIDI output by doing things like:
MidiSystem.schedule(new MidiNote(100)); // pitch is 100


Constructor Index

 o MidiSystem()

Method Index

 o allNotesOff()
Return a phrase containing allo-notes-off messsages for all channels Currently this is only on the default channel
 o beatToClick(long)
Return number of clicks in a specified number of beats.
 o beatToMilli(long)
Return number of milliseconds in a specified number of beats.
 o clicksPerBeat()
Return number of clicks in a beat.
 o clickToMilli(long)
Return number of milliseconds in a specified number of clicks.
 o getNumInDevices()
return the number of input devices
 o getNumOutDevices()
return the number of output devices
 o isStarted()
Return true if MidiSystem has been started.
 o main(String[])
 o milliPerBeat()
Return number of milliseconds in one beat.
 o milliToClick(long)
Return number of clicks in a specified number of milliseconds.
 o nativeMidiInGetNumDevs()
Query the system regarding the number of MIDI input devices
 o nativeMidiOutGetNumDevs()
Query the system regarding the number of MIDI output devices
 o nativeNow()
Return value of current time in clicks (not milliseconds).
 o nativeOpenURL(String, String)
open a URL in a browser
 o nativeSetClicks(int)
set the value of Clicks for the scheduler
 o nativeSetDebug(int)
Set the debug flag for the Midi system
 o nativeSetTempo(int)
set the internal Tempo of the scheduler
 o now()
Return the current time in clicks.
 o schedule(byte[])
 o schedule(byte[], long)
 o schedule(MidiMsg)
Schedule a MidiMsg for eventual output.
 o schedule(MidiPhrase)
Schedule a MidiPhrase for eventual output The time offset of the phrase is set to MidiSystem.now(), so that if the time of the phrase starts at 0 (which is pretty normal), the phrase will play immediately.
 o schedule(MidiPhrase, long)
Schedule a MidiPhrase for eventual output.
 o setClicks(int)
Set the number of clicks per beat.
 o setDebug(int)
Set the debug level in the native methods.
 o setInDevice(MidiInput)
Set the input device to a new device (this is untested)
 o setOutDevice(MidiOutput)
Set the output device to a new device (this is untested)
 o setTempo(int)
Set the tempo of schedule playback.
 o start()
Initialize the MIDI system with default input and output devices.
 o start(MidiAction)
Initialize the MIDI system with specific callback actions.
 o start(MidiAction, int, int)
Initialize the MIDI system with specific callbacks and I/O devices.
 o stop()
Stop the MIDI system.

Constructors

 o MidiSystem
 public MidiSystem()

Methods

 o getNumInDevices
 public static int getNumInDevices()
return the number of input devices

 o getNumOutDevices
 public static int getNumOutDevices()
return the number of output devices

 o isStarted
 public static boolean isStarted()
Return true if MidiSystem has been started.

 o start
 public static boolean start()
Initialize the MIDI system with default input and output devices.

 o start
 public static boolean start(MidiAction act)
Initialize the MIDI system with specific callback actions.

Parameters:
act - MidiAction for callbacks on MIDI input messages.
 o start
 public static boolean start(MidiAction act,
                             int outId,
                             int inId)
Initialize the MIDI system with specific callbacks and I/O devices.

Parameters:
act - MidiAction for callbacks on MIDI input messages.
outId - Id of MIDI output device
inId - Id of MIDI input device
 o setOutDevice
 public static void setOutDevice(MidiOutput o)
Set the output device to a new device (this is untested)

 o setInDevice
 public static void setInDevice(MidiInput o)
Set the input device to a new device (this is untested)

 o stop
 public static void stop()
Stop the MIDI system.

 o allNotesOff
 public static MidiPhrase allNotesOff()
Return a phrase containing allo-notes-off messsages for all channels Currently this is only on the default channel

 o clickToMilli
 public static long clickToMilli(long nclicks)
Return number of milliseconds in a specified number of clicks.

Parameters:
nclicks - number of clicks
 o beatToMilli
 public static long beatToMilli(long nbeats)
Return number of milliseconds in a specified number of beats.

Parameters:
nbeats - number of beats
 o milliPerBeat
 public static long milliPerBeat()
Return number of milliseconds in one beat.

 o milliToClick
 public static long milliToClick(long milli)
Return number of clicks in a specified number of milliseconds.

Parameters:
milli - number of milliseconds
 o clicksPerBeat
 public static int clicksPerBeat()
Return number of clicks in a beat.

 o beatToClick
 public static long beatToClick(long nbeats)
Return number of clicks in a specified number of beats.

Parameters:
nbeats - number of beats
 o schedule
 public static synchronized void schedule(MidiMsg m) throws MidiException
Schedule a MidiMsg for eventual output.

Parameters:
m - MidiMsg to be scheduled
Throws: MidiException
If unable to schedule
 o schedule
 public static synchronized void schedule(MidiPhrase p) throws MidiException
Schedule a MidiPhrase for eventual output The time offset of the phrase is set to MidiSystem.now(), so that if the time of the phrase starts at 0 (which is pretty normal), the phrase will play immediately.

Parameters:
p - MidiPhrase to be scheduled
Throws: MidiException
If unable to schedule
 o schedule
 public static synchronized void schedule(MidiPhrase p,
                                          long offset) throws MidiException
Schedule a MidiPhrase for eventual output. The offset value controls when the phrase will begin. If the phrase time (i.e. the times attached to its MidiMsg objects) starts at 0, and the offset value is set to MidiSystem.now(), then playback will start immediately.

Parameters:
p - MidiPhrase to be scheduled
offset - An offset (in clicks) to be added to the time of the phrase
Throws: MidiException
If unable to schedule
 o schedule
 public static synchronized void schedule(byte b[]) throws MidiException
 o schedule
 public static synchronized void schedule(byte b[],
                                          long offset) throws MidiException
 o setTempo
 public static void setTempo(int t) throws MidiException
Set the tempo of schedule playback.

Parameters:
t - tempo in microseconds per beat.
Throws: MidiException
If something goes wrong.
 o setClicks
 public static void setClicks(int c) throws MidiException
Set the number of clicks per beat.

Parameters:
c - Number of clicks per beat.
Throws: MidiException
If something goes wrong.
 o setDebug
 public static void setDebug(int d) throws MidiException
Set the debug level in the native methods.

Parameters:
d - Debug level.
Throws: MidiException
If something goes wrong.
 o now
 public static long now()
Return the current time in clicks.

Returns:
s Current time in clicks.
 o nativeSetTempo
 public native void nativeSetTempo(int t) throws MidiException
set the internal Tempo of the scheduler

Throws: MidiException
If something goes wrong.
 o nativeSetClicks
 public native void nativeSetClicks(int c) throws MidiException
set the value of Clicks for the scheduler

Throws: MidiException
If something goes wrong.
 o nativeSetDebug
 public native void nativeSetDebug(int d)
Set the debug flag for the Midi system

 o nativeNow
 public native long nativeNow()
Return value of current time in clicks (not milliseconds).

Returns:
s Current time in clicks.
 o nativeMidiInGetNumDevs
 public native int nativeMidiInGetNumDevs() throws MidiException
Query the system regarding the number of MIDI input devices

Returns:
s The number of MIDI input devices.
Throws: MidiException
If something goes wrong.
 o nativeMidiOutGetNumDevs
 public native int nativeMidiOutGetNumDevs() throws MidiException
Query the system regarding the number of MIDI output devices

Returns:
s The number of MIDI output devices.
Throws: MidiException
If something goes wrong.
 o nativeOpenURL
 public native void nativeOpenURL(String browser,
                                  String url) throws MidiException
open a URL in a browser

Throws: MidiException
If something goes wrong.
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index