annotate audio/ContinuousSynth.h @ 606:ffda5e5444aa

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