diff options
author | Alex Touchet <alextouchet@outlook.com> | 2018-09-11 09:06:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 09:06:42 -0700 |
commit | 025b5550fc6f1fd74605b09973ffc606dae7432c (patch) | |
tree | 7dfb1026318b7a0135273b667d3f44e3ee8d737d /components/script/dom/audiobuffer.rs | |
parent | 9a7e1d17f0e054cb9f7eaafeee943a2ec5bc5e26 (diff) | |
parent | 049eb6887e29d8409b1dfe55bc31803f1c3220da (diff) | |
download | servo-025b5550fc6f1fd74605b09973ffc606dae7432c.tar.gz servo-025b5550fc6f1fd74605b09973ffc606dae7432c.zip |
Merge branch 'master' into tidy
Diffstat (limited to 'components/script/dom/audiobuffer.rs')
-rw-r--r-- | components/script/dom/audiobuffer.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/components/script/dom/audiobuffer.rs b/components/script/dom/audiobuffer.rs index 8cf3bb6648f..761bcde404b 100644 --- a/components/script/dom/audiobuffer.rs +++ b/components/script/dom/audiobuffer.rs @@ -64,7 +64,7 @@ impl AudioBuffer { number_of_channels: u32, length: u32, sample_rate: f32, - initial_data: Option<&[f32]>, + initial_data: Option<&[Vec<f32>]>, ) -> DomRoot<AudioBuffer> { let buffer = AudioBuffer::new_inherited(number_of_channels, length, sample_rate); let buffer = reflect_dom_object(Box::new(buffer), global, AudioBufferBinding::Wrap); @@ -93,20 +93,19 @@ impl AudioBuffer { } #[allow(unsafe_code)] - pub fn set_channels(&self, initial_data: Option<&[f32]>) { + pub fn set_channels(&self, initial_data: Option<&[Vec<f32>]>) { let global = self.global(); let cx = global.get_cx(); let _ac = JSAutoCompartment::new(cx, global.reflector().get_jsobject().get()); let chans = self.js_channels.borrow_mut(); for channel in 0..self.number_of_channels { rooted!(in (cx) let mut array = ptr::null_mut::<JSObject>()); - let offset = (channel * self.length) as usize; match initial_data { Some(data) => { let _ = unsafe { Float32Array::create( cx, - CreateWith::Slice(&data[offset..offset + (self.length as usize) - 1]), + CreateWith::Slice(data[channel as usize].as_slice()), array.handle_mut(), ) }; |