00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __JackPort__
00022 #define __JackPort__
00023
00024 #include "types.h"
00025 #include "JackConstants.h"
00026 #include "JackCompilerDeps.h"
00027
00028 namespace Jack
00029 {
00030
00031 #define ALL_PORTS 0xFFFF
00032 #define NO_PORT 0xFFFE
00033
00038 class SERVER_EXPORT JackPort
00039 {
00040
00041 friend class JackGraphManager;
00042
00043 private:
00044
00045 int fTypeId;
00046 enum JackPortFlags fFlags;
00047 char fName[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
00048 char fAlias1[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
00049 char fAlias2[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
00050 int fRefNum;
00051
00052 jack_nframes_t fLatency;
00053 jack_nframes_t fTotalLatency;
00054 uint8_t fMonitorRequests;
00055
00056 bool fInUse;
00057 jack_port_id_t fTied;
00058 float fBuffer[BUFFER_SIZE_MAX + 4];
00059
00060 bool IsUsed() const
00061 {
00062 return fInUse;
00063 }
00064
00065
00066 void ClearBuffer(jack_nframes_t frames);
00067 void MixBuffers(void** src_buffers, int src_count, jack_nframes_t frames);
00068
00069 public:
00070
00071 JackPort();
00072
00073 bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
00074 void Release();
00075 const char* GetName() const;
00076 const char* GetShortName() const;
00077 void SetName(const char* name);
00078
00079 int GetAliases(char* const aliases[2]);
00080 int SetAlias(const char* alias);
00081 int UnsetAlias(const char* alias);
00082 bool NameEquals(const char* target);
00083
00084 int GetFlags() const;
00085 const char* GetType() const;
00086
00087 int Tie(jack_port_id_t port_index);
00088 int UnTie();
00089
00090 jack_nframes_t GetLatency() const;
00091 jack_nframes_t GetTotalLatency() const;
00092 void SetLatency(jack_nframes_t latency);
00093
00094 int RequestMonitor(bool onoff);
00095 int EnsureMonitor(bool onoff);
00096 bool MonitoringInput()
00097 {
00098 return (fMonitorRequests > 0);
00099 }
00100
00101
00102 float* GetBuffer()
00103 {
00104 return (float*)((long)fBuffer & ~15L) + 4;
00105 }
00106
00107 int GetRefNum() const;
00108
00109 } POST_PACKED_STRUCTURE;
00110
00111 }
00112
00113
00114 #endif
00115