116 lines
2.7 KiB
Text
116 lines
2.7 KiB
Text
$NetBSD: patch-ab,v 1.2 2002/10/08 12:30:57 jlam Exp $
|
|
|
|
--- mixer.c.orig Thu Nov 7 08:00:26 1996
|
|
+++ mixer.c
|
|
@@ -104,6 +104,14 @@ STATIC ctlinfo_t ctlsav; /* Saved state
|
|
***********************/
|
|
|
|
|
|
+#ifdef __NetBSD__
|
|
+void
|
|
+mxchg(int sig)
|
|
+{
|
|
+ deliverSIGIO();
|
|
+}
|
|
+#endif
|
|
+
|
|
/*
|
|
* do_ioctl
|
|
* Perform ioctl command. If file is not yet open or if we
|
|
@@ -201,12 +209,18 @@ mx_queryhw(widgets_t *m)
|
|
ctlinfo.slinfo[i].right = ((level >> 8) & 0xff);
|
|
|
|
/* Sanity check */
|
|
- if (ctlinfo.slinfo[i].left > 100)
|
|
- ctlinfo.slinfo[i].left = 100;
|
|
+#if defined(__NetBSD__) && \
|
|
+ !defined(OPEN_SOUND_SYSTEM) && !defined(UNIX_SOUND_SYSTEM)
|
|
+# define SLIDER_MAX 255
|
|
+#else
|
|
+# define SLIDER_MAX 100
|
|
+#endif
|
|
+ if (ctlinfo.slinfo[i].left > SLIDER_MAX)
|
|
+ ctlinfo.slinfo[i].left = SLIDER_MAX;
|
|
else if (ctlinfo.slinfo[i].left < 0)
|
|
ctlinfo.slinfo[i].left = 0;
|
|
- if (ctlinfo.slinfo[i].right > 100)
|
|
- ctlinfo.slinfo[i].right = 100;
|
|
+ if (ctlinfo.slinfo[i].right > SLIDER_MAX)
|
|
+ ctlinfo.slinfo[i].right = SLIDER_MAX;
|
|
else if (ctlinfo.slinfo[i].right < 0)
|
|
ctlinfo.slinfo[i].right = 0;
|
|
|
|
@@ -674,18 +688,25 @@ mx_init_drv(void)
|
|
}
|
|
|
|
/* Set maximum number of devices supported */
|
|
+#if defined(__NetBSD__) && \
|
|
+ !defined(OPEN_SOUND_SYSTEM) && !defined(UNIX_SOUND_SYSTEM)
|
|
+ maxdevs = SOUND_MIXER_NRDEVICES;
|
|
+#else
|
|
maxdevs = MAXDEVS_V3;
|
|
+#endif
|
|
|
|
strcpy(drv_ver, "unknown");
|
|
|
|
/* Query sound driver version */
|
|
if ((fp = fopen("/dev/sndstat", "r")) == NULL) {
|
|
if (!app_data.demo) {
|
|
+#if defined(OPEN_SOUND_SYSTEM) || defined(UNIX_SOUND_SYSTEM)
|
|
fprintf(errfp, "%s: %s: %s\n",
|
|
PROGNAME,
|
|
"Cannot open /dev/sndstat",
|
|
"assuming pre-3.0 sound driver.");
|
|
maxdevs = MAXDEVS_V2;
|
|
+#endif
|
|
}
|
|
return;
|
|
}
|
|
@@ -915,6 +936,7 @@ void
|
|
mx_start(widgets_t *m)
|
|
{
|
|
char msg[256];
|
|
+ int one = 1;
|
|
|
|
if (app_data.autoload != NULL && app_data.autoload[0] != '\0' &&
|
|
strcmp(app_data.autoload, "/dev/null") != 0) {
|
|
@@ -930,6 +952,16 @@ mx_start(widgets_t *m)
|
|
}
|
|
}
|
|
|
|
+#if defined(__NetBSD__)
|
|
+ signal(SIGIO, mxchg);
|
|
+#if !defined(OPEN_SOUND_SYSTEM) && !defined(UNIX_SOUND_SYSTEM)
|
|
+ do_ioctl(FIOASYNC, &one, "FIOASYNC", IOC_DATA_NONE);
|
|
+#endif
|
|
+#endif
|
|
+
|
|
+ /* Query hardware mixer settings */
|
|
+ mx_queryhw(&widgets);
|
|
+
|
|
/* Update screen controls to match current status */
|
|
mx_updctl(m);
|
|
}
|
|
@@ -1531,6 +1563,22 @@ mx_focuschg(Widget w, XtPointer client_d
|
|
if (p->reason != XmCR_FOCUS || form == (Widget) NULL)
|
|
return;
|
|
|
|
+ /* Query hardware mixer settings */
|
|
+ mx_queryhw(&widgets);
|
|
+
|
|
+ /* Update screen controls */
|
|
+ mx_updctl(&widgets);
|
|
+}
|
|
+
|
|
+
|
|
+/*
|
|
+ * mx_change
|
|
+ * Mixer device has changed
|
|
+ */
|
|
+/*ARGSUSED*/
|
|
+void
|
|
+mx_change(XtPointer client_data)
|
|
+{
|
|
/* Query hardware mixer settings */
|
|
mx_queryhw(&widgets);
|
|
|