Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Apr 2007 16:36:04 GMT
From:      Pontus Stenetorp<ninjin@kth.se>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/111194: New port: audio/py-fastaudio Python bindings for Portaudio
Message-ID:  <200704031636.l33Ga4rh054784@www.freebsd.org>
Resent-Message-ID: <200704031650.l33Go3Ns089680@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         111194
>Category:       misc
>Synopsis:       New port: audio/py-fastaudio Python bindings for Portaudio
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 03 16:50:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Pontus Stenetorp
>Release:        FreeBSD 6.2-RELEASE i386
>Organization:
>Environment:
FreeBSD sanshou.yasai 6.2-RELEASE FreeBSD 6.2-RELEASE #1: Mon Jan 15 15:03:34 CET 2007     ninjin@sanshou.yasai:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
I have created a port for Fastaudio that is a Python module that gives bindings to Portaudio. It has been necessary to add some patches and tinker a bit with the Makefile but now it works perfectly. This is my first port.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	py-fastaudio
#	py-fastaudio/files
#	py-fastaudio/files/patch-setup.py
#	py-fastaudio/files/patch-mysndfile.h
#	py-fastaudio/files/patch-fastaudio.pyx
#	py-fastaudio/Makefile
#	py-fastaudio/distinfo
#	py-fastaudio/pkg-descr
#
echo c - py-fastaudio
mkdir -p py-fastaudio > /dev/null 2>&1
echo c - py-fastaudio/files
mkdir -p py-fastaudio/files > /dev/null 2>&1
echo x - py-fastaudio/files/patch-setup.py
sed 's/^X//' >py-fastaudio/files/patch-setup.py << 'END-of-py-fastaudio/files/patch-setup.py'
X--- setup.py.orig	Sat Mar  3 10:39:05 2007
X+++ setup.py	Fri Mar  9 22:28:00 2007
X@@ -4,6 +4,7 @@
X 
X import sys
X 
X+libDir=[]
X if sys.platform == 'win32':
X     faSources=['fastaudio.pyx', '../pa_common/pa_lib.c', '../pa_win_wmme/pa_win_wmme.c']
X     defines = [('WIN32', 1)]
X@@ -15,12 +16,22 @@
X     libs = ['sndfile']
X     extra_link_args = ['/usr/lib/libsndfile.a']
X #faSources=['fastaudio.pyx']
X+elif sys.platform.find('freebsd') != -1:
X+    faSources=['fastaudio.pyx', '../portaudio_v18_1/pa_common/pa_lib.c', '../portaudio_v18_1/pa_unix_oss/pa_unix_oss.c']
X+    defines = []
X+    libs = ['sndfile']
X+    libDir = ['%%LOCALBASE%%/lib']
X+    extra_link_args = ['-lportaudio']
X+    #extra_link_args = ['-lsndfile']
X+    include_dirs=['%%LOCALBASE%%/include', '../portaudio_v18_1/pa_common']
X 
X ext_fastaudio = [Extension('fastaudio',
X                           faSources,
X-                          include_dirs=['../pa_common'],
X+                          #include_dirs=,
X+			  include_dirs,
X                           define_macros=defines,
X                           libraries=libs,
X+			  library_dirs=libDir,
X                           extra_link_args=extra_link_args
X                           )]
X                       
END-of-py-fastaudio/files/patch-setup.py
echo x - py-fastaudio/files/patch-mysndfile.h
sed 's/^X//' >py-fastaudio/files/patch-mysndfile.h << 'END-of-py-fastaudio/files/patch-mysndfile.h'
X--- mysndfile.h.orig	Tue Jun 15 13:37:39 2004
X+++ mysndfile.h	Sat Mar  3 11:53:57 2007
X@@ -1,5 +1,5 @@
X #ifdef WIN32
X #include "sndfile-win32.h"
X #else
X-#include "sndfile.h"
X+#include "/usr/local/include/sndfile.h"
X #endif
END-of-py-fastaudio/files/patch-mysndfile.h
echo x - py-fastaudio/files/patch-fastaudio.pyx
sed 's/^X//' >py-fastaudio/files/patch-fastaudio.pyx << 'END-of-py-fastaudio/files/patch-fastaudio.pyx'
X--- fastaudio.pyx.orig	Sat Mar  3 10:53:45 2007
X+++ fastaudio.pyx	Sat Mar  3 11:03:03 2007
X@@ -92,7 +92,7 @@
X #@+node:portaudio.h
X # portaudio-specifics
X 
X-cdef extern from "../pa_common/portaudio.h":
X+cdef extern from "/usr/local/include/portaudio.h":
X     ctypedef int PaError
X 
X     cdef enum PA_ERRORS:
X@@ -586,8 +586,8 @@
X         cdata.framesPerBuf = framesPerBuf
X         cdata.bytesPerFrame = channels * _sampleFormatSizes[format]
X         cdata.bytesPerBuf = framesPerBuf * cdata.bytesPerFrame 
X-        cdata.txFifo = fifoNew(cdata.bytesPerBuf, maxbufs, 't')
X-        cdata.rxFifo = fifoNew(cdata.bytesPerBuf, maxbufs, 'r')
X+        cdata.txFifo = fifoNew(cdata.bytesPerBuf, maxbufs, <int> 't')
X+        cdata.rxFifo = fifoNew(cdata.bytesPerBuf, maxbufs, <int> 'r')
X         printf("__new__: txFifo=%lx rxFifo=%lx\n", cdata.txFifo, cdata.rxFifo)
X         cdata.hits = 0
X         cdata.running = 1
X@@ -1113,28 +1113,28 @@
X             # write to output buffer, converting to output format
X             if cChansOut == 1:
X                 if outFormat == paInt8:
X-                    outPtr_8[idxOut] = (frameLeft + frameRight) / (2 * 0x1000000)
X+                    outPtr_8[idxOut] = <char> (frameLeft + frameRight) / (2 * 0x1000000)
X                 elif outFormat == paUInt8:
X-                    outPtr_u8[idxOut] = (frameLeft + frameRight) / (2 * 0x1000000)
X+                    outPtr_u8[idxOut] = <unsigned char> (frameLeft + frameRight) / (2 * 0x1000000)
X                 elif outFormat == paInt16:
X-                    outPtr_16[idxOut] = (frameLeft + frameRight) / (2 * 0x10000)
X+                    outPtr_16[idxOut] = <short> (frameLeft + frameRight) / (2 * 0x10000)
X                 elif outFormat == paInt32:
X-                    outPtr_32[idxOut] = (frameLeft + frameRight) / 2
X+                    outPtr_32[idxOut] = <long> (frameLeft + frameRight) / 2
X                 elif outFormat == paFloat32:
X                     outPtr_f32[idxOut] = (frameLeft + frameRight) / 2
X             else:
X                 if outFormat == paInt8:
X-                    outPtr_8[idxOut * 2] = frameLeft / 0x1000000
X-                    outPtr_8[idxOut * 2 + 1] = frameRight / 0x1000000
X+                    outPtr_8[idxOut * 2] = <char> frameLeft / 0x1000000
X+                    outPtr_8[idxOut * 2 + 1] = <char> frameRight / 0x1000000
X                 elif outFormat == paUInt8:
X-                    outPtr_u8[idxOut * 2] = frameLeft / 0x1000000
X-                    outPtr_u8[idxOut * 2 + 1] = frameRight / 0x1000000
X+                    outPtr_u8[idxOut * 2] = <unsigned char> frameLeft / 0x1000000
X+                    outPtr_u8[idxOut * 2 + 1] = <unsigned char> frameRight / 0x1000000
X                 elif outFormat == paInt16:
X-                    outPtr_16[idxOut * 2] = frameLeft / 0x10000
X-                    outPtr_16[idxOut * 2 + 1] = frameRight / 0x10000
X+                    outPtr_16[idxOut * 2] = <short> frameLeft / 0x10000
X+                    outPtr_16[idxOut * 2 + 1] = <short> frameRight / 0x10000
X                 elif outFormat == paInt32:
X-                    outPtr_32[idxOut * 2] = frameLeft
X-                    outPtr_32[idxOut * 2 + 1] = frameRight
X+                    outPtr_32[idxOut * 2] = <long> frameLeft
X+                    outPtr_32[idxOut * 2 + 1] = <long> frameRight
X                 elif outFormat == paFloat32:
X                     outPtr_f32[idxOut * 2] = frameLeft
X                     outPtr_f32[idxOut * 2 + 1] = frameRight
END-of-py-fastaudio/files/patch-fastaudio.pyx
echo x - py-fastaudio/Makefile
sed 's/^X//' >py-fastaudio/Makefile << 'END-of-py-fastaudio/Makefile'
X# New ports collection makefile for: py-fastaudio
X# Date created:		3 March 2007
X# Whom:			Pontus Stenetorp <ninjin@kth.se>
X#			Carl Johan Gustavsson <cjg@bsdmail.org>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	fastaudio
XPORTVERSION=	0.1
XCATEGORIES=	audio python
XMASTER_SITES=	http://www.freenet.org.nz/python/pyPortAudio/:site1 \
X		http://www.portaudio.com/archives/:site2
XPKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
XDISTNAME=	fastaudio
XDISTFILES=	fastaudio.tar.gz:site1 portaudio_v18_1.zip:site2
XDIST_SUBDIR=	python
X
XMAINTAINER=	ninjin@kth.se
XCOMMENT=	Python bindings for the PortAudio multi-platform audio library
X
XBUILD_DEPENDS=	pyrexc:${PORTSDIR}/devel/pyrex
XLIB_DEPENDS=	portaudio:${PORTSDIR}/audio/portaudio
X
XPLIST_FILES=	lib/%%PYTHON_VERSION%%/site-packages/fastaudio.so
XPLIST_DIRS=
XEXAMPLESDIR=	${LOCALBASE}/share/examples/py-${PORTNAME}
X
XUSE_ZIP=	yes
XUSE_PYTHON=	yes
XUSE_PYDISTUTILS=yes
X
XFASTA_SRCFILE=	fastaudio.tar.gz
XPORTA_SRCFILE=	portaudio_v18_1.zip
XPORTASRC_DIR=	${WRKDIR}/portaudio_v18_1/
X
X.if !defined(WITHOUT_EXAMPLES)
XPLIST_DIRS+=	share/examples/py-${PORTNAME}
XPLIST_FILES+=	share/examples/py-${PORTNAME}/demo.py
X.endif
X
Xdo-extract:
X	@${MKDIR} ${WRKDIR}
X	@${TAR} zxf ${DISTDIR}/${DIST_SUBDIR}/${FASTA_SRCFILE} -C ${WRKDIR}
X	@${UNZIP_CMD} -q -d ${WRKDIR}/ \
X		${DISTDIR}/${DIST_SUBDIR}/${PORTA_SRCFILE}
X
Xpost-patch:
X	@${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' \
X		${WRKSRC}/setup.py ${WRKSRC}/mysndfile.h
X# Borrowed from the portaudio port, fixes obsolete path
X	@${REINPLACE_CMD} -e 's|machine\/soundcard.h|sys\/soundcard.h|' \
X		${PORTASRC_DIR}/pa_unix_oss/pa_unix_oss.c
X
Xpost-install:
X.if !defined(WITHOUT_EXAMPLES)
X	( ${MKDIR} ${EXAMPLESDIR} && \
X		${INSTALL_DATA} ${WRKSRC}/demo.py ${EXAMPLESDIR}/ )
X.endif
X
X.include <bsd.port.mk>
END-of-py-fastaudio/Makefile
echo x - py-fastaudio/distinfo
sed 's/^X//' >py-fastaudio/distinfo << 'END-of-py-fastaudio/distinfo'
XMD5 (python/fastaudio.tar.gz) = afe72c073e0a10d4379285a78d511bd6
XSHA256 (python/fastaudio.tar.gz) = 5cd72f0b83a3eed448299f431be38efca8f3c349357997ed6e0e58aecf7be748
XSIZE (python/fastaudio.tar.gz) = 229039
XMD5 (python/portaudio_v18_1.zip) = ce66a732d263fde2b5ad2262ef37a691
XSHA256 (python/portaudio_v18_1.zip) = 9da7f1ba0b8029f934d5a8300199e29095127e6abfa03dbb3c1ce40e10751f0a
XSIZE (python/portaudio_v18_1.zip) = 550130
END-of-py-fastaudio/distinfo
echo x - py-fastaudio/pkg-descr
sed 's/^X//' >py-fastaudio/pkg-descr << 'END-of-py-fastaudio/pkg-descr'
Xpy-fastaudio is a Python module that provides bindings for the PortAudio
Xmultiplatform audio I/O library.
X
XWWW: http://www.freenet.org.nz/python/pyPortAudio/
END-of-py-fastaudio/pkg-descr
exit


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704031636.l33Ga4rh054784>