Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Channelizer.h

00001 #ifndef INCLUDE_CHANNELIZER_H
00002 #define INCLUDE_CHANNELIZER_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-2004 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  * Channelizer.h
00026  *
00027  * Definition of class Loris::Channelizer.
00028  *
00029  * Kelly Fitz, 21 July 2000
00030  * loris@cerlsoundgroup.org
00031  *
00032  * http://www.cerlsoundgroup.org/Loris/
00033  *
00034  */
00035 
00036 #if defined(NO_TEMPLATE_MEMBERS)
00037 #include "PartialList.h"
00038 #endif
00039 
00040 #include <memory>
00041 
00042 //  begin namespace
00043 namespace Loris {
00044 
00045 class Envelope;
00046 class Partial;
00047 
00048 // ---------------------------------------------------------------------------
00049 //  Channelizer
00050 //  
00074 //
00075 class Channelizer
00076 {
00077 //  -- implementaion --
00078     std::auto_ptr< Envelope > _refChannelFreq;
00079     int _refChannelLabel;
00080     
00081 //  -- public interface --
00082 public:
00083 //  -- construction --
00084 
00095     Channelizer( const Envelope & refChanFreq, int refChanLabel );
00096      
00102     Channelizer( const Channelizer & other );
00103      
00109     Channelizer & operator=( const Channelizer & rhs );
00110      
00112     ~Channelizer( void );
00113      
00114 //  -- channelizing --
00115 
00120     void channelize( Partial & partial ) const;
00121 
00132 #if ! defined(NO_TEMPLATE_MEMBERS)
00133     template<typename Iter>
00134     void channelize( Iter begin, Iter end ) const;
00135 #else
00136     void channelize( PartialList::iterator begin, PartialList::iterator end ) const;
00137 #endif   
00138 
00140 #if ! defined(NO_TEMPLATE_MEMBERS)
00141     template<typename Iter>
00142     void operator() ( Iter begin, Iter end ) const
00143 #else
00144     inline
00145     void operator() ( PartialList::iterator begin, PartialList::iterator end ) const
00146 #endif
00147          { channelize( begin, end ); }
00148          
00149 // -- static members --
00150 
00172 #if ! defined(NO_TEMPLATE_MEMBERS)
00173     template< typename Iter >
00174     static 
00175     void channelize( Iter begin, Iter end, 
00176                      const Envelope & refChanFreq, int refChanLabel );
00177 #else
00178     static inline 
00179     void channelize( PartialList::iterator begin, PartialList::iterator end,
00180                      const Envelope & refChanFreq, int refChanLabel );
00181 #endif   
00182      
00183 };  //  end of class Channelizer
00184 
00185 // ---------------------------------------------------------------------------
00186 //  channelize (sequence of Partials)
00187 // ---------------------------------------------------------------------------
00198 //
00199 #if ! defined(NO_TEMPLATE_MEMBERS)
00200 template<typename Iter>
00201 void Channelizer::channelize( Iter begin, Iter end ) const
00202 #else
00203 inline
00204 void Channelizer::channelize( PartialList::iterator begin, PartialList::iterator end ) const
00205 #endif
00206 {
00207     while ( begin != end )
00208     {
00209         channelize( *begin++ );
00210     }
00211 }
00212 
00213 // ---------------------------------------------------------------------------
00214 //  channelize (static)
00215 // ---------------------------------------------------------------------------
00237 //
00238 #if ! defined(NO_TEMPLATE_MEMBERS)
00239 template< typename Iter >
00240 void Channelizer::channelize( Iter begin, Iter end, 
00241                               const Envelope & refChanFreq, int refChanLabel )
00242 #else
00243 inline
00244 void Channelizer::channelize( PartialList::iterator begin, PartialList::iterator end,
00245                               const Envelope & refChanFreq, int refChanLabel )
00246 #endif   
00247 {
00248    Channelizer instance( refChanFreq, refChanLabel );
00249     while ( begin != end )
00250     {
00251         instance.channelize( *begin++ );
00252     }
00253 }
00254 
00255 
00256 
00257 }   //  end of namespace Loris
00258 
00259 #endif /* ndef INCLUDE_CHANNELIZER_H */

Generated on Thu Apr 14 22:01:55 2005 for Loris by doxygen 1.3.4