changeset 265:03c7167e1f30

* Use _VAMP_PLUGIN_IN_HOST_NAMESPACE rather than omitting plugin namespace completely in host context * Doc and build warning updates
author cannam
date Thu, 20 Nov 2008 20:16:05 +0000
parents 91ac8f5e52ea
children 53b0e7557c52
files README.compat src/vamp-hostsdk/PluginSummarisingAdapter.cpp vamp-sdk/plugguard.h
diffstat 3 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/README.compat	Thu Nov 20 17:33:12 2008 +0000
+++ b/README.compat	Thu Nov 20 20:16:05 2008 +0000
@@ -86,13 +86,12 @@
 
 However, hosts that directly incorporate code from plugins, for
 example to provide functionality that is the same as those plugins
-without having to explicitly load them, may find that they can no
-longer resolve plugin functions at link time because of this namespace
-mismatch.  To avoid this, the host build process should define the
-preprocessor flag _VAMP_NO_PLUGIN_NAMESPACE when compiling the plugin
-code to ensure that both host and plugin code exist at the same level
-of namespace.  Note that the corresponding _VAMP_NO_HOST_NAMESPACE is
-also available.
+without having to explicitly load them, will find that they cannot
+resolve plugin symbols at link time because of this namespace
+mismatch.  To avoid this, you may define the preprocessor symbol
+_VAMP_PLUGIN_IN_HOST_NAMESPACE when compiling the plugin code in the
+context of the host, to ensure that both host and plugin code exist
+within the same namespace.
 
 (If your host does this, why not make it load the plugins dynamically
 instead using the normal Vamp plugin loader method?  There are many
--- a/src/vamp-hostsdk/PluginSummarisingAdapter.cpp	Thu Nov 20 17:33:12 2008 +0000
+++ b/src/vamp-hostsdk/PluginSummarisingAdapter.cpp	Thu Nov 20 20:16:05 2008 +0000
@@ -522,7 +522,7 @@
     result.time = timestamp;
     result.duration = INVALID_DURATION;
 
-    if (f.values.size() > m_accumulators[output].bins) {
+    if (int(f.values.size()) > m_accumulators[output].bins) {
         m_accumulators[output].bins = f.values.size();
     }
 
@@ -629,7 +629,7 @@
         // interest)... but perhaps it's the user's problem if they
         // ask for segmentation (or any summary at all) in that case
 
-        for (int n = 0; n < source.results.size(); ++n) {
+        for (int n = 0; n < int(source.results.size()); ++n) {
             
             // This result spans source.results[n].time to
             // source.results[n].time + source.results[n].duration.
@@ -760,7 +760,7 @@
                 std::vector<ValueDurationFloatPair> valvec;
 
                 for (int k = 0; k < sz; ++k) {
-                    while (accumulator.results[k].values.size() <
+                    while (int(accumulator.results[k].values.size()) <
                            accumulator.bins) {
                         accumulator.results[k].values.push_back(0.f);
                     }
--- a/vamp-sdk/plugguard.h	Thu Nov 20 17:33:12 2008 +0000
+++ b/vamp-sdk/plugguard.h	Thu Nov 20 20:16:05 2008 +0000
@@ -75,6 +75,14 @@
 #define _VAMP_SDK_PLUGSPACE_BEGIN(h)
 #define _VAMP_SDK_PLUGSPACE_END(h)
 #else
+#ifdef _VAMP_PLUGIN_IN_HOST_NAMESPACE
+#define _VAMP_SDK_PLUGSPACE_BEGIN(h) \
+	namespace _VampHost {
+
+#define _VAMP_SDK_PLUGSPACE_END(h) \
+	} \
+	using namespace _VampHost;
+#else
 #define _VAMP_SDK_PLUGSPACE_BEGIN(h) \
 	namespace _VampPlugin {
 
@@ -82,6 +90,7 @@
 	} \
 	using namespace _VampPlugin;
 #endif
+#endif
 
 #endif