Nsound  0.9.4
FilterBandPassFIR.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: FilterBandPassFIR.h 874 2014-09-08 02:21:29Z 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) 2006 - Present Nick Hilton
11 //
12 // weegreenblobbie_yahoo_com (replace '_' with '@' and '.')
13 //
14 //-----------------------------------------------------------------------------
15 
16 //-----------------------------------------------------------------------------
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 //
32 //-----------------------------------------------------------------------------
33 #ifndef _NSOUND_FILTER_BAND_PASS_FIR_H_
34 #define _NSOUND_FILTER_BAND_PASS_FIR_H_
35 
36 #include <Nsound/Filter.h>
37 
38 #include <set>
39 
40 namespace Nsound
41 {
42 
43 class FilterLowPassFIR;
44 class FilterHighPassFIR;
45 
46 //-----------------------------------------------------------------------------
47 class FilterBandPassFIR : public Filter
48 {
49  public:
50 
52  const float64 & sample_rate,
53  uint32 kernel_size,
54  const float64 & frequency_Hz_low,
55  const float64 & frequency_Hz_high);
56 
57  virtual ~FilterBandPassFIR();
58 
59  float64
60  getFrequencyLow() const;
61 
62  float64
63  getFrequencyHigh() const;
64 
66  filter(const AudioStream & x);
67 
68 //~//~ AudioStream
69 //~ filter(const AudioStream & x, const Buffer & frequencies);
70 
72  filter(
73  const AudioStream & x,
74  const float64 & low_frequencies,
75  const float64 & high_frequencies);
76 
78  filter(
79  const AudioStream & x,
80  const Buffer & low_frequencies,
81  const Buffer & high_frequencies);
82 
83  Buffer
84  filter(const Buffer & x);
85 
86 //~//~ Buffer
87 //~ filter(const Buffer & x, const Buffer & frequencies);
88 
89  Buffer
90  filter(
91  const Buffer & x,
92  const float64 & frequencies_Hz_low,
93  const float64 & frequencies_Hz_high);
94 
95  Buffer
96  filter(
97  const Buffer & x,
98  const Buffer & frequencies_Hz_low,
99  const Buffer & frequencies_Hz_high);
100 
101  virtual
102  float64
103  filter(const float64 & x);
104 
105  virtual
106  float64
107  filter(const float64 & x, const float64 & frequency_Hz);
108 
109  virtual
110  float64
111  filter(
112  const float64 & x,
113  const float64 & frequency_Hz_low,
114  const float64 & frequency_Hz_high);
115 
116 
117  void
118  plot(boolean show_fc = true, boolean show_phase = false);
119 
122  void
123  reset();
124 
125  protected:
126 
127  // Band Pass must cascade two stages in series.
130 
131  private:
132 
134  :
135  Filter(copy.sample_rate_),
136  low_(NULL),
137  high_(NULL)
138  {
139  };
140 
143  {
144  return *this;
145  };
146 
147 }; // class FilterBandPassFIR
148 
149 } // namespace Nsound
150 
151 // :mode=c++: jEdit modeline
152 #endif
unsigned int uint32
Definition: Nsound.h:153
FilterBandPassFIR & operator=(const FilterBandPassFIR &rhs)
float64 getFrequencyHigh() const
AudioStream filter(const AudioStream &x)
double float64
Definition: Nsound.h:146
FilterHighPassFIR * high_
Base class for IIR Filters, defines the interface.
Definition: Filter.h:49
FilterBandPassFIR(const float64 &sample_rate, uint32 kernel_size, const float64 &frequency_Hz_low, const float64 &frequency_Hz_high)
FilterBandPassFIR(const FilterBandPassFIR &copy)
A Buffer for storing audio samples.
Definition: Buffer.h:60
void plot(boolean show_fc=true, boolean show_phase=false)
float64 getFrequencyLow() const
float64 sample_rate_
Definition: Filter.h:113