Exemplo n.º 1
0
    public void SetVoiceStealing(bool value)
    {
        useVoiceStealing = value;

        if (spawner == null)
        {
            return;
        }

        Stem.Sound sound = Stem.SoundManager.GetSound(spawner.soundName);
        if (sound == null)
        {
            return;
        }

        Stem.SoundBus bus = sound.Bus;
        if (bus != null)
        {
            bus.AllowVoiceStealing = useVoiceStealing;
        }

        if (text != null)
        {
            text.text = string.Format("Bus \"{0}\", Voices: {1}", bus.Name, bus.Polyphony);
        }
    }
Exemplo n.º 2
0
    private float GetSoundLength(string name)
    {
        Stem.Sound sound = Stem.SoundManager.GetSound(name);
        if (sound == null)
        {
            return(0.0f);
        }

        if (sound.Variations.Count == 0)
        {
            return(0.0f);
        }

        float soundLength = 0.0f;

        for (int i = 0; i < sound.Variations.Count; i++)
        {
            AudioClip clip = sound.Variations[i].Clip;
            if (clip == null)
            {
                continue;
            }

            soundLength = Mathf.Max(soundLength, clip.length);
        }

        return(soundLength);
    }