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 |