Cleanup
[jack2.git] / common / JackPort.h
blob84823842029b917720593c78176704ab941ede7b
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2006 Grame
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 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 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __JackPort__
22 #define __JackPort__
24 #include "types.h"
25 #include "JackConstants.h"
27 namespace Jack
30 #define ALL_PORTS 0xFFFF
31 #define NO_PORT 0xFFFE
33 /*!
34 \brief Base class for port.
37 class JackPort
40 friend class JackGraphManager;
42 private:
44 enum JackPortFlags fFlags;
45 char fName[JACK_PORT_NAME_SIZE + 2];
46 int fRefNum;
48 jack_nframes_t fLatency;
49 uint8_t fMonitorRequests;
51 bool fInUse;
52 bool fLocked;
53 jack_port_id_t fTied; // Locally tied source port
55 float fBuffer[BUFFER_SIZE_MAX];
57 bool IsUsed() const;
59 static void MixBuffer(float* mixbuffer, float* buffer, jack_nframes_t frames);
61 public:
63 JackPort();
64 virtual ~JackPort();
66 void Allocate(int refnum, const char* port_name, JackPortFlags flags);
67 void Release();
68 const char* GetName() const;
69 const char* GetShortName() const;
70 int SetName(const char * name);
72 int Flags() const;
73 const char* Type() const;
75 int Lock();
76 int Unlock();
78 int Tie(jack_port_id_t port_index);
79 int UnTie();
81 jack_nframes_t GetLatency() const;
82 void SetLatency(jack_nframes_t latency);
84 int RequestMonitor(bool onoff);
85 int EnsureMonitor(bool onoff);
86 bool MonitoringInput();
88 float* GetBuffer();
89 int GetRefNum() const;
94 } // end of namespace
97 #endif