Mercurial > hg > svapp
comparison audio/ContinuousSynth.h @ 468:56acd9368532 bqaudioio
Initial work toward switching to bqaudioio library (so as to get I/O, not just O)
author | Chris Cannam |
---|---|
date | Tue, 04 Aug 2015 13:27:42 +0100 |
parents | audioio/ContinuousSynth.h@72c662fe7ea3 |
children |
comparison
equal
deleted
inserted
replaced
466:45054b36ddbf | 468:56acd9368532 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #ifndef CONTINUOUS_SYNTH_H | |
16 #define CONTINUOUS_SYNTH_H | |
17 | |
18 #include "base/BaseTypes.h" | |
19 | |
20 /** | |
21 * Mix into a target buffer a signal synthesised so as to sound at a | |
22 * specific frequency. The frequency may change with each processing | |
23 * block, or may be switched on or off. | |
24 */ | |
25 | |
26 class ContinuousSynth | |
27 { | |
28 public: | |
29 ContinuousSynth(int channels, sv_samplerate_t sampleRate, sv_frame_t blockSize, int waveType); | |
30 ~ContinuousSynth(); | |
31 | |
32 void setChannelCount(int channels); | |
33 | |
34 void reset(); | |
35 | |
36 /** | |
37 * Mix in a signal to be heard at the given fundamental | |
38 * frequency. Any oscillator state will be maintained between | |
39 * process calls so as to provide a continuous sound. The f0 value | |
40 * may vary between calls. | |
41 * | |
42 * Supply f0 equal to 0 if you want to maintain the f0 from the | |
43 * previous block (without having to remember what it was). | |
44 * | |
45 * Supply f0 less than 0 for silence. You should continue to call | |
46 * this even when the signal is silent if you want to ensure the | |
47 * sound switches on and off cleanly. | |
48 */ | |
49 void mix(float **toBuffers, | |
50 float gain, | |
51 float pan, | |
52 float f0); | |
53 | |
54 private: | |
55 int m_channels; | |
56 sv_samplerate_t m_sampleRate; | |
57 sv_frame_t m_blockSize; | |
58 | |
59 double m_prevF0; | |
60 double m_phase; | |
61 | |
62 int m_wavetype; | |
63 }; | |
64 | |
65 #endif |