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.

101 lines
2.5KB

  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. jack_nframes_t *output_port_timeouts;
  32. nfds_t poll_fd_count;
  33. struct pollfd *poll_fds;
  34. JackThread *thread;
  35. void
  36. FreeDeviceInfo(std::vector<snd_rawmidi_info_t *> *in_info_list,
  37. std::vector<snd_rawmidi_info_t *> *out_info_list);
  38. void
  39. GetDeviceInfo(snd_ctl_t *control, snd_rawmidi_info_t *info,
  40. std::vector<snd_rawmidi_info_t *> *info_list);
  41. void
  42. HandleALSAError(const char *driver_func, const char *alsa_func,
  43. int code);
  44. public:
  45. JackALSARawMidiDriver(const char *name, const char *alias,
  46. JackLockedEngine *engine, JackSynchro *table);
  47. ~JackALSARawMidiDriver();
  48. int
  49. Attach();
  50. int
  51. Close();
  52. bool
  53. Execute();
  54. bool
  55. Init();
  56. int
  57. Open(bool capturing, bool playing, int in_channels, int out_channels,
  58. bool monitoring, const char *capture_driver_name,
  59. const char *playback_driver_name, jack_nframes_t capture_latency,
  60. jack_nframes_t playback_latency);
  61. int
  62. Read();
  63. int
  64. Start();
  65. int
  66. Stop();
  67. int
  68. Write();
  69. };
  70. }
  71. #endif