This file is part of polypaudio.
polypaudio is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
+ it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with polypaudio; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA.
PA_MODULE_VERSION(PACKAGE_VERSION)
PA_MODULE_USAGE("source_name=<name for the source> device=<ALSA device> format=<sample format> channels=<number of channels> rate=<sample rate> fragments=<number of fragments> fragment_size=<fragment size>")
+#define PA_TYPEID_ALSA PA_TYPEID_MAKE('A', 'L', 'S', 'A')
+
struct userdata {
snd_pcm_t *pcm_handle;
struct pa_source *source;
const char *dev;
struct pa_sample_spec ss;
unsigned periods, fragsize;
- snd_pcm_uframes_t buffer_size;
+ snd_pcm_uframes_t period_size;
size_t frame_size;
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log(__FILE__": failed to parse buffer metrics\n");
goto fail;
}
- buffer_size = fragsize/frame_size*periods;
+ period_size = fragsize;
u = pa_xmalloc0(sizeof(struct userdata));
m->userdata = u;
goto fail;
}
- if (pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &buffer_size) < 0) {
+ if (pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size) < 0) {
pa_log(__FILE__": Failed to set hardware parameters\n");
goto fail;
}
- u->source = pa_source_new(c, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss);
+ u->source = pa_source_new(c, PA_TYPEID_ALSA, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss);
assert(u->source);
u->source->userdata = u;
}
u->frame_size = frame_size;
- u->fragment_size = buffer_size*u->frame_size/periods;
+ u->fragment_size = period_size;
pa_log(__FILE__": using %u fragments of size %u bytes.\n", periods, u->fragment_size);