/[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 1817 by iliev, Wed Oct 8 22:38:15 2008 UTC revision 1818 by iliev, Wed Dec 24 17:29:47 2008 UTC
# Line 126  public class CC { Line 126  public class CC {
126           * @return The task queue to be used for scheduling tasks           * @return The task queue to be used for scheduling tasks
127           * for execution out of the event-dispatching thread.           * for execution out of the event-dispatching thread.
128           */           */
129          public static TaskQueue          public static synchronized TaskQueue
130          getTaskQueue() { return taskQueue; }          getTaskQueue() { return taskQueue; }
131                    
132          /**          /**
133           * Adds the specified task to the task queue. All task in the           * Adds the specified task to the task queue. All task in the
134           * queue equal to the specified task are removed from the queue.           * queue equal to the specified task are removed from the queue.
135           */           */
136          public static void          public static synchronized void
137          scheduleTask(Task t) {          scheduleTask(Task t) {
138                  while(getTaskQueue().removeTask(t)) { }                  while(getTaskQueue().removeTask(t)) { }
139                                    
# Line 142  public class CC { Line 142  public class CC {
142                    
143          /**          /**
144           * Adds the specified task to the task queue only if the last           * Adds the specified task to the task queue only if the last
145           * task in the is not equal to <code>t</code>.           * task in the queue is not equal to <code>t</code>.
146           */           */
147          public static void          public static synchronized void
148          addTask(Task t) {          addTask(Task t) {
149                  Task[] tasks = getTaskQueue().getPendingTasks();                  Task[] tasks = getTaskQueue().getPendingTasks();
150                  if(tasks.length > 0 && tasks[tasks.length - 1].equals(t)) return;                  if(tasks.length > 0 && tasks[tasks.length - 1].equals(t)) return;
# Line 255  public class CC { Line 255  public class CC {
255                          actionPerformed(ActionEvent e) { CC.getProgressIndicator().start(); }                          actionPerformed(ActionEvent e) { CC.getProgressIndicator().start(); }
256                  });                  });
257                                    
258                  taskQueue.addTaskQueueListener(getHandler());                  getTaskQueue().addTaskQueueListener(getHandler());
259                                    
260                  taskQueue.start();                  getTaskQueue().start();
261                                    
262                  getClient().removeChannelCountListener(getHandler());                  getClient().removeChannelCountListener(getHandler());
263                  getClient().addChannelCountListener(getHandler());                  getClient().addChannelCountListener(getHandler());
# Line 851  public class CC { Line 851  public class CC {
851                                  getTaskQueue().add(new Audio.UpdateDevices());                                  getTaskQueue().add(new Audio.UpdateDevices());
852                                  addTask(uc);                                  addTask(uc);
853                                                                    
854                                    int vl = preferences().getIntProperty(JSPrefs.GLOBAL_VOICE_LIMIT);
855                                    int sl = preferences().getIntProperty(JSPrefs.GLOBAL_STREAM_LIMIT);
856                                    
857                                    getTaskQueue().add(new Global.SetPolyphony(vl, sl));
858                                    
859                                  fireConnectionEstablishedEvent();                                  fireConnectionEstablishedEvent();
860                          }                          }
861                  });                  });
# Line 1108  public class CC { Line 1113  public class CC {
1113                          sb.append("\r\n");                          sb.append("\r\n");
1114                  }                  }
1115                                    
1116                  //sb.append(getViewConfig().exportSessionViewConfig());                  sb.append(getViewConfig().exportSessionViewConfig());
1117                                    
1118                  return sb.toString();                  return sb.toString();
1119          }          }
# Line 1268  public class CC { Line 1273  public class CC {
1273                  @Override                  @Override
1274                  public void                  public void
1275                  channelCountChanged( ChannelCountEvent e) {                  channelCountChanged( ChannelCountEvent e) {
1276                            if(e.getChannelCount() == 0) {
1277                                    /*
1278                                     * This special case is handled because this might be due to
1279                                     * loading a lscp script containing sampler view configuration.
1280                                     */
1281                                    CC.getSamplerModel().removeAllChannels();
1282                                    return;
1283                            }
1284                          addTask(new UpdateChannels());                          addTask(new UpdateChannels());
1285                  }                  }
1286                                    
# Line 1383  public class CC { Line 1396  public class CC {
1396                  @Override                  @Override
1397                  public void                  public void
1398                  totalVoiceCountChanged(TotalVoiceCountEvent e) {                  totalVoiceCountChanged(TotalVoiceCountEvent e) {
1399                          getTaskQueue().add(new UpdateTotalVoiceCount());                          scheduleTask(new UpdateTotalVoiceCount());
1400                  }                  }
1401                                    
1402                  /** Invoked when the number of MIDI instruments in a MIDI instrument map is changed. */                  /** Invoked when the number of MIDI instruments in a MIDI instrument map is changed. */
# Line 1411  public class CC { Line 1424  public class CC {
1424                          getSamplerModel().setVolume(e.getVolume());                          getSamplerModel().setVolume(e.getVolume());
1425                  }                  }
1426                                    
1427                    @Override
1428                    public void
1429                    voiceLimitChanged(GlobalInfoEvent e) { }
1430                    
1431                    @Override
1432                    public void
1433                    streamLimitChanged(GlobalInfoEvent e) { }
1434                    
1435                  /**                  /**
1436                   * Invoked to indicate that the state of a task queue is changed.                   * Invoked to indicate that the state of a task queue is changed.
1437                   * This method is invoked only from the event-dispatching thread.                   * This method is invoked only from the event-dispatching thread.

Legend:
Removed from v.1817  
changed lines
  Added in v.1818

  ViewVC Help
Powered by ViewVC