Exemplo n.º 1
0
 private void SetNextLoop(string p_clip)
 {
     for (int i = 0; i < backgroundClips.Length; i++)
     {
         string name = backgroundClips[i].clipName;
         if (name == p_clip)
         {
             nextClip = backgroundClips[i];
         }
     }
 }
Exemplo n.º 2
0
 void Start()
 {
     sources = new AudioSource[2];
     for (int i = 0; i < sources.Length; i++)
     {
         sources[i] = gameObject.AddComponent <AudioSource>() as AudioSource;
         sources[i].outputAudioMixerGroup = backgroundMixGroup;
     }
     //setup background loop meta data
     backgroundClips = new BackgroundClip[clips.Length];
     for (int i = 0; i < clips.Length; i++)
     {
         backgroundClips[i] = new BackgroundClip(clips[i], clipKeys[i], clipLengths[i]);
     }
 }
Exemplo n.º 3
0
    public void HandleTickChange(NotationTime currentTime)
    {
        if (currentTime.TimeAsTicks() == nextPlay.TimeAsTicks() - 1)
        {
            double nextPlayTime = Metronome.Instance.GetFutureTime(nextPlay);
            //sources[nextSource].clip = nextClip.clip;
            sources[nextSource].clip   = nextClip.clip;
            sources[nextSource].volume = 0.4f;
            sources[nextSource].PlayScheduled(nextPlayTime);
            //Set next time to play
            currentClip = nextClip;
            nextPlay.Add(currentClip.length);

            nextSource = (nextSource + 1) % sources.Length;
        }
    }