diff 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
line wrap: on
line diff
--- a/audioio/AudioGenerator.cpp	Wed May 07 16:51:04 2014 +0100
+++ b/audioio/AudioGenerator.cpp	Thu May 08 15:04:42 2014 +0100
@@ -173,6 +173,18 @@
 }
 
 bool
+AudioGenerator::wantsQuieterClips(const Model *model)
+{
+    // basically, anything that usually has sustain (like notes) or
+    // often has multiple sounds at once (like notes) wants to use a
+    // quieter level than simple click tracks
+    bool does = 
+        (qobject_cast<const NoteModel *>(model) ||
+         qobject_cast<const FlexiNoteModel *>(model));
+    return does;
+}
+
+bool
 AudioGenerator::usesContinuousSynth(const Model *model)
 {
     bool cont = 
@@ -209,7 +221,8 @@
 
     QString clipPath = QString("%1/%2.wav").arg(m_sampleDir).arg(clipId);
 
-    if (!mixer->loadClipData(clipPath, clipF0)) {
+    float level = wantsQuieterClips(model) ? 0.5 : 1.0;
+    if (!mixer->loadClipData(clipPath, clipF0, level)) {
         delete mixer;
         return 0;
     }