JackPort.h

00001 /*
00002 Copyright (C) 2001 Paul Davis
00003 Copyright (C) 2004-2006 Grame  
00004 
00005 This program is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009 
00010   This program is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU General Public License for more details.
00014 
00015   You should have received a copy of the GNU General Public License
00016   along with this program; if not, write to the Free Software
00017   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 */
00020 
00021 #ifndef __JackPort__
00022 #define __JackPort__
00023 
00024 #include "types.h"
00025 #include "JackConstants.h"
00026 
00027 namespace Jack
00028 {
00029 
00030 #define ALL_PORTS       0xFFFF
00031 #define NO_PORT         0xFFFE
00032 
00037 class JackPort
00038 {
00039 
00040         friend class JackGraphManager;
00041 
00042     private:
00043 
00044         enum JackPortFlags fFlags;
00045         char fName[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
00046                 char fAlias1[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
00047                 char fAlias2[JACK_CLIENT_NAME_SIZE + JACK_PORT_NAME_SIZE];
00048         int fRefNum;
00049 
00050         jack_nframes_t fLatency;
00051         uint8_t fMonitorRequests;
00052 
00053         bool fInUse;
00054         bool fLocked;
00055         jack_port_id_t fTied;   // Locally tied source port
00056 
00057         #ifdef WIN32
00058         //__declspec(align(16)) float fBuffer[BUFFER_SIZE_MAX];
00059                 float fBuffer[BUFFER_SIZE_MAX];
00060         #elif __GNUC__
00061                 float fBuffer[BUFFER_SIZE_MAX] __attribute__((aligned(64)));  // 16 alignment for vector code, 64 better for cache loads/stores
00062         #else
00063                 #warning Buffer will not be aligned on 16 bytes boundaries : vector based code (Altivec of SSE) will fail 
00064                 float fBuffer[BUFFER_SIZE_MAX];
00065         #endif
00066 
00067         bool IsUsed() const;
00068                 
00069                 static void MixBuffer(float* mixbuffer, float* buffer, jack_nframes_t frames);
00070 
00071     public:
00072 
00073         JackPort();
00074         virtual ~JackPort();
00075 
00076         void Allocate(int refnum, const char* port_name, JackPortFlags flags);
00077         void Release();
00078         const char* GetName() const;
00079         const char* GetShortName() const;
00080         int     SetName(const char* name);
00081                 void Rename(const char* name, int index);
00082                 
00083                 int GetAliases(char* const aliases[2]);
00084                 int SetAlias(const char* alias);
00085                 int UnsetAlias(const char* alias);
00086                 bool NameEquals(const char* target);
00087 
00088         int     Flags() const;
00089         const char* Type() const;
00090 
00091         int Lock();
00092         int Unlock();
00093 
00094         int Tie(jack_port_id_t port_index);
00095         int UnTie();
00096 
00097         jack_nframes_t GetLatency() const;
00098         void SetLatency(jack_nframes_t latency);
00099 
00100         int RequestMonitor(bool onoff);
00101         int EnsureMonitor(bool onoff);
00102         bool MonitoringInput();
00103 
00104         float* GetBuffer();
00105         int GetRefNum() const;
00106         
00107 };
00108 
00109 
00110 } // end of namespace
00111 
00112 
00113 #endif
00114 

Generated on Mon Oct 15 17:11:14 2007 for Jackdmp by  doxygen 1.5.1