2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2008 Grame
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.
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.
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.
25 #include "JackConstants.h"
26 #include "JackCompilerDeps.h"
31 #define ALL_PORTS 0xFFFF
32 #define NO_PORT 0xFFFE
35 \brief Base class for port.
39 class SERVER_EXPORT JackPort
42 friend class JackGraphManager
;
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];
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
;
60 jack_port_id_t fTied
; // Locally tied source port
61 jack_default_audio_sample_t fBuffer
[BUFFER_SIZE_MAX
+ 8];
69 void ClearBuffer(jack_nframes_t frames
);
70 void MixBuffers(void** src_buffers
, int src_count
, jack_nframes_t frames
);
76 bool Allocate(int refnum
, const char* port_name
, const char* port_type
, JackPortFlags flags
);
78 const char* GetName() const;
79 const char* GetShortName() const;
80 void SetName(const char* name
);
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
);
88 const char* GetType() const;
90 int Tie(jack_port_id_t port_index
);
93 jack_nframes_t
GetLatency() const;
94 void SetLatency(jack_nframes_t latency
);
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;
99 jack_nframes_t
GetTotalLatency() const;
101 int RequestMonitor(bool onoff
);
102 int EnsureMonitor(bool onoff
);
103 bool MonitoringInput()
105 return (fMonitorRequests
> 0);
108 // Since we are in shared memory, the resulting pointer cannot be cached, so align it here...
109 jack_default_audio_sample_t
* GetBuffer()
111 return (jack_default_audio_sample_t
*)((uintptr_t)fBuffer
& ~31L) + 8;
114 int GetRefNum() const;
116 } POST_PACKED_STRUCTURE
;
118 } // end of namespace