@@ -222,31 +222,6 @@ template <class T> class SineWaveGenerator : public SoundGenerator<T> {
222
222
}
223
223
};
224
224
225
- /* *
226
- * @brief Generates a square wave sound.
227
- * @ingroup generator
228
- * @author Phil Schatzmann
229
- * @copyright GPLv3
230
- *
231
- */
232
- template <class T > class SquareWaveGenerator : public SineWaveGenerator <T> {
233
- public:
234
- SquareWaveGenerator (float amplitude = 32767 .0f , float phase = 0 .0f )
235
- : SineWaveGenerator<T>(amplitude, phase) {
236
- LOGD (" SquareWaveGenerator" );
237
- }
238
-
239
- virtual T readSample () {
240
- return value (SineWaveGenerator<T>::readSample (),
241
- SineWaveGenerator<T>::m_amplitude);
242
- }
243
-
244
- protected:
245
- // returns amplitude for positive vales and -amplitude for negative values
246
- T value (T value, T amplitude) {
247
- return (value >= 0 ) ? amplitude : -amplitude;
248
- }
249
- };
250
225
251
226
/* *
252
227
* @brief Sine wave which is based on a fast approximation function.
@@ -283,11 +258,37 @@ template <class T> class FastSineGenerator : public SineWaveGenerator<T> {
283
258
}
284
259
};
285
260
261
+ /* *
262
+ * @brief Generates a square wave sound.
263
+ * @ingroup generator
264
+ * @author Phil Schatzmann
265
+ * @copyright GPLv3
266
+ *
267
+ */
268
+ template <class T > class SquareWaveGenerator : public FastSineGenerator <T> {
269
+ public:
270
+ SquareWaveGenerator (float amplitude = 32767 .0f , float phase = 0 .0f )
271
+ : FastSineGenerator<T>(amplitude, phase) {
272
+ LOGD (" SquareWaveGenerator" );
273
+ }
274
+
275
+ virtual T readSample () {
276
+ return value (FastSineGenerator<T>::readSample (),
277
+ FastSineGenerator<T>::m_amplitude);
278
+ }
279
+
280
+ protected:
281
+ // returns amplitude for positive vales and -amplitude for negative values
282
+ T value (T value, T amplitude) {
283
+ return (value >= 0 ) ? amplitude : -amplitude;
284
+ }
285
+ };
286
+
286
287
287
288
/* *
288
- * @brief Sine wave which is based on a fast approximation function.
289
+ * @brief SawToothGenerator
289
290
* @ingroup generator
290
- * @author Vivian Leigh Stewart
291
+ * @author Phil Schatzmann
291
292
* @copyright GPLv3
292
293
* @tparam T
293
294
*/
0 commit comments