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.

91 lines
2.6KB

  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 __JackAudioDriver__
  17. #define __JackAudioDriver__
  18. #include "JackDriver.h"
  19. namespace Jack
  20. {
  21. /*!
  22. \brief The base class for audio drivers: drivers with audio ports.
  23. */
  24. class EXPORT JackAudioDriver : public JackDriver
  25. {
  26. protected:
  27. int fCaptureChannels;
  28. int fPlaybackChannels;
  29. // static tables since the actual number of ports may be changed by the real driver
  30. // thus dynamic allocation is more difficult to handle
  31. jack_port_id_t fCapturePortList[PORT_NUM];
  32. jack_port_id_t fPlaybackPortList[PORT_NUM];
  33. jack_port_id_t fMonitorPortList[PORT_NUM];
  34. bool fWithMonitorPorts;
  35. jack_default_audio_sample_t* GetInputBuffer(int port_index);
  36. jack_default_audio_sample_t* GetOutputBuffer(int port_index);
  37. jack_default_audio_sample_t* GetMonitorBuffer(int port_index);
  38. private:
  39. int ProcessAsync();
  40. int ProcessSync();
  41. public:
  42. JackAudioDriver(const char* name, JackEngine* engine, JackSynchro** table);
  43. virtual ~JackAudioDriver();
  44. virtual int Process();
  45. virtual int Open(jack_nframes_t nframes,
  46. jack_nframes_t samplerate,
  47. int capturing,
  48. int playing,
  49. int inchannels,
  50. int outchannels,
  51. bool monitor,
  52. const char* capture_driver_name,
  53. const char* playback_driver_name,
  54. jack_nframes_t capture_latency,
  55. jack_nframes_t playback_latency);
  56. virtual int Attach();
  57. virtual int Detach();
  58. virtual int Write();
  59. virtual int SetBufferSize(jack_nframes_t buffer_size);
  60. virtual int SetSampleRate(jack_nframes_t sample_rate);
  61. virtual void NotifyXRun(jack_time_t callback_usecs); // XRun notification sent by the driver
  62. };
  63. } // end of namespace
  64. #endif