The setSequence method of the Sequencer class dereferences the sequence loaded into the sequencer.
Therefore, setSequence(seq) must be called on play. IDIOTIQUE!!!
super("Moosique");
this.seq = seq;
+ advanceStatus();
Container pane = getContentPane();
pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));
// Adds menu bar.
menu = new MooMenu();
setJMenuBar(menu);
+ advanceStatus();
// Adds toolbar.
toolbar = new MooToolbar();
pane.add(toolbar, BorderLayout.NORTH);
+ advanceStatus();
// Adds main view.
view = new MooView(seq.getTracks());
im.put(octave4Key, "Octave change 4");
im.put(octave6Key, "Octave change 6");
im.put(octave8Key, "Octave change 8");
+ advanceStatus();
// Configures window.
addWindowListener(new MooGUICloser());
Dimension bounds = Toolkit.getDefaultToolkit().getScreenSize();
setSize(bounds.width,bounds.height - 40);
setLocation(0, 0);
- // setResizable(false);
setBackground(Color.white);
+ advanceStatus();
setVisible(true);
show();
}
return octaveAction;
}
+ private void advanceStatus() {
+ System.out.print(".");
+ }
+
/**
* Listener for closing the program
*/
try {
noteOnMsg.setMessage(ShortMessage.NOTE_ON, channel, pitch, velocity);
noteOffMsg.setMessage(ShortMessage.NOTE_OFF, channel, pitch, 0);
- } catch (InvalidMidiDataException e) {}
+ } catch (InvalidMidiDataException e) {System.out.println("Invalid data!");}
}
/**
*/
private void addStandardNote() {
long timestamp = (long)(ticksPerSixteenth * (popupY - insets.top) / NOTE_HEIGHT);
- System.out.println(ticksPerSixteenth + ", " + popupY + ", " + insets.top + ", " + timestamp);
addNote(new MooNote(title.getChannel(), 60, 100, timestamp, Moosique.getSequence().getResolution() / 4));
}
progressDialog.pack();
progressDialog.setLocation((Toolkit.getDefaultToolkit().getScreenSize().width - progressDialog.getWidth()) / 2, (Toolkit.getDefaultToolkit().getScreenSize().height - progressDialog.getHeight()) / 2);
progressDialog.setVisible(true);
- } else System.out.println("Creating track views");
-
+ }
+
// Starts filling the track panel with track views, while updating the progress bar.
GridLayout gL = new GridLayout(1,numberOfTracks);
trackPanel.setLayout(gL);
}
}
if (showProgress) progressDialog.dispose();
- else System.out.print("Done");
}
/* JPanel filler = new JPanel();
int totalViewLength = trackPanel.getComponents().length * MooTrackView.VIEW_WIDTH;
// Builds GUI, unless n-flag is set.
if (makeGUI) {
- System.out.print("Building GUI...");
+ System.out.print("Building GUI.");
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
*/
public static void resume() {
gui.update(0);
+ try {
+ sequencer.setSequence(seq);
+ } catch (InvalidMidiDataException e) {}
sequencer.start();
// Disables input to volatile components
Collections.sort(noteOns, c);
Collections.sort(noteOffs, c);
- // For each NoteOn event, finds its NoteOff event and replaces it with a MooNote.
+ // Replaces each NoteOn event it with a MooNote containing a reference to the NoteOff event.
Iterator iOn = noteOns.iterator(), iOff;
MidiEvent on, off = null, nextOff;
ShortMessage onMsg, nextOffMsg;
iOn.remove();
}
}
-
// Sends sequence to GUI and sequencer, then returns
if (gui != null) gui.setSequence(seq);
try {
However, as we recently discovered, the Sun developers were also aware of this issue and, in trying to find a remedy for it, implemented some additional methods for controlling the viewport's visualisation during scrolling. This allowed us to reduce the time lag to a fraction.
+Another issue, that could be resolved only through trial-and-error, was the application's interaction with the setSequence method of the Sequencer class. The method employs, as opposed to what is customary in Java, dereferencing of its argument. This means that the MIDI sequence passed to the method is somehow cloned before it is sent to the sequencer, and therefore when the data of the sequence is updated, the changes are not reflected in the sequence currently loaded into the sequencer. In the Programmer's Guide, this method is described as "[tying] together an existing Sequence with the Sequencer, which is somewhat analogous to loading a tape onto a tape recorder". However, the actual implementation of the method (which may be vendor specific) does not work that way, since the "tape recorder" reads the contents of the "tape", but then does not respond to any changes in the "tape" unless the tape is reinserted. This incomprehensible implementation, which is not even hinted at in the API or the Programmer's Guide, didn't cause us a lot of extra work (since we could not understand where the problem was), but postponed a vital step in our implementation to the very last stage of the project.
+
During our project some time has also been wasted when wrestling with Java Swing components showing up at the wrong position whith the wrong size. No matter how much we studied the API we could not find the answer of this problem. In the end we found out that rebooting our FreeBSD machines was the only cure to this problem. We suspect there is some kind of bug, either in the FreeBSD OS, or the windomaker application we use. After all, we never ran into this problem those rare times we were working on a Windows-platform
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.