dguitar.players.sound.midi
Class PerformanceCore

java.lang.Object
  extended byjavax.sound.midi.Sequence
      extended bydguitar.players.sound.midi.PerformanceCore
All Implemented Interfaces:
Performance
Direct Known Subclasses:
PerformanceFile, PerformanceLive

public abstract class PerformanceCore
extends javax.sound.midi.Sequence
implements Performance

Implementation of a Performance

Author:
crnash

Field Summary
private static java.lang.String className
           
private static java.util.logging.Logger logger
           
(package private)  Tempo tempo
           
 
Fields inherited from class javax.sound.midi.Sequence
divisionType, PPQ, resolution, SMPTE_24, SMPTE_25, SMPTE_30, SMPTE_30DROP, tracks
 
Constructor Summary
PerformanceCore(int tracks, Tempo tempo, int resolution)
           
 
Method Summary
 void addMusicalEvents(EventStream events)
          Adds the given list of musical events to the performance.
 Tempo getTempo()
           
 void initializeTrack(SongTrack track)
          Generate initialization events (such as controller initialization and patch selection) for the given SongTrack.
private  void makeEvent(int track, long time, int status, int data1, int data2)
           
private  void makeEvent(int track, long time, javax.sound.midi.MidiMessage mm)
           
protected abstract  void recordPerformanceEvent(PerformanceEvent event)
           
private  void setTempo(Tempo tempo)
           
 void setTimeSignature(int location, TimeSignature timeSignature)
           
 
Methods inherited from class javax.sound.midi.Sequence
createTrack, deleteTrack, getDivisionType, getMicrosecondLength, getPatchList, getResolution, getTickLength, getTracks
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface dguitar.players.sound.Performance
addTimerEvents, setTimerFrequency
 

Field Detail

className

private static java.lang.String className

logger

private static java.util.logging.Logger logger

tempo

Tempo tempo
Constructor Detail

PerformanceCore

public PerformanceCore(int tracks,
                       Tempo tempo,
                       int resolution)
                throws javax.sound.midi.InvalidMidiDataException
Parameters:
tracks -
tempo -
resolution -
Throws:
javax.sound.midi.InvalidMidiDataException
Method Detail

makeEvent

private void makeEvent(int track,
                       long time,
                       javax.sound.midi.MidiMessage mm)
Parameters:
mm -

makeEvent

private void makeEvent(int track,
                       long time,
                       int status,
                       int data1,
                       int data2)

setTempo

private void setTempo(Tempo tempo)
               throws javax.sound.midi.InvalidMidiDataException
Parameters:
tempo -
Throws:
javax.sound.midi.InvalidMidiDataException

getTempo

public Tempo getTempo()
Specified by:
getTempo in interface Performance
Returns:
a Tempo object for his Performance

initializeTrack

public void initializeTrack(SongTrack track)
Description copied from interface: Performance
Generate initialization events (such as controller initialization and patch selection) for the given SongTrack. The implementor is responsible for creating the actual performed data as well as a PerformanceTrackInitEvent on virtual track 0 of the given SongTrack.

Specified by:
initializeTrack in interface Performance
Parameters:
track - the SongTrack to add.

addMusicalEvents

public void addMusicalEvents(EventStream events)
Description copied from interface: Performance
Adds the given list of musical events to the performance. The particular performance implementation is responsible for adding these events, as-is, to the event stream for the particular index of track and virtual track. In addition, the performance implementation must generate any necessary audio that will be played by the given player (for example, MIDI events or wave files).

Typically the PerformanceEvent is little more than a wrapped SongEvent with added time information. Note this means that a PerformanceEvent applies strictly to the notation of a Song, not necessarily the actual notes. For example, a tied note may be delivered as multiple events, which a typical implementation must be ready to handle as a single played note (but keep the multiple events in the event stream).

The implementor should not necessarily assume the incoming list of events is in precise performance order (rather, the events will arrive in the order they appear on a score). Events on each call will originate from the same virtual track. Note that it is the responsibility of the implementation to expect and handle calls from multiple virtual tracks into the same physical track.

Specified by:
addMusicalEvents in interface Performance
Parameters:
events - an event stream of PerformanceEvents to add

recordPerformanceEvent

protected abstract void recordPerformanceEvent(PerformanceEvent event)
Parameters:
event -

setTimeSignature

public void setTimeSignature(int location,
                             TimeSignature timeSignature)
Specified by:
setTimeSignature in interface Performance
Parameters:
location -
timeSignature -