Exemplo n.º 1
0
        public void Play(ScoreDetail scoreDetail)
        {
            positions = new int[numberOfTracks];

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

            PlayScoreStart(scoreDetail.Creator);

            PlayScore(scoreDetail);

            PlayScoreEnd();
        }
Exemplo n.º 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);
        }
Exemplo n.º 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();
            }
        }
Exemplo n.º 4
0
        private void PlayNextBeat(ScoreDetail scoreDetail)
        {
            var score = scoreDetail.Score;

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