Beispiel #1
0
 private void StopPlayerData()
 {
     if (_player != null)
     {
         _player.Stop();
         _player = null;
     }
 }
Beispiel #2
0
        /// <summary>
        /// 2/23版のMIDIデータから発行されるコマンドタイムラインを再生する
        /// </summary>
        private void TogglePlayData()
        {
            if (_player != null)
            {
                StopPlayerData();
                return;
            }

            using (var loader = new CommandTimelineDataLoader(new BinaryReader(new MemoryStream(_playData.bytes))))
            {
                var commands = loader.Load();
                _player = new CommandTimelinePlayer(commands);
            }

            _player.OnCommand += command =>
            {
                _context.Post(state => _robot.MoveAxis(command.Param), null);
            };
            _player.Start();
        }