File: pulseaudio_and_alsa.diff

package info (click to toggle)
speech-tools 1%3A2.5.0-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,040 kB
  • sloc: cpp: 67,350; ansic: 12,174; sh: 4,055; java: 3,748; makefile: 1,106; lisp: 711; perl: 396; awk: 85; xml: 9
file content (186 lines) | stat: -rw-r--r-- 5,467 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
Forwarded: https://github.com/festvox/speech_tools/pull/33
--- a/audio/audioP.h
+++ b/audio/audioP.h
@@ -40,6 +40,7 @@
 #define __AUDIOP_H__
 
 int play_nas_wave(EST_Wave &inwave, EST_Option &al);
+int play_pulse_wave(EST_Wave &inwave, EST_Option &al);
 int play_esd_wave(EST_Wave &inwave, EST_Option &al);
 int play_sun16_wave(EST_Wave &inwave, EST_Option &al);
 int play_linux_wave(EST_Wave &inwave, EST_Option &al);
@@ -49,6 +50,7 @@ int play_irix_wave(EST_Wave &inwave, EST
 int play_macosx_wave(EST_Wave &inwave, EST_Option &al);
 
 int record_nas_wave(EST_Wave &inwave, EST_Option &al);
+int record_pulse_wave(EST_Wave &inwave, EST_Option &al);
 int record_esd_wave(EST_Wave &inwave, EST_Option &al);
 int record_sun16_wave(EST_Wave &inwave, EST_Option &al);
 int record_linux_wave(EST_Wave &inwave, EST_Option &al);
--- a/audio/gen_audio.cc
+++ b/audio/gen_audio.cc
@@ -81,6 +81,8 @@ int play_wave(EST_Wave &inwave, EST_Opti
     {
 	if (nas_supported)
 	    protocol = "netaudio";  // the default protocol
+	else if (pulse_supported)
+	    protocol = "pulseaudio";
 	else if (esd_supported)
 	    protocol = "esdaudio";
 	else if (sun16_supported)
@@ -112,6 +114,8 @@ int play_wave(EST_Wave &inwave, EST_Opti
 
     if (upcase(protocol) == "NETAUDIO")
 	return play_nas_wave(*toplay,al);
+    else if (upcase(protocol) == "PULSEAUDIO")
+	return play_pulse_wave(*toplay,al);
     else if (upcase(protocol) == "ESDAUDIO")
 	return play_esd_wave(*toplay,al);
     else if (upcase(protocol) == "SUNAUDIO")
@@ -249,6 +253,8 @@ EST_String options_supported_audio(void)
 	audios += " esdaudio";
     if (sun16_supported)
 	audios += " sun16audio";
+    if (pulse_supported)
+	audios += " pulseaudio";
     if (freebsd16_supported)
 	audios += " freebsd16audio";
     if (linux16_supported)
@@ -285,7 +291,9 @@ int record_wave(EST_Wave &wave, EST_Opti
 	protocol = sr;
     else if (protocol == "")
     {
-	if (nas_supported)
+    if (pulse_supported)
+        protocol = "pulseaudio";
+	else if (nas_supported)
 	    protocol = "netaudio";  // the default protocol
 	else if (esd_supported)
 	    protocol = "esdaudio";  // the default protocol
@@ -307,6 +315,8 @@ int record_wave(EST_Wave &wave, EST_Opti
 
     if (upcase(protocol) == "NETAUDIO")
 	return record_nas_wave(wave,al);
+    else if (upcase(protocol) == "PULSEAUDIO")
+	return record_pulse_wave(wave,al);
     else if (upcase(protocol) == "ESDAUDIO")
         return record_esd_wave(wave,al);
     else if (upcase(protocol) == "SUN16AUDIO")
--- a/audio/linux_sound.cc
+++ b/audio/linux_sound.cc
@@ -873,20 +873,38 @@ int record_linux_wave(EST_Wave &inwave,
     return 0;
 }
 
-#else
+#else /* ALSALINUX not supported */
+int freebsd16_supported = FALSE;
+int linux16_supported = FALSE;
+
+int play_linux_wave(EST_Wave &inwave, EST_Option &al)
+{
+    (void)inwave;
+    (void)al;
+    cerr << "ALSA audio support not compiled." << endl;
+    return -1;
+}
+int record_linux_wave(EST_Wave &inwave, EST_Option &al)
+{
+    (void)inwave;
+    (void)al;
+    cerr << "ALSA audio support not compiled." << endl;
+    return -1;
+}
+
+#endif /* ALSALINUX */
+#endif /* VOXWARE */
+
 
 #ifdef SUPPORT_PULSEAUDIO
 #include <pulse/simple.h>
 
-int freebsd16_supported = FALSE;
-int linux16_supported = TRUE;
-
-static const char *aud_sys_name = "PULSEAUDIO";
+int pulse_supported = TRUE;
 
 #define AUDIOBUFFSIZE 256
 // #define AUDIOBUFFSIZE 20480
 
-int play_linux_wave(EST_Wave &inwave, EST_Option &al)
+int play_pulse_wave(EST_Wave &inwave, EST_Option &al)
 {
     pa_sample_spec *ss;
     pa_simple *s;
@@ -934,32 +952,29 @@ int play_linux_wave(EST_Wave &inwave, ES
     return 1;
 }
 
-int record_linux_wave(EST_Wave &inwave, EST_Option &al)
+int record_pulse_wave(EST_Wave &inwave, EST_Option &al)
 {
     return -1;
 }
 
 #else /* not supported */
 
-int freebsd16_supported = FALSE;
-int linux16_supported = FALSE;
+int pulse_supported = FALSE;
 
-int play_linux_wave(EST_Wave &inwave, EST_Option &al)
+int play_pulse_wave(EST_Wave &inwave, EST_Option &al)
 {
     (void)inwave;
     (void)al;
-    cerr << "MacOS X audio support not compiled." << endl;
+    cerr << "PulseAudio audio support not compiled." << endl;
     return -1;
 }
-int record_linux_wave(EST_Wave &inwave, EST_Option &al)
+int record_pulse_wave(EST_Wave &inwave, EST_Option &al)
 {
     (void)inwave;
     (void)al;
-    cerr << "MacOS X audio support not compiled." << endl;
+    cerr << "PulseAudio audio support not compiled." << endl;
     return -1;
 }
 
-#endif /* ALSA */
 #endif /* PULSEAUDIO */
-#endif /* VOXWARE */
 
--- a/include/EST_audio.h
+++ b/include/EST_audio.h
@@ -43,6 +43,7 @@
 #include "EST_Option.h"
 
 extern int nas_supported;
+extern int pulse_supported;
 extern int esd_supported;
 extern int sun16_supported;
 extern int freebsd16_supported;
--- a/config/config.in
+++ b/config/config.in
@@ -91,6 +91,8 @@ INCLUDE_MODULES += NATIVE_AUDIO
 ## Under Linux there may be a choice of audio support
 ## This is only used if we are under Linux (or a linux like system)
 LINUXAUDIO = @LINUXAUDIO@
+# Change it to pulseaudio to enable pulseaudio
+PULSEAUDIO = pulseaudio
 
 ## USER INTERFACE
 
--- a/config/modules/linux16_audio.mak
+++ b/config/modules/linux16_audio.mak
@@ -48,7 +48,7 @@ ifeq ($(LINUXAUDIO),alsa)
    MODULE_LIBS += -lasound
 endif
 
-ifeq ($(LINUXAUDIO),pulseaudio)
+ifeq ($(PULSEAUDIO),pulseaudio)
    AUDIO_DEFINES += -DSUPPORT_PULSEAUDIO
    MODULE_LIBS += -lpulse-simple -lpulse
 endif