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

Diff of /jsampler/trunk/src/org/jsampler/task/Channel.java

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

revision 1313 by iliev, Thu Aug 30 22:44:29 2007 UTC revision 2200 by iliev, Sun Jul 3 22:01:16 2011 UTC
# Line 1  Line 1 
1  /*  /*
2   *   JSampler - a java front-end for LinuxSampler   *   JSampler - a java front-end for LinuxSampler
3   *   *
4   *   Copyright (C) 2005-2007 Grigor Iliev <grigor@grigoriliev.com>   *   Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5   *   *
6   *   This file is part of JSampler.   *   This file is part of JSampler.
7   *   *
# Line 22  Line 22 
22    
23  package org.jsampler.task;  package org.jsampler.task;
24    
 import java.util.logging.Level;  
   
25  import net.sf.juife.Task;  import net.sf.juife.Task;
26    
27  import org.jsampler.CC;  import org.jsampler.CC;
 import org.jsampler.HF;  
28  import org.jsampler.JSPrefs;  import org.jsampler.JSPrefs;
29  import org.jsampler.SamplerChannelModel;  import org.jsampler.SamplerChannelModel;
30  import org.jsampler.SamplerModel;  import org.jsampler.SamplerModel;
31    
32  import org.linuxsampler.lscp.FxSend;  import org.linuxsampler.lscp.FxSend;
33    import org.linuxsampler.lscp.event.MidiDataEvent;
34    
35  import static org.jsampler.JSI18n.i18n;  import static org.jsampler.JSI18n.i18n;
36  import static org.jsampler.JSPrefs.*;  import static org.jsampler.JSPrefs.*;
# Line 60  public class Channel { Line 58  public class Channel {
58                  }                  }
59                    
60                  /** The entry point of the task. */                  /** The entry point of the task. */
61                    @Override
62                  public void                  public void
63                  run() {                  exec() throws Exception {
64                          try {                          setResult(CC.getClient().addSamplerChannel());
65                                  setResult(CC.getClient().addSamplerChannel());                          int chnId = getResult();
66                                                            
67                                  JSPrefs p = CC.getViewConfig().preferences();                          JSPrefs p = CC.getViewConfig().preferences();
68                                  if(!p.getBoolProperty(USE_CHANNEL_DEFAULTS)) return;                          if(!p.getBoolProperty(USE_CHANNEL_DEFAULTS)) return;
69                                                            
70                                  String s = p.getStringProperty(DEFAULT_ENGINE);                          String s = p.getStringProperty(DEFAULT_ENGINE);
71                                  if(s != null && s.length() > 0) {                          if(s != null && s.length() > 0) {
72                                          CC.getClient().loadSamplerEngine(s, getResult());                                  CC.getClient().loadSamplerEngine(s, chnId);
73                                  }                          }
74                                                            
75                                  s = p.getStringProperty(DEFAULT_MIDI_INPUT);                          s = p.getStringProperty(DEFAULT_MIDI_INPUT);
76                                  if(s != null && s.equals("firstDevice")) {                          if(s != null && s.equals("firstDevice")) {
77                                          assignFirstMidiDevice();                                  assignFirstMidiDevice();
78                                  } else if(s != null && s.equals("firstDeviceNextChannel")) {                          } else if(s != null && s.equals("firstDeviceNextChannel")) {
79                                          assignFirstMidiDeviceNextChannel();                                  assignFirstMidiDeviceNextChannel();
80                                  }                          }
81                                                            
82                                  s = p.getStringProperty(DEFAULT_AUDIO_OUTPUT);                          s = p.getStringProperty(DEFAULT_AUDIO_OUTPUT);
83                                  if(s != null && s.equals("firstDevice")) {                          if(s != null && s.equals("firstDevice")) {
84                                          assignFirstAudioDevice();                                  assignFirstAudioDevice();
                                 }  
                         } catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
85                          }                          }
86                            
87                            s = p.getStringProperty(DEFAULT_MIDI_INSTRUMENT_MAP);
88                            if(s != null && s.equals("midiInstrumentMap.none")) {
89                                    CC.getClient().setChannelMidiInstrumentMap(chnId, -1);
90                            } else if(s != null && s.equals("midiInstrumentMap.default")) {
91                                    CC.getClient().setChannelMidiInstrumentMap(chnId, -2);
92                            }
93                            
94                            float volume = p.getIntProperty(DEFAULT_CHANNEL_VOLUME);
95                            volume /= 100;
96                            CC.getClient().setChannelVolume(chnId, volume);
97                  }                  }
98                                    
99                  private void                  private void
# Line 173  public class Channel { Line 179  public class Channel {
179                  }                  }
180                    
181                  /** The entry point of the task. */                  /** The entry point of the task. */
182                    @Override
183                  public void                  public void
184                  run() {                  exec() throws Exception { CC.getClient().removeSamplerChannel(channel); }
                         try { CC.getClient().removeSamplerChannel(channel); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
185          }          }
186    
187          /**          /**
# Line 202  public class Channel { Line 203  public class Channel {
203                  }                  }
204                    
205                  /** The entry point of the task. */                  /** The entry point of the task. */
206                    @Override
207                  public void                  public void
208                  run() {                  exec() throws Exception { CC.getClient().resetChannel(channel); }
                         try { CC.getClient().resetChannel(channel); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
209          }          }
210    
211          /**          /**
# Line 240  public class Channel { Line 236  public class Channel {
236                  }                  }
237                    
238                  /** The entry point of the task. */                  /** The entry point of the task. */
239                    @Override
240                  public void                  public void
241                  run() {                  exec() throws Exception {
242                          try { CC.getClient().setChannelAudioOutputChannel(chn, audioOut, audioIn); }                          CC.getClient().setChannelAudioOutputChannel(chn, audioOut, audioIn);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
243                  }                  }
244          }          }
245    
# Line 273  public class Channel { Line 266  public class Channel {
266                  }                  }
267                    
268                  /** The entry point of the task. */                  /** The entry point of the task. */
269                    @Override
270                  public void                  public void
271                  run() {                  exec() throws Exception {
272                          try { CC.getClient().setChannelAudioOutputDevice(channel, deviceID); }                          CC.getClient().setChannelAudioOutputDevice(channel, deviceID);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
273                  }                  }
274          }          }
275                    
# Line 307  public class Channel { Line 297  public class Channel {
297                  }                  }
298                    
299                  /** The entry point of the task. */                  /** The entry point of the task. */
300                    @Override
301                  public void                  public void
302                  run() {                  exec() throws Exception {
303                          try { CC.getClient().setChannelMidiInputChannel(channel, midiChannel); }                          CC.getClient().setChannelMidiInputChannel(channel, midiChannel);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
304                  }                  }
305          }          }
306    
# Line 340  public class Channel { Line 327  public class Channel {
327                  }                  }
328                    
329                  /** The entry point of the task. */                  /** The entry point of the task. */
330                    @Override
331                  public void                  public void
332                  run() {                  exec() throws Exception {
333                          try { CC.getClient().setChannelMidiInputDevice(channel, deviceID); }                          CC.getClient().setChannelMidiInputDevice(channel, deviceID);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
334                  }                  }
335          }          }
336    
# Line 373  public class Channel { Line 357  public class Channel {
357                  }                  }
358                    
359                  /** The entry point of the task. */                  /** The entry point of the task. */
360                    @Override
361                  public void                  public void
362                  run() {                  exec() throws Exception {
363                          try { CC.getClient().setChannelMidiInputPort(channel, port); }                          CC.getClient().setChannelMidiInputPort(channel, port);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
364                  }                  }
365          }          }
366                    
367          /**          /**
368           * This task loads a sampler engine in a specific sampler channel.           * This task loads a sampler engine in a specific sampler channel.
          * @author Grigor Iliev  
369           */           */
370          public static class LoadEngine extends EnhancedTask {          public static class LoadEngine extends EnhancedTask {
371                  private String engine;                  private String engine;
# Line 409  public class Channel { Line 389  public class Channel {
389                  }                  }
390                                    
391                  /** The entry point of the task. */                  /** The entry point of the task. */
392                    @Override
393                  public void                  public void
394                  run() {                  exec() throws Exception { CC.getClient().loadSamplerEngine(engine, channel); }
                         try { CC.getClient().loadSamplerEngine(engine, channel); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
395          }          }
396                    
397          /**          /**
398           * This task loads and assigns an instrument to a sampler channel.           * This task loads and assigns an instrument to a sampler channel.
          * @author Grigor Iliev  
399           */           */
400          public static class LoadInstrument extends EnhancedTask {          public static class LoadInstrument extends EnhancedTask {
401                  private String filename;                  private String filename;
# Line 447  public class Channel { Line 421  public class Channel {
421                  }                  }
422                                    
423                  /** The entry point of the task. */                  /** The entry point of the task. */
424                    @Override
425                  public void                  public void
426                  run() {                  exec() throws Exception {
427                          try { CC.getClient().loadInstrument(filename, instrIndex, channel, true); }                          CC.getClient().loadInstrument(filename, instrIndex, channel, true);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
428                  }                  }
429          }          }
430                    
# Line 482  public class Channel { Line 453  public class Channel {
453                  }                  }
454                    
455                  /** The entry point of the task. */                  /** The entry point of the task. */
456                    @Override
457                  public void                  public void
458                  run() {                  exec() throws Exception {
459                          try { CC.getClient().setChannelMidiInstrumentMap(channel, mapId); }                          CC.getClient().setChannelMidiInstrumentMap(channel, mapId);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
460                  }                  }
461          }          }
462                    
# Line 515  public class Channel { Line 483  public class Channel {
483                  }                  }
484                    
485                  /** The entry point of the task. */                  /** The entry point of the task. */
486                    @Override
487                  public void                  public void
488                  run() {                  exec() throws Exception { CC.getClient().setChannelMute(channel, mute); }
                         try { CC.getClient().setChannelMute(channel, mute); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
489          }          }
490                    
491          /**          /**
# Line 548  public class Channel { Line 511  public class Channel {
511                  }                  }
512                    
513                  /** The entry point of the task. */                  /** The entry point of the task. */
514                    @Override
515                  public void                  public void
516                  run() {                  exec() throws Exception { CC.getClient().setChannelSolo(channel, solo); }
                         try { CC.getClient().setChannelSolo(channel, solo); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
517          }          }
518    
519          /**          /**
520           * This taks sets the volume of a specific sampler channel.           * This task sets the volume of a specific sampler channel.
521           */           */
522          public static class SetVolume extends EnhancedTask {          public static class SetVolume extends EnhancedTask {
523                  private int channel;                  private int channel;
# Line 580  public class Channel { Line 538  public class Channel {
538                  }                  }
539                    
540                  /** The entry point of the task. */                  /** The entry point of the task. */
541                    @Override
542                  public void                  public void
543                  run() {                  exec() throws Exception {
544                          /*                          /*
545                           * Because of the rapid flow of volume change tasks in some cases                           * Because of the rapid flow of volume change tasks in some cases
546                           * we need to do some optimization to decrease the traffic.                           * we need to do some optimization to decrease the traffic.
# Line 600  public class Channel { Line 559  public class Channel {
559                                  }                                  }
560                          }                          }
561                                    
562                          try { CC.getClient().setChannelVolume(channel, volume); }                          CC.getClient().setChannelVolume(channel, volume);
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
563                  }                  }
564                    
565                  /**                  /**
# Line 634  public class Channel { Line 589  public class Channel {
589                  }                  }
590                                    
591                  /** The entry point of the task. */                  /** The entry point of the task. */
592                    @Override
593                  public void                  public void
594                  run() {                  exec() throws Exception {
595                          try {                          /*
596                                  SamplerModel sm = CC.getSamplerModel();                           * We don't want to bother the user if error occurs when updating
597                                  sm.updateChannel(CC.getClient().getSamplerChannelInfo(channel));                           * a channel because in most cases this happens due to a race
598                          } catch(Exception x) {                           * condition between delete/update events. So we just log this
599                                  /*                           * error instead to indicate the failure of this task.
600                                   * We don't want to bother the user if error occurs when updating                           */
601                                   * a channel because in most cases this happens due to a race                          setSilent(true);
602                                   * condition between delete/update events. So we just log this                          SamplerModel sm = CC.getSamplerModel();
603                                   * error instead to indicate the failure of this task.                          sm.updateChannel(CC.getClient().getSamplerChannelInfo(channel));
                                  */  
                                 String msg = getDescription() + ": " + HF.getErrorMessage(x);  
                                 CC.getLogger().log(Level.INFO, msg, x);  
                         }  
604                  }                  }
605                                    
606                  /**                  /**
# Line 696  public class Channel { Line 648  public class Channel {
648                  }                  }
649                    
650                  /** The entry point of the task. */                  /** The entry point of the task. */
651                    @Override
652                  public void                  public void
653                  run() {                  exec() throws Exception {
654                          try { setResult(CC.getClient().createFxSend(channel, midiCtrl, name)); }                          setResult(CC.getClient().createFxSend(channel, midiCtrl, name));
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                                 x.printStackTrace();  
                         }  
655                  }                  }
656          }          }
657    
# Line 729  public class Channel { Line 677  public class Channel {
677                  }                  }
678                    
679                  /** The entry point of the task. */                  /** The entry point of the task. */
680                    @Override
681                  public void                  public void
682                  run() {                  exec() throws Exception { CC.getClient().destroyFxSend(channel, fxSend); }
                         try { CC.getClient().destroyFxSend(channel, fxSend); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
683          }          }
684                    
685          /**          /**
# Line 763  public class Channel { Line 706  public class Channel {
706                  }                  }
707                    
708                  /** The entry point of the task. */                  /** The entry point of the task. */
709                    @Override
710                  public void                  public void
711                  run() {                  exec() throws Exception { setResult(CC.getClient().getFxSends(channel)); }
                         try {  
                                 setResult(CC.getClient().getFxSends(channel));  
                         } catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
712                                    
713                  /**                  /**
714                   * Gets the channel ID.                   * Gets the channel ID.
# Line 809  public class Channel { Line 746  public class Channel {
746                  }                  }
747                    
748                  /** The entry point of the task. */                  /** The entry point of the task. */
749                    @Override
750                  public void                  public void
751                  run() {                  exec() throws Exception {
752                          try {                          SamplerChannelModel scm;
753                                  SamplerChannelModel scm;                          scm = CC.getSamplerModel().getChannelById(channel);
754                                  scm = CC.getSamplerModel().getChannelById(channel);                          Integer[] fxSendIDs = CC.getClient().getFxSendIDs(channel);
755                                  Integer[] fxSendIDs = CC.getClient().getFxSendIDs(channel);                  
756                                                    boolean found = false;
757                                  boolean found = false;                          
758                                                            for(FxSend fxs : scm.getFxSends()) {
759                                  for(FxSend fxs : scm.getFxSends()) {                                  for(int i = 0; i < fxSendIDs.length; i++) {
760                                          for(int i = 0; i < fxSendIDs.length; i++) {                                          if(fxSendIDs[i] == fxs.getFxSendId()) {
761                                                  if(fxSendIDs[i] == fxs.getFxSendId()) {                                                  fxSendIDs[i] = -1;
762                                                          fxSendIDs[i] = -1;                                                  found = true;
                                                         found = true;  
                                                 }  
763                                          }                                          }
                                   
                                         if(!found) scm.removeFxSendById(fxs.getFxSendId());  
                                         found = false;  
764                                  }                                  }
765                                                    
766                                  FxSend fxs;                                  if(!found) scm.removeFxSendById(fxs.getFxSendId());
767                                                                    found = false;
768                                  for(int id : fxSendIDs) {                          }
769                                          if(id >= 0) {                  
770                                                  fxs = CC.getClient().getFxSendInfo(channel, id);                          FxSend fxs;
771                                                  scm.addFxSend(fxs);                          
772                                          }                          for(int id : fxSendIDs) {
773                                    if(id >= 0) {
774                                            fxs = CC.getClient().getFxSendInfo(channel, id);
775                                            scm.addFxSend(fxs);
776                                  }                                  }
                         } catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
777                          }                          }
778                  }                  }
779          }          }
# Line 870  public class Channel { Line 803  public class Channel {
803                  }                  }
804                                    
805                  /** The entry point of the task. */                  /** The entry point of the task. */
806                    @Override
807                  public void                  public void
808                  run() {                  exec() throws Exception {
809                          try {                          /*
810                                  SamplerChannelModel scm;                           * We don't want to bother the user if error occurs when updating
811                                  scm = CC.getSamplerModel().getChannelById(channel);                           * an effect send because in most cases this happens due to a race
812                                  scm.updateFxSend(CC.getClient().getFxSendInfo(channel, fxSend));                           * condition between delete/update events. So we just log this
813                          } catch(Exception x) {                           * error instead to indicate the failure of this task.
814                                  /*                           */
815                                   * We don't want to bother the user if error occurs when updating                          setSilent(true);
816                                   * an effect send because in most cases this happens due to a race                          SamplerChannelModel scm;
817                                   * condition between delete/update events. So we just log this                          scm = CC.getSamplerModel().getChannelById(channel);
818                                   * error instead to indicate the failure of this task.                          scm.updateFxSend(CC.getClient().getFxSendInfo(channel, fxSend));
                                  */  
                                 String msg = getDescription() + ": " + HF.getErrorMessage(x);  
                                 CC.getLogger().log(Level.INFO, msg, x);  
                         }  
819                  }                  }
820          }          }
821    
822          /**          /**
823           * This taks changes the name of a specific effect send.           * This task changes the name of a specific effect send.
824           */           */
825          public static class SetFxSendName extends EnhancedTask {          public static class SetFxSendName extends EnhancedTask {
826                  private int channel;                  private int channel;
# Line 916  public class Channel { Line 846  public class Channel {
846                  }                  }
847                    
848                  /** The entry point of the task. */                  /** The entry point of the task. */
849                    @Override
850                  public void                  public void
851                  run() {                  exec() throws Exception { CC.getClient().setFxSendName(channel, fxSend, name); }
                         try { CC.getClient().setFxSendName(channel, fxSend, name); }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
                 }  
852          }          }
853                    
854          /**          /**
855           * This taks sets the MIDI controller of a specific effect send.           * This task sets the MIDI controller of a specific effect send.
856           */           */
857          public static class SetFxSendAudioOutputChannel extends EnhancedTask {          public static class SetFxSendAudioOutputChannel extends EnhancedTask {
858                  private int channel;                  private int channel;
# Line 957  public class Channel { Line 882  public class Channel {
882                  }                  }
883                    
884                  /** The entry point of the task. */                  /** The entry point of the task. */
885                    @Override
886                  public void                  public void
887                  run() {                  exec() throws Exception {
888                          try {                          CC.getClient().setFxSendAudioOutputChannel (
889                                  CC.getClient().setFxSendAudioOutputChannel (                                  channel, fxSend, audioSrc, audioDst
890                                          channel, fxSend, audioSrc, audioDst                          );
                                 );  
                         }  
                         catch(Exception x) {  
                                 setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));  
                                 CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
                         }  
891                  }                  }
892          }          }
893                    
894          /**          /**
895           * This taks sets the volume of a specific effect send.           * This task sets the volume of a specific effect send.
896           */           */
897          public static class SetFxSendLevel extends EnhancedTask {          public static class SetFxSendLevel extends EnhancedTask {
898                  private int channel;                  private int channel;
# Line 998  public class Channel { Line 918  public class Channel {
918                  }                  }
919                    
920                  /** The entry point of the task. */                  /** The entry point of the task. */
921                    @Override
922                  public void                  public void
923                  run() {                  exec() throws Exception {
924                          try { CC.getClient().setFxSendLevel(channel, fxSend, volume); }                          CC.getClient().setFxSendLevel(channel, fxSend, volume);
925                          catch(Exception x) {                  }
926                                  setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));          }
927                                  CC.getLogger().log(Level.FINE, getErrorMessage(), x);          
928            /**
929             * This task (re)assigns the destination effect of a specific effect send.
930             */
931            public static class SetFxSendEffect extends EnhancedTask {
932                    private int channel;
933                    private int fxSend;
934                    private int chainId;
935                    private int chainPos;
936            
937                    /**
938                     * Creates new instance of <code>SetFxSendEffect</code>.
939                     * @param channel The sampler channel number.
940                     * @param fxSend The numerical ID of the effect send.
941                     * @param chainId The numerical ID of the effect chain. If -1 is
942                     * specified the destination effect is removed.
943                     */
944                    public
945                    SetFxSendEffect(int channel, int fxSend, int chainId, int chainPos) {
946                            setTitle("Channel.SetFxSendEffect_task");
947                            String s = i18n.getMessage("Channel.SetFxSendEffect.desc", channel, fxSend);
948                            setDescription(s);
949                    
950                            this.channel = channel;
951                            this.fxSend = fxSend;
952                            this.chainId = chainId;
953                            this.chainPos = chainPos;
954                    }
955            
956                    /** The entry point of the task. */
957                    @Override
958                    public void
959                    exec() throws Exception {
960                            if(chainId == -1) {
961                                    CC.getClient().removeFxSendEffect(channel, fxSend);
962                            } else {
963                                    CC.getClient().setFxSendEffect(channel, fxSend, chainId, chainPos);
964                          }                          }
965                  }                  }
966          }          }
967    
968          /**          /**
969           * This taks sets the MIDI controller of a specific effect send.           * This task sets the MIDI controller of a specific effect send.
970           */           */
971          public static class SetFxSendMidiController extends EnhancedTask {          public static class SetFxSendMidiController extends EnhancedTask {
972                  private int channel;                  private int channel;
# Line 1036  public class Channel { Line 993  public class Channel {
993                  }                  }
994                    
995                  /** The entry point of the task. */                  /** The entry point of the task. */
996                    @Override
997                  public void                  public void
998                  run() {                  exec() throws Exception {
999                          try { CC.getClient().setFxSendMidiController(channel, fxSend, midiCtrl); }                          CC.getClient().setFxSendMidiController(channel, fxSend, midiCtrl);
1000                          catch(Exception x) {                  }
1001                                  setErrorMessage(getDescription() + ": " + HF.getErrorMessage(x));          }
1002                                  CC.getLogger().log(Level.FINE, getErrorMessage(), x);  
1003                          }          /**
1004             * This task starts an instrument editor for editing the loaded instrument
1005             * on the specified sampler channel.
1006             */
1007            public static class EditInstrument extends EnhancedTask {
1008                    private int chn;
1009                    
1010                    /**
1011                     * Creates new instance of <code>EditInstrument</code>.
1012                     * @param channel The sampler channel number.
1013                     */
1014                    public
1015                    EditInstrument(int channel) {
1016                            setTitle("Channel.EditInstrument_task");
1017                            String s = i18n.getMessage("Channel.EditInstrument.desc");
1018                            setDescription(s);
1019                            
1020                            this.chn = channel;
1021                  }                  }
1022            
1023                    /** The entry point of the task. */
1024                    @Override
1025                    public void
1026                    exec() throws Exception { CC.getClient().editChannelInstrument(chn); }
1027          }          }
1028    
1029            /**
1030             * This task starts an instrument editor for editing the loaded instrument
1031             * on the specified sampler channel.
1032             */
1033            public static class SendMidiMsg extends EnhancedTask {
1034                    private int chn;
1035                    private MidiDataEvent.Type type;
1036                    private int arg1;
1037                    private int arg2;
1038                    
1039                    /**
1040                     * Creates new instance of <code>SendMidiMsg</code>.
1041                     * @param channel The sampler channel number.
1042                     */
1043                    public
1044                    SendMidiMsg(int channel, MidiDataEvent.Type type, int arg1, int arg2) {
1045                            this.chn = channel;
1046                            this.type = type;
1047                            this.arg1 = arg1;
1048                            this.arg2 = arg2;
1049                            
1050                            setTitle("Channel.SendMidiMsg_task");
1051                            String s = i18n.getMessage("Channel.SendMidiMsg.desc", channel);
1052                            setDescription(s);
1053                    }
1054            
1055                    /** The entry point of the task. */
1056                    @Override
1057                    public void
1058                    exec() throws Exception {
1059                            setSilent(true);
1060                            CC.getClient().sendChannelMidiData(chn, type, arg1, arg2);
1061                    }
1062            }
1063  }  }

Legend:
Removed from v.1313  
changed lines
  Added in v.2200

  ViewVC Help
Powered by ViewVC