Пример #1
0
        public static PoolableAudio Play(IAudioPackage package, EventArgs args)
        {
            var poolable = pool.RequestSinglePoolable();

            Reset(poolable.Value);

            package.AssignTo(poolable.Value, args);
            poolable.Value.Play();

            return(poolable);
        }
Пример #2
0
        /// <summary>Combines two <c>IAudioPackage</c> into one.</summary>
        /// <param name="value">The value to combine with the given source.</param>
        public static IAudioPackage Chain(this IAudioPackage source, IAudioPackage value)
        {
            // If one of the given values is already a group
            // It is used for the merge in order to avoid a pollution of the heap with imbricated data containers
            if (source is AudioGroupPackage lGroup)
            {
                lGroup.Add(value);
                return(lGroup);
            }
            else if (value is AudioGroupPackage rGroup)
            {
                rGroup.Add(source);
                return(rGroup);
            }
            else // If no group was ground, create a new one
            {
                var group = new AudioGroupPackage();
                group.Add(source);
                group.Add(value);

                return(group);
            }
        }
Пример #3
0
        //---[Core]-----------------------------------------------------------------------------------------------------/

        /// <summary>Plays an <c>IAudioPackage</c> by passing it an <c>EventArgs.Empty</c>.</summary>
        /// <returns>The instantiated <c>PoolableAudio</c> which will be used to play the given <c>IAudioPackage</c>.</returns>
        public static PoolableAudio Play(IAudioPackage package) => Play(package, EventArgs.Empty);
Пример #4
0
 protected override void OnLoadingDone(object[] values)
 {
     leftAudio  = (AudioPackage)values[0];
     rightAudio = (IAudioPackage)values[1];
 }