Mercurial > hg > svapp
comparison audioio/ClipMixer.h @ 310:8c59cc68eabd tonioni
Initial implementation of clip note mix
author | Chris Cannam |
---|---|
date | Tue, 07 Jan 2014 17:11:14 +0000 |
parents | 289d65722123 |
children | faee60602049 |
comparison
equal
deleted
inserted
replaced
309:71050ffd0141 | 310:8c59cc68eabd |
---|---|
38 | 38 |
39 //!!! what can we find in common with the NoteData type and | 39 //!!! what can we find in common with the NoteData type and |
40 //!!! AudioGenerator's NoteOff? | 40 //!!! AudioGenerator's NoteOff? |
41 | 41 |
42 struct NoteStart { | 42 struct NoteStart { |
43 int frameOffset; // in current processing block | 43 int frameOffset; // within current processing block |
44 float frequency; // Hz | 44 float frequency; // Hz |
45 float level; // volume in range (0,1] | 45 float level; // volume in range (0,1] |
46 float pan; // range [-1,1] | 46 float pan; // range [-1,1] |
47 }; | 47 }; |
48 | 48 |
49 struct NoteEnd { | 49 struct NoteEnd { |
50 int frameOffset; // in current processing block | |
50 float frequency; // matching note start | 51 float frequency; // matching note start |
51 int frameOffset; // in current processing block | |
52 }; | 52 }; |
53 | 53 |
54 void mix(float **toBuffers, | 54 void mix(float **toBuffers, |
55 float gain, | 55 float gain, |
56 std::vector<NoteStart> newNotes, | 56 std::vector<NoteStart> newNotes, |
65 | 65 |
66 float *m_clipData; | 66 float *m_clipData; |
67 int m_clipLength; | 67 int m_clipLength; |
68 float m_clipF0; | 68 float m_clipF0; |
69 float m_clipRate; | 69 float m_clipRate; |
70 | |
71 std::vector<NoteStart> m_playing; | |
72 | |
73 float getResampleRatioFor(float frequency); | |
74 int getResampledClipDuration(float frequency); | |
75 | |
76 void mixNote(float **toBuffers, | |
77 float *levels, | |
78 float frequency, | |
79 int sourceOffset, // within resampled note | |
80 int targetOffset, // within target buffer | |
81 int sampleCount); | |
70 }; | 82 }; |
71 | 83 |
72 | 84 |
73 #endif | 85 #endif |