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.

131 lines
4.1KB

  1. /*
  2. Copyright (C) 2004-2006 Grame
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. */
  15. #ifndef __JackDebugClient__
  16. #define __JackDebugClient__
  17. #define MAX_PORT_HISTORY 2048
  18. #include "JackClient.h"
  19. #include <list>
  20. namespace Jack
  21. {
  22. /*!
  23. \brief Follow a single port.
  24. */
  25. typedef struct
  26. {
  27. jack_port_id_t idport;
  28. char name[JACK_PORT_NAME_SIZE]; //portname
  29. int IsConnected;
  30. int IsUnregistrated;
  31. }
  32. PortFollower;
  33. /*!
  34. \brief A "decorator" debug client to validate API use.
  35. */
  36. class JackDebugClient : public JackClient
  37. {
  38. private:
  39. JackClient* fClient;
  40. std::ofstream* fStream;
  41. protected:
  42. PortFollower fPortList[MAX_PORT_HISTORY]; // Arbitrary value... To be tuned...
  43. int fTotalPortNumber; // The total number of port opened and maybe closed. Historical view.
  44. int fOpenPortNumber; // The current number of opened port.
  45. int fIsActivated;
  46. int fIsDeactivated;
  47. int fIsClosed;
  48. char fClientName[JACK_CLIENT_NAME_SIZE];
  49. public:
  50. JackDebugClient(JackClient* fTheClient);
  51. virtual ~JackDebugClient();
  52. virtual int Open(const char* name, jack_options_t options, jack_status_t* status);
  53. int Close();
  54. virtual JackGraphManager* GetGraphManager() const;
  55. virtual JackEngineControl* GetEngineControl() const;
  56. // Notifications
  57. int ClientNotify(int refnum, const char* name, int notify, int sync, int value);
  58. int Activate();
  59. int Deactivate();
  60. // Context
  61. int SetBufferSize(jack_nframes_t buffer_size);
  62. int SetFreeWheel(int onoff);
  63. void ShutDown();
  64. pthread_t GetThreadID();
  65. // Port management
  66. int PortRegister(const char* port_name, const char* port_type, unsigned long flags, unsigned long buffer_size);
  67. int PortUnRegister(jack_port_id_t port);
  68. int PortConnect(const char* src, const char* dst);
  69. int PortDisconnect(const char* src, const char* dst);
  70. int PortConnect(jack_port_id_t src, jack_port_id_t dst);
  71. int PortDisconnect(jack_port_id_t src);
  72. int PortIsMine(jack_port_id_t port_index);
  73. // Transport
  74. int ReleaseTimebase();
  75. int SetSyncCallback(JackSyncCallback sync_callback, void* arg);
  76. int SetSyncTimeout(jack_time_t timeout);
  77. int SetTimebaseCallback(int conditional, JackTimebaseCallback timebase_callback, void* arg);
  78. int TransportLocate(jack_nframes_t frame);
  79. jack_transport_state_t TransportQuery(jack_position_t* pos);
  80. jack_nframes_t GetCurrentTransportFrame();
  81. int TransportReposition(jack_position_t* pos);
  82. void TransportStart();
  83. void TransportStop();
  84. // Callbacks
  85. void OnShutdown(JackShutdownCallback callback, void *arg);
  86. int SetProcessCallback(JackProcessCallback callback, void* arg);
  87. int SetXRunCallback(JackXRunCallback callback, void* arg);
  88. int SetInitCallback(JackThreadInitCallback callback, void* arg);
  89. int SetGraphOrderCallback(JackGraphOrderCallback callback, void* arg);
  90. int SetBufferSizeCallback(JackBufferSizeCallback callback, void* arg);
  91. int SetClientRegistrationCallback(JackClientRegistrationCallback callback, void* arg);
  92. int SetFreewheelCallback(JackFreewheelCallback callback, void* arg);
  93. int SetPortRegistrationCallback(JackPortRegistrationCallback callback, void* arg);
  94. JackClientControl* GetClientControl() const;
  95. void CheckClient() const;
  96. };
  97. } // end of namespace
  98. #endif