예제 #1
0
        public void Play(ScoreDetail scoreDetail)
        {
            positions = new int[numberOfTracks];

            SetTimeBetweenFrames(Convert.ToInt32(ConfigurationManager.AppSettings["Bpm"]));

            PlayScoreStart(scoreDetail.Creator);

            PlayScore(scoreDetail);

            PlayScoreEnd();
        }
예제 #2
0
        public ActionResult Create(ScoreDetail scoreDetail)
        {
            scoreDetail.Created = DateTime.Now;

            if (ContainsBadWords(scoreDetail.Creator)) scoreDetail.Played = DateTime.Now;

            if (ModelState.IsValid)
            {
                db.ScoreDetails.Add(scoreDetail);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(scoreDetail);
        }
예제 #3
0
        private void PlayScore(ScoreDetail scoreDetail)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            for (var beatCount = 0; beatCount < Convert.ToInt32(ConfigurationManager.AppSettings["BarsToPlay"]) * 4; beatCount++)
            {
                Wait(stopwatch, millisecondsBetweenBeats);

                PlayNextBeat(scoreDetail);

                stopwatch.Restart();
            }
        }
예제 #4
0
        private void PlayNextBeat(ScoreDetail scoreDetail)
        {
            var score = scoreDetail.Score;

            SendMessage(m => BuildBeatMessage(score, m));
        }