changeset 1048:c7e9afcbf070 cxx11

More type fixes. We now build with -Wconversion, on this platform (64-bit Linux) at least.
author Chris Cannam
date Tue, 10 Mar 2015 17:23:45 +0000
parents 26cf6d5251ec
children 5ad98be7f635
files data/fileio/MIDIFileWriter.cpp data/fileio/MIDIFileWriter.h transform/ModelTransformerFactory.cpp transform/ModelTransformerFactory.h
diffstat 4 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/MIDIFileWriter.cpp	Tue Mar 10 17:02:52 2015 +0000
+++ b/data/fileio/MIDIFileWriter.cpp	Tue Mar 10 17:23:45 2015 +0000
@@ -37,7 +37,7 @@
 using namespace MIDIConstants;
 
 MIDIFileWriter::MIDIFileWriter(QString path, const NoteExportable *exportable,
-                               int sampleRate, float tempo) :
+                               sv_samplerate_t sampleRate, float tempo) :
     m_path(path),
     m_exportable(exportable),
     m_sampleRate(sampleRate),
@@ -358,12 +358,12 @@
 
         // Convert frame to MIDI time
 
-        double seconds = double(frame) / double(m_sampleRate);
+        double seconds = double(frame) / m_sampleRate;
         double quarters = (seconds * m_tempo) / 60.0;
         unsigned long midiTime = int(quarters * m_timingDivision + 0.5);
 
         // Get the sounding time for the matching NOTE_OFF
-        seconds = double(frame + duration) / double(m_sampleRate);
+        seconds = double(frame + duration) / m_sampleRate;
         quarters = (seconds * m_tempo) / 60.0;
         unsigned long endTime = int(quarters * m_timingDivision + 0.5);
 
--- a/data/fileio/MIDIFileWriter.h	Tue Mar 10 17:02:52 2015 +0000
+++ b/data/fileio/MIDIFileWriter.h	Tue Mar 10 17:23:45 2015 +0000
@@ -24,6 +24,7 @@
 #define _MIDI_FILE_WRITER_H_
 
 #include "base/RealTime.h"
+#include "base/BaseTypes.h"
 
 #include <QString>
 
@@ -45,7 +46,7 @@
 public:
     MIDIFileWriter(QString path, 
                    const NoteExportable *exportable, 
-                   int sampleRate, // used to convert exportable sample timings
+                   sv_samplerate_t sampleRate, // used to convert exportable sample timings
                    float tempo = 120.f);
     virtual ~MIDIFileWriter();
 
@@ -79,7 +80,7 @@
 
     QString               m_path;
     const NoteExportable *m_exportable;
-    int                   m_sampleRate;
+    sv_samplerate_t       m_sampleRate;
     float                 m_tempo;
     int                   m_timingDivision;   // pulses per quarter note
     MIDIFileFormatType    m_format;
--- a/transform/ModelTransformerFactory.cpp	Tue Mar 10 17:02:52 2015 +0000
+++ b/transform/ModelTransformerFactory.cpp	Tue Mar 10 17:23:45 2015 +0000
@@ -55,8 +55,8 @@
                                                       const std::vector<Model *> &candidateInputModels,
                                                       Model *defaultInputModel,
                                                       AudioPlaySource *source,
-                                                      int startFrame,
-                                                      int duration,
+                                                      sv_frame_t startFrame,
+                                                      sv_frame_t duration,
                                                       UserConfigurator *configurator)
 {
     ModelTransformer::Input input(0);
--- a/transform/ModelTransformerFactory.h	Tue Mar 10 17:02:52 2015 +0000
+++ b/transform/ModelTransformerFactory.h	Tue Mar 10 17:23:45 2015 +0000
@@ -47,8 +47,8 @@
                                Vamp::PluginBase *plugin,
                                Model *&inputModel,
                                AudioPlaySource *source,
-                               int startFrame,
-                               int duration,
+                               sv_frame_t startFrame,
+                               sv_frame_t duration,
                                const QMap<QString, Model *> &modelMap,
                                QStringList candidateModelNames,
                                QString defaultModelName) = 0;
@@ -67,8 +67,8 @@
                                  const std::vector<Model *> &candidateInputModels,
                                  Model *defaultInputModel,
                                  AudioPlaySource *source = 0,
-                                 int startFrame = 0,
-                                 int duration = 0,
+                                 sv_frame_t startFrame = 0,
+                                 sv_frame_t duration = 0,
                                  UserConfigurator *configurator = 0);
 
     class AdditionalModelHandler {