00001 #ifndef PHASEFIX_H 00002 #define PHASEFIX_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-2010 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 * phasefix.h 00026 * 00027 * Functions for correcting Breakpoint phases and frequencies so that 00028 * stored phases match the phases that would be synthesized using the 00029 * Loris Synthesizer. 00030 * 00031 * Kelly Fitz, 23 Sept 04 00032 * loris@cerlsoundgroup.org 00033 * 00034 * http://www.cerlsoundgroup.org/Loris/ 00035 * 00036 */ 00037 #include "Partial.h" 00038 00039 // begin namespace 00040 namespace Loris { 00041 00042 // FUNCTION PROTOYPES 00043 00044 // fixPhaseBackward 00045 // 00068 // 00069 void fixPhaseBackward( Partial::iterator stopHere, Partial::iterator pos ); 00070 00071 // fixPhaseForward 00072 // 00093 // 00094 void fixPhaseForward( Partial::iterator pos, Partial::iterator stopHere ); 00095 00096 // --------------------------------------------------------------------------- 00097 // fixPhaseBetween 00098 // 00124 // 00125 void fixPhaseBetween( Partial::iterator b, Partial::iterator e ); 00126 00127 // fixFrequency 00128 // 00141 // 00142 void fixFrequency( Partial & partial, double maxFixPct = 0.2 ); 00143 00144 // fixFrequency 00145 // 00158 // 00159 template < class Iter > 00160 void fixFrequency( Iter b, Iter e, double maxFixPct = 0.2 ) 00161 { 00162 while ( b != e ) 00163 { 00164 fixFrequency( *b, maxFixPct ); 00165 ++b; 00166 } 00167 } 00168 00169 // --------------------- useful phase maintenance utilities --------------------- 00170 00171 // matchPhaseFwd 00172 // 00206 // 00207 void matchPhaseFwd( Breakpoint & bp0, Breakpoint & bp1, 00208 double dt, double damping, double maxFixPct = 0.2 ); 00209 00210 // phaseTravel 00211 // 00221 // 00222 double phaseTravel( const Breakpoint & bp0, const Breakpoint & bp1, double dt ); 00223 00224 // wrapPi 00225 // 00230 // 00231 double wrapPi( double x ); 00232 00233 00234 } // end of namespace Loris 00235 00236 #endif // ndef PHASEFIX_H 00237