Subject: Re: pkg/29036: audio/cmp3 upgraded to 2.0pre6
To: None <reed@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org>
From: Rui-Xiang Guo <rxg@myrealbox.com>
List: pkgsrc-bugs
Date: 01/22/2005 10:32:02
The following reply was made to PR pkg/29036; it has been noted by GNATS.

From: Rui-Xiang Guo <rxg@myrealbox.com>
To: "Jeremy C. Reed" <reed@reedmedia.net>
Cc: gnats-bugs@netbsd.org, rxg@NetBSD.org
Subject: Re: pkg/29036: audio/cmp3 upgraded to 2.0pre6
Date: Sat, 22 Jan 2005 18:33:39 +0800

 --gKMricLos+KVdGMg
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Fri, Jan 21, 2005 at 10:29:09AM -0800, Jeremy C. Reed wrote:
 > > -MAINTAINER=    rxg@ms25.url.com.tw
 > > +MAINTAINER=    rxg@NetBSD.org
 > 
 > I see you are a developer. Can you commit all this update yourself?
 > 
 > (Also, for some reason the Makefile patch did not apply for me.)
 > 
 > >         p.s. i also feedback the patches to the author.
 
 Hi,
 because I lost my cvs access, please you help me do it, thanks!
 I sent you the patches-
 diff -b -u -r1.19 Makefile
 --- Makefile    27 Oct 2004 17:23:45 -0000      1.19
 +++ Makefile    22 Jan 2005 10:28:31 -0000
 @@ -1,19 +1,19 @@
  # $NetBSD: Makefile,v 1.19 2004/10/27 17:23:45 wiz Exp $
  #
  
 -DISTNAME=      cmp3-2.0pre5
 -PKGNAME=       cmp3-2.0.p5
 -PKGREVISION=   1
 +DISTNAME=      cmp3-2.0pre6
 +PKGNAME=       cmp3-2.0.p6
  CATEGORIES=    audio
  MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=cmp3/}
  
 -MAINTAINER=    rxg@ms25.url.com.tw
 +MAINTAINER=    rxg@NetBSD.org
  HOMEPAGE=      http://cmp3.sourceforge.net/
  COMMENT=       Curses based frontend to mpg123
  
  DEPENDS+=      mpg123-[0-9]*:../../audio/mpg123
 +DEPENDS+=      vorbis-tools-[0-9]*:../../audio/vorbis-tools
  
 -WRKSRC=                        ${WRKDIR}/cmp3
 +WRKSRC=                        ${WRKDIR}/cmp3-kenrevs
  USE_BUILDLINK3=                YES
  USE_GNU_TOOLS+=                make
  INCOMPAT_CURSES=       NetBSD-1.5* NetBSD-1.6[-_.]*
 
 
 --gKMricLos+KVdGMg
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch-aa
 
 $NetBSD$
 
 --- Makefile.orig	2001-07-29 13:43:49.000000000 +0800
 +++ Makefile
 @@ -4,25 +4,25 @@
  #  Set these variables
  #
  #  initial_directory is now set in the config file
 -mpg123_location   := "mpg123"
 -ogg123_location   := "ogg123"
 -install_directory := "$(HOME)/bin"
 +mpg123_location   := "$(LOCALBASE)/bin/mpg123"
 +ogg123_location   := "$(LOCALBASE)/bin/ogg123"
 +install_directory := "$(PREFIX)/bin"
  
  #
  #  Location of config file - Please edit this file before installing
  #
 -config_file       := "$(HOME)/.cmp3rc"
 +#config_file       := "$(HOME)/.cmp3rc"
  
  #
  #  Uncomment and set if desired
  #
  
  ## An ass repository is a nice thing to have. See README
 -ass_repository := "$(HOME)/.cmp3ass"
 +#ass_repository := "$(HOME)/.cmp3ass"
  
  ## Define this for bufferring or add other parameters to mpg123 and ogg123
 -mpg123_params := -b 320
 -ogg123_params := -d oss
 +#mpg123_params := -b 320
 +#ogg123_params := -d oss
  
  # You need debugging info? Uncomment this and check /tmp/cmp3log
  #debugging := 1
 @@ -42,9 +42,9 @@ RNMP3PARAMS= -DVERSION="\$(VERSION)\"
  # Something for me and my cd changer, you definately don't want it as it
  # stands. Change the code to do something else you want it to do...
  #PARAMS +=-DMY_CD
 -LIBS= -lform -lncurses
 -CFLAGS= -g -O -Inevlib
 -CC= gcc
 +LIBS= $(LDFLAGS) -lform -lncurses
 +CFLAGS+= -Inevlib
 +CC?= gcc
  OBJS= cmp3common.o cmp3fileio.o cmp3manager.o cmp3curses.o \
        cmp3llist.o cmp3main.o cmp3listfiles.o cmp3playlist.o cmp3volume.o \
        cmp3general.o cmp3id3.o
 @@ -60,6 +60,7 @@ PARAMS += -DEXEC_PARAMS="$(foreach token
  PARAMS += -DOGG_PARAMS="$(foreach token, $(ogg123_params),\"$(token)\",)"
  else
  PARAMS += -DEXEC_PARAMS=\"\",
 +PARAMS += -DOGG_PARAMS=\"\",
  endif
  ifdef filespacing
  RNMP3PARAMS += -DSPACEIT
 @@ -87,7 +88,7 @@ cmp3: lib $(OBJS)
  	$(CC) $(CFLAGS) $(OBJS) nevlib/libnev.a $(LIBS) -o cmp3
  
  lib:
 -	@$(MAKE) -C nevlib lib
 +	@$(MAKE) CC="$(CC)" CFLAGS="$(CFLAGS)" -C nevlib lib 
  
  cleanlib:
  	@$(MAKE) -C nevlib clean
 
 --gKMricLos+KVdGMg
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch-ab
 
 $NetBSD$
 
 --- cmp3.h.orig	2001-07-01 12:38:08.000000000 +0800
 +++ cmp3.h
 @@ -1,7 +1,7 @@
  #ifndef _CMP3_H
  #define _CMP3_H
  
 -#if defined(__FreeBSD__)
 +#if defined(__FreeBSD__) || defined(__NetBSD__)
  #include <ncurses.h>
  #include <termios.h>
  #else
 @@ -9,9 +9,6 @@
  #endif
  
  
 -#ifndef NCURSES_VERSION
 -  #error "This program requires ncurses to function"
 -#endif
  
  #include <signal.h>
  #include <dirent.h>
 
 --gKMricLos+KVdGMg
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch-ac
 
 $NetBSD$
 
 --- cmp3volume.c.orig	2001-07-01 12:38:08.000000000 +0800
 +++ cmp3volume.c
 @@ -5,6 +5,8 @@
  #include "cmp3funcs.h"
  #if defined(__FreeBSD__)
  #include <machine/soundcard.h>
 +#elif defined(__NetBSD__)
 +#include <sys/audioio.h>
  #else
  #include<sys/soundcard.h>
  #endif
 @@ -16,6 +18,63 @@ static int mixernum,                    
   *  Initialize volume control
   *  Returns: nothing
   ****************************************************************************/
 +#if defined(__NetBSD__)
 +
 +int device_id;
 +mixer_ctrl_t *m, *values;
 +
 +extern void initvol()
 +{
 +    int i, ndev;
 +    char *mixer_device;
 +    mixer_devinfo_t dinfo, *infos;
 +
 +    mixer_device = getenv("MIXERDEVICE");
 +    if (mixer_device == NULL)
 +        mixer_device = "/dev/mixer0";
 +
 +    if ((mixernum=open(mixer_device, O_RDWR)) < 0) {
 +        fprintf(stderr, "open mixer device: %s", strerror(errno));
 +        enditall(SIGSEGV);
 +    }
 +
 +    for (ndev = 0; ; ndev++) {
 +        dinfo.index = ndev;
 +        if (ioctl(mixernum, AUDIO_MIXER_DEVINFO, &dinfo) < 0)
 +            break;
 +    }
 +    infos = calloc(ndev, sizeof *infos);
 +    values = calloc(ndev, sizeof *values);
 +
 +    for (i = 0; i < ndev; i++) {
 +        infos[i].index = i;
 +        ioctl(mixernum, AUDIO_MIXER_DEVINFO, &infos[i]);
 +    }
 +
 +    for (i = 0; i < ndev; i++) {
 +        if (infos[i].type == AUDIO_MIXER_VALUE) {
 +            values[i].dev = i;
 +            values[i].type = infos[i].type;
 +        }
 +        if (strcmp(infos[i].label.name, AudioNdac) == 0) {
 +            device_id = i;
 +            break;
 +        }
 +    }
 +
 +    values[device_id].un.value.num_channels = 2;
 +
 +    m = &values[device_id];
 +    ioctl(mixernum, AUDIO_MIXER_READ, m);
 +    vol = m->un.value.level[0] * 100 / AUDIO_MAX_GAIN;
 +    mvprintw(3,COLS/2-1,"-");
 +    mvprintw(LINES-7,COLS/2-1,"-");
 +    mvprintw((LINES-8)-(vol*(LINES-12)/100),COLS/2-1,"*");
 +    return;
 +}
 +
 +#else
 +
  extern void initvol()
  {
      if ((mixernum=open("/dev/mixer", O_RDWR)) < 0) {
 @@ -30,6 +89,8 @@ extern void initvol()
      return;
  }
  
 +#endif
 +
  extern void endvol()
  {
      close(mixernum);
 @@ -61,6 +122,23 @@ extern void volclean()
   *  Although I hate users in general, we should probably do it.
   *  Returns: nothing
   ****************************************************************************/
 +#if defined(__NetBSD__)
 +
 +extern void volup()
 +{
 +    mvprintw((LINES-8)-(vol*(LINES-12)/100),COLS/2-1," ");
 +    vol += 3;
 +    if (vol > 100)
 +        vol = 100;
 +    m = &values[device_id];
 +    ioctl(mixernum, AUDIO_MIXER_WRITE, m);
 +    m->un.value.level[0] = m->un.value.level[1] = vol * AUDIO_MAX_GAIN / 100;
 +    mvprintw((LINES-8)-(vol*(LINES-12)/100), COLS/2-1, "*");
 +    return;
 +}
 +
 +#else
 +
  extern void volup()
  {
      int i;
 @@ -75,10 +153,29 @@ extern void volup()
      return;
  }
  
 +#endif
 +
  /****************************************************************************
   *  It's too loud junior, turn it down!
   *  Returns: nothing
   ****************************************************************************/
 +#if defined(__NetBSD__)
 +
 +extern void voldown()
 +{
 +    mvprintw((LINES-8)-(vol*(LINES-12)/100),COLS/2-1," ");
 +    vol -= 3;
 +    if (vol < 0)
 +        vol = 0;
 +    m = &values[device_id];
 +    ioctl(mixernum, AUDIO_MIXER_WRITE, m);
 +    m->un.value.level[0] = m->un.value.level[1] = vol * AUDIO_MAX_GAIN / 100;
 +    mvprintw((LINES-8)-(vol*(LINES-12)/100), COLS/2-1, "*");
 +    return;
 +}
 +
 +#else
 +
  extern void voldown()
  {
      int i;
 @@ -93,4 +190,6 @@ extern void voldown()
      return;
  }
  
 +#endif
 +
  /* EOF */
 
 --gKMricLos+KVdGMg--