[Japi-cvs] SF.net SVN: japi:[1396] progs/jirus/trunk/src/prj
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2009-10-26 06:00:00
|
Revision: 1396 http://japi.svn.sourceforge.net/japi/?rev=1396&view=rev Author: christianhujer Date: 2009-10-26 05:59:53 +0000 (Mon, 26 Oct 2009) Log Message: ----------- Add a control for Virus TI (unfinished). Modified Paths: -------------- progs/jirus/trunk/src/prj/net/sf/jirus/Jirus.java progs/jirus/trunk/src/prj/net/sf/jirus/MyReceiver.java Added Paths: ----------- progs/jirus/trunk/src/prj/META-INF/ progs/jirus/trunk/src/prj/META-INF/services/ progs/jirus/trunk/src/prj/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider progs/jirus/trunk/src/prj/net/sf/jirus/JirusControl.java progs/jirus/trunk/src/prj/net/sf/jirus/JirusControlProvider.java Added: progs/jirus/trunk/src/prj/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider =================================================================== --- progs/jirus/trunk/src/prj/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider (rev 0) +++ progs/jirus/trunk/src/prj/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider 2009-10-26 05:59:53 UTC (rev 1396) @@ -0,0 +1 @@ +net.sf.jirus.JirusControlProvider Property changes on: progs/jirus/trunk/src/prj/META-INF/services/javax.sound.midi.spi.MidiDeviceProvider ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: progs/jirus/trunk/src/prj/net/sf/jirus/Jirus.java =================================================================== --- progs/jirus/trunk/src/prj/net/sf/jirus/Jirus.java 2009-10-26 05:56:43 UTC (rev 1395) +++ progs/jirus/trunk/src/prj/net/sf/jirus/Jirus.java 2009-10-26 05:59:53 UTC (rev 1396) @@ -23,6 +23,7 @@ import javax.sound.midi.Sequencer; import javax.sound.midi.SysexMessage; import javax.sound.midi.Transmitter; +import javax.swing.JFrame; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; import net.sf.japi.midi.MidiUtils; @@ -59,27 +60,30 @@ /** {@inheritDoc} */ @SuppressWarnings({"InstanceMethodNamingConvention"}) public int run(@NotNull final List<String> args) throws Exception { - final MidiDevice device1 = MidiUtils.getTransmittingDevice("Virus TI Synth"); - final MidiDevice device2 = MidiUtils.getReceivingDevice("Virus TI Synth"); - final MidiDevice device3 = MidiUtils.getTransmittingDevice("Virus TI MIDI"); - final MidiDevice device4 = MidiUtils.getReceivingDevice("Virus TI MIDI"); - final Sequencer sequencer = (Sequencer) MidiUtils.getDeviceByName("Real Time Sequencer"); - device1.open(); - device2.open(); - device3.open(); - device4.open(); - final Transmitter transmitter = device1.getTransmitter(); - final Receiver receiver = device4.getReceiver(); - transmitter.setReceiver(new MyReceiver(receiver)); + final JFrame frame = new JFrame("foo"); + if (false) { + final MidiDevice device1 = MidiUtils.getTransmittingDevice("Virus TI Synth"); + final MidiDevice device2 = MidiUtils.getReceivingDevice("Virus TI Synth"); + final MidiDevice device3 = MidiUtils.getTransmittingDevice("Virus TI MIDI"); + final MidiDevice device4 = MidiUtils.getReceivingDevice("Virus TI MIDI"); + final Sequencer sequencer = (Sequencer) MidiUtils.getDeviceByName("Real Time Sequencer"); + device1.open(); + device2.open(); + device3.open(); + device4.open(); + final Transmitter transmitter = device1.getTransmitter(); + final Receiver receiver = device4.getReceiver(); + transmitter.setReceiver(new MyReceiver(receiver)); - // The following SysEx message is known to do the following: - // - It sets the tempo to 0x41 which is 128 BPM (63 is the base, + 65 which is 0x41 so that's 128 BPM) - // It sets "Local" to "Off", disabling the Synthesizer's internal feedback loop so all Midi is routed through this program. - final SysexMessage sysexMessage = MidiUtils.createSysexMessage("f0002033011071401041f7"); - receiver.send(new SysexMessage(), 0); - // The following sets logo groove to NN (0x00 - 0x7F) : f00020330100730834NNf7 + // The following SysEx message is known to do the following: + // - It sets the tempo to 0x41 which is 128 BPM (63 is the base, + 65 which is 0x41 so that's 128 BPM) + // It sets "Local" to "Off", disabling the Synthesizer's internal feedback loop so all Midi is routed through this program. + final SysexMessage sysexMessage = MidiUtils.createSysexMessage("f0002033011071401041f7"); + receiver.send(new SysexMessage(), 0); + // The following sets logo groove to NN (0x00 - 0x7F) : f00020330100730834NNf7 - System.out.println("Go!"); + System.out.println("Go!"); + } return 0; } Added: progs/jirus/trunk/src/prj/net/sf/jirus/JirusControl.java =================================================================== --- progs/jirus/trunk/src/prj/net/sf/jirus/JirusControl.java (rev 0) +++ progs/jirus/trunk/src/prj/net/sf/jirus/JirusControl.java 2009-10-26 05:59:53 UTC (rev 1396) @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2009, Your Corporation. All Rights Reserved. + */ + +package net.sf.jirus; + +import javax.sound.midi.MidiDevice; +import javax.sound.midi.MidiUnavailableException; +import javax.sound.midi.Receiver; +import javax.sound.midi.Transmitter; +import java.util.List; + +/** + * TODO:2009-06-21:christianhujer:Documentation. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class JirusControl implements MidiDevice { + + /** Constant that indicates that timestamps are not supported. */ + private static final int MICROSECOND_POSITION_UNSUPPORTED = 1; + + /** Constant that indicates support for an unlimited number of transmitters. */ + private static final int UNLIMITED_TRANSMITTERS = -1; + + /** Constant that indicates support for an unlimited number of receivers. */ + private static final int UNLIMITED_RECEIVERS = -1; + + /** Whether or not JirusControl is open. */ + private boolean open; + + /** {@inheritDoc} */ + public Info getDeviceInfo() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + /** {@inheritDoc} */ + public void open() throws MidiUnavailableException { + open = true; + } + + /** {@inheritDoc} */ + public void close() { + open = false; + } + + /** {@inheritDoc} */ + public boolean isOpen() { + return open; + } + + /** {@inheritDoc} */ + public long getMicrosecondPosition() { + return MICROSECOND_POSITION_UNSUPPORTED; + } + + /** {@inheritDoc} */ + public int getMaxReceivers() { + return UNLIMITED_RECEIVERS; + } + + /** {@inheritDoc} */ + public int getMaxTransmitters() { + return UNLIMITED_TRANSMITTERS; + } + + /** {@inheritDoc} */ + public Receiver getReceiver() throws MidiUnavailableException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + /** {@inheritDoc} */ + public List<Receiver> getReceivers() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + /** {@inheritDoc} */ + public Transmitter getTransmitter() throws MidiUnavailableException { + return null; //To change body of implemented methods use File | Settings | File Templates. + } + + /** {@inheritDoc} */ + public List<Transmitter> getTransmitters() { + return null; //To change body of implemented methods use File | Settings | File Templates. + } +} Property changes on: progs/jirus/trunk/src/prj/net/sf/jirus/JirusControl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: progs/jirus/trunk/src/prj/net/sf/jirus/JirusControlProvider.java =================================================================== --- progs/jirus/trunk/src/prj/net/sf/jirus/JirusControlProvider.java (rev 0) +++ progs/jirus/trunk/src/prj/net/sf/jirus/JirusControlProvider.java 2009-10-26 05:59:53 UTC (rev 1396) @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2009, Your Corporation. All Rights Reserved. + */ + +package net.sf.jirus; + +import javax.sound.midi.spi.MidiDeviceProvider; +import javax.sound.midi.MidiDevice; + +/** + * TODO:2009-06-21:christianhujer:Documentation. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @since 0.1 + */ +public class JirusControlProvider extends MidiDeviceProvider { + + /** The DeficeInfos. */ + private MidiDevice.Info[] deviceInfo = { + new MidiDevice.Info("Jirus Control", "Christian Hujer", "Jirus Control", "trunk") {} + }; + public MidiDevice.Info[] getDeviceInfo() { + return new MidiDevice.Info[0]; + } + + public MidiDevice getDevice(final MidiDevice.Info info) { + return null; //To change body of implemented methods use File | Settings | File Templates. + } +} Property changes on: progs/jirus/trunk/src/prj/net/sf/jirus/JirusControlProvider.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: progs/jirus/trunk/src/prj/net/sf/jirus/MyReceiver.java =================================================================== --- progs/jirus/trunk/src/prj/net/sf/jirus/MyReceiver.java 2009-10-26 05:56:43 UTC (rev 1395) +++ progs/jirus/trunk/src/prj/net/sf/jirus/MyReceiver.java 2009-10-26 05:59:53 UTC (rev 1396) @@ -85,7 +85,7 @@ if (echoMessage) { receiver.send(message, timeStamp); } - } catch (InvalidMidiDataException e) { + } catch (final InvalidMidiDataException e) { // This should not happen. // It would mean that the program itself did something wrong. e.printStackTrace(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |