1 import javax.sound.midi.*;
4 * Functional representation of a MIDI track.
6 * @author Andersson, Andreen, Lanneskog, Pehrson
10 public class MooTrack {
12 private Collection notes;
14 private int instrument;
15 private boolean solo = false;
16 private boolean mute = false;
19 * Creates an empty MooTrack.
22 notes = new Collection();
24 // Find the first available channel
28 * Sets the MIDI instrument of the current track.
29 * @param instr the number of the MIDI instrument (0-127)
31 public void setInstrument(int instr) {
36 * Sets the MIDI channel of the current track.
37 * @param chan the number of the MIDI channel (1-16)
39 public void setChannel(int chan) {
44 * Returns the MIDI channel of the current track.
45 * @return the number of the channel
47 public int getChannel() {
52 * Returns the number of notes in the current track.
53 * @return the number of notes
55 public int getNumberOfNotes() {
60 * Adds the given note to the current track.
61 * @param note the MooNote to add
63 public void addNote(MooNote note) {
68 * Deletes the given note to the current track.
69 * @param note the MooNote to delete
71 public void deleteNote(MooNote note) {
76 * Returns the note of the given index.
77 * @param note the index of the note
79 public MooNote getNote(int note) {
80 return notes.get(note);
84 * Makes the current track solo.
85 * @param set if the track should be solo
87 public void setSolo(boolean set) {
92 * Mutes the current track.
93 * @param set if the track should be muted
95 public void setMute(boolean set) {
100 * Checks if the current track is solo.
101 * @return if the track is solo
104 public boolean isSolo() {
109 * Checks if the current track is muted.
110 * @return if the track is muted
112 public boolean isMute() {