$$ \definecolor{rr}{rgb}{0.95,0.1,0} \definecolor{bb}{rgb}{0,0.4,1} \definecolor{gg}{rgb}{0,0.6,0} \definecolor{yy}{rgb}{0.8,0.5,0} \definecolor{pp}{rgb}{0.9,0,0.5} $$
내성적 물망초
: 내 성적 물리 때문에 망하기 10초 전

MidiSystem 클래스

~카테고리:
java/midi
패키지: javax.sound.midi
java.lang.Object
javax.sound.midi.MidiSystem

public class MidiSystem extends Object

신디사이저, 시퀀서, 미디 입출력 포트와 같은 장치들을 포함하는 설치된 미디시스템 자원에 접근을 제공하는 클래스. 간단한 미디 응용프로그램은 MidiSystem의 메쏘드를 하나 이상 불러서 어느 장치가 설치되었는지 알아내고 응용프로그램에 필요한 것들을 얻음으로써 시작하는 것이 보통이다.

또한, 이 클래스는 파일, 스트림, 표준미디파일 데이터나 사운드뱅크들이 있는 URL을 읽는 메쏘드들을 갖고있다. 지정된 미디파일의 형식을 이 클래스에 물을 수 있다.

MidiSystem은 객체화가 아니 되며 모든 메쏘드는 static이다.

기본 미디장치를 지정할 때 ` property들이 쓰일 수 있다. ` 시스템properties와 ` properties파일이 모두 고려된다. 기본 ` properties파일은 JRE 디렉토리에 있는 "lib/sound.properties" 이다. ` 시스템property와 ` properties파일이 둘다 존자하면 전자를 채택한다. 지정된 게 없으면 가용 장치 중에서 적절한 기본값이 선택된다. ` properties파일의 구문은 Properties.load에서 지정돼있다. 다음 표는 메쏘드들에게 가용 property key로 취급되는 것들의 일람이다.

Property Key인터페이스영향받는 메쏘드
javax.sound.midi.ReceiverReceivergetReceiver()
javax.sound.midi.SequencerSequencergetSequencer()
javax.sound.midi.SynthesizerSynthesizergetSynthesizer()
javax.sound.midi.TransmitterTransmittergetTransmitter()

` property 값은 "#"표시로 구분되는 장치이름과 ` provider클래스이름으로 구성된다. ` provider 클래스의 이름은 ` concrete MIDI device provider 클래스의 ` fully-qualified 이름이다. MidiDevice.Info의 getName 메쏘드가 반환하는 문자열과 장치 이름은 일치한다. 클래스 이름이나 장치 이름이나 생략될 수도 있다. 클래스 이름만 지정된다면야 뒤따르는 #표시는 선택사항이다.

`If the provider class is specified, and it can be successully retrieved from the installed providers, the list of MidiDevice.Info objects is retrieved from the provider. Otherwise, or when these devices do not provide a subsequent match, the list is retrieved from getMidiDeviceInfo() to contain all available MidiDevice.Info objects.

`If a device name is specified, the resulting list of MidiDevice.Info objects is searched: the first one with a matching name, and whose MidiDevice implements the respective interface, will be returned. If no matching MidiDevice.Info object is found, or the device name is not specified, the first suitable device from the resulting list will be returned. For Sequencer and Synthesizer, a device is suitable if it implements the respective interface; whereas for Receiver and Transmitter, a device is suitable if it implements neither Sequencer nor Synthesizer and provides at least one Receiver or Transmitter, respectively. For example, the property javax.sound.midi.Receiver with a value "com.sun.media.sound.MidiProvider#SunMIDI1" will have the following consequences when getReceiver is called: if the class com.sun.media.sound.MidiProvider exists in the list of installed MIDI device providers, the first Receiver device with name "SunMIDI1" will be returned. If it cannot be found, the first Receiver from that provider will be returned, regardless of name. If there is none, the first Receiver with name "SunMIDI1" in the list of all devices (as returned by getMidiDeviceInfo) will be returned, or, if not found, the first Receiver that can be found in the list of all devices is returned. If that fails, too, a MidiUnavailableException is thrown.

메쏘드 요약

메쏘드
제한자, 자료형 식별자, 설명
static MidiDevice getMidiDevice(
MidiDevice.Info info
)
요청된 미디 장치를 얻기.
static MidiDevice.Info[] getMidiDeviceInfo() `Obtains an array of information objects representing the set of all MIDI devices available on the system.
static MidiFileFormat getMidiFileFormat(
File file
)
지정된 File의 미디파일형식을 얻기.
static MidiFileFormat getMidiFileFormat(
InputStream stream
)
`Obtains the MIDI file format of the data in the specified input stream.
static MidiFileFormat getMidiFileFormat(
URL url
)
지정된 URL에서 데이터의 미디파일 형식을 얻기.
static int[] getMidiFileTypes() `Obtains the set of MIDI file types for which file writing support is provided by the system.
static int[] getMidiFileTypes(
Sequence sequence
)
`Obtains the set of MIDI file types that the system can write from the sequence specified.
static Receiver getReceiver() `Obtains a MIDI receiver from an external MIDI port or other default device.
static Sequence getSequence(
File file
)
지정된 파일에서 미디시퀀스를 얻기.
static Sequence getSequence(
InputStream stream
)
지정된 입력 스트림에서 미디시퀀스를 얻기.
static Sequence getSequence(
URL url
)
지정된 URL에서 미디시퀀스를 얻기.
static Sequencer getSequencer() `Obtains the default Sequencer, connected to a default device.
static Sequencer getSequencer(
boolean connected
)
`Obtains the default Sequencer, optionally connected to a default device.
static Soundbank getSoundbank(
File file
)
지정된 파일에서 미디사운드뱅크를 읽어들여 생성.
static Soundbank getSoundbank(
InputStream stream
)
지정된 스트림에서 미디사운드뱅크를 읽어들여 생성.
static Soundbank getSoundbank(
URL url
)
지정된 URL에서 Soundbank를 읽어들여 생성.
static Synthesizer getSynthesizer() 기본 신디사이저를 얻기.
static Transmitter getTransmitter() `Obtains a MIDI transmitter from an external MIDI port or other default source.
static boolean isFileTypeSupported(
int fileType
)
`Indicates whether file writing support for the specified MIDI file type is provided by the system.
static boolean isFileTypeSupported(
int fileType
,
Sequence sequence
)
`Indicates whether a MIDI file of the file type specified can be written from the sequence indicated.
static int write(
Sequence in
,
int type
,
File out
)
`Writes a stream of bytes representing a file of the MIDI file type indicated to the external file provided.
static int write(
Sequence in
,
int fileType
,
OutputStream out
)
`Writes a stream of bytes representing a file of the MIDI file type indicated to the output stream provided.
java.lang.Object에서 상속받은 메쏘드
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
https://docs.oracle.com/javase/7/docs/api/javax/sound/midi/MidiSystem.html