'libs/panners' - Streamline my previous API changes and include Tim's additions to...
authorJohn Emmas <johne53@tiscali.co.uk>
Mon, 2 Sep 2013 15:54:17 +0000 (16:54 +0100)
committerJohn Emmas <johne53@tiscali.co.uk>
Mon, 2 Sep 2013 15:54:17 +0000 (16:54 +0100)
libs/ardour/ardour/panner.h
libs/panners/1in2out/panner_1in2out.cc
libs/panners/1in2out/panner_1in2out.h

index c23d3bd33fbe97b0e3331e0a34b9c9a24e93da53..e2a32e0dc492f59b6fcd39a9676d0c94915855b4 100644 (file)
 #include "ardour/automation_control.h"
 #include "ardour/automatable.h"
 
-#if !defined(ARDOURPANNER_IS_IN_WINDLL)
-       #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
-       // If you need '__declspec' compatibility, add extra compilers to the above as necessary
-               #define ARDOURPANNER_IS_IN_WINDLL 1
-       #else
-               #define ARDOURPANNER_IS_IN_WINDLL 0
-       #endif
+#ifndef ARDOURPANNER_IS_IN_SHARED_LIB
+       #define ARDOURPANNER_IS_IN_SHARED_LIB 1
 #endif
 
-#if ARDOURPANNER_IS_IN_WINDLL && !defined(ARDOURPANNER_API)
-       #if defined(BUILDING_ARDOURPANNERS)
-               #define ARDOURPANNER_API __declspec(dllexport)
-               #define ARDOURPANNER_APICALLTYPE __thiscall
-               #define ARDOURPANNER_CAPICALLTYPE __cdecl
-       #elif defined(COMPILER_MSVC) || defined(COMPILER_MINGW) // Probably needs Cygwin too, at some point
-               #define ARDOURPANNER_API __declspec(dllimport)
-               #define ARDOURPANNER_APICALLTYPE __thiscall
-               #define ARDOURPANNER_CAPICALLTYPE __cdecl
+#if ARDOURPANNER_IS_IN_SHARED_LIB && !defined(ARDOURPANNER_API)
+       #define ARDOURPANNER_CAPICALLTYPE __cdecl
+
+       #if defined(COMPILER_MSVC) || defined(COMPILER_MINGW)
+               #if defined(BUILDING_ARDOURPANNERS)
+                       #define ARDOURPANNER_LOCAL
+                       #define ARDOURPANNER_API   __declspec(dllexport)
+               #else
+                       #define ARDOURPANNER_LOCAL
+                       #define ARDOURPANNER_API   __declspec(dllimport)
+               #endif
        #else
-               #error "Attempting to define __declspec with an incompatible compiler !"
+               #if !defined(COMPILER_GCC)
+                       #warning "Attempting to export symbols with an unspecified compiler! GCC assumed!"
+               #endif
+
+               #define ARDOURPANNER_LOCAL __attribute__ ((visibility("hidden")))
+               #define ARDOURPANNER_API   __attribute__ ((visibility("default")))
        #endif
 #elif !defined(ARDOURPANNER_API)
-       // Other compilers / platforms could be accommodated here
+       #define ARDOURPANNER_CAPICALLTYPE __cdecl
+
+       /* This library was built statically.    */
+       /* Visibility is determined by the code. */
        #define ARDOURPANNER_API
-       #define ARDOURPANNER_APICALLTYPE
-       #define ARDOURPANNER_CAPICALLTYPE
+       #define ARDOURPANNER_LOCAL
 #endif
 
 namespace ARDOUR {
@@ -95,7 +99,7 @@ public:
           * return false
        */
 
-       virtual bool ARDOURPANNER_APICALLTYPE clamp_position (double&) { return true; }
+       virtual bool clamp_position (double&) { return true; }
        virtual bool clamp_width (double&) { return true; }
        virtual bool clamp_elevation (double&) { return true; }
 
@@ -103,7 +107,7 @@ public:
        virtual std::pair<double, double> width_range () const { return std::make_pair (-DBL_MAX, DBL_MAX); }
        virtual std::pair<double, double> elevation_range () const { return std::make_pair (-DBL_MAX, DBL_MAX); }
 
-       virtual void ARDOURPANNER_APICALLTYPE set_position (double) { }
+       virtual void set_position (double) { }
        virtual void set_width (double) { }
        virtual void set_elevation (double) { }
 
index 79a63a2b47da0595edbf07b2e83945146c7bd0d4..dbc9911a773864e29543b0dcc964e92c565548da 100644 (file)
@@ -67,7 +67,7 @@ static PanPluginDescriptor _descriptor = {
         Panner1in2out::factory
 };
 
-extern "C" { ARDOURPANNER_API PanPluginDescriptor* ARDOURPANNER_CAPICALLTYPE panner_descriptor () { return &_descriptor; } }
+extern "C" ARDOURPANNER_API PanPluginDescriptor* ARDOURPANNER_CAPICALLTYPE panner_descriptor () { return &_descriptor; }
 
 Panner1in2out::Panner1in2out (boost::shared_ptr<Pannable> p)
        : Panner (p)
@@ -104,7 +104,7 @@ Panner1in2out::update ()
         desired_right = panR * (scale * panR + 1.0f - scale);
 }
 
-ARDOURPANNER_API void ARDOURPANNER_APICALLTYPE
+ARDOURPANNER_API void
 Panner1in2out::set_position (double p)
 {
         if (clamp_position (p)) {
@@ -112,7 +112,7 @@ Panner1in2out::set_position (double p)
         }
 }
 
-ARDOURPANNER_API bool ARDOURPANNER_APICALLTYPE
+ARDOURPANNER_API bool
 Panner1in2out::clamp_position (double& p)
 {
         /* any position between 0.0 and 1.0 is legal */
index aa5428a329a873cab1f759a5bf746915b197cee4..f035115f6a4b873cdf52635f306116a9ab5c9046 100644 (file)
@@ -42,8 +42,8 @@ class Panner1in2out : public Panner
        Panner1in2out (boost::shared_ptr<Pannable>);
        ~Panner1in2out ();
 
-    ARDOURPANNER_API void ARDOURPANNER_APICALLTYPE set_position (double);
-    ARDOURPANNER_API bool ARDOURPANNER_APICALLTYPE clamp_position (double&);
+    ARDOURPANNER_API void set_position (double);
+    ARDOURPANNER_API bool clamp_position (double&);
        std::pair<double, double> position_range () const;
 
         double position() const;