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.

109 lines
3.0KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2008-2011 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 __JackNetDriver__
  17. #define __JackNetDriver__
  18. #include "JackAudioDriver.h"
  19. #include "JackNetInterface.h"
  20. #ifdef JACK_MONITOR
  21. #include "JackFrameTimer.h"
  22. #endif
  23. namespace Jack
  24. {
  25. /**
  26. \Brief This class describes the Net Backend
  27. */
  28. class JackNetDriver : public JackAudioDriver, public JackNetSlaveInterface
  29. {
  30. private:
  31. //jack data
  32. jack_port_id_t* fMidiCapturePortList;
  33. jack_port_id_t* fMidiPlaybackPortList;
  34. //transport
  35. int fLastTransportState;
  36. int fLastTimebaseMaster;
  37. //monitoring
  38. #ifdef JACK_MONITOR
  39. JackGnuPlotMonitor<float>* fNetTimeMon;
  40. jack_time_t fRcvSyncUst;
  41. #endif
  42. bool Initialize();
  43. void FreeAll();
  44. int AllocPorts();
  45. int FreePorts();
  46. //transport
  47. void EncodeTransportData();
  48. void DecodeTransportData();
  49. JackMidiBuffer* GetMidiInputBuffer(int port_index);
  50. JackMidiBuffer* GetMidiOutputBuffer(int port_index);
  51. void SaveConnections();
  52. public:
  53. JackNetDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
  54. const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports,
  55. char* net_name, uint transport_sync, int network_latency, int celt_encoding);
  56. ~JackNetDriver();
  57. int Open(jack_nframes_t frames_per_cycle, jack_nframes_t rate, bool capturing, bool playing,
  58. int inchannels, int outchannels, bool monitor, const char* capture_driver_name,
  59. const char* playback_driver_name, jack_nframes_t capture_latency, jack_nframes_t playback_latency);
  60. int Close();
  61. int Attach();
  62. int Detach();
  63. int Read();
  64. int Write();
  65. // BufferSize can't be changed
  66. bool IsFixedBufferSize()
  67. {
  68. return true;
  69. }
  70. int SetBufferSize(jack_nframes_t buffer_size)
  71. {
  72. return -1;
  73. }
  74. int SetSampleRate(jack_nframes_t sample_rate)
  75. {
  76. return -1;
  77. }
  78. };
  79. }
  80. #endif