Subject: bin/14402: midiplay -p selects incorrect program
To: None <gnats-bugs@gnats.netbsd.org>
From: None <itohy@netbsd.org>
List: netbsd-bugs
Date: 10/30/2001 23:09:58
>Number:         14402
>Category:       bin
>Synopsis:       midiplay -p  selects incorrect program
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 30 06:11:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     ITOH Yasufumi
>Release:        1.5Y (Oct. 30, 2001)
>Organization:
	
>Environment:
System: NetBSD aloha.my.domain 1.5Y NetBSD 1.5Y (ALOHA_TEST) #59: Tue Oct 30 21:59:09 JST 2001 itohy@ucharmax.my.domain:/amd/fmv/w/src/sys/arch/alpha/compile/ALOHA_TEST alpha

>Description:
	midiplay -p <program-number>  selects incorrect program.
	It selects the program whose number is larger by 2
	than the correct one.

>How-To-Repeat:
	% midiplay -p 1 -x

	should play in Acoustic Grand Piano (#1),
	but actually in Electric Grand Piano (#3).

>Fix:
diff -uF^[a-zA-Z_][a-z 	A-Z0-9_]*(.*[^;]$ usr.bin/midiplay/midiplay.c.orig usr.bin/midiplay/midiplay.c
--- usr.bin/midiplay/midiplay.c.orig	Tue Apr 10 16:43:58 2001
+++ usr.bin/midiplay/midiplay.c	Tue Oct 30 22:49:39 2001
@@ -356,7 +356,7 @@ playdata(buf, tot, name)
 	if (sameprogram) {
 		for(t = 0; t < 16; t++) {
 			SEQ_MK_CHN_COMMON(&event, unit, MIDI_PGM_CHANGE, t,
-			    sameprogram+1, 0, 0);
+			    sameprogram-1, 0, 0);
 			send_event(&event);
 		}
 	}
>Release-Note:
>Audit-Trail:
>Unformatted: