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_PORT_NAME_SIZE + 2];
00046         int fRefNum;
00047 
00048         jack_nframes_t fLatency;
00049         uint8_t fMonitorRequests;
00050 
00051         bool fInUse;
00052         bool fLocked;
00053         jack_port_id_t fTied;   // Locally tied source port
00054 
00055         float fBuffer[BUFFER_SIZE_MAX];
00056 
00057         bool IsUsed() const;
00058                 
00059                 static void MixBuffer(float* mixbuffer, float* buffer, jack_nframes_t frames);
00060 
00061     public:
00062 
00063         JackPort();
00064         virtual ~JackPort();
00065 
00066         void Allocate(int refnum, const char* port_name, JackPortFlags flags);
00067         void Release();
00068         const char* GetName() const;
00069         const char* GetShortName() const;
00070         int     SetName(const char * name);
00071 
00072         int     Flags() const;
00073         const char* Type() const;
00074 
00075         int Lock();
00076         int Unlock();
00077 
00078         int Tie(jack_port_id_t port_index);
00079         int UnTie();
00080 
00081         jack_nframes_t GetLatency() const;
00082         void SetLatency(jack_nframes_t latency);
00083 
00084         int RequestMonitor(bool onoff);
00085         int EnsureMonitor(bool onoff);
00086         bool MonitoringInput();
00087 
00088         float* GetBuffer();
00089         int GetRefNum() const;
00090         
00091 };
00092 
00093 
00094 } // end of namespace
00095 
00096 
00097 #endif
00098 

Generated on Wed Jan 10 11:42:46 2007 for Jackdmp by  doxygen 1.4.5