jack.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. Program RecordPlayback: A MIDI tool
  3. Author: Harry van Haaren
  4. E-mail: harryhaaren@gmail.com
  5. Copyright (C) 2010 Harry van Haaren
  6. PrintJackMidi is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. PrintJackMidi is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with PrintJackMidi. If not, see <http://www.gnu.org/licenses/>. */
  16. #ifndef JACK
  17. #define JACK
  18. #include "midi.hpp"
  19. #include <vector>
  20. #include <iostream>
  21. #include <jack/jack.h>
  22. #include <jack/midiport.h>
  23. #include <jack/ringbuffer.h>
  24. #include <thread>
  25. #include "synth.hpp"
  26. class Jack
  27. {
  28. public:
  29. Jack();
  30. ~Jack();
  31. void activate();
  32. static int staticProcess(jack_nframes_t nframes, void *arg);
  33. private:
  34. Synth synth;
  35. int process(jack_nframes_t nframes);
  36. jack_client_t* client;
  37. jack_port_t* inputPort;
  38. jack_ringbuffer_t* inputBuffer;
  39. jack_port_t* outputPort;
  40. jack_ringbuffer_t* outputBuffer;
  41. int bufferSize;
  42. static void staticWorkerThread(Jack* self);
  43. };
  44. #endif