changeset 49:b27e42b68c61

* Added reference tempo parameter for cyclic tempogram
author Carl Bussey <c.bussey@se10.qmul.ac.uk>
date Tue, 30 Sep 2014 14:44:39 +0100
parents 8c151a9ca202
children 45ba1627d802
files Makefile.osx TempogramPlugin.cpp TempogramPlugin.h
diffstat 3 files changed, 32 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.osx	Mon Sep 29 16:22:16 2014 +0100
+++ b/Makefile.osx	Tue Sep 30 14:44:39 2014 +0100
@@ -19,18 +19,18 @@
 
 # Flags to determine processor architecture and system SDK
 
-ARCHFLAGS	?= -mmacosx-version-min=10.6 -arch x86_64 -arch i386
+ARCHFLAGS	?= -mmacosx-version-min=10.6 -arch x86_64
 
 
 # Location of Vamp plugin SDK relative to the project directory
 
-VAMPSDK_DIR	:= ../vamp-plugin-sdk
+VAMPSDK_DIR	:= /usr/local/include
 
 
 # Libraries and linker flags required by plugin: add any -l<library>
 # options here
 
-PLUGIN_LDFLAGS	:= -dynamiclib -exported_symbols_list vamp-plugin.list $(VAMPSDK_DIR)/libvamp-sdk.a
+PLUGIN_LDFLAGS	:= -dynamiclib -exported_symbols_list vamp-plugin.list /usr/local/lib/libvamp-sdk.a
 
 
 # File extension for plugin library on this platform
--- a/TempogramPlugin.cpp	Mon Sep 29 16:22:16 2014 +0100
+++ b/TempogramPlugin.cpp	Tue Sep 30 14:44:39 2014 +0100
@@ -39,7 +39,8 @@
     m_tempogramMaxLag(0), //set in initialise()
     m_cyclicTempogramMinBPM(30), //reset in initialise()
     m_cyclicTempogramNumberOfOctaves(0), //set in initialise()
-    m_cyclicTempogramOctaveDivider(30) //parameter
+    m_cyclicTempogramOctaveDivider(30), //parameter
+    m_cyclicTempogramReferenceBPM(60)
 
     // Also be sure to set your plugin parameters (presumably stored
     // in member variables) to their default values here -- the host
@@ -238,6 +239,18 @@
     d8.isQuantized = true;
     d8.quantizeStep = 1;
     list.push_back(d8);
+    
+    ParameterDescriptor d9;
+    d9.identifier = "refBPM";
+    d9.name = "Cyclic Tempogram Reference BPM";
+    d9.description = "The reference BPM used when calculating the parameter \'s\' of the cyclic tempogram.";
+    d9.unit = "";
+    d9.minValue = 30;
+    d9.maxValue = 240;
+    d9.defaultValue = 60;
+    d9.isQuantized = true;
+    d9.quantizeStep = 1;
+    list.push_back(d9);
 
     return list;
 }
@@ -269,6 +282,9 @@
     else if (identifier == "octDiv"){
         return m_cyclicTempogramOctaveDivider;
     }
+    else if (identifier == "refBPM"){
+        return m_cyclicTempogramReferenceBPM;
+    }
     
     return 0;
 }
@@ -301,6 +317,9 @@
     else if (identifier == "octDiv"){
         m_cyclicTempogramOctaveDivider = value;
     }
+    else if (identifier == "refBPM"){
+        m_cyclicTempogramReferenceBPM = value;
+    }
     
 }
 
@@ -348,6 +367,14 @@
     d1.sampleType = OutputDescriptor::FixedSampleRate;
     d_sampleRate = tempogramInputSampleRate/m_tempogramHopSize;
     d1.sampleRate = d_sampleRate > 0.0 && !isnan(d_sampleRate) ? d_sampleRate : 0;
+    vector< vector<unsigned int> > logBins = calculateTempogramNearestNeighbourLogBins();
+    if (!logBins.empty()){
+        //assert((int)logBins[0].size() == m_cyclicTempogramOctaveDivider);
+        for(int i = 0; i < (int)m_cyclicTempogramOctaveDivider; i++){
+            //float s = binToBPM(logBins[0][i])/m_cyclicTempogramReferenceBPM;
+            //d1.binNames.push_back(floatToString(s));
+        }
+    }
     d1.hasDuration = false;
     list.push_back(d1);
     
--- a/TempogramPlugin.h	Mon Sep 29 16:22:16 2014 +0100
+++ b/TempogramPlugin.h	Tue Sep 30 14:44:39 2014 +0100
@@ -115,6 +115,7 @@
     float m_cyclicTempogramMinBPM;
     int m_cyclicTempogramNumberOfOctaves;
     int m_cyclicTempogramOctaveDivider;
+    float m_cyclicTempogramReferenceBPM;
 
     string floatToString(float value) const;
     vector< vector<unsigned int> > calculateTempogramNearestNeighbourLogBins() const;