Add TAL-Reverb-II plugin to test
[juce-lv2.git] / juce / source / src / audio / audio_sources / juce_ToneGeneratorAudioSource.h
blobf70d81d0f5104768f76cfcff3e8d3903733de137
1 /*
2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-11 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
27 #define __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__
29 #include "juce_AudioSource.h"
32 //==============================================================================
33 /**
34 A simple AudioSource that generates a sine wave.
37 class JUCE_API ToneGeneratorAudioSource : public AudioSource
39 public:
40 //==============================================================================
41 /** Creates a ToneGeneratorAudioSource. */
42 ToneGeneratorAudioSource();
44 /** Destructor. */
45 ~ToneGeneratorAudioSource();
47 //==============================================================================
48 /** Sets the signal's amplitude. */
49 void setAmplitude (float newAmplitude);
51 /** Sets the signal's frequency. */
52 void setFrequency (double newFrequencyHz);
55 //==============================================================================
56 /** Implementation of the AudioSource method. */
57 void prepareToPlay (int samplesPerBlockExpected, double sampleRate);
59 /** Implementation of the AudioSource method. */
60 void releaseResources();
62 /** Implementation of the AudioSource method. */
63 void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill);
66 private:
67 //==============================================================================
68 double frequency, sampleRate;
69 double currentPhase, phasePerSample;
70 float amplitude;
72 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ToneGeneratorAudioSource);
76 #endif // __JUCE_TONEGENERATORAUDIOSOURCE_JUCEHEADER__