NotePairScorePlayer


A NotePairScorePlayer is an object which can play a NotePairScore. The NotePairScorePlayer keeps track of the position and speed of the NotePairScore. Note that it is perfectly okay to have multiple NotePairScorePlayers playing the same NotePairScore at once.

class NotePairScorePlayer {
public:
  typedef UtilPtr<NotePairScore> NotePairScorePtr;
  static void startMultiple(NotePairScorePlayerPtrArray*);
  static void stopMultiple(NotePairScorePlayerPtrArray*);
  NotePairScorePlayer(NotePairScorePtr);
  NotePairScorePlayer(NotePairScorePtr, void (*func)(const NotePairScoreElement&, NotePairScoreScale, ScheduleTime));
  ~NotePairScorePlayer();
  void start();
  void stop();
  Bool isPlaying() const;
  void setMute(Bool);
  Bool getMute() const;
  void setLoop(Bool);
  Bool getLoop() const;
  void rewind();
  void setIndex(int);
  int getIndex() const;
  void setTimeUnscaled(NotePairScoreTime);
  NotePairScoreTime getTimeUnscaled() const;
  void setTimeScaled(NotePairScoreTime);
  NotePairScoreTime getTimeScaled() const;
  void setScale(NotePairScoreScale);
  NotePairScoreScale getScale() const;
};
static void startMultiple(NotePairScorePlayerPtrArray* a)
Causes all of the NotePairScorePlayers listed in a to start playing simultaneously.
static void stopMultiple(NotePairScorePlayerPtrArray* a)
Causes all of the NotePairScorePlayers listed in a to stop playing simultaneously.
NotePairScorePlayer(NotePairScorePtr s)
Creates a new NotePairScorePlayer which can play NotePairScore s. The output function simply calls the play() method of the NotePairScoreElement. When created, the NotePairScorePlayer is not playing, is not muted, is not looped, has a scale of 1, and is positioned at the beginning.
NotePairScorePlayer(NotePairScorePtr s, void (*func)(const NotePairScoreElement& npse, NotePairScoreScale scale, ScheduleTime now))
Creates a new NotePairScorePlayer which can play NotePairScore s. The output function is func, which should be a function that plays npse in some customized way. When created, the NotePairScorePlayer is not playing, is not muted, is not looped, has a scale of 1, and is positioned at the beginning.
~NotePairScorePlayer()
Destroys the NotePairScorePlayer. The NotePairScorePlayer stops playing when it is destroyed.
void start()
This causes the NotePairScorePlayer to start playing the NotePairScore at the current position. Nothing happens if the NotePairScorePlayer is already playing.
void stop()
This causes the NotePairScorePlayer to stop playing the NotePairScore. Nothing happens if the NotePairScorePlayer is not playing.
Bool isPlaying()
This function returns 1 if the NotePairScorePlayer is playing and 0 if it is not.
void setMute(Bool m)
This function causes the NotePairScorePlayer to be muted (not send out any MIDI_msgs) if the argument is 1, and not be muted if the argument is 0.
Bool getMute()
This returns the value set by setMute.
void setLoop(Bool l)
This function causes the NotePairScorePlayer to loop (i. e. go back to the beginning when it reaches the end) if the argument is 1, and not loop (i. e. stop playing when it reaches the end) if the argument is 0. It is okay to do this whether the NotePairScorePlayer is currently playing or not.
Bool getLoop()
This returns the value set by setLoop.
void rewind()
This moves the NotePairScorePlayer back to the beginning of the NotePairScore. Yes, it is okay to do this while the NotePairScorePlayer is playing.
void setIndex(int n)
This moves the NotePairScorePlayer to event number n. Yes, it is okay to do this while the NotePairScorePlayer is playing.
int getIndex()
This returns the current event index.
void setTimeUnscaled(NotePairScoreTime t)
This sets the position of the NotePairScorePlayer to t demimilliseconds from the beginning of the NotePairScore, based on the default speed of the NotePairScore. It is okay to call this function while the NotePairScorePlayer is playing.
NotePairScoreTime getTimeUnscaled()
This gets the position of the NotePairScorePlayer in demimilliseconds from the beginning of the NotePairScore, based on the default speed of the NotePairScore.
void setTimeScaled(NotePairScoreTime t)
This sets the position of the NotePairScorePlayer to t demimilliseconds from the beginning of the NotePairScore, based on the current NotePairScoreScale of the NotePairScorePlayer. It is okay to call this function while the NotePairScorePlayer is playing.
NotePairScoreTime getTimeScaled()
This gets the position of the NotePairScorePlayer in demimilliseconds from the beginning of the NotePairScore, based on the current NotePairScoreScale of the NotePairScorePlayer.
void setScale(NotePairScoreScale s)
This sets the speed of the NotePairScorePlayer. The default durations are multiplied by s to get the actual durations. Therefore, 1 will play the NotePairScore at the default speed, .5 will play it twice as fast, 2 will play it twice as slow, etc. And guess what? You can call this function while the NotePairScorePlayer is playing.
NotePairScoreScale getScale()
This returns the scaling factor that was set with setScale.

Modified 1 June 1996 pepellet@mit.edu