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.

155 lines
3.8KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  3. Copyright (C) 2004-2006 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 "JackThread.h"
  20. namespace Jack
  21. {
  22. /*!
  23. \brief The base class for threaded drivers. Threaded drivers are used with blocking devices.
  24. */
  25. class JackThreadedDriver : public JackDriverClientInterface, public JackRunnableInterface
  26. {
  27. private:
  28. JackThread* fThread;
  29. JackDriverClient* fDriver;
  30. public:
  31. JackThreadedDriver(JackDriverClient* driver);
  32. virtual ~JackThreadedDriver();
  33. virtual int Open()
  34. {
  35. return fDriver->Open();
  36. }
  37. virtual int Open(jack_nframes_t nframes,
  38. jack_nframes_t samplerate,
  39. int capturing,
  40. int playing,
  41. int inchannels,
  42. int outchannels,
  43. bool monitor,
  44. const char* capture_driver_name,
  45. const char* playback_driver_name,
  46. jack_nframes_t capture_latency,
  47. jack_nframes_t playback_latency)
  48. {
  49. return fDriver->Open(nframes, samplerate, capturing, playing, inchannels, outchannels, monitor, capture_driver_name, playback_driver_name, capture_latency, playback_latency);
  50. }
  51. virtual int Close()
  52. {
  53. return fDriver->Close();
  54. }
  55. virtual int Process()
  56. {
  57. return fDriver->Process();
  58. }
  59. virtual int Attach()
  60. {
  61. return fDriver->Attach();
  62. }
  63. virtual int Detach()
  64. {
  65. return fDriver->Detach();
  66. }
  67. virtual int Read()
  68. {
  69. return fDriver->Read();
  70. }
  71. virtual int Write()
  72. {
  73. return fDriver->Write();
  74. }
  75. virtual int Start();
  76. virtual int Stop();
  77. virtual int SetBufferSize(jack_nframes_t nframes)
  78. {
  79. return fDriver->SetBufferSize(nframes);
  80. }
  81. virtual void SetMaster(bool onoff)
  82. {
  83. fDriver->SetMaster(onoff);
  84. }
  85. virtual bool GetMaster()
  86. {
  87. return fDriver->GetMaster();
  88. }
  89. virtual void AddSlave(JackDriverInterface* slave)
  90. {
  91. fDriver->AddSlave(slave);
  92. }
  93. virtual void RemoveSlave(JackDriverInterface* slave)
  94. {
  95. fDriver->RemoveSlave(slave);
  96. }
  97. virtual void ProcessSlaves()
  98. {
  99. fDriver->ProcessSlaves();
  100. }
  101. virtual void PrintState()
  102. {
  103. fDriver->PrintState();
  104. }
  105. virtual int ClientNotify(int refnum, const char* name, int notify, int sync, int value)
  106. {
  107. return fDriver->ClientNotify(refnum, name, notify, sync, value);
  108. }
  109. virtual JackClientControl* GetClientControl() const
  110. {
  111. return fDriver->GetClientControl();
  112. }
  113. virtual bool IsRealTime()
  114. {
  115. return fDriver->IsRealTime();
  116. }
  117. // JackRunnableInterface interface
  118. virtual bool Execute();
  119. };
  120. } // end of namespace
  121. #endif