diff transform/TransformFactory.cpp @ 184:ebd906049fb6

* Change WaveFileModel API from getValues(start,end) to getData(start,count). It's much less error-prone to pass in frame counts instead of start/end locations. Should have done this ages ago. This closes #1794563. * Add option to apply a transform to only the selection region, instead of the whole audio. * (to make the above work properly) Add start frame offset to wave models
author Chris Cannam
date Mon, 01 Oct 2007 13:48:38 +0000
parents 21a76c9ed5c3
children
line wrap: on
line diff
--- a/transform/TransformFactory.cpp	Sat Sep 29 10:58:31 2007 +0000
+++ b/transform/TransformFactory.cpp	Mon Oct 01 13:48:38 2007 +0000
@@ -516,7 +516,9 @@
                                                const std::vector<Model *> &candidateInputModels,
                                                PluginTransform::ExecutionContext &context,
                                                QString &configurationXml,
-                                               AudioCallbackPlaySource *source)
+                                               AudioCallbackPlaySource *source,
+                                               size_t startFrame,
+                                               size_t duration)
 {
     if (candidateInputModels.empty()) return 0;
 
@@ -651,6 +653,10 @@
             dialog->setCandidateInputModels(candidateModelNames);
         }
 
+        if (startFrame != 0 || duration != 0) {
+            dialog->setShowSelectionOnlyOption(true);
+        }
+
         if (targetChannels > 0) {
             dialog->setChannelArrangement(sourceChannels, targetChannels,
                                           defaultChannel);
@@ -678,6 +684,13 @@
 
         configurationXml = PluginXml(plugin).toXmlString();
         context.channel = dialog->getChannel();
+        
+        if (startFrame != 0 || duration != 0) {
+            if (dialog->getSelectionOnly()) {
+                context.startFrame = startFrame;
+                context.duration = duration;
+            }
+        }
 
         dialog->getProcessingParameters(context.stepSize,
                                         context.blockSize,