sequence rewrite, part 3

portability/boost
zetaPRIME 2019-07-08 05:04:12 -04:00
parent 467c1009ea
commit f173a0e87f
2 changed files with 17 additions and 2 deletions

View File

@ -179,6 +179,7 @@ uint16_t AudioEngine::preview(std::shared_ptr<Project> p, int16_t port, int16_t
for (auto& b : buffer) {
b.clear();
b.reserve(static_cast<size_t>(sampleRate/4));
b.resize(static_cast<size_t>(output->periodSize()));
}
tempo = project->tempo;
@ -562,9 +563,9 @@ void AudioEngine::nextTick() {
}
};
if (!p) return; // no patterns to be found, abort
curTick++;
if (curTick >= p->time.ticksPerRow) advanceRow();
if (p && curTick >= p->time.ticksPerRow) advanceRow();
if (!p) return; // no patterns to be found, abort
// (sample rate / seconds per beat) / ticks per beat
double tickSize = (1.0 * sampleRate / (static_cast<double>(tempo)/60.0)) / (p->time.rowsPerBeat * p->time.ticksPerRow);

View File

@ -227,6 +227,20 @@ MainWindow::MainWindow(QWidget *parent) :
c->seqSel = si+1;
c->commit();
});
menu->addAction("Insert Loop Point", this, [this, idx] {
int si = static_cast<int>(std::min(idx, project->sequence.size()));
auto* c = new ProjectSequencerDeltaCommand(project);
c->seq.insert(c->seq.begin() + si, SequenceEntry::LoopStart);
c->seqSel = si+1;
c->commit();
});
menu->addAction("Insert Loop Trigger", this, [this, idx] {
int si = static_cast<int>(std::min(idx, project->sequence.size()));
auto* c = new ProjectSequencerDeltaCommand(project);
c->seq.insert(c->seq.begin() + si, SequenceEntry::LoopTrigger);
c->seqSel = si+1;
c->commit();
});
if (idx < project->sequence.size()) menu->addAction("Remove", this, [this, idx] {
auto* c = new ProjectSequencerDeltaCommand(project);
c->seq.erase(c->seq.begin() + static_cast<ptrdiff_t>(idx));