コード例 #1
0
                public static void INIT()
                {
                    var R = TermController.RunCommand("fbset", "-i");

                    Thread.Sleep(100);
                    while (true)
                    {
                        string line = "";
                        try
                        {
                            line = R.ReadLine();
                        }
                        catch
                        {
                            throw new MissingFieldException();
                        }

                        if (line.StartsWith("mode \""))
                        {
                            string[] info = line.Substring(6).Split(new char[] { 'x' }, StringSplitOptions.RemoveEmptyEntries);
                            info[1].Substring(0, info[1].Length - 1);
                            X          = int.Parse(info[0]);
                            Y          = int.Parse(info[1]);
                            BufferSize = X * Y;
                            IMG        = new LCDIMG()
                            {
                                Buffer = new byte[BufferSize], LineLength = X
                            };
                            break;
                        }
                    }
                    R.Close();
                }
コード例 #2
0
 public static void PlayWav(string path)
 {
     if (path.Contains(".wav"))
     {
         TermController.RunCommand("aplay", path);
     }
     else
     {
         throw new ArgumentOutOfRangeException();
     }
 }
コード例 #3
0
 public static void Say(string text)
 {
     TermController.RunCommandWithPipe(TermController.RunCommand("espeak", $"\"{text}\" --stdout"), "aplay", "");
 }
コード例 #4
0
 public static void PlayTone(int hz, int timeMS)
 {
     TermController.RunCommand("beep", $"-f {hz} -l {timeMS}");
 }