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

Dilator.h

00001 #ifndef INCLUDE_DILATOR_H
00002 #define INCLUDE_DILATOR_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  * Dilator.h
00026  *
00027  * Definition of class Dilator.
00028  *
00029  * Kelly Fitz, 26 Oct 1999
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 <vector>
00041 
00042 //  begin namespace
00043 namespace Loris {
00044 
00045 class Marker;
00046 class Partial;
00047 
00048 // ---------------------------------------------------------------------------
00049 //  class Dilator
00050 //
00062 //
00063 class Dilator
00064 {
00065 //  -- instance variables --
00066 
00067     std::vector< double > _initial, _target;    //  time points
00068     
00069 //  -- public interface --
00070 public:
00071 //  -- construction --
00072 
00074     Dilator( void );
00075         
00091 #if ! defined(NO_TEMPLATE_MEMBERS)
00092     template<typename Iter1, typename Iter2>
00093     Dilator( Iter1 ibegin, Iter1 iend, Iter2 tbegin );
00094 #else
00095     inline
00096     Dilator( const double * ibegin, const double * iend, const double * tbegin );
00097 #endif
00098 
00099     //  Use compiler-generated copy, assign, and destroy.
00100     
00101 //  -- mutation --
00102     
00118     void insert( double i, double t );
00119     
00120 //  -- dilation --
00121 
00144     void dilate( Partial & p ) const;
00145      
00147     void operator() ( Partial & p ) const;
00148 
00155     void dilate( Marker & m ) const;
00156      
00158     void operator() ( Marker & m ) const;
00159      
00173 #if ! defined(NO_TEMPLATE_MEMBERS)
00174     template<typename Iter>
00175     void dilate( Iter dilate_begin, Iter dilate_end  ) const;
00176 #else
00177     inline
00178     void dilate( PartialList::iterator dilate_begin, 
00179                     PartialList::iterator dilate_end  ) const;
00180 #endif
00181      
00191 #if ! defined(NO_TEMPLATE_MEMBERS)
00192     template<typename Iter>
00193     void operator() ( Iter dilate_begin, Iter dilate_end  ) const;
00194 #else
00195     inline
00196     void operator() ( PartialList::iterator dilate_begin, 
00197                           PartialList::iterator dilate_end ) const;
00198 #endif
00199      
00204     double warpTime( double currentTime ) const;
00205 
00206 // -- static members --
00207 
00232 #if ! defined(NO_TEMPLATE_MEMBERS)
00233     template< typename PartialsIter, typename TimeIter1, typename TimeIter2 >
00234     static 
00235     void dilate( PartialsIter dilate_begin, PartialsIter dilate_end,
00236                  TimeIter1 ibegin, TimeIter1 iend, TimeIter2 tbegin  );
00237 #else
00238     static inline
00239     void dilate( PartialList::iterator dilate_begin, 
00240                  PartialList::iterator dilate_end,
00241                  const double * ibegin, const double * iend, 
00242                  const double * tbegin  );
00243 #endif
00244 
00245 };  //  end of class Dilator
00246 
00247 
00248 // ---------------------------------------------------------------------------
00249 //  constructor (sequences of time points)
00250 // ---------------------------------------------------------------------------
00266 //
00267 #if ! defined(NO_TEMPLATE_MEMBERS)
00268 template<typename Iter1, typename Iter2>
00269 Dilator::Dilator( Iter1 ibegin, Iter1 iend, Iter2 tbegin )
00270 #else
00271 inline
00272 Dilator::Dilator( const double * ibegin, const double * iend, const double * tbegin )
00273 #endif
00274 {
00275     while ( ibegin != iend )
00276     {
00277         insert( *ibegin++, *tbegin++ );
00278     }
00279 }
00280 
00281 // ---------------------------------------------------------------------------
00282 //  dilate (sequence of Partials or Markers)
00283 // ---------------------------------------------------------------------------
00297 //
00298 #if ! defined(NO_TEMPLATE_MEMBERS)
00299 template<typename Iter>
00300 void Dilator::dilate( Iter dilate_begin, Iter dilate_end  ) const
00301 #else
00302 inline
00303 void Dilator::dilate( PartialList::iterator dilate_begin, 
00304                       PartialList::iterator dilate_end  ) const
00305 #endif
00306 {
00307     while ( dilate_begin != dilate_end )
00308     {
00309         dilate( *(dilate_begin++) );
00310     }
00311 }
00312 
00313 // ---------------------------------------------------------------------------
00314 //  Function call operator (sequence of Partials or Markers)
00315 // ---------------------------------------------------------------------------
00325 //   
00326 #if ! defined(NO_TEMPLATE_MEMBERS)
00327 template<typename Iter>
00328 void Dilator::operator() ( Iter dilate_begin, Iter dilate_end  ) const
00329 #else
00330 inline
00331 void Dilator::operator() ( PartialList::iterator dilate_begin, 
00332                            PartialList::iterator dilate_end ) const
00333 #endif
00334 { 
00335     dilate( dilate_begin, dilate_end ); 
00336 }
00337 
00338 // ---------------------------------------------------------------------------
00339 //  Function call operator (single Partial)
00340 // ---------------------------------------------------------------------------
00344 //
00345 inline 
00346 void Dilator::operator() ( Partial & p ) const
00347 { 
00348     dilate( p ); 
00349 }
00350 
00351 // ---------------------------------------------------------------------------
00352 //  Function call operator (single Marker)
00353 // ---------------------------------------------------------------------------
00357 //
00358 inline 
00359 void Dilator::operator() ( Marker & m ) const
00360 { 
00361     dilate( m ); 
00362 }
00363 
00364 // ---------------------------------------------------------------------------
00365 //  dilate (static)
00366 // ---------------------------------------------------------------------------
00391 //
00392 #if ! defined(NO_TEMPLATE_MEMBERS)
00393 template< typename PartialsIter, typename TimeIter1, typename TimeIter2 >
00394 void Dilator::dilate( PartialsIter dilate_begin, PartialsIter dilate_end,
00395                       TimeIter1 ibegin, TimeIter1 iend, TimeIter2 tbegin  )
00396 #else
00397 inline
00398 void Dilator::dilate( PartialList::iterator dilate_begin, 
00399                       PartialList::iterator dilate_end,
00400                       const double * ibegin, const double * iend, 
00401                       const double * tbegin  )
00402 #endif
00403 { 
00404     Dilator instance( ibegin, iend, tbegin );
00405     instance.dilate( dilate_begin, dilate_end ); 
00406 }
00407 
00408 }   //  end of namespace Loris
00409 
00410 #endif /* ndef INCLUDE_DILATOR_H */

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