Пример #1
0
        public Stream Retrieve()
        {
            if (ActiveSource == null)
            {
                throw new InvalidOperationException("Cannot retrieve multi source, the multi source was not properly prepared (none of the sources exists or missing Prepare() call).");
            }

            return(ActiveSource.Retrieve());
        }
Пример #2
0
        public void Prepare()
        {
            if (!Exists())
            {
                throw new InvalidOperationException($"Cannot prepare multi source, none of the underlying sources {ArrayUtils.ToString(_sources)} exists.");
            }

            ActiveSource.Prepare();
        }
        public PackageSourceSettings(ISettingsManager settingsManager)
        {
            Debug.Assert(settingsManager != null);
            _settingsManager = settingsManager;

            // migrate active package source
            if (ActiveSource.Equals(NuGetConstants.V2FeedUrl, StringComparison.OrdinalIgnoreCase) ||
                ActiveSource.Equals(NuGetConstants.V2LegacyFeedUrl, StringComparison.OrdinalIgnoreCase))
            {
                ActiveSource = NuGetConstants.DefaultFeedUrl;
            }
        }
Пример #4
0
 public void Dispose()
 {
     ActiveSource?.Dispose();
 }
Пример #5
0
 public bool Exists()
 {
     return(ActiveSource?.Exists() ?? false);
 }
Пример #6
0
        internal static bool ActivateInternal(
            AudioMixerGroup g, AudioClip c, Parameters p,
            ActivationParams ap, Vector3 pos2, float pitch
#if UNITY_EDITOR
            , Patch patch
#endif
            )
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                UnityEditor.EditorApplication.CallbackFunction f = null;
                float n = Time.realtimeSinceStartup;
                f = () => {
                    if (Time.realtimeSinceStartup - n >= ap.delay)
                    {
                        UnityEditor.EditorApplication.update -= f;
                        PlayClip(c, p.loop);
                    }
                };
                UnityEditor.EditorApplication.update += f;
                return(false);
            }
#endif

            var i = freeSources.Count > 0 ? freeSources.Pop() : CreateSource();
            i.transform.position = pos2;
            i.Enable(p);

            var z = new ActiveSource {
                handle = ap.handle,
                keyOn  = ap.delay,
                keyOff = false,
#if UNITY_EDITOR
                patch = patch,
#endif
                info          = i,
                target        = (ap.transform == null || ap.transform.gameObject.isStatic) ? null : ap.transform,
                localPosition = ap.position,
                volume        = p.GetVolume() * Mathf.Clamp01(ap.volume),
                modVolume     = ap.modVolume,
                envelope      = Envelope.instant
            };

#if SYNTHESIZER_PARANOIA
            Debug.LogFormat(
                Time.frameCount.ToString("X4") +
                " Synthesizer.ActivateInternal: {0} {1} ({2})",
                g, c.name, z.target);
#endif

            if (p.envelope.attack > Mathf.Epsilon)
            {
                z.envelope.SetAttack(p.envelope.attack);
            }
            if (p.envelope.release > Mathf.Epsilon)
            {
                z.envelope.SetRelease(p.envelope.release);
            }

            ActivateStatic(g, c, p, i.audioSource, ap.delay, z.GetVolume(), pitch);
            activeSources0.Add(z);
            return(p.loop);
        }
Пример #7
0
 public void TestInit()
 {
     sw41 = Test.Sw41;
     api  = sw41.ActiveSourceApi;
 }