当前位置: 首页>>代码示例>>C#>>正文


C# IAudioStream.Play方法代码示例

本文整理汇总了C#中IAudioStream.Play方法的典型用法代码示例。如果您正苦于以下问题:C# IAudioStream.Play方法的具体用法?C# IAudioStream.Play怎么用?C# IAudioStream.Play使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IAudioStream的用法示例。


在下文中一共展示了IAudioStream.Play方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test1

        public bool Test1(IAudioStream audio, int state)
        {
            if (state == 0)
                Debug.WriteLine("Test #1: play, pause, stop and global stop");

            if (state == 2)
            {
                Debug.WriteLine("----> play for five seconds");
                audio.Play();
            }

            if (state == 7)
            {
                Debug.WriteLine("----> pause music for two seconds");
                audio.Pause();
            }

            if (state == 9)
            {
                Debug.WriteLine("----> play music for five seconds");
                audio.Play();
            }

            if (state == 14)
            {
                Debug.WriteLine("----> stop music for two seconds");
                audio.Stop();
            }

            if (state == 16)
            {
                Debug.WriteLine("----> play music for five seconds");
                audio.Play();
            }

            if (state == 21)
            {
                Debug.WriteLine("----> global stop for two seconds");
                Audio.Instance.Stop();
            }

            if (state == 23)
            {
                Debug.WriteLine("----> play music for five seconds");
                audio.Play();
            }

            if (state != 28)
                return false;

            audio.Stop();
            return true;
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:53,代码来源:Tests.cs

示例2: Test2

        public bool Test2(IAudioStream audio, int state)
        {
            if (state == 0)
                Debug.WriteLine("Test #2: lower global volume from 100 to 0");

            if (state >= 2)
            {
                Audio.Instance.SetVolume(100 - ((state - 2)*20));
                Debug.WriteLine("----> global volume set to: " + Audio.Instance.GetVolume());

                audio.Play();
            }

            return state == 7;
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:15,代码来源:Tests.cs

示例3: Test3

        public bool Test3(IAudioStream audio, int state)
        {
            if (state == 0)
            {
                Audio.Instance.SetVolume(100);
                audio.Volume = 0;

                Debug.WriteLine("Test #3: raise individual volume from 0 to 100");
            }

            if (state >= 2)
            {
                audio.Volume = ((state - 2)*20);
                Debug.WriteLine("----> individual volume set to: " + audio.Volume);

                audio.Play();
            }

            return (state == 7);
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:20,代码来源:Tests.cs

示例4: Test7

        public bool Test7(IAudioStream audio, int state)
        {
            if (state == 0)
                Debug.WriteLine("Test #7: individual panning from right to left");

            if (state == 2)
                audio.Play();

            if (state >= 2 && state < 19)
            {
                audio.Panning = 100 - ((state - 2)*12.5f);
                Debug.WriteLine("----> individual panning set to: " + audio.Panning);
            }

            if (state != 19)
                return false;

            audio.Stop();
            return true;
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:20,代码来源:Tests.cs

示例5: Test6

        public bool Test6(IAudioStream audio, int state)
        {
            if (state == 0)
                Debug.WriteLine("Test #6: global panning from left to right");

            if (state == 2)
                audio.Play();

            if (state >= 2 && state < 19)
            {
                Audio.Instance.SetPanning(-100 + ((state - 2)*12.5f));
                Debug.WriteLine("----> global panning set to: " + audio.Panning);
            }

            if (state != 19)
                return false;

            audio.Stop();
            Audio.Instance.SetPanning(0);

            return true;
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:22,代码来源:Tests.cs

示例6: Test5

        public bool Test5(IAudioStream audio, int state)
        {
            if (state == 0)
                Debug.WriteLine("Test #5: looping for 2 seconds with loop as parameter");

            if (state == 2)
                audio.Play(true);

            if (state != 4)
                return false;

            audio.Loop = false;
            return true;
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:14,代码来源:Tests.cs

示例7: Test4

        public bool Test4(IAudioStream audio, int state)
        {
            if (state == 0)
                Debug.WriteLine("Test #4: looping for 2 seconds with loop as attribute");

            if (state == 2)
            {
                audio.Loop = true;
                audio.Play();
            }

            if (state != 4)
                return false;

            audio.Loop = false;
            return true;
        }
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:17,代码来源:Tests.cs

示例8: Init

        public override void Init()
        {
            // Initialisierung der Sound-Dateien (.mp3)
            _ton_sammeln = Audio.Instance.LoadFile("Assets/schmotzer1.mp3", true);
            _ton_weg = Audio.Instance.LoadFile("Assets/Klick2.mp3", true);
            _ton_abgeben = Audio.Instance.LoadFile("Assets/slash1.mp3", true);
            _ton_fliegen = Audio.Instance.LoadFile("Assets/biene_LOOP2.mp3", true);
            _ton_hintergrund = Audio.Instance.LoadFile("Assets/backgroundmusic_tech.mp3",true);
            // Initialisierung der Fenstergröße
            _screenWidth = Screen.PrimaryScreen.Bounds.Width;
            _screenWidthAspect = 1;
            _screenHeight = Screen.PrimaryScreen.Bounds.Height;
            _screenHeightAspect = 1;
            SetWindowSize(_screenWidth, _screenHeight / 9 * 2, true, 0, 0);

            var seri = new Serializer();

            #region LevelInit
            using (var fileLevel = File.OpenRead(@"Assets/ground.fus"))
            {
                _levelSC = seri.Deserialize(fileLevel, null, typeof(SceneContainer)) as SceneContainer;
            }
            _levelSR = new SceneRenderer(_levelSC, "Assets");
            _levelSOC = FindByName("landscape_container", _levelSC.Children);
            //_levelSOC.Transform.Scale = _levelSOC.Transform.Scale / 30;

            using (var fileLevel = File.OpenRead(@"Assets/Bienenstock.fus"))
            {
                _stockSC = seri.Deserialize(fileLevel, null, typeof(SceneContainer)) as SceneContainer;
            }
            _stockSR = new SceneRenderer(_stockSC, "Assets");
            _stockSOC = FindByName("bienenstock", _stockSC.Children);
            #endregion

            #region PlayerInit
            using (var filePlayer = File.OpenRead(@"Assets/Biene.fus"))
            {
                _playerSC = seri.Deserialize(filePlayer, null, typeof(SceneContainer)) as SceneContainer;
            }
            _playerSR = new SceneRenderer(_playerSC, "Assets");
            _playerSOC = FindByName("Biene", _playerSC.Children);
            _playerSOC.Transform.Scale = _playerSOC.Transform.Scale / 25;
            _playerSOC.Transform.Rotation.z = _twoPi/2;
            _playerSOC.Transform.Rotation.x = _twoPi/2;

            if (_playerSOC != null)
            {
                _playerSOC.Transform.Translation.z = 200;
                _playerSOC.Transform.Translation.y = 500;
            }
            #endregion

            #region ArrayInit
            _sOClist = new SceneObjectContainer[_lanesArray][];
            _sRlist = new SceneRenderer[_lanesArray][];
            _scene = new SceneContainer[_lanesArray][];

            for (int c1 = 0; c1 < _sOClist.Length; c1++)
            {
                _sOClist[c1] = new SceneObjectContainer[_arrayLength];
            }
            for (int c2 = 0; c2 < _sOClist.Length; c2++)
            {
                _sRlist[c2] = new SceneRenderer[_arrayLength];
            }
            for (int c3 = 0; c3 < _sOClist.Length; c3++)
            {
                _scene[c3] = new SceneContainer[_arrayLength];
            }

            //Enemy
            _enemySOClist = new SceneObjectContainer[_lanesArray][];
            _enemySRlist = new SceneRenderer[_lanesArray][];
            _enemyScene = new SceneContainer[_lanesArray][];

            for (int c1 = 0; c1 < _enemySOClist.Length; c1++)
            {
                _enemySOClist[c1] = new SceneObjectContainer[_arrayLength];
            }
            for (int c2 = 0; c2 < _enemySOClist.Length; c2++)
            {
                _enemySRlist[c2] = new SceneRenderer[_arrayLength];
            }
            for (int c3 = 0; c3 < _enemySOClist.Length; c3++)
            {
                _enemyScene[c3] = new SceneContainer[_arrayLength];
            }

            _objCountOnLane = new int[_lanesArray];
            for (int c4 = 0; c4 < _objCountOnLane.Length; c4++)
            {
                _objCountOnLane[c4] = 0;
            }
            _enemyMove = new bool[_arrayLength];
            for (int c5 = 0; c5 < _enemyMove.Length; c5++)
            {
                _enemyMove[c5] = true;
            }
            #endregion

//.........这里部分代码省略.........
开发者ID:juradosa,项目名称:BeeTheGame,代码行数:101,代码来源:Main.cs


注:本文中的IAudioStream.Play方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。