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>]> ) -> 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>]> ) -> Root<Dom<AudioBuffer>>
pub fn Constructor( window: &Window, proto: Option<HandleObject<'_>>, options: &AudioBufferOptions ) -> Result<Root<Dom<AudioBuffer>>, Error>
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 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>) -> 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>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::audiobuffer::AudioBuffer>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>) -> 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>) -> 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§unsafe fn init_reflector(&self, obj: *mut JSObject)
unsafe fn init_reflector(&self, obj: *mut JSObject)
Initializes the Reflector
source§impl PartialEq<AudioBuffer> for AudioBuffer
impl PartialEq<AudioBuffer> for AudioBuffer
source§fn eq(&self, other: &AudioBuffer) -> bool
fn eq(&self, other: &AudioBuffer) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToJSValConvertible for AudioBuffer
impl ToJSValConvertible for AudioBuffer
Auto Trait Implementations§
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<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> MaybeBoxed<Box<T, Global>> for T
impl<T> MaybeBoxed<Box<T, Global>> for T
source§fn maybe_boxed(self) -> Box<T, Global>
fn maybe_boxed(self) -> Box<T, Global>
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