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.

93 lines
2.3KB

  1. /*
  2. Copyright (C) 2006 Grame
  3. Portable Audio I/O Library for ASIO Drivers
  4. Author: Stephane Letz
  5. Based on the Open Source API proposed by Ross Bencina
  6. Copyright (c) 2000-2002 Stephane Letz, Phil Burk, Ross Bencina
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. #ifndef __JackASIODriver__
  20. #define __JackASIODriver__
  21. #include "JackAudioDriver.h"
  22. #include "portaudio.h"
  23. namespace Jack
  24. {
  25. /*!
  26. \brief The ASIO driver.
  27. */
  28. class JackASIODriver : public JackAudioDriver
  29. {
  30. private:
  31. PaStream* fStream;
  32. float** fInputBuffer;
  33. float** fOutputBuffer;
  34. PaDeviceIndex fInputDevice;
  35. PaDeviceIndex fOutputDevice;
  36. static int Render(const void* inputBuffer, void* outputBuffer,
  37. unsigned long framesPerBuffer,
  38. const PaStreamCallbackTimeInfo* timeInfo,
  39. PaStreamCallbackFlags statusFlags,
  40. void* userData);
  41. public:
  42. JackASIODriver(const char* name, JackEngine* engine, JackSynchro** table)
  43. : JackAudioDriver(name, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
  44. fInputDevice(paNoDevice), fOutputDevice(paNoDevice)
  45. {}
  46. virtual ~JackASIODriver()
  47. {}
  48. int Open(jack_nframes_t frames_per_cycle,
  49. jack_nframes_t rate,
  50. int capturing,
  51. int playing,
  52. int chan_in,
  53. int chan_out,
  54. bool monitor,
  55. const char* capture_driver_name,
  56. const char* playback_driver_name,
  57. jack_nframes_t capture_latency,
  58. jack_nframes_t playback_latency);
  59. int Close();
  60. int Start();
  61. int Stop();
  62. int Read();
  63. int Write();
  64. int SetBufferSize(jack_nframes_t nframes);
  65. void PrintState();
  66. };
  67. } // end of namespace
  68. #endif