Nsound  0.9.4
Hat.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // $Id: Hat.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) 2009-Present Nick Hilton
11 //
12 // Simulates a Hat Hit. Based on a Csound Hat by Steven Cook.
13 //
14 // source: http://www.csounds.com/cook/
15 //
16 // Sound Generators: 808HiHat.orc 808HiHat.sco
17 //
18 //-----------------------------------------------------------------------------
19 
20 //-----------------------------------------------------------------------------
21 //
22 // This program is free software; you can redistribute it and/or modify
23 // it under the terms of the GNU General Public License as published by
24 // the Free Software Foundation; either version 2 of the License, or
25 // (at your option) any later version.
26 //
27 // This program is distributed in the hope that it will be useful,
28 // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 // GNU Library General Public License for more details.
31 //
32 // You should have received a copy of the GNU General Public License
33 // along with this program; if not, write to the Free Software
34 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 //
36 //-----------------------------------------------------------------------------
37 
38 #ifndef _NSOUND_HAT_H_
39 #define _NSOUND_HAT_H_
40 
41 #include <Nsound/Instrument.h>
42 
43 namespace Nsound
44 {
45 
46 // Forward Declarations
47 class AudioStream;
48 class Buffer;
49 class FilterHighPassIIR;
50 class Square;
51 
52 //-----------------------------------------------------------------------------
54 //
60 //
61 class Hat : public Instrument
62 {
63  public:
64 
66  Hat(const float64 & sample_rate);
67 
69  Hat(const Hat & copy);
70 
72  ~Hat();
73 
75  Hat &
76  operator=(const Hat & rhs);
77 
80  play();
81 
85  const float64 & duration,
86  const float64 & tune)
87  { return play(duration, tune, true); };
88 
91  play(
92  const float64 & duration,
93  const float64 & tune,
94  boolean is_closed);
95 
97  std::string getInfo()
98  {
99  return
100  "Nsound::Hat by Nick Hilton on 2009-11-13\n"
101  "Simulates a Hat Hit. Based on a Csound Hat by Steven Cook.\n"
102  "source: http://www.csounds.com/cook/\n";
103  };
104 
105  protected:
106 
107  Square * square_;
109 
110 };
111 
112 };
113 
114 // :mode=c++: jEdit modeline
115 #endif
AudioStream play(const float64 &duration, const float64 &tune)
Static play method with option of Hat open or closed.
Definition: Hat.h:84
AudioStream play()
Plays a demo for this instrument.
Definition: Hat.cc:93
Hat(const float64 &sample_rate)
Creates a Hat.
Definition: Hat.cc:46
FilterHighPassIIR * hpf_
Definition: Hat.h:108
Square generator.
Definition: Square.h:50
double float64
Definition: Nsound.h:146
Hat & operator=(const Hat &rhs)
Assignment.
Definition: Hat.cc:79
~Hat()
Destructor.
Definition: Hat.cc:70
A class for filtering audio in the frequecy domain.
std::string getInfo()
Nsound::Hat information.
Definition: Hat.h:97
Square * square_
Definition: Hat.h:103
The Nsound Instrument baseclass. All Nsound instruments extend this class.
Definition: Instrument.h:50
Class Hat.
Definition: Hat.h:61