Remove nll feature from webaudio example

This commit is contained in:
Alex Crichton 2018-08-19 14:42:25 -07:00
parent d4297ad2d3
commit 305ecb7910

View File

@ -1,5 +1,3 @@
#![feature(nll)]
extern crate wasm_bindgen;
extern crate web_sys;
@ -45,13 +43,20 @@ impl FmOsc {
// TODO, how to throw from a constructor?
let ctx = web_sys::AudioContext::new().unwrap();
let primary;
let fm_osc;
let gain;
let fm_gain;
{
let base: &BaseAudioContext = ctx.as_ref();
// create our web audio objects
let primary = base.create_oscillator().unwrap();
let fm_osc = base.create_oscillator().unwrap();
let gain = base.create_gain().unwrap();
let fm_gain = base.create_gain().unwrap();
primary = base.create_oscillator().unwrap();
fm_osc = base.create_oscillator().unwrap();
gain = base.create_gain().unwrap();
fm_gain = base.create_gain().unwrap();
}
// some initial settings:
primary.set_type(OscillatorType::Sine);
@ -63,10 +68,12 @@ impl FmOsc {
// Create base class references:
{
let primary_node: &AudioNode = primary.as_ref();
let gain_node: &AudioNode = gain.as_ref();
let fm_osc_node: &AudioNode = fm_osc.as_ref();
let fm_gain_node: &AudioNode = fm_gain.as_ref();
let base: &BaseAudioContext = ctx.as_ref();
let destination = base.destination();
let destination_node: &AudioNode = destination.as_ref();
@ -84,6 +91,7 @@ impl FmOsc {
// Connect the FM oscillator to the frequency parameter of the main oscillator, so that the
// FM node can modulate its frequency
fm_gain_node.connect_with_destination_and_output_using_destination(&primary.frequency());
}
// start the oscillators!