jmusic.midi
Class PhrasePlayer

java.lang.Object
  extended by jmusic.midi.PhrasePlayer
All Implemented Interfaces:
IMidiPlayer

public class PhrasePlayer
extends java.lang.Object
implements IMidiPlayer


Constructor Summary
PhrasePlayer()
          Default constructor.
 
Method Summary
 void addPhrase(jm.music.data.Phrase phrase, int instrument)
          Adds a phrase to be played with the given instrument.
 void addPhrase(jm.music.data.Phrase phrase, int instrument, boolean loop)
          Adds a phrase to be played with the given instrument.
 jm.music.data.Phrase[] getPhrases()
           
 float getTempoBPM()
           
 float getTempoMPQ()
           
static void main(java.lang.String[] args)
           
 int numberOfPhrases()
           
 void play()
          Starts playback.
 void removePhrase(jm.music.data.Phrase phrase)
          Removes the given phrase from the player and stops playing it.
 void setTempoBPM(float tempoBPM)
           
 void setTempoMPQ(float tempoMPQ)
           
 void stop()
          Ceases playback.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhrasePlayer

public PhrasePlayer()
Default constructor.

Method Detail

addPhrase

public void addPhrase(jm.music.data.Phrase phrase,
                      int instrument)
Adds a phrase to be played with the given instrument. A maximum of 16 phrases may be loaded at any given time as each phrase plays on one midi channel. By default phrases are looped so that when they end they are simply restarted.

Parameters:
phrase - the phrase to be played
instrument - the instrument to play the phrase with

addPhrase

public void addPhrase(jm.music.data.Phrase phrase,
                      int instrument,
                      boolean loop)
Adds a phrase to be played with the given instrument. A maximum of 16 phrases may be loaded at any given time as each phrase plays on one midi channel.

Parameters:
phrase - the phrase to be played
instrument - the instrument to play the phrase with
loop - whether or not to restart the phrase upon completion.

removePhrase

public void removePhrase(jm.music.data.Phrase phrase)
Removes the given phrase from the player and stops playing it. If the phrase is not presently loaded then this method does nothing.

Parameters:
phrase - - the phrase to remove

play

public void play()
Starts playback.

Specified by:
play in interface IMidiPlayer

numberOfPhrases

public int numberOfPhrases()

getPhrases

public jm.music.data.Phrase[] getPhrases()

stop

public void stop()
Ceases playback.


setTempoMPQ

public void setTempoMPQ(float tempoMPQ)

setTempoBPM

public void setTempoBPM(float tempoBPM)

getTempoMPQ

public float getTempoMPQ()

getTempoBPM

public float getTempoBPM()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Throwable
Throws:
java.lang.Throwable