Ejemplo n.º 1
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();
        }
Ejemplo n.º 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");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Play a set of RTTL songs synchronously, loaded from SD card resources
        /// </summary>
        public static void PlayFromResource()
        {
            var sd = new SDResourceLoader();

            sd.Load(Pins.GPIO_PIN_D10);
            foreach (string songName in sd.RTTLSongs.Keys)
            {
                RttlSong song = (RttlSong)sd.RTTLSongs[songName];
                Debug.Print("Playing: " + song.Name);
                song.Play(_channel);
                Thread.Sleep(1500);
            }
        }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
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!");
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Play a set of RTTL songs synchronously, loaded from SD card resources
        /// </summary>
        public static void PlayFromResource()
        {
#if NETDUINO_MINI
            StorageDevice.MountSD(SDMountPoint, SPI.SPI_module.SPI1, Pins.GPIO_PIN_13);
#else
            StorageDevice.MountSD(SDMountPoint, SPI.SPI_module.SPI1, Pins.GPIO_PIN_D10);
#endif
            var sd = new SDResourceLoader();
            sd.Load();

            foreach (string songName in sd.RTTLSongs.Keys)
            {
                RttlSong song = (RttlSong)sd.RTTLSongs[songName];
                Debug.Print("Playing: " + song.Name);
                song.Play(_channel);
                Thread.Sleep(1500);
            }

#if NETDUINO_MINI || NETDUINO
            StorageDevice.Unmount(SDMountPoint);
#endif
        }