]> ruin.nu Git - moosique.git/commitdiff
*** empty log message ***
authorEinar Pehrson <einarp@itstud.chalmers.se>
Fri, 16 May 2003 13:34:36 +0000 (13:34 +0000)
committerEinar Pehrson <einarp@itstud.chalmers.se>
Fri, 16 May 2003 13:34:36 +0000 (13:34 +0000)
MooNote.java
MooNoteElement.java
MooTrackView.java
Moosique.java
To Do.txt
report.txt

index d401aa7de424e51250c95d5ae90b881c33370df8..cd71ffbc1f065e98c89616c849bc4a6610b157ca 100644 (file)
@@ -36,14 +36,13 @@ public class MooNote extends MidiEvent {
 
        /** 
         * Creates a MooNote of the given pitch, velocity and duration in the current track.
-        * @param track         the track to which the MooNote was added
         * @param channel       the channel of the note (1-16)
         * @param pitch         the pitch of the note (0-127)
         * @param velocity      the velocity of the note (0-127)
         * @param timestamp     the timestamp of the note in ticks (96 per beat)
         * @param duration      the duration of the note in ticks (96 per beat)
         */
-       public MooNote (int track, int channel, int pitch, int velocity, long timestamp, int duration) {
+       public MooNote (int channel, int pitch, int velocity, long timestamp, int duration) {
                super(new ShortMessage(), timestamp);
                noteOffEvent = new MidiEvent(new ShortMessage(), timestamp + duration);
                noteOnMsg = (ShortMessage)getMessage();
index 7488d1543d94a54a9a66099263d072767f0dad55..e93eb298ace082ede63be2c0dafd84936f407a08 100644 (file)
@@ -154,7 +154,7 @@ public class MooNoteElement extends JPanel {
        }
 
        protected void remove(){
-               mtv.remove(this);
+               mtv.removeNote(this, note);
        }
 
 }
index b06355430b125be17116ef370a5c26a761f55563..1a612e47eb01f7f748ed05e70d01cc88351b7be0 100644 (file)
@@ -66,7 +66,7 @@ public class MooTrackView extends JPanel {
                addKeyListener(new MooKeyboard());
        }
 
-       public void layoutElementMooNoteElement elem, boolean old){
+       public void layoutElement(MooNoteElement elem, boolean old){
                // If the element is currently in the view, removes its coordinates from the list.
                Rectangle r = new Rectangle();
                if (old){
@@ -101,7 +101,6 @@ public class MooTrackView extends JPanel {
                        viewLength = y + height;
                        if(old)setPreferredSize(new Dimension(VIEW_WIDTH, viewLength + extraHeight));
                }
-
        }
 
        public Track getTrack() {
@@ -169,8 +168,9 @@ public class MooTrackView extends JPanel {
                public void actionPerformed(ActionEvent e) {
                        Object source = e.getSource();
                        if  (source == popupAdd) {
-                               addNote(new MooNote());
+                               //addNote(new MooNote());
                                // int channel, int pitch, int velocity, long timestamp, int duration
+                       }
                }
        }
 }
\ No newline at end of file
index c51336423b7d8297a27032b0c32d834429b44e13..91cf4ff7ddc117a62e7109224e9c66add37ef474 100644 (file)
@@ -153,6 +153,7 @@ public class Moosique {
                try {
                        seq = new Sequence(Sequence.PPQ, DEFAULT_RESOLUTION, DEFAULT_TRACKS);
                        sequencer.setSequence(seq);
+                       emptyTracks = new ArrayList();
                } catch (InvalidMidiDataException e) {}
                // Sends sequence to GUI.
                if (gui != null) gui.setSequence(seq);
@@ -204,7 +205,8 @@ public class Moosique {
                                        // Puts the thread to sleep for as long as it takes
                                        // the sequencer to reach the next sixteenth.
                                        try {
-                                               sleep((long)((15000 / getTempo()) * (tickDiff / ticksPerSixteenth)));
+                                               //sleep((long)((15000 / getTempo()) * (tickDiff / ticksPerSixteenth)));
+                                               sleep (10);
                                        } catch (InterruptedException e) {
                                                Moosique.stop();
                                        }
@@ -425,45 +427,6 @@ public class Moosique {
                        }
                }
 
-       /*
-               Collections.sort(track[i].events, new Comparator() {
-                       public int compare(Object o1, Object o2) {
-                               return ((MidiEvent)o2).getTick() - ((MidiEvent)o1).getTick();
-                       }
-               });
-
-               // Searches the sequence for NoteOn events
-               MidiEvent noteOn, noteOff = null, nextEvent;
-               MidiMessage nextMsg;
-               ShortMessage shortMsg;
-
-               for (int i = 0; i < tracks.length; i++) {
-                       for (int j = 0; j < tracks[i].size(); j++) {
-                               noteOn = tracks[i].get(j);
-                               if (noteOn.getMessage().getStatus() == ShortMessage.NOTE_ON) {
-                                       // Finds the corresponding NoteOff event
-                                       for (int k = j + 1; k < tracks[i].size(); k++) {
-                                               nextEvent = tracks[i].get(k);
-                                               nextMsg = nextEvent.getMessage();
-                                               if (nextMsg instanceof ShortMessage) {
-                                                       shortMsg = (ShortMessage) nextMsg;
-                                                       if (shortMsg.getCommand() == ShortMessage.NOTE_OFF && shortMsg.getChannel() == ((ShortMessage)noteOn.getMessage()).getChannel() && shortMsg.getData1() == ((ShortMessage)noteOn.getMessage()).getData1()) {
-                                                               noteOff = nextEvent;
-                                                               break;
-                                                       }
-                                               }
-                                       }
-                                       // Replaces the NoteOn event with a MooNote, if possible with the corresponding NoteOff event
-                                       tracks[i].remove(noteOn);
-                                       if (noteOff != null) {
-                                               tracks[i].add(new MooNote(noteOn, noteOff));
-                                       } else {
-                                               tracks[i].add(new MooNote(noteOn));
-                                       }
-                               }
-                       }
-               }
-*/
                // Sends sequence to GUI and sequencer, then returns
                if (gui != null) gui.setSequence(seq);
                try {
index 1a6bc857398b10fc11ac702e351e43e7e2fe9f3a..b5984369394ffe6a565920385b39e2ab32df12fb 100644 (file)
--- a/To Do.txt
+++ b/To Do.txt
@@ -21,24 +21,14 @@ x 
 
 x Fixa InstrumentList.
 x Fixa så att toolbarens rutor sitter fast!
-x Visualisera inte tomma spår!
 x Räkna ut tempo och taktart. Skicka (på nåt sätt) tempovektorn till MooToolbar.
 x Gör en ruta för tempot i MooToolbar.
 x Gör en ruta för taktarten i MooViews övre vänstra hörn.
 x Implementera klart menyn, med alla dialoger.
+x Lägg till en tom panel i MooGUI för att fylla ut skärmen. Använd setBounds()
 
 x Highlighta noter som spelas? (Enligt kravspec.)
 
-\f
-MooNote / MooTrackView / MooNoteElement
-
-       * Hur lägga till MooNote och NoteOff?
-               Internt vid skapandet - Då behövs track         MooNote.addTo(Track track);
-                                                               MooNote.removeFrom(Track track);
-               Externt         new MooNote(...);
-                               ...add(MooNote);
-                               ...add(MooNote.getNoteOffEvent());
-
 \f
 MooNoteProp
        * Textfält som gör att man bara kan skriva in siffror?
index 3ea52d1eb7080d4aa6c28aa0457b2e035825ffa4..bbdb98baa8ed6fd18bc75f5157fcdfcef0e750ac 100644 (file)
@@ -58,13 +58,15 @@ x MooKeyboard               A keyboard listener emulating a synthesizer.
 One class, MooStatus, was also removed. It was reduced to a JLabel with a single method and was therefore merged inte the main GUI class.
 ------------------------------
 2.7 Problems
-Of all the problems we have come across in our work with Moosique, only one has persisted and is yet unresolved. As always when working with Java, we were aware that the visualisation performance leaves more to be desired. But we did not expect the extremely low performance the program displayed. During playback, a thread updates the view port of the main scroll pane (MooView). However, the update delay on low-end hardware exceeds one second. This obviously makes the GUI unresponsive, but also affects synthesizer playback performance. In order for the application to work properly, this delay must at the very least fall below the time it takes the synthesizer to play a sixteenth note. In a sequence of standard tempo, 120 beats per minute, this would mean 1/8 of a second.
+Of all the problems we have come across in our work with Moosique, only one persisted and was until very recently unresolved. As always when working with Java, we were aware that the visualisation performance leaves more to be desired. But we did not expect the extremely low performance the program displayed. During playback, a thread updates the view port of the main scroll pane (MooView). However, the update delay on low-end hardware exceeded one second. This obviously made the GUI unresponsive, but also affected synthesizer playback performance. In order for the application to work properly, this delay must at the very least fall below the time it takes the synthesizer to play a sixteenth note. In a sequence of standard tempo, 120 beats per minute, this would mean 1/8 of a second.
 
-This problem is especially unfortunate since it was the only performance aspect that was mentioned in the requirements specification.
+This problem was especially unfortunate since it was the only performance aspect that was mentioned in the requirements specification.
 
 [Ändra font och dra ner textstorlek, citat juh!]
 "Delays during execution should be minimized, but are allowed when loading files. Playback should be smooth and delays should not change the beat or tempo."
 
+However, as we recently discovered, 
+
 The major changes and that not enough work design of the graphical classes resulted in that the different graphical classes couldn't be implemented on their own. Instead changes often had to take place in many different classes when some feature was added. This made the implementation slow, especially in the beginning, since there where many different ideas on how things should be implemented. This got better through time though, when the basic foundation was implemented it got easier to add the rest of the features.
 ------------------------------
 3. Conclusions