Mercurial > hg > svapp
comparison audioio/AudioGenerator.cpp @ 349:8d7f39df44ed tony_integration
Quieter clip playback for note layers
author | Chris Cannam |
---|---|
date | Thu, 08 May 2014 15:04:42 +0100 |
parents | f8e1ca25dd80 |
children | 0876ea394902 |
comparison
equal
deleted
inserted
replaced
348:f8e1ca25dd80 | 349:8d7f39df44ed |
---|---|
171 qobject_cast<const FlexiNoteModel *>(model)); | 171 qobject_cast<const FlexiNoteModel *>(model)); |
172 return clip; | 172 return clip; |
173 } | 173 } |
174 | 174 |
175 bool | 175 bool |
176 AudioGenerator::wantsQuieterClips(const Model *model) | |
177 { | |
178 // basically, anything that usually has sustain (like notes) or | |
179 // often has multiple sounds at once (like notes) wants to use a | |
180 // quieter level than simple click tracks | |
181 bool does = | |
182 (qobject_cast<const NoteModel *>(model) || | |
183 qobject_cast<const FlexiNoteModel *>(model)); | |
184 return does; | |
185 } | |
186 | |
187 bool | |
176 AudioGenerator::usesContinuousSynth(const Model *model) | 188 AudioGenerator::usesContinuousSynth(const Model *model) |
177 { | 189 { |
178 bool cont = | 190 bool cont = |
179 (qobject_cast<const SparseTimeValueModel *>(model)); | 191 (qobject_cast<const SparseTimeValueModel *>(model)); |
180 return cont; | 192 return cont; |
207 | 219 |
208 float clipF0 = Pitch::getFrequencyForPitch(60, 0, 440.0f); // required | 220 float clipF0 = Pitch::getFrequencyForPitch(60, 0, 440.0f); // required |
209 | 221 |
210 QString clipPath = QString("%1/%2.wav").arg(m_sampleDir).arg(clipId); | 222 QString clipPath = QString("%1/%2.wav").arg(m_sampleDir).arg(clipId); |
211 | 223 |
212 if (!mixer->loadClipData(clipPath, clipF0)) { | 224 float level = wantsQuieterClips(model) ? 0.5 : 1.0; |
225 if (!mixer->loadClipData(clipPath, clipF0, level)) { | |
213 delete mixer; | 226 delete mixer; |
214 return 0; | 227 return 0; |
215 } | 228 } |
216 | 229 |
217 std::cerr << "AudioGenerator::makeClipMixerFor(" << model << "): loaded clip " << clipId << std::endl; | 230 std::cerr << "AudioGenerator::makeClipMixerFor(" << model << "): loaded clip " << clipId << std::endl; |