MidiDevice is the base interface for all MIDI devices.
Common devices include synthesizers, sequencers, MIDI input ports, and MIDI
output ports.
A MidiDevice can be a transmitter or a receiver of
MIDI events, or both. Therefore, it can provide Transmitter
or Receiver instances (or both). Typically, MIDI IN ports
provide transmitters, MIDI OUT ports and synthesizers provide
receivers. A Sequencer typically provides transmitters for playback
and receivers for recording.
A MidiDevice can be opened and closed explicitly as
well as implicitly. Explicit opening is accomplished by calling
open(), explicit closing is done by calling close() on the MidiDevice instance.
If an application opens a MidiDevice
explicitly, it has to close it explicitly to free system resources
and enable the application to exit cleanly. Implicit opening is
done by calling MidiSystem.getReceiver and MidiSystem.getTransmitter. The MidiDevice used by
MidiSystem.getReceiver and
MidiSystem.getTransmitter is implementation-dependant
unless the properties javax.sound.midi.Receiver
and javax.sound.midi.Transmitter are used (see the
description of properties to select default providers in
MidiSystem). A MidiDevice
that was opened implicitly, is closed implicitly by closing the
Receiver or Transmitter that resulted in
opening it. If more than one implicitly opening
Receiver or Transmitter were obtained by
the application, the decive is closed after the last
Receiver or Transmitter has been
closed. On the other hand, calling getReceiver or
getTransmitter on the device instance directly does
not open the device implicitly. Closing these
Transmitters and Receivers does not close
the device implicitly. To use a device with Receivers
or Transmitters obtained this way, the device has to
be opened and closed explicitly.
If implicit and explicit opening and closing are mixed on the
same MidiDevice instance, the following rules apply:
MidiDevice device = ...; // we're now sure that device represents a MIDI port // ... }
A MidiDevice includes a object
to provide manufacturer information and so on.
MidiDevice.Info
Synthesizer,
Sequencer,
Receiver,
Transmitter| Nested Class Summary | |
|---|---|
static class | MidiDevice.Info
A MidiDevice.Info object contains assorted
data about a , including its
name, the company who created it, and descriptive text. |
| Method Summary | |
|---|---|
void | close()
Closes the device, indicating that the device should now release any system resources it is using. |
MidiDevice.Info | getDeviceInfo()
Obtains information about the device, including its Java class and Strings containing its name, vendor, and description. |
int | getMaxReceivers()
Obtains the maximum number of MIDI IN connections available on this MIDI device for receiving MIDI data. |
int | getMaxTransmitters()
Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data. |
long | getMicrosecondPosition()
Obtains the current time-stamp of the device, in microseconds. |
Receiver | getReceiver()
Obtains a MIDI IN receiver through which the MIDI device may receive MIDI data. |
List<Receiver> | getReceivers()
Returns all currently active, non-closed receivers connected with this MidiDevice. |
Transmitter | getTransmitter()
Obtains a MIDI OUT connection from which the MIDI device will transmit MIDI data The returned transmitter must be closed when the application has finished using it. |
List<Transmitter> | getTransmitters()
Returns all currently active, non-closed transmitters connected with this MidiDevice. |
boolean | isOpen()
Reports whether the device is open. |
void | open()
Opens the device, indicating that it should now acquire any system resources it requires and become operational. |
| Method Detail |
|---|
MidiDevice.Info getDeviceInfo()
Strings containing its name, vendor, and description.
void open() throws MidiUnavailableException
An application opening a device explicitly with this call
has to close the device by calling close(). This is
necessary to release system resources and allow applications to
exit cleanly.
Note that some devices, once closed, cannot be reopened. Attempts to reopen such a device will always result in a MidiUnavailableException.
MidiUnavailableException - thrown if the device cannot be
opened due to resource restrictions.
SecurityException - thrown if the device cannot be
opened due to security restrictions.close(),
isOpen()void close()
All Receiver and Transmitter instances
open from this device are closed. This includes instances retrieved
via MidiSystem.
boolean isOpen()
long getMicrosecondPosition()
int getMaxReceivers()
int getMaxTransmitters()
Receiver getReceiver() throws MidiUnavailableException
Obtaining a Receiver with this method does not
open the device. To be able to use the device, it has to be
opened explicitly by calling open(). Also, closing the
Receiver does not close the device. It has to be
closed explicitly by calling close().
MidiUnavailableException - thrown if a receiver is not available
due to resource restrictionsReceiver.close()List<Receiver> getReceivers()
Transmitter getTransmitter() throws MidiUnavailableException
Obtaining a Transmitter with this method does not
open the device. To be able to use the device, it has to be
opened explicitly by calling open(). Also, closing the
Transmitter does not close the device. It has to be
closed explicitly by calling close().
MidiUnavailableException - thrown if a transmitter is not available
due to resource restrictionsTransmitter.close()List<Transmitter> getTransmitters()
Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
7 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)