movements
Class MusicPlayer

java.lang.Object
  extended bymovements.MusicPlayer
All Implemented Interfaces:
java.io.Serializable

public class MusicPlayer
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
(package private)  int introductoryTicks
           
private  MusicNote[] music
           
private  int musicEndTick
          The number of ticks from the start of the dance (i.e.
(package private)  int musicPosition
           
private  int numberOfNotes
           
private  int timesThruTheMusic
          The number of times the music must be repeated to fill up the length of the dance.
private  int totalTicksInMusic
          The number of ticks between one repeat of the music and the next repeat.
 
Constructor Summary
(package private) MusicPlayer(int numberOfNotes, MusicNote[] music, int introductoryTicks, int totalTicksInMusic, int musicEndTick, int timesThruTheMusic)
           
 
Method Summary
(package private)  int getIntroductoryTicks()
          gets the number of ticks needed to play the introductory music that plays before the dance starts on tick zero.
(package private)  void playNote(int tick)
          If a note starts on the given tick then this method will play the note.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numberOfNotes

private int numberOfNotes

music

private MusicNote[] music

totalTicksInMusic

private int totalTicksInMusic
The number of ticks between one repeat of the music and the next repeat. So this count does not include introductory music that is played only before the dance starts. It does include the time in any incomplete bar at the end that is usually filled with a repeat of the introductory music.


musicEndTick

private int musicEndTick
The number of ticks from the start of the dance (i.e. excluding any introductory music) until the end of the last note or rest in the last bar. If this is less than totalTicksInMusic then the difference is an incomplete last bar which is filled with a repeat of any introductory music.


timesThruTheMusic

private int timesThruTheMusic
The number of times the music must be repeated to fill up the length of the dance.


musicPosition

transient int musicPosition

introductoryTicks

int introductoryTicks
Constructor Detail

MusicPlayer

MusicPlayer(int numberOfNotes,
            MusicNote[] music,
            int introductoryTicks,
            int totalTicksInMusic,
            int musicEndTick,
            int timesThruTheMusic)
Method Detail

getIntroductoryTicks

int getIntroductoryTicks()
gets the number of ticks needed to play the introductory music that plays before the dance starts on tick zero. When playing the music, the tick count must start at zero minus the number of introductory ticks.


playNote

void playNote(int tick)
If a note starts on the given tick then this method will play the note. If no note starts on the given tick then this method does nothing.



Copyright © 2003 Nigel Westbury