mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
add phrase uuids; implement comparisons
This commit is contained in:
parent
5b2b04dcf9
commit
690a8e8f24
6 changed files with 40 additions and 19 deletions
|
|
@ -23,6 +23,7 @@ pub struct PhrasePool<E: Engine> {
|
|||
/// A MIDI sequence.
|
||||
#[derive(Debug)]
|
||||
pub struct Phrase {
|
||||
pub uuid: uuid::Uuid,
|
||||
/// Name of phrase
|
||||
pub name: Arc<RwLock<String>>,
|
||||
/// Temporal resolution in pulses per quarter note
|
||||
|
|
@ -121,6 +122,7 @@ impl Phrase {
|
|||
name: &str, loop_on: bool, length: usize, notes: Option<PhraseData>
|
||||
) -> Self {
|
||||
Self {
|
||||
uuid: uuid::Uuid::new_v4(),
|
||||
name: Arc::new(RwLock::new(name.into())),
|
||||
ppq: PPQ,
|
||||
length,
|
||||
|
|
@ -185,6 +187,12 @@ impl Phrase {
|
|||
}
|
||||
}
|
||||
}
|
||||
impl std::cmp::PartialEq for Phrase {
|
||||
fn eq (&self, other: &Self) -> bool {
|
||||
self.uuid == other.uuid
|
||||
}
|
||||
}
|
||||
impl Eq for Phrase {}
|
||||
impl<E: Engine> PhrasePlayer<E> {
|
||||
pub fn new (name: &str) -> Self {
|
||||
Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue