Mercurial > sdl-ios-xcode
annotate src/audio/pulseaudio/SDL_pulseaudio.c @ 3674:7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 17 Jan 2010 06:51:31 +0000 |
parents | c9d5bd1b4e18 |
children | f7b03b6838cb |
rev | line source |
---|---|
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
1 /* |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
2859 | 3 Copyright (C) 1997-2009 Sam Lantinga |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
4 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
9 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
14 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
18 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
19 Sam Lantinga |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
21 */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
22 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
23 /* |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
24 The PulseAudio target for SDL 1.3 is based on the 1.3 arts target, with |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
25 the appropriate parts replaced with the 1.2 PulseAudio target code. This |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
26 was the cleanest way to move it to 1.3. The 1.2 target was written by |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
27 Stéphan Kochen: stephan .a.t. kochen.nl |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
28 */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
29 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
30 #include "SDL_config.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
31 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
32 /* Allow access to a raw mixing buffer */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
33 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
34 #ifdef HAVE_SIGNAL_H |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
35 #include <signal.h> |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
36 #endif |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
37 #include <unistd.h> |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
38 #include <sys/types.h> |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
39 #include <errno.h> |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
40 #include <pulse/pulseaudio.h> |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
41 #include <pulse/simple.h> |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
42 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
43 #include "SDL_timer.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
44 #include "SDL_audio.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
45 #include "../SDL_audiomem.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
46 #include "../SDL_audio_c.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
47 #include "SDL_pulseaudio.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
48 #include "SDL_loadso.h" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
49 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
50 /* The tag name used by pulse audio */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
51 #define PULSEAUDIO_DRIVER_NAME "pulseaudio" |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
52 |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
53 #if (PA_API_VERSION < 12) |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
54 /** Return non-zero if the passed state is one of the connected states */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
55 static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
56 return |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
57 x == PA_CONTEXT_CONNECTING || |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
58 x == PA_CONTEXT_AUTHORIZING || |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
59 x == PA_CONTEXT_SETTING_NAME || |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
60 x == PA_CONTEXT_READY; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
61 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
62 /** Return non-zero if the passed state is one of the connected states */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
63 static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
64 return |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
65 x == PA_STREAM_CREATING || |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
66 x == PA_STREAM_READY; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
67 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
68 #endif /* pulseaudio <= 0.9.10 */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
69 |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
70 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
71 static pa_simple *(*PULSEAUDIO_pa_simple_new) (const char *, const char *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
72 pa_stream_direction_t, const char *, const char *, const pa_sample_spec *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
73 const pa_channel_map *, const pa_buffer_attr *, int *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
74 static void (*PULSEAUDIO_pa_simple_free) (pa_simple *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
75 static pa_channel_map *(*PULSEAUDIO_pa_channel_map_init_auto) ( |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
76 pa_channel_map *, unsigned, pa_channel_map_def_t); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
77 static const char * (*PULSEAUDIO_pa_strerror) (int); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
78 static pa_mainloop * (*PULSEAUDIO_pa_mainloop_new) (void); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
79 static pa_mainloop_api * (*PULSEAUDIO_pa_mainloop_get_api) (pa_mainloop *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
80 static int (*PULSEAUDIO_pa_mainloop_iterate) (pa_mainloop *, int, int *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
81 static void (*PULSEAUDIO_pa_mainloop_free) (pa_mainloop *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
82 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
83 static pa_operation_state_t (*PULSEAUDIO_pa_operation_get_state) ( |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
84 pa_operation *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
85 static void (*PULSEAUDIO_pa_operation_cancel) (pa_operation *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
86 static void (*PULSEAUDIO_pa_operation_unref) (pa_operation *); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
87 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
88 static pa_context * (*PULSEAUDIO_pa_context_new) (pa_mainloop_api *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
89 const char *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
90 static int (*PULSEAUDIO_pa_context_connect) (pa_context *, const char *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
91 pa_context_flags_t, const pa_spawn_api *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
92 static pa_context_state_t (*PULSEAUDIO_pa_context_get_state) (pa_context *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
93 static void (*PULSEAUDIO_pa_context_disconnect) (pa_context *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
94 static void (*PULSEAUDIO_pa_context_unref) (pa_context *); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
95 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
96 static pa_stream * (*PULSEAUDIO_pa_stream_new) (pa_context *, const char *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
97 const pa_sample_spec *, const pa_channel_map *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
98 static int (*PULSEAUDIO_pa_stream_connect_playback) (pa_stream *, const char *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
99 const pa_buffer_attr *, pa_stream_flags_t, pa_cvolume *, pa_stream *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
100 static pa_stream_state_t (*PULSEAUDIO_pa_stream_get_state) (pa_stream *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
101 static size_t (*PULSEAUDIO_pa_stream_writable_size) (pa_stream *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
102 static int (*PULSEAUDIO_pa_stream_write) (pa_stream *, const void *, size_t, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
103 pa_free_cb_t, int64_t, pa_seek_mode_t); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
104 static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *, |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
105 pa_stream_success_cb_t, void *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
106 static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
107 static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
108 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
109 static int load_pulseaudio_syms(void); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
110 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
111 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
112 #ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
113 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
114 static const char *pulseaudio_library = SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
115 static void *pulseaudio_handle = NULL; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
116 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
117 static int |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
118 load_pulseaudio_sym(const char *fn, void **addr) |
2274 | 119 { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
120 *addr = SDL_LoadFunction(pulseaudio_handle, fn); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
121 if (*addr == NULL) { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
122 /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
123 return 0; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
124 } |
2274 | 125 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
126 return 1; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
127 } |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
128 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
129 /* cast funcs to char* first, to please GCC's strict aliasing rules. */ |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
130 #define SDL_PULSEAUDIO_SYM(x) \ |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
131 if (!load_pulseaudio_sym(#x, (void **) (char *) &PULSEAUDIO_##x)) return -1 |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
132 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
133 static void |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
134 UnloadPulseAudioLibrary(void) |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
135 { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
136 if (pulseaudio_handle != NULL) { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
137 SDL_UnloadObject(pulseaudio_handle); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
138 pulseaudio_handle = NULL; |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
139 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
140 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
141 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
142 static int |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
143 LoadPulseAudioLibrary(void) |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
144 { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
145 int retval = 0; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
146 if (pulseaudio_handle == NULL) { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
147 pulseaudio_handle = SDL_LoadObject(pulseaudio_library); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
148 if (pulseaudio_handle == NULL) { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
149 retval = -1; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
150 /* Don't call SDL_SetError(): SDL_LoadObject already did. */ |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
151 } else { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
152 retval = load_pulseaudio_syms(); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
153 if (retval < 0) { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
154 UnloadPulseAudioLibrary(); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
155 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
156 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
157 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
158 return retval; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
159 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
160 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
161 #else |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
162 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
163 #define SDL_PULSEAUDIO_SYM(x) PULSEAUDIO_##x = x |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
164 |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
165 static void |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
166 UnloadPulseAudioLibrary(void) |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
167 { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
168 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
169 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
170 static int |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
171 LoadPulseAudioLibrary(void) |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
172 { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
173 load_pulseaudio_syms(); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
174 return 0; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
175 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
176 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
177 #endif /* SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
178 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
179 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
180 static int |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
181 load_pulseaudio_syms(void) |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
182 { |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
183 SDL_PULSEAUDIO_SYM(pa_simple_new); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
184 SDL_PULSEAUDIO_SYM(pa_simple_free); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
185 SDL_PULSEAUDIO_SYM(pa_mainloop_new); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
186 SDL_PULSEAUDIO_SYM(pa_mainloop_get_api); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
187 SDL_PULSEAUDIO_SYM(pa_mainloop_iterate); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
188 SDL_PULSEAUDIO_SYM(pa_mainloop_free); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
189 SDL_PULSEAUDIO_SYM(pa_operation_get_state); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
190 SDL_PULSEAUDIO_SYM(pa_operation_cancel); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
191 SDL_PULSEAUDIO_SYM(pa_operation_unref); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
192 SDL_PULSEAUDIO_SYM(pa_context_new); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
193 SDL_PULSEAUDIO_SYM(pa_context_connect); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
194 SDL_PULSEAUDIO_SYM(pa_context_get_state); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
195 SDL_PULSEAUDIO_SYM(pa_context_disconnect); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
196 SDL_PULSEAUDIO_SYM(pa_context_unref); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
197 SDL_PULSEAUDIO_SYM(pa_stream_new); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
198 SDL_PULSEAUDIO_SYM(pa_stream_connect_playback); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
199 SDL_PULSEAUDIO_SYM(pa_stream_get_state); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
200 SDL_PULSEAUDIO_SYM(pa_stream_writable_size); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
201 SDL_PULSEAUDIO_SYM(pa_stream_write); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
202 SDL_PULSEAUDIO_SYM(pa_stream_drain); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
203 SDL_PULSEAUDIO_SYM(pa_stream_disconnect); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
204 SDL_PULSEAUDIO_SYM(pa_stream_unref); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
205 SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
206 SDL_PULSEAUDIO_SYM(pa_strerror); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
207 return 0; |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
208 } |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
209 |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
210 |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
211 /* This function waits until it is possible to write a full sound buffer */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
212 static void |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
213 PULSEAUDIO_WaitDevice(_THIS) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
214 { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
215 struct SDL_PrivateAudioData *h = this->hidden; |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
216 |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
217 while(1) { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
218 if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
219 PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
220 PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
221 this->enabled = 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
222 return; |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
223 } |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
224 if (PULSEAUDIO_pa_stream_writable_size(h->stream) >= h->mixlen) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
225 return; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
226 } |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
227 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
228 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
229 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
230 static void |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
231 PULSEAUDIO_PlayDevice(_THIS) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
232 { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
233 /* Write the audio data */ |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
234 struct SDL_PrivateAudioData *h = this->hidden; |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
235 if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf, h->mixlen, NULL, 0LL, |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
236 PA_SEEK_RELATIVE) < 0) { |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
237 this->enabled = 0; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
238 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
239 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
240 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
241 static void |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
242 stream_drain_complete(pa_stream *s, int success, void *userdata) |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
243 { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
244 /* no-op for pa_stream_drain() to use for callback. */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
245 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
246 |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
247 static void |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
248 PULSEAUDIO_WaitDone(_THIS) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
249 { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
250 struct SDL_PrivateAudioData *h = this->hidden; |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
251 pa_operation *o; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
252 |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
253 o = PULSEAUDIO_pa_stream_drain(h->stream, stream_drain_complete, NULL); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
254 if (!o) { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
255 return; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
256 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
257 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
258 while (PULSEAUDIO_pa_operation_get_state(o) != PA_OPERATION_DONE) { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
259 if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
260 PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
261 PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
262 PULSEAUDIO_pa_operation_cancel(o); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
263 break; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
264 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
265 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
266 |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
267 PULSEAUDIO_pa_operation_unref(o); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
268 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
269 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
270 |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
271 |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
272 static Uint8 * |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
273 PULSEAUDIO_GetDeviceBuf(_THIS) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
274 { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
275 return (this->hidden->mixbuf); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
276 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
277 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
278 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
279 static void |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
280 PULSEAUDIO_CloseDevice(_THIS) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
281 { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
282 if (this->hidden != NULL) { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
283 if (this->hidden->mixbuf != NULL) { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
284 SDL_FreeAudioMem(this->hidden->mixbuf); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
285 this->hidden->mixbuf = NULL; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
286 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
287 if (this->hidden->stream) { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
288 PULSEAUDIO_pa_stream_disconnect(this->hidden->stream); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
289 PULSEAUDIO_pa_stream_unref(this->hidden->stream); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
290 this->hidden->stream = NULL; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
291 } |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
292 if (this->hidden->context != NULL) { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
293 PULSEAUDIO_pa_context_disconnect(this->hidden->context); |
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
294 PULSEAUDIO_pa_context_unref(this->hidden->context); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
295 this->hidden->context = NULL; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
296 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
297 if (this->hidden->mainloop != NULL) { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
298 PULSEAUDIO_pa_mainloop_free(this->hidden->mainloop); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
299 this->hidden->mainloop = NULL; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
300 } |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
301 SDL_free(this->hidden); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
302 this->hidden = NULL; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
303 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
304 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
305 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
306 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
307 /* !!! FIXME: this could probably be expanded. */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
308 /* Try to get the name of the program */ |
2274 | 309 static char * |
310 get_progname(void) | |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
311 { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
312 #ifdef __LINUX__ |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
313 char *progname = NULL; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
314 FILE *fp; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
315 static char temp[BUFSIZ]; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
316 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
317 SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid()); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
318 fp = fopen(temp, "r"); |
2274 | 319 if (fp != NULL) { |
320 if (fgets(temp, sizeof(temp) - 1, fp)) { | |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
321 progname = SDL_strrchr(temp, '/'); |
2274 | 322 if (progname == NULL) { |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
323 progname = temp; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
324 } else { |
2274 | 325 progname = progname + 1; |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
326 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
327 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
328 fclose(fp); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
329 } |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
330 return(progname); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
331 #elif defined(__NetBSD__) |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
332 return getprogname(); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
333 #else |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
334 return("unknown"); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
335 #endif |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
336 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
337 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
338 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
339 static int |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
340 PULSEAUDIO_OpenDevice(_THIS, const char *devname, int iscapture) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
341 { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
342 struct SDL_PrivateAudioData *h = NULL; |
2272
25a87553a59d
Minor PulseAudio fixes: corrected OpenDevice return code, human-readable
Ryan C. Gordon <icculus@icculus.org>
parents:
2271
diff
changeset
|
343 Uint16 test_format = 0; |
25a87553a59d
Minor PulseAudio fixes: corrected OpenDevice return code, human-readable
Ryan C. Gordon <icculus@icculus.org>
parents:
2271
diff
changeset
|
344 pa_sample_spec paspec; |
25a87553a59d
Minor PulseAudio fixes: corrected OpenDevice return code, human-readable
Ryan C. Gordon <icculus@icculus.org>
parents:
2271
diff
changeset
|
345 pa_buffer_attr paattr; |
25a87553a59d
Minor PulseAudio fixes: corrected OpenDevice return code, human-readable
Ryan C. Gordon <icculus@icculus.org>
parents:
2271
diff
changeset
|
346 pa_channel_map pacmap; |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
347 pa_stream_flags_t flags = 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
348 int state = 0; |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
349 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
350 /* Initialize all variables that we clean on shutdown */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
351 this->hidden = (struct SDL_PrivateAudioData *) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
352 SDL_malloc((sizeof *this->hidden)); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
353 if (this->hidden == NULL) { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
354 SDL_OutOfMemory(); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
355 return 0; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
356 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
357 SDL_memset(this->hidden, 0, (sizeof *this->hidden)); |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
358 h = this->hidden; |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
359 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
360 paspec.format = PA_SAMPLE_INVALID; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
361 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
362 /* Try for a closest match on audio format */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
363 for (test_format = SDL_FirstAudioFormat(this->spec.format); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
364 (paspec.format == PA_SAMPLE_INVALID) && test_format;) { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
365 #ifdef DEBUG_AUDIO |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
366 fprintf(stderr, "Trying format 0x%4.4x\n", test_format); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
367 #endif |
2274 | 368 switch (test_format) { |
369 case AUDIO_U8: | |
370 paspec.format = PA_SAMPLE_U8; | |
371 break; | |
372 case AUDIO_S16LSB: | |
373 paspec.format = PA_SAMPLE_S16LE; | |
374 break; | |
375 case AUDIO_S16MSB: | |
376 paspec.format = PA_SAMPLE_S16BE; | |
377 break; | |
378 default: | |
379 paspec.format = PA_SAMPLE_INVALID; | |
380 break; | |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
381 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
382 if (paspec.format == PA_SAMPLE_INVALID) { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
383 test_format = SDL_NextAudioFormat(); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
384 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
385 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
386 if (paspec.format == PA_SAMPLE_INVALID) { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
387 PULSEAUDIO_CloseDevice(this); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
388 SDL_SetError("Couldn't find any hardware audio formats"); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
389 return 0; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
390 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
391 this->spec.format = test_format; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
392 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
393 /* Calculate the final parameters for this audio specification */ |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
394 #ifdef PA_STREAM_ADJUST_LATENCY |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
395 this->spec.samples /= 2; /* Mix in smaller chunck to avoid underruns */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
396 #endif |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
397 SDL_CalculateAudioSpec(&this->spec); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
398 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
399 /* Allocate mixing buffer */ |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
400 h->mixlen = this->spec.size; |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
401 h->mixbuf = (Uint8 *) SDL_AllocAudioMem(h->mixlen); |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
402 if (h->mixbuf == NULL) { |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
403 PULSEAUDIO_CloseDevice(this); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
404 SDL_OutOfMemory(); |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
405 return 0; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
406 } |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
407 SDL_memset(h->mixbuf, this->spec.silence, this->spec.size); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
408 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
409 paspec.channels = this->spec.channels; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
410 paspec.rate = this->spec.freq; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
411 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
412 /* Reduced prebuffering compared to the defaults. */ |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
413 #ifdef PA_STREAM_ADJUST_LATENCY |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
414 /* 2x original requested bufsize */ |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
415 paattr.tlength = h->mixlen * 4; |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
416 paattr.prebuf = -1; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
417 paattr.maxlength = -1; |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
418 /* -1 can lead to pa_stream_writable_size() >= mixlen never being true */ |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
419 paattr.minreq = h->mixlen; |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
420 flags = PA_STREAM_ADJUST_LATENCY; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
421 #else |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
422 paattr.tlength = h->mixlen*2; |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
423 paattr.prebuf = h->mixlen*2; |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
424 paattr.maxlength = h->mixlen*2; |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
425 paattr.minreq = h->mixlen; |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
426 #endif |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
427 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
428 /* The SDL ALSA output hints us that we use Windows' channel mapping */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
429 /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */ |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
430 PULSEAUDIO_pa_channel_map_init_auto(&pacmap, this->spec.channels, |
2274 | 431 PA_CHANNEL_MAP_WAVEEX); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
432 |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
433 /* Set up a new main loop */ |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
434 if (!(h->mainloop = PULSEAUDIO_pa_mainloop_new())) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
435 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
436 SDL_SetError("pa_mainloop_new() failed"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
437 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
438 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
439 |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
440 h->mainloop_api = PULSEAUDIO_pa_mainloop_get_api(h->mainloop); |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
441 h->context = PULSEAUDIO_pa_context_new(h->mainloop_api, get_progname()); |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
442 if (!h->context) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
443 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
444 SDL_SetError("pa_context_new() failed"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
445 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
446 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
447 |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
448 /* Connect to the PulseAudio server */ |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
449 if (PULSEAUDIO_pa_context_connect(h->context, NULL, 0, NULL) < 0) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
450 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
451 SDL_SetError("Could not setup connection to PulseAudio"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
452 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
453 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
454 |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
455 do { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
456 if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
457 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
458 SDL_SetError("pa_mainloop_iterate() failed"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
459 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
460 } |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
461 state = PULSEAUDIO_pa_context_get_state(h->context); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
462 if (!PA_CONTEXT_IS_GOOD(state)) { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
463 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
464 SDL_SetError("Could not connect to PulseAudio"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
465 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
466 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
467 } while (state != PA_CONTEXT_READY); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
468 |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
469 h->stream = PULSEAUDIO_pa_stream_new( |
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
470 h->context, |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
471 "Simple DirectMedia Layer", /* stream description */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
472 &paspec, /* sample format spec */ |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
473 &pacmap /* channel map */ |
2274 | 474 ); |
2272
25a87553a59d
Minor PulseAudio fixes: corrected OpenDevice return code, human-readable
Ryan C. Gordon <icculus@icculus.org>
parents:
2271
diff
changeset
|
475 |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
476 if (h->stream == NULL) { |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
477 PULSEAUDIO_CloseDevice(this); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
478 SDL_SetError("Could not set up PulseAudio stream"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
479 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
480 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
481 |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
482 if (PULSEAUDIO_pa_stream_connect_playback(h->stream, NULL, &paattr, flags, |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
483 NULL, NULL) < 0) { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
484 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
485 SDL_SetError("Could not connect PulseAudio stream"); |
2272
25a87553a59d
Minor PulseAudio fixes: corrected OpenDevice return code, human-readable
Ryan C. Gordon <icculus@icculus.org>
parents:
2271
diff
changeset
|
486 return 0; |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
487 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
488 |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
489 do { |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
490 if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
491 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
492 SDL_SetError("pa_mainloop_iterate() failed"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
493 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
494 } |
3674
7b597182d06b
Minor cleanups in PulseAudio code, to keep this 80-column-friendly.
Ryan C. Gordon <icculus@icculus.org>
parents:
3673
diff
changeset
|
495 state = PULSEAUDIO_pa_stream_get_state(h->stream); |
3672
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
496 if (!PA_STREAM_IS_GOOD(state)) { |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
497 PULSEAUDIO_CloseDevice(this); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
498 SDL_SetError("Could not create to PulseAudio stream"); |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
499 return 0; |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
500 } |
878d8adf2fde
Merged r4210:5510 from branches/SDL-1.2/src/audio/pulse: PulseAudio updates.
Ryan C. Gordon <icculus@icculus.org>
parents:
3068
diff
changeset
|
501 } while (state != PA_STREAM_READY); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
502 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
503 /* We're ready to rock and roll. :-) */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
504 return 1; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
505 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
506 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
507 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
508 static void |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
509 PULSEAUDIO_Deinitialize(void) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
510 { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
511 UnloadPulseAudioLibrary(); |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
512 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
513 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
514 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
515 static int |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
516 PULSEAUDIO_Init(SDL_AudioDriverImpl * impl) |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
517 { |
3673
c9d5bd1b4e18
Attempt to clean up PulseAudio dynamic loading support.
Ryan C. Gordon <icculus@icculus.org>
parents:
3672
diff
changeset
|
518 if (LoadPulseAudioLibrary() < 0) { |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
519 return 0; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
520 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
521 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
522 /* Set the function pointers */ |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
523 impl->OpenDevice = PULSEAUDIO_OpenDevice; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
524 impl->PlayDevice = PULSEAUDIO_PlayDevice; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
525 impl->WaitDevice = PULSEAUDIO_WaitDevice; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
526 impl->GetDeviceBuf = PULSEAUDIO_GetDeviceBuf; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
527 impl->CloseDevice = PULSEAUDIO_CloseDevice; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
528 impl->WaitDone = PULSEAUDIO_WaitDone; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
529 impl->Deinitialize = PULSEAUDIO_Deinitialize; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
530 impl->OnlyHasDefaultOutputDevice = 1; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
531 |
2938
2929ed239d2a
Adjusted default choice of audio driver.
Ryan C. Gordon <icculus@icculus.org>
parents:
2859
diff
changeset
|
532 /* !!! FIXME: should test if server is available here, return 2 if so. */ |
2271
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
533 return 1; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
534 } |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
535 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
536 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
537 AudioBootStrap PULSEAUDIO_bootstrap = { |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
538 PULSEAUDIO_DRIVER_NAME, "PulseAudio", PULSEAUDIO_Init, 0 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
539 }; |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
540 |
60b4c52a7906
Ported PulseAudio target from 1.2 to 1.3 interfaces, and added it to the trunk.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff
changeset
|
541 /* vi: set ts=4 sw=4 expandtab: */ |