Loris 1.5

NoiseGenerator.h

00001 #ifndef NOISEGENERATOR_H
00002 #define NOISEGENERATOR_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  * NoiseGenerator.h
00026  *
00027  * Definition of a class representing a gaussian noise generator, filtered and 
00028  * used as a modulator in bandwidth-enhanced synthesis.
00029  *
00030  * Kelly Fitz, 5 June 2003
00031  * revised 11 October 2009
00032  * loris@cerlsoundgroup.org
00033  *
00034  * http://www.cerlsoundgroup.org/Loris/
00035  *
00036  */
00037 
00038 //  begin namespace
00039 namespace Loris {
00040 
00041 // ---------------------------------------------------------------------------
00042 //  class NoiseGenerator
00043 //
00044 class NoiseGenerator
00045 {
00046 //  --- interface ---
00047 
00048 public:
00049 
00054     explicit NoiseGenerator( double initSeed = 1.0 );
00055 
00056 
00057     //  copy and assign are free
00058     
00059     
00063     void seed( double newSeed );
00064     
00065     //  sample
00066     //
00073     double sample( void );
00074     
00078     double operator() ( void )  { return sample(); }
00079     
00080 
00081 //  --- implementation ---
00082 private:
00083 
00084     //  random number generation helpers
00085     inline double uniform( void );
00086     inline double gaussian_normal( void );
00087 
00088 
00089     // random number generator state variables
00090     double m_useed;
00091     double m_gset;
00092     bool m_iset;
00093     
00094 };
00095 
00096 
00097 }   //  end of namespace Loris
00098 
00099 #endif  /* ndef NOISEGENERATOR_H */
 All Classes Functions Variables Typedefs Enumerator Friends