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


C# PlayState类代码示例

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


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

示例1: PlayFile

        public void PlayFile(string path)
        {
            try
            {
                if (!File.Exists(path))
                {
                    if (PlayFinishedEvent != null)
                    {
                        PlayFinishedEvent(this, EventArgs.Empty);
                    }
                }
                if (image != null)
                    image.Dispose();
                image = new Bitmap(path);
                state = PlayState.Running;
                tickcount = 0;
                Refresh();
            }
            catch (Exception exp)
            {

                if (PlayFinishedEvent != null)
                {
                    PlayFinishedEvent(this, EventArgs.Empty);
                }

            }
        }
开发者ID:siqiaochen,项目名称:ContentManager,代码行数:28,代码来源:UserControlImageSurface.cs

示例2: WaveSoundPlayer

        public WaveSoundPlayer(WaveFile w, bool loop)
        {
            ac = new AudioContext ();

            bufferlist = new List<int> (NUM_BUFFERS);
            bufferlist.AddRange (AL.GenBuffers (NUM_BUFFERS));

            source = AL.GenSource ();
            this._PlayState = PlayState.NotLoaded;

            wfile = w;
            bufferlist.ForEach (x => {
                byte[] buf = new byte[BUFFER_SIZE];
                buf = wfile.DataBinary.ReadBytes(BUFFER_SIZE);
                AL.BufferData(x,wfile.SoundFormat,buf,buf.Length,wfile.SampleRate);
            });

            AL.SourceQueueBuffers (source, NUM_BUFFERS, bufferlist.ToArray ());
            if (loop)
                AL.Source (source, ALSourceb.Looping, true);

            System.Diagnostics.Debug.WriteLine (AL.GetSourceState(source).ToString());

            this._PlayState = PlayState.Stopped;
        }
开发者ID:Carrot031,项目名称:EasyOpenAL,代码行数:25,代码来源:WaveSoundPlayer.cs

示例3: OnPlayStateChanged

        /// <summary>
        ///     Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        ///     Play State changes cannot be cancelled. They are raised even if the application
        ///     caused the state change itself, assuming the application has opted-in to the callback.
        ///     Notable playstate events:
        ///     (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        ///     (b) TrackReady: an audio track has been set and it is now ready for playack.
        ///     Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            Debug.WriteLine("OnPlayStateChanged() playState " + playState);

            switch (playState)
            {
                case PlayState.TrackEnded:
                    player.Track = GetPreviousTrack();
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:henricj,项目名称:HttpClientBackgroundAudio,代码行数:49,代码来源:AudioPlayer.cs

示例4: VideoService

        public VideoService(
            Rectangle viewFinder,
            MediaElement player
            )
        {
            // Initial State
            _State = PlayState.Paused;
            _CanRecord = false;

            _Record = new SwitchableCommand(OnRecord);
            _Play = new SwitchableCommand(OnPlay);
            _Stop = new SwitchableCommand(OnPause);

            _ViewFinder = viewFinder;

            _Player = player;
            _Player.MediaEnded += MediaEnded;

            _CaptureSource = new CaptureSource();
            _CaptureSource.CaptureFailed += CaptureFailed;

            _FileSink = new FileSink();
            _Brush = new VideoBrush();

            _HasRecording = new BehaviorSubject<bool>(false);
        }
开发者ID:SNSB,项目名称:DiversityMobile,代码行数:26,代码来源:VideoService.cs

示例5: OnPlayStateChanged

        /// <summary>
        /// playstate 更改时调用,但 Error 状态除外(参见 OnError)
        /// </summary>
        /// <param name="player">BackgroundAudioPlayer</param>
        /// <param name="track">在 playstate 更改时播放的曲目</param>
        /// <param name="playState">播放机的新 playstate </param>
        /// <remarks>
        /// 无法取消播放状态更改。即使应用程序
        /// 导致状态自行更改也会提出这些更改,假定应用程序已经选择了回调。
        ///
        /// 值得注意的 playstate 事件:
        /// (a) TrackEnded: 播放器没有当前曲目时激活。代理可设置下一曲目。
        /// (b) TrackReady: 音轨已设置完毕,现在可以播放。
        ///
        /// 只在代理请求完成之后调用一次 NotifyComplete(),包括异步回调。
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    //player.Track = GetPreviousTrack();
                    //player.Track = GetNextTrack();
                    PlayNextTrack(player);
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: 在此处理关机状态(例如保存状态)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:vicalloy,项目名称:lb.ting,代码行数:51,代码来源:AudioPlayer.cs

示例6: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        /// 
        /// Notable playstate events: 
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    player.Track = GetNextTrack();
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    _playlistHelper.SetAllTracksToNotPlayingAndSave();
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:EchoDemon,项目名称:MediaBrowser.WindowsPhone,代码行数:50,代码来源:AudioPlayer.cs

示例7: Start

 void Start()
 {
     CameraScript.LoadData();
     State = PlayState.menu;
     //LUCE A SECONDA DELLA PIATTAFORMA
     if (Application.platform == RuntimePlatform.WP8Player
           #if UNITY_IPHONE
         || iPhone.generation == iPhoneGeneration.iPodTouch4Gen || iPhone.generation == iPhoneGeneration.iPodTouch3Gen ||
        iPhone.generation == iPhoneGeneration.iPodTouch2Gen || iPhone.generation == iPhoneGeneration.iPodTouch1Gen ||
        iPhone.generation == iPhoneGeneration.iPhone3GS || iPhone.generation == iPhoneGeneration.iPhone4 ||
        iPhone.generation == iPhoneGeneration.iPad2Gen || iPhone.generation == iPhoneGeneration.iPad1Gen
         #endif
         )
     {
         pglight.SetActive(false);
         wplight.SetActive(true);
     }
     else
     {
         wplight.SetActive(true);
         wplight.light.range=6f;
         pglight.SetActive(true);
     }
     GameCredits = 0;
 }
开发者ID:EmanueleGrassi,项目名称:Man-in-the-cave,代码行数:25,代码来源:PlayScript.cs

示例8: MovieScreen

        public MovieScreen()
        {
            InitializeComponent();

            movie_timer = new Timer();
            movie_timer.Tick += new EventHandler(movie_timer_Tick);
            play_state = PlayState.Close;
        }
开发者ID:qiuwch,项目名称:MotionSeg,代码行数:8,代码来源:MovieScreen.cs

示例9: Run

        public void Run()
        {
            // Start previewing video data
            int hr = this.mediaControl.Run();
            DsError.ThrowExceptionForHR(hr);

            // Remember current state
            this.currentState = PlayState.Running;
        }
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:9,代码来源:VideoSource.cs

示例10: Initialize

        public override void Initialize()
        {
            base.Initialize();

            playState = PlayState.running;
            spelObjektLista.Clear();
            gubbe = game.Player1;
            gubbe.Initialize(this);
            spelObjektLista.Add(gubbe);
        }
开发者ID:Jakob37,项目名称:JDGAME,代码行数:10,代码来源:LevelState.cs

示例11: OnPlayStateChanged

 protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
 {
     switch (playState)
     {
         case PlayState.TrackReady:
             player.Play();
             break;
     }
     NotifyComplete();
 }
开发者ID:OlivierRiberi,项目名称:3NET-SimpleRadio,代码行数:10,代码来源:AudioPlayer.cs

示例12: LevelState

        public LevelState(Game1 game, Sprite spriteSheet)
            : base(game)
        {
            this.spriteSheet = spriteSheet;
            font = game.Content.Load<SpriteFont>("vanligFont");
            random1 = new Random();

            Sprite tile = new Sprite(game.Content.Load<Texture2D>("Tiles/MudTile"));
            backgroundSprite = new BackgroundSprite(game.Window.ClientBounds.Width, game.Window.ClientBounds.Height, tile);

            playState = PlayState.running;
        }
开发者ID:Jakob37,项目名称:JDGAME,代码行数:12,代码来源:LevelState.cs

示例13: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        ///
        /// Notable playstate events:
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        ///
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackEnded:
                    //player.Track = GetPreviousTrack();
                    player.Track = null;
                    break;
                case PlayState.TrackReady:
                    player.Play();
                    connectedEvent.Set();

                    if (track != null && track.Tag != null)
                    {
                        var data = track.Tag.ToString().Split('$');
                        var url = data[data.Length - 1];
                        var title = data[1];
                        var type = data[2];

                        //#region from http://stackoverflow.com/questions/7159900/detect-application-launch-from-universal-volume-control
                        //MediaHistoryItem nowPlaying = new MediaHistoryItem();
                        //nowPlaying.Title = title;
                        //nowPlaying.PlayerContext.Add("station", title);
                        //MediaHistory.Instance.NowPlaying = nowPlaying;
                        //#endregion
                    }
                    break;
                case PlayState.Shutdown:
                    // TODO: Handle the shutdown state here (e.g. save state)
                    break;
                case PlayState.Unknown:
                    break;
                case PlayState.Stopped:
                    break;
                case PlayState.Paused:
                    break;
                case PlayState.Playing:
                    break;
                case PlayState.BufferingStarted:
                    break;
                case PlayState.BufferingStopped:
                    break;
                case PlayState.Rewinding:
                    break;
                case PlayState.FastForwarding:
                    break;
            }

            NotifyComplete();
        }
开发者ID:Amrykid,项目名称:Hanasu,代码行数:66,代码来源:AudioPlayer.cs

示例14: OnPlayStateChanged

        /// <summary>
        /// Called when the playstate changes, except for the Error state (see OnError)
        /// </summary>
        /// <param name="player">The BackgroundAudioPlayer</param>
        /// <param name="track">The track playing at the time the playstate changed</param>
        /// <param name="playState">The new playstate of the player</param>
        /// <remarks>
        /// Play State changes cannot be cancelled. They are raised even if the application
        /// caused the state change itself, assuming the application has opted-in to the callback.
        /// 
        /// Notable playstate events: 
        /// (a) TrackEnded: invoked when the player has no current track. The agent can set the next track.
        /// (b) TrackReady: an audio track has been set and it is now ready for playack.
        /// 
        /// Call NotifyComplete() only once, after the agent request has been completed, including async callbacks.
        /// </remarks>
        protected override void OnPlayStateChanged(BackgroundAudioPlayer player, AudioTrack track, PlayState playState)
        {
            switch (playState)
            {
                case PlayState.TrackReady:
                    // Wiedergabe wurde in PlayTrack() bereits festgelegt
                    player.Play();
                    break;
                case PlayState.TrackEnded:
                    PlayNextTrack(player);
                    break;
            }

            NotifyComplete();
        }
开发者ID:GregOnNet,项目名称:WP8BookSamples,代码行数:31,代码来源:AudioPlayer.cs

示例15: Metronome

 public Metronome()
 {
     mTempo = 100;
     mBeatsPerBar = 4;
     mMillisecondsBetweenBeats = 60000f / mTempo;
     mStopAfter = 100;
     mIncreaseAfter = 16;
     mIncreaseBy = 10;
     mIncreaseUpTo = 200;
     mTickCounter = 0;
     mPlayState = PlayState.Stopped;
     mPlayTimer = TimeSpan.Zero;
     mUpperTempoLimit = 500;
     mSpeedTemplates = new List<SpeedTemplate>();
     mRudiments = new List<Rudiment>();
 }
开发者ID:flackbash,项目名称:Drumtronome,代码行数:16,代码来源:Metronome.cs


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