Пример #1
0
        /// <summary>
        /// Play an RTTL song asynchronously
        /// </summary>
        public static void AsynchronousPlay() {
            var song = new RttlSong("PacMan:d=4,o=5,b=90:32b,32p,32b6,32p,32f#6,32p,32d#6,32p,32b6,32f#6,16p,16d#6,16p,32c6,32p,32c7,32p,32g6,32p,32e6,32p,32c7,32g6,16p,16e6,16p,32b,32p,32b6,32p,32f#6,32p,32d#6,32p,32b6,32f#6,16p,16d#6,16p,32d#6,32e6,32f6,32p,32f6,32f#6,32g6,32p,32g6,32g#6,32a6,32p,32b.6");
            
            var thread = song.Play(_channel, true);

            for (int I = 0; I < song.Duration; I++) {
                Debug.Print("Playing:" + song.Name + "...");
                Thread.Sleep(1000);
            }

            thread.Join();
        }
Пример #2
0
        protected override void OnGameEnd()
        {
            var song = new RttlSong("SadTrombone:d=4,o=4,b=40:32d4,32c#4,32c4,4b3");
            var thread = song.Play(Hardware.Speaker, true);

            for (int i = 0; i < _explosion.FrameCount; i++)
            {
                Hardware.Matrix.Display(_explosion.GetNextFrame());
                Thread.Sleep(200);
            }

            ScrollMessage(" Game Over");
        }
Пример #3
0
        /// <summary>
        /// Starts the game
        /// </summary>
        protected override void OnGameStart()
        {
            // Sets the snake for the first time
            this._ResetSnake();
            this._ResetFood();
            // Plays intro tune
#if toolboxspeaker
            this._speaker.Play("MBT128L8O6DDD<B>DEL4D");
#else
            var song = new RttlSong("nom-nom-no:d=4,o=5,b=128:8d6,8d6,8d6,8b,8d6,8e6,d6");
            var thread = song.Play(Hardware.Speaker, true);
#endif
            // Scrolls the intro text
            ScrollMessage(" Nom Nom!");
        }
Пример #4
0
 public override void Loop() {
     var song = new RttlSong("PacMan:d=4,o=5,b=90:32b,32p,32b6,32p,32f#6,32p,32d#6,32p,32b6,32f#6,16p,16d#6,16p,32c6,32p,32c7,32p,32g6,32p,32e6,32p,32c7,32g6,16p,16e6,16p,32b,32p,32b6,32p,32f#6,32p,32d#6,32p,32b6,32f#6,16p,16d#6,16p,32d#6,32e6,32f6,32p,32f6,32f#6,32g6,32p,32g6,32g#6,32a6,32p,32b.6");
     var thread = song.Play(Hardware.Speaker, false);
     Stop();
 }