From: Jeff W. <jww...@ya...> - 2004-09-01 02:10:24
|
I think I may have found something that might at least partially explain the problems I'm experiencing with Converters and I'd love to hear an opinion or two. In the constructor for the SysexGetDialog class is the following code: // First Populate the Device/Driver List with all Device/Driver // combinations except converters // skip 0 (Generic Device) for (int i=1; i < AppConfig.deviceCount(); i++) { Device device=AppConfig.getDevice(i); for (int j=0; j < device.driverCount(); j++) { IDriver driver = device.getDriver(j); if (driver instanceof IPatchDriver) { // Skipping a converter deviceComboBox.addItem(device); break; } } } I was able to step through this code with a debugger and what I found was that the condition in the if statement: if (driver instanceof IPatchDriver) { // Skipping a converter is returning a true condition even when driver is a Converter. (Note this condition is being used in a few other places, too). I decided to check the class and interface hierarchies using a class browser. Stripping away all the stuff that didn't seem relative, this is what I found: Interface Hierarchy-- IDriver IConverter extends IDriver IPatchDriver extends IDriver IBankDriver extends IPatchDriver ISingleDriver extends IPatchDriver Class Hierarchy-- Driver implements ISingleDriver BankDriver extends Driver implements IBankDriver Converter extends Driver implements IConverter Even though Converter does not directly implement IPatchDriver, notice that it extends Driver, which implements ISingleDriver, which extends IPatchDriver. I'm certainly no expert with interfaces and maybe I'm missing something here but doesn't that mean that Converter implements IPatchDriver indirectly? Is that the reason why the condition (driver instanceof IPatchDriver) returns true for a Converter? __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com |
From: Hiroo H. <hir...@co...> - 2004-09-01 03:14:37
|
Hi Jeff, Jeff> I think I may have found something that might at least Jeff> partially explain the problems I'm experiencing with Jeff> Converters and I'd love to hear an opinion or two. You are right. I made this bug. I did not realize that Converter class implemented IPatchDriver interface. I made same bug on some other places. Let me fix them. Thanks a lot! -- Hiroo Hayashi |
From: Hiroo H. <hir...@co...> - 2004-09-01 14:05:56
|
The fix for this bug and SysexWidget.IParamModel|ISender is in head. -- Hiroo Hayashi |
From: <tt_...@gm...> - 2004-09-09 10:32:06
|
Hi Hiroo, Hiroo Hayashi wrote: > The fix for this bug and SysexWidget.IParamModel|ISender is in head. Do you commit the converter fix already? I still have problems with my DX7 Converter. If I request a patch from my DX7 the DX7 Converter isn't concerned. I get the warning: You requested a Yamaha DX7 SER-7 Converter patch! But you got a Yamaha DX7 SER-7 Converter patch. And this means that no fitting driver was found! The pasted patch is the original received bytearray containing multi Sysexmessages. It seems that the DX7Converter extractPatch() method isn't called. I tried to find the bug, but I don't understand the new construction in detail. In the core.SysexGetDialog.pasteIntoSelectedFrame() method the selected drivers createPatch(SysexMessage[]) method is called directly. But in the core.Driver.createPatch(SysexMessage[]) method I found only the lines // if Conveter for the patch exist, convert the patch. IPatch[] patarray = createPatch(patchSysex); concerning Converters and to be honour I don't understand this. Where is the converters extractPatch(Patch) method called? I hope you understand my problem. Any idea? Bye Torsten |
From: Hiroo H. <hir...@co...> - 2004-09-09 13:51:20
|
Torsten, tt_ml_2_g7> The pasted patch is the original received bytearray containing multi Sysexmessages. tt_ml_2_g7> It seems that the DX7Converter extractPatch() method isn't called. Could you send me this byte data by direct mail? Biggest problem for me is that I cannot test converter. If there is an actual data, it will help me a lot. -- Hiroo Hayashi |
From: Hiroo H. <hir...@co...> - 2004-09-09 14:00:23
|
tt_ml_2_g7> But in the core.Driver.createPatch(SysexMessage[]) method I found only the lines tt_ml_2_g7> // if Conveter for the patch exist, convert the patch. tt_ml_2_g7> IPatch[] patarray = createPatch(patchSysex); And Patch.valueOf() calls it. tt_ml_2_g7> concerning Converters and to be honour I don't understand this. tt_ml_2_g7> Where is the converters extractPatch(Patch) method called? Converter.createPatch(byte[]) calls it. -- Hiroo Hayashi |
From: Hiroo H. <hir...@co...> - 2004-09-10 04:28:58
|
Torsten, Does this solve your problem? Index: Converter.java =================================================================== RCS file: /cvsroot/jsynthlib/JSynthLib/core/Converter.java,v retrieving revision 1.14 diff -u -r1.14 Converter.java --- Converter.java 6 Sep 2004 21:13:29 -0000 1.14 +++ Converter.java 10 Sep 2004 04:27:14 -0000 @@ -31,8 +31,10 @@ String patchString = patarray[i].getPatchHeader(); for (int jdrv = 0; jdrv < dev.driverCount(); jdrv++) { IPatchDriver drv = (IPatchDriver) dev.getDriver(jdrv); - if (drv.supportsPatch(patchString, patarray[i].getByteArray())) + if (drv.supportsPatch(patchString, patarray[i].getByteArray())) { patarray[i].setDriver(drv); + break; + } } } return patarray; -- Hiroo Hayashi |
From: <tt_...@gm...> - 2004-09-10 12:35:21
|
Hi Hiroo, a quick test shows that this hack doesn't work, alas. Hiroo Hayashi wrote: > Torsten, > > Does this solve your problem? > > Index: Converter.java > =================================================================== > RCS file: /cvsroot/jsynthlib/JSynthLib/core/Converter.java,v > retrieving revision 1.14 > diff -u -r1.14 Converter.java > --- Converter.java 6 Sep 2004 21:13:29 -0000 1.14 > +++ Converter.java 10 Sep 2004 04:27:14 -0000 > @@ -31,8 +31,10 @@ > String patchString = patarray[i].getPatchHeader(); > for (int jdrv = 0; jdrv < dev.driverCount(); jdrv++) { > IPatchDriver drv = (IPatchDriver) dev.getDriver(jdrv); > - if (drv.supportsPatch(patchString, patarray[i].getByteArray())) > + if (drv.supportsPatch(patchString, patarray[i].getByteArray())) { > patarray[i].setDriver(drv); > + break; > + } > } > } > return patarray; > Hiroo Hayashi wrote: > tt_ml_2_g7> But in the core.Driver.createPatch(SysexMessage[]) method I found only the lines > tt_ml_2_g7> // if Conveter for the patch exist, convert the patch. > tt_ml_2_g7> IPatch[] patarray = createPatch(patchSysex); > And Patch.valueOf() calls it. Alas Patch.valueof() isn't called anytime. I've made a small fix with calling IPatch[] patarray = Patch.valueOf(patchSysex); instead of IPatch[] patarray = createPatch(patchSysex); And now the converter is concerned properly. I think that the old call missed the proper driver information to work correctly. But Patch.valueOf() determine the right driver and call the proper createPatch() method. If you agree, I will commit this fix. Thanks and bye Torsten |
From: Hiroo H. <hir...@co...> - 2004-09-11 04:07:18
|
Torsten> I've made a small fix with calling Torsten> IPatch[] patarray =3D Patch.valueOf(patchSysex); Torsten> instead of Torsten> IPatch[] patarray =3D createPatch(patchSysex); Torsten> And now the converter is concerned properly. I see the problem. Your fix is close, but is not optimal. I made a fix for this. I found I could remove IPatch.chooseDriver method. I've checked in the fix. Please try it. Torsten> > But in the core.Driver.createPatch(SysexMessage[]) method I fou= nd only the lines Torsten> > // if Conveter for the patch exist, convert the patch. Torsten> > IPatch[] patarray =3D createPatch(patchSysex); Torsten> > And Patch.valueOf() calls it. Torsten> Alas Patch.valueof() isn't called anytime. I just meant that Patch.valueOf() also called =2EDriver.createPatch(SysexMessage[]). It is not called by SysgetGetDialog. --=20 Hiroo Hayashi |
From: <tt_...@gm...> - 2004-09-11 10:12:19
|
Hi Hiroo, Hiroo Hayashi wrote: > Torsten> I've made a small fix with calling > Torsten> IPatch[] patarray = Patch.valueOf(patchSysex); > Torsten> instead of > Torsten> IPatch[] patarray = createPatch(patchSysex); > > Torsten> And now the converter is concerned properly. > > I see the problem. Your fix is close, but is not optimal. I made a > fix for this. I found I could remove IPatch.chooseDriver method. > I've checked in the fix. Please try it. I tried it and it works, great. Your code limits chooseDriver() to look only for a fitting driver/converter of the choosen device. This avoids the unnecessary search through all loaded devices. Very good. Thanks and bye Torsten |