NetBSD Problem Report #35772

From www@NetBSD.org  Wed Feb 21 21:21:43 2007
Return-Path: <www@NetBSD.org>
Received: by narn.NetBSD.org (Postfix, from userid 31301)
	id 76CA163B879; Wed, 21 Feb 2007 21:21:43 +0000 (UTC)
Message-Id: <20070221212143.76CA163B879@narn.NetBSD.org>
Date: Wed, 21 Feb 2007 21:21:43 +0000 (UTC)
From: svs@ropnet.ru
Reply-To: svs@ropnet.ru
To: gnats-bugs@NetBSD.org
Subject: audio/timidity (using 'sun' output driver) pauses at start of playback
X-Send-Pr-Version: www-1.0

>Number:         35772
>Category:       pkg
>Synopsis:       audio/timidity (using 'sun' output driver) pauses at start of playback
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    wiz
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 21 21:25:00 +0000 2007
>Closed-Date:    Fri Jun 08 17:19:08 +0000 2007
>Last-Modified:  Fri Jun 08 17:20:01 +0000 2007
>Originator:     Sergey Svishchev
>Release:        3.0.2_PATCH
>Organization:
>Environment:
auich0 at pci0 dev 31 function 5: i82801EB (ICH5) AC-97 Audio
auich0: interrupting at ioapic0 pin 17 (irq 11)
auich0: ac97: Analog Devices AD1985 codec; headphone, 20 bit DAC, no 3D stereo
auich0: ac97: ext id 3c7<AMAP,LDAC,SDAC,CDAC,SPDIF,DRA,VRA>
auich0: measured ac97 link rate at 48000 Hz
audio0 at auich0: full duplex, mmap, independent

>Description:
timidity plays for less than a second, then pauses for a second or so (waiting for audio buffer to drain, it seems), and then plays the rest of the MIDI.

The reason seems to be: sun_a.c does not handle PM_REQ_GETQSIZ and PM_REQ_GETFRAGSIZ requests, and thus Timidity has to guess the size of audio buffer.
>How-To-Repeat:
Play a MIDI file.  Say, one of these: http://home.modemss.brisnet.org.au/~mlevoi/elp.html
>Fix:
--- timidity/sun_a.c.orig	2004-09-27 03:40:14.000000000 +0400
+++ timidity/sun_a.c	2007-01-29 22:36:14.000000000 +0300
@@ -296,6 +296,18 @@


 #if !defined(I_FLUSH) || !defined(FLUSHW)
+#  if defined(AUDIO_FLUSH)	/* NetBSD */
+static int sun_discard_playing(void)
+{
+    if(ioctl(dpm.fd, AUDIO_FLUSH, NULL) < 0)
+    {
+	ctl->cmsg(CMSG_ERROR, VERB_NORMAL, "%s: (ioctl) %s",
+		  dpm.name, strerror(errno));
+	return -1;
+    }
+    return 0;
+}
+#  else
 static void null_proc(){}
 static int sun_discard_playing(void)
 {
@@ -308,6 +320,7 @@
     signal(SIGALRM, orig_alarm_handler);
     return open_output();
 }
+#  endif
 #else
 static int sun_discard_playing(void)
 {
@@ -328,6 +341,21 @@

     switch(request)
     {
+#ifdef __NetBSD__
+      case PM_REQ_GETQSIZ:
+	if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0)
+	    return -1;
+	return auinfo.play.buffer_size;
+
+      case PM_REQ_GETFRAGSIZ:
+	if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0)
+	    return -1;
+	return auinfo.blocksize;
+
+      case PM_REQ_OUTPUT_FINISH:
+	return ioctl(audioctl_fd, AUDIO_DRAIN, NULL);
+#endif
+
       case PM_REQ_GETFILLED:
 	if(ioctl(audioctl_fd, AUDIO_GETINFO, &auinfo) < 0)
 	    return -1;

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->wiz
Responsible-Changed-By: reed@netbsd.org
Responsible-Changed-When: Sun, 25 Feb 2007 00:09:33 +0000
Responsible-Changed-Why:
Assigned to maintainer.


State-Changed-From-To: open->closed
State-Changed-By: wiz@netbsd.org
State-Changed-When: Fri, 08 Jun 2007 17:19:08 +0000
State-Changed-Why:
Committed, thank you!


From: Thomas Klausner <wiz@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/35772 CVS commit: pkgsrc/audio/timidity
Date: Fri,  8 Jun 2007 17:18:53 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Fri Jun  8 17:18:53 UTC 2007

 Modified Files:
 	pkgsrc/audio/timidity: Makefile distinfo
 	pkgsrc/audio/timidity/patches: patch-aa

 Log Message:
 Support PM_REQ_GETQSIZ and PM_REQ_GETFRAGSIZ in sun_a.c to improve
 playback. From Sergey Svishchev in PR 35772.

 Bump PKGREVISION.


 To generate a diff of this commit:
 cvs rdiff -r1.60 -r1.61 pkgsrc/audio/timidity/Makefile
 cvs rdiff -r1.12 -r1.13 pkgsrc/audio/timidity/distinfo
 cvs rdiff -r1.6 -r1.7 pkgsrc/audio/timidity/patches/patch-aa

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.