hydrogen 1.2.3
Synth.h
Go to the documentation of this file.
1/*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 * Copyright(c) 2008-2024 The hydrogen development team [hydrogen-devel@lists.sourceforge.net]
5 *
6 * http://www.hydrogen-music.org
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY, without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see https://www.gnu.org/licenses
20 *
21 */
22
23
24#ifndef SYNTH_H
25#define SYNTH_H
26
27#include <cstdint>
28#include <vector>
29
30#include <core/Object.h>
31
32
33namespace H2Core
34{
35class Note;
36class AudioOutput;
37
41
42class Synth : public H2Core::Object<Synth>
43{
45public:
46 float *m_pOut_L;
47 float *m_pOut_R;
48
55 Synth();
56 ~Synth();
57
59 void noteOn( Note* pNote );
60
62 void noteOff( Note* pNote );
63
64 void process( uint32_t nFrames );
65 void setAudioOutput( AudioOutput* pAudioOutput );
66
68 return m_playingNotesQueue.size();
69 }
70
71
72private:
73 std::vector<Note*> m_playingNotesQueue;
74
75 float m_fTheta;
77
78
79};
80
81} // namespace H2Core
82
83#endif
84
85
#define H2_OBJECT(name)
Definition Object.h:224
Base abstract class for audio output classes.
Definition AudioOutput.h:39
A note plays an associated instrument with a velocity left and right pan.
Definition Note.h:102
A simple synthetizer...
Definition Synth.h:43
void process(uint32_t nFrames)
Definition Synth.cpp:94
float * m_pOut_R
Definition Synth.h:47
void noteOff(Note *pNote)
Stop playing a note.
Definition Synth.cpp:70
Synth()
Constructor of the Synth.
Definition Synth.cpp:34
float * m_pOut_L
Definition Synth.h:46
void noteOn(Note *pNote)
Start playing a note.
Definition Synth.cpp:59
std::vector< Note * > m_playingNotesQueue
Definition Synth.h:73
void setAudioOutput(AudioOutput *pAudioOutput)
Definition Synth.cpp:120
float m_fTheta
Definition Synth.h:75
AudioOutput * m_pAudioOutput
Definition Synth.h:76
int getPlayingNotesNumber()
Definition Synth.h:67