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.

81 lines
2.3KB

  1. /*
  2. Copyright (C) 2009 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 __JackCoreMidiDriver__
  16. #define __JackCoreMidiDriver__
  17. #include <CoreMIDI/CoreMIDI.h>
  18. #include "JackMidiDriver.h"
  19. #include "JackTime.h"
  20. namespace Jack
  21. {
  22. /*!
  23. \brief The CoreMidi driver.
  24. */
  25. class JackCoreMidiDriver : public JackMidiDriver
  26. {
  27. private:
  28. MIDIClientRef fMidiClient;
  29. MIDIPortRef fInputPort;
  30. MIDIPortRef fOutputPort;
  31. MIDIEndpointRef* fMidiDestination;
  32. MIDIEndpointRef* fMidiSource;
  33. char fMIDIBuffer[BUFFER_SIZE_MAX * sizeof(float)];
  34. int fRealCaptureChannels;
  35. int fRealPlaybackChannels;
  36. static void ReadProcAux(const MIDIPacketList *pktlist, jack_ringbuffer_t* ringbuffer);
  37. static void ReadProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
  38. static void ReadVirtualProc(const MIDIPacketList *pktlist, void *refCon, void *connRefCon);
  39. static void NotifyProc(const MIDINotification *message, void *refCon);
  40. public:
  41. JackCoreMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
  42. virtual ~JackCoreMidiDriver();
  43. int Open( bool capturing,
  44. bool playing,
  45. int chan_in,
  46. int chan_out,
  47. bool monitor,
  48. const char* capture_driver_name,
  49. const char* playback_driver_name,
  50. jack_nframes_t capture_latency,
  51. jack_nframes_t playback_latency);
  52. int Close();
  53. int Attach();
  54. int Read();
  55. int Write();
  56. };
  57. } // end of namespace
  58. #endif