Logo Search packages:      
Sourcecode: csound version File versions  Download package

std::vector< double > csound::Score::getPitches ( size_t  begin,
size_t  end,
size_t  divisionsPerOctave = 12 
) const [virtual]

Return a vector containing the MIDI key numbers in the specified segment of the score.

Definition at line 508 of file Score.cpp.

References csound::System::inform().

Referenced by getPT(), getPTV(), getVoicing(), setPT(), and voicelead().

  {
    System::inform("BEGAN Score::getPitches(%d, %d, %d)\n", begin_, end_, divisionsPerOctave_);
    if (begin_ < 0) {
      begin_ = 0;
    }
    if (end_ > size()) {
      end_ = size();
    }
    std::set<double> pitches;
    std::vector<double> chord;
    for (size_t i = begin_; i < end_; i++) {
      const Event &event = (*this)[i];
      double pitch = event.getKey(divisionsPerOctave_);
      if (pitches.find(pitch) == pitches.end()) {
        pitches.insert(pitch);
        chord.push_back(pitch);
      //System::inform("  i: %d  pitch: %f\n", i, pitch);
      }
    }
    std::sort(chord.begin(), chord.end());
    printChord("  pitches:             ", chord);
    System::inform("ENDED Score::getPitches.\n");
    return chord;
  }


Generated by  Doxygen 1.6.0   Back to index