#[repr(C)]
pub struct BaseAudioContext { eventtarget: EventTarget, audio_context_impl: Arc<Mutex<AudioContext>>, destination: MutNullableDom<AudioDestinationNode>, listener: MutNullableDom<AudioListener>, in_flight_resume_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, Result<(), Error>)>>, pending_resume_promises: DomRefCell<Vec<Rc<Promise>>>, decode_resolvers: DomRefCell<HashMap<String, DecodeResolver>>, sample_rate: f32, state: Cell<AudioContextState>, channel_count: u32, }

Fields§

§eventtarget: EventTarget§audio_context_impl: Arc<Mutex<AudioContext>>§destination: MutNullableDom<AudioDestinationNode>§listener: MutNullableDom<AudioListener>§in_flight_resume_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, Result<(), Error>)>>

Resume promises which are soon to be fulfilled by a queued task.

§pending_resume_promises: DomRefCell<Vec<Rc<Promise>>>§decode_resolvers: DomRefCell<HashMap<String, DecodeResolver>>§sample_rate: f32§state: Cell<AudioContextState>

https://webaudio.github.io/web-audio-api/#dom-baseaudiocontext-state Although servo-media already keeps track of the control thread state, we keep a state flag here as well. This is so that we can synchronously throw when trying to do things on the context when the context has just been “closed()”.

§channel_count: u32

Implementations§

source§

impl BaseAudioContext

source

pub fn new_inherited( options: BaseAudioContextOptions, pipeline_id: PipelineId ) -> BaseAudioContext

source

pub fn is_offline(&self) -> bool

Tells whether this is an OfflineAudioContext or not.

source

pub fn audio_context_impl(&self) -> Arc<Mutex<AudioContext>>

source

pub fn destination_node(&self) -> NodeId

source

pub fn listener(&self) -> NodeId

source

pub fn is_allowed_to_start(&self) -> bool

source

fn push_pending_resume_promise(&self, promise: &Rc<Promise>)

source

fn take_pending_resume_promises(&self, result: Result<(), Error>)

Takes the pending resume promises.

The result with which these promises will be fulfilled is passed here and this method returns nothing because we actually just move the current list of pending resume promises to the in_flight_resume_promises_queue field.

Each call to this method must be followed by a call to fulfill_in_flight_resume_promises, to actually fulfill the promises which were taken and moved to the in-flight queue.

source

fn fulfill_in_flight_resume_promises<F>(&self, f: F)where F: FnOnce(),

Fulfills the next in-flight resume promises queue after running a closure.

See the comment on take_pending_resume_promises for why this method does not take a list of promises to fulfill. Callers cannot just pop the front list off of in_flight_resume_promises_queue and later fulfill the promises because that would mean putting #[allow(crown::unrooted_must_root)] on even more functions, potentially hiding actual safety bugs.

source

pub fn control_thread_state(&self) -> ProcessingState

Control thread processing state

source

pub fn set_state_attribute(&self, state: AudioContextState)

Set audio context state

source

pub fn resume(&self)

source§

impl BaseAudioContext

Trait Implementations§

source§

impl BaseAudioContextMethods for BaseAudioContext

source§

fn SampleRate(&self) -> Finite<f32>

source§

fn CurrentTime(&self) -> Finite<f64>

source§

fn State(&self) -> AudioContextState

source§

fn Resume(&self, comp: InRealm<'_>) -> Rc<Promise>

source§

fn Destination(&self) -> Root<Dom<AudioDestinationNode>>

source§

fn Listener(&self) -> Root<Dom<AudioListener>>

source§

fn CreateOscillator(&self) -> Result<Root<Dom<OscillatorNode>>, Error>

source§

fn CreateGain(&self) -> Result<Root<Dom<GainNode>>, Error>

source§

fn CreatePanner(&self) -> Result<Root<Dom<PannerNode>>, Error>

source§

fn CreateAnalyser(&self) -> Result<Root<Dom<AnalyserNode>>, Error>

source§

fn CreateBiquadFilter(&self) -> Result<Root<Dom<BiquadFilterNode>>, Error>

source§

fn CreateStereoPanner(&self) -> Result<Root<Dom<StereoPannerNode>>, Error>

source§

fn CreateConstantSource(&self) -> Result<Root<Dom<ConstantSourceNode>>, Error>

source§

fn CreateChannelMerger( &self, count: u32 ) -> Result<Root<Dom<ChannelMergerNode>>, Error>

source§

fn CreateChannelSplitter( &self, count: u32 ) -> Result<Root<Dom<ChannelSplitterNode>>, Error>

source§

fn CreateBuffer( &self, number_of_channels: u32, length: u32, sample_rate: Finite<f32> ) -> Result<Root<Dom<AudioBuffer>>, Error>

source§

fn GetOnstatechange(&self) -> Option<Rc<EventHandlerNonNull>>

source§

fn SetOnstatechange(&self, listener: Option<Rc<EventHandlerNonNull>>)

source§

fn CreateBufferSource(&self) -> Result<Root<Dom<AudioBufferSourceNode>>, Error>

source§

fn DecodeAudioData( &self, audio_data: CustomAutoRooterGuard<'_, ArrayBuffer>, decode_success_callback: Option<Rc<DecodeSuccessCallback>>, decode_error_callback: Option<Rc<DecodeErrorCallback>>, comp: InRealm<'_> ) -> Rc<Promise>

source§

impl Castable for BaseAudioContext

source§

fn is<T>(&self) -> boolwhere T: DerivedFrom<Self>,

Check whether a DOM object implements one of its deriving interfaces.
source§

fn upcast<T>(&self) -> &Twhere T: Castable, Self: DerivedFrom<T>,

Cast a DOM object upwards to one of the interfaces it derives from.
source§

fn downcast<T>(&self) -> Option<&T>where T: DerivedFrom<Self>,

Cast a DOM object downwards to one of the interfaces it might implement.
source§

impl DomObject for BaseAudioContext

source§

fn reflector(&self) -> &Reflector

Returns the receiver’s reflector.
source§

fn global(&self) -> Root<Dom<GlobalScope>>where Self: Sized,

Returns the global scope of the realm that the DomObject was created in.
source§

impl DomObjectWrap for BaseAudioContext

source§

const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::BaseAudioContextBinding::BaseAudioContext_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::baseaudiocontext::BaseAudioContext>) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::baseaudiocontext::BaseAudioContext>>}

Function pointer to the general wrap function type
source§

impl HasParent for BaseAudioContext

source§

fn as_parent(&self) -> &EventTarget

This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is

§

type Parent = EventTarget

source§

impl IDLInterface for BaseAudioContext

source§

fn derives(class: &'static DOMClass) -> bool

Returns whether the given DOM class derives that interface.
source§

impl MallocSizeOf for BaseAudioContext

source§

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 BaseAudioContext

source§

unsafe fn init_reflector(&self, obj: *mut JSObject)

Initializes the Reflector
source§

impl PartialEq<BaseAudioContext> for BaseAudioContext

source§

fn eq(&self, other: &BaseAudioContext) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl ToJSValConvertible for BaseAudioContext

source§

unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue<'_>)

Convert self to a JSVal. JSAPI failure causes a panic.
source§

impl Traceable for BaseAudioContext

source§

unsafe fn trace(&self, tracer: *mut JSTracer)

Trace self.
source§

impl DerivedFrom<BaseAudioContext> for AudioContext

source§

impl DerivedFrom<BaseAudioContext> for BaseAudioContext

source§

impl DerivedFrom<BaseAudioContext> for OfflineAudioContext

source§

impl DerivedFrom<EventTarget> for BaseAudioContext

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>where F: FnOnce(&Self) -> bool,

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 more
source§

impl<T> MaybeBoxed<Box<T, Global>> for T

source§

fn maybe_boxed(self) -> Box<T, Global>

Convert
source§

impl<T> MaybeBoxed<T> for T

source§

fn maybe_boxed(self) -> T

Convert
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Erased for T

source§

impl<T> ErasedDestructor for Twhere T: 'static,

source§

impl<T> MaybeSendSync for T