OpenShot Library | libopenshot-audio
0.2.0
juce_ToneGeneratorAudioSource.h
1
2
/** @weakgroup juce_audio_basics-sources
3
* @{
4
*/
5
/*
6
==============================================================================
7
8
This file is part of the JUCE library.
9
Copyright (c) 2017 - ROLI Ltd.
10
11
JUCE is an open source library subject to commercial or open-source
12
licensing.
13
14
The code included in this file is provided under the terms of the ISC license
15
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
16
To use, copy, modify, and/or distribute this software for any purpose with or
17
without fee is hereby granted provided that the above copyright notice and
18
this permission notice appear in all copies.
19
20
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22
DISCLAIMED.
23
24
==============================================================================
25
*/
26
27
namespace
juce
28
{
29
30
//==============================================================================
31
/**
32
A simple AudioSource that generates a sine wave.
33
34
35
@tags{Audio}
36
*/
37
class
JUCE_API
ToneGeneratorAudioSource
:
public
AudioSource
38
{
39
public
:
40
//==============================================================================
41
/** Creates a ToneGeneratorAudioSource. */
42
ToneGeneratorAudioSource
();
43
44
/** Destructor. */
45
~ToneGeneratorAudioSource
()
override
;
46
47
//==============================================================================
48
/** Sets the signal's amplitude. */
49
void
setAmplitude (
float
newAmplitude
);
50
51
/** Sets the signal's frequency. */
52
void
setFrequency (
double
newFrequencyHz
);
53
54
55
//==============================================================================
56
/** Implementation of the AudioSource method. */
57
void
prepareToPlay (
int
samplesPerBlockExpected
,
double
sampleRate)
override
;
58
59
/** Implementation of the AudioSource method. */
60
void
releaseResources()
override
;
61
62
/** Implementation of the AudioSource method. */
63
void
getNextAudioBlock (
const
AudioSourceChannelInfo
&)
override
;
64
65
66
private
:
67
//==============================================================================
68
double
frequency, sampleRate;
69
double
currentPhase, phasePerSample;
70
float
amplitude;
71
72
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (
ToneGeneratorAudioSource
)
73
};
74
75
}
// namespace juce
76
77
/** @}*/
juce::Array
Holds a resizable array of primitive or copy-by-value objects.
Definition
juce_Array.h:60
juce::AudioSource
Base class for objects that can produce a continuous stream of audio.
Definition
juce_AudioSource.h:114
juce::ToneGeneratorAudioSource
A simple AudioSource that generates a sine wave.
Definition
juce_ToneGeneratorAudioSource.h:38
JUCE_API
#define JUCE_API
This macro is added to all JUCE public class declarations.
Definition
juce_StandardHeader.h:143
juce::AudioSourceChannelInfo
Used by AudioSource::getNextAudioBlock().
Definition
juce_AudioSource.h:37
juce_audio_basics
sources
juce_ToneGeneratorAudioSource.h
Generated on Fri Sep 20 2024 04:11:05 for OpenShot Library | libopenshot-audio by
1.9.8