示例#1
0
        /// <summary>
        /// Plays one-shot sound.
        /// </summary>
        /// <param name="name">Name of the sound.</param>
        /// <param name="volume">Volume of the sound. Value must be in [0;1] range.</param>
        /// <param name="pitch">Pitch of the sound. Value must be in [-3;3] range.</param>
        /// <param name="delay">Delay of the sound. Value must be greater or equal to zero.</param>
        /// <remarks>
        /// <para>If multiple banks have sounds with a matching name, primary sound bank will be checked first.
        /// Within a bank, the first occurrence of found sound will be used.</para>
        /// <para>Volume parameter value will override <see cref="Stem.SoundVariation"/>.<see cref="Stem.SoundVariation.Volume"/> value.</para>
        /// <para>Pitch parameter value will override <see cref="Stem.SoundVariation"/>.<see cref="Stem.SoundVariation.Pitch"/> value.</para>
        /// <para>Delay parameter value will override <see cref="Stem.SoundVariation"/>.<see cref="Stem.SoundVariation.Delay"/> value.</para>
        /// </remarks>
        public static void Play(string name, float volume, float pitch, float delay)
        {
            if (shutdown)
            {
                return;
            }

            SoundManagerRuntime runtime = bankManager.FetchRuntime(name);

            if (runtime != null)
            {
                runtime.Play(name, volume, pitch, delay);
            }
        }
示例#2
0
        /// <summary>
        /// Plays one-shot sound.
        /// </summary>
        /// <param name="name">Name of the sound.</param>
        /// <remarks>
        /// <para>If multiple banks have sounds with a matching name, primary sound bank will be checked first.
        /// Within a bank, the first occurrence of found sound will be used.</para>
        /// </remarks>
        public static void Play(string name)
        {
            if (shutdown)
            {
                return;
            }

            SoundManagerRuntime runtime = bankManager.FetchRuntime(name);

            if (runtime != null)
            {
                runtime.Play(name);
            }
        }