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.

96 lines
2.6KB

  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 "jack/session.h"
  23. namespace Jack
  24. {
  25. /*!
  26. \brief Client control possibly in shared memory.
  27. */
  28. struct JackClientControl : public JackShmMemAble
  29. {
  30. char fName[JACK_CLIENT_NAME_SIZE + 1];
  31. bool fCallback[kMaxNotification];
  32. volatile jack_transport_state_t fTransportState;
  33. volatile bool fTransportSync; /* Will be true when slow-sync cb has to be called */
  34. volatile bool fTransportTimebase; /* Will be true when timebase cb is called with new_pos on */
  35. int fRefNum;
  36. int fPID;
  37. bool fActive;
  38. int fSessionID;
  39. char fSessionCommand[JACK_SESSION_COMMAND_SIZE];
  40. jack_session_flags_t fSessionFlags;
  41. JackClientControl(const char* name, int pid, int refnum, int uuid)
  42. {
  43. Init(name, pid, refnum, uuid);
  44. }
  45. JackClientControl(const char* name)
  46. {
  47. Init(name, 0, -1, -1);
  48. }
  49. JackClientControl()
  50. {
  51. Init("", 0, -1, -1);
  52. }
  53. void Init(const char* name, int pid, int refnum, int uuid)
  54. {
  55. strcpy(fName, name);
  56. for (int i = 0; i < kMaxNotification; i++)
  57. fCallback[i] = false;
  58. // Always activated
  59. fCallback[kAddClient] = true;
  60. fCallback[kRemoveClient] = true;
  61. fCallback[kActivateClient] = true;
  62. // So that driver synchro are correctly setup in "flush" or "normal" mode
  63. fCallback[kStartFreewheelCallback] = true;
  64. fCallback[kStopFreewheelCallback] = true;
  65. fRefNum = refnum;
  66. fPID = pid;
  67. fTransportState = JackTransportStopped;
  68. fTransportSync = false;
  69. fTransportTimebase = false;
  70. fActive = false;
  71. fSessionID = uuid;
  72. }
  73. } POST_PACKED_STRUCTURE;
  74. } // end of namespace
  75. #endif