~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
JACK/jack/port.h


** Warning: Cannot open xref database.

1 /* 2 Copyright (C) 2001 Paul Davis 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU Lesser General Public License as published by 6 the Free Software Foundation; either version 2.1 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public License 15 along with this program; if not, write to the Free Software 16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 18 $Id: port.h,v 1.19 2003/10/31 20:52:24 joq Exp $ 19 */ 20 21 #ifndef __jack_port_h__ 22 #define __jack_port_h__ 23 24 #include <pthread.h> 25 #include <jack/types.h> 26 #include <jack/jslist.h> 27 #include <jack/shm.h> 28 29 #define JACK_PORT_NAME_SIZE 32 30 #define JACK_PORT_TYPE_SIZE 32 31 32 /* The relatively low value of this constant reflects the fact that 33 * JACK currently only knows about *1* port type. (March 2003) 34 * 35 * Further, the 4 covers: 36 * - a single non-negotiated audio format 37 * - music data (ie. MIDI) 38 * - video 39 * - one other 40 * 41 * which is probably enough for more than just the foreseeable future. 42 */ 43 #define JACK_MAX_PORT_TYPES 4 44 #define JACK_AUDIO_PORT_TYPE 0 45 46 /* these should probably go somewhere else, but not in <jack/types.h> */ 47 #define JACK_CLIENT_NAME_SIZE 32 48 typedef uint32_t jack_client_id_t; 49 50 /* JACK shared memory segments are limited to MAX_INT32, they can be 51 * shared between 32-bit and 64-bit clients. 52 */ 53 #define JACK_SHM_MAX (MAX_INT32) 54 typedef int32_t jack_port_type_id_t; 55 56 /* Port type structure. 57 * 58 * (1) One for each port type is part of the engine's jack_control_t 59 * shared memory structure. 60 * 61 * (2) One for each port type is appended to the engine's 62 * jack_client_connect_result_t response. The client reads them into 63 * its local memory, using them to attach the corresponding shared 64 * memory segments. 65 */ 66 typedef struct _jack_port_type_info { 67 68 jack_port_type_id_t ptype_id; 69 const char type_name[JACK_PORT_TYPE_SIZE]; 70 71 /* If == 1, then a buffer to handle nframes worth of data has 72 * sizeof(jack_default_audio_sample_t) * nframes bytes. 73 * 74 * If > 1, the buffer allocated for input mixing will be 75 * this value times sizeof(jack_default_audio_sample_t) 76 * * nframes bytes in size. For non-audio data types, 77 * it may have a different value. 78 * 79 * If < 0, the value should be ignored, and buffer_size 80 * should be used. 81 */ 82 int32_t buffer_scale_factor; 83 84 /* ignored unless buffer_scale_factor is < 0. see above */ 85 jack_shmsize_t buffer_size; 86 87 jack_shm_registry_index_t shm_registry_index; 88 89 } jack_port_type_info_t; 90 91 /* Allocated by the engine in shared memory. */ 92 typedef struct _jack_port_shared { 93 94 jack_port_type_id_t ptype_id; /* index into port type array */ 95 jack_shmsize_t offset; /* buffer offset in shm segment */ 96 jack_port_id_t id; /* index into engine port array */ 97 enum JackPortFlags flags; 98 char name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE+2]; 99 jack_client_id_t client_id; /* who owns me */ 100 101 volatile jack_nframes_t latency; 102 volatile jack_nframes_t total_latency; 103 volatile uint8_t monitor_requests; 104 105 char has_mixdown; /* port has a mixdown function */ 106 char in_use; 107 char locked; 108 109 } jack_port_shared_t; 110 111 typedef struct _jack_port_functions { 112 113 /* Function to mixdown multiple inputs to a buffer. Can be NULL, 114 * indicating that multiple input connections are not legal for 115 * this data type. 116 */ 117 void (*mixdown)(jack_port_t *, jack_nframes_t); 118 119 } jack_port_functions_t; 120 121 /* Allocated by the client in local memory. */ 122 struct _jack_port { 123 void **client_segment_base; 124 void *mix_buffer; 125 jack_port_type_info_t *type_info; /* shared memory type info */ 126 struct _jack_port_shared *shared; /* corresponding shm struct */ 127 struct _jack_port *tied; /* locally tied source port */ 128 jack_port_functions_t fptr; 129 pthread_mutex_t connection_lock; 130 JSList *connections; 131 }; 132 133 /* Inline would be cleaner, but it needs to be fast even in 134 * non-optimized code. jack_output_port_buffer() only handles output 135 * ports. jack_port_buffer() works for both input and output ports. 136 */ 137 #define jack_port_buffer(p) \ 138 ((void *) ((p)->mix_buffer? (p)->mix_buffer: \ 139 *(p)->client_segment_base + (p)->shared->offset)) 140 #define jack_output_port_buffer(p) \ 141 ((void *) (*(p)->client_segment_base + (p)->shared->offset)) 142 143 #endif /* __jack_port_h__ */ 144 145

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.