edu.uiuc.cs397rhc.sound
Class ChannelMapFilter

java.lang.Object
  extended by edu.uiuc.cs397rhc.sound.MidiFilter
      extended by edu.uiuc.cs397rhc.sound.ConditionalMidiFilter
          extended by edu.uiuc.cs397rhc.sound.ChannelMapFilter
All Implemented Interfaces:
javax.sound.midi.Receiver, javax.sound.midi.Transmitter

public class ChannelMapFilter
extends ConditionalMidiFilter

ChannelMapFilter is a ConditionalMidiFilter that maps MIDI channels on ShortMessages to other channels.

Author:
Pedro DeRose

Constructor Summary
ChannelMapFilter(java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
          Creates a new ChannelMapFilter with the given mapping, no Receiver, and that always applies.
ChannelMapFilter(MidiCondition condition, java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
          Creates a new ChannelMapFilter with the given mapping, no Receiver, and that applies when then given condition is satisfied.
ChannelMapFilter(javax.sound.midi.Receiver receiver, java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
          Creates a new ChannelMapFilter with the given mapping and Receiver, and that always appliess.
ChannelMapFilter(javax.sound.midi.Receiver receiver, MidiCondition condition, java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
          Creates a new ChannelMapFilter with the given mapping and Receiver, and that applies when then given condition is satisfied.
 
Method Summary
 javax.sound.midi.MidiEvent[] applyFilter(javax.sound.midi.MidiMessage message, long time)
          Returns the MidiEvents whose MidiMessages and timestamps should be sent instead of the given message and timestamp when the filter applies.
 
Methods inherited from class edu.uiuc.cs397rhc.sound.ConditionalMidiFilter
getCondition, isApplicable, setCondition
 
Methods inherited from class edu.uiuc.cs397rhc.sound.MidiFilter
close, getMicrosecondPosition, getReceiver, getSequencer, send, setReceiver, setSequencer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChannelMapFilter

public ChannelMapFilter(java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
Creates a new ChannelMapFilter with the given mapping, no Receiver, and that always applies.

Parameters:
channelMap - a Map between channels

ChannelMapFilter

public ChannelMapFilter(MidiCondition condition,
                        java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
Creates a new ChannelMapFilter with the given mapping, no Receiver, and that applies when then given condition is satisfied.

Parameters:
condition - the condition
channelMap - a Map between channels

ChannelMapFilter

public ChannelMapFilter(javax.sound.midi.Receiver receiver,
                        java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
Creates a new ChannelMapFilter with the given mapping and Receiver, and that always appliess.

Parameters:
receiver - the receiver
channelMap - a Map between channels

ChannelMapFilter

public ChannelMapFilter(javax.sound.midi.Receiver receiver,
                        MidiCondition condition,
                        java.util.Map<java.lang.Integer,java.lang.Integer> channelMap)
Creates a new ChannelMapFilter with the given mapping and Receiver, and that applies when then given condition is satisfied.

Parameters:
receiver - the receiver
condition - the condition
channelMap - a Map between channels
Method Detail

applyFilter

public javax.sound.midi.MidiEvent[] applyFilter(javax.sound.midi.MidiMessage message,
                                                long time)
Description copied from class: MidiFilter
Returns the MidiEvents whose MidiMessages and timestamps should be sent instead of the given message and timestamp when the filter applies. When called by send(), this method will only be caleld if isApplicable() returns true.

Specified by:
applyFilter in class MidiFilter
Parameters:
message - the message
time - the timestamp
Returns:
an array of MidiEvents whose MidiMessages and timestamps should be sent instead of the given message and timestamp