Lines 42-48
Link Here
|
42 |
oss->ext.private_data = oss; |
42 |
oss->ext.private_data = oss; |
43 |
--- oss/pcm_oss.c.orig 2009-08-31 21:09:41.000000000 +0800 |
43 |
--- oss/pcm_oss.c.orig 2009-08-31 21:09:41.000000000 +0800 |
44 |
+++ oss/pcm_oss.c 2009-09-28 14:54:12.000000000 +0800 |
44 |
+++ oss/pcm_oss.c 2009-09-28 14:54:12.000000000 +0800 |
45 |
@@ -22,17 +22,55 @@ |
45 |
@@ -22,17 +22,48 @@ |
46 |
#include <sys/ioctl.h> |
46 |
#include <sys/ioctl.h> |
47 |
#include <alsa/asoundlib.h> |
47 |
#include <alsa/asoundlib.h> |
48 |
#include <alsa/pcm_external.h> |
48 |
#include <alsa/pcm_external.h> |
Lines 54-71
Link Here
|
54 |
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) |
54 |
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) |
55 |
+ |
55 |
+ |
56 |
+#ifdef __FreeBSD__ |
56 |
+#ifdef __FreeBSD__ |
57 |
+/* #define FREEBSD_OSS_USE_IO_PTR 1 */ |
|
|
58 |
+/* #define FREEBSD_OSS_BLKCNT_P2 1 */ |
59 |
+/* #define FREEBSD_OSS_DEBUG_VERBOSE 1 */ |
60 |
+#undef FREEBSD_OSS_USE_IO_PTR /* _IPTR is buggy ... Grr... */ |
61 |
+#undef FREEBSD_OSS_BLKCNT_P2 |
62 |
+#undef FREEBSD_OSS_DEBUG_VERBOSE |
63 |
+ |
64 |
+#define FREEBSD_OSS_RATE_MIN 1 |
57 |
+#define FREEBSD_OSS_RATE_MIN 1 |
65 |
+#define FREEBSD_OSS_RATE_MAX 384000 |
58 |
+#define FREEBSD_OSS_RATE_MAX 384000 |
66 |
+ |
59 |
+ |
67 |
+#define FREEBSD_OSS_CHANNELS_MIN 1 |
60 |
+#define FREEBSD_OSS_CHANNELS_MIN 1 |
68 |
+#if __FreeBSD_version >= 800096 |
61 |
+#ifndef __DragonFly__ |
69 |
+#define FREEBSD_OSS_CHANNELS_MAX 8 |
62 |
+#define FREEBSD_OSS_CHANNELS_MAX 8 |
70 |
+#else |
63 |
+#else |
71 |
+#define FREEBSD_OSS_CHANNELS_MAX 2 |
64 |
+#define FREEBSD_OSS_CHANNELS_MAX 2 |
Lines 73-79
Link Here
|
73 |
+ |
66 |
+ |
74 |
+#define FREEBSD_OSS_BUFSZ_MAX 131072 |
67 |
+#define FREEBSD_OSS_BUFSZ_MAX 131072 |
75 |
+#define FREEBSD_OSS_BLKCNT_MIN 2 |
68 |
+#define FREEBSD_OSS_BLKCNT_MIN 2 |
76 |
+#define FREEBSD_OSS_BLKSZ_MIN 16 /* (FREEBSD_OSS_CHANNEL_MAX * 4) */ |
69 |
+#define FREEBSD_OSS_BLKSZ_MIN 16 /* (FREEBSD_OSS_CHANNELS_MAX * 4) */ |
77 |
+ |
70 |
+ |
78 |
+#define FREEBSD_OSS_BUFSZ_MIN (FREEBSD_OSS_BLKCNT_MIN * FREEBSD_OSS_BLKSZ_MIN) |
71 |
+#define FREEBSD_OSS_BUFSZ_MIN (FREEBSD_OSS_BLKCNT_MIN * FREEBSD_OSS_BLKSZ_MIN) |
79 |
+#define FREEBSD_OSS_BLKCNT_MAX (FREEBSD_OSS_BUFSZ_MAX / FREEBSD_OSS_BUFSZ_MIN) |
72 |
+#define FREEBSD_OSS_BLKCNT_MAX (FREEBSD_OSS_BUFSZ_MAX / FREEBSD_OSS_BUFSZ_MIN) |
Lines 461-467
Link Here
|
461 |
|
454 |
|
462 |
if ((flags = fcntl(oss->fd, F_GETFL)) < 0) { |
455 |
if ((flags = fcntl(oss->fd, F_GETFL)) < 0) { |
463 |
err = -errno; |
456 |
err = -errno; |
464 |
@@ -229,10 +530,128 @@ |
457 |
@@ -229,10 +530,146 @@ |
465 |
return 0; |
458 |
return 0; |
466 |
} |
459 |
} |
467 |
|
460 |
|
Lines 478-483
Link Here
|
478 |
+#ifdef FREEBSD_OSS_BLKCNT_P2 |
471 |
+#ifdef FREEBSD_OSS_BLKCNT_P2 |
479 |
+ unsigned int period_list[30]; |
472 |
+ unsigned int period_list[30]; |
480 |
+#endif |
473 |
+#endif |
|
|
474 |
+#ifdef FREEBSD_OSS_BUFSZ_P2 |
475 |
+ unsigned int bufsz_list[30]; |
476 |
+#endif |
481 |
+ unsigned int nformats; |
477 |
+ unsigned int nformats; |
482 |
+ unsigned int format[ARRAY_SIZE(oss_formats_tab)]; |
478 |
+ unsigned int format[ARRAY_SIZE(oss_formats_tab)]; |
483 |
+#if 0 |
479 |
+#if 0 |
Lines 580-585
Link Here
|
580 |
+ if (err < 0) |
576 |
+ if (err < 0) |
581 |
+ return err; |
577 |
+ return err; |
582 |
+ |
578 |
+ |
|
|
579 |
+#ifdef FREEBSD_OSS_BUFSZ_P2 |
580 |
+ tmp = 0; |
581 |
+ for (i = 1; i < 31 && tmp < ARRAY_SIZE(bufsz_list); i++) { |
582 |
+ if ((1 << i) > FREEBSD_OSS_BUFSZ_MAX) |
583 |
+ break; |
584 |
+ if ((1 << i) < FREEBSD_OSS_BUFSZ_MIN) |
585 |
+ continue; |
586 |
+ bufsz_list[tmp++] = 1 << i; |
587 |
+ } |
588 |
+ |
589 |
+ if (tmp > 0) |
590 |
+ err = snd_pcm_ioplug_set_param_list(io, |
591 |
+ SND_PCM_IOPLUG_HW_BUFFER_BYTES, tmp, bufsz_list); |
592 |
+ else |
593 |
+#endif |
583 |
+ /* buffer size , not strictly ^2 */ |
594 |
+ /* buffer size , not strictly ^2 */ |
584 |
+ err = snd_pcm_ioplug_set_param_minmax(io, |
595 |
+ err = snd_pcm_ioplug_set_param_minmax(io, |
585 |
+ SND_PCM_IOPLUG_HW_BUFFER_BYTES, FREEBSD_OSS_BUFSZ_MIN, |
596 |
+ SND_PCM_IOPLUG_HW_BUFFER_BYTES, FREEBSD_OSS_BUFSZ_MIN, |