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.

108 lines
3.0KB

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