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

  1. /*
  2. Copyright (C) 2004-2008 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 __JackPortAudioDriver__
  16. #define __JackPortAudioDriver__
  17. #include "JackAudioDriver.h"
  18. #include "JackPortAudioDevices.h"
  19. namespace Jack
  20. {
  21. /*!
  22. \brief The PortAudio driver.
  23. */
  24. class JackPortAudioDriver : public JackAudioDriver
  25. {
  26. private:
  27. PortAudioDevices* fPaDevices;
  28. PaStream* fStream;
  29. float** fInputBuffer;
  30. float** fOutputBuffer;
  31. PaDeviceIndex fInputDevice;
  32. PaDeviceIndex fOutputDevice;
  33. static int Render(const void* inputBuffer, void* outputBuffer,
  34. unsigned long framesPerBuffer,
  35. const PaStreamCallbackTimeInfo* timeInfo,
  36. PaStreamCallbackFlags statusFlags,
  37. void* userData);
  38. public:
  39. JackPortAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, PortAudioDevices* pa_devices)
  40. : JackAudioDriver(name, alias, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
  41. fInputDevice(paNoDevice), fOutputDevice(paNoDevice)
  42. {
  43. fPaDevices = pa_devices;
  44. }
  45. virtual ~JackPortAudioDriver()
  46. {
  47. delete fPaDevices;
  48. }
  49. int Open(jack_nframes_t frames_per_cycle,
  50. jack_nframes_t rate,
  51. bool capturing,
  52. bool playing,
  53. int chan_in,
  54. int chan_out,
  55. bool monitor,
  56. const char* capture_driver_name,
  57. const char* playback_driver_name,
  58. jack_nframes_t capture_latency,
  59. jack_nframes_t playback_latency);
  60. int Close();
  61. int Start();
  62. int Stop();
  63. int Read();
  64. int Write();
  65. int SetBufferSize(jack_nframes_t buffer_size);
  66. };
  67. } // end of namespace
  68. #endif