public static void PlayIfNotNull(this AudioBlock audioBlock)
 {
     if (audioBlock)
     {
         audioBlock.Play();
     }
 }
        internal void RaiseRenderingAudioEvent(AudioBlock audioBlock, TimeSpan clock)
        {
            var args = new RenderingAudioEventArgs(
                audioBlock.Buffer, audioBlock.BufferLength, Container.MediaInfo.Streams[audioBlock.StreamIndex], audioBlock.StartTime, audioBlock.Duration, clock);

            RenderingAudio?.Invoke(this, args);
        }
示例#3
0
        public void AudioBlockNoTitle()
        {
            var block = new AudioBlock();
            var title = block.GetTitle();

            Assert.Equal("No audio selected", title);
        }
示例#4
0
 private void OnLevelWasLoaded(int level)
 {
     if (gameStart)
     {
         cameraMovement = FindObjectOfType <CameraMovement>();
     }
     audio = FindObjectOfType <AudioBlock>();
     currentCoinAtStart = currentCoin;
     if (SceneManager.GetActiveScene().name == "Stage05")
     {
         Debug.Log("BOSS LEVEL!");
     }
 }
        internal void RaiseRenderingAudioEvent(AudioBlock audioBlock, TimeSpan clock)
        {
            if (RenderingAudio == null)
            {
                return;
            }

            var e = new RenderingAudioEventArgs(
                audioBlock.Buffer,
                audioBlock.BufferLength,
                MediaCore.MediaInfo.Streams[audioBlock.StreamIndex],
                audioBlock.StartTime,
                audioBlock.Duration,
                clock);

            RenderingAudio?.Invoke(this, e);
        }
示例#6
0
        void Awake()
        {
            _runtimeAudioSettings = new RuntimeChangableSettings();
            _generalAudioSettings = new GeneralAudioSettings();

            LoadRuntimeChangableAudioSettings();
            LoadAudioConfiguration();

            musicSource = AddAudioSource();
            soundSource = new List <AudioSource>();
            soundSource.Add(AddAudioSource());

            audioBlock        = new AudioBlock();
            delay             = 0;
            _musicTrackVolume = 0;
            _musicState       = MusicStates.Default;
        }
示例#7
0
    void Start()
    {
        gameStart          = true;
        audio              = FindObjectOfType <AudioBlock>();
        cameraMovement     = FindObjectOfType <CameraMovement>();
        currentCoinUI.text = currentCoin.ToString();
        currentLifeUI.text = currentLife.ToString();
        Debug.Log("GameStatus started");
        canvasHealth = FindObjectOfType <CanvasHealth>();
        //loadGameoverScene = SceneManager.LoadSceneAsync("Gameover");
        //loadGameoverScene.allowSceneActivation = false;

        if (SceneManager.GetActiveScene().name == "Stage05")
        {
            Debug.Log("BOSS LEVEL!");
        }

        Instantiate(heart);
    }
示例#8
0
        public async Task AudioBlockHasTitle()
        {
            using (var api = CreateApi())
            {
                var media = await api.Media.GetByIdAsync(image1Id);

                var block = new AudioBlock()
                {
                    Body = new Extend.Fields.AudioField
                    {
                        Id    = media.Id,
                        Media = media
                    }
                };
                var title = block.GetTitle();

                Assert.Equal("HLD_Screenshot_01_mech_1080.png", title);
            }
        }
示例#9
0
        private static void HandleAudioFrame(AudioBlock e)
        {
            TotalBytes += (ulong)e.BufferLength;
            PrintFrameInfo(e);

            if (IsBenchmarking)
            {
                return;
            }
            if (DecompressDispatcher == null)
            {
                return;
            }

            if (SaveWaveFile)
            {
                DecompressDispatcher.Invoke(() =>
                {
                    var outputBytes = new byte[e.BufferLength];
                    Marshal.Copy(e.Buffer, outputBytes, 0, outputBytes.Length);
                    AudioData.AddRange(outputBytes);
                });
            }
        }
        void OnGUI()
        {
            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            Color defaultColor = GUI.color;

            GUILayout.Space(9);

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(38f);
            EditorGUILayout.LabelField("General audio settings", EditorStyles.boldLabel, GUILayout.Width(150f));
            DrawImage(_gearIcon, 20f, 20f, 10f, 0f);
            EditorGUILayout.EndHorizontal();

            GUILayout.Space(12);

            _runtimeAudioSettings.Draw();
            _generalAudioSettings.DrawGUI();
            _fadingSettings.DrawGUI();

            GUILayout.Space(12);

            /*
             *          EditorGUILayout.BeginHorizontal ();
             *          EditorGUILayout.LabelField ("Fade time", GUILayout.Width (180));
             *          fadeTime = EditorGUILayout.FloatField (fadeTime, GUILayout.Width (120));
             *          if (fadeTime < 0)
             *                  fadeTime = 0;
             *          EditorGUILayout.EndHorizontal ();
             *          EditorGUILayout.BeginHorizontal ();
             *          EditorGUILayout.LabelField ("Use fade ON", GUILayout.Width (180));
             *          useFadeOn = EditorGUILayout.Toggle (useFadeOn, GUILayout.Width (120));
             *          EditorGUILayout.EndHorizontal ();
             *
             *          GUILayout.Space (12);
             */

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("New Audio Block", GUILayout.Width(250)))
            {
                AudioBlock newBlock = new AudioBlock();
                newBlock.name = GetUniqueBlockName();
                audioData.Add(newBlock.name, newBlock);
            }
            EditorGUILayout.EndHorizontal();

            string removeKey = "";

            if (audioData != null)
            {
                foreach (var item in audioData)
                {
                    GUILayout.Space(12);
                    AEditorTool.DrawSeparator(AEditorTool.SeparationStyle.BigDark);

                    var block = item.Value;

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Audio Block Name:");
                    if (GUILayout.Button("Remove", GUILayout.Width(60)))
                    {
                        removeKey = item.Key;
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    string name = block.name;
                    name = EditorGUILayout.TextField(name, GUILayout.MinWidth(100), GUILayout.MaxWidth(250));
                    if (audioData.ContainsKey(name) && audioData[name] != block)
                    {
                        name = GetUniqueBlockName(name);
                    }
                    block.name = name;
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(12);

                    EditorGUILayout.BeginHorizontal();
                    GUI.color = Color.green;
                    EditorGUILayout.LabelField("Music:");
                    GUI.color = defaultColor;
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Delay between musics", GUILayout.Width(150));
                    block.music.delay = EditorGUILayout.FloatField(block.music.delay, GUILayout.Width(40));
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField("Not reply length", GUILayout.Width(150));
                    block.music.musicNotReplyCount = EditorGUILayout.IntField(block.music.musicNotReplyCount, GUILayout.Width(40));
                    if (block.music.musicNotReplyCount < 0)
                    {
                        block.music.musicNotReplyCount = 0;
                    }
                    EditorGUILayout.EndHorizontal();
                    GUILayout.Space(6);

                    DrawTrackList(block.music, true);
                    GUILayout.Space(6);

                    EditorGUILayout.BeginHorizontal();
                    GUI.color = Color.green;
                    EditorGUILayout.LabelField("Sound:");
                    GUI.color = defaultColor;
                    EditorGUILayout.EndHorizontal();

                    DrawTrackList(block.sound, false);
                }
            }

            if (removeKey != "")
            {
                audioData.Remove(removeKey);
            }

            GUILayout.Space(12);
            if (GUILayout.Button("Save"))
            {
                SaveConfiguration(true);
                SaveNamesInCode();
            }
            GUILayout.Space(20);
            EditorGUILayout.EndScrollView();
        }
 private void Start()
 {
     gameStatus = FindObjectOfType <GameStatus>();
     audio      = FindObjectOfType <AudioBlock>();
 }