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.7KB

  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 __JackThreadedDriver__
  17. #define __JackThreadedDriver__
  18. #include "JackDriver.h"
  19. #include "JackPlatformPlug.h"
  20. namespace Jack
  21. {
  22. /*!
  23. \brief The base class for threaded drivers using a "decorator" pattern. Threaded drivers are used with blocking devices.
  24. */
  25. class SERVER_EXPORT JackThreadedDriver : public JackDriverClientInterface, public JackRunnableInterface
  26. {
  27. protected:
  28. JackThread fThread;
  29. JackDriver* fDriver;
  30. void SetRealTime();
  31. public:
  32. JackThreadedDriver(JackDriver* driver);
  33. virtual ~JackThreadedDriver();
  34. virtual int Open();
  35. virtual int Open (bool capturing,
  36. bool playing,
  37. int inchannels,
  38. int outchannels,
  39. bool monitor,
  40. const char* capture_driver_name,
  41. const char* playback_driver_name,
  42. jack_nframes_t capture_latency,
  43. jack_nframes_t playback_latency)
  44. {
  45. return -1;
  46. }
  47. virtual int Open(jack_nframes_t buffer_size,
  48. jack_nframes_t samplerate,
  49. bool capturing,
  50. bool playing,
  51. int inchannels,
  52. int outchannels,
  53. bool monitor,
  54. const char* capture_driver_name,
  55. const char* playback_driver_name,
  56. jack_nframes_t capture_latency,
  57. jack_nframes_t playback_latency);
  58. virtual int Close();
  59. virtual int Process();
  60. virtual int Attach();
  61. virtual int Detach();
  62. virtual int Read();
  63. virtual int Write();
  64. virtual int Start();
  65. virtual int Stop();
  66. virtual bool IsFixedBufferSize();
  67. virtual int SetBufferSize(jack_nframes_t buffer_size);
  68. virtual int SetSampleRate(jack_nframes_t sample_rate);
  69. virtual void SetMaster(bool onoff);
  70. virtual bool GetMaster();
  71. virtual void AddSlave(JackDriverInterface* slave);
  72. virtual void RemoveSlave(JackDriverInterface* slave);
  73. virtual std::list<JackDriverInterface*> GetSlaves();
  74. virtual int ProcessReadSlaves();
  75. virtual int ProcessWriteSlaves();
  76. virtual int ProcessRead();
  77. virtual int ProcessWrite();
  78. virtual int ProcessReadSync();
  79. virtual int ProcessWriteSync();
  80. virtual int ProcessReadAsync();
  81. virtual int ProcessWriteAsync();
  82. virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
  83. virtual JackClientControl* GetClientControl() const;
  84. virtual bool IsRealTime() const;
  85. virtual bool IsRunning() const;
  86. // JackRunnableInterface interface
  87. virtual bool Execute();
  88. virtual bool Init();
  89. };
  90. } // end of namespace
  91. #endif