/[svn]/jsampler/trunk/src/org/jsampler/CC.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/CC.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1204 by iliev, Thu May 24 21:43:45 2007 UTC revision 1688 by iliev, Thu Feb 14 16:52:36 2008 UTC
# Line 42  import java.util.logging.StreamHandler; Line 42  import java.util.logging.StreamHandler;
42    
43  import javax.swing.Timer;  import javax.swing.Timer;
44    
45    import javax.swing.event.ChangeEvent;
46    import javax.swing.event.ChangeListener;
47    
48  import net.sf.juife.Task;  import net.sf.juife.Task;
49  import net.sf.juife.TaskQueue;  import net.sf.juife.TaskQueue;
50    
# Line 59  import org.jsampler.task.*; Line 62  import org.jsampler.task.*;
62    
63  import org.jsampler.view.JSMainFrame;  import org.jsampler.view.JSMainFrame;
64  import org.jsampler.view.JSProgress;  import org.jsampler.view.JSProgress;
65    import org.jsampler.view.JSViewConfig;
66  import org.jsampler.view.InstrumentsDbTreeModel;  import org.jsampler.view.InstrumentsDbTreeModel;
67    
68  import org.linuxsampler.lscp.AudioOutputChannel;  import org.linuxsampler.lscp.AudioOutputChannel;
# Line 76  import org.w3c.dom.Document; Line 80  import org.w3c.dom.Document;
80  import org.w3c.dom.Node;  import org.w3c.dom.Node;
81    
82  import static org.jsampler.JSI18n.i18n;  import static org.jsampler.JSI18n.i18n;
83    import static org.jsampler.JSPrefs.MANUAL_SERVER_SELECT_ON_STARTUP;
84    
85    
86  /**  /**
# Line 87  public class CC { Line 92  public class CC {
92          private static Handler handler;          private static Handler handler;
93          private static FileOutputStream fos;          private static FileOutputStream fos;
94                    
95            private static JSViewConfig viewConfig = null;
96          private static JSMainFrame mainFrame = null;          private static JSMainFrame mainFrame = null;
97          private static JSProgress progress = null;          private static JSProgress progress = null;
98                    
# Line 138  public class CC { Line 144  public class CC {
144          }          }
145                    
146          /**          /**
147             * Gets the configuration of the current view.
148             */
149            public static JSViewConfig
150            getViewConfig() { return viewConfig; }
151            
152            private static JSPrefs
153            preferences() { return getViewConfig().preferences(); }
154            
155            /**
156             * Sets the configuration of the current view.
157             */
158            public static void
159            setViewConfig(JSViewConfig viewConfig) { CC.viewConfig = viewConfig; }
160            
161            /**
162           * Returns the main window of this application.           * Returns the main window of this application.
163           * @return The main window of this application.           * @return The main window of this application.
164           */           */
# Line 219  public class CC { Line 240  public class CC {
240                                    
241                  HF.setUIDefaultFont(Prefs.getInterfaceFont());                  HF.setUIDefaultFont(Prefs.getInterfaceFont());
242                                    
                 getClient().setServerAddress(Prefs.getLSAddress());  
                 getClient().setServerPort(Prefs.getLSPort());  
                   
243                  timer.setRepeats(false);                  timer.setRepeats(false);
244                                    
245                  timer.addActionListener(new ActionListener() {                  timer.addActionListener(new ActionListener() {
# Line 251  public class CC { Line 269  public class CC {
269                  getClient().removeVoiceCountListener(getHandler());                  getClient().removeVoiceCountListener(getHandler());
270                  getClient().addVoiceCountListener(getHandler());                  getClient().addVoiceCountListener(getHandler());
271                                    
272                    getClient().removeTotalStreamCountListener(getHandler());
273                    getClient().addTotalStreamCountListener(getHandler());
274                    
275                  getClient().removeTotalVoiceCountListener(getHandler());                  getClient().removeTotalVoiceCountListener(getHandler());
276                  getClient().addTotalVoiceCountListener(getHandler());                  getClient().addTotalVoiceCountListener(getHandler());
277                                    
# Line 293  public class CC { Line 314  public class CC {
314          checkJSamplerHome() {          checkJSamplerHome() {
315                  if(getJSamplerHome() != null) {                  if(getJSamplerHome() != null) {
316                          File f = new File(getJSamplerHome());                          File f = new File(getJSamplerHome());
317                          if(f.isDirectory()) return;                          if(f.exists() && f.isDirectory()) {
318                                    return;
319                            }
320                  }                  }
321                                    
322                  CC.getMainFrame().installJSamplerHome();                  CC.getMainFrame().installJSamplerHome();
# Line 309  public class CC { Line 332  public class CC {
332          public static void          public static void
333          changeJSamplerHome(String path) {          changeJSamplerHome(String path) {
334                  File fNew = new File(path);                  File fNew = new File(path);
335                  if(fNew.isFile()) {                  if(fNew.exists() && fNew.isFile()) {
336                          HF.showErrorMessage(i18n.getError("CC.JSamplerHomeIsNotDir!"));                          HF.showErrorMessage(i18n.getError("CC.JSamplerHomeIsNotDir!"));
337                          return;                          return;
338                  }                  }
339                                    
340                  if(!fNew.isDirectory()) {                  if(!fNew.exists()) {
341                          if(!fNew.mkdir()) {                          if(!fNew.mkdir()) {
342                                  String s = fNew.getAbsolutePath();                                  String s = fNew.getAbsolutePath();
343                                  HF.showErrorMessage(i18n.getError("CC.mkdirFailed", s));                                  HF.showErrorMessage(i18n.getError("CC.mkdirFailed", s));
# Line 322  public class CC { Line 345  public class CC {
345                          }                          }
346                  }                  }
347                                    
348                  if(getJSamplerHome() == null) {                  if(getJSamplerHome() == null || path.equals(getJSamplerHome())) {
349                          setJSamplerHome(fNew.getAbsolutePath());                          setJSamplerHome(fNew.getAbsolutePath());
350                          return;                          return;
351                  }                  }
352                                    
353                  File fOld = new File(getJSamplerHome());                  File fOld = new File(getJSamplerHome());
354                  if(!fOld.isDirectory()) {                  if(!fOld.exists() || !fOld.isDirectory()) {
355                          setJSamplerHome(fNew.getAbsolutePath());                          setJSamplerHome(fNew.getAbsolutePath());
356                          return;                          return;
357                  }                  }
# Line 353  public class CC { Line 376  public class CC {
376          public static OrchestraListModel          public static OrchestraListModel
377          getOrchestras() { return orchestras; }          getOrchestras() { return orchestras; }
378                    
379            private final static ServerList servers = new ServerList();
380            
381            /** Returns the server list. */
382            public static ServerList
383            getServerList() { return servers; }
384            
385            private static ServerListListener serverListListener = new ServerListListener();
386            
387            private static class ServerListListener implements ChangeListener {
388                    public void
389                    stateChanged(ChangeEvent e) {
390                            saveServerList();
391                    }
392            }
393            
394            private static final Vector<ChangeListener> idtmListeners = new Vector<ChangeListener>();
395          private static InstrumentsDbTreeModel instrumentsDbTreeModel = null;          private static InstrumentsDbTreeModel instrumentsDbTreeModel = null;
396            
397          /**          /**
398           * Gets the tree model of the instruments database.           * Gets the tree model of the instruments database.
399           * If the currently used view doesn't have instruments           * If the currently used view doesn't have instruments
400           * database support the tree model is initialized on first use.           * database support the tree model is initialized on first use.
401           * @return The tree model of the instruments database or           * @return The tree model of the instruments database or
402           * <code>null</code> if the backend doesn't have instruments database support.           * <code>null</code> if the backend doesn't have instruments database support.
403           * @see org.jsampler.view.JSMainFrame#getInstrumentsDbSupport           * @see org.jsampler.view.JSViewConfig#getInstrumentsDbSupport
404           */           */
405          public static InstrumentsDbTreeModel          public static InstrumentsDbTreeModel
406          getInstrumentsDbTreeModel() {          getInstrumentsDbTreeModel() {
# Line 368  public class CC { Line 408  public class CC {
408                                    
409                  if(instrumentsDbTreeModel == null) {                  if(instrumentsDbTreeModel == null) {
410                          instrumentsDbTreeModel = new InstrumentsDbTreeModel();                          instrumentsDbTreeModel = new InstrumentsDbTreeModel();
411                            for(ChangeListener l : idtmListeners) l.stateChanged(null);
412                  }                  }
413                                    
414                  return instrumentsDbTreeModel;                  return instrumentsDbTreeModel;
415          }          }
416                    
417            public static void
418            addInstrumentsDbChangeListener(ChangeListener l) {
419                    idtmListeners.add(l);
420            }
421            
422            public static void
423            removeInstrumentsDbChangeListener(ChangeListener l) {
424                    idtmListeners.remove(l);
425            }
426            
427          /**          /**
428           * Loads the orchestras described in <code>&lt;jsampler_home&gt;/orchestras.xml</code>.           * Loads the orchestras described in <code>&lt;jsampler_home&gt;/orchestras.xml</code>.
429           * If file with name <code>orchestras.xml.bkp</code> exist in the JSampler's home           * If file with name <code>orchestras.xml.bkp</code> exist in the JSampler's home
# Line 384  public class CC { Line 435  public class CC {
435          loadOrchestras() {          loadOrchestras() {
436                  if(getJSamplerHome() == null) return;                  if(getJSamplerHome() == null) return;
437                                    
                 //TODO: This should be removed in the next release (including loadOrchestras0())  
                 File f2 = new File(getJSamplerHome() + File.separator + "orchestras.xml");  
                 if(!f2.isFile()) {  
                         loadOrchestras0();  
                         saveOrchestras();  
                         return;  
                 }  
                 ///////  
                   
438                  try {                  try {
439                          String s = getJSamplerHome();                          String s = getJSamplerHome();
                         if(s == null) return;  
440                                                    
441                          File f = new File(s + File.separator + "orchestras.xml.bkp");                          File f = new File(s + File.separator + "orchestras.xml.bkp");
442                          if(f.isFile()) HF.createBackup("orchestras.xml.bkp", "orchestras.xml.rec");                          if(f.isFile()) HF.createBackup("orchestras.xml.bkp", "orchestras.xml.rec");
# Line 408  public class CC { Line 449  public class CC {
449                  } catch(Exception x) {                  } catch(Exception x) {
450                          getLogger().log(Level.INFO, HF.getErrorMessage(x), x);                          getLogger().log(Level.INFO, HF.getErrorMessage(x), x);
451                  }                  }
452                    
453                    getOrchestras().addOrchestraListListener(getHandler());
454          }          }
455                    
456                    
# Line 424  public class CC { Line 467  public class CC {
467                  for(int i = 0; i < getOrchestras().getOrchestraCount(); i++) {                  for(int i = 0; i < getOrchestras().getOrchestraCount(); i++) {
468                          getOrchestras().getOrchestra(i).addOrchestraListener(getHandler());                          getOrchestras().getOrchestra(i).addOrchestraListener(getHandler());
469                  }                  }
                 getOrchestras().addOrchestraListListener(getHandler());  
         }  
           
         private static void  
         loadOrchestras0() {  
                 String s = Prefs.getOrchestras();  
                 if(s == null) return;  
                   
                 ByteArrayInputStream bais = new ByteArrayInputStream(s.getBytes());  
                 Document doc = DOMUtils.readObject(bais);  
                   
                 try { getOrchestras().readObject(doc.getDocumentElement()); }  
                 catch(Exception x) { HF.showErrorMessage(x, "Loading orchestras: "); }  
470          }          }
471                    
472          private static void          private static void
# Line 471  public class CC { Line 501  public class CC {
501          }          }
502                    
503          /**          /**
504             * Loads the servers' info described in <code>&lt;jsampler_home&gt;/servers.xml</code>.
505             * If file with name <code>servers.xml.bkp</code> exist in the JSampler's home
506             * directory, this means that the last save has failed. In that case a recovery file
507             * <code>servers.xml.rec</code> is created and a recovery procedure
508             * will be initiated.
509             */
510            public static void
511            loadServerList() {
512                    if(getJSamplerHome() == null) return;
513                    
514                    try {
515                            String s = getJSamplerHome();
516                            
517                            File f = new File(s + File.separator + "servers.xml.bkp");
518                            if(f.isFile()) HF.createBackup("servers.xml.bkp", "servers.xml.rec");
519                            
520                            FileInputStream fis;
521                            fis = new FileInputStream(s + File.separator + "servers.xml");
522                            
523                            loadServerList(fis);
524                            fis.close();
525                    } catch(Exception x) {
526                            getLogger().log(Level.INFO, HF.getErrorMessage(x), x);
527                    }
528                    
529                    getServerList().addChangeListener(serverListListener);
530                    
531                    /* We should have at least one server to connect. */
532                    if(getServerList().getServerCount() == 0) {
533                            Server server = new Server();
534                            server.setName("127.0.0.1:8888");
535                            server.setAddress("127.0.0.1");
536                            server.setPort(8888);
537                            getServerList().addServer(server);
538                    }
539            }
540            
541            
542            private static void
543            loadServerList(InputStream in) {
544                    Document doc = DOMUtils.readObject(in);
545                    
546                    try { getServerList().readObject(doc.getDocumentElement()); }
547                    catch(Exception x) {
548                            HF.showErrorMessage(x, "Loading server list: ");
549                            return;
550                    }
551            }
552            
553            private static void
554            saveServerList() {
555                    try {
556                            String s = getJSamplerHome();
557                            if(s == null) return;
558                            
559                            HF.createBackup("servers.xml", "servers.xml.bkp");
560                            
561                            FileOutputStream fos;
562                            fos = new FileOutputStream(s + File.separator + "servers.xml", false);
563                            
564                            Document doc = DOMUtils.createEmptyDocument();
565                    
566                            Node node = doc.createElement("temp");
567                            doc.appendChild(node);
568                            
569                            getServerList().writeObject(doc, doc.getDocumentElement());
570                            
571                            doc.replaceChild(node.getFirstChild(), node);
572                    
573                            DOMUtils.writeObject(doc, fos);
574                            
575                            fos.close();
576                            
577                            HF.deleteFile("servers.xml.bkp");
578                    } catch(Exception x) {
579                            HF.showErrorMessage(x, "Saving server list: ");
580                            return;
581                    }
582            }
583            
584            /**
585           * The exit point of the application which ensures clean exit with default exit status 0.           * The exit point of the application which ensures clean exit with default exit status 0.
586           *  @see #cleanExit(int i)           *  @see #cleanExit(int i)
587           */           */
# Line 526  public class CC { Line 637  public class CC {
637          getSamplerModel() { return samplerModel; }          getSamplerModel() { return samplerModel; }
638                    
639          /**          /**
640             * Connects to LinuxSampler.
641             */
642            public static void
643            connect() { initSamplerModel(); }
644            
645            /**
646           * Reconnects to LinuxSampler.           * Reconnects to LinuxSampler.
647           */           */
648          public static void          public static void
649          reconnect() {          reconnect() { initSamplerModel(getCurrentServer()); }
650                  initSamplerModel();          
651                  fireReconnectEvent();          private static Server currentServer = null;
         }  
652                    
653          /**          /**
654           * This method updates the information about the backend state.           * Gets the server, to which the frontend is going to connect
655             * or is already connected.
656             */
657            public static Server
658            getCurrentServer() { return currentServer; }
659            
660            /**
661             * Sets the current server.
662           */           */
663          public static void          public static void
664            setCurrentServer(Server server) { currentServer = server; }
665            
666            /**
667             * This method updates the information about the backend state.
668             */
669            private static void
670          initSamplerModel() {          initSamplerModel() {
671                    Server srv = getMainFrame().getServer();
672                    if(srv == null) return;
673                    initSamplerModel(srv);
674            }
675            
676            /**
677             * This method updates the information about the backend state.
678             */
679            private static void
680            initSamplerModel(Server srv) {
681                    setCurrentServer(srv);
682                    final SetServerAddress ssa = new SetServerAddress(srv.getAddress(), srv.getPort());
683                    
684                  final DefaultSamplerModel model = (DefaultSamplerModel)getSamplerModel();                  final DefaultSamplerModel model = (DefaultSamplerModel)getSamplerModel();
685                                    
686                  final Global.GetServerInfo gsi = new Global.GetServerInfo();                  final Global.GetServerInfo gsi = new Global.GetServerInfo();
# Line 549  public class CC { Line 691  public class CC {
691                                                                    
692                                  model.setServerInfo(gsi.getResult());                                  model.setServerInfo(gsi.getResult());
693                                                                    
694                                  if(CC.getMainFrame().getInstrumentsDbSupport()) {                                  if(CC.getViewConfig().getInstrumentsDbSupport()) {
695                                          getInstrumentsDbTreeModel();                                          getInstrumentsDbTreeModel();
696                                  }                                  }
697                          }                          }
# Line 615  public class CC { Line 757  public class CC {
757                                          gfs.addTaskListener(new GetFxSendsListener());                                          gfs.addTaskListener(new GetFxSendsListener());
758                                          getTaskQueue().add(gfs);                                          getTaskQueue().add(gfs);
759                                  }                                  }
760                                    
761                                    // TODO: This should be done after the fx sends are set
762                                    //CC.getSamplerModel().setModified(false);
763                          }                          }
764                  });                  });
765                                    
# Line 623  public class CC { Line 768  public class CC {
768                  cnt.addTaskListener(new TaskListener() {                  cnt.addTaskListener(new TaskListener() {
769                          public void                          public void
770                          taskPerformed(TaskEvent e) {                          taskPerformed(TaskEvent e) {
771                                  if(cnt.doneWithErrors()) return;                                  if(cnt.doneWithErrors()) {
772                                            setCurrentServer(null);
773                                            retryToConnect();
774                                            return;
775                                    }
776                                                                    
777                                  getTaskQueue().add(gsi);                                  getTaskQueue().add(gsi);
778                                  getTaskQueue().add(gaod);                                  getTaskQueue().add(gaod);
# Line 636  public class CC { Line 785  public class CC {
785                                  getTaskQueue().add(uc);                                  getTaskQueue().add(uc);
786                          }                          }
787                  });                  });
788                  getTaskQueue().add(cnt);                  
789                    ssa.addTaskListener(new TaskListener() {
790                            public void
791                            taskPerformed(TaskEvent e) {
792                                    CC.getTaskQueue().add(cnt);
793                            }
794                    });
795                    
796                    getSamplerModel().reset();
797                    if(instrumentsDbTreeModel != null) {
798                            instrumentsDbTreeModel.reset();
799                            instrumentsDbTreeModel = null;
800                    }
801                    
802                    getTaskQueue().removePendingTasks();
803                    getTaskQueue().add(ssa);
804                    
805                    fireReconnectEvent();
806            }
807            
808            private static void
809            retryToConnect() {
810                    javax.swing.SwingUtilities.invokeLater(new Runnable() {
811                            public void
812                            run() { changeBackend(); }
813                    });
814            }
815            
816            public static void
817            changeBackend() {
818                    Server s = getMainFrame().getServer(true);
819                    if(s != null) initSamplerModel(s);
820          }          }
821                    
822          private static class GetFxSendsListener implements TaskListener {          private static class GetFxSendsListener implements TaskListener {
# Line 695  public class CC { Line 875  public class CC {
875                    
876          public static String          public static String
877          exportSessionToLscpScript() {          exportSessionToLscpScript() {
878                    CC.getSamplerModel().setModified(false);
879                    
880                  StringBuffer sb = new StringBuffer("# Exported by: ");                  StringBuffer sb = new StringBuffer("# Exported by: ");
881                  sb.append("JSampler - a java front-end for LinuxSampler\r\n# Version: ");                  sb.append("JSampler - a java front-end for LinuxSampler\r\n# Version: ");
882                  sb.append(JSampler.VERSION).append("\r\n");                  sb.append(JSampler.VERSION).append("\r\n");
# Line 734  public class CC { Line 916  public class CC {
916                  SamplerChannelModel[] channels = getSamplerModel().getChannels();                  SamplerChannelModel[] channels = getSamplerModel().getChannels();
917                                    
918                  for(int i = 0; i < channels.length; i++) {                  for(int i = 0; i < channels.length; i++) {
919                          SamplerChannelModel scm = getSamplerModel().getChannelById(i);                          SamplerChannelModel scm = channels[i];
920                          exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient);                          exportChannelToLscpScript(scm.getChannelInfo(), i, lscpClient);
921                          sb.append(out.toString());                          sb.append(out.toString());
922                          out.reset();                          out.reset();
# Line 802  public class CC { Line 984  public class CC {
984                  try {                  try {
985                          lscpCLient.addSamplerChannel();                          lscpCLient.addSamplerChannel();
986                                                    
987                          int i = chn.getMidiInputDevice();                          SamplerModel sm = CC.getSamplerModel();
988                          if(i != -1) lscpCLient.setChannelMidiInputDevice(chnId, i);                          int id = chn.getMidiInputDevice();
989                          lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort());                          if(id != -1) {
990                          lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel());                                  for(int i = 0; i < sm.getMidiDeviceCount(); i++) {
991                                                                    if(sm.getMidiDevice(i).getDeviceId() == id) {
992                          i = chn.getAudioOutputDevice();                                                  lscpCLient.setChannelMidiInputDevice(chnId, i);
993                          if(i != -1) {                                                  break;
994                                  lscpCLient.setChannelAudioOutputDevice(chnId, i);                                          }
995                                    }
996                                    lscpCLient.setChannelMidiInputPort(chnId, chn.getMidiInputPort());
997                                    lscpCLient.setChannelMidiInputChannel(chnId, chn.getMidiInputChannel());
998                            }
999                            
1000                            if(chn.getEngine() != null) {
1001                                    lscpCLient.loadSamplerEngine(chn.getEngine().getName(), chnId);
1002                                    lscpCLient.setChannelVolume(chnId, chn.getVolume());
1003                            }
1004                            
1005                            id = chn.getAudioOutputDevice();
1006                            if(id != -1) {
1007                                    for(int i = 0; i < sm.getAudioDeviceCount(); i++) {
1008                                            if(sm.getAudioDevice(i).getDeviceId() == id) {
1009                                                    lscpCLient.setChannelAudioOutputDevice(chnId, i);
1010                                                    break;
1011                                            }
1012                                    }
1013                                    
1014                                  Integer[] routing = chn.getAudioOutputRouting();                                  Integer[] routing = chn.getAudioOutputRouting();
1015                                                                    
1016                                  for(int j = 0; j < routing.length; j++) {                                  for(int j = 0; j < routing.length; j++) {
# Line 820  public class CC { Line 1021  public class CC {
1021                                  }                                  }
1022                          }                          }
1023                                                    
                         if(chn.getEngine() != null) {  
                                 lscpCLient.loadSamplerEngine(chn.getEngine().getName(), chnId);  
                                 lscpCLient.setChannelVolume(chnId, chn.getVolume());  
                         }  
                           
1024                          String s = chn.getInstrumentFile();                          String s = chn.getInstrumentFile();
1025                          i = chn.getInstrumentIndex();                          int i = chn.getInstrumentIndex();
1026                          if(s != null) lscpCLient.loadInstrument(s, i, chnId, true);                          if(s != null) lscpCLient.loadInstrument(s, i, chnId, true);
1027                                                    
1028                          if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true);                          if(chn.isMuted()) lscpCLient.setChannelMute(chnId, true);
# Line 855  public class CC { Line 1051  public class CC {
1051                  }                  }
1052          }          }
1053                    
1054            public static void
1055            scheduleInTaskQueue(final Runnable r) {
1056                    Task dummy = new Global.DummyTask();
1057                    dummy.addTaskListener(new TaskListener() {
1058                            public void
1059                            taskPerformed(TaskEvent e) {
1060                                    javax.swing.SwingUtilities.invokeLater(r);
1061                            }
1062                    });
1063                    
1064                    CC.getTaskQueue().add(dummy);
1065            }
1066            
1067            public static boolean
1068            verifyConnection() {
1069                    if(getCurrentServer() == null) {
1070                            HF.showErrorMessage(i18n.getError("CC.notConnected"));
1071                            return false;
1072                    }
1073                    
1074                    return true;
1075            }
1076            
1077                    
1078          private final static EventHandler eventHandler = new EventHandler();          private final static EventHandler eventHandler = new EventHandler();
1079                    
# Line 863  public class CC { Line 1082  public class CC {
1082                    
1083          private static class EventHandler implements ChannelCountListener, ChannelInfoListener,          private static class EventHandler implements ChannelCountListener, ChannelInfoListener,
1084                  FxSendCountListener, FxSendInfoListener, StreamCountListener, VoiceCountListener,                  FxSendCountListener, FxSendInfoListener, StreamCountListener, VoiceCountListener,
1085                  TotalVoiceCountListener, TaskQueueListener, OrchestraListener,                  TotalStreamCountListener, TotalVoiceCountListener, TaskQueueListener,
1086                  ListListener<OrchestraModel>, MidiInstrumentCountListener,                  OrchestraListener, ListListener<OrchestraModel>, MidiInstrumentCountListener,
1087                  MidiInstrumentInfoListener, GlobalInfoListener {                  MidiInstrumentInfoListener, GlobalInfoListener {
1088                                    
1089                  /** Invoked when the number of channels has changed. */                  /** Invoked when the number of channels has changed. */
# Line 969  public class CC { Line 1188  public class CC {
1188                          scm.setVoiceCount(e.getVoiceCount());                          scm.setVoiceCount(e.getVoiceCount());
1189                  }                  }
1190                                    
1191                    /** Invoked when the total number of active streams has changed. */
1192                    public void
1193                    totalStreamCountChanged(TotalStreamCountEvent e) {
1194                            getSamplerModel().updateActiveStreamsInfo(e.getTotalStreamCount());
1195                    }
1196                    
1197                  /** Invoked when the total number of active voices has changed. */                  /** Invoked when the total number of active voices has changed. */
1198                  public void                  public void
1199                  totalVoiceCountChanged(TotalVoiceCountEvent e) {                  totalVoiceCountChanged(TotalVoiceCountEvent e) {
# Line 1012  public class CC { Line 1237  public class CC {
1237                          case TASK_DONE:                          case TASK_DONE:
1238                                  EnhancedTask t = (EnhancedTask)e.getSource();                                  EnhancedTask t = (EnhancedTask)e.getSource();
1239                                  if(t.doneWithErrors() && !t.isStopped()) {                                  if(t.doneWithErrors() && !t.isStopped()) {
1240                                          if(t.getErrorDetails() == null) {                                          showError(t);
                                                 HF.showErrorMessage(t.getErrorMessage());  
                                         } else {  
                                                 getMainFrame().showDetailedErrorMessage (  
                                                         getMainFrame(),  
                                                         t.getErrorMessage(),  
                                                         t.getErrorDetails()  
                                                 );  
                                         }  
1241                                  }                                  }
1242                                  break;                                  break;
1243                          case NOT_IDLE:                          case NOT_IDLE:
# Line 1033  public class CC { Line 1250  public class CC {
1250                          }                          }
1251                  }                  }
1252                                    
1253                    private void
1254                    showError(final Task t) {
1255                            javax.swing.SwingUtilities.invokeLater(new Runnable() {
1256                                    public void
1257                                    run() {
1258                                            if(t.getErrorDetails() == null) {
1259                                                    HF.showErrorMessage(t.getErrorMessage());
1260                                            } else {
1261                                                    getMainFrame().showDetailedErrorMessage (
1262                                                            getMainFrame(),
1263                                                            t.getErrorMessage(),
1264                                                            t.getErrorDetails()
1265                                                    );
1266                                            }
1267                                    }
1268                            });
1269                    }
1270                    
1271                  /** Invoked when the name of orchestra is changed. */                  /** Invoked when the name of orchestra is changed. */
1272                  public void                  public void
1273                  nameChanged(OrchestraEvent e) { saveOrchestras(); }                  nameChanged(OrchestraEvent e) { saveOrchestras(); }

Legend:
Removed from v.1204  
changed lines
  Added in v.1688

  ViewVC Help
Powered by ViewVC