mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 04:00:05 +02:00
Port of OpenCP, a MOD player.
This commit is contained in:
27
media-sound/ocp/ocp-snapshot20110319.bep
Normal file
27
media-sound/ocp/ocp-snapshot20110319.bep
Normal file
@@ -0,0 +1,27 @@
|
||||
DESCRIPTION="ocp - Open Cubic Player, a music player ported from DOS"
|
||||
HOMEPAGE="http://stian.cubic.org/project-ocp.php"
|
||||
SRC_URI="http://stian.cubic.org/ocp/ocp-snapshot-20110319.tar.bz2"
|
||||
CHECKSUM_MD5="4adb34d39053e06bca00aa6b4ec8dd93"
|
||||
REVISION="1"
|
||||
STATUS_HAIKU="stable"
|
||||
DEPEND="media-libs/libvorbis >= 1.3.1
|
||||
media-libs/libogg >= 1.2.2
|
||||
sys-devel/gettext >= 0.18.1.1
|
||||
media-libs/libsdl >= 1.2.14"
|
||||
# media-libs/flac >= 1.2.1"
|
||||
# ncurses zlib ... cf. ocp.spec
|
||||
MESSAGE="This port requires gcc4"
|
||||
BUILD {
|
||||
cd ocp-snapshot-20110319
|
||||
autoconf
|
||||
CPPFLAGS=-I/boot/common/include LDFLAGS=-L/boot/common/lib ./configure --prefix=/boot/common
|
||||
make
|
||||
}
|
||||
|
||||
INSTALL {
|
||||
cd ocp-snapshot-20110319
|
||||
make install
|
||||
}
|
||||
|
||||
LICENSE="GNU GPL v2"
|
||||
COPYRIGHT="2000-2008 Michael Smith, Stan Seibert and other contributers"
|
||||
504
media-sound/ocp/patches/ocp-snapshot20110319.patch
Normal file
504
media-sound/ocp/patches/ocp-snapshot20110319.patch
Normal file
@@ -0,0 +1,504 @@
|
||||
diff -ur ../ocp-snapshot-20110319.org/Makefile.in ./Makefile.in
|
||||
--- ../ocp-snapshot-20110319.org/Makefile.in 2011-03-19 01:04:33.008650752 +0100
|
||||
+++ ocp-snapshot-20110319/Makefile.in 2011-03-19 02:03:20.319291392 +0100
|
||||
@@ -165,7 +165,7 @@
|
||||
$(MAKE) -C doc TOPDIR="../$(TOPDIR)"
|
||||
|
||||
ocp: boot/kickload.o
|
||||
- $(CC) $(LDFLAGS) -o $@ $^ -pthread @DL_LIBS@ @EFENCE_LIBS@ @DUMA_LIBS@
|
||||
+ $(CC) $(LDFLAGS) -o $@ $^ @PTHREAD_LIBS@ @DL_LIBS@ @EFENCE_LIBS@ @DUMA_LIBS@
|
||||
|
||||
ocp.hlp: doc/opencp.dox goodies/helpc/ocphhc
|
||||
goodies/helpc/ocphhc doc/opencp.dox $@
|
||||
@@ -207,7 +207,7 @@
|
||||
rm -Rf config.h autom4te.cache Rules.make config.log config.status Makefile ocp.ini desktop/opencubicplayer.desktop doc/texi/faq.texi doc/texi/install.texi doc/texi/ocp.texi goodies/pack/Makefile goodies/helpc/Makefile
|
||||
|
||||
fstypes$(LIB_SUFFIX): dirs $(fstypes_so)
|
||||
- $(CC) $(SHARED_FLAGS) $(ICONV_LIBS) -o $@ $(fstypes_so)
|
||||
+ $(CC) $(SHARED_FLAGS) $(ICONV_LIBS) $(LDFLAGS) -o $@ $(fstypes_so)
|
||||
|
||||
libocp$(LIB_SUFFIX): $(libocp_so)
|
||||
$(CC) $(SHARED_FLAGS) $(STATIC_LIBS) -o $@ $(libocp_so)
|
||||
diff -ur ../ocp-snapshot-20110319.org/boot/kickload.c ./boot/kickload.c
|
||||
--- ../ocp-snapshot-20110319.org/boot/kickload.c 2011-03-19 01:04:33.044826624 +0100
|
||||
+++ ocp-snapshot-20110319/boot/kickload.c 2011-03-19 02:03:20.439091200 +0100
|
||||
@@ -601,6 +601,8 @@
|
||||
|
||||
#ifdef __linux
|
||||
dir=get_current_dir_name();
|
||||
+#elif defined(HAVE_GETCWD)
|
||||
+ dir=getcwd(malloc(PATH_MAX), PATH_MAX);
|
||||
#else /* BSD */
|
||||
dir=getwd(malloc(PATH_MAX));
|
||||
#endif
|
||||
diff -ur ../ocp-snapshot-20110319.org/boot/pmain.c ./boot/pmain.c
|
||||
--- ../ocp-snapshot-20110319.org/boot/pmain.c 2011-03-19 01:04:33.045350912 +0100
|
||||
+++ ocp-snapshot-20110319/boot/pmain.c 2011-03-19 15:09:03.064749568 +0100
|
||||
@@ -110,7 +110,7 @@
|
||||
printf(" curses : ncurses driver\n");
|
||||
printf(" x11 : x11 driver\n");
|
||||
printf(" vcsa : vcsa/fb linux console driver\n");
|
||||
- printf(" sdl : SDL video driverr\n");
|
||||
+ printf(" sdl : SDL video driver\n");
|
||||
printf("\nExample : ocp -fl0,r1 -vp75,f2 -spdevpdisk -sr48000 ftstar.xm\n");
|
||||
printf(" (for nice HD rendering of modules)\n");
|
||||
return errHelpPrinted;
|
||||
diff -ur ../ocp-snapshot-20110319.org/config.h.in ./config.h.in
|
||||
--- ../ocp-snapshot-20110319.org/config.h.in 2011-03-19 01:04:33.066060288 +0100
|
||||
+++ ocp-snapshot-20110319/config.h.in 2011-03-19 02:05:09.172490752 +0100
|
||||
@@ -190,6 +190,8 @@
|
||||
|
||||
#undef DLLVERSION
|
||||
|
||||
+#undef HAVE_GETCWD
|
||||
+
|
||||
#undef HAVE_MEMMEM
|
||||
|
||||
#undef HAVE_QSORT
|
||||
diff -ur ../ocp-snapshot-20110319.org/configure.ac ./configure.ac
|
||||
--- ../ocp-snapshot-20110319.org/configure.ac 2011-03-19 01:04:33.051642368 +0100
|
||||
+++ ocp-snapshot-20110319/configure.ac 2011-03-19 02:44:49.498860032 +0100
|
||||
@@ -29,6 +29,7 @@
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
AC_SUBST(SHARED_FLAGS)
|
||||
+AC_SUBST(PTHREAD_LIBS)
|
||||
AC_SUBST(LIB_SUFFIX)
|
||||
target=`gcc -dumpmachine`
|
||||
case "$target" in
|
||||
@@ -36,10 +37,18 @@
|
||||
SHARED_FLAGS="-dynamiclib -flat_namespace -undefined suppress"
|
||||
CFLAGS="$CFLAGS -fno-common"
|
||||
CXXFLAGS="$CXXFLAGS -fno-common"
|
||||
+ PTHREAD_LIBS=-pthread
|
||||
LIB_SUFFIX=.dylib
|
||||
;;
|
||||
+ *-haiku*)
|
||||
+ SHARED_FLAGS=-shared
|
||||
+ LIB_SUFFIX=.so
|
||||
+ PTHREAD_LIBS=
|
||||
+ with_desktop_file_install=no
|
||||
+ ;;
|
||||
*)
|
||||
SHARED_FLAGS=-shared
|
||||
+ PTHREAD_LIBS=-pthread
|
||||
LIB_SUFFIX=.so
|
||||
;;
|
||||
esac
|
||||
@@ -172,6 +181,7 @@
|
||||
])
|
||||
)
|
||||
|
||||
+AC_CHECK_FUNCS(getcwd)
|
||||
AC_CHECK_FUNCS(memmem)
|
||||
AC_CHECK_FUNCS(qsort)
|
||||
AC_CHECK_FUNCS(sysconf)
|
||||
diff -ur ../ocp-snapshot-20110319.org/stuff/compat.c ./stuff/compat.c
|
||||
--- ../ocp-snapshot-20110319.org/stuff/compat.c 2011-03-19 01:04:33.053739520 +0100
|
||||
+++ ocp-snapshot-20110319/stuff/compat.c 2011-03-19 02:10:17.354418688 +0100
|
||||
@@ -204,7 +204,7 @@
|
||||
*src=toupper(*src);
|
||||
src++;
|
||||
}
|
||||
- return src;
|
||||
+ return retval;
|
||||
}
|
||||
|
||||
#endif
|
||||
diff -ur ../ocp-snapshot-20110319.org/devp/Makefile ./devp/Makefile
|
||||
--- ../ocp-snapshot-20110319.org/devp/Makefile 2011-03-19 01:04:33.048234496 +0100
|
||||
+++ ocp-snapshot-20110319/devp/Makefile 2011-03-19 03:37:27.953679872 +0100
|
||||
@@ -13,7 +13,11 @@
|
||||
COREAUDIO_SO=devpcoreaudio$(LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
-all: devpnone$(LIB_SUFFIX) devpdisk$(LIB_SUFFIX) $(OSS_SO) $(ALSA_SO) $(COREAUDIO_SO)
|
||||
+ifeq ($(HAVE_SDL),1)
|
||||
+SDL_SO=devpsdl$(LIB_SUFFIX)
|
||||
+endif
|
||||
+
|
||||
+all: devpnone$(LIB_SUFFIX) devpdisk$(LIB_SUFFIX) $(OSS_SO) $(ALSA_SO) $(COREAUDIO_SO) $(SDL_SO)
|
||||
|
||||
devpnone_so=devpnone.o
|
||||
devpnone$(LIB_SUFFIX): $(devpnone_so)
|
||||
@@ -35,6 +39,10 @@
|
||||
devpcoreaudio$(LIB_SUFFIX):$(devpcoreaudio_so)
|
||||
$(CC) $(SHARED_FLAGS) -o $@ $^ $(COREAUDIO_LIBS)
|
||||
|
||||
+devpsdl_so=devpsdl.o
|
||||
+devpsdl$(LIB_SUFFIX):$(devpsdl_so)
|
||||
+ $(CC) $(SHARED_FLAGS) -o $@ $^ $(SDL_LIBS)
|
||||
+
|
||||
clean:
|
||||
rm -f *.o *$(LIB_SUFFIX)
|
||||
|
||||
@@ -49,6 +57,9 @@
|
||||
ifeq ($(HAVE_COREAUDIO),1)
|
||||
$(CP) $(COREAUDIO_SO) "$(DESTDIR)$(LIBDIR)"
|
||||
endif
|
||||
+ifeq ($(HAVE_SDL),1)
|
||||
+ $(CP) $(SDL_SO) "$(DESTDIR)$(LIBDIR)"
|
||||
+endif
|
||||
|
||||
uninstall:
|
||||
rm -f "$(DESTDIR)$(LIBDIR)/devpnone$(LIB_SUFFIX)" "$(DESTDIR)$(LIBDIR)/devpdisk$(LIB_SUFFIX)"
|
||||
@@ -61,6 +72,9 @@
|
||||
ifeq ($(HAVE_COREAUDIO),1)
|
||||
rm -f "$(DESTDIR)$(LIBDIR)/$(COREAUDIO_SO)"
|
||||
endif
|
||||
+ifeq ($(HAVE_SDL),1)
|
||||
+ rm -f "$(DESTDIR)$(LIBDIR)/$(SDL_SO)"
|
||||
+endif
|
||||
|
||||
devposs.o: devposs.c \
|
||||
../config.h \
|
||||
@@ -120,3 +134,12 @@
|
||||
../dev/player.h \
|
||||
../stuff/imsrtns.h
|
||||
$(CC) devpcoreaudio.c -o $@ -c $(DEVPCOREAUDIO_CFLAGS)
|
||||
+
|
||||
+devpsdl.o: devpsdl.c \
|
||||
+ ../config.h \
|
||||
+ ../types.h \
|
||||
+ ../boot/plinkman.h \
|
||||
+ ../dev/imsdev.h \
|
||||
+ ../dev/player.h \
|
||||
+ ../stuff/imsrtns.h
|
||||
+ $(CC) devpsdl.c -o $@ -c $(SDL_CFLAGS) $(DEVPSDL_CFLAGS)
|
||||
diff -ur ../ocp-snapshot-20110319.org/ocp.ini.in ./ocp.ini.in
|
||||
--- ../ocp-snapshot-20110319.org/ocp.ini.in 2011-03-19 01:04:33.065798144 +0100
|
||||
+++ ocp-snapshot-20110319/ocp.ini.in 2011-03-20 15:56:58.479199232 +0100
|
||||
@@ -136,6 +136,9 @@
|
||||
path=/dev/dsp
|
||||
mixer=/dev/mixer
|
||||
|
||||
+[devpSDL]
|
||||
+ link=devpsdl
|
||||
+
|
||||
[devpDisk]
|
||||
link=devpdisk
|
||||
|
||||
--- /dev/null 2011-03-20 15:34:50.648381000 +0100
|
||||
+++ ocp-snapshot-20110319/devp/devpsdl.c 2011-03-20 21:05:30.579862528 +0100
|
||||
@@ -0,0 +1,321 @@
|
||||
+/* OpenCP Module Player
|
||||
+ * copyright (c) '11 François Revol <revol@free.fr>
|
||||
+ *
|
||||
+ * SDL Player device
|
||||
+ *
|
||||
+ * derived from the CoreAudio Player device
|
||||
+ * copyright (c) '06-'10 Stian Skjelstad <stian@nixia.no>
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 2 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, write to the Free Software
|
||||
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+ *
|
||||
+ * revision history: (please note changes here)
|
||||
+ * -fr110319 François Revol <revol@free.fr>
|
||||
+ * -copied from devpcoreaudio
|
||||
+ */
|
||||
+
|
||||
+#include "config.h"
|
||||
+#include <signal.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <stdio.h>
|
||||
+#include <SDL.h>
|
||||
+#include <SDL_audio.h>
|
||||
+#include "types.h"
|
||||
+#include "boot/plinkman.h"
|
||||
+#include "dev/imsdev.h"
|
||||
+#include "dev/player.h"
|
||||
+#include "stuff/timer.h"
|
||||
+#include "stuff/imsrtns.h"
|
||||
+
|
||||
+/*#define PRINT(a) fprintf(stderr, a)*/
|
||||
+#define PRINT(a) do {} while(0)
|
||||
+
|
||||
+extern struct sounddevice plrSDL;
|
||||
+
|
||||
+/*static SDL_AudioSpec sdlSpec;*/
|
||||
+
|
||||
+/* stolen from devpcoreaudio.c */
|
||||
+
|
||||
+static void *playbuf=0;
|
||||
+static int buflen;
|
||||
+volatile static int kernpos, cachepos, bufpos; /* in bytes */
|
||||
+/* kernpos = kernel write header
|
||||
+ * bufpos = the write header given out of this driver */
|
||||
+
|
||||
+/* playbuf kernpos cachepos bufpos buflen
|
||||
+ * | | kernlen | | |
|
||||
+ * | | cachelen | |
|
||||
+ *
|
||||
+ * on flush, we update all variables> * on getbufpos we return kernpos-(1 sample) as safe point to buffer up to
|
||||
+ * on getplaypos we use last known kernpos if locked, else update kernpos
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+volatile static int cachelen, kernlen; /* to make life easier */
|
||||
+
|
||||
+volatile static uint32_t playpos; /* how many samples have we done totally */
|
||||
+
|
||||
+/* Avoid deadlocks due to signals catched when in the critical section */
|
||||
+#define SDL_LockAudio() \
|
||||
+ sigset_t _orgmask; \
|
||||
+ sigset_t _mask; \
|
||||
+ sigemptyset(&_mask); \
|
||||
+ sigaddset(&_mask, SIGALRM); \
|
||||
+ sigprocmask(SIG_BLOCK, &_mask, &_orgmask); \
|
||||
+ SDL_LockAudio()
|
||||
+
|
||||
+#define SDL_UnlockAudio() \
|
||||
+ SDL_UnlockAudio(); \
|
||||
+ sigprocmask(SIG_SETMASK, &_orgmask, NULL)
|
||||
+
|
||||
+
|
||||
+void theRenderProc(void *userdata, Uint8 *stream, int len)
|
||||
+{
|
||||
+ int i, i2;
|
||||
+ int done = 0;
|
||||
+
|
||||
+#ifdef SDL_DEBUG
|
||||
+ PRINT(("%s(,,%d)\n", __FUNCTION__, len));
|
||||
+#endif
|
||||
+
|
||||
+ memset(stream, 0, len);
|
||||
+
|
||||
+ SDL_LockAudio();
|
||||
+
|
||||
+ i = cachelen;/* >>2 *stereo + 16it */
|
||||
+ if (i > len)
|
||||
+ i = len;
|
||||
+
|
||||
+ kernlen = done = i;
|
||||
+ cachelen -= i;
|
||||
+ cachepos = kernpos;
|
||||
+
|
||||
+ if ((i+kernpos)>buflen)
|
||||
+ {
|
||||
+ i2 = ( i + kernpos ) % buflen;
|
||||
+ i = i - i2;
|
||||
+ } else {
|
||||
+ i2 = 0;
|
||||
+ }
|
||||
+
|
||||
+ memcpy(stream, playbuf+kernpos, i);
|
||||
+ if (i2)
|
||||
+ memcpy(stream+i, playbuf, i2);
|
||||
+
|
||||
+ kernpos = (kernpos+i+i2)%buflen;
|
||||
+
|
||||
+ SDL_UnlockAudio();
|
||||
+
|
||||
+ if (done < len)
|
||||
+ fprintf(stderr, "%s: got %d of %d\n", __FUNCTION__, done, len);
|
||||
+ /*PRINT(("%s: got %d of %d\n", __FUNCTION__, done, len));*/
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/* stolen from devposs */
|
||||
+static int sdlGetBufPos(void)
|
||||
+{
|
||||
+ int retval;
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+
|
||||
+ /* this thing is utterly broken */
|
||||
+
|
||||
+ SDL_LockAudio();
|
||||
+ if (kernpos==bufpos)
|
||||
+ {
|
||||
+ if (cachelen|kernlen)
|
||||
+ {
|
||||
+ retval=kernpos;
|
||||
+ SDL_UnlockAudio();
|
||||
+ return retval;
|
||||
+ }
|
||||
+ }
|
||||
+ retval=(kernpos+buflen-4 /* 1 sample = 4 bytes*/)%buflen;
|
||||
+ SDL_UnlockAudio();
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+static int sdlGetPlayPos(void)
|
||||
+{
|
||||
+ int retval;
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+
|
||||
+ SDL_LockAudio();
|
||||
+ retval=cachepos;
|
||||
+ SDL_UnlockAudio();
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+static void sdlIdle(void)
|
||||
+{
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+}
|
||||
+
|
||||
+static void sdlAdvanceTo(unsigned int pos)
|
||||
+{
|
||||
+ PRINT(("%s(%u)\n", __FUNCTION__, pos));
|
||||
+ SDL_LockAudio();
|
||||
+
|
||||
+ cachelen+=(pos-bufpos+buflen)%buflen;
|
||||
+ bufpos=pos;
|
||||
+
|
||||
+ SDL_UnlockAudio();
|
||||
+}
|
||||
+
|
||||
+static uint32_t sdlGetTimer(void)
|
||||
+{
|
||||
+ long retval;
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+
|
||||
+ SDL_LockAudio();
|
||||
+
|
||||
+ retval=playpos-kernlen;
|
||||
+
|
||||
+ SDL_UnlockAudio();
|
||||
+
|
||||
+ return imuldiv(retval, 65536>>(2/*stereo+bit16*/), plrRate);
|
||||
+}
|
||||
+
|
||||
+static void sdlStop(void)
|
||||
+{
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+ /* TODO, forceflush */
|
||||
+
|
||||
+ SDL_PauseAudio(1);
|
||||
+
|
||||
+ if (playbuf)
|
||||
+ {
|
||||
+ free(playbuf);
|
||||
+ playbuf=0;
|
||||
+ }
|
||||
+
|
||||
+ plrGetBufPos=0;
|
||||
+ plrGetPlayPos=0;
|
||||
+ plrIdle=0;
|
||||
+ plrAdvanceTo=0;
|
||||
+ plrGetTimer=0;
|
||||
+
|
||||
+ SDL_CloseAudio();
|
||||
+}
|
||||
+
|
||||
+static int sdlPlay(void **buf, unsigned int *len)
|
||||
+{
|
||||
+ SDL_AudioSpec desired;
|
||||
+ int status;
|
||||
+ PRINT(("%s(,&%d)\n", __FUNCTION__, *len));
|
||||
+
|
||||
+ if ((*len)<(plrRate&~3))
|
||||
+ *len=plrRate&~3;
|
||||
+ if ((*len)>(plrRate*4))
|
||||
+ *len=plrRate*4;
|
||||
+ playbuf=*buf=malloc(*len);
|
||||
+
|
||||
+ memset(*buf, 0x80008000, (*len)>>2);
|
||||
+ buflen = *len;
|
||||
+
|
||||
+ cachepos=0;
|
||||
+ kernpos=0;
|
||||
+ bufpos=0;
|
||||
+ cachelen=0;
|
||||
+ kernlen=0;
|
||||
+
|
||||
+ playpos=0;
|
||||
+
|
||||
+ plrGetBufPos=sdlGetBufPos;
|
||||
+ plrGetPlayPos=sdlGetPlayPos;
|
||||
+ plrIdle=sdlIdle;
|
||||
+ plrAdvanceTo=sdlAdvanceTo;
|
||||
+ plrGetTimer=sdlGetTimer;
|
||||
+
|
||||
+
|
||||
+ desired.freq = plrRate;
|
||||
+ desired.format = AUDIO_S16SYS;
|
||||
+ desired.channels = 2;
|
||||
+ desired.samples = *len;
|
||||
+ desired.callback = theRenderProc;
|
||||
+ desired.userdata = NULL;
|
||||
+
|
||||
+ status=SDL_OpenAudio(&desired, NULL);
|
||||
+ if (status < 0)
|
||||
+ {
|
||||
+ fprintf(stderr, "[SDL] SDL_OpenAudio returned %d (%s)\n", (int)status, SDL_GetError());
|
||||
+ free(*buf);
|
||||
+ *buf = playbuf = 0;
|
||||
+ plrGetBufPos = 0;
|
||||
+ plrGetPlayPos = 0;
|
||||
+ plrIdle = 0;
|
||||
+ plrAdvanceTo = 0;
|
||||
+ plrGetTimer = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ /*plrRate = sdlSpec.freq;*/
|
||||
+ SDL_PauseAudio(0);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+static void sdlSetOptions(unsigned int rate, int opt)
|
||||
+{
|
||||
+ PRINT(("%s(%u, %d)\n", __FUNCTION__, rate, opt));
|
||||
+ plrRate=rate; /* fixed */
|
||||
+ plrOpt=PLR_STEREO|PLR_16BIT|PLR_SIGNEDOUT; /* fixed fixed fixed */
|
||||
+}
|
||||
+
|
||||
+static int sdlInit(const struct deviceinfo *c)
|
||||
+{
|
||||
+ char drivername[FILENAME_MAX];
|
||||
+ int status;
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+ status = SDL_InitSubSystem(SDL_INIT_AUDIO);
|
||||
+ if (status == 0)
|
||||
+ {
|
||||
+ fprintf(stderr, "[SDL] Using driver %s\n", SDL_AudioDriverName(drivername, sizeof(drivername)));
|
||||
+ plrSetOptions=sdlSetOptions;
|
||||
+ plrPlay=sdlPlay;
|
||||
+ plrStop=sdlStop;
|
||||
+ return 1;
|
||||
+ }
|
||||
+ fprintf(stderr, "[SDL] SDL_InitSubSystem returned %d (%s)\n", (int)status, SDL_GetError());
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void sdlClose(void)
|
||||
+{
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+ SDL_QuitSubSystem(SDL_INIT_AUDIO);
|
||||
+ plrSetOptions=0;
|
||||
+ plrPlay=0;
|
||||
+ plrStop=0;
|
||||
+}
|
||||
+
|
||||
+static int sdlDetect(struct deviceinfo *card)
|
||||
+{
|
||||
+ PRINT(("%s()\n", __FUNCTION__));
|
||||
+
|
||||
+ /* ao is now created, the above is needed only ONCE */
|
||||
+ card->devtype=&plrSDL;
|
||||
+ card->port=0;
|
||||
+ card->port2=0;
|
||||
+ card->subtype=-1;
|
||||
+ card->mem=0;
|
||||
+ card->chan=2;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+struct sounddevice plrSDL={SS_PLAYER, 0, "SDL Player", sdlDetect, sdlInit, sdlClose, 0};
|
||||
+
|
||||
+char *dllinfo="driver plrSDL";
|
||||
+struct linkinfostruct dllextinfo = {"devpsdl", "OpenCP Player Device: None (c) 1994-09 Niklas Beisert, Tammo Hinrichs", DLLVERSION, 0 LINKINFOSTRUCT_NOEVENTS};
|
||||
Reference in New Issue
Block a user