Skip to content

Commit

Permalink
Merge pull request #40 from mebitek/feature_47
Browse files Browse the repository at this point in the history
Feature 47
  • Loading branch information
mebitek authored Jan 23, 2024
2 parents 42e0550 + 2b98495 commit f4240c8
Show file tree
Hide file tree
Showing 40 changed files with 792 additions and 312 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- name: Update
run: sudo apt update
- name: Install Dependencies
run: sudo apt install -y libsdl2-dev libasound2-dev mesa-common-dev python3 python3-dev
- name: Setup
Expand All @@ -60,7 +62,7 @@ jobs:
run: (cd build/sim/release && make test)
sim_wasm:
name: Simulation Platform (WebAssembly)
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Changelog

## v 0.1.46 (4 January 2024)
# v0.1.4.47 (24 January 2024)
- launchpad circuit mode improvements
- random generator: random seed just on init method
- patter follow
- 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
- song sync with clock
Expand Down
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +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 the table below.

| Change | Documentation | Status |
|-------------------- |-------------------------------------------------- | ------ |
| Increase Retrigger | Increase rettrigger value to 8 per step | done |
| import Metro like seq PR | [link](https://github.com/westlicht/performer/pull/259) | done |
| import trigger negative offset PR | [link](https://github.com/westlicht/performer/pull/234) | done |
| extend probability steps | turning the encoder results in more steps (min is 6.3%) | done |
| add various curves | add curve half and double curves and missing reverse curves| done |
| double click to toggle gates| double click on step to toggle a gate when editing layer other than gate| done |
| cv outs on stop clock| cv outs remain to the last value when clock is stopped | done |
| random seed | each time we enter the random generator page a random seed is picked | done |
| import curve improvements | merge jackpf shape improvements [link](https://github.com/jackpf/performer/blob/master/doc/improvements/shape-improvements.md) | done |
| import MIDI improvements | merge jackpf MIDI improvements [link](https://github.com/jackpf/performer/blob/master/doc/improvements/midi-improvements.md) | done |
| import Noise Redection Improvements | merge jackpf Noise Reduction improvements [link](https://github.com/jackpf/performer/blob/master/doc/improvements/noise-reduction.md) | done |
| track names | edit track name for each track (note, curve, midi) | done |
| quick tie notes | select a step range, then click page+16 to tie notes. set gate lenght to max (except last selected step) and set note as first note selected | done |
| launchpad follow mode| pressing button 6 access to follow mode per track | done |
| launchpad slide | in slide mode now we can see the active gates | done |
| improve solo perform | toggle solo feature and launchpad integration: pessing button 6 + A-H will toggle solo | done |
| launchpad color theme | in user settings there is an option to chose between classic and blue launchapd color schema | done |
| launchpad circuit note editor | novation circuit style note editor. on user setting you can choose it or leave the classic one | done |
| step edit ui enhancements | on track and curve step edit pages, turning the encoder cycles through available layers of the selected tab | done |
| Sync Song | sync song play with starting clock | done |
| Perform Page | encoder to change tempo on Performer page | done
| Metro like seq | add new repeat modes | done |

[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) and the [WIKI page ](https://github.com/mebitek/performer/wiki)

--- original documentation below ---

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 @@ -7,7 +7,7 @@
#define CONFIG_VERSION_NAME "PER|FORMER SEQUENCER"
#define CONFIG_VERSION_MAJOR 0
#define CONFIG_VERSION_MINOR 1
#define CONFIG_VERSION_REVISION 46
#define CONFIG_VERSION_REVISION 47

// Task priorities
#define CONFIG_DRIVER_TASK_PRIORITY 5
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sequencer/engine/SequenceState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void SequenceState::advanceAligned(int absoluteStep, Types::RunMode runMode, int
calculateNextStepAligned(absoluteStep, runMode, firstStep, lastStep, rng);
}

_iteration = _nextIteration;
//_iteration = _nextIteration;
_prevStep = _step;
_step = _nextStep;
_nextStep = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sequencer/engine/generators/RandomGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RandomGenerator::RandomGenerator(SequenceBuilder &builder, Params &params) :
Generator(builder),
_params(params)
{
init();
update();
}

const char *RandomGenerator::paramName(int index) const {
Expand Down
2 changes: 1 addition & 1 deletion src/apps/sequencer/engine/generators/RandomGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RandomGenerator : public Generator {
uint16_t seed = 0;
uint8_t smooth = 0;
int8_t bias = 0;
uint8_t scale = 10;
uint8_t scale = 5;
};

RandomGenerator(SequenceBuilder &builder, Params &params);
Expand Down
24 changes: 24 additions & 0 deletions src/apps/sequencer/model/BaseTrack.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once

#include "Config.h"
#include "Types.h"
#include "NoteSequence.h"
#include "Serialize.h"
#include "Routing.h"
#include "FileDefs.h"
#include "core/utils/StringUtils.h"


class BaseTrack {
public:
static constexpr size_t NameLength = FileHeader::NameLength;

// trackName
const char *name() const { return _name; }
void setName(const char *name) {
StringUtils::copy(_name, name, sizeof(_name));
}

protected:
char _name[NameLength + 1];
};
84 changes: 84 additions & 0 deletions src/apps/sequencer/model/BaseTrackPatternFollow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#pragma once

#include "Config.h"
#include "Types.h"
#include "NoteSequence.h"
#include "Serialize.h"
#include "Routing.h"
#include "FileDefs.h"
#include "core/utils/StringUtils.h"


class BaseTrackPatternFollow {
public:

// patternFollow
Types::PatternFollow patternFollow() const { return _patternFollow; }
void setPatternFollow(const Types::PatternFollow patternFollow) {
_patternFollow = ModelUtils::clampedEnum(patternFollow);
}

void setPatternFollow(bool trackDisplay, bool trackLP) {

if (trackDisplay && trackLP) {
setPatternFollow(Types::PatternFollow::DispAndLP);
return;
}

else if (trackDisplay) {
setPatternFollow(Types::PatternFollow::Display);
return;
}

else if (trackLP) {
setPatternFollow(Types::PatternFollow::LaunchPad);
return;
}

setPatternFollow(Types::PatternFollow::Off);

return;
}

void setPatternFollowDisplay(bool trackDisplay) {
const auto pattern_follow = patternFollow();

const bool lp_tracking =
(pattern_follow == Types::PatternFollow::LaunchPad ||
pattern_follow == Types::PatternFollow::DispAndLP);

setPatternFollow(trackDisplay, lp_tracking);
}

bool isPatternFollowDisplayOn() {
const auto pattern_follow = patternFollow();

return (pattern_follow == Types::PatternFollow::Display ||
pattern_follow == Types::PatternFollow::DispAndLP);
}


void togglePatternFollowDisplay() {
const auto pattern_follow = patternFollow();

const bool disp_tracking = isPatternFollowDisplayOn();

const bool lp_tracking =
(pattern_follow == Types::PatternFollow::LaunchPad ||
pattern_follow == Types::PatternFollow::DispAndLP);

setPatternFollow(not disp_tracking, lp_tracking);
}

void editPatternFollow(int value, bool shift) {
setPatternFollow(ModelUtils::adjustedEnum(patternFollow(), value));
}

void printPatternFollow(StringBuilder &str) const {
str(Types::patternFollowName(patternFollow()));
}

protected:
Types::PatternFollow _patternFollow;

};
14 changes: 3 additions & 11 deletions src/apps/sequencer/model/CurveTrack.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include "BaseTrack.h"
#include "BaseTrackPatternFollow.h"
#include "Config.h"
#include "Types.h"
#include "CurveSequence.h"
Expand All @@ -8,14 +10,12 @@
#include "FileDefs.h"
#include "core/utils/StringUtils.h"

class CurveTrack {
class CurveTrack : public BaseTrack, public BaseTrackPatternFollow {
public:
//----------------------------------------
// Types
//----------------------------------------

static constexpr size_t NameLength = FileHeader::NameLength;

typedef std::array<CurveSequence, CONFIG_PATTERN_COUNT + CONFIG_SNAPSHOT_COUNT> CurveSequenceArray;

// FillMode
Expand Down Expand Up @@ -62,13 +62,6 @@ class CurveTrack {
// Properties
//----------------------------------------

// name
// name
const char *name() const { return _name; }
void setName(const char *name) {
StringUtils::copy(_name, name, sizeof(_name));
}

// playMode

Types::PlayMode playMode() const { return _playMode; }
Expand Down Expand Up @@ -241,7 +234,6 @@ class CurveTrack {
}

int8_t _trackIndex = -1;
char _name[NameLength + 1];
Types::PlayMode _playMode;
FillMode _fillMode;
MuteMode _muteMode;
Expand Down
11 changes: 2 additions & 9 deletions src/apps/sequencer/model/MidiCvTrack.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "BaseTrack.h"
#include "Config.h"
#include "Types.h"
#include "MidiConfig.h"
Expand All @@ -12,12 +13,11 @@

#include "core/math/Math.h"

class MidiCvTrack {
class MidiCvTrack : public BaseTrack {
public:
//----------------------------------------
// Types
//----------------------------------------
static constexpr size_t NameLength = FileHeader::NameLength;
enum class VoiceSignal : uint8_t { Pitch, Velocity, Pressure };

enum class VoiceConfig : uint8_t {
Expand Down Expand Up @@ -62,12 +62,6 @@ class MidiCvTrack {
// Properties
//----------------------------------------

// trackName
const char *name() const { return _name; }
void setName(const char *name) {
StringUtils::copy(_name, name, sizeof(_name));
}

// source

const MidiSourceConfig &source() const { return _source; }
Expand Down Expand Up @@ -269,7 +263,6 @@ class MidiCvTrack {
}

int8_t _trackIndex = -1;
char _name[NameLength + 1];
MidiSourceConfig _source;
uint8_t _voices;
VoiceConfig _voiceConfig;
Expand Down
1 change: 1 addition & 0 deletions src/apps/sequencer/model/NoteSequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ void NoteSequence::Step::read(VersionedSerializedReader &reader) {
void NoteSequence::writeRouted(Routing::Target target, int intValue, float floatValue) {
switch (target) {
case Routing::Target::Scale:
//_model._selectedScale[0] = intValue;
setScale(intValue, true);
break;
case Routing::Target::RootNote:
Expand Down
50 changes: 46 additions & 4 deletions src/apps/sequencer/model/NoteSequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <cstdint>
#include <initializer_list>
#include <iostream>
#include <map>

class NoteSequence {
public:
Expand Down Expand Up @@ -271,18 +272,52 @@ class NoteSequence {
// scale

int scale() const { return _scale.get(isRouted(Routing::Target::Scale)); }
void setScale(int scale, bool routed = false) {
_scale.set(clamp(scale, -1, Scale::Count - 1), routed);
void setScale(int s, bool routed = false, int defaultScale = 0) {

auto &pScale = selectedScale(defaultScale);

_scale.set(clamp(s, -1, Scale::Count - 1), routed);

auto &aScale = selectedScale(s);

if (pScale == aScale) {
return;
}

if (s != -1 && aScale.isChromatic() && pScale.isChromatic() > 0) {
for (int i = 0; i < 64; ++i) {

auto pStep = _steps[i];

int rN = pScale.noteIndex(pStep.note(), selectedRootNote(0));
if (rN > 0) {
if (aScale.isNotePresent(rN)) {
int pNoteIndex = aScale.getNoteIndex(rN);
step(i).setNote(pNoteIndex);
} else {
// search nearest note
while (!aScale.isNotePresent(rN)) {
rN--;
}
int pNoteIndex = aScale.getNoteIndex(rN);
step(i).setNote(pNoteIndex);
}
}


}
}

}

int indexedScale() const { return scale() + 1; }
void setIndexedScale(int index) {
setScale(index - 1);
}

void editScale(int value, bool shift) {
void editScale(int value, bool shift, int defaultScale = 0) {
if (!isRouted(Routing::Target::Scale)) {
setScale(scale() + value);
setScale(value, false, defaultScale);
}
}

Expand Down Expand Up @@ -473,6 +508,10 @@ class NoteSequence {
void write(VersionedSerializedWriter &writer) const;
void read(VersionedSerializedReader &reader);

int trackIndex() {
return _trackIndex;
}

private:
void setTrackIndex(int trackIndex) { _trackIndex = trackIndex; }

Expand All @@ -489,6 +528,9 @@ class NoteSequence {

int8_t _trackIndex = -1;
Routable<int8_t> _scale;

int _previousScale;

Routable<int8_t> _rootNote;
Routable<uint16_t> _divisor;
uint8_t _resetMeasure;
Expand Down
Loading

0 comments on commit f4240c8

Please sign in to comment.