00001 #ifndef INCLUDE_OSCILLATOR_H 00002 #define INCLUDE_OSCILLATOR_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-2009 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 * Oscillator.h 00026 * 00027 * Definition of class Loris::Oscillator, a Bandwidth-Enhanced Oscillator. 00028 * 00029 * Kelly Fitz, 31 Aug 1999 00030 * loris@cerlsoundgroup.org 00031 * 00032 * http://www.cerlsoundgroup.org/Loris/ 00033 * 00034 */ 00035 00036 #include "NoiseGenerator.h" 00037 00038 // begin namespace 00039 namespace Loris { 00040 00041 class Breakpoint; 00042 00043 // --------------------------------------------------------------------------- 00044 // class Oscillator 00045 // 00055 // 00056 class Oscillator 00057 { 00058 // --- implementation --- 00059 00060 NoiseGenerator bwModulator; 00061 00062 // instantaneous oscillator state: 00063 double i_frequency; 00064 double i_amplitude; 00065 double i_bandwidth; 00066 00067 // accumulating phase state: 00068 double determ_phase; 00069 00070 // --- interface --- 00071 public: 00072 // --- construction --- 00073 00075 Oscillator( void ); 00076 00077 // Copy, assignment, and destruction are free. 00078 // 00079 // Copied and assigned Oscillators have the duplicate state 00080 // variables and the filters have the same coefficients, 00081 // but the state of the filter delay lines is not copied. 00082 00083 // --- oscillation --- 00084 00089 void resetEnvelopes( const Breakpoint & bp, double srate ); 00090 00095 void resetPhase( double ph ); 00096 00104 void oscillate( double * begin, double * end, 00105 const Breakpoint & bp, double srate ); 00106 00107 // --- accessors --- 00108 00110 double amplitude( void ) const { return i_amplitude; } 00111 00113 double bandwidth( void ) const { return i_bandwidth; } 00114 00116 double phase( void ) const { return determ_phase; } 00117 00119 double radianFreq( void ) const { return i_frequency; } 00120 00121 }; // end of class Oscillator 00122 00123 } // end of namespace Loris 00124 00125 #endif /* ndef INCLUDE_OSCILLATOR_H */
1.5.7