diff options
author | John-Mark Gurney <jmg@FreeBSD.org> | 1997-09-03 22:10:47 +0000 |
---|---|---|
committer | John-Mark Gurney <jmg@FreeBSD.org> | 1997-09-03 22:10:47 +0000 |
commit | c9ce00862e1785408288c9b007888c58094f1895 (patch) | |
tree | d3784f8d2a22145f2b534f7f825ba0bc6cbf2beb /audio | |
parent | 9c073f23533cc291d932488bfe2cc43fcd426a97 (diff) | |
download | ports-c9ce00862e1785408288c9b007888c58094f1895.tar.gz ports-c9ce00862e1785408288c9b007888c58094f1895.zip |
Notes
Diffstat (limited to 'audio')
-rw-r--r-- | audio/nspmod/files/patch-aa | 233 | ||||
-rw-r--r-- | audio/nspmod/files/patch-ac | 44 | ||||
-rw-r--r-- | audio/nspmod/files/patch-ad | 12 | ||||
-rw-r--r-- | audio/nspmod/files/patch-ae | 12 | ||||
-rw-r--r-- | audio/nspmod/pkg-descr | 3 |
5 files changed, 300 insertions, 4 deletions
diff --git a/audio/nspmod/files/patch-aa b/audio/nspmod/files/patch-aa index 2ef0725f0899..d9b77b1fb826 100644 --- a/audio/nspmod/files/patch-aa +++ b/audio/nspmod/files/patch-aa @@ -1,5 +1,5 @@ -*** dacio-linux.c.orig Sun Jun 1 17:44:17 1997 ---- dacio-linux.c Sun Jun 1 17:43:50 1997 +*** dacio-linux.c.orig Wed Sep 3 14:57:59 1997 +--- dacio-linux.c Wed Sep 3 14:50:20 1997 *************** *** 3,9 **** --- 3,13 ---- @@ -14,3 +14,232 @@ #include <errno.h> /*EINTR*/ #include "defs.h" /*u8,u16*/ #include "dacio.h" /*(dacioXXX)*/ +*************** +*** 47,53 **** + static struct { + union { + u8 *p8; +! u16 *p16; + } p; + u8 *top; + u8 *bot; +--- 51,57 ---- + static struct { + union { + u8 *p8; +! i15 *p16; + } p; + u8 *top; + u8 *bot; +*************** +*** 67,77 **** + exit(1); + } + #endif +! tmp = AFMT_U8; + if (ioctl(fd, SNDCTL_DSP_SETFMT, &tmp) < 0) { + perror("dacioConf"); + exit(1); + } + /*fprintf(stderr, "fmt = 0x%x\n", tmp);*/ + + if (ioctl(fd, SNDCTL_DSP_STEREO, &dcp->stereo) < 0) { +--- 71,109 ---- + exit(1); + } + #endif +! switch (dcp->bits) { +! case 0: +! case 8: +! dcp->bits = 8; +! tmp = AFMT_U8; break; +! case 16: +! tmp = AFMT_S16_LE; break; +! default: +! fprintf(stderr, "Don't know how to handle %d bit output.\n", dcp->bits); +! exit(1); +! break; +! } +! + if (ioctl(fd, SNDCTL_DSP_SETFMT, &tmp) < 0) { + perror("dacioConf"); + exit(1); + } ++ ++ switch (tmp) { ++ case AFMT_U8: ++ if (dcp->bits != 8) { ++ fprintf(stderr, "soundcard doesn't support 8bits.\n"); ++ exit(1); ++ } ++ break; ++ case AFMT_S16_LE: ++ if (dcp->bits != 16) { ++ fprintf(stderr, "soundcard doesn't support 16bits.\n"); ++ exit(1); ++ } ++ break; ++ } ++ + /*fprintf(stderr, "fmt = 0x%x\n", tmp);*/ + + if (ioctl(fd, SNDCTL_DSP_STEREO, &dcp->stereo) < 0) { +*************** +*** 90,99 **** + perror("dacioConf"); + exit(1); + } +! /*fprintf(stderr, "buffer size = 0x%x\n", buf.size);*/ + dci = *dcp; + /*if (buf.top != NULL) free(buf.top);*/ +! buf.top = memPerm(buf.size * sizeof(u8)); + buf.p.p8 = buf.top; + buf.bot = buf.top + buf.size; + } +--- 122,136 ---- + perror("dacioConf"); + exit(1); + } +! fprintf(stderr, "sound buffer size = 0x%x\n", buf.size); +! tmp = buf.size; +! while (tmp <= (0.1 * (dcp->speed * (dcp->stereo+1) * (dcp->bits/8)))) +! tmp += buf.size; +! buf.size = tmp; +! fprintf(stderr, "buffer size = 0x%x\n", buf.size); + dci = *dcp; + /*if (buf.top != NULL) free(buf.top);*/ +! buf.top = memPerm(buf.size); + buf.p.p8 = buf.top; + buf.bot = buf.top + buf.size; + } +*************** +*** 115,121 **** + int s; + + if (buf.p.p8 <= buf.top) return; +! for ( ; buf.p.p8 < buf.bot; buf.p.p8++) *buf.p.p8 = 128; + RETRY: + s = write(fd, buf.top, buf.size); + if (s < buf.size) { +--- 152,165 ---- + int s; + + if (buf.p.p8 <= buf.top) return; +! switch (dci.bits) { +! case 8: +! for ( ; buf.p.p8 < buf.bot; buf.p.p8++) *buf.p.p8 = 128; +! break; +! case 16: +! for ( ; buf.p.p8 < buf.bot; buf.p.p16++) *buf.p.p16 = 0; +! break; +! } + RETRY: + s = write(fd, buf.top, buf.size); + if (s < buf.size) { +*************** +*** 179,184 **** +--- 223,230 ---- + (tmpvar & ~255)? ~tmpvar >> 16 : tmpvar ) /* 16 will be OK */ + /* ~(tmpvar >> 16) makes longer asm */ + #endif ++ #define to16bit(x) \ ++ (((x) * gv) >> 12) + + /* stereo */ + static void +*************** +*** 186,199 **** + { + const i31 *inbufp = inbuf.p; + u8 *u8p = buf.p.p8; + +! for (; n > 0; n--) { +! i31x tmp; +! *u8p++ = to8bit(*inbufp++, tmp); /* L */ +! *u8p++ = to8bit(*inbufp++, tmp); /* R */ + } + inbuf.p = inbufp; +- buf.p.p8 = u8p; + } + + /* mono */ +--- 232,257 ---- + { + const i31 *inbufp = inbuf.p; + u8 *u8p = buf.p.p8; ++ i15 *s15p = buf.p.p16; + +! switch (dci.bits) { +! case 8: +! for (; n > 0; n--) { +! i31x tmp; +! *u8p++ = to8bit(*inbufp++, tmp); /* L */ +! *u8p++ = to8bit(*inbufp++, tmp); /* R */ +! } +! buf.p.p8 = u8p; +! break; +! case 16: +! for (; n > 0; n--) { +! *s15p++ = to16bit(*inbufp++); /* L */ +! *s15p++ = to16bit(*inbufp++); /* R */ +! } +! buf.p.p16 = s15p; +! break; + } + inbuf.p = inbufp; + } + + /* mono */ +*************** +*** 202,220 **** + { + const i31 *inbufp = inbuf.p; + u8 *u8p = buf.p.p8; + +! for (; n > 0; n--) { +! i31x tmp; +! *u8p++ = to8bit(*inbufp, tmp); +! inbufp += 2; + } + inbuf.p = inbufp; +- buf.p.p8 = u8p; + } + + #define dacioOutHirev(x) \ + if (dci.stereo) dacioOutHirevS(x); else dacioOutHirevM(x) +! #define bufRest() (dci.stereo? (buf.bot - buf.p.p8)/2 : buf.bot - buf.p.p8) + + void + dacioOut(void) +--- 260,290 ---- + { + const i31 *inbufp = inbuf.p; + u8 *u8p = buf.p.p8; ++ i15 *s16p = buf.p.p16; + +! switch (dci.bits) { +! case 8: +! for (; n > 0; n--) { +! i31x tmp; +! *u8p++ = to8bit(*inbufp, tmp); +! inbufp += 2; +! } +! buf.p.p8 = u8p; +! break; +! case 16: +! for (; n > 0; n--) { +! *s16p++ = to16bit(*inbufp); +! inbufp += 2; +! } +! buf.p.p16 = s16p; +! break; + } + inbuf.p = inbufp; + } + + #define dacioOutHirev(x) \ + if (dci.stereo) dacioOutHirevS(x); else dacioOutHirevM(x) +! #define bufRest() ((dci.stereo? (buf.bot - buf.p.p8)/2 : buf.bot - buf.p.p8)/(dci.bits/8)) + + void + dacioOut(void) diff --git a/audio/nspmod/files/patch-ac b/audio/nspmod/files/patch-ac index 07578dab8ec9..c2e5be6584bc 100644 --- a/audio/nspmod/files/patch-ac +++ b/audio/nspmod/files/patch-ac @@ -1,5 +1,5 @@ -*** nspmod.c.orig Tue Jun 3 02:45:41 1997 ---- nspmod.c Tue Jun 3 02:45:52 1997 +*** nspmod.c.orig Wed Sep 3 14:58:19 1997 +--- nspmod.c Wed Sep 3 14:55:06 1997 *************** *** 1,4 **** --- 1,5 ---- @@ -8,3 +8,43 @@ #include <sys/mman.h> /*PROT_READ,MAP_xxx*/ #include <fcntl.h> /*O_RDONLY*/ #include <sys/stat.h> /*stat*/ +*************** +*** 35,40 **** +--- 36,42 ---- + printf("NSPmod version " LIT(VERSION_MAJOR) "." LIT(VERSION_MINOR) "\n"); + printf("Usage: %s [options] modfile\n", argv0); + printf("Options:\n"); ++ printf(" -b # number of bits to output (8 or 16)"); + printf(" -c # play only the channel\n"); + printf(" -e show events\n"); + printf(" -f # output sample rate\n"); +*************** +*** 62,69 **** + oi.outRate = DEF_OUTRATE; + oi.ovsFreq = -1; + /*oi.repLimit = 1;*/ +! while ((optChar = getopt(argc, argv, "c:ef:il:mo:rs:v:")) > 0) { + switch (optChar) { + case 'c': oi.onlyCh = (i15x)strtol(optarg, NULL, 0) | 0x100; break; + case 'e': oi.showEvents++; break; + case 'f': oi.outRate = (u16x)strtol(optarg, NULL, 0); break; +--- 64,72 ---- + oi.outRate = DEF_OUTRATE; + oi.ovsFreq = -1; + /*oi.repLimit = 1;*/ +! while ((optChar = getopt(argc, argv, "b:c:ef:il:mo:rs:v:")) > 0) { + switch (optChar) { ++ case 'b': oi.bits = (i15x)strtol(optarg, NULL, 0); break; + case 'c': oi.onlyCh = (i15x)strtol(optarg, NULL, 0) | 0x100; break; + case 'e': oi.showEvents++; break; + case 'f': oi.outRate = (u16x)strtol(optarg, NULL, 0); break; +*************** +*** 116,121 **** +--- 119,125 ---- + + lookOverFile(p, statbuf.st_size); + dacioInit(); ++ dci.bits = oi.bits; + dci.speed = oi.outRate; + dci.stereo = !oi.mono; + dacioConf(&dci); diff --git a/audio/nspmod/files/patch-ad b/audio/nspmod/files/patch-ad new file mode 100644 index 000000000000..eaf68819e358 --- /dev/null +++ b/audio/nspmod/files/patch-ad @@ -0,0 +1,12 @@ +*** dacio.h.orig Wed Sep 3 14:58:39 1997 +--- dacio.h Wed Sep 3 13:49:32 1997 +*************** +*** 3,8 **** +--- 3,9 ---- + #endif + + typedef struct { ++ int bits; + int speed; + int stereo; + } DacioConfInfo; diff --git a/audio/nspmod/files/patch-ae b/audio/nspmod/files/patch-ae new file mode 100644 index 000000000000..687f69484bf2 --- /dev/null +++ b/audio/nspmod/files/patch-ae @@ -0,0 +1,12 @@ +*** nspmod.h.orig Wed Sep 3 14:58:53 1997 +--- nspmod.h Wed Sep 3 13:47:40 1997 +*************** +*** 3,8 **** +--- 3,9 ---- + #endif + + typedef struct { ++ i15x bits; /* -b # */ + i15x onlyCh; /* -c # */ + i15x showEvents; /* -e, -ee */ + u16x outRate; /* -f # */ diff --git a/audio/nspmod/pkg-descr b/audio/nspmod/pkg-descr index 04ef2441f9cf..68a08b0e93f7 100644 --- a/audio/nspmod/pkg-descr +++ b/audio/nspmod/pkg-descr @@ -5,3 +5,6 @@ enables your PC play MODs without DSP such as Gravis UltraSound (GUS) GF1. This program requires VoxWare v2.90 compatible 8bit DAC device. + +I, John-Mark Gurney, have added support for output in 16bits. The +volume level is slightly less than the 8bit version though. |