private void PlayGraph() { playableGraph = PlayableGraph.Create(); playableGraph.SetTimeUpdateMode(DirectorUpdateMode.GameTime); AudioPlayableOutput audioOutput = AudioPlayableOutput.Create(playableGraph, "AudioOut", audioManager.musicSource); AudioClipPlayable clipPlayable = AudioClipPlayable.Create(playableGraph, audioManager.songs[audioManager.selectedSongIndex], false); audioOutput.SetSourcePlayable(clipPlayable); AudioMixerPlayable mixer = AudioMixerPlayable.Create(playableGraph); //playableDirector.SetGenericBinding(); //audiTrack = playableGraph.Co //audiTrack.CreateClip(audioManager.songs[audioManager.selectedSongIndex]); //audiTrack.CreatePlayable(playableGraph, this.gameObject); playableGraph.Play(); playableGraphIsSet = true; // BindTimelineTracks(); //playableDirector.Play(); }
void Start() { mPlayableGraph = PlayableGraph.Create("AudioManager"); mAudioOutput = AudioPlayableOutput.Create(mPlayableGraph, "Audio", GetComponent <AudioSource>()); mAudioClipPlayable01 = AudioClipPlayable.Create(mPlayableGraph, AudioClips[0], true); mAudioClipPlayable02 = AudioClipPlayable.Create(mPlayableGraph, AudioClips[1], true); mAudioMixerPlayable = AudioMixerPlayable.Create(mPlayableGraph, 2); mPlayableGraph.Connect(mAudioClipPlayable01, 0, mAudioMixerPlayable, 0); mPlayableGraph.Connect(mAudioClipPlayable02, 0, mAudioMixerPlayable, 1); mAudioOutput.SetSourcePlayable(mAudioMixerPlayable); mPlayableGraph.Play(); mInited = true; }