AlexAegis / AlexAegis/rx_bevy

Feature: CadenceObservable

Aberta
#12 0 comentários 0 reações 1 responsável Reivindicada por @AlexAegis Ver no GitHub
enhancement
Linguagem predominante
Rust
Estrelas
25
Forks
2
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

A highly configurable observable that emits a `Cadence` signal.

- No new scheduler task type is required, this is a continous task, and the quantized
cadence is an observable!
- dividing `now` with `tempo` without remainder identifies the current beat

```rs
CadenceOptions {
/// the speed of the smallest timestep
tempo: Duration,
/// Subdivisions define how groups are divided
subdivisions: [4, 4, ...],
/// Whether or not firehose events are enabled at all
/// Firehosing means emitting an empty cadence signal off beat too, in case something has to
/// continuosly re-process something and is okay with filtering out the cadence output.
firehose: bool
}
```

Subdivisions can be used to configure how many events of the base tempo should advance the
next layer of quantization. And the number after advances the next one whenever that much of the previous one had passed.

The layers are really just indices, and since they are subdivisions, it's always true that when we filter for a larger subdivision, ALL the events that would've happen for a smaller subdivision, would've happened. Therefore a single signed integer can describe what beat type we are on.

- `0` means on tempo
- `1` means `x` many tempo emissions have happened
- `2` means `y` many `x` emissions have happened
- `-1` means an emission `x` times per tempo, a subtempo!

Filtering to a beat type is just a matter of comparing two numbers.

```rs
Cadence {
/// None when firehosing
beat: Option
}
```

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.