statusBar.setBackground(bgColor);
view.setBackground(bgColor);
+ ActionMap am = getRootPane().getActionMap();
+
+ Action playAction = new AbstractAction() {
+ public void actionPerformed(ActionEvent ae) {
+ Moosique.resumepause();
+ }};
+ am.put("play", playAction);
+
+ InputMap im = getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ KeyStroke playKey = KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0);
+ im.put(playKey, "play");
+
+
// Configures window.
addWindowListener(new MooGUICloser());
pack();
comps[i].setBackground(bgColor);
}
}
-
+
/**
* Changes the sequence of the GUI.
* @param sequence the MIDI sequence to visualize
// Calls on the toolbar to update the progress indicator.
//toolbar.updateProgInd();
}
-
+
class MooGUICloser extends WindowAdapter {
public void windowClosing(WindowEvent e) {
Moosique.quit();
private static String filename, fileArg;
private static long position;
private static boolean makeGUI = true;
+ private static boolean playing = false;
/**
* Starts the application.
* Starts playback of the current sequence.
*/
public static void play() {
+ playing = true;
sequencer.setTickPosition(position);
sequencer.start();
}
* Pauses playback of the current sequence.
*/
public static void pause() {
+ playing = false;
sequencer.stop();
}
* Resumes playback of the current sequence.
*/
public static void resume() {
+ playing = true;
sequencer.start();
}
* Stops playback of the current sequence.
*/
public static void stop() {
+ playing = false;
sequencer.stop();
sequencer.setTickPosition(position);
}
+ /**
+ * Pauses if playing and resumes if stopped.
+ */
+ public static void resumepause()
+ {
+ if (playing)
+ pause();
+ else
+ resume();
+ }
+
/**
* Rewinds the current sequence the given number of measures.
* @param measures the number of measures to rewind
if (synthesizer.isOpen()) synthesizer.close();
System.exit(0);
}
-}
\ No newline at end of file
+}
InputMap im = rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
KeyStroke helpKey = KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0);
im.put(helpKey, "help");
+
* Globala kommandon
Mappa F9-F12 till MooKeyboard.setOctave(n) där n = {2, 4, 6, 8}
* Play / Stop
- Mappa till blanksteg.
+ Mappa till blanksteg. <-- Detta fungerar inte.. blanksteget
+ används av vår toolbar.
\f
Moosique