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.

112 lines
2.9KB

  1. /*
  2. Copyright (C) 2009 Grame
  3. Copyright (C) 2011 Devin Anderson
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. */
  16. #ifndef __JackCoreMidiDriver__
  17. #define __JackCoreMidiDriver__
  18. #include "JackCoreMidiPhysicalInputPort.h"
  19. #include "JackCoreMidiPhysicalOutputPort.h"
  20. #include "JackCoreMidiVirtualInputPort.h"
  21. #include "JackCoreMidiVirtualOutputPort.h"
  22. #include "JackMidiDriver.h"
  23. #include "JackThread.h"
  24. namespace Jack {
  25. class JackCoreMidiDriver: public JackMidiDriver, public JackRunnableInterface, public JackLockAble {
  26. private:
  27. static void
  28. HandleInputEvent(const MIDIPacketList *packet_list, void *driver,
  29. void *port);
  30. static void
  31. HandleNotificationEvent(const MIDINotification *message, void *driver);
  32. void
  33. HandleNotification(const MIDINotification *message);
  34. MIDIClientRef client;
  35. MIDIPortRef internal_input;
  36. MIDIPortRef internal_output;
  37. int num_physical_inputs;
  38. int num_physical_outputs;
  39. int num_virtual_inputs;
  40. int num_virtual_outputs;
  41. JackCoreMidiPhysicalInputPort **physical_input_ports;
  42. JackCoreMidiPhysicalOutputPort **physical_output_ports;
  43. double time_ratio;
  44. JackCoreMidiVirtualInputPort **virtual_input_ports;
  45. JackCoreMidiVirtualOutputPort **virtual_output_ports;
  46. bool OpenAux();
  47. int CloseAux();
  48. void Restart();
  49. JackThread fThread; /*! Thread to execute the Process function */
  50. public:
  51. JackCoreMidiDriver(const char* name, const char* alias,
  52. JackLockedEngine* engine, JackSynchro* table);
  53. ~JackCoreMidiDriver();
  54. int
  55. Attach();
  56. int
  57. Close();
  58. int
  59. Open(bool capturing, bool playing, int num_inputs, int num_outputs,
  60. bool monitor, const char* capture_driver_name,
  61. const char* playback_driver_name, jack_nframes_t capture_latency,
  62. jack_nframes_t playback_latency);
  63. int
  64. Read();
  65. int
  66. Start();
  67. int
  68. Stop();
  69. int
  70. Write();
  71. int ProcessRead();
  72. int ProcessWrite();
  73. // JackRunnableInterface interface
  74. bool Init();
  75. bool Execute();
  76. };
  77. }
  78. #define WAIT_COUNTER 100
  79. #endif