Jack2: JackPort.h Source File

Jack2 1.9.12

JackPort.h
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2008 Grame
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 */
20
21 #ifndef __JackPort__
22 #define __JackPort__
23
24 #include "types.h"
25 #include "JackConstants.h"
26 #include "JackCompilerDeps.h"
27
28 namespace Jack
29 {
30
31 #define ALL_PORTS 0xFFFF
32 #define NO_PORT 0xFFFE
33
38 PRE_PACKED_STRUCTURE
39 class SERVER_EXPORT JackPort
40 {
41
42 friend class JackGraphManager;
43
44 private:
45
46 int fTypeId;
47 enum JackPortFlags fFlags;
48 char fName[REAL_JACK_PORT_NAME_SIZE+1];
49 char fAlias1[REAL_JACK_PORT_NAME_SIZE+1];
50 char fAlias2[REAL_JACK_PORT_NAME_SIZE+1];
51 int fRefNum;
52
53 jack_nframes_t fLatency;
54 jack_nframes_t fTotalLatency;
55 jack_latency_range_t fPlaybackLatency;
56 jack_latency_range_t fCaptureLatency;
57 uint8_t fMonitorRequests;
58
59 bool fInUse;
60 jack_port_id_t fTied; // Locally tied source port
61 jack_default_audio_sample_t fBuffer[BUFFER_SIZE_MAX + 8];
62
63 bool IsUsed() const
64 {
65 return fInUse;
66 }
67
68 // RT
69 void ClearBuffer(jack_nframes_t frames);
70 void MixBuffers(void** src_buffers, int src_count, jack_nframes_t frames);
71
72 public:
73
74 JackPort();
75
76 bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
77 void Release();
78 const char* GetName() const;
79 const char* GetShortName() const;
80 void SetName(const char* name);
81
82 int GetAliases(char* const aliases[2]);
83 int SetAlias(const char* alias);
84 int UnsetAlias(const char* alias);
85 bool NameEquals(const char* target);
86
87 int GetFlags() const;
88 const char* GetType() const;
89
90 int Tie(jack_port_id_t port_index);
91 int UnTie();
92
93 jack_nframes_t GetLatency() const;
94 void SetLatency(jack_nframes_t latency);
95
96 void SetLatencyRange(jack_latency_callback_mode_t mode, jack_latency_range_t* range);
97 void GetLatencyRange(jack_latency_callback_mode_t mode, jack_latency_range_t* range) const;
98
99 jack_nframes_t GetTotalLatency() const;
100
101 int RequestMonitor(bool onoff);
102 int EnsureMonitor(bool onoff);
103 bool MonitoringInput()
104 {
105 return (fMonitorRequests > 0);
106 }
107
108 // Since we are in shared memory, the resulting pointer cannot be cached, so align it here...
109 jack_default_audio_sample_t* GetBuffer()
110 {
111 return (jack_default_audio_sample_t*)((uintptr_t)fBuffer & ~31L) + 8;
112 }
113
114 int GetRefNum() const;
115
116 } POST_PACKED_STRUCTURE;
117
118 } // end of namespace
119
120
121 #endif
122
Jack
Definition: JackAC3Encoder.cpp:30
Jack::JackPort
Base class for port.
Definition: JackPort.h:39
_jack_latency_range
Definition: types.h:265
Jack::JackGraphManager
Graph manager: contains the connection manager and the port array.
Definition: JackGraphManager.h:40