diff transform/RealTimePluginTransform.cpp @ 64:4d59dc469b0f

* Ensure plugin parameters for a transform are saved in the .sv file and restored in case the plugin has to be run again * Make plugin dialog offer options for mixdown/single-channel use if the file has more than one channels but the plugin only accepts one * Fix incorrect samplerate playback for second file loaded if its samplerate differed from first * Add Zoom to Fit and Select Visible Range menu options, split out Import Audio into main model and secondary model options * Add stubs for cut, copy and paste operations (not implemented yet)
author Chris Cannam
date Thu, 30 Mar 2006 13:18:11 +0000
parents ba405e5e69d3
children 7afcfe666910
line wrap: on
line diff
--- a/transform/RealTimePluginTransform.cpp	Wed Mar 29 12:35:17 2006 +0000
+++ b/transform/RealTimePluginTransform.cpp	Thu Mar 30 13:18:11 2006 +0000
@@ -27,11 +27,13 @@
 
 RealTimePluginTransform::RealTimePluginTransform(Model *inputModel,
                                                  QString pluginId,
+                                                 int channel,
                                                  QString configurationXml,
                                                  QString units,
                                                  int output) :
     Transform(inputModel),
     m_plugin(0),
+    m_channel(channel),
     m_outputNo(output)
 {
     std::cerr << "RealTimePluginTransform::RealTimePluginTransform: plugin " << pluginId.toStdString() << ", output " << output << std::endl;
@@ -105,6 +107,8 @@
 
     size_t sampleRate = input->getSampleRate();
     int channelCount = input->getChannelCount();
+    if (m_channel != -1) channelCount = 1;
+
     size_t blockSize = m_plugin->getBufferSize();
 
     float **buffers = m_plugin->getAudioInputBuffers();
@@ -127,7 +131,7 @@
 
 	if (channelCount == 1) {
 	    got = input->getValues
-		(-1, blockFrame, blockFrame + blockSize, buffers[0]);
+		(m_channel, blockFrame, blockFrame + blockSize, buffers[0]);
 	    while (got < blockSize) {
 		buffers[0][got++] = 0.0;
 	    }