ref: df3bb51a1c27e5499e6c80997bfd25db376e3242
parent: 24cb61a5d9882f7538f1298ef733fee6a6fc280e
author: qwx <qwx@sciops.net>
date: Mon Aug 28 16:40:35 EDT 2023
games/dmx: rename to games/dmxdec for consistency
--- a/sys/man/1/mus
+++ b/sys/man/1/mus
@@ -1,6 +1,6 @@
.TH MUS 1
.SH NAME
-mus, dmx \- MUS to MIDI converter and DMX decoder
+mus, dmxdec \- MUS to MIDI converter and DMX decoder
.SH SYNOPSIS
.B games/mus
[
@@ -7,7 +7,7 @@
.I musfile
]
.br
-.B games/dmx
+.B games/dmxdec
[
.I dmxfile
]
@@ -21,7 +21,7 @@
.B musfile
or from standard input, and produces a MIDI format file on standard output.
.PP
-.I Dmx
+.I Dmxdec
similarly transcodes its input into PCM on standard output at
.IR audio (3)'s
default 44.1 kHz sampling rate.
@@ -31,10 +31,10 @@
.SH SOURCE
.B /sys/src/games/mus.c
.br
-.B /sys/src/games/dmx.c
+.B /sys/src/games/dmxdec.c
.SH HISTORY
.I Mus
and
-.I dmx
+.I dmxdec
first appeared in 9front (respectively
in September, 2015 and August, 2023).
--- a/sys/src/games/dmx.c
+++ /dev/null
@@ -1,33 +1,0 @@
-#include <u.h>
-#include <libc.h>
-#include <fcall.h>
-
-enum{
- Hdrsz = 2+2+4+16,
-};
-
-void
-main(int argc, char **argv)
-{
- int n, rate, fd;
- uchar buf[Hdrsz], *p;
- char fmt[16], len[16];
-
- fd = 0;
- if(argc > 1 && (fd = open(argv[1], OREAD)) < 0)
- sysfatal("open: %r");
- if(read(fd, buf, sizeof buf) != sizeof buf)
- sysfatal("short read: %r");
- p = buf;
- n = GBIT16(p);
- if(n != 3) /* format number */
- sysfatal("invalid dmx file");
- p += 2;
- rate = GBIT16(p); /* sample rate (usually 11025Hz) */
- p += 2;
- n = GBIT32(p);
- snprint(fmt, sizeof fmt, "u8c1r%d", rate);
- snprint(len, sizeof len, "%d", n);
- execl("/bin/audio/pcmconv", "pcmconv", "-i", fmt, "-o", "s16c2r44100", "-l", len, nil);
- sysfatal("execl: %r");
-}
--- /dev/null
+++ b/sys/src/games/dmxdec.c
@@ -1,0 +1,33 @@
+#include <u.h>
+#include <libc.h>
+#include <fcall.h>
+
+enum{
+ Hdrsz = 2+2+4+16,
+};
+
+void
+main(int argc, char **argv)
+{
+ int n, rate, fd;
+ uchar buf[Hdrsz], *p;
+ char fmt[16], len[16];
+
+ fd = 0;
+ if(argc > 1 && (fd = open(argv[1], OREAD)) < 0)
+ sysfatal("open: %r");
+ if(read(fd, buf, sizeof buf) != sizeof buf)
+ sysfatal("short read: %r");
+ p = buf;
+ n = GBIT16(p);
+ if(n != 3) /* format number */
+ sysfatal("invalid dmx file");
+ p += 2;
+ rate = GBIT16(p); /* sample rate (usually 11025Hz) */
+ p += 2;
+ n = GBIT32(p);
+ snprint(fmt, sizeof fmt, "u8c1r%d", rate);
+ snprint(len, sizeof len, "%d", n);
+ execl("/bin/audio/pcmconv", "pcmconv", "-i", fmt, "-o", "s16c2r44100", "-l", len, nil);
+ sysfatal("execl: %r");
+}