Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

/root/src/subsynth/syn/Core/Terminal.h

Go to the documentation of this file.
00001 
00002 /****************** <SYN heading BEGIN do not edit this line> *****************
00003  *
00004  * subsynth - modular audio synthesizer
00005  * subsynth is (C) Copyright 2001-2002 by Kevin Meinert
00006  *
00007  * Original Author: Kevin Meinert
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Library General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Library General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Library General Public
00020  * License along with this library; if not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00022  * Boston, MA 02111-1307, USA.
00023  *
00024  * -----------------------------------------------------------------
00025  * File:          $RCSfile: Terminal.h,v $
00026  * Date modified: $Date: 2002/04/15 01:55:54 $
00027  * Version:       $Revision: 1.13 $
00028  * -----------------------------------------------------------------
00029  *
00030  ****************** <SYN heading END do not edit this line> ******************/
00031 
00032 #ifndef SUBSYNTH_TERMINAL
00033 #define SUBSYNTH_TERMINAL
00034 
00035 #include <string>
00036 //#include <syn/ConnectionPtr.h>
00037 #include <syn/Core/Connection.h>
00038 #include <syn/Core/SampleBufferQueue.h>
00039 #include <syn/Core/TerminalPtr.h>
00040 
00041 namespace syn
00042 {
00043    class Module;
00044    
00051    class Terminal
00052    {
00053    public:
00054       Terminal( Module& module, const std::string& name = "unnamed" );
00055       virtual ~Terminal();
00056 
00057       /* the name of this instance of terminal */
00058       const std::string& name() const;
00059       void setName( const std::string& name );
00060 
00063       virtual void disconnect();
00064 
00066       virtual bool isConnected() const;
00067          
00072       static void connect( TerminalPtr inptr, TerminalPtr outptr  );
00073 
00075       Connection& connection();
00076       
00078       const Module& module() const { return mModule; }
00079       
00081       Module& module() { return mModule; }
00082 
00086       void push( SampleBuffer1f* buf ) { queue().push( buf ); }
00087       
00089       void pop() { queue().pop(); }
00090       
00092       SampleBuffer1f* front() { return queue().front(); }
00093       
00095       bool high() const { return queue().high(); }
00096 
00098       bool low() const { return queue().low(); }
00099       
00101       bool empty() const { return queue().empty(); }
00102       
00104       unsigned int size() const { return queue().size(); }
00105       
00112       bool done();
00113 
00117       void setDone( bool d );
00119       
00123       void setHighMark( unsigned int h ) { queue().setHighMark( h ); }
00124       
00126       void setLowMark( unsigned int l ) { queue().setLowMark( l ); }
00127       
00129       inline unsigned int highMark() const { return queue().highMark(); }
00130       
00132       inline unsigned int lowMark() const { return queue().lowMark(); }
00134    
00135    private:
00137       void setConnection( ConnectionPtr conn );
00138    
00140       SampleBufferQueue& queue()
00141       { 
00142          assert( mConnection.get() != NULL ); 
00143          return mConnection->queue(); 
00144       }
00146       const SampleBufferQueue& queue() const 
00147       { 
00148          assert( mConnection.get() != NULL ); 
00149          return mConnection->queue(); 
00150       }
00151          
00153       Module& mModule;
00154       std::string mName;
00155       ConnectionPtr mConnection;
00156       ConnectionPtr mDisconnect;
00157    };
00158    
00159 }
00160 
00161 
00162 #endif //TERMINAL

Generated at Mon Apr 15 09:26:07 2002 for subsynth by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001