/*
 * Examples for Java
 *
 * Copyright (c) 2021. Elex. All Rights Reserved.
 * https://www.elex-project.com/
 */

package kr.pe.elex.examples;

import lombok.extern.slf4j.Slf4j;

import javax.sound.midi.*;
import java.io.File;
import java.io.IOException;

@Slf4j
public class MidiExample {
	public static void main(String... args) throws MidiUnavailableException, InvalidMidiDataException, IOException {
		Sequencer sequencer = MidiSystem.getSequencer();
		Synthesizer synthesizer = MidiSystem.getSynthesizer();
		Transmitter seqTransmitter = sequencer.getTransmitter();
		Receiver synthReceiver = synthesizer.getReceiver();

		sequencer.open();
		Sequence sequence = MidiSystem.getSequence(new File("MIDI_sample.mid"));
		sequencer.setSequence(sequence);
		sequencer.start();

		while (true){

		}
	}
}
