Since your development is not mios based, what hardware is required to run the Java, a core running mios128, plus DINs and DOUTS? Can this additional core be daisy chained with encoders for keyboards, pedal, pistons, etc.
If anyone is interested, I threw together a little java app today that will handle SAMs from jOrgan. It’s not MIOS-based of course, but it should do the trick until a better solution is found. It’s set up to handle 64 SAMs on channel 10 (0-based); 0-63 are the ON magnets, and 64-127 are the off magnets.
Here’s an example:
Stop #1
Activated: 155 0 127
Deactivated: 155 0 0
Stop #2
Activated 155 1 127
Deactivated 155 1 0
Stop #3
etc…
When Stop #1 is Activated, the app receives 155 0 127 (note 0 on, channel 10). The app then outputs 155 0 127, waits 333ms, then outputs 155 0 0.
When Stop #1 is Deactivated, the app receives 155 0 0 (note 0 off, channel 10). The app then outputs 155 63 127, waits 333ms, then outputs 155 63 0.
If anyone ends up building this from source, you’ll have to change the two device name strings to the names of your input and output devices. Also you can change the delay time to fit your SAMs. I’m using a slightly longer time, because I’m using the original electro-pneumatic combination action. Eventually I’ll make a GUI for this.
SAMs.java
import javax.sound.midi.Transmitter;
import javax.sound.midi.Receiver;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.MidiDevice;
import javax.sound.midi.MidiSystem;
public class SAMs {
private static boolean DEBUG = false;
public static void main(String args)
{
/* The device name to listen to.*/
String strDeviceName = null;
DEBUG = true;
strDeviceName = “In From MIDI Yoke: 2”;
if (DEBUG) { /out("MidiInDump.main(): device name: " + strDeviceName);/ }
if (strDeviceName == null) {
//out(“device name not specified!”);
System.exit(0);
}
MidiDevice.Info info = getMidiDeviceInfo(strDeviceName);
if (info == null) {
//out("no device info found for name " + strDeviceName);
System.exit(1);
}
MidiDevice inputDevice = null;
try {
inputDevice = MidiSystem.getMidiDevice(info);
inputDevice.open();
} catch (MidiUnavailableException e) {
if (DEBUG) { }
}
if (inputDevice == null) {
//out(“wasn’t able to retrieve MidiDevice”);
System.exit(1);
}
Receiver r = new InReceiver();
try {
Transmitter t = inputDevice.getTransmitter();
t.setReceiver(r);
} catch (MidiUnavailableException e) {
if (DEBUG) { out(e); }
}
/* Now, we’re entering an endless loop. Otherwise,
the program would exit and we won’t have a chance
to see any results.
*/
while (true) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
if (DEBUG) { out(e); }
}
}
}
/*
*/
private static MidiDevice.Info getMidiDeviceInfo(String strDeviceName)
{
MidiDevice.Info aInfos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < aInfos.length; i++)
{
if (aInfos[i].getName().equals(strDeviceName))
{
return aInfos[i];
}
}
return null;
}
}
InReceiver.java
import javax.sound.midi.MidiDevice;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.MidiMessage;
import javax.sound.midi.ShortMessage;
import javax.sound.midi.Receiver;
public class InReceiver implements Receiver
{
static Receiver rout;
public InReceiver()
{
try
{
MidiDevice outputDevice = null;
String outputDev = “Out To MIDI Yoke: 1”;
MidiDevice.Info info = getMidiDeviceInfo(outputDev);
outputDevice = MidiSystem.getMidiDevice(info);
outputDevice.open();
rout = outputDevice.getReceiver();
}
catch (MidiUnavailableException e)
{
System.out.println(e);
}
}
public void close()
{
}
private static MidiDevice.Info getMidiDeviceInfo(String strDeviceName)
{
MidiDevice.Info aInfos = MidiSystem.getMidiDeviceInfo();
for (int i = 0; i < aInfos.length; i++)
{
if (aInfos[i].getName().equals(strDeviceName))
{
return aInfos[i];
}
}
return null;
}
public void send(MidiMessage message, long lTimeStamp)
{
int evnt0 = ((ShortMessage) message).getStatus();
int evnt1 = ((ShortMessage) message).getData1();
int evnt2 = ((ShortMessage) message).getData2();
if (message instanceof ShortMessage)
{
if(evnt0 == 155)
new SetSAM(evnt1,evnt2,rout).start();
}
}
}
class SetSAM extends Thread
{
int i;
int pinnum;
Receiver rec;
SetSAM(int evnt1, int evnt2, Receiver r)
{
rec = r;
if(evnt2>0)
{
pinnum=evnt1;
}
if(evnt2==0)
{
pinnum=evnt1+64;
}
}
public void run()
{
ShortMessage on = new ShortMessage();
ShortMessage off = new ShortMessage();
try {
//turn magnet on
on.setMessage(155,pinnum,127);
rec.send(on, -1);
} catch (InvalidMidiDataException e1) {
e1.printStackTrace();
}
try {
sleep(333);
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
//turn magnet off
off.setMessage(155,pinnum,0);
rec.send(off, -1);
} catch (InvalidMidiDataException e1) {
e1.printStackTrace();
}
}
}