Mercurial > hg > svapp
comparison audioio/ClipMixer.cpp @ 351:36efd75d7b7b tonioni
Merge from default branch
author | Chris Cannam |
---|---|
date | Wed, 14 May 2014 09:58:27 +0100 |
parents | 8d7f39df44ed |
children | 0876ea394902 |
comparison
equal
deleted
inserted
replaced
344:63dec7dc11cc | 351:36efd75d7b7b |
---|---|
38 { | 38 { |
39 m_channels = channels; | 39 m_channels = channels; |
40 } | 40 } |
41 | 41 |
42 bool | 42 bool |
43 ClipMixer::loadClipData(QString path, float f0) | 43 ClipMixer::loadClipData(QString path, float f0, float level) |
44 { | 44 { |
45 if (m_clipData) { | 45 if (m_clipData) { |
46 cerr << "ClipMixer::loadClipData: Already have clip loaded" << endl; | 46 cerr << "ClipMixer::loadClipData: Already have clip loaded" << endl; |
47 return false; | 47 return false; |
48 } | 48 } |
79 | 79 |
80 for (i = 0; i < info.frames; ++i) { | 80 for (i = 0; i < info.frames; ++i) { |
81 int j; | 81 int j; |
82 m_clipData[i] = 0.0f; | 82 m_clipData[i] = 0.0f; |
83 for (j = 0; j < info.channels; ++j) { | 83 for (j = 0; j < info.channels; ++j) { |
84 m_clipData[i] += tmpFrames[i * info.channels + j]; | 84 m_clipData[i] += tmpFrames[i * info.channels + j] * level; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 free(tmpFrames); | 88 free(tmpFrames); |
89 | 89 |
133 float *levels = new float[m_channels]; | 133 float *levels = new float[m_channels]; |
134 | 134 |
135 foreach (NoteStart note, m_playing) { | 135 foreach (NoteStart note, m_playing) { |
136 | 136 |
137 for (int c = 0; c < m_channels; ++c) { | 137 for (int c = 0; c < m_channels; ++c) { |
138 levels[c] = gain; | 138 levels[c] = note.level * gain; |
139 } | 139 } |
140 if (note.pan != 0.0 && m_channels == 2) { | 140 if (note.pan != 0.0 && m_channels == 2) { |
141 levels[0] *= 1.0 - note.pan; | 141 levels[0] *= 1.0 - note.pan; |
142 levels[1] *= note.pan + 1.0; | 142 levels[1] *= note.pan + 1.0; |
143 } | 143 } |