Nsound  0.9.4
FilterMovingAverage.h
Go to the documentation of this file.
1 //
3 // $Id: FilterMovingAverage.h 825 2014-02-22 03:39:23Z weegreenblobbie $
4 //
5 // Nsound is a C++ library and Python module for audio synthesis featuring
6 // dynamic digital filters. Nsound lets you easily shape waveforms and write
7 // to disk or plot them. Nsound aims to be as powerful as Csound but easy to
8 // use.
9 //
10 // Copyright (c) 2007 Nick Hilton
11 //
12 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13 //
15 
17 //
18 // This program is free software; you can redistribute it and/or modify
19 // it under the terms of the GNU General Public License as published by
20 // the Free Software Foundation; either version 2 of the License, or
21 // (at your option) any later version.
22 //
23 // This program is distributed in the hope that it will be useful,
24 // but WITHOUT ANY WARRANTY; without even the implied warranty of
25 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 // GNU Library General Public License for more details.
27 //
28 // You should have received a copy of the GNU General Public License
29 // along with this program; if not, write to the Free Software
30 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
31 //
33 #ifndef _NSOUND_FILTER_MOVING_AVERAGE_H_
34 #define _NSOUND_FILTER_MOVING_AVERAGE_H_
35 
36 #include <Nsound/Filter.h>
37 
38 namespace Nsound
39 {
40 
41 // Forward class declarations
42 class AudioStream;
43 class Buffer;
44 class FilterDelay;
45 
48 {
50  public:
51 
53  FilterMovingAverage(uint32 n_samples_to_average);
54 
56 
59 
62  filter(const AudioStream & x);
63 
66  filter(const AudioStream & x, const Buffer & frequencies)
67  { return filter(x); };
68 
70  Buffer
71  filter(const Buffer & x);
72 
74  Buffer
75  filter(const Buffer & x, const Buffer & frequencies)
76  { return filter(x); };
77 
79  float64
80  filter(const float64 & x);
81 
83  float64
84  filter(const float64 & x, const float64 & frequency)
85  { return filter(x); };
86 
88  operator=(const FilterMovingAverage & rhs);
89 
91  void
92  reset();
93 
95  protected:
96 
97  bool init_sum_;
98 
101 
102  FilterDelay * delay_; // used as a circular buffer
103 };
104 
105 }; // Nsound
106 
107 // :mode=c++: jEdit modeline
108 
109 #endif
unsigned int uint32
Definition: Nsound.h:153
FilterMovingAverage(uint32 n_samples_to_average)
FilterMovingAverage & operator=(const FilterMovingAverage &rhs)
float64 filter(const float64 &x, const float64 &frequency)
double float64
Definition: Nsound.h:146
Base class for IIR Filters, defines the interface.
Definition: Filter.h:49
Buffer filter(const Buffer &x, const Buffer &frequencies)
AudioStream filter(const AudioStream &x)
A Buffer for storing audio samples.
Definition: Buffer.h:60
A class for filtering audio in the frequecy domain.
Definition: FilterDelay.h:47
AudioStream filter(const AudioStream &x, const Buffer &frequencies)