Exemple #1
0
        private static void PlayMusicGroup(InMusicGroup toPlay, double playTime, int skipSamples)
        {
            var musicPool = InAudioInstanceFinder.InMusicPlayerPool;
            var mixer     = toPlay.GetUsedMixerGroup();

            toPlay.PlayingInfo.State = MusicState.Playing;
            var editorClips = toPlay._clips;
            int clipCount   = editorClips.Count;
            var playingInfo = toPlay.PlayingInfo;

            playingInfo.State   = MusicState.Playing;
            playingInfo.DoAtEnd = MusicState.Nothing;

            for (int j = 0; j < clipCount; j++)
            {
                var player = musicPool.GetObject();
                toPlay.PlayingInfo.Players.Add(player);
                player.clip                  = editorClips[j];
                player.loop                  = toPlay._loop;
                player.timeSamples           = skipSamples;
                player.outputAudioMixerGroup = mixer;
                player.PlayScheduled(playTime);
            }


            for (int i = 0; i < toPlay._children.Count; i++)
            {
                PlayMusicGroup(toPlay._children[i] as InMusicGroup, playTime, skipSamples);
            }
        }
Exemple #2
0
        private static void PlayMusicGroup(InMusicGroup toPlay, double playTime, int skipSamples)
        {
            var musicPool = InAudioInstanceFinder.InMusicPlayerPool;
            var mixer     = toPlay.GetUsedMixerGroup();

            toPlay.PlayingInfo.State = MusicState.Playing;
            var editorClips = toPlay._clips;
            int clipCount   = editorClips.Count;
            var playingInfo = toPlay.PlayingInfo;

            playingInfo.State   = MusicState.Playing;
            playingInfo.DoAtEnd = MusicState.Nothing;

            for (int j = 0; j < clipCount; j++)
            {
                var player = musicPool.GetObject();
                toPlay.PlayingInfo.Players.Add(player);
                toPlay.PlayingInfo.StartedAtDSPTime = playTime;
                player.clip                  = editorClips[j];
                player.loop                  = toPlay._loop;
                player.timeSamples           = skipSamples;
                player.outputAudioMixerGroup = mixer;
#if UNITY_WEBGL
                player.Play(0); // SK: HACK: Workaround for https://issuetracker.unity3d.com/issues/playschedule-does-not-loop-audio-in-webgl-build
#else
                player.PlayScheduled(playTime);
#endif

                // SK: Koreographer integration
                var visor = player.GetComponent <SonicBloom.Koreo.Players.AudioSourceVisor>();
                if (!visor)
                {
                    visor = player.gameObject.AddComponent <SonicBloom.Koreo.Players.AudioSourceVisor>();
                }
                visor.ScheduledPlayTime = playTime;
                visor.ResyncTimings(0);
            }


            for (int i = 0; i < toPlay._children.Count; i++)
            {
                PlayMusicGroup(toPlay._children[i] as InMusicGroup, playTime, skipSamples);
            }
        }
Exemple #3
0
        private static void PlayMusicGroup(InMusicGroup toPlay, double playTime, int skipSamples)
        {
            var musicPool = InAudioInstanceFinder.InMusicPlayerPool;
            var mixer = toPlay.GetUsedMixerGroup();
            toPlay.PlayingInfo.State = MusicState.Playing;
            var editorClips = toPlay._clips;
            int clipCount = editorClips.Count;
            var playingInfo = toPlay.PlayingInfo;
            playingInfo.State = MusicState.Playing;
            playingInfo.DoAtEnd = MusicState.Nothing;

            for (int j = 0; j < clipCount; j++)
            {
                var player = musicPool.GetObject();
                toPlay.PlayingInfo.Players.Add(player);
                player.clip = editorClips[j];
                player.loop = toPlay._loop;
                player.timeSamples = skipSamples;
                player.outputAudioMixerGroup = mixer;
                player.PlayScheduled(playTime);
            }


            for (int i = 0; i < toPlay._children.Count; i++)
            {
                PlayMusicGroup(toPlay._children[i] as InMusicGroup, playTime, skipSamples);
            }
        }