rawdio 0.14.0

An Audio Engine, inspired by the Web Audio API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use std::sync::atomic::{AtomicUsize, Ordering};

#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct Id(usize);

impl Id {
    pub fn with_value(value: usize) -> Self {
        Self(value)
    }

    pub fn generate() -> Self {
        static NEXT: AtomicUsize = AtomicUsize::new(0);
        Self(NEXT.fetch_add(1, Ordering::Relaxed))
    }
}