Sieve.h

00001 #ifndef INCLUDE_SIEVE_H
00002 #define INCLUDE_SIEVE_H
00003 /*
00004  * This is the Loris C++ Class Library, implementing analysis, 
00005  * manipulation, and synthesis of digitized sounds using the Reassigned 
00006  * Bandwidth-Enhanced Additive Sound Model.
00007  *
00008  * Loris is Copyright (c) 1999-2007 by Kelly Fitz and Lippold Haken
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  *
00024  *
00025  * Sieve.h
00026  *
00027  * Definition of class Sieve.
00028  *
00029  * Lippold Haken, 20 Jan 2001
00030  * loris@cerlsoundgroup.org
00031  *
00032  * http://www.cerlsoundgroup.org/Loris/
00033  *
00034  */
00035 #if defined(NO_TEMPLATE_MEMBERS)
00036 #include "PartialList.h"
00037 #endif
00038 
00039 #include "PartialPtrs.h"
00040 
00041 //  begin namespace
00042 namespace Loris {
00043 
00044 // ---------------------------------------------------------------------------
00045 //  class Sieve
00046 //
00065 //
00066 class Sieve
00067 {
00068 //  -- instance variables --
00069 
00070     double _fadeTime; 
00071 
00072 
00073     
00074 //  -- public interface --
00075 public:
00076 
00077 //  -- global defaults and constants --
00078 
00081     static const double DefaultFadeTime;
00082     
00083 //  -- construction --
00084 
00095     explicit Sieve( double partialFadeTime = Sieve::DefaultFadeTime );
00096      
00097     //  Use compiler-generated copy, assign, and destroy.
00098     
00099 //  -- sifting --
00100 
00113 #if ! defined(NO_TEMPLATE_MEMBERS)
00114     template<typename Iter>
00115     void sift( Iter sift_begin, Iter sift_end  );
00116 #else
00117    inline
00118     void sift( PartialList::iterator sift_begin, PartialList::iterator sift_end  );
00119 #endif
00120 
00132 #if ! defined(NO_TEMPLATE_MEMBERS)
00133     template< typename Container >
00134     void sift( Container & partials  )
00135 #else
00136    inline
00137     void sift( PartialList & partials )
00138 #endif
00139     {
00140         sift( partials.begin(), partials.end() );
00141     }
00142          
00143 // -- static members --
00144 
00162 #if ! defined(NO_TEMPLATE_MEMBERS)
00163     template< typename Iter >
00164     static 
00165     void sift( Iter sift_begin, Iter sift_end, 
00166               double partialFadeTime );
00167 #else
00168     static inline 
00169     void sift( PartialList::iterator sift_begin, PartialList::iterator sift_end,
00170               double partialFadeTime );
00171 #endif   
00172 
00173 //  -- helper --
00174 private:
00175 
00185     void sift_ptrs( PartialPtrs & ptrs );
00186 
00187 };  //  end of class Sieve
00188 
00189 // ---------------------------------------------------------------------------
00190 //  sift
00191 // ---------------------------------------------------------------------------
00204 #if ! defined(NO_TEMPLATE_MEMBERS)
00205 template< typename Iter >
00206 void Sieve::sift( Iter sift_begin, Iter sift_end  )
00207 #else
00208 inline
00209 void Sieve::sift( PartialList::iterator sift_begin, PartialList::iterator sift_end  )
00210 #endif
00211 {
00212     PartialPtrs ptrs;
00213     fillPartialPtrs( sift_begin, sift_end, ptrs );
00214     sift_ptrs( ptrs );
00215 }
00216 
00217 // ---------------------------------------------------------------------------
00218 //  sift (static)
00219 // ---------------------------------------------------------------------------
00237 #if ! defined(NO_TEMPLATE_MEMBERS)
00238 template< typename Iter >
00239 void Sieve::sift( Iter sift_begin, Iter sift_end, 
00240                   double partialFadeTime )
00241 #else
00242 inline 
00243 void Sieve::sift( PartialList::iterator sift_begin, PartialList::iterator sift_end,
00244                   double partialFadeTime )
00245 #endif   
00246 {
00247    Sieve instance( partialFadeTime );
00248    instance.sift( sift_begin, sift_end );
00249 }
00250 
00251 }   //  end of namespace Loris
00252 
00253 #endif /* ndef INCLUDE_SIEVE_H */

Generated on Sat Jan 19 19:02:50 2008 for Loris by  doxygen 1.5.2