Source: songIterator.h


Annotated List
Files
Globals
Hierarchy
Index
#ifndef _SONGITERATOR_H_
#define _SONGITERATOR_H_

#include "compound.h"
#include "position.h"

class Song;
class Track;
class Part;
class Event;
class Note;
class PrPartEditor;

#define MAXEVENTS 128

class SongIterator {
 private:
  Song    * _song;
  Track  ** _track; 
  Part   ** _part;
  Part   ** _new_part;
  Event  ** _event;
  Position  _left;
  Position  _right;
  int       _tracks;

  Note * _mem[MAXEVENTS];
  long   _offset[MAXEVENTS];
  int    _chan[MAXEVENTS];
  int    _num[MAXEVENTS];
  int    _memref;
  int    _memtop;

 public:
  /**
   * copy constructor
   **/
  SongIterator(const SongIterator& i);
  
  /**
   * constructor for an iterator that moves through the song from loft to rigt
   **/
  SongIterator(Song * song, Position left = 0, Position right = 0);

  /**
   * initializes the interator to the positions left and right
   **/
  void init(Position left = 0, Position right = 0);

  /**
   * comparison
   **/
  bool operator!=(const SongIterator& i) const;
  
  /**
   * comparison
   **/
  bool operator==(const SongIterator& i) const;
  
  /**
   * for i >= number of tracks:      returns always true
   * for i =  0..number of tracks-1: returns true if the i'th track has no more events to iterate
   * for i =- 1:                     returns true if none of the tracks has any more events to iterate
   **/
  bool done(int i=-1);
  
  /**
   * returns the start position of the i'th part or 0
   **/
  Position start(int i);
  
  /**
   * returns true if the current event of track i starts at position p
   **/
  bool startsAt(int i, long p);
  
  /**
   * returns the current event of the n'th track
   **/
  Element * operator[](int n);
  
  /**
   * increments the i'th track
   **/
  void increment(int i);

  /**
   * returns the part in case the track has switched to a new part during the current iteration, 0 otherwise
   **/
  Part * change(int);
  Part * part(int);

  /**
   * returns the i'th track
   **/
  Track * track(int i);

  /**
   * returns the channel of the i'th track
   **/
  int channel(int i);

  /**
   * returns the program of the i'th track
   **/
  int program(int i);

  /**
   * returns the mute-flag of the i'th track
   **/
  bool mute(int);

  /**
   * returns the last position within the song
   **/
  Position lastPosition();

  /**
   * returns the end of the song
   **/
  Position endPosition();

  /**
   * returns a vector with references to the notes at the position p
   **/
  Vector chordAt(Position p);

  /**
   * activates the event of the i'th track: puts it on a stack to remember to remove it later...
   **/
  void activate(int i);

  /**
   * tests if current activated note ends at position p
   **/
  bool activeEndsAt(long p);

  /**
   * returns active note
   **/
  Note * activeNote();
  
  /**
   * returns active channel
   **/
  int activeChannel();

  /**
   * returns active track
   **/
  int activeTrack();

  /**
   * removes note from the stack
   **/
  void cutActive();

  /**
   * returns true if there are still active notes
   */
  bool active();
};

#endif

Generated by: wuerthne on al on Sun Mar 3 01:36:08 2002, using kdoc 2.0a53.