예제 #1
0
	public static IEnumerator PopulateResourceSongToPlaylistControllerAsync(string songResourceName, string playlistName, PlaylistController controller, PlaylistController.AudioPlayType playType) {
		MasterAudio.LogError("If this method got called, please report it to Dark Tonic immediately. It should not happen.");
		yield break;
	}
        public static IEnumerator PopulateResourceSongToPlaylistControllerAsync(string songResourceName,
            string playlistName, PlaylistController controller, PlaylistController.AudioPlayType playType) {
            var asyncRes = Resources.LoadAsync(songResourceName, typeof(AudioClip));

            while (!asyncRes.isDone) {
                yield return MasterAudio.EndOfFrameDelay;
            }

            var resAudioClip = asyncRes.asset as AudioClip;

            if (resAudioClip == null) {
                MasterAudio.LogWarning("Resource file '" + songResourceName + "' could not be located from Playlist '" +
                                       playlistName + "'.");
                yield break;
            }

            if (!AudioUtil.AudioClipWillPreload(resAudioClip)) {
                MasterAudio.LogWarning("Audio Clip for Resource file '" + songResourceName + "' from Playlist '" +
                    playlistName + "' has 'Preload Audio Data' turned off, which can cause audio glitches. Resource files should always Preload Audio Data. Please turn it on.");
            }

            FinishRecordingPlaylistClip(controller.ControllerName, resAudioClip);

            controller.FinishLoadingNewSong(resAudioClip, playType);
        }
예제 #3
0
        public static IEnumerator PopulateResourceSongToPlaylistControllerAsync(string songResourceName,
            string playlistName, PlaylistController controller, PlaylistController.AudioPlayType playType) {
            var asyncRes = Resources.LoadAsync(songResourceName, typeof(AudioClip));

            while (!asyncRes.isDone) {
                yield return MasterAudio.EndOfFrameDelay;
            }

            var resAudioClip = asyncRes.asset as AudioClip;

            if (resAudioClip == null) {
                MasterAudio.LogWarning("Resource file '" + songResourceName + "' could not be located from Playlist '" +
                                       playlistName + "'.");
                yield break;
            }

            FinishRecordingPlaylistClip(controller.ControllerName, resAudioClip);

            controller.FinishLoadingNewSong(resAudioClip, playType);
        }
예제 #4
0
 // ReSharper disable once UnusedMember.Local
 private void Start()
 {
     _controller = PlaylistController.InstanceByName(playlistControllerName);
     _controller.SongEnded += SongEnded;
 }