Re: /usr/ports/audio/timidity

2009-07-16 Thread Alexandre Ratchov
On Wed, Jul 15, 2009 at 03:12:34PM +, Jacob Meuser wrote:
 On Wed, Jul 15, 2009 at 01:13:11AM +0300, 4625 wrote:
  On OpenBSD timidity reproduce garbled sound, like when CPU overloaded. 
  However, the same version of timidity on FreeBSD-4.11 play files very 
  well.
  
  OpenBSD localhost 4.5 200907101811#0 i386
  timidity-2.13.2p1
 
 can you try this please?  this adds sndio support.  iirc, it was sent
 to ports@ some onths ago by ray iwata.  I don't recall why it wasn't
 committed though.

i guess i forgot to handle it, i applogize to Ray Iwata, for
that.

this diff applies and works fine here; just for completness,
i added the below bits to check returned parameters (apply
on top of previous diff).

a possible improvement would be to set timidity output
parameters to ones returned by sio_getpar(3) rather than
failing with ``can't set parameters'' error. That's what
alsa backend seems to do.

Jacob, are the porting bits correct? if so this should go
in, imo.

-- Alexandre

--- sndio_a.c.old   Thu Jul 16 08:47:17 2009
+++ sndio_a.c   Thu Jul 16 08:48:39 2009
@@ -52,7 +52,7 @@ static struct sio_hdl *sndio_ctx;
 
 static int open_output(void)
 {
-  static struct sio_par par;
+  static struct sio_par par, newpar;
 
   sndio_ctx = sio_open(NULL, SIO_PLAY, 0);
   if (sndio_ctx == NULL) {
@@ -66,19 +66,34 @@ static int open_output(void)
   par.pchan = (dpm.encoding  PE_MONO) ? 1 : 2;
   par.le = SIO_LE_NATIVE;
   par.rate = dpm.rate;
-  par.bits = (dpm.encoding  PE_24BIT) ? 24 : 0;
-  par.bits = (dpm.encoding  PE_16BIT) ? 16 : 0;
-
-  if (par.bits == 0)
+  if (dpm.encoding  PE_24BIT) {
+par.bits = 24;
+par.bps = 3;
+  } else if (dpm.encoding  PE_16BIT) {
+par.bits = 16;
+par.bps = 2;
+  } else {
 par.bits = 8;
+par.bps = 1;
+  }
 
   if (!sio_setpar(sndio_ctx, par)) {
 ctl-cmsg(CMSG_ERROR, VERB_NORMAL, sio_setpar() failed);
 return -1;
   }
 
-  if (sio_getpar(sndio_ctx, par) == 0) {
+  if (sio_getpar(sndio_ctx, newpar) == 0) {
 ctl-cmsg(CMSG_ERROR, VERB_NORMAL, sio_getpar() failed);
+return -1;
+  }
+  if (newpar.sig != par.sig ||
+  newpar.le != par.le ||
+  newpar.pchan != par.pchan ||
+  newpar.bits != par.bits ||
+  newpar.bps != par.bps ||
+  newpar.rate * 1000  par.rate * 1005 ||
+  newpar.rate * 1000  par.rate *  995) {
+ctl-cmsg(CMSG_ERROR, VERB_NORMAL, couldn't set output play parameters);
 return -1;
   }
 



Re: /usr/ports/audio/timidity

2009-07-16 Thread 4625

On Thu, 16 Jul 2009, Jacob Meuser wrote:

On OpenBSD timidity reproduce garbled sound, like when CPU 
overloaded. However, the same version of timidity on FreeBSD-4.11 
play files very well.


OpenBSD localhost 4.5 200907101811#0 i386
timidity-2.13.2p1


can you try this please? ?this adds sndio support. ?iirc, it was
sent to ports@ some onths ago by ray iwata. ?I don't recall why it
wasn't committed though. ?I personally don't use timidity, but
really basic usage works for me.



use 'patch -p 0  patch.diff'


With 'mkdir files' before.

On midi files with a few instruments - sound is good. On large files I 
hear dither sound.


--
4625



Re: /usr/ports/audio/timidity

2009-07-15 Thread Jacob Meuser
On Wed, Jul 15, 2009 at 01:13:11AM +0300, 4625 wrote:
 On OpenBSD timidity reproduce garbled sound, like when CPU overloaded. 
 However, the same version of timidity on FreeBSD-4.11 play files very 
 well.
 
 OpenBSD localhost 4.5 200907101811#0 i386
 timidity-2.13.2p1

can you try this please?  this adds sndio support.  iirc, it was sent
to ports@ some onths ago by ray iwata.  I don't recall why it wasn't
committed though.  I personally don't use timidity, but really basic
usage works for me.

-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===
RCS file: /cvs/ports/audio/timidity/Makefile,v
retrieving revision 1.32
diff -N -u -p Makefile
--- Makefile22 Nov 2007 12:52:34 -  1.32
+++ Makefile15 Jul 2009 05:22:18 -
@@ -20,12 +20,13 @@ PERMIT_PACKAGE_FTP= copyrighted patches
 PERMIT_DISTFILES_CDROM= copyrighted patches
 PERMIT_DISTFILES_FTP=   copyrighted patches
 
-WANTLIB=   c m ncurses 
+WANTLIB=   c m ncurses sndio
 
-CONFIGURE_STYLE=gnu
-CONFIGURE_ENV+=CFLAGS=-I${LOCALBASE}/include \
-   LDFLAGS=-L${LOCALBASE}/lib
-CONFIGURE_ARGS= --enable-audio=sun \
+CONFIGURE_STYLE=autoconf gnu
+AUTOCONF_VERSION = 2.59
+AUTOMAKE_VERSION = 1.9
+CONFIGURE_ARGS= --enable-audio=sndio,sun \
+   --with-default-output=sndio \
--enable-vt100 \
--enable-ncurses \
--enable-server \
@@ -41,8 +42,9 @@ USE_X11=  Yes
 LIB_DEPENDS+=  gdk-x11-2.0,gdk_pixbuf-2.0,gtk-x11-2.0::x11/gtk+2
 WANTLIB+=  X11 Xau Xcomposite Xcursor Xdamage Xdmcp Xext Xfixes \
Xi Xinerama Xrandr Xrender atk-1.0 cairo expat \
-   fontconfig freetype glib-2.0 glitz gmodule-2.0 \
-   gobject-2.0 pango-1.0 pangocairo-1.0 pangoft2-1.0 png z
+   fontconfig freetype glib-2.0 glitz gio-2.0 gmodule-2.0 \
+   gobject-2.0 pango-1.0 pangocairo-1.0 pangoft2-1.0 \
+   pixman-1 png z
 .endif
 
 .if ${FLAVOR:L:Mxaw}
@@ -61,6 +63,17 @@ NO_REGRESS=  Yes
 WRKDIST=   ${WRKDIR}
 WRKSRC=${WRKDIR}/${DISTNAME}
 DATA_DIRS= gsdrum00 gsdrum08 gsdrum40
+
+post-patch:
+   cp ${FILESDIR}/sndio_a.c \
+   ${WRKSRC}/timidity/sndio_a.c
+   cd ${WRKSRC}  AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal -I autoconf
+
+pre-configure:
+   cd ${WRKSRC}; AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+   AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake \
+   --foreign --add-missing --copy
 
 post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/timidity/goemon
Index: files/sndio_a.c
===
RCS file: files/sndio_a.c
diff -N -u -p files/sndio_a.c
--- /dev/null   14 Jul 2009 23:22:18 -
+++ files/sndio_a.c 15 Jul 2009 05:22:18 -
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2008 IWATA Ray iw...@quasiquote.org
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif /* HAVE_CONFIG_H */
+#include sndio.h
+
+#include timidity.h
+#include output.h
+#include controls.h
+#include timer.h
+#include instrum.h
+#include playmidi.h
+#include miditrace.h
+
+static int open_output(void); /* 0=success, 1=warning, -1=fatal error */
+static void close_output(void);
+static int output_data(char *buf, int32 nbytes);
+static int acntl(int request, void *arg);
+
+/* export the playback mode */
+
+#define dpm sndio_play_mode
+
+PlayMode dpm = {
+  DEFAULT_RATE, PE_SIGNED|PE_16BIT, PF_PCM_STREAM,
+  -1,
+  {0}, /* default: get all the buffer fragments you can */
+  sndio mode, 's',
+  NULL,
+  open_output,
+  close_output,
+  output_data,
+  acntl
+};
+
+static struct sio_hdl *sndio_ctx;
+
+static int open_output(void)
+{
+  static struct sio_par par;
+
+  sndio_ctx = sio_open(NULL, SIO_PLAY, 0);
+  if (sndio_ctx == NULL) {
+ctl-cmsg(CMSG_ERROR, VERB_NORMAL, sio_open() failed);
+return -1;
+  }
+
+  sio_initpar(par);
+
+  par.sig = 1;
+  par.pchan = (dpm.encoding  PE_MONO) ? 1 : 2;
+  par.le = SIO_LE_NATIVE;
+  par.rate = dpm.rate;
+  par.bits = (dpm.encoding  PE_24BIT) ? 24 : 0;
+  

Re: /usr/ports/audio/timidity

2009-07-15 Thread 4625

On Wed, 15 Jul 2009, Jacob Meuser wrote:


On OpenBSD timidity reproduce garbled sound, like when CPU overloaded.
However, the same version of timidity on FreeBSD-4.11 play files very
well.

OpenBSD localhost 4.5 200907101811#0 i386
timidity-2.13.2p1


can you try this please?  this adds sndio support.  iirc, it was sent
to ports@ some onths ago by ray iwata.  I don't recall why it wasn't
committed though.  I personally don't use timidity, but really basic
usage works for me.


Thanks for reply.

This patch does not solve the problem.

By the way, patched Makefile have small error - he try to take the 
'sndio_a.c' from 'files/' dir. But 'sndio_a.c' are present in current 
dir actually.


--
4625



Re: /usr/ports/audio/timidity

2009-07-15 Thread 4625

On Wed, 15 Jul 2009, patrick keshishian wrote:

On OpenBSD timidity reproduce garbled sound, like when CPU 
overloaded. However, the same version of timidity on FreeBSD-4.11 
play files very well.


OpenBSD localhost 4.5 200907101811#0 i386
timidity-2.13.2p1


can you try this please?  this adds sndio support.  iirc, it was 
sent to ports@ some onths ago by ray iwata.  I don't recall why it 
wasn't committed though.  I personally don't use timidity, but 
really basic usage works for me.


Thanks for reply.

This patch does not solve the problem.

By the way, patched Makefile have small error - he try to take the 
'sndio_a.c' from 'files/' dir. But 'sndio_a.c' are present in current 
dir actually.



Are you sure you applied the patch properly? I haven't tried building
the port but the patch applied correctly creates the sndio_a.c file in
files directory:


If this line correct, then I'm sure. 'patch  Yourpatch.diff'


$ ls -l files/
total 12
drwxr-xr-x  2 sidster  wsrc   512 Jul  4 14:12 CVS/
-rw-r--r--  1 sidster  wsrc  2946 Jul 15 20:03 sndio_a.c
-rw-r--r--  1 sidster  wsrc 0 Jul 15 20:03 sndio_a.c.orig


timidity:0$ ls -Fl
total 68
drwxr-xr-x  2 root  wheel512 Mar  1 03:25 CVS/
-rw-r--r--  1 root  wheel   2655 Jul 16 07:03 Makefile
-rw-r--r--  1 root  wheel   2276 Nov 22  2007 Makefile.orig
-rw-r--r--  1 root  wheel  13525 Jul 16 02:25 Yourpatch.diff
-rw-r--r--  1 root  wheel549 Apr  5  2007 distinfo
drwxr-xr-x  3 root  wheel   1024 Jul 16 07:03 patches/
drwxr-xr-x  3 root  wheel512 Jul 16 07:03 pkg/
-rw-r--r--  1 root  wheel   2946 Jul 16 07:03 sndio_a.c
-rw-r--r--  1 root  wheel  0 Jul 16 07:03 sndio_a.c.orig

--
4625



Re: /usr/ports/audio/timidity

2009-07-15 Thread Jacob Meuser
On Thu, Jul 16, 2009 at 07:10:13AM +0300, 4625 wrote:
 On Wed, 15 Jul 2009, patrick keshishian wrote:
 
 On OpenBSD timidity reproduce garbled sound, like when CPU 
 overloaded. However, the same version of timidity on FreeBSD-4.11 
 play files very well.
 
 OpenBSD localhost 4.5 200907101811#0 i386
 timidity-2.13.2p1
 
 can you try this please? ?this adds sndio support. ?iirc, it was 
 sent to ports@ some onths ago by ray iwata. ?I don't recall why it 
 wasn't committed though. ?I personally don't use timidity, but 
 really basic usage works for me.
 
 Thanks for reply.
 
 This patch does not solve the problem.
 
 By the way, patched Makefile have small error - he try to take the 
 'sndio_a.c' from 'files/' dir. But 'sndio_a.c' are present in current 
 dir actually.
 
 
 Are you sure you applied the patch properly? I haven't tried building
 the port but the patch applied correctly creates the sndio_a.c file in
 files directory:
 
 If this line correct, then I'm sure. 'patch  Yourpatch.diff'
 
 $ ls -l files/
 total 12
 drwxr-xr-x  2 sidster  wsrc   512 Jul  4 14:12 CVS/
 -rw-r--r--  1 sidster  wsrc  2946 Jul 15 20:03 sndio_a.c
 -rw-r--r--  1 sidster  wsrc 0 Jul 15 20:03 sndio_a.c.orig
 
 timidity:0$ ls -Fl
 total 68
 drwxr-xr-x  2 root  wheel512 Mar  1 03:25 CVS/
 -rw-r--r--  1 root  wheel   2655 Jul 16 07:03 Makefile
 -rw-r--r--  1 root  wheel   2276 Nov 22  2007 Makefile.orig
 -rw-r--r--  1 root  wheel  13525 Jul 16 02:25 Yourpatch.diff
 -rw-r--r--  1 root  wheel549 Apr  5  2007 distinfo
 drwxr-xr-x  3 root  wheel   1024 Jul 16 07:03 patches/
 drwxr-xr-x  3 root  wheel512 Jul 16 07:03 pkg/
 -rw-r--r--  1 root  wheel   2946 Jul 16 07:03 sndio_a.c
 -rw-r--r--  1 root  wheel  0 Jul 16 07:03 sndio_a.c.orig

use 'patch -p 0  patch.diff'

-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org



Re: /usr/ports/audio/timidity

2009-07-15 Thread Owain Ainsworth
On Thu, Jul 16, 2009 at 07:10:13AM +0300, 4625 wrote:
 On Wed, 15 Jul 2009, patrick keshishian wrote:
 
 On OpenBSD timidity reproduce garbled sound, like when CPU
 overloaded. However, the same version of timidity on
 FreeBSD-4.11 play files very well.
 
 OpenBSD localhost 4.5 200907101811#0 i386
 timidity-2.13.2p1
 
 can you try this please? ?this adds sndio support. ?iirc, it
 was sent to ports@ some onths ago by ray iwata. ?I don't
 recall why it wasn't committed though. ?I personally don't use
 timidity, but really basic usage works for me.
 
 Thanks for reply.
 
 This patch does not solve the problem.
 
 By the way, patched Makefile have small error - he try to take
 the 'sndio_a.c' from 'files/' dir. But 'sndio_a.c' are present
 in current dir actually.
 
 
 Are you sure you applied the patch properly? I haven't tried building
 the port but the patch applied correctly creates the sndio_a.c file in
 files directory:
 
 If this line correct, then I'm sure. 'patch  Yourpatch.diff'
 
 $ ls -l files/
 total 12
 drwxr-xr-x  2 sidster  wsrc   512 Jul  4 14:12 CVS/
 -rw-r--r--  1 sidster  wsrc  2946 Jul 15 20:03 sndio_a.c
 -rw-r--r--  1 sidster  wsrc 0 Jul 15 20:03 sndio_a.c.orig
 
 timidity:0$ ls -Fl
 total 68
 drwxr-xr-x  2 root  wheel512 Mar  1 03:25 CVS/
 -rw-r--r--  1 root  wheel   2655 Jul 16 07:03 Makefile
 -rw-r--r--  1 root  wheel   2276 Nov 22  2007 Makefile.orig
 -rw-r--r--  1 root  wheel  13525 Jul 16 02:25 Yourpatch.diff
 -rw-r--r--  1 root  wheel549 Apr  5  2007 distinfo
 drwxr-xr-x  3 root  wheel   1024 Jul 16 07:03 patches/
 drwxr-xr-x  3 root  wheel512 Jul 16 07:03 pkg/
 -rw-r--r--  1 root  wheel   2946 Jul 16 07:03 sndio_a.c
 -rw-r--r--  1 root  wheel  0 Jul 16 07:03 sndio_a.c.orig

$ mkdir files  patch  blah.diff

should do it.

patch has a habit of not making directories and just stuffing new files
in those into the directory below.

-0-
-- 
Get forgiveness now -- tomorrow you may no longer feel guilty.



/usr/ports/audio/timidity

2009-07-14 Thread 4625
On OpenBSD timidity reproduce garbled sound, like when CPU overloaded. 
However, the same version of timidity on FreeBSD-4.11 play files very 
well.


OpenBSD localhost 4.5 200907101811#0 i386
timidity-2.13.2p1

--
4625