3 #include "qemu/osdep.h"
4 #include "qemu/module.h"
6 #include "qapi/opts-visitor.h"
8 #include <pulse/pulseaudio.h>
10 #define AUDIO_CAP "pulseaudio"
11 #include "audio_int.h"
12 #include "audio_pt_int.h"
14 typedef struct PAConnection
{
17 QTAILQ_ENTRY(PAConnection
) list
;
19 pa_threaded_mainloop
*mainloop
;
23 static QTAILQ_HEAD(PAConnectionHead
, PAConnection
) pa_conns
=
24 QTAILQ_HEAD_INITIALIZER(pa_conns
);
53 const void *read_data
;
54 size_t read_index
, read_length
;
59 static void qpa_conn_fini(PAConnection
*c
);
61 static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err
, const char *fmt
, ...)
66 AUD_vlog (AUDIO_CAP
, fmt
, ap
);
69 AUD_log (AUDIO_CAP
, "Reason: %s\n", pa_strerror (err
));
72 #ifndef PA_CONTEXT_IS_GOOD
73 static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x
)
76 x
== PA_CONTEXT_CONNECTING
||
77 x
== PA_CONTEXT_AUTHORIZING
||
78 x
== PA_CONTEXT_SETTING_NAME
||
79 x
== PA_CONTEXT_READY
;
83 #ifndef PA_STREAM_IS_GOOD
84 static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x
)
87 x
== PA_STREAM_CREATING
||
92 #define CHECK_SUCCESS_GOTO(c, rerror, expression, label) \
94 if (!(expression)) { \
96 *(rerror) = pa_context_errno ((c)->context); \
102 #define CHECK_DEAD_GOTO(c, stream, rerror, label) \
104 if (!(c)->context || !PA_CONTEXT_IS_GOOD (pa_context_get_state((c)->context)) || \
105 !(stream) || !PA_STREAM_IS_GOOD (pa_stream_get_state ((stream)))) { \
106 if (((c)->context && pa_context_get_state ((c)->context) == PA_CONTEXT_FAILED) || \
107 ((stream) && pa_stream_get_state ((stream)) == PA_STREAM_FAILED)) { \
109 *(rerror) = pa_context_errno ((c)->context); \
113 *(rerror) = PA_ERR_BADSTATE; \
120 static int qpa_simple_read (PAVoiceIn
*p
, void *data
, size_t length
, int *rerror
)
122 PAConnection
*c
= p
->g
->conn
;
124 pa_threaded_mainloop_lock(c
->mainloop
);
126 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
131 while (!p
->read_data
) {
134 r
= pa_stream_peek (p
->stream
, &p
->read_data
, &p
->read_length
);
135 CHECK_SUCCESS_GOTO(c
, rerror
, r
== 0, unlock_and_fail
);
138 pa_threaded_mainloop_wait(c
->mainloop
);
139 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
145 l
= p
->read_length
< length
? p
->read_length
: length
;
146 memcpy (data
, (const uint8_t *) p
->read_data
+p
->read_index
, l
);
148 data
= (uint8_t *) data
+ l
;
154 if (!p
->read_length
) {
157 r
= pa_stream_drop (p
->stream
);
162 CHECK_SUCCESS_GOTO(c
, rerror
, r
== 0, unlock_and_fail
);
166 pa_threaded_mainloop_unlock(c
->mainloop
);
170 pa_threaded_mainloop_unlock(c
->mainloop
);
174 static int qpa_simple_write (PAVoiceOut
*p
, const void *data
, size_t length
, int *rerror
)
176 PAConnection
*c
= p
->g
->conn
;
178 pa_threaded_mainloop_lock(c
->mainloop
);
180 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
186 while (!(l
= pa_stream_writable_size (p
->stream
))) {
187 pa_threaded_mainloop_wait(c
->mainloop
);
188 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
191 CHECK_SUCCESS_GOTO(c
, rerror
, l
!= (size_t) -1, unlock_and_fail
);
197 r
= pa_stream_write (p
->stream
, data
, l
, NULL
, 0LL, PA_SEEK_RELATIVE
);
198 CHECK_SUCCESS_GOTO(c
, rerror
, r
>= 0, unlock_and_fail
);
200 data
= (const uint8_t *) data
+ l
;
204 pa_threaded_mainloop_unlock(c
->mainloop
);
208 pa_threaded_mainloop_unlock(c
->mainloop
);
212 static void *qpa_thread_out (void *arg
)
214 PAVoiceOut
*pa
= arg
;
215 HWVoiceOut
*hw
= &pa
->hw
;
217 if (audio_pt_lock(&pa
->pt
, __func__
)) {
222 int decr
, to_mix
, rpos
;
233 if (audio_pt_wait(&pa
->pt
, __func__
)) {
238 decr
= to_mix
= audio_MIN(pa
->live
, pa
->samples
>> 5);
241 if (audio_pt_unlock(&pa
->pt
, __func__
)) {
247 int chunk
= audio_MIN (to_mix
, hw
->samples
- rpos
);
248 struct st_sample
*src
= hw
->mix_buf
+ rpos
;
250 hw
->clip (pa
->pcm_buf
, src
, chunk
);
252 if (qpa_simple_write (pa
, pa
->pcm_buf
,
253 chunk
<< hw
->info
.shift
, &error
) < 0) {
254 qpa_logerr (error
, "pa_simple_write failed\n");
258 rpos
= (rpos
+ chunk
) % hw
->samples
;
262 if (audio_pt_lock(&pa
->pt
, __func__
)) {
272 audio_pt_unlock(&pa
->pt
, __func__
);
276 static int qpa_run_out (HWVoiceOut
*hw
, int live
)
279 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
281 if (audio_pt_lock(&pa
->pt
, __func__
)) {
285 decr
= audio_MIN (live
, pa
->decr
);
287 pa
->live
= live
- decr
;
290 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
293 audio_pt_unlock(&pa
->pt
, __func__
);
298 static int qpa_write (SWVoiceOut
*sw
, void *buf
, int len
)
300 return audio_pcm_sw_write (sw
, buf
, len
);
304 static void *qpa_thread_in (void *arg
)
307 HWVoiceIn
*hw
= &pa
->hw
;
309 if (audio_pt_lock(&pa
->pt
, __func__
)) {
314 int incr
, to_grab
, wpos
;
325 if (audio_pt_wait(&pa
->pt
, __func__
)) {
330 incr
= to_grab
= audio_MIN(pa
->dead
, pa
->samples
>> 5);
333 if (audio_pt_unlock(&pa
->pt
, __func__
)) {
339 int chunk
= audio_MIN (to_grab
, hw
->samples
- wpos
);
340 void *buf
= advance (pa
->pcm_buf
, wpos
);
342 if (qpa_simple_read (pa
, buf
,
343 chunk
<< hw
->info
.shift
, &error
) < 0) {
344 qpa_logerr (error
, "pa_simple_read failed\n");
348 hw
->conv (hw
->conv_buf
+ wpos
, buf
, chunk
);
349 wpos
= (wpos
+ chunk
) % hw
->samples
;
353 if (audio_pt_lock(&pa
->pt
, __func__
)) {
363 audio_pt_unlock(&pa
->pt
, __func__
);
367 static int qpa_run_in (HWVoiceIn
*hw
)
369 int live
, incr
, dead
;
370 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
372 if (audio_pt_lock(&pa
->pt
, __func__
)) {
376 live
= audio_pcm_hw_get_live_in (hw
);
377 dead
= hw
->samples
- live
;
378 incr
= audio_MIN (dead
, pa
->incr
);
380 pa
->dead
= dead
- incr
;
383 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
386 audio_pt_unlock(&pa
->pt
, __func__
);
391 static int qpa_read (SWVoiceIn
*sw
, void *buf
, int len
)
393 return audio_pcm_sw_read (sw
, buf
, len
);
396 static pa_sample_format_t
audfmt_to_pa (AudioFormat afmt
, int endianness
)
401 case AUDIO_FORMAT_S8
:
402 case AUDIO_FORMAT_U8
:
403 format
= PA_SAMPLE_U8
;
405 case AUDIO_FORMAT_S16
:
406 case AUDIO_FORMAT_U16
:
407 format
= endianness
? PA_SAMPLE_S16BE
: PA_SAMPLE_S16LE
;
409 case AUDIO_FORMAT_S32
:
410 case AUDIO_FORMAT_U32
:
411 format
= endianness
? PA_SAMPLE_S32BE
: PA_SAMPLE_S32LE
;
414 dolog ("Internal logic error: Bad audio format %d\n", afmt
);
415 format
= PA_SAMPLE_U8
;
421 static AudioFormat
pa_to_audfmt (pa_sample_format_t fmt
, int *endianness
)
425 return AUDIO_FORMAT_U8
;
426 case PA_SAMPLE_S16BE
:
428 return AUDIO_FORMAT_S16
;
429 case PA_SAMPLE_S16LE
:
431 return AUDIO_FORMAT_S16
;
432 case PA_SAMPLE_S32BE
:
434 return AUDIO_FORMAT_S32
;
435 case PA_SAMPLE_S32LE
:
437 return AUDIO_FORMAT_S32
;
439 dolog ("Internal logic error: Bad pa_sample_format %d\n", fmt
);
440 return AUDIO_FORMAT_U8
;
444 static void context_state_cb (pa_context
*c
, void *userdata
)
446 PAConnection
*conn
= userdata
;
448 switch (pa_context_get_state(c
)) {
449 case PA_CONTEXT_READY
:
450 case PA_CONTEXT_TERMINATED
:
451 case PA_CONTEXT_FAILED
:
452 pa_threaded_mainloop_signal(conn
->mainloop
, 0);
455 case PA_CONTEXT_UNCONNECTED
:
456 case PA_CONTEXT_CONNECTING
:
457 case PA_CONTEXT_AUTHORIZING
:
458 case PA_CONTEXT_SETTING_NAME
:
463 static void stream_state_cb (pa_stream
*s
, void * userdata
)
465 PAConnection
*c
= userdata
;
467 switch (pa_stream_get_state (s
)) {
469 case PA_STREAM_READY
:
470 case PA_STREAM_FAILED
:
471 case PA_STREAM_TERMINATED
:
472 pa_threaded_mainloop_signal(c
->mainloop
, 0);
475 case PA_STREAM_UNCONNECTED
:
476 case PA_STREAM_CREATING
:
481 static void stream_request_cb (pa_stream
*s
, size_t length
, void *userdata
)
483 PAConnection
*c
= userdata
;
485 pa_threaded_mainloop_signal(c
->mainloop
, 0);
488 static pa_stream
*qpa_simple_new (
491 pa_stream_direction_t dir
,
493 const pa_sample_spec
*ss
,
494 const pa_channel_map
*map
,
495 const pa_buffer_attr
*attr
,
500 pa_stream_flags_t flags
;
502 pa_threaded_mainloop_lock(c
->mainloop
);
504 stream
= pa_stream_new(c
->context
, name
, ss
, map
);
509 pa_stream_set_state_callback(stream
, stream_state_cb
, c
);
510 pa_stream_set_read_callback(stream
, stream_request_cb
, c
);
511 pa_stream_set_write_callback(stream
, stream_request_cb
, c
);
514 PA_STREAM_INTERPOLATE_TIMING
515 #ifdef PA_STREAM_ADJUST_LATENCY
516 | PA_STREAM_ADJUST_LATENCY
518 | PA_STREAM_AUTO_TIMING_UPDATE
;
520 if (dir
== PA_STREAM_PLAYBACK
) {
521 r
= pa_stream_connect_playback(stream
, dev
, attr
, flags
, NULL
, NULL
);
523 r
= pa_stream_connect_record(stream
, dev
, attr
, flags
);
530 pa_threaded_mainloop_unlock(c
->mainloop
);
535 pa_threaded_mainloop_unlock(c
->mainloop
);
538 pa_stream_unref (stream
);
541 *rerror
= pa_context_errno(c
->context
);
546 static int qpa_init_out(HWVoiceOut
*hw
, struct audsettings
*as
,
552 struct audsettings obt_as
= *as
;
553 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
554 paaudio
*g
= pa
->g
= drv_opaque
;
555 AudiodevPaOptions
*popts
= &g
->dev
->u
.pa
;
556 AudiodevPaPerDirectionOptions
*ppdo
= popts
->out
;
557 PAConnection
*c
= g
->conn
;
559 ss
.format
= audfmt_to_pa (as
->fmt
, as
->endianness
);
560 ss
.channels
= as
->nchannels
;
563 ba
.tlength
= pa_usec_to_bytes(ppdo
->latency
, &ss
);
568 obt_as
.fmt
= pa_to_audfmt (ss
.format
, &obt_as
.endianness
);
570 pa
->stream
= qpa_simple_new (
574 ppdo
->has_name
? ppdo
->name
: NULL
,
576 NULL
, /* channel map */
577 &ba
, /* buffering attributes */
581 qpa_logerr (error
, "pa_simple_new for playback failed\n");
585 audio_pcm_init_info (&hw
->info
, &obt_as
);
586 hw
->samples
= pa
->samples
= audio_buffer_samples(
587 qapi_AudiodevPaPerDirectionOptions_base(ppdo
),
588 &obt_as
, ppdo
->buffer_length
);
589 pa
->pcm_buf
= audio_calloc(__func__
, hw
->samples
, 1 << hw
->info
.shift
);
592 dolog ("Could not allocate buffer (%d bytes)\n",
593 hw
->samples
<< hw
->info
.shift
);
597 if (audio_pt_init(&pa
->pt
, qpa_thread_out
, hw
, AUDIO_CAP
, __func__
)) {
604 g_free (pa
->pcm_buf
);
608 pa_stream_unref (pa
->stream
);
615 static int qpa_init_in(HWVoiceIn
*hw
, struct audsettings
*as
, void *drv_opaque
)
620 struct audsettings obt_as
= *as
;
621 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
622 paaudio
*g
= pa
->g
= drv_opaque
;
623 AudiodevPaOptions
*popts
= &g
->dev
->u
.pa
;
624 AudiodevPaPerDirectionOptions
*ppdo
= popts
->in
;
625 PAConnection
*c
= g
->conn
;
627 ss
.format
= audfmt_to_pa (as
->fmt
, as
->endianness
);
628 ss
.channels
= as
->nchannels
;
631 ba
.fragsize
= pa_usec_to_bytes(ppdo
->latency
, &ss
);
632 ba
.maxlength
= pa_usec_to_bytes(ppdo
->latency
* 2, &ss
);
636 obt_as
.fmt
= pa_to_audfmt (ss
.format
, &obt_as
.endianness
);
638 pa
->stream
= qpa_simple_new (
642 ppdo
->has_name
? ppdo
->name
: NULL
,
644 NULL
, /* channel map */
645 &ba
, /* buffering attributes */
649 qpa_logerr (error
, "pa_simple_new for capture failed\n");
653 audio_pcm_init_info (&hw
->info
, &obt_as
);
654 hw
->samples
= pa
->samples
= audio_buffer_samples(
655 qapi_AudiodevPaPerDirectionOptions_base(ppdo
),
656 &obt_as
, ppdo
->buffer_length
);
657 pa
->pcm_buf
= audio_calloc(__func__
, hw
->samples
, 1 << hw
->info
.shift
);
660 dolog ("Could not allocate buffer (%d bytes)\n",
661 hw
->samples
<< hw
->info
.shift
);
665 if (audio_pt_init(&pa
->pt
, qpa_thread_in
, hw
, AUDIO_CAP
, __func__
)) {
672 g_free (pa
->pcm_buf
);
676 pa_stream_unref (pa
->stream
);
683 static void qpa_fini_out (HWVoiceOut
*hw
)
686 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
688 audio_pt_lock(&pa
->pt
, __func__
);
690 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
691 audio_pt_join(&pa
->pt
, &ret
, __func__
);
694 pa_stream_unref (pa
->stream
);
698 audio_pt_fini(&pa
->pt
, __func__
);
699 g_free (pa
->pcm_buf
);
703 static void qpa_fini_in (HWVoiceIn
*hw
)
706 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
708 audio_pt_lock(&pa
->pt
, __func__
);
710 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
711 audio_pt_join(&pa
->pt
, &ret
, __func__
);
714 pa_stream_unref (pa
->stream
);
718 audio_pt_fini(&pa
->pt
, __func__
);
719 g_free (pa
->pcm_buf
);
723 static int qpa_ctl_out (HWVoiceOut
*hw
, int cmd
, ...)
725 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
728 PAConnection
*c
= pa
->g
->conn
;
730 #ifdef PA_CHECK_VERSION /* macro is present in 0.9.16+ */
731 pa_cvolume_init (&v
); /* function is present in 0.9.13+ */
741 sw
= va_arg (ap
, SWVoiceOut
*);
745 v
.values
[0] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.l
) / UINT32_MAX
;
746 v
.values
[1] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.r
) / UINT32_MAX
;
748 pa_threaded_mainloop_lock(c
->mainloop
);
750 op
= pa_context_set_sink_input_volume(c
->context
,
751 pa_stream_get_index (pa
->stream
),
754 qpa_logerr(pa_context_errno(c
->context
),
755 "set_sink_input_volume() failed\n");
757 pa_operation_unref(op
);
760 op
= pa_context_set_sink_input_mute(c
->context
,
761 pa_stream_get_index (pa
->stream
),
762 sw
->vol
.mute
, NULL
, NULL
);
764 qpa_logerr(pa_context_errno(c
->context
),
765 "set_sink_input_mute() failed\n");
767 pa_operation_unref(op
);
770 pa_threaded_mainloop_unlock(c
->mainloop
);
776 static int qpa_ctl_in (HWVoiceIn
*hw
, int cmd
, ...)
778 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
781 PAConnection
*c
= pa
->g
->conn
;
783 #ifdef PA_CHECK_VERSION
784 pa_cvolume_init (&v
);
794 sw
= va_arg (ap
, SWVoiceIn
*);
798 v
.values
[0] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.l
) / UINT32_MAX
;
799 v
.values
[1] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.r
) / UINT32_MAX
;
801 pa_threaded_mainloop_lock(c
->mainloop
);
803 op
= pa_context_set_source_output_volume(c
->context
,
804 pa_stream_get_index(pa
->stream
),
807 qpa_logerr(pa_context_errno(c
->context
),
808 "set_source_output_volume() failed\n");
810 pa_operation_unref(op
);
813 op
= pa_context_set_source_output_mute(c
->context
,
814 pa_stream_get_index (pa
->stream
),
815 sw
->vol
.mute
, NULL
, NULL
);
817 qpa_logerr(pa_context_errno(c
->context
),
818 "set_source_output_mute() failed\n");
820 pa_operation_unref (op
);
823 pa_threaded_mainloop_unlock(c
->mainloop
);
829 static int qpa_validate_per_direction_opts(Audiodev
*dev
,
830 AudiodevPaPerDirectionOptions
*pdo
)
832 if (!pdo
->has_buffer_length
) {
833 pdo
->has_buffer_length
= true;
834 pdo
->buffer_length
= 46440;
836 if (!pdo
->has_latency
) {
837 pdo
->has_latency
= true;
838 pdo
->latency
= 15000;
844 static void *qpa_conn_init(const char *server
)
846 PAConnection
*c
= g_malloc0(sizeof(PAConnection
));
847 QTAILQ_INSERT_TAIL(&pa_conns
, c
, list
);
849 c
->mainloop
= pa_threaded_mainloop_new();
854 c
->context
= pa_context_new(pa_threaded_mainloop_get_api(c
->mainloop
),
860 pa_context_set_state_callback(c
->context
, context_state_cb
, c
);
862 if (pa_context_connect(c
->context
, server
, 0, NULL
) < 0) {
863 qpa_logerr(pa_context_errno(c
->context
),
864 "pa_context_connect() failed\n");
868 pa_threaded_mainloop_lock(c
->mainloop
);
870 if (pa_threaded_mainloop_start(c
->mainloop
) < 0) {
871 goto unlock_and_fail
;
875 pa_context_state_t state
;
877 state
= pa_context_get_state(c
->context
);
879 if (state
== PA_CONTEXT_READY
) {
883 if (!PA_CONTEXT_IS_GOOD(state
)) {
884 qpa_logerr(pa_context_errno(c
->context
),
885 "Wrong context state\n");
886 goto unlock_and_fail
;
889 /* Wait until the context is ready */
890 pa_threaded_mainloop_wait(c
->mainloop
);
893 pa_threaded_mainloop_unlock(c
->mainloop
);
897 pa_threaded_mainloop_unlock(c
->mainloop
);
899 AUD_log (AUDIO_CAP
, "Failed to initialize PA context");
904 static void *qpa_audio_init(Audiodev
*dev
)
907 AudiodevPaOptions
*popts
= &dev
->u
.pa
;
911 assert(dev
->driver
== AUDIODEV_DRIVER_PA
);
913 if (!popts
->has_server
) {
918 runtime
= getenv("XDG_RUNTIME_DIR");
922 snprintf(pidfile
, sizeof(pidfile
), "%s/pulse/pid", runtime
);
923 if (stat(pidfile
, &st
) != 0) {
928 if (!qpa_validate_per_direction_opts(dev
, popts
->in
)) {
931 if (!qpa_validate_per_direction_opts(dev
, popts
->out
)) {
935 g
= g_malloc0(sizeof(paaudio
));
936 server
= popts
->has_server
? popts
->server
: NULL
;
940 QTAILQ_FOREACH(c
, &pa_conns
, list
) {
941 if (server
== NULL
|| c
->server
== NULL
?
942 server
== c
->server
:
943 strcmp(server
, c
->server
) == 0) {
949 g
->conn
= qpa_conn_init(server
);
960 static void qpa_conn_fini(PAConnection
*c
)
963 pa_threaded_mainloop_stop(c
->mainloop
);
967 pa_context_disconnect(c
->context
);
968 pa_context_unref(c
->context
);
972 pa_threaded_mainloop_free(c
->mainloop
);
975 QTAILQ_REMOVE(&pa_conns
, c
, list
);
979 static void qpa_audio_fini (void *opaque
)
982 PAConnection
*c
= g
->conn
;
984 if (--c
->refcount
== 0) {
991 static struct audio_pcm_ops qpa_pcm_ops
= {
992 .init_out
= qpa_init_out
,
993 .fini_out
= qpa_fini_out
,
994 .run_out
= qpa_run_out
,
996 .ctl_out
= qpa_ctl_out
,
998 .init_in
= qpa_init_in
,
999 .fini_in
= qpa_fini_in
,
1000 .run_in
= qpa_run_in
,
1002 .ctl_in
= qpa_ctl_in
1005 static struct audio_driver pa_audio_driver
= {
1007 .descr
= "http://www.pulseaudio.org/",
1008 .init
= qpa_audio_init
,
1009 .fini
= qpa_audio_fini
,
1010 .pcm_ops
= &qpa_pcm_ops
,
1011 .can_be_default
= 1,
1012 .max_voices_out
= INT_MAX
,
1013 .max_voices_in
= INT_MAX
,
1014 .voice_size_out
= sizeof (PAVoiceOut
),
1015 .voice_size_in
= sizeof (PAVoiceIn
),
1016 .ctl_caps
= VOICE_VOLUME_CAP
1019 static void register_audio_pa(void)
1021 audio_driver_register(&pa_audio_driver
);
1023 type_init(register_audio_pa
);