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.

103 lines
3.3KB

  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 Lesser General Public License as published by
  5. the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program; if not, write to the Free Software
  13. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  14. $Id: port.h,v 1.1 2002-07-28 23:18:15 nebogeo Exp $
  15. */
  16. #ifndef __jack_port_h__
  17. #define __jack_port_h__
  18. #include <pthread.h>
  19. #include <jack/types.h>
  20. typedef struct _jack_port_type_info {
  21. const char type_name[32]; /* what do you think ? */
  22. void (*mixdown)(jack_port_t *, nframes_t); /* function to mixdown multiple inputs to a buffer. can be
  23. NULL, indicating that multiple input connections
  24. are not legal for this data type.
  25. */
  26. long buffer_scale_factor; /* If == 1, then a buffer to handle nframes worth of
  27. data is sizeof(sample_t) * nframes bytes large.
  28. If anything other than 1, the buffer allocated
  29. for input mixing will be this value times
  30. sizeof (sample_t) * nframes bytes in size.
  31. Obviously, for non-audio data types, it may have
  32. a different value.
  33. if < 0, then the value should be ignored, and
  34. port->shared->buffer_size should be used.
  35. */
  36. } jack_port_type_info_t;
  37. /* This is the data structure allocated in shared memory
  38. by the engine.
  39. */
  40. typedef struct _jack_port_shared {
  41. int shm_key;
  42. size_t offset;
  43. unsigned long flags;
  44. unsigned long buffer_size;
  45. jack_port_id_t id;
  46. char name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE+2];
  47. jack_port_type_info_t type_info;
  48. jack_client_id_t client_id;
  49. nframes_t latency;
  50. unsigned char monitor_requests;
  51. char in_use : 1;
  52. char locked : 1;
  53. } jack_port_shared_t;
  54. /* This is the data structure allocated by the client
  55. in local memory. The `shared' pointer points
  56. the the corresponding structure in shared memory.
  57. */
  58. struct _jack_port {
  59. char *client_segment_base;
  60. struct _jack_port_shared *shared;
  61. pthread_mutex_t connection_lock;
  62. GSList *connections;
  63. struct _jack_port *tied;
  64. };
  65. /* inline would be cleaner, but it needs to be fast even in non-optimized
  66. code.
  67. */
  68. #define jack_port_buffer(p) ((void *) ((p)->client_segment_base + (p)->shared->offset))
  69. /* this is the structure allocated by the engine in local
  70. memory.
  71. */
  72. typedef struct _jack_port_internal {
  73. struct _jack_port_shared *shared;
  74. GSList *connections;
  75. void *buffer_info;
  76. } jack_port_internal_t;
  77. #endif /* __jack_port_h__ */