comparison audioio/ClipMixer.h @ 308:289d65722123 tonioni

More work on mixing and file i/o for sample stuff
author Chris Cannam
date Tue, 07 Jan 2014 15:50:04 +0000
parents 9716c75499ef
children 8c59cc68eabd
comparison
equal deleted inserted replaced
307:6eb15c3aee0a 308:289d65722123
28 { 28 {
29 public: 29 public:
30 ClipMixer(int channels, int sampleRate, int blockSize); 30 ClipMixer(int channels, int sampleRate, int blockSize);
31 ~ClipMixer(); 31 ~ClipMixer();
32 32
33 void setChannelCount(int channels);
34
33 bool loadClipData(QString clipFilePath, float clipF0); 35 bool loadClipData(QString clipFilePath, float clipF0);
36
37 void reset(); // discarding any playing notes
34 38
35 //!!! what can we find in common with the NoteData type and 39 //!!! what can we find in common with the NoteData type and
36 //!!! AudioGenerator's NoteOff? 40 //!!! AudioGenerator's NoteOff?
37 41
38 struct NoteStart { 42 struct NoteStart {
39 int id; // unique to match note end
40 int frameOffset; // in current processing block 43 int frameOffset; // in current processing block
41 float frequency; // Hz 44 float frequency; // Hz
42 float level; // volume in range (0,1] 45 float level; // volume in range (0,1]
43 float pan; // range [-1,1] 46 float pan; // range [-1,1]
44 }; 47 };
45 48
46 struct NoteEnd { 49 struct NoteEnd {
47 int id; // matching note start 50 float frequency; // matching note start
48 int frameOffset; // in current processing block 51 int frameOffset; // in current processing block
49 }; 52 };
50 53
51 void mix(float **toBuffers, 54 void mix(float **toBuffers,
55 float gain,
52 std::vector<NoteStart> newNotes, 56 std::vector<NoteStart> newNotes,
53 std::vector<NoteEnd> endingNotes); 57 std::vector<NoteEnd> endingNotes);
54 58
55 private: 59 private:
56 int m_channels; 60 int m_channels;