pub struct StreamingBuffer { /* private fields */ }Expand description
Streaming buffer for long sounds. Does not support random access.
Implementations§
Source§impl StreamingBuffer
impl StreamingBuffer
Sourcepub const STREAM_SAMPLE_COUNT: usize = 44100
pub const STREAM_SAMPLE_COUNT: usize = 44100
Defines amount of samples per channel which each streaming buffer will use for internal buffer.
Sourcepub fn new(source: DataSource) -> Result<Self, DataSource>
pub fn new(source: DataSource) -> Result<Self, DataSource>
Creates new streaming buffer using given data source. May fail if data source has unsupported format
or it has corrupted data. Length of internal generic buffer cannot be changed but can be fetched from
StreamingBuffer::STREAM_SAMPLE_COUNT
§Notes
This function will return Err if data source is Raw. It makes no sense to stream raw data which
is already loaded into memory. Use Generic source instead!
Methods from Deref<Target = GenericBuffer>§
Sourcepub fn external_data_path(&self) -> &Path
pub fn external_data_path(&self) -> &Path
In case if buffer was created from file, this method returns file name. Can be useful for serialization needs where you just need to know which file needs to be reloaded from disk when you loading a saved game.
Sourcepub fn set_external_data_path(&mut self, path: PathBuf) -> PathBuf
pub fn set_external_data_path(&mut self, path: PathBuf) -> PathBuf
Sets new path for external data source.
Sourcepub fn samples_mut(&mut self) -> &mut [f32]
pub fn samples_mut(&mut self) -> &mut [f32]
Returns mutable reference to an array with samples that could be modified.
Sourcepub fn channel_count(&self) -> usize
pub fn channel_count(&self) -> usize
Returns exact amount of channels in the buffer.
Sourcepub fn sample_rate(&self) -> usize
pub fn sample_rate(&self) -> usize
Returns sample rate of the buffer.
Trait Implementations§
Source§impl Debug for StreamingBuffer
impl Debug for StreamingBuffer
Source§impl Default for StreamingBuffer
impl Default for StreamingBuffer
Source§fn default() -> StreamingBuffer
fn default() -> StreamingBuffer
Source§impl Deref for StreamingBuffer
impl Deref for StreamingBuffer
Source§impl DerefMut for StreamingBuffer
impl DerefMut for StreamingBuffer
Source§impl Visit for StreamingBuffer
impl Visit for StreamingBuffer
Auto Trait Implementations§
impl Freeze for StreamingBuffer
impl !RefUnwindSafe for StreamingBuffer
impl Send for StreamingBuffer
impl Sync for StreamingBuffer
impl Unpin for StreamingBuffer
impl UnsafeUnpin for StreamingBuffer
impl !UnwindSafe for StreamingBuffer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> PropertyValue for Twhere
T: Debug + 'static,
impl<T> PropertyValue for Twhere
T: Debug + 'static,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.