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.

91 lines
2.5KB

  1. /*
  2. Copyright (C) 2001 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 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 __JackNetDriver__
  17. #define __JackNetDriver__
  18. #include "JackAudioDriver.h"
  19. #include "JackNetTool.h"
  20. namespace Jack
  21. {
  22. class JackNetDriver : public JackAudioDriver
  23. {
  24. private:
  25. session_params_t fParams;
  26. char* fMulticastIP;
  27. unsigned int fPort;
  28. int fSockfd;
  29. struct sockaddr_in fMasterAddr;
  30. unsigned int fNSubProcess;
  31. jack_port_id_t* fMidiCapturePortList;
  32. jack_port_id_t* fMidiPlaybackPortList;
  33. packet_header_t fTxHeader;
  34. packet_header_t fRxHeader;
  35. char* fTxBuffer;
  36. char* fRxBuffer;
  37. char* fTxData;
  38. char* fRxData;
  39. NetMidiBuffer* fNetMidiCaptureBuffer;
  40. NetMidiBuffer* fNetMidiPlaybackBuffer;
  41. NetAudioBuffer* fNetAudioCaptureBuffer;
  42. NetAudioBuffer* fNetAudioPlaybackBuffer;
  43. int fAudioRxLen;
  44. int fAudioTxLen;
  45. bool Init();
  46. net_status_t GetNetMaster();
  47. net_status_t SendMasterStartSync();
  48. void Restart();
  49. int SetParams();
  50. int AllocPorts();
  51. int FreePorts();
  52. JackMidiBuffer* GetMidiInputBuffer ( int port_index );
  53. JackMidiBuffer* GetMidiOutputBuffer ( int port_index );
  54. int Recv ( unsigned int size, int flags );
  55. int Send ( unsigned int size, int flags );
  56. public:
  57. JackNetDriver ( const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
  58. const char* ip, unsigned int port, int midi_input_ports, int midi_output_ports, const char* master_name );
  59. ~JackNetDriver();
  60. int Open ( jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
  61. int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
  62. const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency );
  63. int Attach();
  64. int Detach();
  65. int Read();
  66. int Write();
  67. };
  68. }
  69. #endif