Struct script::dom::audiobuffer::AudioBuffer
source · #[repr(C)]pub struct AudioBuffer {
reflector_: Reflector,
js_channels: DomRefCell<Vec<HeapBufferSource<Float32>>>,
shared_channels: DomRefCell<Option<AudioBuffer>>,
sample_rate: f32,
length: u32,
duration: f64,
number_of_channels: u32,
}
Expand description
The AudioBuffer keeps its data either in js_channels or in shared_channels if js_channels buffers are detached.
js_channels buffers are (re)attached right before calling GetChannelData and remain attached until its contents are needed by some other API implementation. Follow https://webaudio.github.io/web-audio-api/#acquire-the-content to know in which situations js_channels buffers must be detached.
Fields§
§reflector_: Reflector
§js_channels: DomRefCell<Vec<HeapBufferSource<Float32>>>
Float32Arrays returned by calls to GetChannelData.
Aggregates the data from js_channels.
This is Some<T>
iff the buffers in js_channels are detached.
sample_rate: f32
§length: u32
§duration: f64
§number_of_channels: u32
Implementations§
source§impl AudioBuffer
impl AudioBuffer
pub fn new_inherited( number_of_channels: u32, length: u32, sample_rate: f32, ) -> AudioBuffer
pub fn new( global: &Window, number_of_channels: u32, length: u32, sample_rate: f32, initial_data: Option<&[Vec<f32>]>, can_gc: CanGc, ) -> Root<Dom<AudioBuffer>>
fn new_with_proto( global: &Window, proto: Option<HandleObject<'_>>, number_of_channels: u32, length: u32, sample_rate: f32, initial_data: Option<&[Vec<f32>]>, can_gc: CanGc, ) -> Root<Dom<AudioBuffer>>
fn set_initial_data(&self, initial_data: Option<&[Vec<f32>]>)
fn restore_js_channel_data(&self, cx: JSContext) -> bool
fn acquire_contents(&self) -> Option<ServoMediaAudioBuffer>
pub fn get_channels(&self) -> Ref<'_, Option<ServoMediaAudioBuffer>>
source§impl AudioBuffer
impl AudioBuffer
fn __assert_parent_type(&self)
Trait Implementations§
source§impl AudioBufferMethods for AudioBuffer
impl AudioBufferMethods for AudioBuffer
fn Constructor( window: &Window, proto: Option<HandleObject<'_>>, can_gc: CanGc, options: &AudioBufferOptions, ) -> Result<Root<Dom<AudioBuffer>>, Error>
fn SampleRate(&self) -> Finite<f32>
fn Length(&self) -> u32
fn Duration(&self) -> Finite<f64>
fn NumberOfChannels(&self) -> u32
fn GetChannelData( &self, cx: JSContext, channel: u32, ) -> Result<Float32Array, Error>
fn CopyFromChannel( &self, destination: CustomAutoRooterGuard<'_, Float32Array>, channel_number: u32, start_in_channel: u32, ) -> Result<(), Error>
fn CopyToChannel( &self, source: CustomAutoRooterGuard<'_, Float32Array>, channel_number: u32, start_in_channel: u32, ) -> Result<(), Error>
source§impl DomObject for AudioBuffer
impl DomObject for AudioBuffer
source§impl DomObjectWrap for AudioBuffer
impl DomObjectWrap for AudioBuffer
source§const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::AudioBufferBinding::AudioBuffer_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::audiobuffer::AudioBuffer>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::audiobuffer::AudioBuffer>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::AudioBufferBinding::AudioBuffer_Binding::Wrap as for<'a, 'b> unsafe fn(script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::audiobuffer::AudioBuffer>, script_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::audiobuffer::AudioBuffer>>}
Function pointer to the general wrap function type
source§impl HasParent for AudioBuffer
impl HasParent for AudioBuffer
source§impl IDLInterface for AudioBuffer
impl IDLInterface for AudioBuffer
source§impl MallocSizeOf for AudioBuffer
impl MallocSizeOf for AudioBuffer
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
source§impl MutDomObject for AudioBuffer
impl MutDomObject for AudioBuffer
source§impl PartialEq for AudioBuffer
impl PartialEq for AudioBuffer
source§impl ToJSValConvertible for AudioBuffer
impl ToJSValConvertible for AudioBuffer
source§impl Traceable for AudioBuffer
impl Traceable for AudioBuffer
impl Eq for AudioBuffer
Auto Trait Implementations§
impl !Freeze for AudioBuffer
impl !RefUnwindSafe for AudioBuffer
impl !Send for AudioBuffer
impl !Sync for AudioBuffer
impl Unpin for AudioBuffer
impl UnwindSafe for AudioBuffer
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
Mutably borrows from an owned value. Read more
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
Converts
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>
Converts
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> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert