comparison audioio/ClipMixer.h @ 305:9716c75499ef tonioni

Toward using a sample mixer (with arbitrary frequency target) instead of dssi player plugin
author Chris Cannam
date Tue, 07 Jan 2014 10:58:10 +0000
parents
children 289d65722123
comparison
equal deleted inserted replaced
303:b6358ba5ebc6 305:9716c75499ef
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 This file copyright 2006 Chris Cannam, 2006-2014 QMUL.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #ifndef _CLIP_MIXER_H_
17 #define _CLIP_MIXER_H_
18
19 #include <QString>
20 #include <vector>
21
22 /**
23 * Mix in synthetic notes produced by resampling a prerecorded
24 * clip. That is, this is a sampler.
25 */
26
27 class ClipMixer
28 {
29 public:
30 ClipMixer(int channels, int sampleRate, int blockSize);
31 ~ClipMixer();
32
33 bool loadClipData(QString clipFilePath, float clipF0);
34
35 //!!! what can we find in common with the NoteData type and
36 //!!! AudioGenerator's NoteOff?
37
38 struct NoteStart {
39 int id; // unique to match note end
40 int frameOffset; // in current processing block
41 float frequency; // Hz
42 float level; // volume in range (0,1]
43 float pan; // range [-1,1]
44 };
45
46 struct NoteEnd {
47 int id; // matching note start
48 int frameOffset; // in current processing block
49 };
50
51 void mix(float **toBuffers,
52 std::vector<NoteStart> newNotes,
53 std::vector<NoteEnd> endingNotes);
54
55 private:
56 int m_channels;
57 int m_sampleRate;
58 int m_blockSize;
59
60 QString m_clipPath;
61
62 float *m_clipData;
63 int m_clipLength;
64 float m_clipF0;
65 float m_clipRate;
66 };
67
68
69 #endif