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.

99 lines
2.3KB

  1. /*
  2. Copyright (C) 2011 Devin Anderson
  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 __JackALSARawMidiDriver__
  16. #define __JackALSARawMidiDriver__
  17. #include <vector>
  18. #include <alsa/asoundlib.h>
  19. #include <poll.h>
  20. #include "JackALSARawMidiInputPort.h"
  21. #include "JackALSARawMidiOutputPort.h"
  22. #include "JackMidiDriver.h"
  23. #include "JackThread.h"
  24. namespace Jack {
  25. class JackALSARawMidiDriver:
  26. public JackMidiDriver, public JackRunnableInterface {
  27. private:
  28. int fds[2];
  29. JackALSARawMidiInputPort **input_ports;
  30. JackALSARawMidiOutputPort **output_ports;
  31. nfds_t poll_fd_count;
  32. struct pollfd *poll_fds;
  33. JackThread *thread;
  34. void
  35. GetDeviceInfo(snd_ctl_t *control, snd_rawmidi_info_t *info,
  36. std::vector<snd_rawmidi_info_t *> *info_list);
  37. void
  38. HandleALSAError(const char *driver_func, const char *alsa_func,
  39. int code);
  40. int
  41. Poll(const jack_nframes_t *wakeup_frame);
  42. public:
  43. JackALSARawMidiDriver(const char *name, const char *alias,
  44. JackLockedEngine *engine, JackSynchro *table);
  45. ~JackALSARawMidiDriver();
  46. int
  47. Attach();
  48. int
  49. Close();
  50. bool
  51. Execute();
  52. bool
  53. Init();
  54. int
  55. Open(bool capturing, bool playing, int in_channels, int out_channels,
  56. bool monitoring, const char *capture_driver_name,
  57. const char *playback_driver_name, jack_nframes_t capture_latency,
  58. jack_nframes_t playback_latency);
  59. int
  60. Read();
  61. int
  62. Start();
  63. int
  64. Stop();
  65. int
  66. Write();
  67. };
  68. }
  69. #endif