Loading...
Searching...
No Matches
Inheritance diagram for Patternist::pattern_node:

Classes

struct  display_state
 
struct  event
 A message waiting for the tick its musical position falls in. More...
 
struct  grid_point
 The grid points of a tick, across the divisions the lanes walk. More...
 
struct  hit
 
struct  lane_state
 
struct  step_controls
 

Public Types

enum class  event_kind : uint8_t { accent , note_off , note_on , slide }
 

Public Member Functions

std::string label () const noexcept override
 
const Pattern & pattern () const noexcept
 
void request_pattern (int idx) noexcept
 Ask for a pattern: it takes effect at the next quantification point.
 
void release_all (int64_t timestamp) noexcept
 
void reset_lanes () noexcept
 
void replace_patterns (std::vector< Pattern > &list) noexcept
 Takes a new list, swapped in so that the old one is freed elsewhere.
 
void set_channel (uint8_t c) noexcept
 
void set_switch_rate (float v) noexcept
 
void set_density (float v) noexcept
 
void set_velocity_scale (float v) noexcept
 
void set_swing (float v) noexcept
 
void set_ratchet_scale (float v) noexcept
 
void set_pace_offset (float v) noexcept
 
void set_repeat_time (ossia::vec2f v) noexcept
 
void read_controls () noexcept
 
void transport () noexcept
 The playhead moved somewhere else: the next tick follows it.
 
void run (const ossia::token_request &tk, ossia::exec_state_facade st) noexcept override
 
void publish () noexcept
 
void play_steps (const ossia::token_request &tk, int64_t tick_start, double samplesratio, bool rewinding, bool timed, int64_t from_offset, int64_t to_offset) noexcept
 
void reposition (const ossia::token_request &tk) noexcept
 
void resync (const ossia::token_request &tk) noexcept
 
void release_removed_lanes (int64_t date) noexcept
 A lane that is gone cannot release what it held: release it here.
 
void play_lane (const Pattern &pat, int i, double position, double unit, bool rewinding, bool timed, bool solo, int64_t date) noexcept
 
double note_shift (const Lane &l, int step) noexcept
 
void update_repeat_time () noexcept
 
template<typename Gate >
int hits (const StepParams &p, double unit, bool scheduled, std::array< hit, max_ratchet > &out, Gate &&gate_of) const noexcept
 
double swing_delay (int step) const noexcept
 Every other step is delayed, by up to half a step.
 
bool condition_holds (const StepParams &p, int64_t pass) const noexcept
 
float control_value (const Pattern &pat, int i, int64_t n) noexcept
 
step_controls controls_at (const Pattern &pat, double grid, bool scheduled) noexcept
 
void play_step (const Pattern &pat, int i, int step, int64_t pass, double grid, double at, double unit, bool scheduled, bool solo, int64_t date) noexcept
 
void push_event (event e, bool scheduled, int64_t date) noexcept
 
void flush_immediate (int64_t date) noexcept
 Every lane's releases go before any lane strikes.
 
void emit_until (const ossia::token_request &tk, int64_t tick_start, double samplesratio, double end) noexcept
 
void emit (const event &e, int64_t date) noexcept
 
void apply_switch (int64_t date) noexcept
 
void all_notes_off () noexcept override
 

Static Public Member Functions

static bool finite (float v) noexcept
 
static int64_t points_between (double from, double to, double bar_line, double bar, int division) noexcept
 
static double timing (const Lane &l, int step, double shift) noexcept
 Where a step's note starts, in steps from its grid point.
 

Public Attributes

ossia::value_inlet pattern_select
 
ossia::value_inlet switch_quantification
 
ossia::value_inlet fill_in
 
ossia::value_inlet density_in
 
ossia::value_inlet velocity_in
 
ossia::value_inlet swing_in
 
ossia::value_inlet ratchet_in
 
ossia::value_inlet pace_in
 
ossia::value_inlet repeat_time_in
 
ossia::midi_outlet out
 
ossia::value_outlet accent_out
 
ossia::value_outlet slide_out
 
std::vector< Pattern > patterns
 
std::array< uint8_t, 128 > in_flight {}
 
int current_pattern {}
 
int pending_pattern {-1}
 Pattern the next quantification point switches to; -1 when nothing waits.
 
double switch_rate {1.}
 A token_request rate: 0 switches at the beginning of the tick.
 
bool fill {}
 
float density {1.f}
 
float velocity_scale {1.f}
 
float swing {0.f}
 
float ratchet_scale {1.f}
 Multiplies every step's ratchet, 1 - 8, fractions included.
 
float pace_offset {0.f}
 Added to every step's pace, -1 - 1.
 
double repeat_time {0.}
 
ossia::vec2f repeat_time_value {0.f, 0.f}
 The time chooser's value: {seconds, 0} or {whole notes, synced}.
 
double tempo {120.}
 
double origin = std::numeric_limits<double>::quiet_NaN()
 
bool transport_requested {}
 
int current = 0
 
int64_t main_played {}
 
std::array< bool, Pattern::maxLanes > resync_lane {}
 
bool resync_main {}
 
int last = -1
 
uint8_t channel {1}
 
uint8_t in_flight_channel {1}
 
bool release_pending {}
 
bool mustStop {}
 
std::array< lane_state, max_lanes > lanes {}
 
std::array< event, max_events > queue {}
 
int queue_size {}
 
uint32_t next_order {}
 
std::array< event, 2 *max_lanes > immediate {}
 What a step without musical time sends, all at the same date.
 
int immediate_size {}
 
std::array< grid_point, max_points > points {}
 
std::minstd_rand rng {0x5eed}
 
std::array< int16_t, max_lanes > control_lanes {}
 The accent and slide lanes of the pattern playing.
 
int control_lane_count {}
 
display_state shown
 

Static Public Attributes

static constexpr int max_ratchet = 16
 A step's hits once multiplied, held to what a step can still tell apart.
 
static constexpr int max_lanes = Pattern::maxLanes
 
static constexpr int max_events = 4 * max_lanes * (2 * max_ratchet + 1)
 
static constexpr int max_points = 2048
 
static constexpr int release_reserve = 2 * max_lanes
 

Member Enumeration Documentation

◆ event_kind

enum class Patternist::pattern_node::event_kind : uint8_t
strong

At the same position, in this order: an accent is set before the notes it acts on, a slide changes once the note it glides into is struck.

Member Function Documentation

◆ control_value()

float Patternist::pattern_node::control_value ( const Pattern &  pat,
int  i,
int64_t  n 
)
inlinenoexcept

Step n of control lane i: 0 when it does not play, otherwise its accent amount, or its glide time for a slide. Drawn once per step.

◆ emit_until()

void Patternist::pattern_node::emit_until ( const ossia::token_request &  tk,
int64_t  tick_start,
double  samplesratio,
double  end 
)
inlinenoexcept

Sends what is due before musical position end, in order: at the same position a note-off goes before a note-on, so that a note restarted on the step that ends it is heard; then in the order they were pushed.

◆ finite()

static bool Patternist::pattern_node::finite ( float  v)
inlinestaticnoexcept

The controls, from the inlets or from the GUI: each one keeps its value when given something that is not a finite number, and is held to its range otherwise.

◆ note_shift()

double Patternist::pattern_node::note_shift ( const Lane &  l,
int  step 
)
inlinenoexcept

The timing random a whole note moves by, in steps: none when each hit draws its own.

◆ play_lane()

void Patternist::pattern_node::play_lane ( const Pattern &  pat,
int  i,
double  position,
double  unit,
bool  rewinding,
bool  timed,
bool  solo,
int64_t  date 
)
inlinenoexcept

Lane i reaches a point of its grid at musical position position, in quarters; unit is the length of its step in quarters.

◆ play_step()

void Patternist::pattern_node::play_step ( const Pattern &  pat,
int  i,
int  step,
int64_t  pass,
double  grid,
double  at,
double  unit,
bool  scheduled,
bool  solo,
int64_t  date 
)
inlinenoexcept

Plays step step of lane i at musical position at, its point on the grid being grid. When scheduled is false everything goes out at once, at date.

◆ play_steps()

void Patternist::pattern_node::play_steps ( const ossia::token_request &  tk,
int64_t  tick_start,
double  samplesratio,
bool  rewinding,
bool  timed,
int64_t  from_offset,
int64_t  to_offset 
)
inlinenoexcept

Plays the steps of the current pattern whose offset in the tick falls in [from_offset; to_offset[.

◆ points_between()

static int64_t Patternist::pattern_node::points_between ( double  from,
double  to,
double  bar_line,
double  bar,
int  division 
)
inlinestaticnoexcept

Points of a grid of division per whole note in [from; to[, the grid starting again at every bar line: bars of bar quarters, one of them at bar_line. The same points get_quantification_dates() walks.

◆ reposition()

void Patternist::pattern_node::reposition ( const ossia::token_request &  tk)
inlinenoexcept

After a transport: the counters as if the pattern had played from its origin up to where the tick starts.

◆ resync()

void Patternist::pattern_node::resync ( const ossia::token_request &  tk)
inlinenoexcept

Puts the lanes flagged by replace_patterns where they would be had they always played: a lane on the pattern's grid on its count, another on the points of its own grid since the origin. What they hold carries on.

Member Data Documentation

◆ current

int Patternist::pattern_node::current = 0

Step of the pattern's own grid, which the lanes without a length or a division of their own follow.

◆ in_flight

std::array<uint8_t, 128> Patternist::pattern_node::in_flight {}

For each note, how many of the lanes' notes are sounding on it: two lanes on one note share a single voice, released by the last of them.

◆ main_played

int64_t Patternist::pattern_node::main_played {}

Points of the pattern's own grid since the origin: current before the modulo, so that a new length starts from where the pattern is.

◆ max_events

constexpr int Patternist::pattern_node::max_events = 4 * max_lanes * (2 * max_ratchet + 1)
staticconstexpr

Once half full, what is due goes out before the next grid point, so the queue holds at most the steps around the one playing: the one before (late offset and swing delay it by up to a step), this one and the next (scheduled early), with room to spare - each a note-on and a note-off per hit, and a release.

◆ origin

double Patternist::pattern_node::origin = std::numeric_limits<double>::quiet_NaN()

Musical position the step counters count from: where the pattern started playing, or switched. NaN until the first tick with musical time.

◆ release_reserve

constexpr int Patternist::pattern_node::release_reserve = 2 * max_lanes
staticconstexpr

The queue keeps room for releases: when it is that full, a note that could not be released later is not struck at all.

◆ repeat_time

double Patternist::pattern_node::repeat_time {0.}

When above 0, the steps that ratchet repeat every so many quarters instead of dividing the step by their ratchet.

◆ resync_lane

std::array<bool, Pattern::maxLanes> Patternist::pattern_node::resync_lane {}

Set when the list changes under a playing pattern: lanes that are new or changed rate, and the pattern's own counter when its length or rate changed, join on the next tick where they would be had they always played.

◆ transport_requested

bool Patternist::pattern_node::transport_requested {}

Set by a transport: the next tick moves the step counters to where the playhead landed.


The documentation for this class was generated from the following file: