line[strcspn(line, "\r\n")] = 0;
if (!b) {
- b = strcmp(line, "Audio devices:") == 0;
+ b = strcmp(line, "Audio devices:") == 0 || strcmp(line, "Installed devices:") == 0;
continue;
}
if (line[0] == 0)
break;
- if (sscanf(line, "%u: ", &device) != 1)
- continue;
-
- if (device == 0)
- snprintf(args, sizeof(args), "device=/dev/dsp");
- else
- snprintf(args, sizeof(args), "device=/dev/dsp%u", device);
-
- if (!pa_module_load(c, "module-oss", args))
- continue;
+ if (sscanf(line, "%u: ", &device) == 1) {
+ if (device == 0)
+ snprintf(args, sizeof(args), "device=/dev/dsp");
+ else
+ snprintf(args, sizeof(args), "device=/dev/dsp%u", device);
+
+ if (!pa_module_load(c, "module-oss", args))
+ continue;
+
+ } else if (sscanf(line, "pcm%u: ", &device) == 1) {
+ /* FreeBSD support, the devices are named /dev/dsp0.0, dsp0.1 and so on */
+ snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device);
+
+ if (!pa_module_load(c, "module-oss", args))
+ continue;
+ }
n++;