Exemplo n.º 1
0
        public bool Activate(
            ActivationParams ap, Parameters.EnvelopeParams eo
#if UNITY_EDITOR
            , Patch patch
#endif
            )
        {
            bool delayed = !Mathf.Approximately(ap.delay, 0f);

            if (delayed || (!randomize && !increment) ||
                lastFrame != Time.frameCount || !Application.isPlaying)
            {
                if (!delayed)
                {
                    lastFrame = Time.frameCount;
                }
                return(Synthesizer.Activate(
                           this, eo, ap
#if UNITY_EDITOR
                           , patch
#endif
                           ));
            }
            return(false);
        }
Exemplo n.º 2
0
        internal static bool Activate(
            AudioProgram a, Parameters.EnvelopeParams ep, ActivationParams ap
#if UNITY_EDITOR
            , Patch patch
#endif
            )
        {
            var p = a.parameters;

            p.envelope = ep;
            float gain;
            var   clip = a.GetClip(out gain);

#if UNITY_EDITOR
            if (!clip)
            {
                Debug.LogError("Activate: Null AudioClip from patch: " + patch, patch);
            }
#endif
            ap.volume *= 1f + gain;
            bool looping = Activate(
                a.mixerGroup, clip, p, ap
#if UNITY_EDITOR
                , patch
#endif
                );
            return(looping);
        }
Exemplo n.º 3
0
        public bool Activate(ActivationParams ap, Parameters.EnvelopeParams ep)
        {
            return(program.Activate(ap, ep
#if UNITY_EDITOR
                                    , this
#endif
                                    ));
        }
Exemplo n.º 4
0
        public static uint KeyOn(
            out bool looping, Patch patch, Parameters.EnvelopeParams ep,
            Transform t     = null, Vector3 pos = new Vector3(), float delay = 0f, float volume = 1f,
            float modVolume = 1f)
        {
            if (patch == null)
            {
                Debug.LogErrorFormat("AxelF.Synthesizer KeyOn: missing patch reference");
                looping = false;
                return(0);
            }
            uint handle = GetNextHandle();

            looping = patch.Activate(
                new ActivationParams {
                transform = t,
                position  = pos,
                delay     = delay,
                volume    = volume,
                modVolume = modVolume,
                handle    = handle
            }, ep);
            return(handle);
        }