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


C# SoundState类代码示例

本文整理汇总了C#中SoundState的典型用法代码示例。如果您正苦于以下问题:C# SoundState类的具体用法?C# SoundState怎么用?C# SoundState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: HandleSoundBufferRecycled

 /// <summary>
 /// Event handler that resets internal state of this instance. The sound state will report
 /// SoundState.Stopped after this event handler.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void HandleSoundBufferRecycled(object sender, EventArgs e)
 {
     sourceId = 0;
     hasSourceId = false;
     soundState = SoundState.Stopped;
     //Console.WriteLine ("recycled: " + soundEffect.Name);
 }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:13,代码来源:SoundEffectInstance.OpenAL.cs

示例2: PlatformPlay

        private void PlatformPlay()
        {
            if (_soundPlayer != null)
                _soundPlayer.Play();

            soundState = SoundState.Playing;
        }
开发者ID:Breadmouth,项目名称:Gravitas,代码行数:7,代码来源:SoundEffectInstance.PSM.cs

示例3: PlatformPause

        private void PlatformPause()
        {
            if (_soundPlayer != null)
                _soundPlayer.Stop();

            soundState = SoundState.Paused;
        }
开发者ID:Breadmouth,项目名称:Gravitas,代码行数:7,代码来源:SoundEffectInstance.PSM.cs

示例4: PlatformPause

        private void PlatformPause()
        {
			if (streamId == 0)
				return;

			s_soundPool.Pause(streamId);
            soundState = SoundState.Paused;
        }
开发者ID:procfxgen,项目名称:MGShaderEditor,代码行数:8,代码来源:SoundEffectInstance.Android.cs

示例5: Pause

		public void Pause ()
		{
            if ( _sound != null )
			{
				_sound.Pause();
				soundState = SoundState.Paused;
			}
		}
开发者ID:ustor,项目名称:MonoGame,代码行数:8,代码来源:SoundEffectInstance.cs

示例6: PlatformStop

        private void PlatformStop(bool immediate)
        {
            if (_soundPlayer != null )
			{
				_soundPlayer.Stop();
			}
            
            soundState = SoundState.Stopped;
        }
开发者ID:Breadmouth,项目名称:Gravitas,代码行数:9,代码来源:SoundEffectInstance.PSM.cs

示例7: Play

 public void Play()
 {
     if (soundEffect != null)
       {
     soundEffect.Play();
     SoundState previousStateTemp = previousState;
     previousState = SoundState.Playing;
     if (SoundStateChanged != null)
       SoundStateChanged.Invoke(previousStateTemp, previousState);
       }
 }
开发者ID:msachs,项目名称:TestRepo2,代码行数:11,代码来源:SoundPlayer.cs

示例8: Load

 public void Load()
 {
     if (Status == SoundState.Unloaded)
     {
         Status = SoundState.Loading;
         // I commented out this code because we let windows handle loading mp3s.
         // Static song ctor requires a URI, which is a pain in the butt,
         // so we're going to just reflect out the ctor.
         /*var ctor = typeof(Song).GetConstructor(
             BindingFlags.NonPublic | BindingFlags.Instance, null,
             new[] { typeof(string), typeof(string), typeof(int) }, null);*/
         // m_Song = (Song)ctor.Invoke(new object[] { Name, Path, 0 });
         Status = SoundState.Loaded;
     }
 }
开发者ID:gautamabudha,项目名称:UltimaXNA,代码行数:15,代码来源:UOMusic.cs

示例9: PlatformDispose

        private void PlatformDispose(bool disposing)
        {
		    if (disposing)
            {
                if (_soundPlayer != null)
                {
                    _soundPlayer.Stop();
                    _soundPlayer.Dispose();
                }
                if (_audioBuffer != null)
                    _audioBuffer.Dispose();
            }
            _soundPlayer = null;
            _audioBuffer = null;
            soundState = SoundState.Stopped;
        }
开发者ID:Breadmouth,项目名称:Gravitas,代码行数:16,代码来源:SoundEffectInstance.PSM.cs

示例10: ChangState

 public void ChangState()
 {
     
     if (Count % 2 == 0)
     {
         currentSoundState = SoundState.OFF;
         mutte.SetActive(true);
         Count++;
         StopGameAudio();
     }
     else
     {
         currentSoundState = SoundState.ON;
         mutte.SetActive(false);
         Count++;
         PlayMenuAudio();
     }
     
 }
开发者ID:quangdai02031994,项目名称:FindNumber,代码行数:19,代码来源:SoundController.cs

示例11: SetSound

        public void SetSound(Sound sound)
        {
            if (soundEffect != null)
            soundEffect.Stop();

              previousState = SoundState.Stopped;

              string path = CatrobatContext.Instance.CurrentProject.BasePath + "/" + Project.SoundsPath + "/" + sound.FileName;

              using (IStorage storage = StorageSystem.GetStorage())
              {
            if (storage.FileExists(path))
              using (Stream stream = storage.OpenFile(path, StorageFileMode.Open, StorageFileAccess.Read))
              {
            byte[] soundArray = new byte[stream.Length];
            stream.Read(soundArray, 0, soundArray.Length);
            stream.Close();
            soundEffect = new SoundEffect(soundArray, Microphone.Default.SampleRate, AudioChannels.Mono).CreateInstance();
              }
              }

              checkSoundThread = new System.Threading.Thread(checkIfSoundFinished);
        }
开发者ID:msachs,项目名称:TestRepo2,代码行数:23,代码来源:SoundPlayer.cs

示例12: Play

		public void Play ()
		{
#if WINRT
            if (_voice != null)
            {
                // Choose the correct buffer depending on if we are looped.            
                var buffer = _loop ? _effect._loopedBuffer : _effect._buffer;

                if (_voice.State.BuffersQueued > 0)
                {
                    _voice.Stop();
                    _voice.FlushSourceBuffers();
                }

                _voice.SubmitSourceBuffer(buffer, null);
                _voice.Start();
            }

		    _paused = false;
#else
			if ( _sound != null )
			{
#if ANDROID
				if (soundState == SoundState.Paused)
					_sound.Resume(_streamId);
				else
					_streamId = _sound.Play();
#else
				if (soundState == SoundState.Paused)
					_sound.Resume();
				else
					_sound.Play();
#endif
				soundState = SoundState.Playing;
			}
#endif
		}
开发者ID:fragcastle,项目名称:MonoGame,代码行数:37,代码来源:SoundEffectInstance.cs

示例13: Resume

		public void Resume()
		{
#if WINRT
            if (_voice != null)
            {
                // Restart the sound if (and only if) it stopped playing
                if (!_loop)
                {
                    if (_voice.State.BuffersQueued == 0)
                    {
                        _voice.Stop();
                        _voice.FlushSourceBuffers();
                        _voice.SubmitSourceBuffer(_effect._buffer, null);
                    }
                }
                _voice.Start();
            }
            _paused = false;
#else
			if ( _sound != null )
			{
				if (soundState == SoundState.Paused)
				{
#if ANDROID
					_sound.Resume(_streamId);
#else
                    _sound.Resume();
#endif
                }
				soundState = SoundState.Playing;
 			}
#endif
		}
开发者ID:fragcastle,项目名称:MonoGame,代码行数:33,代码来源:SoundEffectInstance.cs

示例14: Pause

		public void Pause ()
		{
#if WINRT         
            if (_voice != null)
                _voice.Stop();
            _paused = true;
#else
            if ( _sound != null )
			{
#if ANDROID
				_sound.Pause(_streamId);
#else
				_sound.Pause();
#endif
                soundState = SoundState.Paused;
			}
#endif
		}
开发者ID:fragcastle,项目名称:MonoGame,代码行数:18,代码来源:SoundEffectInstance.cs

示例15: Update

        //Update all of the elements that need updating in the Controller Detect Screen
        public override void Update(GameTime theTime)
        {
            MouseState mouse = Mouse.GetState();

            Rectangle hoverPosition = new Rectangle(mouse.X, mouse.Y, 1, 1);
            if (hoverPosition.Intersects(btnKembaliPosition))
            {
                btnKembali = btnKembaliHover;
            }
            else
            {
                btnKembali = btnKembaliActive;
            }

            if (mouse.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                Point pointer = new Point(mouse.X, mouse.Y);
                if (btnKembaliPosition.Contains(pointer))
                {
                    Game1.MOUSE_DOWN.Play();
                    Thread.Sleep(200);
                    if (PlayScreen.SUB_LEVEL == Game1.LEVEL11 || PlayScreen.SUB_LEVEL == Game1.LEVEL12)
                    {
                        ScreenEvent.Invoke(Game1.LEVEL1, new EventArgs());
                        return;
                    }
                    else if (PlayScreen.SUB_LEVEL == Game1.LEVEL21 || PlayScreen.SUB_LEVEL == Game1.LEVEL22)
                    {
                        ScreenEvent.Invoke(Game1.LEVEL2, new EventArgs());
                        return;
                    }
                    else
                    {
                        ScreenEvent.Invoke(Game1.LEVEL_SCREEN, new EventArgs());
                        return;
                    }
                }

                soundState = soundInstance.State;
                if (btnSoal1Position.Contains(pointer))
                {
                    if (currentSound == 1 && soundState == SoundState.Playing)
                    {
                        soundInstance.Stop();
                        btnSoal1 = btnPlay;
                    }
                    else
                    {
                        soundInstance.Stop();
                        soundInstance = soundSoal[0].CreateInstance();
                        btnSoal1 = btnStop;
                        soundInstance.Play();
                        soundState = soundInstance.State;
                        currentSound = 1;

                        btnSoal2 = btnPlay;
                        btnSoal3 = btnPlay;
                        btnSoal4 = btnPlay;
                        btnSoal5 = btnPlay;
                    }
                }
                else if (btnSoal2Position.Contains(pointer))
                {
                    if (currentSound == 2 && soundState == SoundState.Playing)
                    {
                        soundInstance.Stop();
                        btnSoal2 = btnPlay;
                    }
                    else
                    {
                        soundInstance.Stop();
                        soundInstance = soundSoal[1].CreateInstance();
                        btnSoal2 = btnStop;
                        soundInstance.Play();
                        soundState = soundInstance.State;
                        currentSound = 2;

                        btnSoal1 = btnPlay;
                        btnSoal3 = btnPlay;
                        btnSoal4 = btnPlay;
                        btnSoal5 = btnPlay;
                    }
                }
                else if (btnSoal3Position.Contains(pointer))
                {if (currentSound == 3 && soundState == SoundState.Playing)
                    {
                        soundInstance.Stop();
                        btnSoal3 = btnPlay;
                    }
                    else
                    {
                        soundInstance.Stop();
                        soundInstance = soundSoal[2].CreateInstance();
                        btnSoal3 = btnStop;
                        soundInstance.Play();
                        soundState = soundInstance.State;
                        currentSound = 3;

                        btnSoal1 = btnPlay;
//.........这里部分代码省略.........
开发者ID:januar,项目名称:AlGame,代码行数:101,代码来源:SoalScreen.cs


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