diff transform/RealTimeEffectModelTransformer.cpp @ 1039:b14064bd1f97 cxx11

This code now compiles. Main problem: sample rate types
author Chris Cannam
date Tue, 03 Mar 2015 17:09:19 +0000
parents d5404b8421b4
children a1cd5abcb38b
line wrap: on
line diff
--- a/transform/RealTimeEffectModelTransformer.cpp	Tue Mar 03 15:18:24 2015 +0000
+++ b/transform/RealTimeEffectModelTransformer.cpp	Tue Mar 03 17:09:19 2015 +0000
@@ -82,7 +82,7 @@
 
     if (m_outputNo == -1) {
 
-        int outputChannels = m_plugin->getAudioOutputCount();
+        int outputChannels = (int)m_plugin->getAudioOutputCount();
         if (outputChannels > input->getChannelCount()) {
             outputChannels = input->getChannelCount();
         }
@@ -141,22 +141,22 @@
     int channelCount = input->getChannelCount();
     if (!wwfm && m_input.getChannel() != -1) channelCount = 1;
 
-    long blockSize = m_plugin->getBufferSize();
+    sv_frame_t blockSize = m_plugin->getBufferSize();
 
     float **inbufs = m_plugin->getAudioInputBuffers();
 
-    long startFrame = m_input.getModel()->getStartFrame();
-    long   endFrame = m_input.getModel()->getEndFrame();
+    sv_frame_t startFrame = m_input.getModel()->getStartFrame();
+    sv_frame_t endFrame = m_input.getModel()->getEndFrame();
 
     Transform transform = m_transforms[0];
     
     RealTime contextStartRT = transform.getStartTime();
     RealTime contextDurationRT = transform.getDuration();
 
-    long contextStart =
+    sv_frame_t contextStart =
         RealTime::realTime2Frame(contextStartRT, sampleRate);
 
-    long contextDuration =
+    sv_frame_t contextDuration =
         RealTime::realTime2Frame(contextDurationRT, sampleRate);
 
     if (contextStart == 0 || contextStart < startFrame) {
@@ -174,20 +174,20 @@
         wwfm->setStartFrame(contextStart);
     }
 
-    long blockFrame = contextStart;
+    sv_frame_t blockFrame = contextStart;
 
-    long prevCompletion = 0;
+    int prevCompletion = 0;
 
-    long latency = m_plugin->getLatency();
+    sv_frame_t latency = m_plugin->getLatency();
 
     while (blockFrame < contextStart + contextDuration + latency &&
            !m_abandoned) {
 
-	long completion =
-	    (((blockFrame - contextStart) / blockSize) * 99) /
-	    (1 + ((contextDuration) / blockSize));
+	int completion = int
+	    ((((blockFrame - contextStart) / blockSize) * 99) /
+             (1 + ((contextDuration) / blockSize)));
 
-	long got = 0;
+	sv_frame_t got = 0;
 
 	if (channelCount == 1) {
             if (inbufs && inbufs[0]) {
@@ -197,7 +197,7 @@
                     inbufs[0][got++] = 0.0;
                 }          
                 for (int ch = 1; ch < (int)m_plugin->getAudioInputCount(); ++ch) {
-                    for (long i = 0; i < blockSize; ++i) {
+                    for (sv_frame_t i = 0; i < blockSize; ++i) {
                         inbufs[ch][i] = inbufs[0][i];
                     }
                 }
@@ -214,7 +214,7 @@
                     ++got;
                 }
                 for (int ch = channelCount; ch < (int)m_plugin->getAudioInputCount(); ++ch) {
-                    for (long i = 0; i < blockSize; ++i) {
+                    for (sv_frame_t i = 0; i < blockSize; ++i) {
                         inbufs[ch][i] = inbufs[ch % channelCount][i];
                     }
                 }
@@ -241,7 +241,7 @@
 
             float value = m_plugin->getControlOutputValue(m_outputNo);
 
-            long pointFrame = blockFrame;
+            sv_frame_t pointFrame = blockFrame;
             if (pointFrame > latency) pointFrame -= latency;
             else pointFrame = 0;
 
@@ -255,13 +255,13 @@
             if (outbufs) {
 
                 if (blockFrame >= latency) {
-                    long writeSize = std::min
+                    sv_frame_t writeSize = std::min
                         (blockSize,
                          contextStart + contextDuration + latency - blockFrame);
                     wwfm->addSamples(outbufs, writeSize);
                 } else if (blockFrame + blockSize >= latency) {
-                    long offset = latency - blockFrame;
-                    long count = blockSize - offset;
+                    sv_frame_t offset = latency - blockFrame;
+                    sv_frame_t count = blockSize - offset;
                     float **tmp = new float *[channelCount];
                     for (int c = 0; c < channelCount; ++c) {
                         tmp[c] = outbufs[c] + offset;