adjust StepSequence API(s) to meet needs

This commit is contained in:
Paul Davis
2018-11-14 22:43:27 -05:00
parent 9869b0266b
commit aceec18510
2 changed files with 9 additions and 6 deletions

View File

@@ -164,17 +164,18 @@ class StepSequence : public PBD::Stateful
rd_random = 3
};
StepSequence (StepSequencer &myseq, size_t nsteps, Temporal::Beats const & step_size, Temporal::Beats const & bar_size, int notenum);
StepSequence (StepSequencer &myseq, size_t index, size_t nsteps, Temporal::Beats const & step_size, Temporal::Beats const & bar_size, int notenum);
~StepSequence ();
size_t index() const { return _index; }
size_t nsteps() const { return _steps.size(); }
Step& step (size_t n) const;
void startup (Temporal::Beats const & start, Temporal::Beats const & offset);
double root() const { return _root; }
void set_root (double n);
int root() const { return _root; }
void set_root (int n);
int channel() const { return _channel; }
void set_channel (int);
@@ -200,12 +201,13 @@ class StepSequence : public PBD::Stateful
private:
StepSequencer& _sequencer;
int _index;
mutable Glib::Threads::Mutex _step_lock;
typedef std::vector<Step*> Steps;
Steps _steps;
int _channel; /* MIDI channel */
double _root;
int _root;
MusicalMode _mode;
};

View File

@@ -400,8 +400,9 @@ Step::set_state (XMLNode const &, int)
/**/
StepSequence::StepSequence (StepSequencer& s, size_t nsteps, Temporal::Beats const & step_size, Temporal::Beats const & bar_size, int r)
StepSequence::StepSequence (StepSequencer& s, size_t cnt, size_t nsteps, Temporal::Beats const & step_size, Temporal::Beats const & bar_size, int r)
: _sequencer (s)
, _index (cnt)
, _channel (0)
, _root (r)
, _mode (MusicalMode::IonianMajor)
@@ -522,7 +523,7 @@ StepSequencer::StepSequencer (TempoMap& tmap, size_t nseqs, size_t nsteps, Tempo
, requests (64)
{
for (size_t n = 0; n < nseqs; ++n) {
_sequences.push_back (new StepSequence (*this, nsteps, step_size, bar_size, notenum));
_sequences.push_back (new StepSequence (*this, n, nsteps, step_size, bar_size, notenum));
notenum++;
}
}