jack2 codebase
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.

98 lines
2.7KB

  1. /*
  2. Copyright (C) 2003 Paul Davis
  3. Copyright (C) 2004-2008 Grame
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #ifndef __JackClientControl__
  17. #define __JackClientControl__
  18. #include "JackShmMem.h"
  19. #include "JackPort.h"
  20. #include "JackSynchro.h"
  21. #include "JackNotification.h"
  22. #include "JackSession.h"
  23. namespace Jack
  24. {
  25. /*!
  26. \brief Client control possibly in shared memory.
  27. */
  28. PRE_PACKED_STRUCTURE
  29. struct JackClientControl : public JackShmMemAble
  30. {
  31. char fName[JACK_CLIENT_NAME_SIZE + 1];
  32. bool fCallback[kMaxNotification];
  33. volatile jack_transport_state_t fTransportState;
  34. volatile bool fTransportSync; /* Will be true when slow-sync cb has to be called */
  35. volatile bool fTransportTimebase; /* Will be true when timebase cb is called with new_pos on */
  36. int fRefNum;
  37. int fPID;
  38. bool fActive;
  39. jack_uuid_t fSessionID;
  40. char fSessionCommand[JACK_SESSION_COMMAND_SIZE];
  41. jack_session_flags_t fSessionFlags;
  42. JackClientControl(const char* name, int pid, int refnum, jack_uuid_t uuid)
  43. {
  44. Init(name, pid, refnum, uuid);
  45. }
  46. JackClientControl(const char* name, jack_uuid_t uuid)
  47. {
  48. Init(name, 0, -1, uuid);
  49. }
  50. JackClientControl()
  51. {
  52. Init("", 0, -1, JACK_UUID_EMPTY_INITIALIZER);
  53. }
  54. void Init(const char* name, int pid, int refnum, jack_uuid_t uuid)
  55. {
  56. strcpy(fName, name);
  57. for (int i = 0; i < kMaxNotification; i++) {
  58. fCallback[i] = false;
  59. }
  60. // Always activated
  61. fCallback[kAddClient] = true;
  62. fCallback[kRemoveClient] = true;
  63. fCallback[kActivateClient] = true;
  64. fCallback[kLatencyCallback] = true;
  65. // So that driver synchro are correctly setup in "flush" or "normal" mode
  66. fCallback[kStartFreewheelCallback] = true;
  67. fCallback[kStopFreewheelCallback] = true;
  68. fRefNum = refnum;
  69. fPID = pid;
  70. fTransportState = JackTransportStopped;
  71. fTransportSync = false;
  72. fTransportTimebase = false;
  73. fActive = false;
  74. fSessionID = uuid;
  75. }
  76. } POST_PACKED_STRUCTURE;
  77. } // end of namespace
  78. #endif