libcm is a C development framework with an emphasis on audio signal processing applications.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef cmKeyboard_h
  2. #define cmKeyboard_h
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. //( { file_desc:"Query and get keypresses directly from the console." kw:[system] }
  7. enum
  8. {
  9. kInvalidKId,
  10. kAsciiKId,
  11. kLeftArrowKId,
  12. kRightArrowKId,
  13. kUpArrowKId,
  14. kDownArrowKId,
  15. kHomeKId,
  16. kEndKId,
  17. kPgUpKId,
  18. kPgDownKId,
  19. kInsertKId,
  20. kDeleteKId,
  21. };
  22. typedef struct
  23. {
  24. unsigned code;
  25. char ch;
  26. bool ctlFl;
  27. bool altFl;
  28. } cmKbRecd;
  29. // Set 'p' to NULL if the value of the key is not required.
  30. void cmKeyPress( cmKbRecd* p );
  31. // Return non-zero if a key is waiting to be read otherwise return 0.
  32. // Use getchar() to pick up the key.
  33. //
  34. // Example:
  35. // while( 1 )
  36. // {
  37. // if( cmIsKeyWaiting() == 0 )
  38. // usleep(20000);
  39. // else
  40. // {
  41. // char c = getchar();
  42. // switch(c)
  43. // {
  44. // ....
  45. // }
  46. // }
  47. //
  48. // }
  49. //
  50. // TODO: Note that this function turns off line-buffering on stdin.
  51. // It should be changed to a three function sequence.
  52. // bool org_state = cmSetStdinLineBuffering(false);
  53. // ....
  54. // cmIsKeyWaiting()
  55. // ....
  56. // cmSetStdinLineBuffering(org_state)
  57. int cmIsKeyWaiting();
  58. //)
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62. #endif