Skip to content

Commit

Permalink
Merge pull request #71 from mebitek/feature_20
Browse files Browse the repository at this point in the history
Feature 20
  • Loading branch information
mebitek authored Feb 29, 2024
2 parents 364d336 + f2eb27e commit 3a49feb
Show file tree
Hide file tree
Showing 87 changed files with 7,481 additions and 257 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
days-before-issue-stale: 10
days-before-issue-close: 10
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
stale-issue-message: "This issue is stale because it has been open for 10 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 10 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 28 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

# v0.2.0 (29 Febrary 2024)
- Stochastic Track
- global octave modifier
- launchpad control general octave
- loop and lock loop
- reseed
- rest probability 2,4,8 steps
- global gate length modifier
- clipboard actions
- generators
- Load/Save Sequence to use a sequence library (fast switch on loading)
- Launchpad Performance Mode `8`+`3` (`2`+`GRID2` -> quick set lenght sequence; `2`+`GRID1` -> overview page )
- Submenu shortcuts (double click F[1-5] to enter project, layout, routing, midi out, user scale)
- Page buttons on launchpad circuit note edit
- Extend gate Lenght to 4bits [@glibersat](https://github.com/glibersat)
- Multi Curve CV Recording (cv curve input has been moved in track page)
- quick change octave shortuct (step+F[1-5]) 1-5V
- quick gate accent launchpad control on gate page and circuit page (`7`+`GRID`)
- add steps to stop feature in project page. Once started when the engine reaches the steps to stop value the clock will stop.
- improved overview page. quick edit tracks
-

> **testers** :
>
> mebitek, Guillaume Libersat, Nick Ansell, XponentOne, dblu2000, hales2488, XQSTKRPS, KittenVillage, Andreas Hieninger
# v0.1.4.48 (30 January 2024)
- Moving steps in a sequence
- INIT by step selected
Expand All @@ -15,15 +41,15 @@
# v0.1.4.47 (24 January 2024)
- launchpad circuit mode improvements
- random generator: random seed just on init method
- patter follow
- patter follow [@glibersat](https://github.com/glibersat)
- pattern chain quick shortcut from pattern page
- scale edit: scales are changed only if the encoder is pressed
- on scale change the sequence notes are changed according to the previous scale. if a note in the previous scale is also present in the new scale the value is preeserved. if it is not present the nearest note in the new scale will be selected
- launchpad follows pattern in song mode

## v0.1.46 (4 January 2024)

- UI note edit page reaggment
- UI note edit page reaggment [@aclangor](https://github.com/aclangor)
- song sync with clock
- fix reverse shape feature
- add new shapes
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a fork of the [original repository](https://github.com/westlicht/perform

[Full updated documentation](https://mebitek.github.io/performer/manual/)

To find out more about improvements changes, check [changelog](https://github.com/mebitek/performer/blob/master/CHANGELOG.md) and the [WIKI page ](https://github.com/mebitek/performer/wiki)
To find out more about improvements changes, check [changelog](https://github.com/mebitek/performer/blob/master/CHANGELOG.md)

--- original documentation below ---

Expand Down
5 changes: 5 additions & 0 deletions src/apps/sequencer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(sources
engine/MidiLearn.cpp
engine/MidiOutputEngine.cpp
engine/NoteTrackEngine.cpp
engine/StochasticEngine.cpp
engine/RoutingEngine.cpp
engine/SequenceState.cpp
# engine/generators
Expand All @@ -38,6 +39,8 @@ set(sources
model/ModelUtils.cpp
model/NoteSequence.cpp
model/NoteTrack.cpp
model/StochasticSequence.cpp
model/StochasticTrack.cpp
model/PlayState.cpp
model/Project.cpp
model/Routing.cpp
Expand Down Expand Up @@ -84,6 +87,8 @@ set(sources
ui/pages/MonitorPage.cpp
ui/pages/NoteSequenceEditPage.cpp
ui/pages/NoteSequencePage.cpp
ui/pages/StochasticSequencePage.cpp
ui/pages/StochasticSequenceEditPage.cpp
ui/pages/OverviewPage.cpp
ui/pages/PatternPage.cpp
ui/pages/PerformerPage.cpp
Expand Down
4 changes: 2 additions & 2 deletions src/apps/sequencer/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#define CONFIG_VERSION_MAGIC 0xfadebabe
#define CONFIG_VERSION_NAME "PER|FORMER SEQUENCER"
#define CONFIG_VERSION_MAJOR 0
#define CONFIG_VERSION_MINOR 1
#define CONFIG_VERSION_REVISION 48
#define CONFIG_VERSION_MINOR 2
#define CONFIG_VERSION_REVISION 0

// Task priorities
#define CONFIG_DRIVER_TASK_PRIORITY 5
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sequencer/engine/Clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ void Clock::outputTick(uint32_t tick) {

if (tick == _output.nextTick) {
uint32_t divisor = _output.divisor;
uint32_t clockDuration = std::max(uint32_t(10), uint32_t(_masterBpm * _ppqn * _output.pulse / (60 * 1000)));
uint32_t clockDuration = std::max(uint32_t(1), uint32_t(_masterBpm * _ppqn * _output.pulse / (60 * 1000)));

_output.nextTickOn = applySwing(_output.nextTick);
_output.nextTickOff = std::min(_output.nextTickOn + clockDuration, applySwing(_output.nextTick + divisor) - 1);
Expand Down
12 changes: 9 additions & 3 deletions src/apps/sequencer/engine/CurveTrackEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ TrackEngine::TickResult CurveTrackEngine::tick(uint32_t tick) {
uint32_t resetDivisor = sequence.resetMeasure() * _engine.measureDivisor();
uint32_t relativeTick = resetDivisor == 0 ? tick : tick % resetDivisor;


if (int(_model.project().stepsToStop()) != 0 && int(relativeTick / divisor) == int(_model.project().stepsToStop())) {
_engine.clockStop();
}

// handle reset measure
if (relativeTick == 0) {
reset();
Expand Down Expand Up @@ -232,14 +237,15 @@ void CurveTrackEngine::updateOutput(uint32_t relativeTick, uint32_t divisor) {
bool CurveTrackEngine::isRecording() const {
return
_engine.state().recording() &&
_model.project().curveCvInput() != Types::CurveCvInput::Off &&
_model.project().selectedTrackIndex() == _track.trackIndex();
_curveTrack.curveCvInput() != Types::CurveCvInput::Off;
//&&
//_model.project().selectedTrackIndex() == _track.trackIndex();
}

void CurveTrackEngine::updateRecordValue() {
auto &sequence = *_sequence;
const auto &range = Types::voltageRangeInfo(sequence.range());
auto curveCvInput = _model.project().curveCvInput();
auto curveCvInput = _curveTrack.curveCvInput();

switch (curveCvInput) {
case Types::CurveCvInput::Cv1:
Expand Down
5 changes: 5 additions & 0 deletions src/apps/sequencer/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@ void Engine::updateTrackSetups() {
track.midiCvTrack().setName(str);
}
break;
case Track::TrackMode::Stochastic:
trackEngine = trackContainer.create<StochasticEngine>(*this, _model, track, linkedTrackEngine);
if (sizeof(track.stochasticTrack().name()==0)) {
track.stochasticTrack().setName(str);
}
break;
case Track::TrackMode::Last:
break;
Expand Down
3 changes: 2 additions & 1 deletion src/apps/sequencer/engine/Engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "CvOutput.h"
#include "RoutingEngine.h"
#include "MidiOutputEngine.h"
#include "StochasticEngine.h"
#include "MidiPort.h"
#include "MidiLearn.h"
#include "CvGateToMidiConverter.h"
Expand All @@ -33,7 +34,7 @@

class Engine : private Clock::Listener {
public:
typedef Container<NoteTrackEngine, CurveTrackEngine, MidiCvTrackEngine> TrackEngineContainer;
typedef Container<NoteTrackEngine, CurveTrackEngine, MidiCvTrackEngine, StochasticEngine> TrackEngineContainer;
typedef std::array<TrackEngineContainer, CONFIG_TRACK_COUNT> TrackEngineContainerArray;
typedef std::array<TrackEngine *, CONFIG_TRACK_COUNT> TrackEngineArray;
typedef std::array<UpdateReducer<os::time::ms(25)>, CONFIG_TRACK_COUNT> TrackUpdateReducerArray;
Expand Down
29 changes: 22 additions & 7 deletions src/apps/sequencer/engine/NoteTrackEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ TrackEngine::TickResult NoteTrackEngine::tick(uint32_t tick) {
uint32_t resetDivisor = sequence.resetMeasure() * _engine.measureDivisor();
uint32_t relativeTick = resetDivisor == 0 ? tick : tick % resetDivisor;

if (int(_model.project().stepsToStop()) != 0 && int(relativeTick / divisor) == int(_model.project().stepsToStop())) {
_engine.clockStop();
}

// handle reset measure
if (relativeTick == 0) {
reset();
Expand Down Expand Up @@ -173,23 +177,34 @@ TrackEngine::TickResult NoteTrackEngine::tick(uint32_t tick) {
_freeRelativeTick = 0;
}
if (relativeTick == 0) {

if (_currentStageRepeat == 1) {
_sequenceState.advanceFree(sequence.runMode(), sequence.firstStep(), sequence.lastStep(), rng);
_sequenceState.calculateNextStepFree(
sequence.runMode(), sequence.firstStep(), sequence.lastStep(), rng);
}

recordStep(tick, divisor);
const auto &step = sequence.step(_sequenceState.step());
bool isLastStageStep = ((int) (step.stageRepeats()+1) - (int) _currentStageRepeat) <= 0;
bool isLastStageStep = ((int) step.stageRepeats() - (int) _currentStageRepeat) <= 0;

if (step.gateOffset() >= 0) {
triggerStep(tick, divisor);
}

triggerStep(tick+divisor, divisor);
if (!isLastStageStep && step.gateOffset() < 0) {
triggerStep(tick + divisor, divisor, false);
}

if (isLastStageStep
&& sequence.step(_sequenceState.nextStep()).gateOffset() < 0) {
triggerStep(tick + divisor, divisor, true);
}

if (isLastStageStep) {
_currentStageRepeat = 1;
_currentStageRepeat = 1;
} else {
_currentStageRepeat++;
}

}
break;
case Types::PlayMode::Last:
Expand Down Expand Up @@ -390,7 +405,7 @@ void NoteTrackEngine::triggerStep(uint32_t tick, uint32_t divisor, bool forNextS
break;
case NoteSequence::StageRepeatMode::Random:
srand((unsigned int)time(NULL));
int rndMode = 0 + ( std::rand() % ( 6 - 0 + 1 ) );
int rndMode = rng.nextRange(6);
switch (rndMode) {
case 0:
break;
Expand Down Expand Up @@ -467,7 +482,7 @@ void NoteTrackEngine::recordStep(uint32_t tick, uint32_t divisor) {
step.setNoteVariationRange(0);
step.setNoteVariationProbability(NoteSequence::NoteVariationProbability::Max);
step.setCondition(Types::Condition::Off);
step.setStageRepeats(1);


stepWritten = true;
};
Expand Down
93 changes: 16 additions & 77 deletions src/apps/sequencer/engine/SequenceState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,80 +17,21 @@ void SequenceState::reset() {
}

void SequenceState::advanceFree(Types::RunMode runMode, int firstStep, int lastStep, Random &rng) {
ASSERT(firstStep <= lastStep, "invalid first/last step");

_prevStep = _step;

if (_step == -1) {
// first step
switch (runMode) {
case Types::RunMode::Forward:
case Types::RunMode::Pendulum:
case Types::RunMode::PingPong:
_step = firstStep;
break;
case Types::RunMode::Backward:
_step = lastStep;
break;
case Types::RunMode::Random:
case Types::RunMode::RandomWalk:
_step = randomStep(firstStep, lastStep, rng);
break;
case Types::RunMode::Last:
break;
}
} else {
// advance step
_step = clamp(int(_step), firstStep, lastStep);
ASSERT(firstStep <= lastStep, "invalid first/last step");

switch (runMode) {
case Types::RunMode::Forward:
if (_step >= lastStep) {
_step = firstStep;
++_iteration;
} else {
++_step;
}
break;
case Types::RunMode::Backward:
if (_step <= firstStep) {
_step = lastStep;
++_iteration;
} else {
--_step;
}
break;
case Types::RunMode::Pendulum:
case Types::RunMode::PingPong:
if (_direction > 0 && _step >= lastStep) {
_direction = -1;
} else if (_direction < 0 && _step <= firstStep) {
_direction = 1;
++_iteration;
} else {
if (runMode == Types::RunMode::Pendulum) {
_step += _direction;
}
}
if (runMode == Types::RunMode::PingPong) {
_step += _direction;
}
break;
case Types::RunMode::Random:
_step = randomStep(firstStep, lastStep, rng);
break;
case Types::RunMode::RandomWalk:
advanceRandomWalk(firstStep, lastStep, rng);
break;
case Types::RunMode::Last:
break;
}
if (_nextStep < 0) {
calculateNextStepFree(runMode, firstStep, lastStep, rng);
}

_iteration = _nextIteration;
_prevStep = _step;
_step = _nextStep;
_nextStep = -1;
}

void SequenceState::calculateNextStepFree(Types::RunMode runMode, int firstStep, int lastStep, Random &rng) {

if (_nextStep == -1) {
if (_step == -1) {
// first step
switch (runMode) {
case Types::RunMode::Forward:
Expand All @@ -116,35 +57,33 @@ void SequenceState::calculateNextStepFree(Types::RunMode runMode, int firstStep,
case Types::RunMode::Forward:
if (_step >= lastStep) {
_nextStep = firstStep;
++_nextIteration;
_nextIteration = _iteration + 1 ;
} else {
++_nextStep;
_nextStep = _step + 1;
}
_direction = 1;
break;
case Types::RunMode::Backward:
if (_step <= firstStep) {
_nextStep = lastStep;
++_nextIteration;
_nextIteration = _iteration + 1 ;
} else {
--_nextStep;
_nextStep = _step - 1;
}
_direction = -1;
break;
case Types::RunMode::Pendulum:
case Types::RunMode::PingPong:
if (_direction > 0 && _step>= lastStep) {
_direction = -1;
} else if (_direction < 0 && _step <= firstStep) {
_direction = 1;
++_nextIteration;
_nextIteration = _iteration + 1 ;
} else {
if (runMode == Types::RunMode::Pendulum) {
_nextStep += _direction;
_nextStep = _step + _direction;
}
}
if (runMode == Types::RunMode::PingPong) {
_nextStep += _direction;
_nextStep = _step + _direction;
}
break;
case Types::RunMode::Random:
Expand Down
1 change: 1 addition & 0 deletions src/apps/sequencer/engine/SequenceState.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class SequenceState {
public:
int step() const { return _step; }
void setStep(int8_t step) { _step = step; }
int prevStep() const { return _prevStep; }
int nextStep() const { return _nextStep; }
int direction() { return _direction; }
Expand Down
Loading

0 comments on commit 3a49feb

Please sign in to comment.