import javax.sound.midi.Synthesizer;
import camidion.chordhelper.ChordHelperApplet;
-import camidion.chordhelper.midieditor.MidiSequenceEditor;
/**
- * 仮想MIDIデバイスを含めた、すべてのMIDIデバイスモデル {@link MidiTransceiverListModel}
- * を収容するリストです。{@link MidiDeviceTreeModel} もこのリストを参照します。
+ * 仮想MIDIデバイスを含めたすべてのMIDIデバイスモデル {@link MidiTransceiverListModel} を収容するリスト
*/
public class MidiTransceiverListModelList extends Vector<MidiTransceiverListModel> {
public String toString() { return "MIDI devices"; }
- public MidiSequenceEditor editorDialog;
-
private MidiSequencerModel sequencerModel;
public MidiSequencerModel getSequencerModel() { return sequencerModel; }
public MidiTransceiverListModelList(List<VirtualMidiDevice> guiVirtualDeviceList) {
//
- // GUI仮想MIDIデバイスリストの構築
+ // GUI仮想MIDIデバイス
MidiTransceiverListModel guiModels[] = new MidiTransceiverListModel[guiVirtualDeviceList.size()];
for( int i=0; i<guiVirtualDeviceList.size(); i++ ) {
addElement(guiModels[i] = new MidiTransceiverListModel(guiVirtualDeviceList.get(i), this));
System.out.println(ChordHelperApplet.VersionInfo.NAME +" : MIDI sequencer unavailable");
e.printStackTrace();
}
- // MIDIエディタの生成
- editorDialog = new MidiSequenceEditor(sequencerModel);
- MidiTransceiverListModel editorDialogModel;
- addElement(editorDialogModel = new MidiTransceiverListModel(editorDialog.getVirtualMidiDevice(), this));
+ // その他のリアルMIDIデバイスの取得
MidiTransceiverListModel synthModel = null;
MidiTransceiverListModel firstMidiInModel = null;
MidiTransceiverListModel firstMidiOutModel = null;
MidiDevice.Info[] deviceInfos = MidiSystem.getMidiDeviceInfo();
for( MidiDevice.Info info : deviceInfos ) {
- // MIDIデバイスの取得
MidiDevice device;
try {
device = MidiSystem.getMidiDevice(info);
firstMidiOutModel,
sequencerModel,
firstMidiInModel,
- editorDialogModel,
};
for( MidiTransceiverListModel m : openModels ) if( m != null ) {
m.getMidiDevice().open();
sequencerModel.connectToReceiverOf(synthModel);
sequencerModel.connectToReceiverOf(firstMidiOutModel);
}
- if( editorDialogModel != null ) {
- editorDialogModel.connectToReceiverOf(synthModel);
- editorDialogModel.connectToReceiverOf(firstMidiOutModel);
- }
}
-}
\ No newline at end of file
+ /**
+ * すべてのデバイスについて、{@link MidiTransceiverListModel#resetMicrosecondPosition()}
+ * でマイクロ秒位置をリセットします。
+ */
+ public void resetMicrosecondPosition() {
+ for(MidiTransceiverListModel m : this) m.resetMicrosecondPosition();
+ }
+ /**
+ * すべてのMIDIデバイスを閉じます。
+ */
+ public void closeAllDevices() {
+ for(MidiTransceiverListModel m : this) m.device.close();
+ }
+}