This discussion is archived
0 Replies Latest reply: Oct 29, 2012 8:37 PM by 971308 RSS

How to use master sync mode?

971308 Newbie
Currently Being Moderated
Hello,


I'd like to use a sync mode but when i call the method "sequencer.setMasterSyncMode(Sequencer.SyncMode.MIDI_TIME_CODE)" , nothing happen. Where is the problem from?

Following is my code where I define the receiver et transmitter (maybe the problem come from there):

public void initDevice(int id) {
          ArrayList<Info> infos = this.getMidiDeviceList();
          System.out.println(infos.get(id).getName() + " - " + infos.get(id).getDescription() + " - " + infos.get(id).getVendor() + " - " + infos.get(id).getVersion());
          
          MidiDevice device = null;
          try {
               device = MidiSystem.getMidiDevice(infos.get(id));
          } catch (MidiUnavailableException e) {}
          if (!(device.isOpen())) {
               try {
                    device.open();
               } catch (MidiUnavailableException e) {
                    e.printStackTrace();
               }
          }
          Receiver rcvr = null;
          try {
               rcvr = device.getReceiver();
          } catch (MidiUnavailableException e) {
               e.printStackTrace();
          }
          
          try {
               seqTrans = sequencer.getTransmitter();
               seqTrans.setReceiver(rcvr);
               
          } catch (MidiUnavailableException e) {
               e.printStackTrace();
          }
     }
     
public void initRecevier(int id){
          Info[] infos = MidiSystem.getMidiDeviceInfo();
          System.out.println(infos[id].getName() + " - " + infos[id].getDescription() + " - " + infos[id].getVendor() + " - " + infos[id].getVersion());
          
          MidiDevice device = null;
          try {
               device = MidiSystem.getMidiDevice(infos[id]);
          } catch (MidiUnavailableException e) {}
          if (!(device.isOpen())) {
               try {
                    device.open();
               } catch (MidiUnavailableException e) {
                    e.printStackTrace();
               }
          }
          Transmitter rcvr = null;
          try {
               rcvr = device.getTransmitter();
          } catch (MidiUnavailableException e) {
               e.printStackTrace();
          }
          
          try {
     rcvr.setReceiver(sequencer.getReceiver());
          } catch (MidiUnavailableException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
          };

     }

I'm new in this forum. I use java sound since few months for develop a sequencer prototype for a student research projet and it's the bigger problem I have found.
I have found nothing on others forums. Nobody seems use this method...
Thanks for your help!

François

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points