speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 05/10] Fix audio module dynamic opening on OS X


From: Boris Dušek
Subject: [PATCH 05/10] Fix audio module dynamic opening on OS X
Date: Mon, 23 Jul 2012 15:24:16 +0200

From: Boris Dus?ek <address@hidden>
To: address@hidden

"weak" attribute is not supported on OS X, further only one audio
module currently is usable on OS X (libao), so the whole aliasing
business is not currently needed. So make life on OS X easier for
now.
---
 src/audio/alsa.c               |    9 ++-------
 src/audio/libao.c              |    9 ++-------
 src/audio/nas.c                |    9 ++-------
 src/audio/oss.c                |    9 ++-------
 src/audio/pulse.c              |    9 ++-------
 src/audio/spd_audio_plugin_p.h |   13 +++++++++++++
 6 files changed, 23 insertions(+), 35 deletions(-)
 create mode 100644 src/audio/spd_audio_plugin_p.h

diff --git a/src/audio/alsa.c b/src/audio/alsa.c
index 4e20a54..4048b1f 100644
--- a/src/audio/alsa.c
+++ b/src/audio/alsa.c
@@ -39,6 +39,7 @@
 
 #define SPD_AUDIO_PLUGIN_ENTRY spd_alsa_LTX_spd_audio_plugin_get
 #include <spd_audio_plugin.h>
+#include "spd_audio_plugin_p.h"
 
 typedef struct {
        AudioID id;
@@ -872,12 +873,6 @@ static spd_audio_plugin_t alsa_functions = {
        alsa_get_playcmd
 };
 
-spd_audio_plugin_t *alsa_plugin_get(void)
-{
-       return &alsa_functions;
-}
-
-spd_audio_plugin_t *SPD_AUDIO_PLUGIN_ENTRY(void)
-    __attribute__ ((weak, alias("alsa_plugin_get")));
+SPD_AUDIO_PLUGIN(alsa)
 #undef MSG
 #undef ERR
diff --git a/src/audio/libao.c b/src/audio/libao.c
index e82be2b..3c473eb 100644
--- a/src/audio/libao.c
+++ b/src/audio/libao.c
@@ -33,6 +33,7 @@
 
 #define SPD_AUDIO_PLUGIN_ENTRY spd_libao_LTX_spd_audio_plugin_get
 #include <spd_audio_plugin.h>
+#include "spd_audio_plugin_p.h"
 
 /* send a packet of XXX bytes to the sound device */
 #define AO_SEND_BYTES 256
@@ -235,12 +236,6 @@ static spd_audio_plugin_t libao_functions = {
        libao_get_playcmd
 };
 
-spd_audio_plugin_t *libao_plugin_get(void)
-{
-       return &libao_functions;
-}
-
-spd_audio_plugin_t *SPD_AUDIO_PLUGIN_ENTRY(void)
-    __attribute__ ((weak, alias("libao_plugin_get")));
+SPD_AUDIO_PLUGIN(libao)
 #undef MSG
 #undef ERR
diff --git a/src/audio/nas.c b/src/audio/nas.c
index ca76127..0247cdf 100644
--- a/src/audio/nas.c
+++ b/src/audio/nas.c
@@ -35,6 +35,7 @@
 
 #define SPD_AUDIO_PLUGIN_ENTRY spd_nas_LTX_spd_audio_plugin_get
 #include <spd_audio_plugin.h>
+#include "spd_audio_plugin_p.h"
 
 typedef struct {
        AudioID id;
@@ -254,10 +255,4 @@ static spd_audio_plugin_t nas_functions = {
        nas_get_playcmd
 };
 
-spd_audio_plugin_t *nas_plugin_get(void)
-{
-       return &nas_functions;
-}
-
-spd_audio_plugin_t *SPD_AUDIO_PLUGIN_ENTRY(void)
-    __attribute__ ((weak, alias("nas_plugin_get")));
+SPD_AUDIO_PLUGIN(nas)
diff --git a/src/audio/oss.c b/src/audio/oss.c
index b7232c3..2ae100a 100644
--- a/src/audio/oss.c
+++ b/src/audio/oss.c
@@ -43,6 +43,7 @@
 
 #define SPD_AUDIO_PLUGIN_ENTRY spd_oss_LTX_spd_audio_plugin_get
 #include <spd_audio_plugin.h>
+#include "spd_audio_plugin_p.h"
 
 typedef struct {
        AudioID id;
@@ -512,12 +513,6 @@ static spd_audio_plugin_t oss_functions = {
        oss_get_playcmd
 };
 
-spd_audio_plugin_t *oss_plugin_get(void)
-{
-       return &oss_functions;
-}
-
-spd_audio_plugin_t *SPD_AUDIO_PLUGIN_ENTRY(void)
-    __attribute__ ((weak, alias("oss_plugin_get")));
+SPD_AUDIO_PLUGIN(oss)
 #undef MSG
 #undef ERR
diff --git a/src/audio/pulse.c b/src/audio/pulse.c
index a4137e5..c6778cb 100644
--- a/src/audio/pulse.c
+++ b/src/audio/pulse.c
@@ -45,6 +45,7 @@
 
 #define SPD_AUDIO_PLUGIN_ENTRY spd_pulse_LTX_spd_audio_plugin_get
 #include <spd_audio_plugin.h>
+#include "spd_audio_plugin_p.h"
 
 /* Switch this on to debug, see output log location in MSG() */
 //#define DEBUG_PULSE
@@ -301,10 +302,4 @@ static spd_audio_plugin_t pulse_functions = {
        pulse_get_playcmd
 };
 
-spd_audio_plugin_t *pulse_plugin_get(void)
-{
-       return &pulse_functions;
-}
-
-spd_audio_plugin_t *SPD_AUDIO_PLUGIN_ENTRY(void)
-    __attribute__ ((weak, alias("pulse_plugin_get")));
+SPD_AUDIO_PLUGIN(pulse)
diff --git a/src/audio/spd_audio_plugin_p.h b/src/audio/spd_audio_plugin_p.h
new file mode 100644
index 0000000..5028642
--- /dev/null
+++ b/src/audio/spd_audio_plugin_p.h
@@ -0,0 +1,13 @@
+#ifndef SPD_AUDIO_PLUGIN_P_H_
+#define SPD_AUDIO_PLUGIN_P_H_
+
+#ifdef __APPLE__
+#      define SPD_AUDIO_PLUGIN(modname) \
+               spd_audio_plugin_t *spd_audio_plugin_get(void) { return 
&modname##_functions; }
+#else
+#      define SPD_AUDIO_PLUGIN(modname) \
+               spd_audio_plugin_t * modname##_plugin_get(void) { return 
&modname##_functions; }\
+               spd_audio_plugin_t * SPD_AUDIO_PLUGIN_ENTRY (void) 
__attribute__ ((weak, alias(#modname "_plugin_get")));
+#endif
+
+#endif
-- 
1.7.7.5 (Apple Git-26)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]