summaryrefslogtreecommitdiff
path: root/jack/port.h
blob: 90d41044157b4f46d468fd229302b1c207dcf6ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
    Copyright (C) 2001 Paul Davis
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.
    
    You should have received a copy of the GNU Lesser General Public License
    along with this program; if not, write to the Free Software 
    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

    $Id$
*/

#ifndef __jack_port_h__
#define __jack_port_h__

#include <pthread.h>
#include <jack/types.h>

typedef struct _jack_port_type_info {
    const char *type_name;                       /* what do you think ? */

    void (*mixdown)(jack_port_t *, nframes_t);  /* function to mixdown multiple inputs to a buffer. can be
						    NULL, indicating that multiple input connections
						    are not legal for this data type.
						 */

    long buffer_scale_factor;                    /* If == 1, then a buffer to handle nframes worth of
						    data is sizeof(sample_t) * nframes bytes large.
						    
						    If anything other than 1, the buffer allocated
						    for input mixing will be this value times
						    sizeof (sample_t) * nframes bytes in size.

						    Obviously, for non-audio data types, it may have
						    a different value.

						    if < 0, then the value should be ignored, and
						    port->shared->buffer_size should be used.
						 */
} jack_port_type_info_t;

/* This is the data structure allocated in shared memory
   by the engine.
*/

typedef struct _jack_port_shared {
    void                      *buffer;      
    unsigned long              flags; 
    unsigned long              buffer_size;
    jack_port_id_t            id;
    char                       name[JACK_CLIENT_NAME_SIZE+JACK_PORT_NAME_SIZE+2];
    jack_port_type_info_t     type_info;
    jack_client_id_t          client_id;

    char                       in_use : 1;
    char                       locked : 1;
} jack_port_shared_t;

/* This is the data structure allocated by the client
   in local memory. The `shared' pointer points
   the the corresponding structure in shared memory.
*/

struct _jack_port {
    struct _jack_port_shared *shared;
    GSList                    *connections;
    struct _jack_port        *tied;
    void                      *own_buffer;
};

/* this is the structure allocated by the engine in local
   memory.
*/

typedef struct _jack_port_internal {
    struct _jack_port_shared *shared;
    GSList                    *connections;
} jack_port_internal_t;

#endif /* __jack_port_h__ */