diff data/model/AggregateWaveModel.cpp @ 1038:cc27f35aa75c cxx11

Introducing the signed 64-bit frame index type, and fixing build failures from inclusion of -Wconversion with -Werror. Not finished yet.
author Chris Cannam
date Tue, 03 Mar 2015 15:18:24 +0000
parents d9e0e59a1581
children a1cd5abcb38b
line wrap: on
line diff
--- a/data/model/AggregateWaveModel.cpp	Tue Mar 03 09:33:59 2015 +0000
+++ b/data/model/AggregateWaveModel.cpp	Tue Mar 03 15:18:24 2015 +0000
@@ -65,14 +65,14 @@
     return ready;
 }
 
-int
+sv_frame_t
 AggregateWaveModel::getFrameCount() const
 {
-    int count = 0;
+    sv_frame_t count = 0;
 
     for (ChannelSpecList::const_iterator i = m_components.begin();
          i != m_components.end(); ++i) {
-        int thisCount = i->model->getEndFrame() - i->model->getStartFrame();
+        sv_frame_t thisCount = i->model->getEndFrame() - i->model->getStartFrame();
         if (thisCount > count) count = thisCount;
     }
 
@@ -82,7 +82,7 @@
 int
 AggregateWaveModel::getChannelCount() const
 {
-    return m_components.size();
+    return int(m_components.size());
 }
 
 int
@@ -98,8 +98,8 @@
     return new AggregateWaveModel(m_components);
 }
 
-int
-AggregateWaveModel::getData(int channel, int start, int count,
+sv_frame_t
+AggregateWaveModel::getData(int channel, sv_frame_t start, sv_frame_t count,
                             float *buffer) const
 {
     int ch0 = channel, ch1 = channel;
@@ -113,15 +113,15 @@
     float *readbuf = buffer;
     if (mixing) {
         readbuf = new float[count];
-        for (int i = 0; i < count; ++i) {
+        for (sv_frame_t i = 0; i < count; ++i) {
             buffer[i] = 0.f;
         }
     }
 
-    int longest = 0;
+    sv_frame_t longest = 0;
     
     for (int c = ch0; c <= ch1; ++c) {
-        int here = 
+        sv_frame_t here = 
             m_components[c].model->getData(m_components[c].channel,
                                            start, count,
                                            readbuf);
@@ -129,12 +129,12 @@
             longest = here;
         }
         if (here < count) {
-            for (int i = here; i < count; ++i) {
+            for (sv_frame_t i = here; i < count; ++i) {
                 readbuf[i] = 0.f;
             }
         }
         if (mixing) {
-            for (int i = 0; i < count; ++i) {
+            for (sv_frame_t i = 0; i < count; ++i) {
                 buffer[i] += readbuf[i];
             }
         }
@@ -144,8 +144,8 @@
     return longest;
 }
          
-int
-AggregateWaveModel::getData(int channel, int start, int count,
+sv_frame_t
+AggregateWaveModel::getData(int channel, sv_frame_t start, sv_frame_t count,
                             double *buffer) const
 {
     int ch0 = channel, ch1 = channel;
@@ -159,15 +159,15 @@
     double *readbuf = buffer;
     if (mixing) {
         readbuf = new double[count];
-        for (int i = 0; i < count; ++i) {
+        for (sv_frame_t i = 0; i < count; ++i) {
             buffer[i] = 0.0;
         }
     }
 
-    int longest = 0;
+    sv_frame_t longest = 0;
     
     for (int c = ch0; c <= ch1; ++c) {
-        int here = 
+        sv_frame_t here = 
             m_components[c].model->getData(m_components[c].channel,
                                            start, count,
                                            readbuf);
@@ -175,12 +175,12 @@
             longest = here;
         }
         if (here < count) {
-            for (int i = here; i < count; ++i) {
+            for (sv_frame_t i = here; i < count; ++i) {
                 readbuf[i] = 0.;
             }
         }
         if (mixing) {
-            for (int i = 0; i < count; ++i) {
+            for (sv_frame_t i = 0; i < count; ++i) {
                 buffer[i] += readbuf[i];
             }
         }
@@ -190,15 +190,15 @@
     return longest;
 }
 
-int
+sv_frame_t
 AggregateWaveModel::getData(int fromchannel, int tochannel,
-                            int start, int count,
+                            sv_frame_t start, sv_frame_t count,
                             float **buffer) const
 {
-    int min = count;
+    sv_frame_t min = count;
 
     for (int c = fromchannel; c <= tochannel; ++c) {
-        int here = getData(c, start, count, buffer[c - fromchannel]);
+        sv_frame_t here = getData(c, start, count, buffer[c - fromchannel]);
         if (here < min) min = here;
     }
     
@@ -213,14 +213,14 @@
 }
         
 void
-AggregateWaveModel::getSummaries(int, int, int,
+AggregateWaveModel::getSummaries(int, sv_frame_t, sv_frame_t,
                                  RangeBlock &, int &) const
 {
     //!!! complete
 }
 
 AggregateWaveModel::Range
-AggregateWaveModel::getSummary(int, int, int) const
+AggregateWaveModel::getSummary(int, sv_frame_t, sv_frame_t) const
 {
     //!!! complete
     return Range();
@@ -229,7 +229,7 @@
 int
 AggregateWaveModel::getComponentCount() const
 {
-    return m_components.size();
+    return int(m_components.size());
 }
 
 AggregateWaveModel::ModelChannelSpec
@@ -245,7 +245,7 @@
 }
 
 void
-AggregateWaveModel::componentModelChangedWithin(int start, int end)
+AggregateWaveModel::componentModelChangedWithin(sv_frame_t start, sv_frame_t end)
 {
     emit modelChangedWithin(start, end);
 }