From: Rib R. <ri...@gm...> - 2005-03-04 05:55:16
|
Maybe instead of having a ClassName field, DeviceDescriptor should have a createDevice(Preferences) method. That way the XML driver (and any other future driver that supports multiple devices) doesn't have to abuse class names or use some other sort of hack. At the moment I can't think of a good way to get a DeviceDescriptor from a Java driver, but it would be really easy to have XMLDeviceFactory.getDeviceDescriptors() instead of getDeviceNames(). On Thu, 03 Mar 2005 19:31:56 -0800, Joe Emenaker <jo...@em...> wrote: > I'm done with the initial work on turning the DeviceAddDialog JList into > a JTree. Now, I'm just working on the parts that group the tree in > various ways (ie, first by manufacturer and then by type, by > manufacturer only, by type only, etc). I'm also considering making it > possible to add multiple synths with a single instance of the dialog. > > Anyway, my current work forced me to go into DevicesConfig an clean > things up. While I was there, I decided to keep track of devices with a > class I named "DeviceDescriptor". It's merely a data-holding class which > keeps DeviceName, ShortName, IDString, Manufacturer, Type, and ClassName > all together. Then, I'm able to just maintain a list of all of the > descriptors. > > Right now, DeviceDescriptor is only used by a few classes that I'm > working on... but I'd like to expand it. The reason is that > DevicesConfig has a handful of methods like "getClassNameForDeviceName", > "getShortNameForDeviceName", "getIDStringForDeviceName", and then there > are more for "getXxxByIDString" or "getXxxByClassName". > > What I'd *like* to do is just have "getDescriptorForDeviceName", > "getDescriptorForClassName", etc. and then the *calling* method gets the > whole descriptor and can get whatever data elements it wants out of > that. This will require me to go modify some classes that are currently > outside the scope of my development on DeviceAddDialog. They're small > changes, but I wanted to check to see if anyone had any objections first. > > Ultimately, I think it would make for cleaner design if DeviceDescriptor > got more widely used, too. Ultimately, it would be nice if this was how > synthdrivers reported what devices they can interact with. This way, a > single Device class could offer back an array of DeviceDescriptors for > various synths that it knew how to control. Of course, that would be > down the road a ways.... but I just wanted to put that in your heads. > > - Joe > > > |