mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
Create AudioBuffer from BaseAudioContext
This commit is contained in:
parent
cb16c596b3
commit
25a74a75ea
5 changed files with 115 additions and 80 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::audiobuffer::AudioBuffer;
|
||||
use dom::audiodestinationnode::AudioDestinationNode;
|
||||
use dom::bindings::cell::DomRefCell;
|
||||
use dom::bindings::codegen::Bindings::AudioNodeBinding::AudioNodeOptions;
|
||||
|
@ -277,6 +278,14 @@ impl BaseAudioContextMethods for BaseAudioContext {
|
|||
let options = unsafe { GainOptions::empty(window.get_cx()) };
|
||||
GainNode::new(&window, &self, &options)
|
||||
}
|
||||
|
||||
fn CreateBuffer(&self,
|
||||
number_of_channels: u32,
|
||||
length: u32,
|
||||
sample_rate: Finite<f32>) -> DomRoot<AudioBuffer> {
|
||||
let global = self.global();
|
||||
AudioBuffer::new(&global.as_window(), number_of_channels, length, *sample_rate)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<ProcessingState> for AudioContextState {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue