001package net.kreatious.pianoleopard.keyboardselect; 002 003import javax.sound.midi.MidiDevice; 004 005/** 006 * Represents the MIDI keyboard in use by the current application 007 * 008 * @author Jay-R Studer 009 */ 010public class Keyboard { 011 private final MidiDevice input; 012 private final MidiDevice output; 013 014 /** 015 * Constructs a new {@link Keyboard} with the specified input and output 016 * devices 017 * 018 * @param input 019 * the MIDI input device 020 * @param output 021 * the MIDI output device 022 */ 023 public Keyboard(MidiDevice input, MidiDevice output) { 024 this.input = input; 025 this.output = output; 026 } 027 028 /** 029 * Obtains the current input MIDI device. 030 * 031 * @return the current input {@link MidiDevice} 032 */ 033 public MidiDevice getInput() { 034 return input; 035 } 036 037 /** 038 * Obtains the current output MIDI device. 039 * 040 * @return the current output {@link MidiDevice} 041 */ 042 public MidiDevice getOutput() { 043 return output; 044 } 045 046 @Override 047 public String toString() { 048 return "Keyboard[input = " + input.getDeviceInfo() + ", output = " + output.getDeviceInfo() + "]"; 049 } 050}