comparison audioio/ClipMixer.h @ 312:faee60602049 tonioni

Comments
author Chris Cannam
date Wed, 08 Jan 2014 11:00:12 +0000
parents 8c59cc68eabd
children 7105604e9803
comparison
equal deleted inserted replaced
311:86fb9160d122 312:faee60602049
11 published by the Free Software Foundation; either version 2 of the 11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file 12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information. 13 COPYING included with this distribution for more information.
14 */ 14 */
15 15
16 #ifndef _CLIP_MIXER_H_ 16 #ifndef CLIP_MIXER_H
17 #define _CLIP_MIXER_H_ 17 #define CLIP_MIXER_H
18 18
19 #include <QString> 19 #include <QString>
20 #include <vector> 20 #include <vector>
21 21
22 /** 22 /**
23 * Mix in synthetic notes produced by resampling a prerecorded 23 * Mix in synthetic notes produced by resampling a prerecorded
24 * clip. That is, this is a sampler. 24 * clip. (i.e. this is an implementation of a digital sampler in the
25 * musician's sense.) This can mix any number of notes of arbitrary
26 * frequency, so long as they all use the same sample clip.
25 */ 27 */
26 28
27 class ClipMixer 29 class ClipMixer
28 { 30 {
29 public: 31 public:
30 ClipMixer(int channels, int sampleRate, int blockSize); 32 ClipMixer(int channels, int sampleRate, int blockSize);
31 ~ClipMixer(); 33 ~ClipMixer();
32 34
33 void setChannelCount(int channels); 35 void setChannelCount(int channels);
34 36
37 /**
38 * Load a sample clip from a wav file. This can only happen once:
39 * construct a new ClipMixer if you want a different clip.
40 */
35 bool loadClipData(QString clipFilePath, float clipF0); 41 bool loadClipData(QString clipFilePath, float clipF0);
36 42
37 void reset(); // discarding any playing notes 43 void reset(); // discarding any playing notes
38
39 //!!! what can we find in common with the NoteData type and
40 //!!! AudioGenerator's NoteOff?
41 44
42 struct NoteStart { 45 struct NoteStart {
43 int frameOffset; // within current processing block 46 int frameOffset; // within current processing block
44 float frequency; // Hz 47 float frequency; // Hz
45 float level; // volume in range (0,1] 48 float level; // volume in range (0,1]