]>
code.delx.au - pulseaudio/blob - polyp/core.c
dc9525a8f62f18871b9dcf587b4e08f03269ab18
4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
37 struct pa_core
* pa_core_new(struct pa_mainloop_api
*m
) {
39 c
= malloc(sizeof(struct pa_core
));
43 c
->clients
= pa_idxset_new(NULL
, NULL
);
44 c
->sinks
= pa_idxset_new(NULL
, NULL
);
45 c
->sources
= pa_idxset_new(NULL
, NULL
);
46 c
->source_outputs
= pa_idxset_new(NULL
, NULL
);
47 c
->sink_inputs
= pa_idxset_new(NULL
, NULL
);
49 c
->default_source_index
= c
->default_sink_index
= PA_IDXSET_INVALID
;
54 c
->default_sample_spec
.format
= PA_SAMPLE_S16NE
;
55 c
->default_sample_spec
.rate
= 44100;
56 c
->default_sample_spec
.channels
= 2;
58 pa_check_for_sigpipe();
63 void pa_core_free(struct pa_core
*c
) {
66 pa_module_unload_all(c
);
69 assert(pa_idxset_isempty(c
->clients
));
70 pa_idxset_free(c
->clients
, NULL
, NULL
);
72 assert(pa_idxset_isempty(c
->sinks
));
73 pa_idxset_free(c
->sinks
, NULL
, NULL
);
75 assert(pa_idxset_isempty(c
->sources
));
76 pa_idxset_free(c
->sources
, NULL
, NULL
);
78 assert(pa_idxset_isempty(c
->source_outputs
));
79 pa_idxset_free(c
->source_outputs
, NULL
, NULL
);
81 assert(pa_idxset_isempty(c
->sink_inputs
));
82 pa_idxset_free(c
->sink_inputs
, NULL
, NULL
);