Skip to content

Commit

Permalink
Merge pull request #119 from mebitek/feature-31
Browse files Browse the repository at this point in the history
Feature 31
  • Loading branch information
mebitek authored May 30, 2024
2 parents 5fb1045 + 5d3441e commit 28c1dbc
Show file tree
Hide file tree
Showing 34 changed files with 65 additions and 42 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Changelog

# v0.3.1 ()
# v0.3.1 (29 May 2024)
- issue #111 - fix program change
- issue #112 - fix launchpad follow mode
- issue #115 - follow pattern is now saved on project
- issue #116 - fix F1-F5 shortcut
- issue #117 - fix curve cv problem
- issue #118 - fix file stack overflow
- fix fill display
- fix stochastic reseed behaviour
- fix arp track copy pattern


# v0.3.0 (02 May 2024)
- Arpeggiator Track
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sequencer/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define CONFIG_ENGINE_TASK_STACK_SIZE 4096
#define CONFIG_USBH_TASK_STACK_SIZE 2048
#define CONFIG_UI_TASK_STACK_SIZE 4096
#define CONFIG_FILE_TASK_STACK_SIZE 2048
#define CONFIG_FILE_TASK_STACK_SIZE 4096
#define CONFIG_PROFILER_TASK_STACK_SIZE 2048

// Settings flash storage
Expand Down
9 changes: 6 additions & 3 deletions src/apps/sequencer/engine/CurveTrackEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,14 @@ void CurveTrackEngine::updateOutput(uint32_t relativeTick, uint32_t divisor) {
}

bool CurveTrackEngine::isRecording() const {
return
bool val =
_engine.state().recording() &&
_curveTrack.curveCvInput() != Types::CurveCvInput::Off;
//&&
//_model.project().selectedTrackIndex() == _track.trackIndex();

if (!_model.project().useMultiCvRec()) {
return val && _model.project().selectedTrackIndex() == _track.trackIndex();
}
return val;
}

void CurveTrackEngine::updateRecordValue() {
Expand Down
6 changes: 5 additions & 1 deletion src/apps/sequencer/engine/StochasticEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,11 @@ void StochasticEngine::triggerStep(uint32_t tick, uint32_t divisor, bool forNext
int sum =0;
for (int i = 0; i < 12; i++) {
if (sequence.step(i).gate()) {
probability.insert(probability.end(), StochasticStep(i, clamp(sequence.step(i).noteVariationProbability() + _stochasticTrack.noteProbabilityBias(), -1, StochasticSequence::NoteVariationProbability::Max)));
int prob = sequence.step(i).noteVariationProbability() + _stochasticTrack.noteProbabilityBias();
if (sequence.step(i).noteVariationProbability()==0) {
prob = 0;
}
probability.insert(probability.end(), StochasticStep(i, clamp(prob, -1, StochasticSequence::NoteVariationProbability::Max)));
} else {
probability.insert(probability.end(), StochasticStep(i, 0));
}
Expand Down
2 changes: 2 additions & 0 deletions src/apps/sequencer/model/ArpTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void ArpTrack::write(VersionedSerializedWriter &writer) const {
writer.write(_noteProbabilityBias.base);
writer.write(_arpeggiator);
writeArray(writer, _sequences);
writer.write(_patternFollow);
}

void ArpTrack::read(VersionedSerializedReader &reader) {
Expand Down Expand Up @@ -94,4 +95,5 @@ void ArpTrack::read(VersionedSerializedReader &reader) {
}

readArray(reader, _sequences);
reader.read(_patternFollow, ProjectVersion::Version39);
}
3 changes: 3 additions & 0 deletions src/apps/sequencer/model/ClipBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void ClipBoard::copyPattern(int patternIndex) {
case Track::TrackMode::Logic:
pattern.sequences[trackIndex].data.logic = track.logicTrack().sequence(patternIndex);
break;
case Track::TrackMode::Arp:
pattern.sequences[trackIndex].data.arp = track.arpTrack().sequence(patternIndex);
break;
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/apps/sequencer/model/CurveTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void CurveTrack::write(VersionedSerializedWriter &writer) const {
writer.write(_min);
writer.write(_max);
writeArray(writer, _sequences);
writer.write(_patternFollow);
}

void CurveTrack::read(VersionedSerializedReader &reader) {
Expand All @@ -79,4 +80,5 @@ void CurveTrack::read(VersionedSerializedReader &reader) {
reader.read(_min, ProjectVersion::Version37);
reader.read(_max, ProjectVersion::Version37);
readArray(reader, _sequences);
reader.read(_patternFollow, ProjectVersion::Version39);
}
2 changes: 2 additions & 0 deletions src/apps/sequencer/model/LogicTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void LogicTrack::write(VersionedSerializedWriter &writer) const {
writer.write(_inputTrack2);
writer.write(_detailedView);
writeArray(writer, _sequences);
writer.write(_patternFollow);
}

void LogicTrack::read(VersionedSerializedReader &reader) {
Expand Down Expand Up @@ -105,4 +106,5 @@ void LogicTrack::read(VersionedSerializedReader &reader) {
}

readArray(reader, _sequences);
reader.read(_patternFollow, ProjectVersion::Version39);
}
2 changes: 2 additions & 0 deletions src/apps/sequencer/model/NoteTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void NoteTrack::write(VersionedSerializedWriter &writer) const {
writer.write(_logicTrack);
writer.write(_logicTrackInput);
writeArray(writer, _sequences);
writer.write(_patternFollow);
}

void NoteTrack::read(VersionedSerializedReader &reader) {
Expand Down Expand Up @@ -101,4 +102,5 @@ void NoteTrack::read(VersionedSerializedReader &reader) {
}

readArray(reader, _sequences);
reader.read(_patternFollow, ProjectVersion::Version39);
}
3 changes: 3 additions & 0 deletions src/apps/sequencer/model/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void Project::clear() {
setCvGateInput(Types::CvGateInput::Off);
setCurveCvInput(Types::CurveCvInput::Off);
setResetCvOnStop(true);
setUseMultiCvRec(true);

_clockSetup.clear();

Expand Down Expand Up @@ -135,6 +136,7 @@ void Project::write(VersionedSerializedWriter &writer) const {
writer.write(_selectedTrackIndex);
writer.write(_selectedPatternIndex);
writer.write(_resetCvOnStop);
writer.write(_useMultiCv);

writer.writeHash();

Expand Down Expand Up @@ -190,6 +192,7 @@ bool Project::read(VersionedSerializedReader &reader) {
reader.read(_selectedTrackIndex);
reader.read(_selectedPatternIndex);
reader.read(_resetCvOnStop, ProjectVersion::Version38);
reader.read(_useMultiCv, ProjectVersion::Version39);

bool success = reader.checkHash();
if (success) {
Expand Down
18 changes: 18 additions & 0 deletions src/apps/sequencer/model/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,23 @@ class Project {
_resetCvOnStop = enabled;
}

// use multi cv recording

bool useMultiCvRec() const { return _useMultiCv;}

void editUseMultiCvRec(int value) {
_useMultiCv = value == 1;
}

void printUseMultiCvRec(StringBuilder &str) const {
if (_useMultiCv) str("On");
else str("Off");
}

void setUseMultiCvRec(bool enabled) {
_useMultiCv = enabled;
}

// selectedTrackIndex

int selectedTrackIndex() const { return _selectedTrackIndex; }
Expand Down Expand Up @@ -693,6 +710,7 @@ class Project {
uint8_t _recordDelay;

bool _resetCvOnStop;
bool _useMultiCv;

int _selectedTrackIndex = 0;
int _selectedPatternIndex = 0;
Expand Down
3 changes: 3 additions & 0 deletions src/apps/sequencer/model/ProjectVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ enum ProjectVersion {
// add arp track and malekko integration
Version38 = 38,

// add pattern follow
Version39 = 39,


// automatically derive latest version
Last,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,8 @@ void LaunchpadController::sequenceButton(const Button &button, ButtonAction acti
}
auto &sequence = _project.selectedStochasticSequence();
sequence.step(selectedNote).toggleGate();
sequence.step(selectedNote).setNoteOctave(selectedOctave); }
sequence.step(selectedNote).setNoteOctave(selectedOctave);
}
break;
}
case Track::TrackMode::Arp: {
Expand Down
8 changes: 8 additions & 0 deletions src/apps/sequencer/ui/model/ProjectListModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class ProjectListModel : public RoutableListModel {
StepsToStop,
RecordDelay,
ResetCvOnStop,
MultiCvRec,
//CurveCvInput,
Last
};
Expand All @@ -104,6 +105,7 @@ class ProjectListModel : public RoutableListModel {
case StepsToStop: return "Steps to stop";
case RecordDelay: return "Record Delay";
case ResetCvOnStop: return "Reset CV";
case MultiCvRec: return "Multi CV rec";
//case CurveCvInput: return "Curve CV Input";
case Last: break;
}
Expand Down Expand Up @@ -166,6 +168,9 @@ class ProjectListModel : public RoutableListModel {
case ResetCvOnStop:
_project.printResetCvOnStop(str);
break;
case MultiCvRec:
_project.printUseMultiCvRec(str);
break;
//case CurveCvInput:
// _project.printCurveCvInput(str);
// break;
Expand Down Expand Up @@ -223,6 +228,9 @@ class ProjectListModel : public RoutableListModel {
case ResetCvOnStop:
_project.editResetCvOnStop(value);
break;
case MultiCvRec:
_project.editUseMultiCvRec(value);
break;
//case CurveCvInput:
// _project.editCurveCvInput(value, shift);
// break;
Expand Down
1 change: 0 additions & 1 deletion src/apps/sequencer/ui/pages/ArpSequenceEditPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ void ArpSequenceEditPage::keyPress(KeyPressEvent &event) {
auto &sequence = _project.selectedArpSequence();
auto &track = _project.selectedTrack().arpTrack();

functionShortcuts(event);

if (key.isContextMenu()) {
contextShow();
Expand Down
1 change: 0 additions & 1 deletion src/apps/sequencer/ui/pages/ArpSequencePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ void ArpSequencePage::updateLeds(Leds &leds) {
void ArpSequencePage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

if (key.shiftModifier() && event.count() == 2) {
saveContextShow();
Expand Down
1 change: 0 additions & 1 deletion src/apps/sequencer/ui/pages/CurveSequenceEditPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ void CurveSequenceEditPage::keyPress(KeyPressEvent &event) {
auto &sequence = _project.selectedCurveSequence();
auto &track = _project.selectedTrack().curveTrack();

functionShortcuts(event);

if (key.isContextMenu()) {
contextShow();
Expand Down
1 change: 0 additions & 1 deletion src/apps/sequencer/ui/pages/CurveSequencePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ void CurveSequencePage::updateLeds(Leds &leds) {
void CurveSequencePage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

if (key.shiftModifier() && event.count() == 2) {
saveContextShow();
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/LayoutPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ void LayoutPage::draw(Canvas &canvas) {
void LayoutPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

//functionShortcuts(event);

if (key.isFunction()) {
if (key.function() == 4 && _mode == Mode::TrackMode && !_trackModeListModel.sameAsProject(_project)) {
_manager.pages().confirmation.show("ARE YOU SURE?", [this] (bool result) {
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/LogicSequenceEditPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ void LogicSequenceEditPage::keyPress(KeyPressEvent &event) {
auto &sequence = _project.selectedLogicSequence();
auto &track = _project.selectedTrack().logicTrack();

functionShortcuts(event);

if (key.isContextMenu()) {
contextShow();
event.consume();
Expand Down
1 change: 0 additions & 1 deletion src/apps/sequencer/ui/pages/LogicSequencePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ void LogicSequencePage::updateLeds(Leds &leds) {
void LogicSequencePage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

if (key.shiftModifier() && event.count() == 2) {
saveContextShow();
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/MidiOutputPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ void MidiOutputPage::draw(Canvas &canvas) {
void MidiOutputPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

//functionShortcuts(event);

if (key.isFunction()) {
switch (Function(key.function())) {
case Function::Prev:
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/NoteSequenceEditPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,6 @@ void NoteSequenceEditPage::keyPress(KeyPressEvent &event) {
auto &sequence = _project.selectedNoteSequence();
auto &track = _project.selectedTrack().noteTrack();

functionShortcuts(event);

auto &trackEngine = _engine.selectedTrackEngine().as<NoteTrackEngine>();

if (key.isContextMenu()) {
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/NoteSequencePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ void NoteSequencePage::updateLeds(Leds &leds) {
void NoteSequencePage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

if (key.shiftModifier() && event.count() == 2) {
saveContextShow();
event.consume();
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/OverviewPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,6 @@ void OverviewPage::keyUp(KeyEvent &event) {
void OverviewPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

if (key.isGlobal()) {
return;
}
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/PatternPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,6 @@ void PatternPage::keyUp(KeyEvent &event) {

void PatternPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

auto &playState = _project.playState();

Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/PerformerPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ void PerformerPage::keyUp(KeyEvent &event) {
void PerformerPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

auto &playState = _project.playState();

if (key.pageModifier()) {
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/ProjectPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ void ProjectPage::keyPress(KeyPressEvent &event) {
return;
}

//functionShortcuts(event);

if (key.pageModifier()) {
// easter egg
if (key.is(Key::Step15)) {
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/RoutingPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ void RoutingPage::draw(Canvas &canvas) {
void RoutingPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

//functionShortcuts(event);

if (edit() && selectedRow() == int(RouteListModel::Item::Tracks) && key.isTrack()) {
_editRoute.toggleTrack(key.track());
event.consume();
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/SongPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ void SongPage::keyPress(KeyPressEvent &event) {
auto &playState = _project.playState();
uint8_t selectedTracks = pressedTrackKeys();

functionShortcuts(event);

if (key.isContextMenu()) {
contextShow();
event.consume();
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/StochasticSequenceEditPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ void StochasticSequenceEditPage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();
auto &sequence = _project.selectedStochasticSequence();

functionShortcuts(event);

if (key.isContextMenu()) {
contextShow();
event.consume();
Expand Down
2 changes: 0 additions & 2 deletions src/apps/sequencer/ui/pages/StochasticSequencePage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ void StochasticSequencePage::updateLeds(Leds &leds) {
void StochasticSequencePage::keyPress(KeyPressEvent &event) {
const auto &key = event.key();

functionShortcuts(event);

if (key.isContextMenu()) {
contextShow();
event.consume();
Expand Down
Loading

0 comments on commit 28c1dbc

Please sign in to comment.