jack1 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.

136 lines
5.1KB

  1. /*
  2. Copyright (C) 2001 Paul Davis
  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. $Id$
  15. */
  16. #ifndef __jack_driver_h__
  17. #define __jack_driver_h__
  18. #include <glib.h>
  19. #include <pthread.h>
  20. #include <jack/types.h>
  21. typedef void (*ClockSyncListenerFunction)(channel_t,ClockSyncStatus,void*);
  22. typedef struct {
  23. unsigned long id;
  24. ClockSyncListenerFunction function;
  25. void *arg;
  26. } ClockSyncListener;
  27. typedef void (*InputMonitorListenerFunction)(channel_t,int,void*);
  28. typedef struct {
  29. unsigned long id;
  30. InputMonitorListenerFunction function;
  31. void *arg;
  32. } InputMonitorListener;
  33. struct _jack_engine;
  34. struct _jack_driver;
  35. typedef int (*JackDriverAttachFunction)(struct _jack_driver *, struct _jack_engine *);
  36. typedef int (*JackDriverDetachFunction)(struct _jack_driver *, struct _jack_engine *);
  37. typedef int (*JackDriverWaitFunction)(struct _jack_driver *);
  38. typedef nframes_t (*JackDriverFramesSinceCycleStartFunction)(struct _jack_driver *);
  39. typedef ClockSyncStatus (*JackDriverClockSyncStatusFunction)(struct _jack_driver *, channel_t);
  40. typedef int (*JackDriverAudioStopFunction)(struct _jack_driver *);
  41. typedef int (*JackDriverAudioStartFunction)(struct _jack_driver *);
  42. typedef void (*JackDriverSetHwMonitoringFunction) (struct _jack_driver *, int);
  43. typedef int (*JackDriverChangeSampleClockFunction) (struct _jack_driver *, SampleClockMode mode);
  44. typedef int (*JackDriverResetParametersFunction) (struct _jack_driver *, nframes_t frames_per_cycle, nframes_t rate);
  45. typedef void (*JackDriverMarkChannelSilentFunction) (struct _jack_driver *, unsigned long chn);
  46. typedef void (*JackDriverRequestMonitorInputFunction) (struct _jack_driver *, unsigned long chn, int yn);
  47. typedef void (*JackDriverRequestAllMonitorInputFunction) (struct _jack_driver *, int yn);
  48. typedef int (*JackDriverMonitoringInputFunction)(struct _jack_driver *,channel_t chn);
  49. #define JACK_DRIVER_DECL \
  50. nframes_t frame_rate; \
  51. nframes_t frames_per_cycle; \
  52. nframes_t capture_frame_latency; \
  53. nframes_t playback_frame_latency; \
  54. unsigned long period_interval; \
  55. SampleClockMode clock_mode; \
  56. unsigned long input_monitor_mask; \
  57. struct _jack_engine *engine; \
  58. GSList *clock_sync_listeners; \
  59. pthread_mutex_t clock_sync_lock; \
  60. unsigned long next_clock_sync_listener_id; \
  61. GSList *input_monitor_listeners; \
  62. pthread_mutex_t input_monitor_lock; \
  63. unsigned long next_input_monitor_listener_id; \
  64. char hw_monitoring : 1; \
  65. char all_monitor_in : 1; \
  66. char has_clock_sync_reporting : 1; \
  67. char has_hw_monitoring : 1; \
  68. void *handle; \
  69. void (*finish)(struct _jack_driver *);\
  70. \
  71. /* These are the "core" driver functions */ \
  72. \
  73. JackDriverAttachFunction attach; \
  74. JackDriverDetachFunction detach; \
  75. JackDriverWaitFunction wait; \
  76. \
  77. /* These support the "audio" side of a driver, which arguably \
  78. could/should be provided by a different kind of object. \
  79. */ \
  80. \
  81. JackDriverFramesSinceCycleStartFunction frames_since_cycle_start; \
  82. JackDriverClockSyncStatusFunction clock_sync_status; \
  83. JackDriverAudioStopFunction audio_stop; \
  84. JackDriverAudioStartFunction audio_start; \
  85. JackDriverSetHwMonitoringFunction set_hw_monitoring; \
  86. JackDriverChangeSampleClockFunction change_sample_clock; \
  87. JackDriverResetParametersFunction reset_parameters; \
  88. JackDriverMarkChannelSilentFunction mark_channel_silent; \
  89. JackDriverRequestMonitorInputFunction request_monitor_input; \
  90. JackDriverRequestAllMonitorInputFunction request_all_monitor_input; \
  91. JackDriverMonitoringInputFunction monitoring_input;
  92. typedef struct _jack_driver {
  93. JACK_DRIVER_DECL
  94. } jack_driver_t;
  95. void jack_driver_init (jack_driver_t *);
  96. void jack_driver_release (jack_driver_t *);
  97. jack_driver_t *jack_driver_load (const char *path_to_so, ...);
  98. void jack_driver_unload (jack_driver_t *);
  99. int jack_driver_listen_for_clock_sync_status (jack_driver_t *, ClockSyncListenerFunction, void *arg);
  100. int jack_driver_stop_listen_for_clock_sync_status (jack_driver_t *, int);
  101. int jack_driver_listen_for_input_monitor_status (jack_driver_t *, InputMonitorListenerFunction, void *arg);
  102. int jack_driver_stop_listen_for_input_monitor_status (jack_driver_t *, int);
  103. void jack_driver_clock_sync_notify (jack_driver_t *, channel_t chn, ClockSyncStatus);
  104. void jack_driver_input_monitor_notify (jack_driver_t *, channel_t chn, int);
  105. #endif /* __jack_driver_h__ */