From: Hiroo H. <hir...@co...> - 2004-08-29 19:22:59
|
I'd like to propose two inner interfaces for SysexWidget. 1. IParamModel public interface IParamModel { void set(int value); int get(); } The current ParamModel class depends on Patch class which is an implementation of IPatch. It cannot be used for other implementation of IPatch. By introducing this interface, SysexWidget and its subclasses can support any implementation of IPatch. 2. ISender public interface ISender { void send(IPatchDriver driver, int value); } Now SysexSender.generate() returns a byte array and SysexWidget.sendSysex() converts the byte array into a SysexMessage and send it to MIDI port. After my proposal SysexWidget.sendSysex() will just call ISender.send() method and send() method does all of the job. The main job of SysexSender class becomes sending Sysex Message. Easy to understand, isn't it? More importantly a sender has more flexibility. It can send any message, short message, multiple message, and mix of sysex and short message. For example WaldorfPulseSingleEditor.WaldorfPulseSender (the only sender which sends short message, I could find.) becomes as follows; class WaldorfPulseSender implements SysexWidget.ISender { private int param; private int mult; public WaldorfPulseSender(int param) { this(param, 1); } public WaldorfPulseSender(int param, int multiplier) { this.param = param; this.mult = multiplier; } public void send(IPatchDriver driver, int value) { ShortMessage msg = new ShortMessage(); try { msg.setMessage(ShortMessage.CONTROL_CHANGE, driver.getChannel() - 1, param, value * mult); driver.send(msg); } catch (InvalidMidiDataException e) { ErrorMsg.reportStatus(e); } } } This proposal requires little changes of SysexWidget, its subclasses in core, SysexSender, and ParamModel. No change for synthdrivers. I'm ready to commit them. Rib, are you changing these files for your XML driver? If so, I'll check-in my fix after your check-in. -- Hiroo Hayashi |
From: Jeff W. <jww...@ya...> - 2004-08-29 20:23:08
|
Hi Hiroo, That should solve my problem. All I would have to do is add the override to send(IPatchDriver driver, int value) to my sender. Jeff --- Hiroo Hayashi <hir...@co...> wrote: > I'd like to propose two inner interfaces for > SysexWidget. > > 1. IParamModel > public interface IParamModel { > void set(int value); > int get(); > } > > The current ParamModel class depends on Patch class > which is an > implementation of IPatch. It cannot be used for > other implementation of > IPatch. By introducing this interface, SysexWidget > and its subclasses > can support any implementation of IPatch. > > 2. ISender > public interface ISender { > void send(IPatchDriver driver, int value); > } > > Now SysexSender.generate() returns a byte array and > SysexWidget.sendSysex() converts the byte array into > a SysexMessage and > send it to MIDI port. After my proposal > SysexWidget.sendSysex() will > just call ISender.send() method and send() method > does all of the job. > > The main job of SysexSender class becomes sending > Sysex Message. Easy > to understand, isn't it? More importantly a sender > has more flexibility. > It can send any message, short message, multiple > message, and mix of > sysex and short message. > > For example > WaldorfPulseSingleEditor.WaldorfPulseSender (the > only sender > which sends short message, I could find.) becomes as > follows; > > class WaldorfPulseSender implements > SysexWidget.ISender { > private int param; > private int mult; > > public WaldorfPulseSender(int param) { > this(param, 1); > } > > public WaldorfPulseSender(int param, int > multiplier) { > this.param = param; > this.mult = multiplier; > } > > public void send(IPatchDriver driver, int > value) { > ShortMessage msg = new ShortMessage(); > try { > > msg.setMessage(ShortMessage.CONTROL_CHANGE, > driver.getChannel() - 1, > param, value * mult); > driver.send(msg); > } catch (InvalidMidiDataException e) { > ErrorMsg.reportStatus(e); > } > } > } > > This proposal requires little changes of > SysexWidget, its subclasses in > core, SysexSender, and ParamModel. No change for > synthdrivers. I'm > ready to commit them. > > Rib, are you changing these files for your XML > driver? If so, I'll > check-in my fix after your check-in. > -- > Hiroo Hayashi > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic > Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 > today. > http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click > _______________________________________________ > Jsynthlib-devel mailing list > Jsy...@li... > https://lists.sourceforge.net/lists/listinfo/jsynthlib-devel > __________________________________ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com |
From: Hiroo H. <hir...@co...> - 2004-08-30 13:21:06
|
OK, take your time. I have some questions. (You don't have to answer. I can wait to seeing your code.) Why some method in Parameter has 'IPatch p' argument. I guess the IPatch object is passed to Parameter object via constructor. How does IPatchDriver.sendParameter(IPatch, Parameter) works. Parameter object does not have information about SysexMessage data format. I guess what we need is 'void Parameter.send()'. I must be misunderstanding something. On Sun, 29 Aug 2004 20:11:50 -0700 Rib Rdb <ri...@gm...> wrote: Rib> On Sun, 29 Aug 2004 13:22:51 -0500, Hiroo Hayashi Rib> <hir...@co...> wrote: Rib> > Rib, are you changing these files for your XML driver? If so, I'll Rib> > check-in my fix after your check-in. Rib> Rib> Yes. What I've done is changed the sysex widgets to support both the Rib> current param model/sysex senders, as well as a new api: an interface Rib> Parameter, and a method IPatchDriver.sendParameter(IPatch, Parameter). Rib> Here is the parameter interface: Rib> public interface Parameter { Rib> public String getName(); Rib> Rib> /* For numeric parameters */ Rib> public int getMin(); Rib> public int getMax(); Rib> public int get(IPatch p); Rib> public void set(IPatch p, int val); Rib> Rib> /* For list parameters */ Rib> public String[] getValues(); Rib> Rib> /* For String parameters */ Rib> public String getString(IPatch p); Rib> public int getLength(); Rib> public void set(IPatch p, String stringval); Rib> } Rib> Rib> This way all the sysex sender objects aren't necessary, and the Rib> parameter objects can be shared between instances. Also, sysex Rib> widgets can be constructed from the parameter objects instead of Rib> hardcoding the values to the constructor like is currently done. This Rib> is meant to help with editor builder. Rib> Rib> Speaking of the XML driver: I have finished the parser and the plugin Rib> support. I merely have to finish implementing the XMLPatch class. Rib> Hopefully I'll be able to get it done in the next couple days. -- Hiroo Hayashi |
From: Hiroo H. <hir...@co...> - 2004-09-06 22:44:53
|
Hi Rib, Rib> > Why some method in Parameter has 'IPatch p' argument. I guess the Rib> > IPatch object is passed to Parameter object via constructor. Rib> Rib> This is so the driver can have one set of parameter objects which are Rib> shared by all of that driver's patches. I see. XMLParamter.decoder is never set now. I guess it will be set by the constructor. Rib> > How does IPatchDriver.sendParameter(IPatch, Parameter) works. Parameter Rib> > object does not have information about SysexMessage data format. I Rib> > guess what we need is 'void Parameter.send()'. Rib> Rib> Each driver (or decoder for xml drivers) has a subclass of parameter Rib> with whatever data is necessary about how the parameter is stored in Rib> the sysex message. Although Parameter.send might be better for non-xml Rib> drivers. My question was not clear. I think we don't need IPatchDriver.sendParamter. IPatchDriver does not have to have a method only for Parameter class. We already have IPatchDriver.send(SysexMessage) method. What we need is; void Parameter.send(IPatch) or MidiMessage[] Parameter.getMessage(IPatch) I chose the 1st one for ISender, because most of cases only one MIDI message is sent but we need to support the case of multiple MIDI messages. Only ISender which sends multiple message have a for-loop. BTW Parameter interface is used only for an argument of SysexWidget. It would be better to make it an inner interface of SysexWidget as I did for ISender and IParamModel. How do you think? -- Hiroo Hayashi |
From: Hiroo H. <hir...@co...> - 2004-09-11 04:41:10
|
Hi Rib, Rib> the XMLDriverImplementation class. It would probably make more sense Rib> to have Parameter.send(IPatch) and remove IPatchDriver.sendParameter. Rib> But for XMLParameter it would probably need to be something like: Rib> final void send(IPatch p) { Rib> ((XMLDriver)p.getDriver).sendParameter(this, (XMLPatch)p); Rib> } Could you make this change when you are convenient Rib> > BTW Parameter interface is used only for an argument of SysexWidget. It Rib> > would be better to make it an inner interface of SysexWidget as I did Rib> > for ISender and IParamModel. How do you think? Rib> Rib> I can't think of any problems with this. I checked in the fix. I chose name SysexWidget.IParameter to make it consistent with other interface names. I also made SysexHandler.NameValue class for the substitute of NameValue class. -- Hiroo Hayashi |