]> ruin.nu Git - moosique.git/blob - MooNote.java
Started on Moosique and MooNote. Changed comment in the others.
[moosique.git] / MooNote.java
1 import javax.sound.midi.*;
2
3 /*
4  * Functional representation of a MIDI note, which contains two MIDI events, note on and note off.
5  * 
6  * @author  Andersson, Andreen, Lanneskog, Pehrson
7  * @version 1
8  */
9  
10 public class MooNote {
11
12         private MidiEvent noteOnEvent, noteOffEvent;
13         private ShortMessage noteOnMsg, noteOffMsg;
14         private long noteOnTime, noteOffTime;
15
16         /* 
17          * Creates a MooNote of the given pitch, velocity and length in the current track.
18          */
19         public MooNote (int pitch, int velocity, int length) {
20                 // MidiEvent(MidiMessage message, long tick)
21                 noteOnMsg = new ShortMessage();
22                 noteOffMsg = new ShortMessage();
23                 noteOnMsg.setMessage(ShortMessage.NOTE_ON, top.getChannel(), pitch, velocity);
24                 noteOffMsg.setMessage(ShortMessage.NOTE_OFF, top.getChannel(), pitch, velocity);
25 //              noteOnTime = ???;
26                 noteOffTime = noteOnTime + length;
27                 noteOnEvent = new MidiEvent(noteOnMsg, noteOnTime)
28                 noteOffEvent = new MidiEvent(noteOffMsg, noteOffTime)
29         }
30
31         /* 
32          * Sets the pitch of the current note.
33          + @param pitch         the pitch of the note (0-127)
34          */
35         public void setPitch(int pitch) {
36         
37         }
38
39         /* 
40          * Sets the velocity of the current note.
41          + @param vel   the velocity of the note (0-127)
42          */
43         public void setVelocity(int vel) {
44         
45         }
46
47         /* 
48          * Sets the length of the current note (or rather moves the note off event).
49          + @param n     the length of the note in ticks (100 per beat)
50          */
51         public void setLength(int ticks) {
52         
53         }
54
55         /* 
56          * Returns the note on event of the current note.
57          * @return      the note on MidiEvent
58          */
59         public MidiEvent getNoteOnEvent() {
60         
61         }
62
63         /* 
64          * Returns the note off event of the current note.
65          * @return      the note off MidiEvent
66          */
67         public MidiEvent getNoteOffEvent() {
68         
69         }
70
71         /* 
72          * Returns the pitch of the current note.
73          * @return the pitch of the note
74          */
75         public int getPitch() {
76         
77         }
78
79         /* 
80          * Returns the velocity of the current note.
81          * @return the velocity of the note
82          */
83         public int getVelocity() {
84         
85         }
86
87         /* 
88          * Returns the length of the current note.
89          * @return the length of the note
90          */
91         public int getLength() {
92         
93         }
94 }