mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-08 04:36:45 +01:00
add const PPQ = 96
This commit is contained in:
parent
0da54db5e0
commit
11a66ee415
5 changed files with 28 additions and 20 deletions
|
|
@ -10,10 +10,20 @@ pub type MIDIMessage = Vec<u8>;
|
|||
pub type MIDIChunk = [Vec<MIDIMessage>];
|
||||
|
||||
/// Contains all phrases in the project
|
||||
pub struct PhrasePool {
|
||||
pub struct PhrasePool<E: Engine> {
|
||||
_engine: PhantomData<E>,
|
||||
pub phrases: Vec<Arc<RwLock<Option<Phrase>>>>,
|
||||
}
|
||||
|
||||
impl<E: Engine> PhrasePool<E> {
|
||||
pub fn new () -> Self {
|
||||
Self {
|
||||
_engine: Default::default(),
|
||||
phrases: vec![Arc::new(RwLock::new(Some(Phrase::default())))]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Contains state for viewing and editing a phrase
|
||||
pub struct PhraseEditor<E: Engine> {
|
||||
_engine: PhantomData<E>,
|
||||
|
|
@ -52,16 +62,16 @@ pub struct Phrase {
|
|||
}
|
||||
|
||||
impl Default for Phrase {
|
||||
fn default () -> Self { Self::new("", 0, None) }
|
||||
fn default () -> Self { Self::new("", false, 0, None) }
|
||||
}
|
||||
|
||||
impl Phrase {
|
||||
pub fn new (name: &str, length: usize, notes: Option<PhraseData>) -> Self {
|
||||
pub fn new (name: &str, loop_on: bool, length: usize, notes: Option<PhraseData>) -> Self {
|
||||
Self {
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
length,
|
||||
notes: notes.unwrap_or(vec![Vec::with_capacity(16);length]),
|
||||
loop_on: true,
|
||||
loop_on,
|
||||
loop_start: 0,
|
||||
loop_length: length,
|
||||
percussive: true,
|
||||
|
|
@ -246,7 +256,7 @@ impl<E: Engine> Sequencer<E> {
|
|||
keys_in: [false;128],
|
||||
keys_out: [false;128],
|
||||
now: 0,
|
||||
ppq: 96,
|
||||
ppq: PPQ,
|
||||
transport: None,
|
||||
note_axis: FixedAxis { start: 12, point: Some(36) },
|
||||
time_axis: ScaledAxis { start: 0, scale: 24, point: Some(0) },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue