Ejemplo n.º 1
0
        public static int main()
        {
            Console.WriteLine("20141104 does this device support speaker music?");

            // you really should not use headphones with PC speakers
            Console.Beep();
            JaggedArrayTest();

            var m = new MusicalNotes();

            var intro1 = new GuitarTabs(m,
                                        "---------0-------]---------0-------]---------0-------]---------0-------]",
                                        "-----------0-----]-----------3-----]-----3-----3---3-]-----3-----3---3-]",
                                        "-------0-----0---]-------0-----0---]---2---2-----2---]---2---2-----2---]",
                                        "-----2---------0-]-----0---------0-]-0---------------]-0---------------]",
                                        "---2-------------]---2-------------]-----------------]-----------------]",
                                        "-0---------------]-3---------------]-----------------]-----------------]"
                                        );

            var intro2 = new GuitarTabs(m,
                                        "---------0-------]---------0-------]---------0-------]---------0-------]",
                                        "-----3-----3---3-]-----3-----3---3-]-----0-----0---0-]-----0-----0---0-]",
                                        "-------0-----0---]-------0-----0---]-------2-----2---]-------2-----2---]",
                                        "---2-------------]---2-------------]---2-------------]---2-------------]",
                                        "-3---------------]-3---------------]-0---------------]-0---------------]",
                                        "-----------------]-----------------]-----------------]-----------------]"
                                        );


            // http://www.guitaretab.com/l/limp-bizkit/25879.html

            for (int i = 0; i < 100; i++)
            {
                var x = i * Math.PI / 100;
                int y = (int)(Math.Sin(x) * 400);

                Console.Beep(800 + y, 30);
            }


            intro1.Play();
            intro2.Play();


            new ColoredText
            {
                Color = ConsoleColor.Green,
                Text  = "look, it is an object"
            }.ToConsole();
            // this object wont be garbage collected, so be careful for what you wish for.

            Console.ForegroundColor = ConsoleColor.Cyan;

            var pi = Math.PI;

            Console.Write(pi);
            Console.WriteLine();

            var param = 30;
            var pisin = Math.Sin(param * Math.PI / 180);

            Console.Write(pisin);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("[NativeClass1]");
            Console.ForegroundColor = ConsoleColor.Yellow;

            File.WriteAllText("log.txt", "this is the result");

            // we are safe to use the list until our
            // value type is not larger than the pointer
            var music = new List <int>
            {
                100,
                600,
                300,
                700,
                100,
                200,
                500,
                50,
                50,
                600
            };



            foreach (char c in "hello world. c# code has been converted to c code. and you are running it!")
            {
                Console.Beep(37 + c, 10);
                Console.Write(c);

                if (c == '.')
                {
                    Thread.Sleep(100);
                }
                else
                {
                    Thread.Sleep(20);
                }
            }

            Console.WriteLine();

            for (int r = 0; r < 2; r++)
            {
                for (int i = 0; i < music.Count; i++)
                {
                    var x = (int)music[i];

                    Console.Write(x);
                    Console.Write(" ");

                    Console.Beep(x, 50);
                    Thread.Sleep(20);
                }
            }



            Console.WriteLine("got music?");


            for (int i = 37; i < 1200; i += 100)
            {
                Console.Beep(i, 50);
                Thread.Sleep(20);
            }


            Console.Write('j');
            Console.Write('s');
            Console.Write('c');

            Console.Beep(1200, 200);

            return(0);
        }
Ejemplo n.º 2
0
        public static int main()
        {
            Console.WriteLine("20141104 does this device support speaker music?");

            // you really should not use headphones with PC speakers
            Console.Beep();
            JaggedArrayTest();

            var m = new MusicalNotes();

            var intro1 = new GuitarTabs(m,
             "---------0-------]---------0-------]---------0-------]---------0-------]",
             "-----------0-----]-----------3-----]-----3-----3---3-]-----3-----3---3-]",
             "-------0-----0---]-------0-----0---]---2---2-----2---]---2---2-----2---]",
             "-----2---------0-]-----0---------0-]-0---------------]-0---------------]",
             "---2-------------]---2-------------]-----------------]-----------------]",
             "-0---------------]-3---------------]-----------------]-----------------]"
            );

            var intro2 = new GuitarTabs(m,
                "---------0-------]---------0-------]---------0-------]---------0-------]",
                "-----3-----3---3-]-----3-----3---3-]-----0-----0---0-]-----0-----0---0-]",
                "-------0-----0---]-------0-----0---]-------2-----2---]-------2-----2---]",
                "---2-------------]---2-------------]---2-------------]---2-------------]",
                "-3---------------]-3---------------]-0---------------]-0---------------]",
                "-----------------]-----------------]-----------------]-----------------]"
            );


            // http://www.guitaretab.com/l/limp-bizkit/25879.html

            for (int i = 0; i < 100; i++)
            {
                var x = i * Math.PI / 100;
                int y = (int)(Math.Sin(x) * 400);

                Console.Beep(800 + y, 30);
            }


            intro1.Play();
            intro2.Play();


            new ColoredText
            {
                Color = ConsoleColor.Green,
                Text = "look, it is an object"
            }.ToConsole();
            // this object wont be garbage collected, so be careful for what you wish for.

            Console.ForegroundColor = ConsoleColor.Cyan;

            var pi = Math.PI;

            Console.Write(pi);
            Console.WriteLine();

            var param = 30;
            var pisin = Math.Sin(param * Math.PI / 180);

            Console.Write(pisin);
            Console.WriteLine();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("[NativeClass1]");
            Console.ForegroundColor = ConsoleColor.Yellow;

            File.WriteAllText("log.txt", "this is the result");

            // we are safe to use the list until our 
            // value type is not larger than the pointer
            var music = new List<int>
			{
				100,
				600,
				300,
				700,
				100,
				200,
				500,
				50,
				50,
				600
			};




            foreach (char c in "hello world. c# code has been converted to c code. and you are running it!")
            {
                Console.Beep(37 + c, 10);
                Console.Write(c);

                if (c == '.')
                    Thread.Sleep(100);
                else
                    Thread.Sleep(20);
            }

            Console.WriteLine();

            for (int r = 0; r < 2; r++)
            {
                for (int i = 0; i < music.Count; i++)
                {
                    var x = (int)music[i];

                    Console.Write(x);
                    Console.Write(" ");

                    Console.Beep(x, 50);
                    Thread.Sleep(20);
                }
            }



            Console.WriteLine("got music?");


            for (int i = 37; i < 1200; i += 100)
            {
                Console.Beep(i, 50);
                Thread.Sleep(20);
            }


            Console.Write('j');
            Console.Write('s');
            Console.Write('c');

            Console.Beep(1200, 200);

            return 0;
        }