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

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

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

revision 1775 by iliev, Thu Dec 6 19:37:41 2007 UTC revision 1776 by iliev, Thu Sep 11 18:48:36 2008 UTC
# Line 50  import org.jsampler.task.DuplicateChanne Line 50  import org.jsampler.task.DuplicateChanne
50  import org.linuxsampler.lscp.FxSend;  import org.linuxsampler.lscp.FxSend;
51  import org.linuxsampler.lscp.SamplerChannel;  import org.linuxsampler.lscp.SamplerChannel;
52    
53    import org.linuxsampler.lscp.event.MidiDataEvent;
54    import org.linuxsampler.lscp.event.MidiDataListener;
55    
56    
57  /**  /**
58   * This class provides default implementation of the <code>SamplerChannelModel</code> interface.   * This class provides default implementation of the <code>SamplerChannelModel</code> interface.
# Line 69  public class DefaultSamplerChannelModel Line 72  public class DefaultSamplerChannelModel
72                    
73          private final Vector<FxSend> fxSends = new Vector<FxSend>();          private final Vector<FxSend> fxSends = new Vector<FxSend>();
74                    
75            private final Vector<MidiDataListener> midiListeners = new Vector<MidiDataListener>();
76            
77          /**          /**
78           * Creates a new instance of <code>DefaultSamplerChannelModel</code> using the           * Creates a new instance of <code>DefaultSamplerChannelModel</code> using the
79           * specified channel settings.           * specified channel settings.
# Line 110  public class DefaultSamplerChannelModel Line 115  public class DefaultSamplerChannelModel
115          removeEffectSendsListener(EffectSendsListener l) { fxListeners.remove(l); }          removeEffectSendsListener(EffectSendsListener l) { fxListeners.remove(l); }
116                    
117          /**          /**
118             * Registers the specified listener to be notified when
119             * MIDI events are sent to the channel.
120             * @param l The <code>MidiDataListener</code> to register.
121             */
122            public void
123            addMidiDataListener(MidiDataListener l) { midiListeners.add(l); }
124            
125            /**
126             * Removes the specified listener.
127             * @param l The <code>MidiDataListener</code> to remove.
128             */
129            public void
130            removeMidiDataListener(MidiDataListener l) { midiListeners.remove(l); }
131            
132            /**
133           * Gets the sampler channel number.           * Gets the sampler channel number.
134           * @return The sampler channel number or -1 if the sampler channel number is not set.           * @return The sampler channel number or -1 if the sampler channel number is not set.
135           */           */
# Line 677  public class DefaultSamplerChannelModel Line 697  public class DefaultSamplerChannelModel
697                  CC.getTaskQueue().add(new Channel.SetFxSendLevel(getChannelId(), fxSend, level));                  CC.getTaskQueue().add(new Channel.SetFxSendLevel(getChannelId(), fxSend, level));
698          }          }
699                    
700            /**
701             * Sends a MIDI data message to this sampler channel.
702             */
703            public void
704            sendBackendMidiData(MidiDataEvent e) {
705                    sendBackendMidiData(e.getType(), e.getNote(), e.getVelocity());
706            }
707            
708            /**
709             * Sends a MIDI data message to this sampler channel.
710             * @param type The type of MIDI message to send.
711             * @param arg1 Depends on the message type.
712             * @param arg2 Depends on the message type.
713             */
714            public void
715            sendBackendMidiData(MidiDataEvent.Type type, int arg1, int arg2) {
716                    CC.getTaskQueue().add(new Channel.SendMidiMsg(getChannelId(), type, arg1, arg2));
717            }
718            
719          /** Notifies listeners that the sampler channel settings has changed. */          /** Notifies listeners that the sampler channel settings has changed. */
720          protected void          protected void
721          fireSamplerChannelChanged() {          fireSamplerChannelChanged() {
# Line 802  public class DefaultSamplerChannelModel Line 841  public class DefaultSamplerChannelModel
841                  CC.getSamplerModel().setModified(true);                  CC.getSamplerModel().setModified(true);
842                  for(EffectSendsListener l : fxListeners) l.effectSendChanged(e);                  for(EffectSendsListener l : fxListeners) l.effectSendChanged(e);
843          }          }
844            
845            /**
846             * Notifies listeners that the specified effect send has been updated.
847             * This method should be invoked from the event-dispatching thread.
848             */
849            protected void
850            fireMidiDataEvent(MidiDataEvent e) {
851                    for(MidiDataListener l : midiListeners) l.midiDataArrived(e);
852            }
853  }  }

Legend:
Removed from v.1775  
changed lines
  Added in v.1776

  ViewVC Help
Powered by ViewVC