From: <tti...@us...> - 2003-03-13 12:31:09
|
Update of /cvsroot/jsynthlib/JSynthLib/core In directory sc8-pr-cvs1:/tmp/cvs-serv23439/JSynthLib/core Modified Files: Patch.java Log Message: Additional constructor and ChooseDriver method for patches with known deviceNum Index: Patch.java =================================================================== RCS file: /cvsroot/jsynthlib/JSynthLib/core/Patch.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Patch.java 24 Feb 2003 22:54:05 -0000 1.11 --- Patch.java 13 Mar 2003 12:31:05 -0000 1.12 *************** *** 36,39 **** --- 36,60 ---- } + /** + * Constructor - The device number is known, but not the driver number + * @param dev The known device number + * @param gsysex The MIDI SysEx message + */ + public Patch (int deviceNum, byte[] gsysex) + { + comment = new StringBuffer (); + date= new StringBuffer (); + author= new StringBuffer (); + sysex= gsysex; + this.deviceNum= deviceNum; + ChooseDriver(deviceNum); + } + + /** + * Constructor - Device and driver number are known + * @param gsysex The MIDI SysEx message + * @param deviceNum The known device number + * @param driverNum The known driver number + */ public Patch (byte[] gsysex, int deviceNum, int driverNum) { *************** *** 66,69 **** --- 87,99 ---- } + /** + * Constructor - all parameters are known + * @param gsysex The MIDI SysEx message + * @param deviceNum The known device number + * @param driverNum The known driver number + * @param gdate A comment + * @param gauthor Another comment + * @param gcomment A last comment + */ public Patch (byte[] gsysex, int deviceNum, int driverNum, String gdate, String gauthor, String gcomment) { *************** *** 76,79 **** --- 106,134 ---- } + /** + * Which driver of a device with known device number supports this patch + * @param deviceNum The known device number + */ + public void ChooseDriver(int deviceNum) + { + this.deviceNum = deviceNum; + Device dev = (Device)PatchEdit.appConfig.getDevice(deviceNum); + StringBuffer patchString=this.getPatchHeader(); + + for (int j=0;j<dev.driverList.size ();j++) + { + // iterating over all Drivers of the given device + if (((Driver)dev.driverList.get (j)).supportsPatch (patchString,this)) + { + this.driverNum=j; + getDriver().trimSysex(this); + return; + } + } + // Unkown patch, try to guess at least the manufacturer + comment=new StringBuffer("Probably a "+LookupManufacturer.get(sysex[1],sysex[2],sysex[3])+" Patch, Size: "+sysex.length); + + } + public void ChooseDriver () { |