createAudio() public static method

public static createAudio ( AnimationCurve volume, AnimationCurve frequency, LeanAudioOptions, options = null ) : AudioClip
volume UnityEngine.AnimationCurve
frequency UnityEngine.AnimationCurve
options LeanAudioOptions,
return UnityEngine.AudioClip
Example #1
0
    // Use this for initialization
    void Start()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(8.130963E-06f, 0.06526042f, 0f, -1f), new Keyframe(0.0007692695f, 2.449077f, 9.078861f, 9.078861f), new Keyframe(0.01541314f, 0.9343268f, -40f, -40f), new Keyframe(0.05169491f, 0.03835937f, -0.08621139f, -0.08621139f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.003005181f, 0f, 0f), new Keyframe(0.01507768f, 0.002227979f, 0f, 0f));

        boomAudioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }));
    }
Example #2
0
    // COUNTDOWN
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.001987448,,,8~8,,1,,-,.5,.2122908,-,,8~~~0~~1
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.001987448,,,8~8,,.2251969,,-,.5,.03779528,-,,8~~~0~~1
    public AudioClip PlayCountdown()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 0.2251969f, 0f, -1f), new Keyframe(0.5f, 0.03779528f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.001987448f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare()));
    }
Example #3
0
    static int createAudio(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 1);
                UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 2);
                UnityEngine.AudioClip      o    = LeanAudio.createAudio(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 3)
            {
                UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 1);
                UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject <UnityEngine.AnimationCurve>(L, 2);
                LeanAudioOptions           arg2 = (LeanAudioOptions)ToLua.CheckObject <LeanAudioOptions>(L, 3);
                UnityEngine.AudioClip      o    = LeanAudio.createAudio(arg0, arg1, arg2);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: LeanAudio.createAudio"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Example #4
0
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:4,.01002278,.001229508,,,.03234624,.0005327869,,,.05831435,.0003688525,,,.1047836,.008155738,,,4~8,.0001858941,1.033342,,-,.0405467,.8681767,-3,-1.7,.2,.02177083,-,,2~.1,,,~~0~~
    public AudioClip PlaySineWaveHighPitch()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.0001858941f, 1.033342f, 0f, -1f), new Keyframe(0.0405467f, 0.8681767f, -3f, -1.7f), new Keyframe(0.2f, 0.02177083f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.01002278f, 0.001229508f, 0f, 0f), new Keyframe(0.03234624f, 0.0005327869f, 0f, 0f), new Keyframe(0.05831435f, 0.0003688525f, 0f, 0f), new Keyframe(0.1047836f, 0.008155738f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) })));
    }
Example #5
0
    // Ambient Low-Mid Vibrato Tone 2.5
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.002,,,2.5,0.002,,,0.001822857f,0.004420519,,1.83897,1.83897,,,.5,.002288329,-,,8~~~0~~3,1000,1
    public AudioClip PlayLongAmbientLowMidWaveVibrato()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(-0.001822857f, 0.004420519f, 1.83897f, 1.83897f), new Keyframe(1.261261f, 0.9045518f, 0.02452584f, 0.008126878f), new Keyframe(2.5f, 0.003967403f, -2.285804f, -2.285804f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.002f, 0f, 0f), new Keyframe(2.5f, 0.002f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.003f, 0f, 0f), new Vector3(0.0012f, 0f, 0f), new Vector3(0.0016f, 0f, 0f) })));
    }
Example #6
0
    // TOO SLOW
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.03811491,.003057325,,,.5,.006242038,,,8~8,.001859264,.9363058,,-,.5,.1804671,-,,8~~~0~~1
    public AudioClip PlayTooSlow()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.001859264f, 0.9363058f, 0f, -1f), new Keyframe(0.5f, 0.1804671f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.03811491f, 0.003057325f, 0f, 0f), new Keyframe(0.5f, 0.006242038f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare()));
    }
Example #7
0
    // COUNTDOWN GO!!
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.02695933,.001464968,,,8~8,,1,,-,.5,.1566879,-,,8~~~0~~1
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.02695933,.001464968,,,8~8,,.1952756,,-,.5,.01889764,-,,8~~~0~~1
    public AudioClip PlayCountdownGo()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 0.1952756f, 0f, -1f), new Keyframe(0.5f, 0.01889764f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.02695933f, 0.001464968f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare()));
    }
Example #8
0
    // Click Low Tone 0.25
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.01105769,.001647597,,,8~8,,1,,-,.2376075,.7377388,-,,.25,,,,8~~~0~~
    public AudioClip PlayLowToneButton()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(0.1795745f, 0.7224256f, -1f, 0f), new Keyframe(0.25f, 0f, 0f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.01105769f, 0.001647597f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options()));
    }
Example #9
0
    // Extra High Pitch END with Vibrato 0.75
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2984478,.0005949656,,,8~8,,1,,-,.5,.7377388,-,,8~.1,,,~~0~~2
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2984478,.0005949656,,,8~8,.002012411,.5548589,,-,.5,.3777429,-,,8~.1,,,~~0~~2
    public AudioClip PlayCountdownHighPitchEndVibrato()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.002012411f, 0.5548589f, 0f, -1f), new Keyframe(0.5f, 0.3777429f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2984478f, 0.0005949656f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setWaveSawtooth()));
    }
Example #10
0
    // Noise Mid-High Vibrato Tone 0.5
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2680972,.0008237986,,,8~8,.04856101,.0389016,,-,.3267751,.562929,,,.5,.2929062,-,,8~~~0~~3,1000,1
    public AudioClip PlayNoiseMidHighTone()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.04856101f, 0.0389016f, 0f, -1f), new Keyframe(0.3267751f, 0.562929f, 0f, 0f), new Keyframe(0.5f, 0.2929062f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2680972f, 0.0008237986f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveNoise().setWaveNoiseScale(1000)));
    }
Example #11
0
    // Sawtooth Mid-Low Tone 0.5
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.1598466,.007437071,,,8~8,.04856101,.0389016,,-,.3267751,.562929,,,.5,.7185355,-,,8~.1,,,~~0~~2
    public AudioClip PlaySawLowHighTone()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.06312931f, 0.0389016f, 0f, -1f), new Keyframe(0.40625f, 0.7185355f, -1f, 0f), new Keyframe(0.65f, 0.2929062f, 0f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.1598466f, 0.007437071f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setWaveSawtooth()));
    }
Example #12
0
    void CreateCubeButton(int index, Vector2 rotation, float depth)
    {
        GameObject cubeButton = Instantiate(cubeButtonPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        cubeButton.transform.localPosition = new Vector3(Mathf.Sin(rotation.x * (Mathf.PI * 2) / 360) * depth, 0, Mathf.Cos(rotation.x * (Mathf.PI * 2) / 360) * depth);
        cubeButton.transform.rotation      = Quaternion.Euler(new Vector3(rotation.y, rotation.x, 0));


        //   cubeButton.GetComponent<Renderer>().material = Instantiate(material) as Material;
        cubeButton.GetComponent <Renderer>().material.color = buttonSettings[index].normalColor;
        cubeButton.GetComponent <Button>().onClick.AddListener(() =>
        {
            onGameButtonClick(index);
        });

        cubeButtons.Add(cubeButton);

        {
            float length    = 2f;
            float frequency = 0.0001f * ((float)index + 1f);

            AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(length, 0f, -1f, 0f));
            AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, frequency, 0f, 0f), new Keyframe(length, frequency, 0f, 0f));

            LeanAudioOptions audioOptions = LeanAudio.options();
            audioOptions.setWaveSine();
            audioOptions.setFrequency(44100);


            AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, audioOptions);
            cubeButton.GetComponent <AudioSource>().clip = audioClip;
        }
    }
Example #13
0
    // Noise Low-Mid-High-Fade No Vibrato Tone 0.75
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2873193,.001556064,,,8~8,.05766619,.06864989,,-,.2691089,.3546911,,,.5,.002288329,-,,8~~~0~~3,1000,1
    public AudioClip PlaySawLowMidHighTone()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.05766619f, 0.06864989f, 0f, -1f), new Keyframe(0.2691089f, 0.3546911f, 0f, 0f), new Keyframe(0.5f, 0.002288329f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2873193f, 0.001556064f, 0f, 0f));

        return(LeanAudio.createAudio(volumeCurve, frequencyCurve,
                                     LeanAudio.options().setWaveNoise().setWaveNoiseScale(1000)));
    }
Example #14
0
    void playBoom()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(-0.001454365f, 0.006141067f, -3.698472f, -3.698472f), new Keyframe(0.004859668f, 1.392618f, -4.544237f, -4.544237f), new Keyframe(0.9999977f, 0.00601998f, -0.1788428f, -0.1788428f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(2.99277E-05f, 0.002244899f, 0.01912267f, 0.01912267f), new Keyframe(0.9984757f, 0.06040816f, 0f, 0f));
        AudioClip      audioClip      = LeanAudio.createAudio(volumeCurve, frequencyCurve, new LeanAudioOptions().setVibrato(new Vector3[] { new Vector3(0.002f, 0.6f, 0f) }));

        LeanAudio.playClipAt(audioClip, Vector3.zero);
    }
Example #15
0
    void PlayBoom()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1.163155f, 0f, -1f), new Keyframe(0.3098361f, 0f, 0f, 0f), new Keyframe(0.5f, 0.003534712f, 0f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.000819672f, 0.007666667f, 0f, 0f), new Keyframe(0.01065573f, 0.002424242f, 0f, 0f), new Keyframe(0.02704918f, 0.007454545f, 0f, 0f), new Keyframe(0.03770492f, 0.002575758f, 0f, 0f), new Keyframe(0.052459f, 0.007090909f, 0f, 0f), new Keyframe(0.06885245f, 0.002939394f, 0f, 0f), new Keyframe(0.0819672f, 0.006727273f, 0f, 0f), new Keyframe(0.1040983f, 0.003181818f, 0f, 0f), new Keyframe(0.1188525f, 0.006212121f, 0f, 0f), new Keyframe(0.145082f, 0.004151515f, 0f, 0f), new Keyframe(0.1893443f, 0.005636364f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setFrequency(11025));

        LeanAudio.play(audioClip);
    }
Example #16
0
    // Make your own LeanAudio sounds at http://leanaudioplay.dentedpixel.com
    void playSwish()
    {
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 0.005464481f, 1.83897f, 0f), new Keyframe(0.1114856f, 2.281785f, 0f, 0f), new Keyframe(0.2482903f, 2.271654f, 0f, 0f), new Keyframe(0.3f, 0.01670286f, 0f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.00136725f, 0f, 0f), new Keyframe(0.1482391f, 0.005405405f, 0f, 0f), new Keyframe(0.2650336f, 0.002480127f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.2f, 0.5f, 0f) }).setWaveNoise().setWaveNoiseScale(1000));

        LeanAudio.play(audioClip); //a:fvb:8,,.00136725,,,.1482391,.005405405,,,.2650336,.002480127,,,8~8,,.005464481,1.83897,,.1114856,2.281785,,,.2482903,2.271654,,,.3,.01670286,,,8~.2,.5,,~~0~~3,1000,1
    }
Example #17
0
    void playBoom()
    {
        // Make your own Dynamic Audio at http://leanaudioplay.dentedpixel.com

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(-0.001454365f, 0.006141067f, -3.698472f, -3.698472f), new Keyframe(0.007561419f, 1.006896f, -3.613532f, -3.613532f), new Keyframe(0.9999977f, 0.00601998f, -0.1788428f, -0.1788428f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.001724138f, 0.01912267f, 0.01912267f), new Keyframe(0.9981073f, 0.007586207f, 0f, 0f));
        AudioClip      audioClip      = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setFrequency(11025));

        LeanAudio.play(audioClip, Vector3.zero);
    }
Example #18
0
    void playBoom()
    {
        // Make your own Dynamic Audio at http://leanaudioplay.dentedpixel.com

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1.163155f, 0f, -1f), new Keyframe(0.3098361f, 0f, 0f, 0f), new Keyframe(0.5f, 0.003524712f, 0f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.000819672f, 0.007666667f, 0f, 0f), new Keyframe(0.01065573f, 0.002424242f, 0f, 0f), new Keyframe(0.02704918f, 0.007454545f, 0f, 0f), new Keyframe(0.03770492f, 0.002575758f, 0f, 0f), new Keyframe(0.052459f, 0.007090909f, 0f, 0f), new Keyframe(0.06885245f, 0.002939394f, 0f, 0f), new Keyframe(0.0819672f, 0.006727273f, 0f, 0f), new Keyframe(0.1040983f, 0.003181818f, 0f, 0f), new Keyframe(0.1188525f, 0.006212121f, 0f, 0f), new Keyframe(0.145082f, 0.004151515f, 0f, 0f), new Keyframe(0.1893443f, 0.005636364f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setFrequency(11025));

        LeanAudio.play(audioClip);           //a:fvb:8,.000819672,.007666667,,,.01065573,.002424242,,,.02704918,.007454545,,,.03770492,.002575758,,,.052459,.007090909,,,.06885245,.002939394,,,.0819672,.006727273,,,.1040983,.003181818,,,.1188525,.006212121,,,.145082,.004151515,,,.1893443,.005636364,,,8~8,,1.163155,,-,.3098361,,,,.5,.003524712,,,8~.1,,,~11025~0~~
    }
Example #19
0
    // Click Low Tone 0.25
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.01105769,.001647597,,,8~8,,1,,-,.2376075,.7377388,-,,.25,,,,8~~~0~~

    public void PlayLowToneButton(float volumeOverride = 0.45f)
    {
        if (GameControl.instance.IsRunningIE)
        {
            return;
        }

        volumeOverride = VolumeOverrideCheck(volumeOverride);

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(0.1795745f, 0.7224256f, -1f, 0f), new Keyframe(0.25f, 0f, 0f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.01105769f, 0.001647597f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options());

        LeanAudio.play(audioClip, volumeOverride);           //a:fvb:8,.01105769,.001647597,,,8~8,,1,,-,.1795745,.7224256,-,,.25,,,,8~~~0~~
    }
Example #20
0
    // COUNTDOWN
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.001987448,,,8~8,,1,,-,.5,.2122908,-,,8~~~0~~1

    public void PlayCountdown(float volumeOverride = 0.0f)
    {
        if (GameControl.instance.IsRunningIE)
        {
            return;
        }

        volumeOverride = VolumeOverrideCheck(volumeOverride);

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(0.5f, 0.2122908f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, 0.001987448f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare());

        LeanAudio.play(audioClip, _volume);           //a:fvb:8,,.001987448,,,8~8,,1,,-,.5,.2122908,-,,8~~~0~~1
    }
Example #21
0
    // TOO SLOW
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.03811491,.003057325,,,.5,.006242038,,,8~8,.001859264,.9363058,,-,.5,.1804671,-,,8~~~0~~1

    public void PlayTooSlow(float volumeOverride = 0.0f)
    {
        if (GameControl.instance.IsRunningIE)
        {
            return;
        }

        volumeOverride = VolumeOverrideCheck(volumeOverride);

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0.001859264f, 0.9363058f, 0f, -1f), new Keyframe(0.5f, 0.1804671f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.03811491f, 0.003057325f, 0f, 0f), new Keyframe(0.5f, 0.006242038f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare());

        LeanAudio.play(audioClip, volumeOverride);           //a:fvb:8,.03811491,.003057325,,,.5,.006242038,,,8~8,.001859264,.9363058,,-,.5,.1804671,-,,8~~~0~~1
    }
Example #22
0
    // pulse beep semi - low - http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,,.001987448,,,8~8,,1,,-,.5,.7377388,-,,8~~~0~~2
    // pulse beep low - http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.0009296319,.003821656,,,8~8,,1,,-,.5,.7377388,-,,8~~~0~~2

    // High Pitch with Vibrato 0.5
    // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.2984478,.0005949656,,,8~8,,1,,-,.5,.7377388,-,,8~.1,,,~~0~~2

    public void PlayCountdownHighPitchVibrato(float volumeOverride = 0.0f)
    {
        if (GameControl.instance.IsRunningIE)
        {
            return;
        }

        volumeOverride = VolumeOverrideCheck(volumeOverride);

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(0.5f, 0.7377388f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.2984478f, 0.0005949656f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setVibrato(new Vector3[] { new Vector3(0.1f, 0f, 0f) }).setWaveSawtooth());

        LeanAudio.play(audioClip, volumeOverride);           //a:fvb:8,.2984478,.0005949656,,,8~8,,1,,-,.5,.7377388,-,,8~.1,,,~~0~~2
    }
    // Play the audio upon button press
    public void PlayAudio(int index)
    {
        float length    = GameManager.Instance.scrollDelay / 2000f;
        float frequency = 0.001f * ((float)index + 1f);

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(length, 0f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, frequency, 0f, 0f), new Keyframe(length, frequency, 0f, 0f));

        LeanAudioOptions audioOptions = LeanAudio.options();

        audioOptions.setWaveSine();
        audioOptions.setFrequency(44100);

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, audioOptions);

        LeanAudio.play(audioClip, length);
    }
Example #24
0
 static int createAudio(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.AnimationCurve arg0 = (UnityEngine.AnimationCurve)ToLua.CheckObject(L, 1, typeof(UnityEngine.AnimationCurve));
         UnityEngine.AnimationCurve arg1 = (UnityEngine.AnimationCurve)ToLua.CheckObject(L, 2, typeof(UnityEngine.AnimationCurve));
         LeanAudioOptions           arg2 = (LeanAudioOptions)ToLua.CheckObject(L, 3, typeof(LeanAudioOptions));
         UnityEngine.AudioClip      o    = LeanAudio.createAudio(arg0, arg1, arg2);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #25
0
 static public int createAudio_s(IntPtr l)
 {
     try {
         UnityEngine.AnimationCurve a1;
         checkType(l, 1, out a1);
         UnityEngine.AnimationCurve a2;
         checkType(l, 2, out a2);
         LeanAudioOptions a3;
         checkType(l, 3, out a3);
         var ret = LeanAudio.createAudio(a1, a2, a3);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #26
0
    void PlayAudio(int index)
    {
        //Debug.Log(index);
        float length    = 0.5f;
        float frequency = 0.0005f * ((float)index + 2f);

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(length, 0f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, frequency, 0f, 0f), new Keyframe(length, frequency, 0f, 0f));

        LeanAudioOptions audioOptions = LeanAudio.options();

        audioOptions.setWaveSine();
        audioOptions.setFrequency(44100);

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, audioOptions);

        LeanAudio.play(audioClip, 0.5f);
    }
Example #27
0
    public void PlayCountdownGo(float volumeOverride = 0.0f)
    {
        if (GameControl.instance.IsRunningIE)
        {
            return;
        }

        volumeOverride = VolumeOverrideCheck(volumeOverride);

        // COUNTDOWN GO!!
        // http://leanaudioplay.dentedpixel.com/?d=a:fvb:8,.02695933,.001464968,,,8~8,,1,,-,.5,.1566879,-,,8~~~0~~1

        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(0.5f, 0.1566879f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0.02695933f, 0.001464968f, 0f, 0f));

        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, LeanAudio.options().setWaveSquare());

        LeanAudio.play(audioClip, volumeOverride);           //a:fvb:8,.02695933,.001464968,,,8~8,,1,,-,.5,.1566879,-,,8~~~0~~1
    }
    void PlayAudio(int index)
    {
        float audioLength = timeLit;
        float frequency   = 0.0005f * ((float)index + 1f);

        // generate waveform
        AnimationCurve volumeCurve    = new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(audioLength, 0f, -1f, 0f));
        AnimationCurve frequencyCurve = new AnimationCurve(new Keyframe(0f, frequency, 0f, 0f), new Keyframe(audioLength, frequency, 0f, 0f));

        // set waveform parameters
        LeanAudioOptions audioOptions = LeanAudio.options();

        audioOptions.setWaveSine();
        audioOptions.setFrequency(44100);

        // create clip of our waveform
        AudioClip audioClip = LeanAudio.createAudio(volumeCurve, frequencyCurve, audioOptions);

        // play it
        LeanAudio.play(audioClip, 0.5f);
    }
Example #29
0
 static public int createAudio_s(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.AnimationCurve a1;
         checkType(l, 1, out a1);
         UnityEngine.AnimationCurve a2;
         checkType(l, 2, out a2);
         LeanAudioOptions a3;
         checkType(l, 3, out a3);
         var ret = LeanAudio.createAudio(a1, a2, a3);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Example #30
0
        void Start()
        {
//			Time.timeScale = 0.25f;

            LeanTest.timeout  = 46f;
            LeanTest.expected = 56;

            LeanTween.init(15 + 1200);

            // add a listener
            LeanTween.addListener(cube1, 0, eventGameObjectCalled);

            LeanTest.expect(LeanTween.isTweening() == false, "NOTHING TWEEENING AT BEGINNING");

            LeanTest.expect(LeanTween.isTweening(cube1) == false, "OBJECT NOT TWEEENING AT BEGINNING");

            LeanTween.scaleX(cube4, 2f, 0f).setOnComplete(() => {
                LeanTest.expect(cube4.transform.localScale.x == 2f, "TWEENED WITH ZERO TIME");
            });

            // dispatch event that is received
            LeanTween.dispatchEvent(0);
            LeanTest.expect(eventGameObjectWasCalled, "EVENT GAMEOBJECT RECEIVED");

            // do not remove listener
            LeanTest.expect(LeanTween.removeListener(cube2, 0, eventGameObjectCalled) == false, "EVENT GAMEOBJECT NOT REMOVED");
            // remove listener
            LeanTest.expect(LeanTween.removeListener(cube1, 0, eventGameObjectCalled), "EVENT GAMEOBJECT REMOVED");

            // add a listener
            LeanTween.addListener(1, eventGeneralCalled);

            // dispatch event that is received
            LeanTween.dispatchEvent(1);
            LeanTest.expect(eventGeneralWasCalled, "EVENT ALL RECEIVED");

            // remove listener
            LeanTest.expect(LeanTween.removeListener(1, eventGeneralCalled), "EVENT ALL REMOVED");

            lt1Id = LeanTween.move(cube1, new Vector3(3f, 2f, 0.5f), 1.1f).id;
            LeanTween.move(cube2, new Vector3(-3f, -2f, -0.5f), 1.1f);

            LeanTween.reset();

            // Queue up a bunch of tweens, cancel some of them but expect the remainder to finish
            GameObject[] cubes    = new GameObject[99];
            int[]        tweenIds = new int[cubes.Length];
            for (int i = 0; i < cubes.Length; i++)
            {
                GameObject c = cubeNamed("cancel" + i);
                tweenIds[i] = LeanTween.moveX(c, 100f, 1f).id;
                cubes [i]   = c;
            }
            int onCompleteCount = 0;

            LeanTween.delayedCall(cubes[0], 0.2f, () => {
                for (int i = 0; i < cubes.Length; i++)
                {
                    if (i % 3 == 0)
                    {
                        LeanTween.cancel(cubes [i]);
                    }
                    else if (i % 3 == 1)
                    {
                        LeanTween.cancel(tweenIds[i]);
                    }
                    else if (i % 3 == 2)
                    {
                        LTDescr descr = LeanTween.descr(tweenIds[i]);
//						Debug.Log("descr:"+descr);
                        descr.setOnComplete(() => {
                            onCompleteCount++;
//							Debug.Log("onCompleteCount:"+onCompleteCount);
                            if (onCompleteCount >= 33)
                            {
                                LeanTest.expect(true, "CANCELS DO NOT EFFECT FINISHING");
                            }
                        });
                    }
                }
            });

            Vector3[] splineArr = new Vector3[] { new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 0f), new Vector3(4f, 0f, 0f), new Vector3(20f, 0f, 0f), new Vector3(30f, 0f, 0f) };
            LTSpline  cr        = new LTSpline(splineArr);

            cr.place(cube4.transform, 0.5f);
            LeanTest.expect((Vector3.Distance(cube4.transform.position, new Vector3(10f, 0f, 0f)) <= 0.7f), "SPLINE POSITIONING AT HALFWAY", "position is:" + cube4.transform.position + " but should be:(10f,0f,0f)");
            LeanTween.color(cube4, Color.green, 0.01f);

//			Debug.Log("Point 2:"+cr.ratioAtPoint(splineArr[2]));

            // OnStart Speed Test for ignoreTimeScale vs normal timeScale

            GameObject cubeDest    = cubeNamed("cubeDest");
            Vector3    cubeDestEnd = new Vector3(100f, 20f, 0f);

            LeanTween.move(cubeDest, cubeDestEnd, 0.7f);

            GameObject cubeToTrans = cubeNamed("cubeToTrans");

            LeanTween.move(cubeToTrans, cubeDest.transform, 1.2f).setEase(LeanTweenType.easeOutQuad).setOnComplete(() => {
                LeanTest.expect(cubeToTrans.transform.position == cubeDestEnd, "MOVE TO TRANSFORM WORKS");
            });

            GameObject cubeDestroy = cubeNamed("cubeDestroy");

            LeanTween.moveX(cubeDestroy, 200f, 0.05f).setDelay(0.02f).setDestroyOnComplete(true);
            LeanTween.moveX(cubeDestroy, 200f, 0.1f).setDestroyOnComplete(true).setOnComplete(() => {
                LeanTest.expect(true, "TWO DESTROY ON COMPLETE'S SUCCEED");
            });

            GameObject cubeSpline = cubeNamed("cubeSpline");

            LeanTween.moveSpline(cubeSpline, new Vector3[] { new Vector3(0.5f, 0f, 0.5f), new Vector3(0.75f, 0f, 0.75f), new Vector3(1f, 0f, 1f), new Vector3(1f, 0f, 1f) }, 0.1f).setOnComplete(() => {
                LeanTest.expect(Vector3.Distance(new Vector3(1f, 0f, 1f), cubeSpline.transform.position) < 0.01f, "SPLINE WITH TWO POINTS SUCCEEDS");
            });

            // This test works when it is positioned last in the test queue (probably worth fixing when you have time)
            GameObject jumpCube = cubeNamed("jumpTime");

            jumpCube.transform.position    = new Vector3(100f, 0f, 0f);
            jumpCube.transform.localScale *= 100f;
            int jumpTimeId = LeanTween.moveX(jumpCube, 200f, 1f).id;

            LeanTween.delayedCall(gameObject, 0.2f, () => {
                LTDescr d     = LeanTween.descr(jumpTimeId);
                float beforeX = jumpCube.transform.position.x;
                d.setTime(0.5f);
                LeanTween.delayedCall(0.0f, () => { }).setOnStart(() => {
                    float diffAmt = 1f;                    // This variable is dependent on a good frame-rate because it evalutes at the next Update
                    beforeX      += Time.deltaTime * 100f * 2f;
                    LeanTest.expect(Mathf.Abs(jumpCube.transform.position.x - beforeX) < diffAmt, "CHANGING TIME DOESN'T JUMP AHEAD", "Difference:" + Mathf.Abs(jumpCube.transform.position.x - beforeX) + " beforeX:" + beforeX + " now:" + jumpCube.transform.position.x + " dt:" + Time.deltaTime);
                });
            });

            // Tween with time of zero is needs to be set to it's final value
            GameObject zeroCube = cubeNamed("zeroCube");

            LeanTween.moveX(zeroCube, 10f, 0f).setOnComplete(() => {
                LeanTest.expect(zeroCube.transform.position.x == 10f, "ZERO TIME FINSHES CORRECTLY", "final x:" + zeroCube.transform.position.x);
            });

            // Scale, and OnStart
            GameObject cubeScale = cubeNamed("cubeScale");

            LeanTween.scale(cubeScale, new Vector3(5f, 5f, 5f), 0.01f).setOnStart(() => {
                LeanTest.expect(true, "ON START WAS CALLED");
            }).setOnComplete(() => {
                LeanTest.expect(cubeScale.transform.localScale.z == 5f, "SCALE", "expected scale z:" + 5f + " returned:" + cubeScale.transform.localScale.z);
            });

            // Rotate
            GameObject cubeRotate = cubeNamed("cubeRotate");

            LeanTween.rotate(cubeRotate, new Vector3(0f, 180f, 0f), 0.02f).setOnComplete(() => {
                LeanTest.expect(cubeRotate.transform.eulerAngles.y == 180f, "ROTATE", "expected rotate y:" + 180f + " returned:" + cubeRotate.transform.eulerAngles.y);
            });

            // RotateAround
            GameObject cubeRotateA = cubeNamed("cubeRotateA");

            LeanTween.rotateAround(cubeRotateA, Vector3.forward, 90f, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeRotateA.transform.eulerAngles.z == 90f, "ROTATE AROUND", "expected rotate z:" + 90f + " returned:" + cubeRotateA.transform.eulerAngles.z);
            });

            // RotateAround 360
            GameObject cubeRotateB = cubeNamed("cubeRotateB");

            cubeRotateB.transform.position = new Vector3(200f, 10f, 8f);
            LeanTween.rotateAround(cubeRotateB, Vector3.forward, 360f, 0.3f).setPoint(new Vector3(5f, 3f, 2f)).setOnComplete(() => {
                LeanTest.expect(cubeRotateB.transform.position.ToString() == (new Vector3(200f, 10f, 8f)).ToString(), "ROTATE AROUND 360", "expected rotate pos:" + (new Vector3(200f, 10f, 8f)) + " returned:" + cubeRotateB.transform.position);
            });

            // Alpha, onUpdate with passing value, onComplete value
            LeanTween.alpha(cubeAlpha1, 0.5f, 0.1f).setOnUpdate((float val) => {
                LeanTest.expect(val != 0f, "ON UPDATE VAL");
            }).setOnCompleteParam("Hi!").setOnComplete((object completeObj) => {
                LeanTest.expect(((string)completeObj) == "Hi!", "ONCOMPLETE OBJECT");
                LeanTest.expect(cubeAlpha1.GetComponent <Renderer>().material.color.a == 0.5f, "ALPHA");
            });
            // Color
            float onStartTime = -1f;

            LeanTween.color(cubeAlpha2, Color.cyan, 0.3f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.GetComponent <Renderer>().material.color == Color.cyan, "COLOR");
                LeanTest.expect(onStartTime >= 0f && onStartTime < Time.time, "ON START", "onStartTime:" + onStartTime + " time:" + Time.time);
            }).setOnStart(() => {
                onStartTime = Time.time;
            });
            // moveLocalY (make sure uses y values)
            Vector3 beforePos = cubeAlpha1.transform.position;

            LeanTween.moveY(cubeAlpha1, 3f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha1.transform.position.x == beforePos.x && cubeAlpha1.transform.position.z == beforePos.z, "MOVE Y");
            });

            Vector3 beforePos2 = cubeAlpha2.transform.localPosition;

            LeanTween.moveLocalZ(cubeAlpha2, 12f, 0.2f).setOnComplete(() => {
                LeanTest.expect(cubeAlpha2.transform.localPosition.x == beforePos2.x && cubeAlpha2.transform.localPosition.y == beforePos2.y, "MOVE LOCAL Z", "ax:" + cubeAlpha2.transform.localPosition.x + " bx:" + beforePos.x + " ay:" + cubeAlpha2.transform.localPosition.y + " by:" + beforePos2.y);
            });

            AudioClip audioClip = LeanAudio.createAudio(new AnimationCurve(new Keyframe(0f, 1f, 0f, -1f), new Keyframe(1f, 0f, -1f, 0f)), new AnimationCurve(new Keyframe(0f, 0.001f, 0f, 0f), new Keyframe(1f, 0.001f, 0f, 0f)), LeanAudio.options());

            LeanTween.delayedSound(gameObject, audioClip, new Vector3(0f, 0f, 0f), 0.1f).setDelay(0.2f).setOnComplete(() => {
                LeanTest.expect(Time.time > 0, "DELAYED SOUND");
            });

            // Easing Methods
            int totalEasingCheck        = 0;
            int totalEasingCheckSuccess = 0;

            for (int j = 0; j < 2; j++)
            {
                bool isCheckingFrom       = j == 1;
                int  totalTweenTypeLength = (int)LeanTweenType.easeShake;
                for (int i = (int)LeanTweenType.notUsed; i < totalTweenTypeLength; i++)
                {
                    LeanTweenType easeType = (LeanTweenType)i;
                    GameObject    cube     = cubeNamed("cube" + easeType);
                    LTDescr       descr    = LeanTween.moveLocalX(cube, 5, 0.1f).setOnComplete((object obj) => {
                        GameObject cubeIn = obj as GameObject;
                        totalEasingCheck++;
                        if (cubeIn.transform.position.x == 5f)
                        {
                            totalEasingCheckSuccess++;
                        }
                        if (totalEasingCheck == (2 * totalTweenTypeLength))
                        {
                            LeanTest.expect(totalEasingCheck == totalEasingCheckSuccess, "EASING TYPES");
                        }
                    }).setOnCompleteParam(cube);

                    if (isCheckingFrom)
                    {
                        descr.setFrom(-5f);
                    }
                }
            }

            // value2
            bool value2UpdateCalled = false;

            LeanTween.value(gameObject, new Vector2(0, 0), new Vector2(256, 96), 0.1f).setOnUpdate((Vector2 value) => {
                value2UpdateCalled = true;
            });
            LeanTween.delayedCall(0.2f, () => {
                LeanTest.expect(value2UpdateCalled, "VALUE2 UPDATE");
            });

            // check descr
//			LTDescr descr2 = LeanTween.descr( descrId );
//			LeanTest.expect(descr2 == null,"DESCRIPTION STARTS AS NULL");

            StartCoroutine(timeBasedTesting());
        }