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.

88 lines
2.4KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2008 Romain Moret at Grame
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 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 General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef __JackNetSlaveInterface__
  17. #define __JackNetSlaveInterface__
  18. #include "JackNetTool.h"
  19. #ifdef JACK_MONITOR
  20. #include "JackFrameTimer.h"
  21. #endif
  22. namespace Jack
  23. {
  24. /**
  25. \Brief This class describes the Net Interface for slaves (NetDriver and NetAdapter)
  26. */
  27. class EXPORT JackNetSlaveInterface
  28. {
  29. protected:
  30. session_params_t fParams;
  31. char* fMulticastIP;
  32. JackNetSocket fSocket;
  33. uint fNSubProcess;
  34. //headers
  35. packet_header_t fTxHeader;
  36. packet_header_t fRxHeader;
  37. //network buffers
  38. char* fTxBuffer;
  39. char* fRxBuffer;
  40. char* fTxData;
  41. char* fRxData;
  42. //jack buffers
  43. NetMidiBuffer* fNetMidiCaptureBuffer;
  44. NetMidiBuffer* fNetMidiPlaybackBuffer;
  45. NetAudioBuffer* fNetAudioCaptureBuffer;
  46. NetAudioBuffer* fNetAudioPlaybackBuffer;
  47. //sizes
  48. int fAudioRxLen;
  49. int fAudioTxLen;
  50. int fPayloadSize;
  51. //sub processes
  52. bool Init();
  53. net_status_t GetNetMaster();
  54. net_status_t SendMasterStartSync();
  55. int SetParams();
  56. int SyncRecv();
  57. int SyncSend();
  58. int DataRecv();
  59. int DataSend();
  60. //network operations
  61. int Recv ( size_t size, int flags );
  62. int Send ( size_t size, int flags );
  63. public:
  64. JackNetSlaveInterface();
  65. JackNetSlaveInterface ( const char* ip, int port ) : fMulticastIP ( NULL ), fSocket ( ip, port )
  66. {}
  67. ~JackNetSlaveInterface();
  68. };
  69. }
  70. #endif