shithub: riscv

Download patch

ref: 618b7b861bd417a8e83ca612141617b79bc68424
parent: 493994826396340fed0afd048e642ca747a5997a
author: qwx <[email protected]>
date: Sun Nov 27 19:26:07 EST 2022

play: use doom1.wad and dmid/opl3 for midi files by default

--- a/rc/bin/play
+++ b/rc/bin/play
@@ -1,5 +1,5 @@
 #!/bin/rc
-rfork e
+rfork en
 
 nl='
 '
@@ -23,6 +23,13 @@
 	cleanup
 }
 
+fn midi {
+	if(test -f /mnt/wad/genmidi || games/wadfs /sys/games/lib/doom/doom1.wad >[2]/dev/null)
+		games/dmid | games/opl3
+	if not
+		games/midi -c
+}
+
 fn play1 {
 	if(! ~ $#* 2){
 		tmp=(/tmp/play.$pid.$#tmp.tmp $tmp)
@@ -59,9 +66,9 @@
 		case *audio/basic*
 			audio/sundec
 		case *audio/midi*
-			games/midi -c
+			midi
 		case *audio/mus*
-			games/mus | games/midi -c
+			games/mus | midi
 		case *pls*
 			awk 'BEGIN {FS="="} /^File/{print $2}' | play1 list plain
 		case *
@@ -77,9 +84,9 @@
 			case *.au *.AU
 				audio/sundec
 			case *.mid *.MID
-				games/midi -c
+				midi
 			case *.mus *.MUS
-				games/mus | games/midi -c
+				games/mus | midi
 			case *
 				echo $argv0: $1: unknown format: $2 >[1=2]
 			}