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

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

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

revision 2191 by iliev, Sun Apr 5 09:15:35 2009 UTC revision 2192 by iliev, Fri Jun 24 21:34:51 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-2009 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    
25    import org.jsampler.AudioDeviceModel;
26  import org.jsampler.CC;  import org.jsampler.CC;
27    import org.jsampler.EffectChain;
28    import org.jsampler.SamplerModel;
29    
30    import org.linuxsampler.lscp.Effect;
31    import org.linuxsampler.lscp.Instrument;
32  import org.linuxsampler.lscp.SamplerEngine;  import org.linuxsampler.lscp.SamplerEngine;
33  import org.linuxsampler.lscp.ServerInfo;  import org.linuxsampler.lscp.ServerInfo;
 import org.linuxsampler.lscp.Instrument;  
34    
 import org.jsampler.SamplerModel;  
35    
36  import static org.jsampler.JSI18n.i18n;  import static org.jsampler.JSI18n.i18n;
37    
# Line 39  import static org.jsampler.JSI18n.i18n; Line 42  import static org.jsampler.JSI18n.i18n;
42   */   */
43  public class Global {  public class Global {
44                    
45          /** Forbits the instantiation of this class. */          /** Forbids the instantiation of this class. */
46          private Global() { }          private Global() { }
47    
48          /**          /**
# Line 312  public class Global { Line 315  public class Global {
315                          setResult(CC.getClient().getFileInstrumentInfo(filename, instrIdx));                          setResult(CC.getClient().getFileInstrumentInfo(filename, instrIdx));
316                  }                  }
317          }          }
318    
319            /**
320             * This task retrieves the list of internal effects, available to the sampler.
321             */
322            public static class GetEffects extends EnhancedTask<Effect[]> {
323                    /** Creates a new instance of <code>GetEffects</code>. */
324                    public
325                    GetEffects() {
326                            setTitle("Global.GetEffects_task");
327                            setDescription(i18n.getMessage("Global.GetEffects.desc"));
328                    }
329            
330                    /** The entry point of the task. */
331                    @Override
332                    public void
333                    exec() throws Exception { setResult(CC.getClient().getEffects()); }
334            }
335    
336            /**
337             * This task updates the send effect chains and the effect instances in those chains.
338             */
339            public static class UpdateSendEffectChains extends EnhancedTask {
340                    private final int audioDeviceId;
341                    
342                    /** Creates a new instance of <code>UpdateSendEffectChains</code>. */
343                    public
344                    UpdateSendEffectChains() { this(-1); }
345                    
346                    /** Creates a new instance of <code>UpdateSendEffectChains</code>. */
347                    public
348                    UpdateSendEffectChains(int audioDeviceId) {
349                            this.audioDeviceId = audioDeviceId;
350                            setTitle("Global.UpdateSendEffectChains_task");
351                            setDescription(i18n.getMessage("Global.UpdateSendEffectChains.desc"));
352                    }
353            
354                    /** The entry point of the task. */
355                    @Override
356                    public void
357                    exec() throws Exception {
358                            // TODO: synchornization
359                            
360                            if(audioDeviceId < 0) {
361                                    Integer[] aodIDs = CC.getClient().getAudioOutputDeviceIDs();
362                                    for(int id : aodIDs) { updateSendEffectChains(id); }
363                            } else {
364                                    updateSendEffectChains(audioDeviceId);
365                            }
366                    }
367                    
368                    private void
369                    updateSendEffectChains(int devId) throws Exception {
370                            org.linuxsampler.lscp.EffectChain[] chains =
371                                    CC.getClient().getSendEffectChains(devId);
372                            
373                            AudioDeviceModel adm = CC.getSamplerModel().getAudioDeviceById(devId);
374                            adm.removeAllSendEffectChains();
375                            
376                            for(org.linuxsampler.lscp.EffectChain c : chains) {
377                                    adm.addSendEffectChain(new EffectChain(c));
378                            }
379                    }
380            }
381                    
382          public static class DummyTask extends EnhancedTask {          public static class DummyTask extends EnhancedTask {
383                  @Override                  @Override

Legend:
Removed from v.2191  
changed lines
  Added in v.2192

  ViewVC Help
Powered by ViewVC