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

Gervill receivers are not independent

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      If MidiDevice.getMaxReceivers()==-1 makes any sense, the receivers should act independently, as if two devices were present.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Apply getReceiver() twice on a Gervill soft synthesizer object. Two distinct Receiver objects will be obtained.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When one receiver changes, say, the sound of MIDI channel 1 to piano, and another receiver changes its MIDI channel 1 to violin, and to each receiver a note is sent, two different sound timbres should be produced.
      ACTUAL -
      Both notes sound the same.

      ---------- BEGIN SOURCE ----------
      public boolean GetTwoIndependentReceivers (Receiver [] inhereplease)
      {
          for (MidiDevice.Info info : MidiSystem.getMidiDeviceInfo ()) try
          {
              MidiDevice device = MidiSystem.getMidiDevice (info);
              if ( device instanceof Synthesizer
                  && ( device.getMaxReceivers () < 0
                      || device.getMaxReceivers () >= 2)) try
              {
                  device.open ();
                  inhereplease [0] = device.getReceiver ();
                  inhereplease [1] = device.getReceiver ();
                  // will be distinct as objects, but with Gervill not independent
                  return true;
              } catch (Exception ex) {}
          } catch (Exception ex) {}
          return false;
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I have tried to create two Gervill SoftSynthesizers objects on the same audio line, and one receiver for each. No exception is being thrown, but the resulting audio is a total mess – perhaps yet another bug?

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: