-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quick start guide screen, refactor desync workaround
- Loading branch information
1 parent
556775e
commit c6d344d
Showing
8 changed files
with
174 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use std::time::Duration; | ||
|
||
use rodio::{Sample, Source}; | ||
|
||
pub struct FramelessSource<I> | ||
where | ||
I: Source, | ||
I::Item: Sample, | ||
{ | ||
inner: I, | ||
} | ||
|
||
impl<I> FramelessSource<I> | ||
where | ||
I: Source, | ||
I::Item: Sample, | ||
{ | ||
pub fn new(source: I) -> Self { | ||
return Self { inner: source }; | ||
} | ||
} | ||
|
||
impl<I> From<I> for FramelessSource<I> | ||
where | ||
I: Source, | ||
I::Item: Sample, | ||
{ | ||
fn from(value: I) -> Self { | ||
return Self::new(value); | ||
} | ||
} | ||
|
||
impl<I> Iterator for FramelessSource<I> | ||
where | ||
I: Source, | ||
I::Item: Sample, | ||
{ | ||
type Item = I::Item; | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
return self.inner.next(); | ||
} | ||
} | ||
|
||
impl<I> Source for FramelessSource<I> | ||
where | ||
I: Source, | ||
I::Item: Sample, | ||
{ | ||
fn current_frame_len(&self) -> Option<usize> { | ||
return None; | ||
} | ||
|
||
fn channels(&self) -> u16 { | ||
return self.inner.channels(); | ||
} | ||
|
||
fn sample_rate(&self) -> u32 { | ||
return self.inner.sample_rate(); | ||
} | ||
|
||
fn total_duration(&self) -> Option<Duration> { | ||
return self.inner.total_duration(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters