public MyEffectInstance(MyAudioEffect effect, IMySourceVoice input, MySourceVoice[] cues, float? duration, XAudio2 engine)
        {
            m_engine = engine;
            m_effect = effect;
            var inputSound = input as MySourceVoice;
            if (inputSound != null && inputSound.IsValid && inputSound.Voice != null && inputSound.Voice.IsValid())
            {
                Debug.Assert(!inputSound.Voice.IsDisposed);
                var sd = new SoundData()
                {
                    Sound = inputSound,
                    Pivot = 0,
                    CurrentEffect = 0,
                    OrigVolume = inputSound.Volume,
                    OrigFrequency = inputSound.FrequencyRatio,
                };
                //FilterParameters fp = new FilterParameters();
                m_sounds.Add(sd);
            }

            foreach(var sound in cues)
            {
                Debug.Assert(!sound.Voice.IsDisposed);
                sound.Start(false); //jn:todo effect command to start sound
                m_sounds.Add(new SoundData()
                {
                    Sound = sound,
                    Pivot = 0,
                    CurrentEffect = 0,
                    OrigVolume = sound.Volume,
                    OrigFrequency = sound.FrequencyRatio,
                });
            }
            if(OutputSound != null)
                OutputSound.StoppedPlaying += EffectFinished;

            ComputeDurationAndScale(duration);
            Update(0);
        }
 private static void UpdateFilter(SoundData sData, MyAudioEffect.SoundEffect effect)
 {
     if (effect.Filter != MyAudioEffect.FilterType.None)
     {
         if (!sData.CurrentFilter.HasValue)
         {
             sData.CurrentFilter = new FilterParameters()
             {
                 Frequency = effect.Frequency,
                 OneOverQ = effect.OneOverQ,
                 Type = (FilterType)effect.Filter
             };
         }
         sData.Sound.Voice.SetFilterParameters(sData.CurrentFilter.Value);
     }
 }
 private static void UpdateVolume(SoundData sData, MyAudioEffect.SoundEffect effect, float effPosition)
 {
     if (effect.VolumeCurve != null)
         sData.Sound.SetVolume(sData.OrigVolume * effect.VolumeCurve.Evaluate(effPosition));
 }