Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7009127

[Spec clarification request] Wrapping the devices retrieved from MidiDeviceProvider

    Details

    • Subcomponent:
    • Resolved In Build:
      b140
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The specs for javax.sound.midi.MidiSystem allows to retrieve custom default midi devices with methods
      - getReceiver()
      - getTransmitter()
      - getSequencer()
      - getSynthesizer()

      The following text specifies how an implementation determines which midi device is returned:
      "Properties can be used to specify default MIDI devices. [...]
      The property value consists of the provider class name and the device name, separated by the hash mark ("#"). [...]
      If the provider class is specified, and it can be successully retrieved from the installed providers, the list of MidiDevice.Info objects is retrieved from the provider. [...]
      If a device name is specified, the resulting list of MidiDevice.Info objects is searched: *the first one with a matching name, and whose MidiDevice implements the respective interface, will be returned*. [...]"

      The marked phrase gives an understanding that a midi device retrieved from our midi device provider is returned "as is" and invoking getClass().getName() will give the name of our midi device implementation. In other words, no wrapping into other objects should take place.
      However, in case of RI under certain conditions (e.g. if a custom Receiver does not implement MidiDeviceReceiver interface) a custom midi device is wrapped into another object and that object is returned.

      I.e. if our MidiDeviceProvider looks like:
      [...]
      public MidiDevice getDevice(MidiDevice.Info info) {
          return MyDevice;
      }

      and MyDevice.getReceiver() returns an instance of MyReceiver,

      and we set all the conditions for MyDevice to be chosen for MidiSystem.getReceiver() call,

      the following check will fail: MidiSystem.getReceiver().getClass().equals(MyReceiver.class)



      Please clarify in specs which devices should be returned "as is" and which may be wrapped. Currently the "problematic" places are getReciver() and getTransmitter() methods.
      The description contains a bit incorrect example with Receiver. Transmitters and Receivers are requested from the midi devices returned by the provider. And the specs does not contain any regulation about how R. and T. should be returned ("as is" or not).

      However all said is applicable to Sequencers and Synthesizers. The specs gives a feeling that these devices should be returned without any wrapping.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amenkov Alex Menkov
                Reporter:
                ashusher Alexander Shusherov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: