|
From: <ge...@us...> - 2003-08-15 20:59:37
|
Update of /cvsroot/jsynthlib/JSynthLib/core
In directory sc8-pr-cvs1:/tmp/cvs-serv2930
Modified Files:
JavaMidiWrapper.java JavasoundMidiWrapper.java
LinuxMidiWrapper.java MacOSXMidiWrapper.java MidiWrapper.java
PatchEdit.java VertScrollBarWidget.java WireMidiWrapper.java
Log Message:
Various changes
including isSupported for Wrappers
Index: JavaMidiWrapper.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/JavaMidiWrapper.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JavaMidiWrapper.java 6 Oct 2002 22:18:05 -0000 1.4
--- JavaMidiWrapper.java 15 Aug 2003 20:48:17 -0000 1.5
***************
*** 88,91 ****
--- 88,103 ----
}
+ /** This method should return true, if this wrapper is
+ * supported on the actual platform (a wrapper for
+ * MacOSX should return true only on Mac's with OSX
+ * etc.)
+ * @return true, if wrapper is supported, false if wrapper is not supported at this
+ * platform.
+ *
+ */
+ public boolean isSupported() throws Exception {
+ // TODO: Implement real functionality here
+ return true;
+ }
Index: JavasoundMidiWrapper.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/JavasoundMidiWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** JavasoundMidiWrapper.java 10 Apr 2003 20:37:08 -0000 1.1
--- JavasoundMidiWrapper.java 15 Aug 2003 20:48:17 -0000 1.2
***************
*** 240,242 ****
--- 240,256 ----
return msg.getLength();
}
+
+ /** This method should return true, if this wrapper is
+ * supported on the actual platform (a wrapper for
+ * MacOSX should return true only on Mac's with OSX
+ * etc.)
+ * @return true, if wrapper is supported, false if wrapper is not supported at this
+ * platform.
+ *
+ */
+ public boolean isSupported() {
+ // TODO: Implement real functionality here
+ return true;
+ }
+
}
Index: LinuxMidiWrapper.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/LinuxMidiWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** LinuxMidiWrapper.java 9 May 2002 00:49:17 -0000 1.3
--- LinuxMidiWrapper.java 15 Aug 2003 20:48:17 -0000 1.4
***************
*** 223,226 ****
--- 223,239 ----
{writeLongMessage (port,sysex,sysex.length);}
+ /** This method should return true, if this wrapper is
+ * supported on the actual platform (a wrapper for
+ * MacOSX should return true only on Mac's with OSX
+ * etc.)
+ * @return true, if wrapper is supported, false if wrapper is not supported at this
+ * platform.
+ *
+ */
+ public boolean isSupported() throws Exception {
+ // TODO: Implement real functionality here
+ return true;
+ }
+
private class InputThread implements Runnable
{
Index: MacOSXMidiWrapper.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/MacOSXMidiWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MacOSXMidiWrapper.java 25 Jul 2003 18:30:30 -0000 1.3
--- MacOSXMidiWrapper.java 15 Aug 2003 20:48:17 -0000 1.4
***************
*** 1,340 ****
!
! package core;
!
! import java.io.*;
! import javax.swing.*;
! import java.util.*;
!
! import com.apple.component.*;
! import com.apple.audio.midi.*;
! import com.apple.audio.hardware.*;
! import com.apple.audio.toolbox.*;
! import com.apple.audio.units.*;
! import com.apple.audio.util.*;
! import com.apple.audio.*;
!
!
!
! /**
! * Midi wrapper for MacOS X.2
! * This version is not X.1 compatible. Get the older version.
! * @author Denis Queffeulou mailto:dqu...@fr...
! */
! public class MacOSXMidiWrapper extends MidiWrapper
! implements MIDICompletionProc
! {
! private static List mInputNames = new ArrayList();
! private static List mOutputNames = new ArrayList();
!
! private static int mNumInputs;
! private static int mNumOutputs;
!
! private MIDIClient mClient;
!
! /** device output */
! private MIDIOutputPort mOutput;
!
! /** all inputs */
! private MIDIInputPort mInputs[];
!
! /** contains List of MIDIData by port (MIDIInputPort) */
! private Map mReceivedDataMap = new Hashtable();
!
! /** when init done... */
! private boolean mInitDone = false;
!
! private static boolean mLoadDone = false;
!
! /** MIDI paquet for channel messages , it seems important for
! handling the controller device data smoothy to create only one and reuse it
! because allocate takes too much time
! */
! private MIDIPacketList mShortMessagePaquetList;
!
!
!
! public MacOSXMidiWrapper(int inport, int outport) throws Exception
! {
! mClient = new MIDIClient(new CAFString("JSynthLib"), null);
! if (!mLoadDone)
! {
! loadDevicesNames();
! mLoadDone = true;
! }
! mInputs = new MIDIInputPort[mNumInputs];
!
! // device input
! mInputs[inport] = mClient.inputPortCreate(new CAFString(getInputDeviceName(inport)), new ReadProcImpl());
! MIDIEndpoint oIn = MIDISetup.getSource(inport);
! mInputs[inport].connectSource(oIn);
!
! // device output
! mOutput = mClient.outputPortCreate(new CAFString(getInputDeviceName(outport)));
!
! mInitDone = true;
! }
!
! public MacOSXMidiWrapper() throws Exception {
! this(0,0);
! }
!
!
! /**
! Init for input read proc. Puts MIDIInputPort in mInputs.
! */
! void inputInit(int inport) throws Exception
! {
! // controller device
! mInputs[inport] = mClient.inputPortCreate(new CAFString(getInputDeviceName(inport)), new ReadProcImpl());
! MIDIEndpoint oInContr = MIDISetup.getSource(inport);
! mInputs[inport].connectSource(oInContr);
! }
!
!
! public void setInputDeviceNum (int port) throws Exception
! {
! // System.out.println("setInputDeviceNum port = "+port);
! }
!
! protected void setOutputDeviceNum (int port) throws Exception
! {
! // System.out.println("setOutputDeviceNum port = "+port);
! }
!
! /**
! Send a sysex but can be called with note data !!?
! so it wraps writeShortMessage.
! */
! public void writeLongMessage (int port,byte []sysex,int length) throws Exception
! {
! // System.out.println("writeLongMessage port = "+port+" len = "+length);
! if (length == 2)
! {
! writeShortMessage (port, sysex[0], sysex[1]);
! }
! else
! if (length == 3)
! {
! writeShortMessage (port, sysex[0], sysex[1], sysex[2]);
! }
! else
! {
! // send sysex
! MIDIEndpoint oOut = MIDISetup.getDestination(port);
! // MIDIData oData = MIDIData.newMIDIPacketData(length);
! MIDIData oData = MIDIData.newMIDIRawData(length);
!
! /* la fonction a l'air de marcher mais l'objet cree ne doit pas etre correct
! oData.copyFromArray(4, mSysex, 0, mLength);
! */
! int oTab[] = new int[length];
! for (int i = 0; i < length; i++)
! {
! oTab[i] = (int)sysex[i];
! }
! oData.addRawData(oTab);
! MIDISysexSendRequest oSysex = new MIDISysexSendRequest(oOut, oData);
! oSysex.send(MacOSXMidiWrapper.this);
! }
! }
!
!
! public void writeLongMessage (int port,byte []sysex)throws Exception
! {
! writeLongMessage(port, sysex, sysex.length);
! }
!
!
! public void writeShortMessage (int port, byte b1, byte b2) throws Exception
! {
! writeShortMessage(port, b1, b2, (byte)0);
! }
!
! public void writeShortMessage (int port,byte b1, byte b2,byte b3) throws Exception
! {
! // System.out.println("writeShortMessage port = "+port+" b1="+b1+" b2="+b2+" b3= "+b3);
! if (mShortMessagePaquetList == null)
! {
! mShortMessagePaquetList = new MIDIPacketList();
! }
! else
! { // reuse the paquet
! mShortMessagePaquetList.init();
! }
! MIDIData oData = MIDIData.newMIDIChannelMessage(b1, b2, b3);
! mShortMessagePaquetList.add(0, oData);
! MIDIEndpoint oOut = MIDISetup.getDestination(port);
! mOutput.send(oOut, mShortMessagePaquetList);
! }
!
!
! public int getNumInputDevices () throws Exception
! {
! if (!mInitDone)
! {
! mNumInputs = MIDISetup.getNumberOfSources();
! }
! return mNumInputs;
! }
!
! public int getNumOutputDevices ()throws Exception
! {
! if (!mInitDone)
! {
! mNumInputs = MIDISetup.getNumberOfDestinations();
! }
! return mNumOutputs;
! }
!
! public String getInputDeviceName (int port)throws Exception
! {
! String oS2 = (String)mInputNames.get(port);
! return oS2;
! }
!
! public String getOutputDeviceName (int port)throws Exception
! {
! String oS2 = (String)mOutputNames.get(port);
! return oS2;
! }
!
! /**
! * Called periodically to see if controller has sent a note or
! * device has sent sysex.
! */
! public int messagesWaiting (int port) throws Exception
! {
! if (mInputs[port] == null)
! {
! // creates new input
! inputInit(port);
! }
! else
! {
! List oList = (List)mReceivedDataMap.get(mInputs[port]);
! if (oList != null)
! {
! if (oList.size() > 0)
! {
! // System.out.println("messagesWaiting port = "+port+" len = "+oList.size());
! return oList.size();
! }
! }
! }
! return 0;
! }
!
! /** get the older data packet received */
! public int readMessage (int port,byte []sysex,int maxSize) throws Exception
! {
! // List oList = (List)mReceivedDataMap.get(getInputDeviceName(port));
! List oList = (List)mReceivedDataMap.get(mInputs[port]);
! if (oList != null)
! {
! if (oList.size() > 0)
! {
! // get the older packet
! byte[] oData = (byte[])oList.remove(0);
! // System.out.println("readMessage port="+port+" len = "+oData.length);
! System.arraycopy(oData, 0, sysex, 0, oData.length);
! return oData.length;
! }
! }
! return 0;
! }
!
! public void close()
! {
! // System.out.println("close");
! }
!
! /**
! Load devices names into static variables
! */
! private static void loadDevicesNames() throws Exception
! {
! int oEntNum = 0;
! mNumInputs = 0;
! mNumOutputs = 0;
! for (int k = 0; k < MIDIDevice.getNumberOfDevices(); k++)
! {
! MIDIDevice oDev = MIDIDevice.getDevice(k);
! // String oS2 = oDev.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("device = "+oS2);
! for (int entity = 0; entity < oDev.getNumberOfEntities(); entity++)
! {
! MIDIEntity oEnt = oDev.getEntity(entity);
! String oSEntity = oDev.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("entity = "+oSEntity);
! mNumInputs += oEnt.getNumberOfSources();
! mNumOutputs += oEnt.getNumberOfDestinations();
! for (int i = 0; i < oEnt.getNumberOfSources(); i++)
! {
! MIDIEndpoint oIn = oEnt.getSource(i);
! String oSIn = oIn.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("input = "+oSIn);
! mInputNames.add(oSEntity+" "+oSIn);
! }
! for (int i = 0; i < oEnt.getNumberOfDestinations(); i++)
! {
! MIDIEndpoint oIn = oEnt.getDestination(i);
! String oSOut = oIn.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("output = "+oSOut);
! mOutputNames.add(oSEntity+" "+oSOut);
! }
! }
! }
! }
!
! // ************** interface MIDICompletionProc *****************************
!
! /**
! * Called on end of sysex sending
! */
! public void execute(MIDISysexSendRequest request)
! {
! // System.out.println("SYSEX sent IN");
! // System.out.println("SYSEX sent OUT");
! }
!
! // ************** interface MIDIReadProc *****************************
!
! /**
! * Read method
! */
! class ReadProcImpl implements MIDIReadProc
! {
! /**
! Sysex are received in several parts. I put them in a list
! read by readMessage.
! */
! public void execute(MIDIInputPort port, MIDIEndpoint srcEndPoint, MIDIPacketList list)
! {
! try
! {
! List oList = (List)mReceivedDataMap.get(port);
! if (oList == null)
! {
! // Vector for sync need
! oList = new Vector();
! mReceivedDataMap.put(port, oList);
! }
! int oNumPackets = list.numPackets();
! for (int i = 0; i < oNumPackets; i++)
! {
! MIDIPacket oPkt = list.getPacket(i);
! MIDIData oData = oPkt.getData();
! byte[] oArray = new byte[oData.getMIDIDataLength()];
! oData.copyToArray(0,oArray, 0, oData.getMIDIDataLength());
! oList.add(oArray);
! }
! }
! catch(Exception cae)
! {
! cae.printStackTrace();
! }
! }
! }
!
! }
!
--- 1,364 ----
!
! package core;
!
! import java.io.*;
! import javax.swing.*;
! import java.util.*;
!
! import com.apple.component.*;
! import com.apple.audio.midi.*;
! import com.apple.audio.hardware.*;
! import com.apple.audio.toolbox.*;
! import com.apple.audio.units.*;
! import com.apple.audio.util.*;
! import com.apple.audio.*;
!
!
!
! /**
! * Midi wrapper for MacOS X.2
! * This version is not X.1 compatible. Get the older version.
! * @author Denis Queffeulou mailto:dqu...@fr...
! * @version $Id$
! */
! public class MacOSXMidiWrapper extends MidiWrapper
! implements MIDICompletionProc
! {
! private static List mInputNames = new ArrayList();
! private static List mOutputNames = new ArrayList();
!
! private static int mNumInputs;
! private static int mNumOutputs;
!
! private MIDIClient mClient;
!
! /** device output */
! private MIDIOutputPort mOutput;
!
! /** all inputs */
! private MIDIInputPort mInputs[];
!
! /** contains List of MIDIData by port (MIDIInputPort) */
! private Map mReceivedDataMap = new Hashtable();
!
! /** when init done... */
! private boolean mInitDone = false;
!
! private static boolean mLoadDone = false;
!
! /** MIDI paquet for channel messages , it seems important for
! handling the controller device data smoothy to create only one and reuse it
! because allocate takes too much time
! */
! private MIDIPacketList mShortMessagePaquetList;
!
!
!
! public MacOSXMidiWrapper(int inport, int outport) throws Exception
! {
! mClient = new MIDIClient(new CAFString("JSynthLib"), null);
! if (!mLoadDone)
! {
! loadDevicesNames();
! mLoadDone = true;
! }
! mInputs = new MIDIInputPort[mNumInputs];
!
! // device input
! mInputs[inport] = mClient.inputPortCreate(new CAFString(getInputDeviceName(inport)), new ReadProcImpl());
! MIDIEndpoint oIn = MIDISetup.getSource(inport);
! mInputs[inport].connectSource(oIn);
!
! // device output
! mOutput = mClient.outputPortCreate(new CAFString(getInputDeviceName(outport)));
!
! mInitDone = true;
! }
!
! public MacOSXMidiWrapper() throws Exception {
! this(0,0);
! }
!
!
! /**
! Init for input read proc. Puts MIDIInputPort in mInputs.
! */
! void inputInit(int inport) throws Exception
! {
! // controller device
! mInputs[inport] = mClient.inputPortCreate(new CAFString(getInputDeviceName(inport)), new ReadProcImpl());
! MIDIEndpoint oInContr = MIDISetup.getSource(inport);
! mInputs[inport].connectSource(oInContr);
! }
!
!
! public void setInputDeviceNum (int port) throws Exception
! {
! // System.out.println("setInputDeviceNum port = "+port);
! }
!
! protected void setOutputDeviceNum (int port) throws Exception
! {
! // System.out.println("setOutputDeviceNum port = "+port);
! }
!
! /**
! Send a sysex but can be called with note data !!?
! so it wraps writeShortMessage.
! */
! public void writeLongMessage (int port,byte []sysex,int length) throws Exception
! {
! // System.out.println("writeLongMessage port = "+port+" len = "+length);
! if (length == 2)
! {
! writeShortMessage (port, sysex[0], sysex[1]);
! }
! else
! if (length == 3)
! {
! writeShortMessage (port, sysex[0], sysex[1], sysex[2]);
! }
! else
! {
! // send sysex
! MIDIEndpoint oOut = MIDISetup.getDestination(port);
! // MIDIData oData = MIDIData.newMIDIPacketData(length);
! MIDIData oData = MIDIData.newMIDIRawData(length);
!
! /* la fonction a l'air de marcher mais l'objet cree ne doit pas etre correct
! oData.copyFromArray(4, mSysex, 0, mLength);
! */
! int oTab[] = new int[length];
! for (int i = 0; i < length; i++)
! {
! oTab[i] = (int)sysex[i];
! }
! oData.addRawData(oTab);
! MIDISysexSendRequest oSysex = new MIDISysexSendRequest(oOut, oData);
! oSysex.send(MacOSXMidiWrapper.this);
! }
! }
!
!
! public void writeLongMessage (int port,byte []sysex)throws Exception
! {
! writeLongMessage(port, sysex, sysex.length);
! }
!
!
! public void writeShortMessage (int port, byte b1, byte b2) throws Exception
! {
! writeShortMessage(port, b1, b2, (byte)0);
! }
!
! public void writeShortMessage (int port,byte b1, byte b2,byte b3) throws Exception
! {
! // System.out.println("writeShortMessage port = "+port+" b1="+b1+" b2="+b2+" b3= "+b3);
! if (mShortMessagePaquetList == null)
! {
! mShortMessagePaquetList = new MIDIPacketList();
! }
! else
! { // reuse the paquet
! mShortMessagePaquetList.init();
! }
! MIDIData oData = MIDIData.newMIDIChannelMessage(b1, b2, b3);
! mShortMessagePaquetList.add(0, oData);
! MIDIEndpoint oOut = MIDISetup.getDestination(port);
! mOutput.send(oOut, mShortMessagePaquetList);
! }
!
!
! public int getNumInputDevices () throws Exception
! {
! if (!mInitDone)
! {
! mNumInputs = MIDISetup.getNumberOfSources();
! }
! return mNumInputs;
! }
!
! public int getNumOutputDevices ()throws Exception
! {
! if (!mInitDone)
! {
! mNumInputs = MIDISetup.getNumberOfDestinations();
! }
! return mNumOutputs;
! }
!
! public String getInputDeviceName (int port)throws Exception
! {
! String oS2 = (String)mInputNames.get(port);
! return oS2;
! }
!
! public String getOutputDeviceName (int port)throws Exception
! {
! String oS2 = (String)mOutputNames.get(port);
! return oS2;
! }
!
! /**
! * Called periodically to see if controller has sent a note or
! * device has sent sysex.
! */
! public int messagesWaiting (int port) throws Exception
! {
! if (mInputs[port] == null)
! {
! // creates new input
! inputInit(port);
! }
! else
! {
! List oList = (List)mReceivedDataMap.get(mInputs[port]);
! if (oList != null)
! {
! if (oList.size() > 0)
! {
! // System.out.println("messagesWaiting port = "+port+" len = "+oList.size());
! return oList.size();
! }
! }
! }
! return 0;
! }
!
! /** get the older data packet received */
! public int readMessage (int port,byte []sysex,int maxSize) throws Exception
! {
! // List oList = (List)mReceivedDataMap.get(getInputDeviceName(port));
! List oList = (List)mReceivedDataMap.get(mInputs[port]);
! if (oList != null)
! {
! if (oList.size() > 0)
! {
! // get the older packet
! byte[] oData = (byte[])oList.remove(0);
! // System.out.println("readMessage port="+port+" len = "+oData.length);
! System.arraycopy(oData, 0, sysex, 0, oData.length);
! return oData.length;
! }
! }
! return 0;
! }
!
! public void close()
! {
! // System.out.println("close");
! }
!
! /**
! Load devices names into static variables
! */
! private static void loadDevicesNames() throws Exception
! {
! int oEntNum = 0;
! mNumInputs = 0;
! mNumOutputs = 0;
! for (int k = 0; k < MIDIDevice.getNumberOfDevices(); k++)
! {
! MIDIDevice oDev = MIDIDevice.getDevice(k);
! // String oS2 = oDev.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("device = "+oS2);
! for (int entity = 0; entity < oDev.getNumberOfEntities(); entity++)
! {
! MIDIEntity oEnt = oDev.getEntity(entity);
! String oSEntity = oDev.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("entity = "+oSEntity);
! mNumInputs += oEnt.getNumberOfSources();
! mNumOutputs += oEnt.getNumberOfDestinations();
! for (int i = 0; i < oEnt.getNumberOfSources(); i++)
! {
! MIDIEndpoint oIn = oEnt.getSource(i);
! String oSIn = oIn.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("input = "+oSIn);
! mInputNames.add(oSEntity+" "+oSIn);
! }
! for (int i = 0; i < oEnt.getNumberOfDestinations(); i++)
! {
! MIDIEndpoint oIn = oEnt.getDestination(i);
! String oSOut = oIn.getStringProperty(MIDIConstants.kMIDIPropertyName).asString();
! // System.out.println("output = "+oSOut);
! mOutputNames.add(oSEntity+" "+oSOut);
! }
! }
! }
! }
!
! // ************** interface MIDICompletionProc *****************************
!
! /**
! * Called on end of sysex sending
! */
! public void execute(MIDISysexSendRequest request)
! {
! // System.out.println("SYSEX sent IN");
! // System.out.println("SYSEX sent OUT");
! }
!
! /** This method should return true, if this wrapper is
! * supported on the actual platform (a wrapper for
! * MacOSX should return true only on Mac's with OSX
! * etc.)
! * @return true, if wrapper is supported, false if wrapper is not supported at this
! * platform.
! *
! */
! public boolean isSupported() throws Exception {
! // TODO: Implement real functionality here
! return true;
! }
!
! // ************** interface MIDIReadProc *****************************
!
! /**
! * Read method
! */
! class ReadProcImpl implements MIDIReadProc
! {
! /**
! Sysex are received in several parts. I put them in a list
! read by readMessage.
! */
! public void execute(MIDIInputPort port, MIDIEndpoint srcEndPoint, MIDIPacketList list)
! {
! try
! {
! List oList = (List)mReceivedDataMap.get(port);
! if (oList == null)
! {
! // Vector for sync need
! oList = new Vector();
! mReceivedDataMap.put(port, oList);
! }
! int oNumPackets = list.numPackets();
! for (int i = 0; i < oNumPackets; i++)
! {
! MIDIPacket oPkt = list.getPacket(i);
! MIDIData oData = oPkt.getData();
! byte[] oArray = new byte[oData.getMIDIDataLength()];
! oData.copyToArray(0,oArray, 0, oData.getMIDIDataLength());
! // Rib Rdb (ri...@ya...)
! // Filter out realtime messages
! ByteArrayOutputStream os =
! new ByteArrayOutputStream(256);
! for (int q=0; q<oArray.length; q++)
! if ( (oArray[q] & 0x80) != 0x80 ||
! (oArray[q] & 0x7F) < 0x78 )
! os.write(oArray[q]);
! oArray = os.toByteArray();
! // End ri...@ya...
! oList.add(oArray);
! }
! }
! catch(Exception cae)
! {
! cae.printStackTrace();
! }
! }
! }
!
! }
!
Index: MidiWrapper.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/MidiWrapper.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MidiWrapper.java 9 May 2002 00:49:17 -0000 1.3
--- MidiWrapper.java 15 Aug 2003 20:48:17 -0000 1.4
***************
*** 1,4 ****
--- 1,7 ----
// Create a subclass of this in order to support a new platform. These are the functions you must implement.
package core;
+ /**
+ * @version $Id$
+ */
abstract public class MidiWrapper
{
***************
*** 22,25 ****
--- 25,36 ----
PatchEdit.midiMonitor.log(port,in,sysex,length);
}
+ /** This method should return true, if this wrapper is
+ * supported on the actual platform (a wrapper for
+ * MacOSX should return true only on Mac's with OSX
+ * etc.)
+ * @return true, if wrapper is supported, false if wrapper is not supported at this
+ * platform.
+ */
+ public abstract boolean isSupported() throws Exception;
public void close() {}
Index: PatchEdit.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/PatchEdit.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** PatchEdit.java 11 Aug 2003 10:06:45 -0000 1.16
--- PatchEdit.java 15 Aug 2003 20:48:17 -0000 1.17
***************
*** 768,779 ****
setEnabled (false);
}
! public void actionPerformed (ActionEvent e)
! {
! try
! {
JInternalFrame frm=
((PatchBasket)desktop.getSelectedFrame ()).EditSelectedPatch ();
! if (frm!=null)
! {
frm.setVisible (true);
desktop.add (frm);
--- 768,782 ----
setEnabled (false);
}
! public void actionPerformed (ActionEvent e){
! Worker w = new Worker();
! w.setDaemon(true);
! w.start();
! }
! class Worker extends Thread {
! public void run () {
! try {
JInternalFrame frm=
((PatchBasket)desktop.getSelectedFrame ()).EditSelectedPatch ();
! if (frm!=null) {
frm.setVisible (true);
desktop.add (frm);
***************
*** 791,797 ****
{}
}
! } catch (Exception ex)
! {ErrorMsg.reportError ("Error", "Library holding Patch to Edit must be the focused Window.",ex);};
! }
}
--- 794,804 ----
{}
}
!
! }
! catch (Exception ex){
! ErrorMsg.reportError ("Error", "Library holding Patch to Edit must be the focused Window.",ex);
! };
! }
! }
}
***************
*** 1280,1285 ****
if ((desktop.getSelectedFrame () instanceof PatchBasket)&&(!(desktop.getSelectedFrame () instanceof PatchEditorFrame)))
{
! if ((desktop.getSelectedFrame () instanceof LibraryFrame ) &
! ((LibraryFrame)((desktop.getSelectedFrame ()))).table.getSelectedRowCount ()==0)
break;
((PatchBasket)desktop.getSelectedFrame ()).CopySelectedPatch ();
--- 1287,1292 ----
if ((desktop.getSelectedFrame () instanceof PatchBasket)&&(!(desktop.getSelectedFrame () instanceof PatchEditorFrame)))
{
! if ((desktop.getSelectedFrame () instanceof LibraryFrame ))
! if (((LibraryFrame)((desktop.getSelectedFrame ()))).table.getSelectedRowCount ()==0)
break;
((PatchBasket)desktop.getSelectedFrame ()).CopySelectedPatch ();
Index: VertScrollBarWidget.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/VertScrollBarWidget.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** VertScrollBarWidget.java 9 May 2002 00:49:17 -0000 1.3
--- VertScrollBarWidget.java 15 Aug 2003 20:48:17 -0000 1.4
***************
*** 4,12 ****
import java.awt.event.*;
import javax.swing.event.*;
public class VertScrollBarWidget extends ScrollBarWidget
{
int base;
JTextField text;
! JSlider slider;
public VertScrollBarWidget(String l,Patch p,int min, int max,int b,ParamModel ofs,SysexSender s)
--- 4,15 ----
import java.awt.event.*;
import javax.swing.event.*;
+ /**
+ * @version $Id$
+ */
public class VertScrollBarWidget extends ScrollBarWidget
{
int base;
JTextField text;
! public JSlider slider;
public VertScrollBarWidget(String l,Patch p,int min, int max,int b,ParamModel ofs,SysexSender s)
Index: WireMidiWrapper.java
===================================================================
RCS file: /cvsroot/jsynthlib/JSynthLib/core/WireMidiWrapper.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** WireMidiWrapper.java 14 Feb 2003 22:05:02 -0000 1.5
--- WireMidiWrapper.java 15 Aug 2003 20:48:17 -0000 1.6
***************
*** 4,7 ****
--- 4,10 ----
import java.util.*;
+ /**
+ * @version $Id$
+ */
public class WireMidiWrapper extends MidiWrapper implements Receiver
{
***************
*** 207,209 ****
--- 210,219 ----
return msg.getLength ();
}
+
+ public boolean isSupported() {
+ // TODO: Implement real functionality here
+ return true;
+ }
+
+
}
|