mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 17:59:20 -04:00
- Add sndio support [1]
- Remove ALSA from default options - Switch to options helpers - Move audio output options to their own option group - Make OSS support an explicit option, so that it can be turned off - Remove OGG option and make it mandatory: audio/libogg is already a dependency via audio/libvorbis - Make the port simpler by not building the examples and not installing the example games (if necessary installing them can be done later in a separate port) - Add LICENSE - Fix WWW - Allegro never directly links with libpng or libGLU; make them a build dependency only - Reset maintainer PR: 215838 Obtained from: OpenBSD [1] Approved by: mat (mentor), maintainer timeout (5 months) Differential Revision: https://reviews.freebsd.org/D11039
This commit is contained in:
parent
92f499161c
commit
03f1c01e0f
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=442981
17 changed files with 656 additions and 145 deletions
|
@ -3,119 +3,77 @@
|
||||||
|
|
||||||
PORTNAME= allegro
|
PORTNAME= allegro
|
||||||
DISTVERSION= 4.4.2
|
DISTVERSION= 4.4.2
|
||||||
PORTREVISION= 6
|
PORTREVISION= 7
|
||||||
CATEGORIES= devel
|
CATEGORIES= devel
|
||||||
MASTER_SITES= SF/alleg/allegro/${PORTVERSION}
|
MASTER_SITES= SF/alleg/allegro/${PORTVERSION}
|
||||||
DISTFILES= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}
|
|
||||||
DIST_SUBDIR= ${PORTNAME}
|
|
||||||
EXTRACT_ONLY= ${PORTNAME}-${DISTVERSION}${EXTRACT_SUFX}
|
|
||||||
|
|
||||||
MAINTAINER= koalative@gmail.com
|
MAINTAINER= ports@FreeBSD.org
|
||||||
COMMENT= Cross-platform library for games and multimedia programming
|
COMMENT= Cross-platform library for games and multimedia programming
|
||||||
|
|
||||||
LIB_DEPENDS+= libpng.so:graphics/png \
|
LICENSE= GIFTWARE
|
||||||
|
LICENSE_NAME= Giftware
|
||||||
|
LICENSE_FILE= ${WRKSRC}/docs/txt/license.txt
|
||||||
|
LICENSE_PERMS= dist-mirror dist-sell pkg-mirror pkg-sell auto-accept
|
||||||
|
|
||||||
|
# Required for building libloadpng.a and liballeggl.a
|
||||||
|
BUILD_DEPENDS= png>0:graphics/png \
|
||||||
|
libGLU>0:graphics/libGLU
|
||||||
|
LIB_DEPENDS= libogg.so:audio/libogg \
|
||||||
libvorbis.so:audio/libvorbis
|
libvorbis.so:audio/libvorbis
|
||||||
|
|
||||||
USES= cmake makeinfo pkgconfig
|
USES= cmake makeinfo pkgconfig
|
||||||
USE_XORG= x11 xpm xext xcursor xxf86vm xxf86dga
|
USE_XORG= ice sm x11 xpm xext xcursor xxf86vm xxf86dga
|
||||||
USE_GL= glu
|
|
||||||
USE_LDCONFIG= yes
|
USE_LDCONFIG= yes
|
||||||
|
|
||||||
INFO= allegro
|
INFO= allegro
|
||||||
PORTDOCS= *
|
PORTDOCS= *
|
||||||
PORTEXAMPLES= *
|
PORTEXAMPLES= *
|
||||||
|
|
||||||
PLIST_SUB+= SHLIB_VER="${SHLIB_VER}"
|
PLIST_SUB= SHLIB_VER="${PORTVERSION}"
|
||||||
CMAKE_ARGS+= -DDOCDIR="${DOCSDIR}"
|
CMAKE_ARGS= -DDOCDIR="${DOCSDIR}" \
|
||||||
|
-DWANT_MODULES=off \
|
||||||
SHLIB_VER= ${PORTVERSION}
|
-DWANT_LOGG=on \
|
||||||
|
-DWANT_EXAMPLES=off
|
||||||
|
|
||||||
# Wrong versioning upstream
|
# Wrong versioning upstream
|
||||||
PORTSCOUT= ignore:1
|
PORTSCOUT= ignore:1
|
||||||
|
|
||||||
OPTIONS_DEFINE= ALSA JACK OGG DOCS
|
OPTIONS_DEFINE= EXAMPLES DOCS
|
||||||
OPTIONS_GROUP= DEMOS_EXAMPLES
|
OPTIONS_MULTI= AUDIO
|
||||||
OPTIONS_GROUP_DEMOS_EXAMPLES= DEMOS EXAMPLES
|
OPTIONS_MULTI_AUDIO= ALSA JACK OSS SNDIO
|
||||||
OPTIONS_DEFAULT= ALSA DEMOS OGG
|
OPTIONS_DEFAULT= OSS
|
||||||
DEMOS_DESC= Install Demos programs, requires EXAMPLES
|
|
||||||
|
|
||||||
DOCSRCDIR1= ${WRKSRC}
|
|
||||||
DOC_FILES1= AUTHORS CHANGES THANKS readme.txt
|
|
||||||
|
|
||||||
DOCSRCDIR2= ${WRKSRC}/docs
|
|
||||||
DOCSDIR2= ${DOCSDIR}/docs
|
|
||||||
|
|
||||||
OPTIONS_SUB= yes
|
OPTIONS_SUB= yes
|
||||||
|
|
||||||
EXAMPLES_CMAKE_ON= -DWANT_EXAMPLES=on
|
|
||||||
EXAMPLES_CMAKE_OFF= -DWANT_EXAMPLES=off
|
|
||||||
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib
|
ALSA_LIB_DEPENDS= libasound.so:audio/alsa-lib
|
||||||
ALSA_CMAKE_ON= -DWANT_ALSA=on
|
ALSA_USES= localbase:ldflags
|
||||||
ALSA_CMAKE_OFF= -DWANT_ALSA=off
|
ALSA_CMAKE_BOOL= WANT_ALSA
|
||||||
|
|
||||||
JACK_LIB_DEPENDS= libjack.so:audio/jack
|
JACK_LIB_DEPENDS= libjack.so:audio/jack
|
||||||
JACK_CMAKE_ON= -DWANT_JACK=on
|
JACK_CMAKE_BOOL= WANT_JACK
|
||||||
JACK_CMAKE_OFF= -DWANT_JACK=off
|
|
||||||
OGG_LIB_DEPENDS= libogg.so:audio/libogg
|
|
||||||
OGG_CMAKE_ON= -DWANT_LOGG=on
|
|
||||||
OGG_CMAKE_OFF= -DWANT_LOGG=of
|
|
||||||
|
|
||||||
.include <bsd.port.options.mk>
|
OSS_CMAKE_BOOL= WANT_OSS
|
||||||
|
|
||||||
.if ${PORT_OPTIONS:MALSA}
|
SNDIO_LIB_DEPENDS= libsndio.so:audio/sndio
|
||||||
CFLAGS+= -L${LOCALBASE}/lib
|
SNDIO_CMAKE_BOOL= WANT_SNDIO
|
||||||
.endif
|
|
||||||
|
|
||||||
.if ${PORT_OPTIONS:MDEMOS} && ${PORT_OPTIONS:MEXAMPLES}
|
|
||||||
SUB_FILES+= shooter skater skater_agl \
|
|
||||||
pkg-message
|
|
||||||
MASTER_SITES+= SF/nemysisfreebsdp/${CATEGORIES}/${PORTNAME}/:icons
|
|
||||||
DISTFILES+= shooter.png:icons \
|
|
||||||
skater.png:icons
|
|
||||||
DESKTOP_ENTRIES+="Shooter" "In a distant corner of the galaxy" "shooter" \
|
|
||||||
"shooter" "Game;ArcadeGame;" false
|
|
||||||
DESKTOP_ENTRIES+="Skater" "Allegro's next demo game" "skater" \
|
|
||||||
"skater" "Game;ArcadeGame;" false
|
|
||||||
DESKTOP_ENTRIES+="Skater AGL" "Allegro's next demo game" "skater" \
|
|
||||||
"skater_agl" "Game;ArcadeGame;" false
|
|
||||||
.endif
|
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
@${REINPLACE_CMD} -e 's|/allegro-$${ALLEGRO_VERSION}||' \
|
@${REINPLACE_CMD} -e 's|/allegro-$${ALLEGRO_VERSION}||' \
|
||||||
${WRKSRC}/docs/CMakeLists.txt
|
${WRKSRC}/docs/CMakeLists.txt
|
||||||
@${REINPLACE_CMD} -e 's|<X11/extensions/xf86dga.h>|<X11/extensions/Xxf86dga.h>|' \
|
@${REINPLACE_CMD} -e 's|<X11/extensions/xf86dga.h>|<X11/extensions/Xxf86dga.h>|' \
|
||||||
${WRKSRC}/src/x/xdga2.c
|
${WRKSRC}/src/x/xdga2.c
|
||||||
.if ${PORT_OPTIONS:MJACK}
|
@${CP} ${FILESDIR}/sndio.c ${WRKSRC}/src/unix
|
||||||
|
|
||||||
|
post-patch-JACK-on:
|
||||||
@${REINPLACE_CMD} -e 's|jack_client = jack_client_new(jack_client_name);|jack_client = jack_client_open(jack_client_name, (jack_options_t)0, NULL);|' \
|
@${REINPLACE_CMD} -e 's|jack_client = jack_client_new(jack_client_name);|jack_client = jack_client_open(jack_client_name, (jack_options_t)0, NULL);|' \
|
||||||
${WRKSRC}/src/unix/jack.c
|
${WRKSRC}/src/unix/jack.c
|
||||||
.endif
|
|
||||||
|
|
||||||
post-install:
|
post-install:
|
||||||
@${INSTALL_MAN} ${WRKSRC}/docs/man/*.3 ${STAGEDIR}${MAN3PREFIX}/man/man3/
|
${INSTALL_MAN} ${WRKSRC}/docs/man/*.3 ${STAGEDIR}${MAN3PREFIX}/man/man3/
|
||||||
|
|
||||||
.if ${PORT_OPTIONS:MEXAMPLES}
|
post-install-EXAMPLES-on:
|
||||||
@(cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
|
@(cd ${WRKSRC}/examples && ${COPYTREE_SHARE} . ${STAGEDIR}${EXAMPLESDIR})
|
||||||
. for l in ex12bit ex3buf ex3d exaccel exalpha exbitmap exblend excamera excolmap \
|
|
||||||
exconfig excustom exdata exdbuf exexedat exfixed exflame exflip exfont \
|
|
||||||
exgui exhello exjoy exkeys exlights exmem exmidi exmouse expackf expal \
|
|
||||||
expat exquat exrgbhsv exrotscl exsample exscale exscn3d exscroll exshade \
|
|
||||||
exspline exsprite exstars exstream exswitch exsyscur extimer extrans \
|
|
||||||
extrans2 extruec exunicod exupdate exxfade exzbuf
|
|
||||||
@${CHMOD} u+w ${STAGEDIR}${EXAMPLESDIR}/${l}
|
|
||||||
${STRIP_CMD} ${STAGEDIR}${EXAMPLESDIR}/${l}
|
|
||||||
@${CHMOD} u-w ${STAGEDIR}${EXAMPLESDIR}/${l}
|
|
||||||
. endfor
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if ${PORT_OPTIONS:MDEMOS} && ${PORT_OPTIONS:MEXAMPLES}
|
|
||||||
@(cd ${WRKSRC} && ${COPYTREE_SHARE} demos ${STAGEDIR}${EXAMPLESDIR})
|
@(cd ${WRKSRC} && ${COPYTREE_SHARE} demos ${STAGEDIR}${EXAMPLESDIR})
|
||||||
${INSTALL_SCRIPT} ${WRKDIR}/shooter ${STAGEDIR}${PREFIX}/bin/
|
${INSTALL_DATA} ${WRKSRC}/allegro.cfg ${STAGEDIR}${EXAMPLESDIR}
|
||||||
${INSTALL_DATA} ${_DISTDIR}/shooter.png ${STAGEDIR}${PREFIX}/share/pixmaps/
|
|
||||||
@(cd ${STAGEDIR}${EXAMPLESDIR}/demos/shooter && ${CHMOD} 755 shooter)
|
|
||||||
${INSTALL_SCRIPT} ${WRKDIR}/skater* ${STAGEDIR}${PREFIX}/bin
|
|
||||||
${INSTALL_DATA} ${_DISTDIR}/skater.png ${STAGEDIR}${PREFIX}/share/pixmaps/
|
|
||||||
@(cd ${STAGEDIR}${EXAMPLESDIR}/demos/skater && ${CHMOD} 755 skater*)
|
|
||||||
${STRIP_CMD} ${STAGEDIR}${EXAMPLESDIR}/demos/shooter/shooter
|
|
||||||
${STRIP_CMD} ${STAGEDIR}${EXAMPLESDIR}/demos/skater/skater*
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.include <bsd.port.mk>
|
.include <bsd.port.mk>
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
SHA256 (allegro/allegro-4.4.2.tar.gz) = 1b21e7577dbfada02d85ca4510bd22fedaa6ce76fde7f4838c7c1276eb840fdc
|
TIMESTAMP = 1483711950
|
||||||
SIZE (allegro/allegro-4.4.2.tar.gz) = 4674902
|
SHA256 (allegro-4.4.2.tar.gz) = 1b21e7577dbfada02d85ca4510bd22fedaa6ce76fde7f4838c7c1276eb840fdc
|
||||||
SHA256 (allegro/shooter.png) = cf73f63f0224a9ee77c287b6211beb4a072ba4aa969a57993e60a2e97996e468
|
SIZE (allegro-4.4.2.tar.gz) = 4674902
|
||||||
SIZE (allegro/shooter.png) = 1741
|
|
||||||
SHA256 (allegro/skater.png) = f0274627c6eae2ecad880c3e2f25bf5f8944f08829ac32ab0a00f77001e8b2f3
|
|
||||||
SIZE (allegro/skater.png) = 3395
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
--- CMakeLists.txt.orig
|
--- CMakeLists.txt.orig 2011-03-24 23:18:50 UTC
|
||||||
+++ CMakeLists.txt
|
+++ CMakeLists.txt
|
||||||
@@ -66,7 +66,7 @@
|
@@ -66,7 +66,7 @@ if(WIN32)
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
set(ALLEGRO_VERSION 4.4.2)
|
set(ALLEGRO_VERSION 4.4.2)
|
||||||
|
@ -9,7 +9,33 @@
|
||||||
|
|
||||||
# Mac OS X -compatibility_version.
|
# Mac OS X -compatibility_version.
|
||||||
# XXX doesn't seem to work
|
# XXX doesn't seem to work
|
||||||
@@ -961,7 +961,7 @@
|
@@ -408,6 +408,7 @@ option(WANT_OSS "Build OSS support" on)
|
||||||
|
option(WANT_ALSA "Build ALSA support" on)
|
||||||
|
option(WANT_JACK "Build JACK support" on)
|
||||||
|
option(WANT_SGIAUDIO "Build SGI audio support" on)
|
||||||
|
+option(WANT_SNDIO "Build sndio audio support" on)
|
||||||
|
|
||||||
|
if(ALLEGRO_UNIX) # not MACOSX
|
||||||
|
find_package(Threads)
|
||||||
|
@@ -471,6 +472,17 @@ if(ALLEGRO_UNIX) # not MACOSX
|
||||||
|
endif(SGIAUDIO_FOUND)
|
||||||
|
endif(WANT_SGIAUDIO)
|
||||||
|
|
||||||
|
+ if(WANT_SNDIO)
|
||||||
|
+ find_path(SNDIO_INCLUDE_DIR sndio.h)
|
||||||
|
+ find_library(SNDIO_LIBRARY NAMES sndio)
|
||||||
|
+ if(SNDIO_INCLUDE_DIR AND SNDIO_LIBRARY)
|
||||||
|
+ set(ALLEGRO_WITH_SNDIODIGI 1)
|
||||||
|
+ include_directories(SYSTEM ${SNDIO_INCLUDE_DIR})
|
||||||
|
+ list(APPEND PLATFORM_LIBS_NON_MODULES ${SNDIO_LIBRARY})
|
||||||
|
+ add_our_module(alleg-sndiodigi src/unix/sndio.c ${SNDIO_LIBRARY})
|
||||||
|
+ endif(SNDIO_INCLUDE_DIR AND SNDIO_LIBRARY)
|
||||||
|
+ endif(WANT_SNDIO)
|
||||||
|
+
|
||||||
|
# aRts is obsolete
|
||||||
|
# esd is obsolete
|
||||||
|
endif(ALLEGRO_UNIX)
|
||||||
|
@@ -961,7 +973,7 @@ if(UNIX)
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
install(FILES ${LIBRARY_OUTPUT_PATH}/pkgconfig/${name}${lib_type}.pc
|
install(FILES ${LIBRARY_OUTPUT_PATH}/pkgconfig/${name}${lib_type}.pc
|
||||||
|
|
11
devel/allegro/files/patch-allegro.cfg
Normal file
11
devel/allegro/files/patch-allegro.cfg
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
$OpenBSD: patch-allegro_cfg,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
|
||||||
|
--- allegro.cfg.orig 2006-05-21 10:01:46 UTC
|
||||||
|
+++ allegro.cfg
|
||||||
|
@@ -326,6 +326,7 @@ mouse_accel_factor =
|
||||||
|
# ARTS - aRts (Analog Real-Time Synthesizer)
|
||||||
|
# ALSA - ALSA Sound System
|
||||||
|
# JACK - JACK Audio Server
|
||||||
|
+# SIOD - sndio Audio API
|
||||||
|
#
|
||||||
|
# BeOS digital sound drivers:
|
||||||
|
#
|
10
devel/allegro/files/patch-cmake_FileList.cmake
Normal file
10
devel/allegro/files/patch-cmake_FileList.cmake
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--- cmake/FileList.cmake.orig 2011-03-12 00:26:00 UTC
|
||||||
|
+++ cmake/FileList.cmake
|
||||||
|
@@ -260,6 +260,7 @@ set(ALLEGRO_SRC_UNIX_FILES
|
||||||
|
src/unix/arts.c
|
||||||
|
src/unix/sgial.c
|
||||||
|
src/unix/jack.c
|
||||||
|
+ src/unix/sndio.c
|
||||||
|
src/unix/udjgpp.c
|
||||||
|
src/unix/udrvlist.c
|
||||||
|
src/unix/udummy.c
|
25
devel/allegro/files/patch-include_allegro_platform_alunix.h
Normal file
25
devel/allegro/files/patch-include_allegro_platform_alunix.h
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
$OpenBSD: patch-include_allegro_platform_alunix_h,v 1.1 2010/04/26 02:56:30 jakemsr Exp $
|
||||||
|
--- include/allegro/platform/alunix.h.orig 2007-06-16 01:52:28 UTC
|
||||||
|
+++ include/allegro/platform/alunix.h
|
||||||
|
@@ -69,6 +69,8 @@ AL_VAR(TIMER_DRIVER, timerdrv_unix_sigal
|
||||||
|
#define DIGI_ALSA AL_ID('A','L','S','A')
|
||||||
|
#define MIDI_ALSA AL_ID('A','M','I','D')
|
||||||
|
#define DIGI_JACK AL_ID('J','A','C','K')
|
||||||
|
+#define DIGI_SNDIO AL_ID('S','I','O','D')
|
||||||
|
+#define MIDI_SNDIO AL_ID('M','I','O','M')
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ALLEGRO_WITH_OSSDIGI
|
||||||
|
@@ -85,6 +87,12 @@ AL_VAR(MIDI_DRIVER, midi_oss);
|
||||||
|
|
||||||
|
#ifndef ALLEGRO_WITH_MODULES
|
||||||
|
|
||||||
|
+#ifdef ALLEGRO_WITH_SNDIODIGI
|
||||||
|
+AL_VAR(DIGI_DRIVER, digi_sndio);
|
||||||
|
+#define DIGI_DRIVER_SNDIO \
|
||||||
|
+ { DIGI_SNDIO, &digi_sndio, TRUE },
|
||||||
|
+#endif /* ALLEGRO_WITH_SNDIODIGI */
|
||||||
|
+
|
||||||
|
#ifdef ALLEGRO_WITH_ESDDIGI
|
||||||
|
AL_VAR(DIGI_DRIVER, digi_esd);
|
||||||
|
#define DIGI_DRIVER_ESD \
|
|
@ -0,0 +1,12 @@
|
||||||
|
--- include/allegro/platform/alunixac.h.cmake.orig 2010-05-08 05:55:30 UTC
|
||||||
|
+++ include/allegro/platform/alunixac.h.cmake
|
||||||
|
@@ -143,6 +143,9 @@
|
||||||
|
/* Define if JACK DIGI driver is supported. */
|
||||||
|
#cmakedefine ALLEGRO_WITH_JACKDIGI
|
||||||
|
|
||||||
|
+/* Define if SNDIO DIGI driver is supported. */
|
||||||
|
+#cmakedefine ALLEGRO_WITH_SNDIODIGI
|
||||||
|
+
|
||||||
|
/* Define if OSS DIGI driver is supported. */
|
||||||
|
#cmakedefine ALLEGRO_WITH_OSSDIGI
|
||||||
|
|
7
devel/allegro/files/patch-modules.lst
Normal file
7
devel/allegro/files/patch-modules.lst
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
--- modules.lst.orig 2004-04-10 00:19:15 UTC
|
||||||
|
+++ modules.lst
|
||||||
|
@@ -10,3 +10,4 @@ alleg-sgialdigi.so
|
||||||
|
alleg-alsadigi.so
|
||||||
|
alleg-alsamidi.so
|
||||||
|
alleg-jackdigi.so
|
||||||
|
+alleg-sndiodigi.so
|
12
devel/allegro/files/patch-src_unix_usnddrv.c
Normal file
12
devel/allegro/files/patch-src_unix_usnddrv.c
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
--- src/unix/usnddrv.c.orig 2004-09-24 14:45:03 UTC
|
||||||
|
+++ src/unix/usnddrv.c
|
||||||
|
@@ -24,6 +24,9 @@ BEGIN_DIGI_DRIVER_LIST
|
||||||
|
#if (defined ALLEGRO_WITH_JACKDIGI) && (!defined ALLEGRO_WITH_MODULES)
|
||||||
|
DIGI_DRIVER_JACK
|
||||||
|
#endif
|
||||||
|
+#if (defined ALLEGRO_WITH_SNDIODIGI) && (!defined ALLEGRO_WITH_MODULES)
|
||||||
|
+ DIGI_DRIVER_SNDIO
|
||||||
|
+#endif
|
||||||
|
#if (defined ALLEGRO_WITH_SGIALDIGI) && (!defined ALLEGRO_WITH_MODULES)
|
||||||
|
DIGI_DRIVER_SGIAL
|
||||||
|
#endif
|
|
@ -1,5 +1,5 @@
|
||||||
--- src/x/xkeyboard.c.orig 2010-12-08 09:13:50.000000000 +0100
|
--- src/x/xkeyboard.c.orig 2010-12-08 08:13:50 UTC
|
||||||
+++ src/x/xkeyboard.c 2013-07-28 00:17:52.000000000 +0200
|
+++ src/x/xkeyboard.c
|
||||||
@@ -23,6 +23,7 @@
|
@@ -23,6 +23,7 @@
|
||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
#include <X11/Xproto.h>
|
#include <X11/Xproto.h>
|
||||||
|
|
||||||
#include "allegro.h"
|
#include "allegro.h"
|
||||||
@@ -617,7 +618,7 @@
|
@@ -617,7 +618,7 @@ void _xwin_get_keyboard_mapping(void)
|
||||||
|
|
||||||
TRACE (PREFIX_I "Modifier %d:", i + 1);
|
TRACE (PREFIX_I "Modifier %d:", i + 1);
|
||||||
for (j = 0; j < xmodmap->max_keypermod; j++) {
|
for (j = 0; j < xmodmap->max_keypermod; j++) {
|
|
@ -1,25 +0,0 @@
|
||||||
===============================================================================
|
|
||||||
|
|
||||||
Allegro has been installed.
|
|
||||||
|
|
||||||
Allegro have two Demos (Games)
|
|
||||||
|
|
||||||
Shooter and Skater
|
|
||||||
|
|
||||||
|
|
||||||
You can use executable
|
|
||||||
|
|
||||||
%%LOCALBASE%%/bin/shooter
|
|
||||||
|
|
||||||
%%LOCALBASE%%/bin/skater
|
|
||||||
|
|
||||||
|
|
||||||
Or can use desktop files
|
|
||||||
|
|
||||||
%%LOCALBASE%%/share/applications/shooter.desktop
|
|
||||||
|
|
||||||
%%LOCALBASE%%/share/applications/skater.desktop
|
|
||||||
|
|
||||||
Have fun!
|
|
||||||
|
|
||||||
===============================================================================
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# # $FreeBSD$
|
|
||||||
#
|
|
||||||
|
|
||||||
cd "%%EXAMPLESDIR%%/demos/shooter"
|
|
||||||
exec ./shooter "${@}"
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# # $FreeBSD$
|
|
||||||
#
|
|
||||||
|
|
||||||
cd "%%EXAMPLESDIR%%/demos/skater"
|
|
||||||
exec ./skater "${@}"
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# # $FreeBSD$
|
|
||||||
#
|
|
||||||
|
|
||||||
cd "%%EXAMPLESDIR%%/demos/skater"
|
|
||||||
exec ./skater_agl "${@}"
|
|
509
devel/allegro/files/sndio.c
Normal file
509
devel/allegro/files/sndio.c
Normal file
|
@ -0,0 +1,509 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010 Jacob Meuser <jakemsr@sdf.lonestar.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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "allegro.h"
|
||||||
|
|
||||||
|
#if (defined ALLEGRO_WITH_SNDIODIGI) && ((!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE))
|
||||||
|
|
||||||
|
#include "allegro/internal/aintern.h"
|
||||||
|
#include "allegro/platform/aintunix.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <poll.h>
|
||||||
|
#include <sndio.h>
|
||||||
|
|
||||||
|
static int sndio_detect(int input);
|
||||||
|
static int sndio_init(int input, int voices);
|
||||||
|
static void sndio_exit(int input);
|
||||||
|
static int sndio_set_mixer_volume(int volume);
|
||||||
|
static int sndio_get_mixer_volume(void);
|
||||||
|
|
||||||
|
static int sndio_buffer_size(void);
|
||||||
|
|
||||||
|
static int sndio_rec_cap_rate(int bits, int stereo);
|
||||||
|
static int sndio_rec_cap_parm(int rate, int bits, int stereo);
|
||||||
|
static int sndio_rec_source(int source);
|
||||||
|
static int sndio_rec_start(int rate, int bits, int stereo);
|
||||||
|
static void sndio_rec_stop(void);
|
||||||
|
static int sndio_rec_read(void *buf);
|
||||||
|
|
||||||
|
static int open_sndio_device(int input);
|
||||||
|
static void sndio_update(int threaded);
|
||||||
|
static void movecb(void *addr, int delta);
|
||||||
|
static void volcb(void *addr, unsigned vol);
|
||||||
|
|
||||||
|
static struct sio_hdl *hdl;
|
||||||
|
static struct sio_par par;
|
||||||
|
static int sndio_signed;
|
||||||
|
static int sndio_play_bufsize, sndio_play_round, sndio_play_appbufsz;
|
||||||
|
static unsigned char *sndio_play_bufdata;
|
||||||
|
static char sndio_desc[256] = EMPTY_STRING;
|
||||||
|
long long sndio_realpos, sndio_playpos;
|
||||||
|
int sndio_volume;
|
||||||
|
|
||||||
|
static int sndio_save_bits, sndio_save_stereo, sndio_save_freq;
|
||||||
|
static int sndio_rec_bufsize, sndio_rec_round, sndio_rec_appbufsz;
|
||||||
|
static unsigned char *sndio_rec_bufdata;
|
||||||
|
|
||||||
|
DIGI_DRIVER digi_sndio =
|
||||||
|
{
|
||||||
|
DIGI_SNDIO,
|
||||||
|
empty_string,
|
||||||
|
empty_string,
|
||||||
|
"sndio",
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
MIXER_MAX_SFX,
|
||||||
|
MIXER_DEF_SFX,
|
||||||
|
|
||||||
|
/* setup routines */
|
||||||
|
sndio_detect,
|
||||||
|
sndio_init,
|
||||||
|
sndio_exit,
|
||||||
|
sndio_set_mixer_volume,
|
||||||
|
sndio_get_mixer_volume,
|
||||||
|
|
||||||
|
/* for use by the audiostream functions */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
sndio_buffer_size,
|
||||||
|
|
||||||
|
/* voice control functions */
|
||||||
|
_mixer_init_voice,
|
||||||
|
_mixer_release_voice,
|
||||||
|
_mixer_start_voice,
|
||||||
|
_mixer_stop_voice,
|
||||||
|
_mixer_loop_voice,
|
||||||
|
|
||||||
|
/* position control functions */
|
||||||
|
_mixer_get_position,
|
||||||
|
_mixer_set_position,
|
||||||
|
|
||||||
|
/* volume control functions */
|
||||||
|
_mixer_get_volume,
|
||||||
|
_mixer_set_volume,
|
||||||
|
_mixer_ramp_volume,
|
||||||
|
_mixer_stop_volume_ramp,
|
||||||
|
|
||||||
|
/* pitch control functions */
|
||||||
|
_mixer_get_frequency,
|
||||||
|
_mixer_set_frequency,
|
||||||
|
_mixer_sweep_frequency,
|
||||||
|
_mixer_stop_frequency_sweep,
|
||||||
|
|
||||||
|
/* pan control functions */
|
||||||
|
_mixer_get_pan,
|
||||||
|
_mixer_set_pan,
|
||||||
|
_mixer_sweep_pan,
|
||||||
|
_mixer_stop_pan_sweep,
|
||||||
|
|
||||||
|
/* effect control functions */
|
||||||
|
_mixer_set_echo,
|
||||||
|
_mixer_set_tremolo,
|
||||||
|
_mixer_set_vibrato,
|
||||||
|
|
||||||
|
/* input functions */
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
sndio_rec_cap_rate,
|
||||||
|
sndio_rec_cap_parm,
|
||||||
|
sndio_rec_source,
|
||||||
|
sndio_rec_start,
|
||||||
|
sndio_rec_stop,
|
||||||
|
sndio_rec_read
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* used to probe and to configure the device. don't use sio_start() here. */
|
||||||
|
static int
|
||||||
|
open_sndio_device(int input)
|
||||||
|
{
|
||||||
|
hdl = sio_open(NULL, (input ? SIO_REC : SIO_PLAY), 0);
|
||||||
|
if (hdl == NULL) {
|
||||||
|
uszprintf(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("sio_opn failed"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sio_initpar(&par);
|
||||||
|
par.bits = (_sound_bits == 8) ? 8 : 16;
|
||||||
|
par.sig = (_sound_bits == 8) ? 0 : 1;
|
||||||
|
if (input)
|
||||||
|
par.rchan = (_sound_stereo) ? 2 : 1;
|
||||||
|
else
|
||||||
|
par.pchan = (_sound_stereo) ? 2 : 1;
|
||||||
|
par.rate = (_sound_freq > 0) ? _sound_freq : 48000;
|
||||||
|
par.le = SIO_LE_NATIVE;
|
||||||
|
/* allegro wants small blocks */
|
||||||
|
par.round = 512;
|
||||||
|
par.appbufsz = par.rate / 10;
|
||||||
|
|
||||||
|
if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) ||
|
||||||
|
(par.bits != 8 && par.bits != 16) ||
|
||||||
|
(par.bits == 8 && par.sig) ||
|
||||||
|
(par.bits == 16 && !par.sig) ||
|
||||||
|
(par.bits == 16 && par.le != SIO_LE_NATIVE) ||
|
||||||
|
(input && (par.rchan != 1 && par.rchan != 2)) ||
|
||||||
|
(!input && (par.pchan != 1 && par.pchan != 2))) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("could not set sndio parameters"));
|
||||||
|
sio_close(hdl);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_sound_bits = par.bits;
|
||||||
|
_sound_stereo = input ? par.rchan == 2 : par.pchan == 2;
|
||||||
|
_sound_freq = par.rate;
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
sndio_rec_round = par.round;
|
||||||
|
sndio_rec_appbufsz = par.appbufsz;
|
||||||
|
sndio_rec_bufsize = par.round * par.bps * par.rchan;
|
||||||
|
} else {
|
||||||
|
sndio_play_round = par.round;
|
||||||
|
sndio_play_appbufsz = par.appbufsz;
|
||||||
|
sndio_play_bufsize = sndio_play_round * par.bps * par.pchan;
|
||||||
|
}
|
||||||
|
sndio_signed = par.sig ? 1 : 0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
sndio_detect(int input)
|
||||||
|
{
|
||||||
|
if (input) {
|
||||||
|
if (digi_driver != digi_input_driver) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("sndio output driver must be installed before input can be read"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (open_sndio_device(0) != 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
sio_close(hdl);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* number of samples per channel in a block */
|
||||||
|
static int
|
||||||
|
sndio_buffer_size(void)
|
||||||
|
{
|
||||||
|
return sndio_play_round;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* callback for data movement notification */
|
||||||
|
static void
|
||||||
|
movecb(void *addr, int delta)
|
||||||
|
{
|
||||||
|
sndio_realpos += delta;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* callback for volume change notification */
|
||||||
|
static void
|
||||||
|
volcb(void *addr, unsigned vol)
|
||||||
|
{
|
||||||
|
sndio_volume = vol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* write as many blocks as is currently possible */
|
||||||
|
static void
|
||||||
|
sndio_update(int threaded)
|
||||||
|
{
|
||||||
|
struct pollfd pfd;
|
||||||
|
nfds_t nfds;
|
||||||
|
int i, nblocks, nbytes;
|
||||||
|
|
||||||
|
/* make sure counters have been updated */
|
||||||
|
nfds = sio_pollfd(hdl, &pfd, POLLOUT);
|
||||||
|
poll(&pfd, nfds, 0);
|
||||||
|
if (!(sio_revents(hdl, &pfd) & POLLOUT))
|
||||||
|
return;
|
||||||
|
|
||||||
|
nblocks = (sndio_play_appbufsz - (sndio_playpos - sndio_realpos)) /
|
||||||
|
sndio_play_round;
|
||||||
|
|
||||||
|
/* we got POLLOUT, so we can write something. if we don't
|
||||||
|
* write anything, we could underrun.
|
||||||
|
*/
|
||||||
|
if (nblocks < 1)
|
||||||
|
nblocks = 1;
|
||||||
|
|
||||||
|
for (i = 0; i < nblocks; i++) {
|
||||||
|
sio_write(hdl, sndio_play_bufdata, sndio_play_bufsize);
|
||||||
|
sndio_playpos += sndio_play_round;
|
||||||
|
if (sio_eof(hdl)) {
|
||||||
|
/* print error message? */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_mix_some_samples((uintptr_t) sndio_play_bufdata, 0, sndio_signed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
sndio_init(int input, int voices)
|
||||||
|
{
|
||||||
|
char tmp1[128], tmp2[128];
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
digi_driver->rec_cap_bits = 16;
|
||||||
|
digi_driver->rec_cap_stereo = TRUE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (open_sndio_device(0) != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
sndio_play_bufdata = _AL_MALLOC_ATOMIC(sndio_play_bufsize);
|
||||||
|
if (sndio_play_bufdata == 0) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("Can not allocate audio buffer"));
|
||||||
|
sio_close(hdl);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sndio_realpos = sndio_playpos = 0;
|
||||||
|
sio_onmove(hdl, movecb, NULL);
|
||||||
|
|
||||||
|
sndio_volume = 127;
|
||||||
|
sio_onvol(hdl, volcb, NULL);
|
||||||
|
|
||||||
|
if (!sio_start(hdl)) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("Can not start sndio"));
|
||||||
|
sio_close(hdl);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
digi_sndio.voices = voices;
|
||||||
|
|
||||||
|
/* first arg is total number of samples */
|
||||||
|
if (_mixer_init(sndio_play_round * (_sound_stereo ? 2 : 1),
|
||||||
|
_sound_freq, _sound_stereo, ((_sound_bits == 16) ? 1 : 0),
|
||||||
|
&digi_sndio.voices) != 0) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("Can not init software mixer"));
|
||||||
|
sio_close(hdl);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_mix_some_samples((uintptr_t) sndio_play_bufdata, 0, sndio_signed);
|
||||||
|
|
||||||
|
/* Add audio interrupt. */
|
||||||
|
_unix_bg_man->register_func(sndio_update);
|
||||||
|
|
||||||
|
uszprintf(sndio_desc, sizeof(sndio_desc),
|
||||||
|
get_config_text("%s: %d bits, %s, %d Hz, %s"),
|
||||||
|
"sndio device",
|
||||||
|
_sound_bits,
|
||||||
|
uconvert_ascii((sndio_signed ? "signed" : "unsigned"), tmp1),
|
||||||
|
_sound_freq,
|
||||||
|
uconvert_ascii((par.pchan == 2 ? "stereo" : "mono"), tmp2));
|
||||||
|
|
||||||
|
digi_driver->desc = sndio_desc;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
sndio_exit(int input)
|
||||||
|
{
|
||||||
|
if (input)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_unix_bg_man->unregister_func(sndio_update);
|
||||||
|
|
||||||
|
_AL_FREE(sndio_play_bufdata);
|
||||||
|
sndio_play_bufdata = 0;
|
||||||
|
|
||||||
|
_mixer_exit();
|
||||||
|
|
||||||
|
if (hdl != NULL)
|
||||||
|
sio_close(hdl);
|
||||||
|
hdl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 'volume' is 0-255 */
|
||||||
|
static int
|
||||||
|
sndio_set_mixer_volume(int volume)
|
||||||
|
{
|
||||||
|
if (!sio_setvol(hdl, volume / 2))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* should return 0-255 */
|
||||||
|
static int
|
||||||
|
sndio_get_mixer_volume(void)
|
||||||
|
{
|
||||||
|
return sndio_volume * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Returns maximum recording sampling rate. */
|
||||||
|
static int
|
||||||
|
sndio_rec_cap_rate(int bits, int stereo)
|
||||||
|
{
|
||||||
|
/* should use sio_getcap() */
|
||||||
|
return 48000;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Returns whether the specified parameters can be set. */
|
||||||
|
static int
|
||||||
|
sndio_rec_cap_parm(int rate, int bits, int stereo)
|
||||||
|
{
|
||||||
|
/* should use sio_getcap() */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Sets the sampling source for audio recording. */
|
||||||
|
static int
|
||||||
|
sndio_rec_source(int source)
|
||||||
|
{
|
||||||
|
/* not implemented in sndio */
|
||||||
|
|
||||||
|
switch (source) {
|
||||||
|
case SOUND_INPUT_MIC:
|
||||||
|
break;
|
||||||
|
case SOUND_INPUT_LINE:
|
||||||
|
break;
|
||||||
|
case SOUND_INPUT_CD:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Re-opens device with read-mode and starts recording (half-duplex).
|
||||||
|
* Returns the DMA buffer size if successful.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
sndio_rec_start(int rate, int bits, int stereo)
|
||||||
|
{
|
||||||
|
sndio_save_bits = _sound_bits;
|
||||||
|
sndio_save_stereo = _sound_stereo;
|
||||||
|
sndio_save_freq = _sound_freq;
|
||||||
|
|
||||||
|
_unix_bg_man->unregister_func(sndio_update);
|
||||||
|
|
||||||
|
if (hdl != NULL)
|
||||||
|
sio_close(hdl);
|
||||||
|
hdl = NULL;
|
||||||
|
|
||||||
|
_sound_bits = bits;
|
||||||
|
_sound_stereo = stereo;
|
||||||
|
_sound_freq = rate;
|
||||||
|
|
||||||
|
if (open_sndio_device(1) != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
sndio_volume = 127;
|
||||||
|
sio_onvol(hdl, volcb, NULL);
|
||||||
|
|
||||||
|
if (!sio_start(hdl)) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("Can not start sndio for recording"));
|
||||||
|
sio_close(hdl);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sndio_rec_bufsize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Stops recording and switches the device back to the original mode. */
|
||||||
|
static void
|
||||||
|
sndio_rec_stop(void)
|
||||||
|
{
|
||||||
|
if (hdl != NULL)
|
||||||
|
sio_close(hdl);
|
||||||
|
hdl = NULL;
|
||||||
|
|
||||||
|
_sound_bits = sndio_save_bits;
|
||||||
|
_sound_stereo = sndio_save_stereo;
|
||||||
|
_sound_freq = sndio_save_freq;
|
||||||
|
|
||||||
|
if (open_sndio_device(0) != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sndio_realpos = sndio_playpos = 0;
|
||||||
|
sio_onmove(hdl, movecb, NULL);
|
||||||
|
|
||||||
|
sndio_volume = 127;
|
||||||
|
sio_onvol(hdl, volcb, NULL);
|
||||||
|
|
||||||
|
if (!sio_start(hdl)) {
|
||||||
|
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE,
|
||||||
|
get_config_text("Can not start sndio"));
|
||||||
|
sio_close(hdl);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_unix_bg_man->register_func(sndio_update);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Retrieves the just recorded buffer, if there is one. */
|
||||||
|
static int
|
||||||
|
sndio_rec_read(void *buf)
|
||||||
|
{
|
||||||
|
struct pollfd pfd;
|
||||||
|
nfds_t nfds;
|
||||||
|
int ret, nbytes, offset = 0;
|
||||||
|
|
||||||
|
/* make sure counters have been updated */
|
||||||
|
nfds = sio_pollfd(hdl, &pfd, POLLIN);
|
||||||
|
poll(&pfd, nfds, 0);
|
||||||
|
sio_revents(hdl, &pfd);
|
||||||
|
if (!(sio_revents(hdl, &pfd) & POLLIN))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
nbytes = sndio_rec_bufsize;
|
||||||
|
while (nbytes) {
|
||||||
|
ret = sio_read(hdl, buf + offset, nbytes);
|
||||||
|
if (sio_eof(hdl))
|
||||||
|
return 0;
|
||||||
|
offset += ret;
|
||||||
|
nbytes -= ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ALLEGRO_WITH_SNDIODIGI */
|
|
@ -4,4 +4,4 @@ other types of multimedia programming.
|
||||||
A wide range of extension packages and add-on modules are also available, which
|
A wide range of extension packages and add-on modules are also available, which
|
||||||
can be found in the "Library Extensions" section of the Allegro website.
|
can be found in the "Library Extensions" section of the Allegro website.
|
||||||
|
|
||||||
WWW: http://www.talula.demon.co.uk/allegro/
|
WWW: http://liballeg.org/
|
||||||
|
|
|
@ -8,9 +8,6 @@ bin/grabber
|
||||||
bin/pack
|
bin/pack
|
||||||
bin/pat2dat
|
bin/pat2dat
|
||||||
bin/rgbmap
|
bin/rgbmap
|
||||||
%%DEMOS%%%%EXAMPLES%%bin/shooter
|
|
||||||
%%DEMOS%%%%EXAMPLES%%bin/skater
|
|
||||||
%%DEMOS%%%%EXAMPLES%%bin/skater_agl
|
|
||||||
bin/textconv
|
bin/textconv
|
||||||
include/alleggl.h
|
include/alleggl.h
|
||||||
include/allegro.h
|
include/allegro.h
|
||||||
|
@ -118,11 +115,6 @@ include/jpgalleg.h
|
||||||
include/loadpng.h
|
include/loadpng.h
|
||||||
include/logg.h
|
include/logg.h
|
||||||
include/xalleg.h
|
include/xalleg.h
|
||||||
%%ALSA%%lib/allegro/%%SHLIB_VER%%/alleg-alsadigi.so
|
|
||||||
%%ALSA%%lib/allegro/%%SHLIB_VER%%/alleg-alsamidi.so
|
|
||||||
%%ALSA%%lib/allegro/%%SHLIB_VER%%/alleg-dga2.so
|
|
||||||
%%JACK%%lib/allegro/%%SHLIB_VER%%/alleg-jack.so
|
|
||||||
lib/allegro/%%SHLIB_VER%%/modules.lst
|
|
||||||
lib/liballeg.so
|
lib/liballeg.so
|
||||||
lib/liballeg.so.4
|
lib/liballeg.so.4
|
||||||
lib/liballeg.so.%%SHLIB_VER%%
|
lib/liballeg.so.%%SHLIB_VER%%
|
||||||
|
@ -1058,5 +1050,3 @@ man/man3/voice_sweep_pan.3.gz
|
||||||
man/man3/vsync.3.gz
|
man/man3/vsync.3.gz
|
||||||
man/man3/xor_mode.3.gz
|
man/man3/xor_mode.3.gz
|
||||||
man/man3/xwin_set_window_name.3.gz
|
man/man3/xwin_set_window_name.3.gz
|
||||||
%%DEMOS%%%%EXAMPLES%%share/pixmaps/shooter.png
|
|
||||||
%%DEMOS%%%%EXAMPLES%%share/pixmaps/skater.png
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue