pub struct GenericBuffer { /* private fields */ }Expand description
Generic sound buffer that contains decoded samples and allows random access.
Implementations§
Source§impl GenericBuffer
impl GenericBuffer
Sourcepub fn new(source: DataSource) -> Result<GenericBuffer, DataSource>
pub fn new(source: DataSource) -> Result<GenericBuffer, DataSource>
Creates new generic buffer from specified data source. May fail if data source has unsupported format, corrupted, etc.
§Notes
DataSource::RawStreaming is not supported with generic buffers, use streaming buffer
instead!
Data source with raw samples must have sample count multiple of channel count, otherwise this
function will return Err.
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 GenericBuffer
impl Debug for GenericBuffer
Source§impl Default for GenericBuffer
impl Default for GenericBuffer
Source§fn default() -> GenericBuffer
fn default() -> GenericBuffer
Auto Trait Implementations§
impl Freeze for GenericBuffer
impl RefUnwindSafe for GenericBuffer
impl Send for GenericBuffer
impl Sync for GenericBuffer
impl Unpin for GenericBuffer
impl UnwindSafe for GenericBuffer
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for 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.