#[non_exhaustive]pub enum AudioSource {
Read(PathBuf),
Download(Uri, Option<Txt>),
Data(AudioHash, IpcBytes, AudioDataFormat),
Audio(Var<AudioTrack>),
}Expand description
The different sources of an audio resource.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Read(PathBuf)
A path to an audio file in the file system.
Audio equality is defined by the path, a copy of the audio in another path is a different audio.
Download(Uri, Option<Txt>)
A uri to an audio resource downloaded using HTTP GET with an optional HTTP ACCEPT string.
If the ACCEPT line is not given, all audio formats supported by the view-process backend are accepted.
Audio equality is defined by the URI and ACCEPT string.
Data(AudioHash, IpcBytes, AudioDataFormat)
Shared reference to bytes for an encoded or decoded audio.
Audio equality is defined by the hash, it is usually the hash of the bytes but it does not need to be.
Inside AUDIOS the reference to the bytes is held only until the audio finishes decoding.
Audio(Var<AudioTrack>)
Already resolved (loaded or loading) audio.
The audio is passed-through, not cached.
Implementations§
Source§impl AudioSource
impl AudioSource
Sourcepub fn from_data(data: IpcBytes, format: AudioDataFormat) -> AudioSource
pub fn from_data(data: IpcBytes, format: AudioDataFormat) -> AudioSource
New source from data.
Sourcepub fn hash128(&self, options: &AudioOptions) -> Option<AudioHash>
pub fn hash128(&self, options: &AudioOptions) -> Option<AudioHash>
Returns the audio hash, unless the source is AudioTrack.
Sourcepub fn hash128_data(data_hash: AudioHash, options: &AudioOptions) -> AudioHash
pub fn hash128_data(data_hash: AudioHash, options: &AudioOptions) -> AudioHash
Compute hash for a borrowed Data audio.
Sourcepub fn hash128_read(path: &Path, options: &AudioOptions) -> AudioHash
pub fn hash128_read(path: &Path, options: &AudioOptions) -> AudioHash
Compute hash for a borrowed Read path.
Sourcepub fn hash128_download(
uri: &Uri,
accept: &Option<Txt>,
options: &AudioOptions,
) -> AudioHash
pub fn hash128_download( uri: &Uri, accept: &Option<Txt>, options: &AudioOptions, ) -> AudioHash
Compute hash for a borrowed Download URI and HTTP-ACCEPT.
Trait Implementations§
Source§impl Clone for AudioSource
impl Clone for AudioSource
Source§fn clone(&self) -> AudioSource
fn clone(&self) -> AudioSource
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AudioSource
impl Debug for AudioSource
Source§impl From<&[u8]> for AudioSource
impl From<&[u8]> for AudioSource
Source§impl From<&Path> for AudioSource
impl From<&Path> for AudioSource
Source§fn from(path: &Path) -> AudioSource
fn from(path: &Path) -> AudioSource
Source§impl From<&str> for AudioSource
impl From<&str> for AudioSource
Source§impl<F> From<(&[u8], F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
impl<F> From<(&[u8], F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
Source§fn from(_: (&[u8], F)) -> AudioSource
fn from(_: (&[u8], F)) -> AudioSource
From encoded data of known format.
Source§impl<F, const N: usize> From<(&[u8; N], F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
impl<F, const N: usize> From<(&[u8; N], F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
Source§impl<F> From<(IpcBytes, F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
impl<F> From<(IpcBytes, F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
Source§fn from(_: (IpcBytes, F)) -> AudioSource
fn from(_: (IpcBytes, F)) -> AudioSource
From encoded data of known format.
Source§impl<F> From<(Vec<u8>, F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
impl<F> From<(Vec<u8>, F)> for AudioSourcewhere
F: Into<AudioDataFormat>,
Source§impl From<IpcBytes> for AudioSource
impl From<IpcBytes> for AudioSource
Source§impl From<PathBuf> for AudioSource
impl From<PathBuf> for AudioSource
Source§fn from(path: PathBuf) -> AudioSource
fn from(path: PathBuf) -> AudioSource
Source§impl From<String> for AudioSource
impl From<String> for AudioSource
Source§fn from(s: String) -> AudioSource
fn from(s: String) -> AudioSource
Same as conversion from &str.
Source§impl From<Txt> for AudioSource
impl From<Txt> for AudioSource
Source§fn from(s: Txt) -> AudioSource
fn from(s: Txt) -> AudioSource
Same as conversion from &str.
Source§impl From<Uri> for AudioSource
impl From<Uri> for AudioSource
Source§fn from(uri: Uri) -> AudioSource
fn from(uri: Uri) -> AudioSource
Source§impl From<Var<AudioTrack>> for AudioSource
impl From<Var<AudioTrack>> for AudioSource
Source§fn from(audio: Var<AudioTrack>) -> AudioSource
fn from(audio: Var<AudioTrack>) -> AudioSource
Source§impl IntoVar<AudioSource> for &[u8]
impl IntoVar<AudioSource> for &[u8]
Source§impl IntoVar<AudioSource> for &Path
impl IntoVar<AudioSource> for &Path
fn into_var(self) -> Var<AudioSource>
Source§impl IntoVar<AudioSource> for &str
impl IntoVar<AudioSource> for &str
Source§impl<F> IntoVar<AudioSource> for (&[u8], F)where
F: Into<AudioDataFormat>,
impl<F> IntoVar<AudioSource> for (&[u8], F)where
F: Into<AudioDataFormat>,
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl<F, const N: usize> IntoVar<AudioSource> for (&[u8; N], F)where
F: Into<AudioDataFormat>,
impl<F, const N: usize> IntoVar<AudioSource> for (&[u8; N], F)where
F: Into<AudioDataFormat>,
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl<F> IntoVar<AudioSource> for (IpcBytes, F)where
F: Into<AudioDataFormat>,
impl<F> IntoVar<AudioSource> for (IpcBytes, F)where
F: Into<AudioDataFormat>,
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl IntoVar<AudioSource> for (Uri, &'static str)
impl IntoVar<AudioSource> for (Uri, &'static str)
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From (URI, HTTP-ACCEPT).
Source§impl<F> IntoVar<AudioSource> for (Vec<u8>, F)where
F: Into<AudioDataFormat>,
impl<F> IntoVar<AudioSource> for (Vec<u8>, F)where
F: Into<AudioDataFormat>,
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
From encoded data of known format.
Source§impl IntoVar<AudioSource> for IpcBytes
impl IntoVar<AudioSource> for IpcBytes
Source§impl IntoVar<AudioSource> for PathBuf
impl IntoVar<AudioSource> for PathBuf
fn into_var(self) -> Var<AudioSource>
Source§impl IntoVar<AudioSource> for String
impl IntoVar<AudioSource> for String
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
Same as conversion from &str.
Source§impl IntoVar<AudioSource> for Txt
impl IntoVar<AudioSource> for Txt
Source§fn into_var(self) -> Var<AudioSource>
fn into_var(self) -> Var<AudioSource>
Same as conversion from &str.
Source§impl IntoVar<AudioSource> for Uri
impl IntoVar<AudioSource> for Uri
fn into_var(self) -> Var<AudioSource>
Source§impl IntoVar<AudioSource> for Var<AudioTrack>
impl IntoVar<AudioSource> for Var<AudioTrack>
fn into_var(self) -> Var<AudioSource>
Source§impl PartialEq for AudioSource
impl PartialEq for AudioSource
impl IntoValue<AudioSource> for &[u8]
impl<const N: usize> IntoValue<AudioSource> for &[u8; N]
impl IntoValue<AudioSource> for &Path
impl IntoValue<AudioSource> for &str
impl<F> IntoValue<AudioSource> for (&[u8], F)where
F: Into<AudioDataFormat>,
impl<F, const N: usize> IntoValue<AudioSource> for (&[u8; N], F)where
F: Into<AudioDataFormat>,
impl<F> IntoValue<AudioSource> for (IpcBytes, F)where
F: Into<AudioDataFormat>,
impl IntoValue<AudioSource> for (Uri, &'static str)
impl<F> IntoValue<AudioSource> for (Vec<u8>, F)where
F: Into<AudioDataFormat>,
impl IntoValue<AudioSource> for IpcBytes
impl IntoValue<AudioSource> for PathBuf
impl IntoValue<AudioSource> for String
impl IntoValue<AudioSource> for Txt
impl IntoValue<AudioSource> for Uri
impl IntoValue<AudioSource> for Var<AudioTrack>
impl IntoValue<AudioSource> for Vec<u8>
Auto Trait Implementations§
impl !Freeze for AudioSource
impl !RefUnwindSafe for AudioSource
impl Send for AudioSource
impl Sync for AudioSource
impl !Unpin for AudioSource
impl !UnwindSafe for AudioSource
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more