PA_MODULE_LOAD_ONCE(TRUE);
PA_MODULE_USAGE(
"tsched=<enable system timer based scheduling mode?> "
+ "fixed_latency_range=<disable latency range changes on underrun?> "
"ignore_dB=<ignore dB information from the device?> "
- "sync_volume=<syncronize sw and hw voluchanges in IO-thread?>");
+ "deferred_volume=<syncronize sw and hw volume changes in IO-thread?>");
struct device {
char *path;
pa_hashmap *devices;
pa_bool_t use_tsched:1;
+ pa_bool_t fixed_latency_range:1;
pa_bool_t ignore_dB:1;
- pa_bool_t sync_volume:1;
+ pa_bool_t deferred_volume:1;
struct udev* udev;
struct udev_monitor *monitor;
static const char* const valid_modargs[] = {
"tsched",
+ "fixed_latency_range",
"ignore_dB",
- "sync_volume",
+ "deferred_volume",
NULL
};
goto finish;
}
- t = pa_sprintf_malloc("%s/class/sound/card%s", udev_get_sys_path(udev), card_idx);
+ t = pa_sprintf_malloc("/sys/class/sound/card%s", card_idx);
card = udev_device_new_from_syspath(udev, t);
pa_xfree(t);
pa_assert(u);
pa_assert(d);
- cd = pa_sprintf_malloc("%s/snd/controlC%s", udev_get_dev_path(u->udev), path_get_card_id(d->path));
+ cd = pa_sprintf_malloc("/dev/snd/controlC%s", path_get_card_id(d->path));
accessible = access(cd, R_OK|W_OK) >= 0;
pa_log_debug("%s is accessible: %s", cd, pa_yes_no(accessible));
* A clean fix would be if we would be able to ignore
* our own inotify close events. However, inotify
* lacks such functionality. Also, during probing of
- * the device we cannot really distuingish between
+ * the device we cannot really distinguish between
* other processes causing EBUSY or ourselves, which
* means we have no way to figure out if the probing
* during opening was canceled by a "try again"
* failure or a "fatal" failure. */
- if (pa_ratelimit_test(&d->ratelimit)) {
+ if (pa_ratelimit_test(&d->ratelimit, PA_LOG_DEBUG)) {
pa_log_debug("Loading module-alsa-card with arguments '%s'", d->args);
m = pa_module_load(u->core, "module-alsa-card", d->args);
"card_name=\"%s\" "
"namereg_fail=false "
"tsched=%s "
+ "fixed_latency_range=%s "
"ignore_dB=%s "
- "sync_volume=%s "
+ "deferred_volume=%s "
"card_properties=\"module-udev-detect.discovered=1\"",
path_get_card_id(path),
n,
d->card_name,
pa_yes_no(u->use_tsched),
+ pa_yes_no(u->fixed_latency_range),
pa_yes_no(u->ignore_dB),
- pa_yes_no(u->sync_volume));
+ pa_yes_no(u->deferred_volume));
pa_xfree(n);
pa_hashmap_put(u->devices, d->path, d);
if (action && pa_streq(action, "remove"))
remove_card(u, dev);
- else if ((!action || pa_streq(action, "change")) &&
- udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
+ else if ((!action || pa_streq(action, "change")) && udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
card_changed(u, dev);
/* For an explanation why we don't look for 'add' events here
}
static int setup_inotify(struct userdata *u) {
- char *dev_snd;
int r;
if (u->inotify_fd >= 0)
return -1;
}
- dev_snd = pa_sprintf_malloc("%s/snd", udev_get_dev_path(u->udev));
- r = inotify_add_watch(u->inotify_fd, dev_snd, IN_ATTRIB|IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF);
- pa_xfree(dev_snd);
+ r = inotify_add_watch(u->inotify_fd, "/dev/snd", IN_ATTRIB|IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF);
if (r < 0) {
int saved_errno = errno;
struct udev_enumerate *enumerate = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
int fd;
- pa_bool_t use_tsched = TRUE, ignore_dB = FALSE, sync_volume = m->core->sync_volume;
+ pa_bool_t use_tsched = TRUE, fixed_latency_range = FALSE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume;
pa_assert(m);
}
u->use_tsched = use_tsched;
+ if (pa_modargs_get_value_boolean(ma, "fixed_latency_range", &fixed_latency_range) < 0) {
+ pa_log("Failed to parse fixed_latency_range= argument.");
+ goto fail;
+ }
+ u->fixed_latency_range = fixed_latency_range;
+
if (pa_modargs_get_value_boolean(ma, "ignore_dB", &ignore_dB) < 0) {
pa_log("Failed to parse ignore_dB= argument.");
goto fail;
}
u->ignore_dB = ignore_dB;
- if (pa_modargs_get_value_boolean(ma, "sync_volume", &sync_volume) < 0) {
- pa_log("Failed to parse sync_volume= argument.");
+ if (pa_modargs_get_value_boolean(ma, "deferred_volume", &deferred_volume) < 0) {
+ pa_log("Failed to parse deferred_volume= argument.");
goto fail;
}
- u->sync_volume = sync_volume;
+ u->deferred_volume = deferred_volume;
if (!(u->udev = udev_new())) {
pa_log("Failed to initialize udev library.");
pa_log("Failed to enable monitor: %s", pa_cstrerror(errno));
if (errno == EPERM)
pa_log_info("Most likely your kernel is simply too old and "
- "allows only priviliged processes to listen to device events. "
+ "allows only privileged processes to listen to device events. "
"Please upgrade your kernel to at least 2.6.30.");
goto fail;
}