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 PRE_PACKED_STRUCTURE
00039 class SERVER_EXPORT JackPort
00040 {
00041
00042 friend class JackGraphManager;
00043
00044 private:
00045
00046 int fTypeId;
00047 enum JackPortFlags fFlags;
00048 char fName[REAL_JACK_PORT_NAME_SIZE];
00049 char fAlias1[REAL_JACK_PORT_NAME_SIZE];
00050 char fAlias2[REAL_JACK_PORT_NAME_SIZE];
00051 int fRefNum;
00052
00053 jack_nframes_t fLatency;
00054 jack_nframes_t fTotalLatency;
00055 jack_latency_range_t fPlaybackLatency;
00056 jack_latency_range_t fCaptureLatency;
00057 uint8_t fMonitorRequests;
00058
00059 bool fInUse;
00060 jack_port_id_t fTied;
00061 jack_default_audio_sample_t fBuffer[BUFFER_SIZE_MAX + 4];
00062
00063 bool IsUsed() const
00064 {
00065 return fInUse;
00066 }
00067
00068
00069 void ClearBuffer(jack_nframes_t frames);
00070 void MixBuffers(void** src_buffers, int src_count, jack_nframes_t frames);
00071
00072 public:
00073
00074 JackPort();
00075
00076 bool Allocate(int refnum, const char* port_name, const char* port_type, JackPortFlags flags);
00077 void Release();
00078 const char* GetName() const;
00079 const char* GetShortName() const;
00080 void SetName(const char* name);
00081
00082 int GetAliases(char* const aliases[2]);
00083 int SetAlias(const char* alias);
00084 int UnsetAlias(const char* alias);
00085 bool NameEquals(const char* target);
00086
00087 int GetFlags() const;
00088 const char* GetType() const;
00089
00090 int Tie(jack_port_id_t port_index);
00091 int UnTie();
00092
00093 jack_nframes_t GetLatency() const;
00094 void SetLatency(jack_nframes_t latency);
00095
00096 void SetLatencyRange(jack_latency_callback_mode_t mode, jack_latency_range_t* range);
00097 void GetLatencyRange(jack_latency_callback_mode_t mode, jack_latency_range_t* range) const;
00098
00099 jack_nframes_t GetTotalLatency() const;
00100
00101 int RequestMonitor(bool onoff);
00102 int EnsureMonitor(bool onoff);
00103 bool MonitoringInput()
00104 {
00105 return (fMonitorRequests > 0);
00106 }
00107
00108
00109 jack_default_audio_sample_t* GetBuffer()
00110 {
00111 return (jack_default_audio_sample_t*)((uintptr_t)fBuffer & ~15L) + 4;
00112 }
00113
00114 int GetRefNum() const;
00115
00116 } POST_PACKED_STRUCTURE;
00117
00118 }
00119
00120
00121 #endif
00122