--- jsampler/trunk/src/org/jsampler/CC.java 2008/05/03 09:54:36 1733 +++ jsampler/trunk/src/org/jsampler/CC.java 2008/05/04 18:40:13 1734 @@ -140,6 +140,17 @@ } /** + * Adds the specified task to the task queue only if the last + * task in the is not equal to t. + */ + public static void + addTask(Task t) { + Task[] tasks = getTaskQueue().getPendingTasks(); + if(tasks.length > 0 && tasks[tasks.length - 1].equals(t)) return; + getTaskQueue().add(t); + } + + /** * Gets the configuration of the current view. */ public static JSViewConfig @@ -784,7 +795,7 @@ getTaskQueue().add(mgim); getTaskQueue().add(new Midi.UpdateDevices()); getTaskQueue().add(new Audio.UpdateDevices()); - getTaskQueue().add(uc); + addTask(uc); } }); @@ -1094,7 +1105,7 @@ /** Invoked when the number of channels has changed. */ public void channelCountChanged( ChannelCountEvent e) { - getTaskQueue().add(new UpdateChannels()); + addTask(new UpdateChannels()); } /** Invoked when changes to the sampler channel has occured. */