File indexing completed on 2024-04-28 05:43:15
0001 /*************************************************************************** 0002 * Copyright (C) 2003-2004 by David Saxton * 0003 * david@bluehaze.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 ***************************************************************************/ 0010 0011 #ifndef ELEMENTSIGNAL_H 0012 #define ELEMENTSIGNAL_H 0013 0014 /** 0015 @short Provides different signals 0016 @author David Saxton 0017 */ 0018 class ElementSignal 0019 { 0020 public: 0021 enum Type { st_sinusoidal, st_square, st_sawtooth, st_triangular }; 0022 ElementSignal(); 0023 ~ElementSignal(); 0024 0025 void setStep(Type type, double frequency); 0026 /** 0027 * Advances the timer, returns amplitude (between -1 and 1) 0028 */ 0029 double advance(double delta); 0030 0031 protected: 0032 Type m_type; 0033 double m_time; 0034 double m_frequency; 0035 double m_omega; // Used for sinusoidal signal 0036 }; 0037 0038 #endif