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YL7NPW4FW3NP45VJZCQIO4UAFOKVLAGNW42HG6OJEBMFFQQC
LJJL6IBEQCCIVNJHDMXA7HBVI3CVROFUSFTXB3CSARCMJFM25Z5AC
U3AGOL3TWWIL2JW4DZBFD2VSCYHW4IXBXHM6HQWHH2SJHT5TEX5AC
MKB2A5XCWBZO2E6QFE6PD36LF3IGMJCGJB5TGMRAPSKCKHS75ISAC
fn add_track_with_sample_rate<T: Resource>(&mut self, sample_rate: f64) -> &mut Self {
self.insert_resource(Track::<T> {
fn add_track_with_sample_rate<T: Resource, N: ArrayLength>(
&mut self,
sample_rate: f64,
) -> &mut Self {
self.insert_resource(Track::<T, N> {
self.sample.store(sample.to_bits(), Ordering::Release);
for i in 0..(N::to_usize() - 1) {
self.samples[i].swap(
self.samples[i + 1].load(Ordering::Acquire),
Ordering::AcqRel,
);
}
self.samples[N::to_usize() - 1].store(sample.to_bits(), Ordering::Release);
fn sample(&self) -> f32 {
let sample_bits = self.sample.load(Ordering::Acquire);
f32::from_bits(sample_bits)
fn samples(&self) -> GenericArray<f32, N> {
<GenericArray<_, N>>::clone(&self.samples)
.map(|bits| f32::from_bits(bits.load(Ordering::Acquire)))
fn rms(&self) -> f32 {
let rms_bits = self.rms.load(Ordering::Acquire);
f32::from_bits(rms_bits)
fn rms(&self) -> GenericArray<f32, N> {
<GenericArray<_, N>>::clone(&self.rms)
.map(|bits| f32::from_bits(bits.load(Ordering::Acquire)))
}
fn empty_atomics() -> GenericArray<Arc<AtomicU32>, N> {
GenericArray::generate(|_| Arc::new(AtomicU32::new(0.0f32.to_bits())))
pub fn sample(&self) -> (f32, f32) {
(
self.trackable.left_channel.sample(),
self.trackable.right_channel.sample(),
)
pub fn samples(&self) -> GenericArray<(f32, f32), N> {
let left_samples = self.trackable.left_channel.samples();
let right_samples = self.trackable.right_channel.samples();
left_samples.zip(right_samples, |l, r| (l, r))
pub fn rms(&self) -> (f32, f32) {
(
self.trackable.left_channel.rms(),
self.trackable.right_channel.rms(),
)
pub fn rms(&self) -> GenericArray<(f32, f32), N> {
let left_rms = self.trackable.left_channel.rms();
let right_rms = self.trackable.right_channel.rms();
left_rms.zip(right_rms, |l, r| (l, r))
const SAMPLES_TO_KEEP: usize = 512;
let sample_pairs_len = sample_pairs.len();
// Fill up them sample_pairs
if sample_pairs_len < SAMPLES_TO_KEEP {
sample_pairs.extend((sample_pairs_len..SAMPLES_TO_KEEP).map(|_| (0.0, 0.0)))
}
// Update main track data
sample_pairs.pop_front();
sample_pairs.push_back(track.sample());