Re: [dev-servo] Mozilla Servo Media - Implementing WebAudio Nodes

2018-11-17 Thread Avanthikaa Ravichandran
Hi,
So I tried removing Copy from the OscillatorNodeOptions type but after
removing it, the other files that create the context do not allow the
options to be used since they need a copy to create the context object.
Refer the following code:
let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options),
Default::default());
This line throws an error for options when I remove copy.

To fix this, I modified it as
let osc1 =
context.create_node(AudioNodeInit::OscillatorNode(options.clone()),
Default::default());
However, for channelsum.rs and channel.rs, clone() is not allowed since
options is created with Default::default();
Could you suggest any other solution?

Thank you.




On Thu, Nov 15, 2018 at 7:30 PM Manish Goregaokar 
wrote:

> Just remove the Copy requirement on the OscillatorOptions type, it's not
> necessary.
>
> -Manish Goregaokar
>
>
> On Thu, Nov 15, 2018 at 4:15 PM Avanthikaa Ravichandran  >
> wrote:
>
> > Thank you so much.
> > We are also trying to implement the periodic wave option for the
> oscillator
> > node. The sizes of the real and imag arrays in the PeriodicWaveOptions
> > structure are not fixed during compile time and need to be generated
> based
> > on the input terms.
> > For this, we thought of using a vector but the vector type does not
> > implement copy. We tried to use clone() during the oscillator node object
> > creation but many of the other types of waves (like channelsum) derive
> the
> > oscillator node and they cannot implement clone/require that copy be
> > derived. Can you suggest what we can do to overcome this? Do we assume an
> > outer limit to the size of the array and create an array of that size or
> is
> > there a way to still dynamically set the array size without the copy
> > conflict?
> >
> >
> >
> > On Thu, Nov 15, 2018 at 6:16 PM Manish Goregaokar  >
> > wrote:
> >
> > > Yes, it's f(x) = k.
> > >
> > > Note that `k` here is an AudioParam, so it's not always a constant --
> > > similar to how frequency in OscillatorSourceNode or gain in GainNode
> can
> > > vary per frame.
> > > -Manish Goregaokar
> > >
> > >
> > > On Thu, Nov 15, 2018 at 2:48 PM Avanthikaa Ravichandran <
> > aravi...@ncsu.edu
> > > >
> > > wrote:
> > >
> > > > Hi,
> > > >
> > > > We are working on implementing the missing WebAudio nodes in
> > servo-media.
> > > > One of the initial steps says* ‘implement the missing ConstantSource
> > node
> > > > type that produces a constant tone based on a stored value that can
> be
> > > > modified using the GainNode implementation as a model*'.
> > > >
> > > > Am I right in understanding that this requires implementing a wave
> > f(x) =
> > > > k, where k is a constant that is determined by the stored value? And
> > the
> > > > working of this wave is similar to sine, sawtooth, etc., with the
> only
> > > > difference being the wave formula?
> > > > ___
> > > > dev-servo mailing list
> > > > dev-servo@lists.mozilla.org
> > > > https://lists.mozilla.org/listinfo/dev-servo
> > > >
> > > ___
> > > dev-servo mailing list
> > > dev-servo@lists.mozilla.org
> > > https://lists.mozilla.org/listinfo/dev-servo
> > >
> > ___
> > dev-servo mailing list
> > dev-servo@lists.mozilla.org
> > https://lists.mozilla.org/listinfo/dev-servo
> >
> ___
> dev-servo mailing list
> dev-servo@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-servo
>
___
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo


Re: [dev-servo] Mozilla Servo Media - Implementing WebAudio Nodes

2018-11-17 Thread Manish Goregaokar
> However, for channelsum.rs and channel.rs, clone() is not allowed since
options is created with Default::default();

This is because of inference, use OscillatorOptions::default() instead,
*or* just construct it twice instead of reusing it
-Manish Goregaokar


On Sat, Nov 17, 2018 at 4:15 PM Avanthikaa Ravichandran 
wrote:

> Hi,
> So I tried removing Copy from the OscillatorNodeOptions type but after
> removing it, the other files that create the context do not allow the
> options to be used since they need a copy to create the context object.
> Refer the following code:
> let osc1 = context.create_node(AudioNodeInit::OscillatorNode(options),
> Default::default());
> This line throws an error for options when I remove copy.
>
> To fix this, I modified it as
> let osc1 =
> context.create_node(AudioNodeInit::OscillatorNode(options.clone()),
> Default::default());
> However, for channelsum.rs and channel.rs, clone() is not allowed since
> options is created with Default::default();
> Could you suggest any other solution?
>
> Thank you.
>
>
>
>
> On Thu, Nov 15, 2018 at 7:30 PM Manish Goregaokar 
> wrote:
>
> > Just remove the Copy requirement on the OscillatorOptions type, it's not
> > necessary.
> >
> > -Manish Goregaokar
> >
> >
> > On Thu, Nov 15, 2018 at 4:15 PM Avanthikaa Ravichandran <
> aravi...@ncsu.edu
> > >
> > wrote:
> >
> > > Thank you so much.
> > > We are also trying to implement the periodic wave option for the
> > oscillator
> > > node. The sizes of the real and imag arrays in the PeriodicWaveOptions
> > > structure are not fixed during compile time and need to be generated
> > based
> > > on the input terms.
> > > For this, we thought of using a vector but the vector type does not
> > > implement copy. We tried to use clone() during the oscillator node
> object
> > > creation but many of the other types of waves (like channelsum) derive
> > the
> > > oscillator node and they cannot implement clone/require that copy be
> > > derived. Can you suggest what we can do to overcome this? Do we assume
> an
> > > outer limit to the size of the array and create an array of that size
> or
> > is
> > > there a way to still dynamically set the array size without the copy
> > > conflict?
> > >
> > >
> > >
> > > On Thu, Nov 15, 2018 at 6:16 PM Manish Goregaokar <
> manishsm...@gmail.com
> > >
> > > wrote:
> > >
> > > > Yes, it's f(x) = k.
> > > >
> > > > Note that `k` here is an AudioParam, so it's not always a constant --
> > > > similar to how frequency in OscillatorSourceNode or gain in GainNode
> > can
> > > > vary per frame.
> > > > -Manish Goregaokar
> > > >
> > > >
> > > > On Thu, Nov 15, 2018 at 2:48 PM Avanthikaa Ravichandran <
> > > aravi...@ncsu.edu
> > > > >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > We are working on implementing the missing WebAudio nodes in
> > > servo-media.
> > > > > One of the initial steps says* ‘implement the missing
> ConstantSource
> > > node
> > > > > type that produces a constant tone based on a stored value that can
> > be
> > > > > modified using the GainNode implementation as a model*'.
> > > > >
> > > > > Am I right in understanding that this requires implementing a wave
> > > f(x) =
> > > > > k, where k is a constant that is determined by the stored value?
> And
> > > the
> > > > > working of this wave is similar to sine, sawtooth, etc., with the
> > only
> > > > > difference being the wave formula?
> > > > > ___
> > > > > dev-servo mailing list
> > > > > dev-servo@lists.mozilla.org
> > > > > https://lists.mozilla.org/listinfo/dev-servo
> > > > >
> > > > ___
> > > > dev-servo mailing list
> > > > dev-servo@lists.mozilla.org
> > > > https://lists.mozilla.org/listinfo/dev-servo
> > > >
> > > ___
> > > dev-servo mailing list
> > > dev-servo@lists.mozilla.org
> > > https://lists.mozilla.org/listinfo/dev-servo
> > >
> > ___
> > dev-servo mailing list
> > dev-servo@lists.mozilla.org
> > https://lists.mozilla.org/listinfo/dev-servo
> >
> ___
> dev-servo mailing list
> dev-servo@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-servo
>
___
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo