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.

84 lines
2.3KB

  1. /*
  2. Copyright (C) 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 __JackIOAdapter__
  16. #define __JackIOAdapter__
  17. #include "ringbuffer.h"
  18. #include "jack.h"
  19. #include "JackError.h"
  20. namespace Jack
  21. {
  22. class JackIOAdapterInterface
  23. {
  24. protected:
  25. int fCaptureChannels;
  26. int fPlaybackChannels;
  27. int fBufferSize;
  28. float fSampleRate;
  29. jack_time_t fCallbackTime;
  30. jack_time_t fFirstCallbackTime;
  31. jack_ringbuffer_t* fCaptureRingBuffer;
  32. jack_ringbuffer_t* fPlaybackRingBuffer;
  33. bool fRunning;
  34. public:
  35. JackIOAdapterInterface(int input, int output, int buffer_size, float sample_rate)
  36. :fCaptureChannels(input),
  37. fPlaybackChannels(output),
  38. fBufferSize(buffer_size),
  39. fSampleRate(sample_rate),
  40. fCallbackTime(0),
  41. fRunning(false)
  42. {}
  43. virtual ~JackIOAdapterInterface()
  44. {}
  45. void SetRingBuffers(jack_ringbuffer_t* input, jack_ringbuffer_t* output)
  46. {
  47. fCaptureRingBuffer = input;
  48. fPlaybackRingBuffer = output;
  49. }
  50. bool IsRunning() {return fRunning;}
  51. virtual int Open() = 0;
  52. virtual int Close() = 0;
  53. virtual void SetBufferSize(int buffer_size)
  54. {
  55. fBufferSize = buffer_size;
  56. }
  57. virtual void SetCallbackTime(jack_time_t usec)
  58. {
  59. fCallbackTime = usec;
  60. }
  61. };
  62. }
  63. #endif