From 83ec11f99e143607d057db2a68c262ca9672e524 Mon Sep 17 00:00:00 2001 From: Einar Pehrson Date: Fri, 16 May 2003 00:19:35 +0000 Subject: [PATCH] Updated the project report, cleaned up the todo list, printed out update delays, fixed menu shortcuts, added global shortcuts and changed MooViewCounter constructor --- MooGUI.java | 22 ++++++++- MooInstrumentList.java | 3 +- MooKeyboard.java | 2 +- MooMenu.java | 80 +++++++++++-------------------- MooToolbar.java | 4 +- MooView.java | 2 +- MooViewCounter.java | 10 ++-- Moosique.java | 15 ++++-- To Do.txt | 103 +++++++++++---------------------------- report.txt | 106 ++++++++++++++++++++++++----------------- 10 files changed, 160 insertions(+), 187 deletions(-) diff --git a/MooGUI.java b/MooGUI.java index b1bbf0d..71b1493 100644 --- a/MooGUI.java +++ b/MooGUI.java @@ -61,7 +61,7 @@ public class MooGUI extends JFrame { // Creates timer. timer = new java.util.Timer(); - // Sets up global key listener + // Sets up global key listener. ActionMap am = getRootPane().getActionMap(); Action playAction = new AbstractAction() { @@ -73,10 +73,22 @@ public class MooGUI extends JFrame { } }}; am.put("Play", playAction); + am.put("Octave change 2", createOctaveAction(2)); + am.put("Octave change 4", createOctaveAction(4)); + am.put("Octave change 6", createOctaveAction(6)); + am.put("Octave change 8", createOctaveAction(8)); InputMap im = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); KeyStroke playKey = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0); + KeyStroke octave2Key = KeyStroke.getKeyStroke(KeyEvent.VK_F9, 0); + KeyStroke octave4Key = KeyStroke.getKeyStroke(KeyEvent.VK_F10, 0); + KeyStroke octave6Key = KeyStroke.getKeyStroke(KeyEvent.VK_F11, 0); + KeyStroke octave8Key = KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0); im.put(playKey, "Play"); + im.put(octave2Key, "Octave change 2"); + im.put(octave4Key, "Octave change 4"); + im.put(octave6Key, "Octave change 6"); + im.put(octave8Key, "Octave change 8"); // Configures window. addWindowListener(new MooGUICloser()); @@ -127,6 +139,14 @@ public class MooGUI extends JFrame { toolbar.updateProgInd(tickPosition); } + private Action createOctaveAction(final int octave) { + Action octaveAction = new AbstractAction() { + public void actionPerformed(ActionEvent ae) { + MooKeyboard.setOctave(octave); + }}; + return octaveAction; + } + class MooGUICloser extends WindowAdapter { public void windowClosing(WindowEvent e) { Moosique.quit(); diff --git a/MooInstrumentList.java b/MooInstrumentList.java index ed976dd..1b33782 100644 --- a/MooInstrumentList.java +++ b/MooInstrumentList.java @@ -12,6 +12,7 @@ import java.awt.event.*; public class MooInstrumentList extends JComboBox implements ActionListener { protected int channel; + public MooInstrumentList(int chan) { super(instruments); setChannel(chan); @@ -19,7 +20,7 @@ public class MooInstrumentList extends JComboBox implements ActionListener { addActionListener(this); } - public void setChannel(int chan){ + public void setChannel(int chan) { channel = chan; setSelectedIndex(Moosique.getChannel(channel).getProgram()); } diff --git a/MooKeyboard.java b/MooKeyboard.java index 90ed18f..11f45fc 100644 --- a/MooKeyboard.java +++ b/MooKeyboard.java @@ -47,7 +47,7 @@ public class MooKeyboard extends KeyAdapter { * Sets the octave of the lower part of the keyboard (default = 4) * @param n the octave to start at */ - public void setOctave(int n) { + public static void setOctave(int n) { startNote = n * 12; } diff --git a/MooMenu.java b/MooMenu.java index 8d1caea..ca97329 100644 --- a/MooMenu.java +++ b/MooMenu.java @@ -23,37 +23,37 @@ public class MooMenu extends JMenuBar implements ActionListener { file = createMenu("File", KeyEvent.VK_F); add(file); - addItem(file, "New", KeyEvent.VK_N); - addItem(file, "Open...", KeyEvent.VK_O); - addItem(file, "Save", KeyEvent.VK_S); + addItem(file, "New", KeyEvent.VK_N, ActionEvent.CTRL_MASK); + addItem(file, "Open...", KeyEvent.VK_O, ActionEvent.CTRL_MASK); + addItem(file, "Save", KeyEvent.VK_S, ActionEvent.CTRL_MASK); addItem(file, "Save as..."); - addItem(file, "Exit", KeyEvent.VK_Q); + addItem(file, "Exit", KeyEvent.VK_Q, ActionEvent.CTRL_MASK); edit = createMenu("Edit", KeyEvent.VK_E); add(edit); - addItem(edit, "Copy", KeyEvent.VK_C); - addItem(edit, "Cut", KeyEvent.VK_X); - addItem(edit, "Paste", KeyEvent.VK_V); - addItem(edit, "Select all", KeyEvent.VK_E); - addItem(edit, "Invert selection", KeyEvent.VK_I); - addItem(edit, "Preferences...", KeyEvent.VK_P); + addItem(edit, "Copy", KeyEvent.VK_C, ActionEvent.CTRL_MASK); + addItem(edit, "Cut", KeyEvent.VK_X, ActionEvent.CTRL_MASK); + addItem(edit, "Paste", KeyEvent.VK_V, ActionEvent.CTRL_MASK); + addItem(edit, "Select all", KeyEvent.VK_E, ActionEvent.CTRL_MASK); + addItem(edit, "Invert selection", KeyEvent.VK_I, ActionEvent.CTRL_MASK); + addItem(edit, "Preferences...", KeyEvent.VK_P, ActionEvent.CTRL_MASK); playback = createMenu("Playback", KeyEvent.VK_P); add(playback); - addItem(playback, "Play", KeyEvent.VK_SPACE); - addItem(playback, "Pause"); - addItem(playback, "Stop"); + addItem(playback, "Play", "F5"); + addItem(playback, "Pause", "F7"); + addItem(playback, "Stop", "F6"); addItem(playback, "Jump..."); music = createMenu("Music", KeyEvent.VK_M); add(music); - addItem(music, "Add track...", KeyEvent.VK_A); - addItem(music, "Delete track...", KeyEvent.VK_D); - addItem(music, "Copy track...", KeyEvent.VK_Y); - addItem(music, "Move track...", KeyEvent.VK_M); + addItem(music, "Add track...", KeyEvent.VK_A, ActionEvent.CTRL_MASK); + addItem(music, "Delete track...", KeyEvent.VK_D, ActionEvent.CTRL_MASK); + addItem(music, "Copy track...", KeyEvent.VK_Y, ActionEvent.CTRL_MASK); + addItem(music, "Move track...", KeyEvent.VK_M, ActionEvent.CTRL_MASK); addItem(music, "Insert measure..."); addItem(music, "Delete measure..."); addItem(music, "Set time signature..."); @@ -64,29 +64,17 @@ public class MooMenu extends JMenuBar implements ActionListener { help = createMenu("Help", KeyEvent.VK_L); add(help); - addItem(help, "Contents"); + addItem(help, "Contents", "F1"); addItem(help, "Getting started"); addItem(help, "About"); } - /** - * creates a menu for the menubar - * @param name the name of the menu - * @param mnemonic the shortcut to activate the menu - * @return menu the menu to be added to the menubar - */ private JMenu createMenu(String name, int mnemonic) { JMenu menu = new JMenu(name); menu.setMnemonic(mnemonic); return menu; } - /** - * Creates a menu item. - * @param menu the menu to which the item is being added to - * @param name the name of this menuitem - * @return item the item to add to the menu - */ private JMenuItem addItem(JMenu menu, String name) { JMenuItem item = new JMenuItem(name); item.addActionListener(this); @@ -94,34 +82,22 @@ public class MooMenu extends JMenuBar implements ActionListener { return item; } - /** - * Creates a menu item with a keyboard accelerator. - * @param menu the menu to which the item is being added to - * @param name the name of this menuitem - * @param key the shortcut to activate the command - * @return item the item to add to the menu - */ - private JMenuItem addItem(JMenu menu, String name, int key) { + private JMenuItem addItem(JMenu menu, String name, String key) { JMenuItem item = new JMenuItem(name); - item.setAccelerator(KeyStroke.getKeyStroke(key, ActionEvent.CTRL_MASK)); + item.setAccelerator(KeyStroke.getKeyStroke(key)); + item.addActionListener(this); + menu.add(item); + return item; + } + + private JMenuItem addItem(JMenu menu, String name, int key, int mask) { + JMenuItem item = new JMenuItem(name); + item.setAccelerator(KeyStroke.getKeyStroke(key, mask)); item.addActionListener(this); menu.add(item); return item; } - /** - * creates a JDialog popupmenu, containing diffrent choices - * @param title the title of the dialog - * @return trackframe the JDialog....ffaaaaaaaaaaaaaaaan! - */ - //private JDialog makeDialog(String title){ - // - //} - /** - * checks if the fileformat is compatible with our program - * @param f the file to check - * @return true or false - */ private boolean isMidiFile(File f) { if(f != null) { String extension = f.getName().substring(f.getName().lastIndexOf('.') + 1).toLowerCase().trim(); diff --git a/MooToolbar.java b/MooToolbar.java index 9852c6a..a94aabd 100644 --- a/MooToolbar.java +++ b/MooToolbar.java @@ -149,7 +149,7 @@ public class MooToolbar extends JToolBar { Moosique.stop(); } } else if (e.getSource() instanceof JLabel) { - long position = Moosique.getPosition(); + long position = Moosique.getEditPosition(); if (e.getSource().equals(measuresValue)) { if (SwingUtilities.isRightMouseButton(e)) { position += beatsPerMeasure * ticksPerBeat; @@ -169,7 +169,7 @@ public class MooToolbar extends JToolBar { position -= 1; } } - Moosique.setPosition(position); + Moosique.setEditPosition(position); Moosique.getGUI().update(position); } } diff --git a/MooView.java b/MooView.java index 1d15f2c..5e25e02 100644 --- a/MooView.java +++ b/MooView.java @@ -30,7 +30,7 @@ public class MooView extends JScrollPane { columnHeader.setView(titlePanel); setColumnHeaderView(columnHeader); - viewCounter = new MooViewCounter(4, 4); + viewCounter = new MooViewCounter(null); JViewport rowHeader = new JViewport(); rowHeader.setView(viewCounter); setRowHeaderView(rowHeader); diff --git a/MooViewCounter.java b/MooViewCounter.java index 5417721..8383b6c 100644 --- a/MooViewCounter.java +++ b/MooViewCounter.java @@ -1,8 +1,9 @@ +import javax.sound.midi.*; import javax.swing.*; import java.awt.*; /** - * + * A graphical representation of the time signature of the current sequence. * * @author Andersson, Andreen, Lanneskog, Pehrson * @version 1 @@ -17,7 +18,8 @@ public class MooViewCounter extends JPanel { * Creates an musical ruler depending on the timesignature */ - public MooViewCounter (int timeSig1, int timeSig2) { + public MooViewCounter (MetaMessage[] timeSigs) { + int timeSig1 = 4, timeSig2 = 4; // ...for now setBackground(Moosique.getGUI().bgColor); setPreferredSize(new Dimension(35, 200 * CELL_HEIGHT)); @@ -46,11 +48,9 @@ public class MooViewCounter extends JPanel { } public void paintComponent(Graphics g) { super.paintComponent(g); - setBackground(Color.black); - if (!(g instanceof Graphics2D)) return; Graphics2D g2 = (Graphics2D)g; - g2.setColor(Color.white); + g2.setColor(Color.black); for (int c = 0; c < 200; c++) { g2.drawLine(0, c * CELL_HEIGHT, 5, c * CELL_HEIGHT); // 1/16 g2.drawLine(0, c * CELL_HEIGHT * halfBeat, 10, c * CELL_HEIGHT * halfBeat); // 1/8 diff --git a/Moosique.java b/Moosique.java index 795772f..89669d3 100644 --- a/Moosique.java +++ b/Moosique.java @@ -185,17 +185,24 @@ public class Moosique { // Disables input to volatile components // gui.disable(); - // Creates the visualization thread and starts it. + System.out.println("Ticks/16: " + seq.getResolution()/4); + + // Creates the visualisation thread and starts it. player = new Thread () { public void run() { + long position = sequencer.getTickPosition(); while(sequencer.isRunning()) { + long pos = sequencer.getTickPosition(); + System.out.print(" ... " + (pos - position)); + position = pos; + // Updates the GUI with the current tick position. gui.update(sequencer.getTickPosition()); // Puts the thread to sleep for as long as it takes // the sequencer to reach the next sixteenth. try { - sleep((long)((1000 * 60 * 1) / (getTempo() * 4))); + sleep((long)(15000 / getTempo())); } catch (InterruptedException e) { Moosique.stop(); } @@ -222,7 +229,7 @@ public class Moosique { * Returns the current editing position of the sequencer. * @return the tick position */ - public static long getPosition() { + public static long getEditPosition() { return editPosition; } @@ -230,7 +237,7 @@ public class Moosique { * Sets the current editing position of the sequencer. * @param ticks the tick position */ - public static void setPosition(long ticks) { + public static void setEditPosition(long ticks) { editPosition = ticks; } diff --git a/To Do.txt b/To Do.txt index 04f5004..7f23fee 100644 --- a/To Do.txt +++ b/To Do.txt @@ -1,95 +1,48 @@ -FÖRDELNING +Diverse -Einar: Moosique(4), MooNote(4) -Micke: MooGUI(4), MooTrackTitle(2), MooNoteElement(6), MooNoteProp(4) -Björn: MooMenu(8), MooToolbar(3), MooViewCounter(1) -Rolle: MooTrackView(16) +x VIKTIGT!!! HUR LÄGGA TILL NOTER?!? - -VIKTIGT! Implementera playfunktionens beteende. - När låten är slut återställes play-knappen. - Göra detta som en tråd?!? +x Varför funkar inte lyssnarna på MooTrackView?!? - -x Får Moosique vara statisk? Fult? x Spara konfiguration? Arbetskatalog Fem senast öppnade filerna Valda MIDI-enheter - -MooNote / MootrackView / MooNoteElement - - * Hur lägga till MooNote och NoteOff? - Internt vid skapandet - Då behövs track - Externt new MooNote(...); - ...add(MooNote); - ...add(MooNote.getNoteOffEvent()); - - MooNote.addTo(Track track); - MooNote.removeFrom(Track track); - - * set/getDuration verkar inte fungera. - - -MooTrackTitle - - * Fixa InstrumentList. - - -MooGUI - - * Global KeyListener - Görs uppenbarligen så här: - - JFrame someFrame = new JFrame(); - - JComponent rootPane = someFrame.getRootPane(); - ActionMap am = rootPane.getActionMap(); - - Action helpAction = new AbstractAction() { - public void actionPerformed(ActionEvent ae) { - showHelpWindow(); - }}; - am.put("help", helpAction); - - InputMap im = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); - KeyStroke helpKey = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0); - im.put(helpKey, "help"); +x Integrera MooViewCounter i MooTrackView genom att istället variera de horisontella streckens gråa nyanser?!? + (Omöjligt att följa strecken till högra änden av skärmen.) - - * Globala kommandon - - * Oktavförändring i MooKeyboard - Mappa F9-F12 till MooKeyboard.setOctave(n) där n = {2, 4, 6, 8} - - * Play / Stop - Mappa till blanksteg. <-- Detta fungerar inte.. blanksteget - används av vår toolbar. +x Ändra längden på MooNoteElement (JPanel). + Känn av klick på panelens gräns, MouseMotionListener känner av när ny ruta nås. + void mouseDragged(MouseEvent) + Called in response to the user moving the mouse while holding a mouse button down. + This event is fired by the component that fired the most recent mouse-pressed event, + even if the cursor is no longer over that component. - -Moosique +x Fixa InstrumentList. +x Fixa så att toolbarens rutor sitter fast! +x Visualisera inte tomma spår! +x Räkna ut tempo och taktart. +x Gör en ruta för tempot i Toolbar. +x Gör en ruta för taktarten i MooViews övre vänstra hörn. +x Implementera klart menyn, med alla dialoger. - * getPosition och setPosition - kvar? +x Highlighta noter som spelas? (Enligt kravspec.) -Skräp +MooNote / MooTrackView / MooNoteElement - // Prints the number of notes in each track - int count; - Track[] tracks = seq.getTracks(); - for (int k = 0; k < tracks.length; k++) { - count = 0; - for (int j = 0; j < tracks[k].size(); j++) { - if (tracks[k].get(j) instanceof MooNote) count++; - } - System.out.println("Track " + k + ": " + count + " notes."); - } + * 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()); MooNoteProp - * textfält som gör att man bara kan skriva in siffror? + * Textfält som gör att man bara kan skriva in siffror? - + \ No newline at end of file diff --git a/report.txt b/report.txt index 43f3591..ca83829 100644 --- a/report.txt +++ b/report.txt @@ -1,64 +1,80 @@ -Foreword (optional) - -OBS! [...] = Hjälp till om ni kan och lägg in text - -1. Introduction - -The purpose of our project was to design and construct a composer's tool for the MIDI interface. The program was to be used for composing and sequencing MIDI songs from scratch, as well as for playback and visualization of existing MIDI files. We chose this project for two reasons. Firstly, none of us had previous experience of working with music in the Java language, so the task of developing an application using an API with which we had no previous experience was challenging. Secondly, we are all very interested in music. One of the developers is also an experienced MIDI composer. +Foreword (optional) + +OBS! [...] = Hjälp till om ni kan och lägg in text + +1. Introduction + +The purpose of our project was to design and construct a composer's tool for the MIDI interface. The program was to be used for composing and sequencing MIDI songs from scratch, as well as for playback and visualisation of existing MIDI files. We chose this project for two reasons. Firstly, none of us had previous experience of working with music in the Java language, so the task of developing an application using an API with which we had no previous experience was challenging. Secondly, we are all very interested in music. One of the developers is also an experienced MIDI composer. The MIDI application we were going to develop was at an early stage given the name Moosique - a name obviously derived from the word music, but with a touch of moose. - -2. Analysis ------------------------------ -2.1 The Java MIDI Package -Our first step was to look at the Java MIDI package (javax.sound.midi), and to try to find out what limitations the package had. As previously stated, none of us was familiar with the package and we all wanted to get an overview before we started working on the design document. And it didn't take long to realize that the functionality and structure of our application were largely dictated by the possibilities provided by the MIDI package. We also looked at software that supported MIDI to get an idea of which features our application might have. ------------------------------ -2.2 Design Document -One of the first design decisions that was made was to divide the program into two major parts. The main part, the classes providing the actual features of the program, included four functional classes. The executable class, the only one containing a main method, was given the same name as the program - Moosique. - -In a hierarchy below the Moosique class, we placed three classes that represented the different parts of a MIDI file: + +2. Analysis +----------------------------- +2.1 The Java MIDI Package +Our first step was to look at the Java MIDI package (javax.sound.midi), and to try to find out what limitations the package had. As previously stated, none of us was familiar with the package and we all wanted to get an overview before we started working on the design document. And it didn't take long to realize that the functionality and structure of our application were largely dictated by the possibilities provided by the MIDI package. We also looked at software that supported MIDI to get an idea of which features our application might have. +----------------------------- +2.2 Design Document +One of the first design decisions that was made was to divide the program into two major parts. The main part, the classes providing the actual features of the program, included four functional classes. The executable class, the only one containing a main method, was given the same name as the program - Moosique. + +In a hierarchy below the Moosique class, we placed three classes that represented the different parts of a MIDI file: x MooSequence The functional representation of a MIDI sequence. Was to extend Java's Sequence class. x MooTrack The functional representation of a MIDI track. Was to extend Java's Track class. x MooNote The functional representation of a MIDI note. Was to encompass the two MIDI events that constitute a note: NoteOn and NoteOff. -The second part of the program was the graphical user interface, including all the graphical classes. The main class of the interface was named MooGUI. Since we had decided to use Swing in building the interface, this class was naturally to extend JFrame. Here, all other GUI components were to be created. Most of these components - maintaining different kinds of data, having listeners and requiring different methods for update their content - were to be quite complex, and were therefore given their own classes. Among these are graphical classes that construct the menu, the toolbar and the view of the MIDI tracks. All these classes [...]. +The second part of the program was the graphical user interface, including all the graphical classes. The main class of the interface was named MooGUI. Since we had decided to use Swing in building the interface, this class was naturally to extend JFrame. Here, all other GUI components were to be created. Most of these components - maintaining different kinds of data, having listeners and requiring different methods for update their content - were to be quite complex, and were therefore given their own classes. Among these are graphical classes that construct the menu, the toolbar and the view of the MIDI tracks. All these classes [...]. + +Apart from the strictly graphical classes we decided to make a graphical representation of the functional classes, this to get an better overview of our work [...]. MooView (a graphical representation of MooSequence), MooTrackView and MooTrackTitle (MooTrack), and MooNoteElement (MooNote). Supporting these components, some other graphical classes were needed: MooViewCounter, representing a ruler that visualises the time signature of the MIDI file; MooTrackTitle, handling the properties of a track; and MooNoteElement, supplying a way of editing the properties of a note. + +We put the application's design document together very quickly, perhaps a bit too quickly. We were not entirely certain of how the Java MIDI package worked. As our work with the project progressed, we were forced to reevaluate some of these design decisions and change the system design (see section [Major Decissions]). On the other hand, our interface design has barely needed any changes. +------------------------------ +2.3 Time Schedule +Before we started implementing the classes, we made a time schedule for each class and divided the classes between us. Later on, we realized that for some classes this time schedule was overly optimistic. As a consequence of these misconceptions, some of the classes were not implemented until the very last stages of the project. -Apart from the strictly graphical classes we decided to make a graphical representation of the functional classes, this to get an better overview of our work [...]. MooView (a graphical representation of MooSequence), MooTrackView and MooTrackTitle (MooTrack), and MooNoteElement (MooNote). Supporting these components, some other graphical classes were needed: MooViewCounter, representing a ruler that visualizes the time signature of the MIDI file; MooTrackTitle, handling the properties of a track; and MooNoteElement, supplying a way of editing the properties of a note. +The schedule that was made initially reflected the time required to implement the functionality of which we then knew. However, as time went on, the complexity of building this type of application became apparent and all our time estimates were by far exceeded. Also, many minor details were changed or for other reasons reimplemented, which of course took a lot of time. +------------------------------ +2.4 Implemention +As we earlier realized, some implementation of the functional classes was required to see what features the graphical representations would need. [...] -We design the structure of the application very quickly, perhaps to quickly. We were not entirely certain of how the Java MIDI package worked. As our work with the project progressed, we were forced to reevaluate some of these design decisions and change the system design (see section [Major Decissions]). ------------------------------- -2.3 Time Schedule -Before we started implement the classes, we made an time-schedule for each class, and divided the classes between us. Later we realeased that for a few classes this time-schedule were very optimistic. The consequences of a misleading time-schedule were that some classes was not implemented before a very long time in the project. ------------------------------- -2.4 Implemention -As we earlier realised we needed to implement the functional classes first. This to see what references the graphical representation might call. [...] - Strictly graphical classes [...] ------------------------------- -2.5 Testing ------------------------------- -2.6 Major Decisions +Strictly graphical classes [...] +------------------------------ +2.5 Testing +Är det nån som har testat nåt dårå?!? +------------------------------ +2.6 Major Decisions 2.6.1 Removing some of the functional classes -Initially, the idea behind the functional classes - MooSequence, MooTrack and MooNote - was that they would extend the classes provided by the Java MIDI API and provide additional functionality for simplifying data manipulation. Soon however, it was discovered that this was not possible because of the methods related to these classes in the API. It was then decided that these classes would imitate the data hierarchy of the MIDI file, as the Java classes do, but provide their own implementations. When the edited sequence was to be sent to the synthesizer for playback, the data would be assembled and inserted into the Java classes. At a later stage, this design was also scrapped, the reason being that creating and maintaining such a data structure would require more code than using the somewhat limited methods of the API. MooSequence and MooTrack was therefore removed. +Initially, the idea behind the functional classes - MooSequence, MooTrack and MooNote - was that they would extend the classes provided by the Java MIDI API and provide additional functionality for simplifying data manipulation. Soon however, it was discovered that this was not possible because of the methods related to these classes in the API. It was then decided that these classes would imitate the data hierarchy of the MIDI file, as the Java classes do, but provide their own implementations. When the edited sequence was to be sent to the synthesizer for playback, the data would be assembled and inserted into the Java classes. At a later stage, this design was also scrapped, the reason being that creating and maintaining such a data structure would require more code than using the somewhat limited methods of the API. MooSequence and MooTrack was therefore removed. -[...] ------------------------------- -2.7 Problems -[...] ------------------------------- -3. Conclusions +2.6.2 Adding and removing some of the GUI classes +As this was the first time for all of us in designing an application before implementation, we were not able to predict exactly which classes would be required. During the course of the project, the following classes were added: +x MooDialog A dialog generator class for all the application's dialogs. +x MooInstrumentList A combo box with the 128 General MIDI instruments. +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. +This problem is especially unfortunate since it was the only performance aspect that was mentioned in the requirements specification. -4. References +[Ä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." +------------------------------ +3. Conclusions +During the course of this project, the importance of extensive system design has become clear to us. With no prior experience in writing such documents or with working with the API in question, designing every aspect of our application would have been nearly impossible without at least approaching the implementation phase. In the future, our proficiency in this field will hopefully improve drastically, and we will be able to save a lot of implementation time by writing more complete design documentation. + +------------------------------ +4. References LITTERATURE Sun Microsystems Inc. (2002) Java Sound API Programmer's Guide [http://java.sun.com/j2se/1.4.1/docs/guide/sound/programmer_guide/] -Horstmann, Cay (2003) Computing Concepts with Java Essentials (3rd Edition), New York: John Wiley & Sons Inc. ISBN: 0-471-24371-x -Jia, Xiao-Ping (2000) Object-Oriented Software Development Using Java, Addison and Wesley Longman, Inc, ISBN: 0-201-35084-X -MCConell, Steve (1993) Code Complete, Redmond: Microsoft Press, ISBN: 1-55615-484-4 +Horstmann, Cay (2003) Computing Concepts with Java Essentials (3rd Edition), New York: John Wiley & Sons Inc. +Jia, Xiao-Ping +Code Complete APPLICATIONS -FastTracker II -MidiSoft Recording Session -CakeWalk 5 +FastTracker II +MidiSoft Recording Session +CakeWalk 5 Cubase SX 1.0 -- 2.39.2