コード例 #1
0
        //***********************************************************************************************************************************************************************************************************

        #region Remove spotify fades

        /// <summary>
        /// Find all places where the record was paused and remove the fade outs and fade ins that spotify applies when pausing and resuming a playback.
        /// </summary>
        /// <param name="inputWavFileName">WAV file to remove fades</param>
        /// <param name="outputWavFileName">WAV file with removed fades</param>
        private void RemoveSpotifyFades(string inputWavFileName, string outputWavFileName)
        {
            RecordState = RecordStates.REMOVING_FADES;

            string spotifyPauseFadeOutPointsPath = System.AppDomain.CurrentDomain.BaseDirectory + @"\SpotifyPauseFadeOutPoints.xml";
            string spotifyPlayFadeInPointsPath   = System.AppDomain.CurrentDomain.BaseDirectory + @"\SpotifyPlayFadeInPoints.xml";

            WaveFileClass       file    = new WaveFileClass(inputWavFileName);
            List <SilenceParts> silence = file.RemoveSilence(200, -1, 0.0001);

            double allowedPauseSilenceDifference_ms = 500;
            List <FadeSettings> fades = new List <FadeSettings>();

            foreach (SilenceParts sil in silence)
            {
                List <double> validPauseTimes = _recordPauseTimes_s.Where(p => ((p * 1000) > (sil.Original_Start_ms - allowedPauseSilenceDifference_ms)) && ((p * 1000) < (sil.Original_Start_ms + allowedPauseSilenceDifference_ms))).ToList();
                if (validPauseTimes.Count() == 0)   //Only remove fades if the difference between the current silencePart and any of the pauseTimes is small enough
                {
                    continue;
                }

                FadeSettings fadeOutSettings = new FadeSettings(sil.New_Start_ms, FadeTypes.UNDO_CUSTOM, spotifyPauseFadeOutPointsPath, AudioChannels.RIGHT_AND_LEFT);
                fadeOutSettings.FadeStartTime_ms -= fadeOutSettings.FadePoints.Last().X;
                fades.Add(fadeOutSettings);
                fades.Add(new FadeSettings(sil.New_Start_ms, FadeTypes.UNDO_CUSTOM, spotifyPlayFadeInPointsPath, AudioChannels.RIGHT_AND_LEFT));
            }
            file.ApplyFading(fades);
            file.SaveFile(outputWavFileName);
        }
コード例 #2
0
ファイル: Category.cs プロジェクト: jayvachon/pharaohs-dance
 public override void SetVolume(FadeSettings fs)
 {
     if (fs.fadeLength > 0f)
         FadeVolume (fs);
     else
         SetVolume (fs.endValue);
 }
コード例 #3
0
    public static AudioElement SetElementVolume(string name, FadeSettings fadeSettings)
    {
        AudioElement e = GetElement(name);

        e.SetVolume(fadeSettings);
        return(e);
    }
コード例 #4
0
    public static Category SetCategoryVolume(string name, FadeSettings fadeSettings)
    {
        Category c = GetCategory(name);

        c.SetVolume(fadeSettings);
        return(c);
    }
コード例 #5
0
    public static Category SetCategoryPan(string name, float pan, FadeSettings fadeSettings)
    {
        Category c = GetCategory(name);

        c.SetPan(fadeSettings);
        return(c);
    }
コード例 #6
0
    public static AudioElement SetPan(string name, FadeSettings FadeSettings)
    {
        AudioElement e = GetElement(name);

        e.SetPan(FadeSettings);
        return(e);
    }
コード例 #7
0
ファイル: Program.cs プロジェクト: johnboggess/Physarum
        static void Main(string[] args)
        {
            TKWindow window = new TKWindow();

            window.AgentSettings = AgentSettings.Default();
            window.FadeSettings  = FadeSettings.Default();
            window.Run();
            Console.Read();
        }
コード例 #8
0
 private void ReverseSettings()
 {
     activate                 = true;
     scaleSettings            = scaleSettings.Reversed();
     rotateSettings           = rotateSettings.Reversed();
     worldPositionSettings    = worldPositionSettings.Reversed();
     anchoredPositionSettings = anchoredPositionSettings.Reversed();
     colourSettings           = colourSettings.Reversed();
     fadeSettings             = fadeSettings.Reversed();
 }
コード例 #9
0
 public override void SetVolume(FadeSettings fs)
 {
     if (fs.fadeLength > 0f)
     {
         FadeVolume(fs);
     }
     else
     {
         SetVolume(fs.endValue);
     }
 }
コード例 #10
0
    /// <summary>
    /// Volume
    /// </summary>

    public override void SetVolume(FadeSettings fs)
    {
        if (fs.fadeLength > 0f)
        {
            FadeVolume(fs);
        }
        else
        {
            volume.ElementLevel = fs.endValue;
        }
    }
コード例 #11
0
    /// <summary>
    /// Panning
    /// </summary>

    public override void SetPan(FadeSettings fs)
    {
        if (fs.fadeLength > 0f)
        {
            FadePan(fs);
        }
        else
        {
            pan.SetPan(fs.endValue);
        }
    }
コード例 #12
0
        public static FadeProgram Create(int width, int height, Texture2D texture, FadeSettings settings)
        {
            FadeProgram _fadeProgram = ObjectTK.Shaders.ProgramFactory.Create <FadeProgram>();

            _fadeProgram.Use();
            _fadeProgram.Texture.Bind(0, texture, TextureAccess.ReadWrite);
            _fadeProgram.Width.Set(width);
            _fadeProgram.Height.Set(height);

            _fadeProgram.FadeSettings = settings;

            return(_fadeProgram);
        }
コード例 #13
0
ファイル: Category.cs プロジェクト: jayvachon/pharaohs-dance
 // Panning a category means that all elements will have the same pan-
 // even if individually they were different before the category panned them,
 // so make sure it's what you want!
 public override void SetPan(FadeSettings fs)
 {
     if (fs.fadeLength > 0f) {
         foreach (AudioElement e in elements) {
             e.SetPan (fs.endValue);
         }
     } else {
         foreach (AudioElement e in elements) {
             e.SetPan (fs);
         }
     }
     foreach (Category c in subcategories) {
         c.SetPan (fs);
     }
 }
コード例 #14
0
    private IEnumerator DoFade(FadeSettings settings)
    {
        if (!settings.IsValid())
        {
            yield break;
        }

        settings.DoneFading = false;

        var   duration = settings.Duration;
        var   type     = settings.Type;
        float t;

        var color = _image.color;

        if (type == FadingType.FadeIn)
        {
            t = 0f;
            while (t < duration)
            {
                color.a = t / duration;

                _image.color = color;

                t += Time.deltaTime;
                yield return(null);
            }
            color.a      = 1f;
            _image.color = color;
        }
        else if (type == FadingType.FadeOut)
        {
            t = duration;
            while (t > 0f)
            {
                color.a = t / duration;

                _image.color = color;

                t -= Time.deltaTime;
                yield return(null);
            }
            color.a      = 0f;
            _image.color = color;
        }

        settings.DoneFading = true;
    }
コード例 #15
0
    private IEnumerator DoRIP()
    {
        var fade = new FadeSettings()
        {
            Type     = FadingType.FadeIn,
            Duration = 0.8f
        };

        Fader.Instance.Fade(fade);
        while (!fade.DoneFading)
        {
            yield return(null);
        }

        Application.LoadLevel(DeathScreenScene);
    }
コード例 #16
0
    public AnimationOperation(AnimationOperation animationOperation)
    {
        targetObject = animationOperation.targetObject;
        type         = animationOperation.type;
        easing       = animationOperation.easing;
        delay        = animationOperation.delay;
        duration     = animationOperation.duration;

        activate                 = animationOperation.activate;
        scaleSettings            = animationOperation.scaleSettings;
        rotateSettings           = animationOperation.rotateSettings;
        worldPositionSettings    = animationOperation.worldPositionSettings;
        anchoredPositionSettings = animationOperation.anchoredPositionSettings;
        colourSettings           = animationOperation.colourSettings;
        fadeSettings             = animationOperation.fadeSettings;
    }
コード例 #17
0
 public void FadePan(FadeSettings fs)
 {
     if (fs.fadeLength == 0f) {
         pan.SetPan (fs.endValue);
     }
     if (fs.startValue == fs.endValue) {
         pan.FadeTo (fs.fadeLength,
                     fs.endValue,
                     fs.fadeType,
                     fs.power);
     } else {
         pan.Fade (fs.fadeLength,
                   fs.startValue,
                   fs.endValue,
                   fs.fadeType,
                   fs.power);
     }
 }
コード例 #18
0
ファイル: Category.cs プロジェクト: jayvachon/pharaohs-dance
 public void FadeVolume(FadeSettings fs)
 {
     if (fs.fadeLength == 0f) {
         volume.Level = fs.endValue;
     }
     if (fs.startValue == fs.endValue) {
         volume.FadeTo (fs.fadeLength,
                        fs.endValue,
                        fs.fadeType,
                        fs.power);
     } else {
         volume.Fade (fs.fadeLength,
                      fs.startValue,
                      fs.endValue,
                      fs.fadeType,
                      fs.power);
     }
 }
コード例 #19
0
 // Panning a category means that all elements will have the same pan-
 // even if individually they were different before the category panned them,
 // so make sure it's what you want!
 public override void SetPan(FadeSettings fs)
 {
     if (fs.fadeLength > 0f)
     {
         foreach (AudioElement e in elements)
         {
             e.SetPan(fs.endValue);
         }
     }
     else
     {
         foreach (AudioElement e in elements)
         {
             e.SetPan(fs);
         }
     }
     foreach (Category c in subcategories)
     {
         c.SetPan(fs);
     }
 }
コード例 #20
0
 public void FadeVolume(FadeSettings fs)
 {
     if (fs.fadeLength == 0f)
     {
         volume.ElementLevel = fs.endValue;
     }
     if (fs.startValue == fs.endValue)
     {
         volume.FadeTo(fs.fadeLength,
                       fs.endValue,
                       fs.fadeType,
                       fs.power);
     }
     else
     {
         volume.Fade(fs.fadeLength,
                     fs.startValue,
                     fs.endValue,
                     fs.fadeType,
                     fs.power);
     }
 }
コード例 #21
0
 public void FadePan(FadeSettings fs)
 {
     if (fs.fadeLength == 0f)
     {
         pan.SetPan(fs.endValue);
     }
     if (fs.startValue == fs.endValue)
     {
         pan.FadeTo(fs.fadeLength,
                    fs.endValue,
                    fs.fadeType,
                    fs.power);
     }
     else
     {
         pan.Fade(fs.fadeLength,
                  fs.startValue,
                  fs.endValue,
                  fs.fadeType,
                  fs.power);
     }
 }
コード例 #22
0
 public MainViewModel()
 {
     window = new TKWindow();
     window.AgentSettings = AgentSettings.Default();
     window.FadeSettings  = FadeSettings.Default();
 }
コード例 #23
0
 public virtual void SetPan(FadeSettings fadeSettings)
 {
     return;
 }
コード例 #24
0
 public virtual void SetVolume(FadeSettings fadeSettings)
 {
     return;
 }
コード例 #25
0
 /// <summary>
 /// Volume 
 /// </summary>
 public override void SetVolume(FadeSettings fs)
 {
     if (fs.fadeLength > 0f)
         FadeVolume (fs);
     else
         volume.ElementLevel = fs.endValue;
 }
コード例 #26
0
 public void Fade(FadeSettings settings)
 {
     StartCoroutine(DoFade(settings));
 }
コード例 #27
0
 /// <summary>
 /// Panning
 /// </summary>
 public override void SetPan(FadeSettings fs)
 {
     if (fs.fadeLength > 0f)
         FadePan (fs);
     else
         pan.SetPan (fs.endValue);
 }