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.

126 lines
3.6KB

  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 "JackTimedDriver.h"
  18. #include "JackNetInterface.h"
  19. //#define JACK_MONITOR
  20. namespace Jack
  21. {
  22. /**
  23. \Brief This class describes the Net Backend
  24. */
  25. class JackNetDriver : public JackWaiterDriver, public JackNetSlaveInterface
  26. {
  27. private:
  28. //jack data
  29. jack_port_id_t* fMidiCapturePortList;
  30. jack_port_id_t* fMidiPlaybackPortList;
  31. //transport
  32. int fLastTransportState;
  33. int fLastTimebaseMaster;
  34. // The wanted value at creation time (may be different than the value actually returned by the master)
  35. int fWantedAudioCaptureChannels;
  36. int fWantedAudioPlaybackChannels;
  37. int fWantedMIDICaptureChannels;
  38. int fWantedMIDIPlaybackChannels;
  39. bool fAutoSave;
  40. //monitoring
  41. #ifdef JACK_MONITOR
  42. JackGnuPlotMonitor<float>* fNetTimeMon;
  43. jack_time_t fRcvSyncUst;
  44. #endif
  45. bool Initialize();
  46. void FreeAll();
  47. int AllocPorts();
  48. int FreePorts();
  49. //transport
  50. void EncodeTransportData();
  51. void DecodeTransportData();
  52. JackMidiBuffer* GetMidiInputBuffer(int port_index);
  53. JackMidiBuffer* GetMidiOutputBuffer(int port_index);
  54. void SaveConnections(int alias);
  55. void UpdateLatencies();
  56. public:
  57. JackNetDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table,
  58. const char* ip, int port, int mtu, int midi_input_ports, int midi_output_ports,
  59. char* net_name, uint transport_sync, int network_latency, int celt_encoding,
  60. int opus_encoding, bool auto_save);
  61. virtual ~JackNetDriver();
  62. int Open(jack_nframes_t buffer_size,
  63. jack_nframes_t samplerate,
  64. bool capturing,
  65. bool playing,
  66. int inchannels,
  67. int outchannels,
  68. bool monitor,
  69. const char* capture_driver_name,
  70. const char* playback_driver_name,
  71. jack_nframes_t capture_latency,
  72. jack_nframes_t playback_latency);
  73. int Close();
  74. int Attach();
  75. int Detach();
  76. int Read();
  77. int Write();
  78. // BufferSize can't be changed
  79. bool IsFixedBufferSize()
  80. {
  81. return true;
  82. }
  83. int SetBufferSize(jack_nframes_t buffer_size)
  84. {
  85. return -1;
  86. }
  87. int SetSampleRate(jack_nframes_t sample_rate)
  88. {
  89. return -1;
  90. }
  91. };
  92. }
  93. #endif