AlexAegis / AlexAegis/rx_bevy

Feature: CadenceObservable

未关闭
#12 0 条评论 0 个 reaction 已指派 1 人 已被 @AlexAegis 认领 在 GitHub 查看
enhancement
主要语言
Rust
星标
25
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

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
}
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。