From 2ab22bdad1415813a3e1df329640332702272fc0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 1 Sep 2008 17:01:58 +0000 Subject: - new configure/make layout: - configure/main-makefile moved to root-dir - configure-script checked in (no need to call autogen.sh on first run) - autogen.sh, m4, install.sh etc. moved to dists/autogen/ - config.guess/sub for canonical builds - unit-tests moved to test - removed delphi subdir in portaudio/-mixer - COPYING.txt/AUTHORS.txt/... added - dists/delphi7/2005 added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1334 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/Makefile.in | 392 ----------- src/autogen.sh | 1 - src/build.bat | 4 - src/configure.ac | 494 -------------- src/install-sh | 519 -------------- src/lib/portaudio/delphi/portaudio.pas | 1162 -------------------------------- src/lib/portaudio/portaudio.pas | 1162 ++++++++++++++++++++++++++++++++ src/lib/portmixer/delphi/portmixer.pas | 151 ----- src/lib/portmixer/portmixer.pas | 151 +++++ src/lib/projectM/cwrapper/Makefile.in | 11 + src/m4/ac_define_dir.m4 | 47 -- src/m4/fpc.m4 | 176 ----- src/ultrastardx.dpr | 4 +- src/unit-tests/switches.inc | 0 src/unit-tests/test_libraries.lpi | 299 -------- src/unit-tests/test_libraries.lpr | 31 - src/unit-tests/testsqllite.pas | 84 --- 17 files changed, 1326 insertions(+), 3362 deletions(-) delete mode 100644 src/Makefile.in delete mode 100755 src/autogen.sh delete mode 100644 src/build.bat delete mode 100644 src/configure.ac delete mode 100755 src/install-sh delete mode 100644 src/lib/portaudio/delphi/portaudio.pas create mode 100644 src/lib/portaudio/portaudio.pas delete mode 100644 src/lib/portmixer/delphi/portmixer.pas create mode 100644 src/lib/portmixer/portmixer.pas delete mode 100644 src/m4/ac_define_dir.m4 delete mode 100644 src/m4/fpc.m4 delete mode 100644 src/unit-tests/switches.inc delete mode 100644 src/unit-tests/test_libraries.lpi delete mode 100644 src/unit-tests/test_libraries.lpr delete mode 100644 src/unit-tests/testsqllite.pas (limited to 'src') diff --git a/src/Makefile.in b/src/Makefile.in deleted file mode 100644 index 2aea0943..00000000 --- a/src/Makefile.in +++ /dev/null @@ -1,392 +0,0 @@ -################################################# -# Makefile for @PACKAGE_STRING@ -# @configure_input@ -################################################# - -# general definitions -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -libdir = @libdir@ -infodir = @infodir@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -datarootdir = @datarootdir@ -VPATH = @srcdir@ -usdxrootdir = @usdxrootdir@ - -INSTALL_PATH_SUFFIX = @suffix@ -INSTALL_datadir = $(datarootdir)/$(INSTALL_PATH_SUFFIX) - -@SET_MAKE@ - -# recursive dir creation tool -MKDIR_P = @MKDIR_P@ -# install tool -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -# calls "ln -s" -LN_S = @LN_S@ - -# Package configuration -USDX_PACKAGE_NAME = @PACKAGE_NAME@ -# should be $(USDX_PACKAGE_NAME) instead -USDX_PREFIX = ultrastardx -USDX_VERSION = @PACKAGE_VERSION@ -USDX_TARNAME = @PACKAGE_TARNAME@ - -USDX_GAME_DIR = $(usdxrootdir)/game -USDX_TOOLS_DIR = $(usdxrootdir)/tools -USDX_LIB_DIR = ./lib -USDX_BUILD_DIR = ./build - -# file-type suffix of executables (e.g. ".exe" in windows) -EXE_SUFFIX = @EXEEXT@ - -# Free Pascal compiler -PPC = @PPC@ -# FPC target platform and processor -PPLATFORM = @FPC_PLATFORM@ -PPROCESSOR = @FPC_PROCESSOR@ - -EXTRA_SRCDIRS = - -# RC resource extraction config -RESEXTRACTOR_NAME = ResourceExtractor -RESEXTRACTOR_DIR = $(USDX_TOOLS_DIR)/$(RESEXTRACTOR_NAME) -RESEXTRACTOR_BIN = $(RESEXTRACTOR_DIR)/$(RESEXTRACTOR_NAME)$(EXE_SUFFIX) -RESOURCE_DIR = $(USDX_GAME_DIR)/resources -RESOURCE_FILE = resource.inc -RC_FILE = ultrastardx.rc -EXTRA_SRCDIRS += $(RESEXTRACTOR_DIR) - -# cwrapper settings -PROJECTM_CWRAPPER_DIR = $(USDX_LIB_DIR)/projectM/cwrapper -@COMMENT_PROJECTM_CWRAPPER@EXTRA_SRCDIRS += $(PROJECTM_CWRAPPER_DIR) - -# Directories added to the unit path -PUNIT_TOKEN = -Fu -PUNIT_FLAGS = $(PUNIT_TOKEN). - -# Directory where compiled units (.ppu and .o files) are stored -PCUNIT_TOKEN = -FU -PCUNIT_DIR = $(USDX_BUILD_DIR)/$(PPLATFORM)/fpc -PCUNIT_FLAGS = $(PCUNIT_TOKEN)$(PCUNIT_DIR) - -# Directories added to the includes path -PINC_TOKEN = -Fi -PINC_FLAGS = $(PINC_TOKEN)$(USDX_LIB_DIR)/JEDI-SDL/SDL/Pas - -# FPC flags - -# The user can overwrite the default flags with -# make PFLAGS_BASE="myflags" -PFLAGS_BASE = -S2gi -vB -# The user can specify additional flags with -# make PFLAGS_EXTRA="myflags" -PFLAGS_EXTRA = @PFLAGS_EXTRA@ -PFLAGS_DEBUG = @PFLAGS_DEBUG@ -PFLAGS_RELEASE = @PFLAGS_RELEASE@ -# the user's flags (specified with configure) must be the last in -# the list to overwrite the defaults (e.g.with the - option: -Xs-). -PFLAGS = $(PFLAGS_BASE) @PFLAGS_MAKE@ $(PFLAGS_EXTRA) - -LIBS = @LIBS@ -LDFLAGS = @LDFLAGS@ -linkflags = $(strip $(LDFLAGS) $(LIBS)) -ifneq ($(linkflags),) -PLINKFLAGS = -k"$(linkflags)" -endif - -# dpr project file used as input -USDX_SRC = ultrastardx.dpr -# name of executable -USDX_BIN_NAME = $(USDX_PREFIX)$(EXE_SUFFIX) -USDX_BIN = $(USDX_GAME_DIR)/$(USDX_BIN_NAME) - -# name of the modification timestamp filename -modfile = lastmod - -# otool: Mac OS X object file displaying tool -OTOOL = /usr/bin/otool -# install_name_tool: Mac OS X tool to change dynamic shared library install names -INSTALL_NAME_TOOL = /usr/bin/install_name_tool -# hdiutil: Mac OS X disk image tool -HDIUTIL = /usr/bin/hdiutil - -################################################# -# general targets -################################################# - -.PHONY: debug release recursive all recursive-all dependencies install install-local install-global install-data install-data-recursive install-exec uninstall uninstall-local uninstall-global uninstall-data uninstall-exec clean recursive-clean distclean recursive-distclean clean_obj clean_res dist debian-package update-modfile $(EXTRA_SRCDIRS) - -debug: PFLAGS = $(PFLAGS_BASE) $(PFLAGS_DEBUG) $(PFLAGS_EXTRA) -debug: all - -release: PFLAGS = $(PFLAGS_BASE) $(PFLAGS_RELEASE) $(PFLAGS_EXTRA) -release: all - -all: recursive-all update-modfile dependencies $(USDX_BIN) - -recursive-all: recursive-target = all -recursive-all: recursive - -dependencies: $(RESOURCE_FILE) - -# call Makefiles in other source-dirs -recursive: $(EXTRA_SRCDIRS) -$(EXTRA_SRCDIRS): - $(MAKE) -C $@ $(recursive-target) - -################################################# -# build -################################################# - -# clean old data before compiling, otherwise FPC might miss some changes. -$(USDX_BIN): lastmod - $(MAKE) clean_obj - mkdir -p "$(PCUNIT_DIR)" - $(PPC) $(strip $(PFLAGS) $(PDEFINES) $(PLINKFLAGS) $(PINC_FLAGS) $(PUNIT_FLAGS) $(PCUNIT_FLAGS)) -o$@ $(USDX_SRC) - -################################################# -# install/uninstall -################################################# - -install: all install-@install_type@ - -uninstall: uninstall-@install_type@ - - -# local build - -install-local: - -uninstall-local: - rm -f "$(USDX_BIN)" - - -# global build - -install-global: install-data install-exec - -install-data: - $(MAKE) RECURSIVE_SRC_DIR="$(usdxrootdir)/artwork" RECURSIVE_DST_DIR="$(INSTALL_datadir)/artwork" install-data-recursive - $(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/languages" RECURSIVE_DST_DIR="$(INSTALL_datadir)/languages" install-data-recursive - $(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/sounds" RECURSIVE_DST_DIR="$(INSTALL_datadir)/sounds" install-data-recursive - $(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/themes" RECURSIVE_DST_DIR="$(INSTALL_datadir)/themes" install-data-recursive - $(MAKE) RECURSIVE_SRC_DIR="$(USDX_GAME_DIR)/resources" RECURSIVE_DST_DIR="$(INSTALL_datadir)/resources" install-data-recursive - $(INSTALL_DATA) "$(usdxrootdir)/License.txt" "$(INSTALL_datadir)" - -install-data-recursive: - $(MKDIR_P) "$(RECURSIVE_DST_DIR)" - @for file in "$(RECURSIVE_SRC_DIR)"/*; do \ - if test -f "$$file"; then \ - echo $(INSTALL_DATA) "$$file" "$(RECURSIVE_DST_DIR)"; \ - $(INSTALL_DATA) "$$file" "$(RECURSIVE_DST_DIR)"; \ - fi; \ - if test -d "$$file"; then \ - subdir="$$file"; \ - subdirname=`basename "$$subdir"`; \ - $(MAKE) RECURSIVE_SRC_DIR="$$subdir" RECURSIVE_DST_DIR="$(RECURSIVE_DST_DIR)/$$subdirname" install-data-recursive; \ - fi; \ - done - -install-exec: - $(MKDIR_P) "$(bindir)" - $(INSTALL) "$(USDX_BIN)" "$(bindir)" - -uninstall-global: uninstall-data uninstall-exec - -uninstall-data: - rm -rf "$(INSTALL_datadir)/artwork" - rm -rf "$(INSTALL_datadir)/languages" - rm -rf "$(INSTALL_datadir)/sounds" - rm -rf "$(INSTALL_datadir)/themes" - rm -rf "$(INSTALL_datadir)/resources" - rm -f "$(INSTALL_datadir)/License.txt" - -rmdir "$(INSTALL_datadir)" - -uninstall-exec: - rm -f "$(bindir)/$(USDX_BIN_NAME)" - -################################################# -# Distributable source-package (TODO) -################################################# - -disttmpdir = ./distdir - -dist: -# $(MKDIR_P) $(disttmpdir) -# acm $(usdxrootdir) $(disttmpdir) -# $(MAKE) -C $(disttmpdir)/src distclean -# tar cvzf $(USDX_TARNAME)-$(USDX_VERSION).tar.gz $(usdxrootdir) - @echo "Comming soon" - -################################################# -# Debian package -################################################# - -debpkgdir = $(usdxrootdir)/dists/debian -debpkgtmpdir = $(debpkgdir)/deb-package -debpkgprefix = $(USDX_PACKAGE_NAME) -debpkgname = $(debpkgprefix)_$(USDX_VERSION)_$(PPROCESSOR).deb - -debian-pkg: all - rm -rf $(debpkgtmpdir) - - $(MKDIR_P) $(debpkgdir) - $(MKDIR_P) $(debpkgtmpdir)/DEBIAN - - $(MAKE) prefix=$(debpkgtmpdir)/$(prefix) install - - $(INSTALL_DATA) $(debpkgdir)/$(debpkgprefix).control $(debpkgtmpdir)/DEBIAN/control - - dpkg-deb --build $(debpkgtmpdir) - mv $(debpkgtmpdir)/../deb-package.deb $(debpkgdir)/$(debpkgname) - - rm -rf $(debpkgtmpdir) - -################################################# -# RPM (TODO) -################################################# - -rpm: all - @echo "Coming soon" - -################################################# -# Mac OS X app-bundle -################################################# - -macosx_bundle_path = $(usdxrootdir)/UltraStarDeluxe.app/Contents -macosx-app: all -# Create double clickable Mac OS X application. - - @echo "" - @echo "Creating the Mac OS X application" - @echo "" - - $(MKDIR_P) $(macosx_bundle_path)/Resources - -# Put the icon file into its particular place. -# Must be done BEFORE info.plist is created. - $(INSTALL_DATA) $(usdxrootdir)/icons/ultrastardx.icns $(macosx_bundle_path)/Resources/ - -# the info.plist file - $(INSTALL_DATA) macosx/Info.plist $(macosx_bundle_path)/ - -# Copy the resources. - $(MAKE) install-global INSTALL_datadir=$(macosx_bundle_path)/Resources bindir=$(macosx_bundle_path)/MacOS - -# final messages - @echo "" - @echo "Mac OS X application created." - @echo "Please report issues to the developer team, preferably mischi." - @echo "Have fun." - @echo "" - -macosx-standalone-app: macosx-app -# Create double clickable standalone (does not need fink) Mac OS X -# application. Not fully test, but should work on 10.5. - - @echo "" - @echo "Creating the standalone Mac OS X application" - @echo "" - -# copy the dylib and change its install names - -define install_osx_libraries - $(shell $(INSTALL) -m 755 $(dylib) $(macosx_bundle_path)/MacOS) - $(shell $(INSTALL_NAME_TOOL) -change $(dylib) @executable_path/$(notdir $(dylib)) $(macosx_bundle_path)/MacOS/ultrastardx) - $(shell $(INSTALL_NAME_TOOL) -id @executable_path/$(notdir $(dylib)) $(macosx_bundle_path)/MacOS/$(notdir $(dylib))) - $(foreach linked_dylibs_2,$(shell $(OTOOL) -L $(dylib) | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \usr\/lib | grep -v executable_path),$(rename_secondary_osx_libraries)) -endef - -define rename_secondary_osx_libraries - $(shell $(INSTALL_NAME_TOOL) -change $(linked_dylibs_2) @executable_path/$(notdir $(linked_dylibs_2)) $(macosx_bundle_path)/MacOS/$(notdir $(dylib))) -endef - -# work on the dylibs in $(macosx_bundle_path)/MacOS/ultrastardx - $(foreach dylib,$(shell $(OTOOL) -L $(macosx_bundle_path)/MacOS/ultrastardx | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) - -# work on the secondary dylibs from ffmpeg -# libavcodec references all tertiary libraries of the ffmpeg libs - $(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libavcodec.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) -# same procedure in libfaac. it gets libgnugetopt - $(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libfaac.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) - -# same procedure for tertiary libs in SDL_image - $(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libSDL_image.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) - -# X11 libs as well, because users may not have installed it on 10.4 - $(foreach dylib,$(shell $(OTOOL) -L /usr/X11R6/lib/libX11.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries)) - -# final messages - @echo "Standalone Mac OS X application created." - @echo "" - -macosx-disk-image: macosx-standalone-app - /bin/rm -f ultrastardx.dmg - $(HDIUTIL) create -type SPARSE -size 30m -fs HFS+ -volname UltraStarDeluxe -ov -attach UltraStarDeluxe.sparseimage - /bin/cp -R ../UltraStarDeluxe.app /Volumes/UltraStarDeluxe -# /bin/cp ultrastardx/icons/UltraStarDeluxeVolumeIcon.icns /Volumes/UltraStarDeluxe/.VolumeIcon.icns -# /Developer/Tools/SetFile -a C /Volumes/UltraStarDeluxe/.VolumeIcon.icns /Volumes/UltraStarDeluxe - $(HDIUTIL) detach /Volumes/UltraStarDeluxe - $(HDIUTIL) convert UltraStarDeluxe.sparseimage -format UDBZ -o ultrastardx.dmg - /bin/rm -f UltraStarDeluxe.sparseimage -################################################# -# clean-up -################################################# - -clean: recursive-clean clean_obj - -recursive-clean: recursive-target = clean -recursive-clean: recursive - -distclean: recursive-distclean clean clean_res - find . -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f - find . -name "*~" -name "*.bak" -o -name "*.orig" -o -name "*.dcu" | xargs rm -f - find . -name "__history" | xargs rm -r -f - rm -f "$(USDX_PREFIX).res" "$(USDX_PREFIX).identcache" - rm -f config.inc Makefile config.log config.status configure aclocal.m4 - rm -rf autom4te.cache - -recursive-distclean: recursive-target = distclean -recursive-distclean: recursive - -clean_obj: - find "$(PCUNIT_DIR)" -name "*.o" -o -name "*.ppu" -o -name "*.rst" -o -name "*.compiled" | xargs rm -f - rm -f "$(USDX_BIN)" - -################################################# -# Resource-file -################################################# - -$(RESOURCE_FILE): $(RC_FILE) - $(RESEXTRACTOR_BIN) $(RC_FILE) $(RESOURCE_DIR) $(RESOURCE_FILE) - -clean_res: - rm -f "$(RESOURCE_FILE)" - -################################################# -# auto-update -################################################# - -# FPC does not recognize changes correctly. E.g. sometimes changes in .inc-files or -# conditional .pas dependencies are ignored which results in corrupted builds. -# So check for changes with a modification timestamp. -update-modfile: - test -e $(modfile) || touch $(modfile) - find . \( -name "*.pas" -o -name "*.pp" -o -name "*.inc" -o -name "*.dpr" \) -newer $(modfile) -exec touch $(modfile) \; - find $(USDX_LIB_DIR) -name "*.a" -newer $(modfile) -exec touch $(modfile) \; - -Makefile: Makefile.in config.status - ./config.status - -config.status: configure - ./config.status --recheck - -configure: configure.ac config.inc.in aclocal.m4 - autoconf - -aclocal.m4: m4/* - aclocal -I m4 diff --git a/src/autogen.sh b/src/autogen.sh deleted file mode 100755 index 3f598d0b..00000000 --- a/src/autogen.sh +++ /dev/null @@ -1 +0,0 @@ -aclocal -I m4 && autoconf diff --git a/src/build.bat b/src/build.bat deleted file mode 100644 index 59f465d5..00000000 --- a/src/build.bat +++ /dev/null @@ -1,4 +0,0 @@ -C:\lazarus\fpc\2.0.4\bin\i386-win32\ppc386.exe -S2cgi -OG1 -gl -vewnhi -l -Filib\JEDI-SDLv1.0\SDL\Pas\ -Fu..\..\..\..\..\lazarus\components\jpeg\lib\i386-win32\ -Fu..\..\..\..\..\lazarus\components\images\lib\i386-win32\ -Fu..\..\..\..\..\lazarus\lcl\units\i386-win32\ -Fu..\..\..\..\..\lazarus\lcl\units\i386-win32\win32\ -Fu..\..\..\..\..\lazarus\packager\units\i386-win32\ -Fu. -oUltraStar.exe -dLCL -dLCLwin32 UltraStar.lpr -rem C:\lazarus\fpc\2.0.4\bin\i386-win32\ppc386.exe -S2cgi -OG1 -gl -vewnhi -l -Filib\JEDI-SDLv1.0\SDL\Pas\ -Fu. -oUltraStar.exe UltraStar.lpr - -move UltraStar.exe ..\..\ \ No newline at end of file diff --git a/src/configure.ac b/src/configure.ac deleted file mode 100644 index 1152c1a1..00000000 --- a/src/configure.ac +++ /dev/null @@ -1,494 +0,0 @@ -# -# ultrastardx configure.ac script -# -# by UltraStar Deluxe Team -# -# Execute "autogen.sh" to create the configure script. -# - -# Require autoconf >= 2.61 -AC_PREREQ(2.61) - -# Init autoconf -AC_INIT([ultrastardx], - [1.1-alpha], - [http://sourceforge.net/tracker/?group_id=191560&atid=937872]) -# specify the website here -PACKAGE_WEBSITE="http://www.ultrastardeluxe.org/" -AC_SUBST(PACKAGE_WEBSITE) -# specify the IRC-channel here -PACKAGE_IRC="#ultrastardx at quakenet.org" -AC_SUBST(PACKAGE_IRC) - -# Specify a source-file so autoconf can check if the source-dir exists -AC_CONFIG_SRCDIR(ultrastardx.dpr) - -# This one is not used by autoconf at the moment. -# When it is used maybe we don't need aclocal's -I parameter anymore. -AC_CONFIG_MACRO_DIR(m4) - -# show features and packages in one list -AC_PRESERVE_HELP_ORDER - -# set root directory (= trunk dir) -# ..resolved: used by configure.ac -usdxroot=.. -# ..unresolved: used by .in files -usdxrootdir=\${top_srcdir}/.. -AC_SUBST(usdxrootdir) - -# set sharerootdir to the resolved dataroot-dir for the config-*.inc file. -# Pascal cannot handle shell-variables like ${prefix} -AC_DEFINE_DIR(sharerootdir, datarootdir) - -# ----------------------------------------- -# find tools -# ----------------------------------------- - -# options for make command -AC_PROG_MAKE_SET -# find tool for ln -s (e.g. uses cp -p for FAT-filesystems) -AC_LN_S -# find a program for recursive dir creation -AC_PROG_MKDIR_P -# find the best install tool -AC_PROG_INSTALL -# some other useful tools -#AC_PROG_AWK -AC_PROG_SED -AC_PROG_GREP -#AC_PROG_EGREP - -# ----------------------------------------- -# macro declarations -# ----------------------------------------- - -# AC_TRIM(STRING) -# removes surrounding whitespace -# ------------------------------------------- -AC_DEFUN([AC_TRIM], -[echo "[$1]" | $SED 's/^[[ \t]]*//' | $SED 's/[[ \t]]*$//' -]) - -# AC_SUBST_DEFINE(DEFINE_SUFFIX, IS_DEFINED) -# used to enable/disable pascal defines -AC_DEFUN([AC_SUBST_DEFINE], -[ - if [[ x$2 = xyes ]]; then - DEFINE_[$1]=DEFINE - else - DEFINE_[$1]=UNDEF - fi - AC_SUBST(DEFINE_[$1]) -]) - -# AC_SUBST_COMMENT(DEFINE_SUFFIX, IS_ENABLED) -# used to enable/disable lines in a Makefile -AC_DEFUN([AC_SUBST_COMMENT], -[ - if [[ x$2 = xyes ]]; then - COMMENT_[$1]="" - else - COMMENT_[$1]="#" - fi - AC_SUBST(COMMENT_[$1]) -]) - -# AC_SPLIT_VERSION(VARIABLE_PREFIX, VERSION) -# Splits version number ("major.minor.release") into its components. -# Sets -# [$VARIABLE_PREFIX]_VERSION_MAJOR -# [$VARIABLE_PREFIX]_VERSION_MINOR -# [$VARIABLE_PREFIX]_VERSION_RELEASE -# This function calls -# AC_SUBST([$VARIABLE_PREFIX]_VERSION_type] for each type -AC_DEFUN([AC_SPLIT_VERSION], -[ - version=[$2] - - # strip leading non-numeric tokens - # (necessary for some ffmpeg-packages in ubuntu) - # example: 0d.51.1.0 -> 51.1.0 - version=`echo $version | $SED 's/^[[^.]]*[[^0-9.]][[^.]]*\.//'` - - # replace "." and "-" with " " and ignore trailing tokens. - # 1.23.4-r2 will be splitted to [maj=1, min=23, rel=4]. - # In addition we delete every character which is not 0-9. - # 1.3a4-r32 will be [maj=1, min=34, rel=32]. - read major minor release ignore <@) - else - [$1][_VERSION]="0.0.0" - fi - AC_SPLIT_VERSION([$1], $[$1][_VERSION]) -]) - -# PKG_HAVE(VARIABLE_PREFIX, MODULE, [REQUIRED]) -# Checks with pkg-config if a package exists and retrieves information -# about it. -# Parameters: -# - VARIABLE_PREFIX: the prefix for the variables storing information about the package. -# - MODULE: package name according to pkg-config -# - REQUIRED: if true, the configure-script is aborted if the package was not found -# Uses: -# with_[$VARIABLE_PREFIX]: whether and how the package should be checked for -# "check": check for the package but do not abort if it does not exist (default) -# "no": do not check for the package (sets _HAVE to "no" and _VERSION to "0.0.0") -# "yes": check for the package and abort if it does not exist -# "nocheck": do not check for the package (sets _HAVE to "yes") -# Sets: -# [$VARIABLE_PREFIX]_HAVE # package is available (values: "yes"|"no") -# [$VARIABLE_PREFIX]_LIBS # linker flags (e.g. -Lmylibdir -lmylib) -# [$VARIABLE_PREFIX]_LIBDIRS # library dirs (e.g. -Lmylibdir) -AC_DEFUN([PKG_HAVE], -[ - have_lib="no" - AC_MSG_CHECKING([for $2]) - if test x"$with_[$1]" = xnocheck; then - # do not call pkg-config, use user settings - have_lib="yes" - elif test x"$with_[$1]" != xno; then - # check if package exists - PKG_CHECK_EXISTS([$2], [ - have_lib="yes" - [$1][_LIBS]=`$PKG_CONFIG --libs --silence-errors "$2"` - [$1][_LIBDIRS]=`$PKG_CONFIG --libs-only-L --silence-errors "$2"` - [$1][_LIBDIRS]=`AC_TRIM($[$1][_LIBDIRS])` - # add library directories to LIBS (ignore *_LIBS for now) - if test -n "$[$1][_LIBDIRS]"; then - LIBS="$LIBS $[$1][_LIBDIRS]" - fi - ]) - fi - if test x$have_lib = xyes; then - [$1][_HAVE]="yes" - if test -n "$[$1][_LIBDIRS]"; then - # show additional lib-dirs - AC_MSG_RESULT(yes [(]$[$1][_LIBDIRS][)]) - else - AC_MSG_RESULT(yes) - fi - else - [$1][_HAVE]="no" - AC_MSG_RESULT(no) - - # check if package is required - if test x$3 = xyes -o x"$with_[$1]" = xyes ; then - # print error message and quit - err_msg=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` - AC_MSG_ERROR( -[ - -$err_msg - -Alternatively, you may set --with-[$1]=nocheck and the environment -variables [$1]_[[...]] (see configure --help) -to appropriate values to avoid the need to call pkg-config. - -See the pkg-config man page for more details. -]) - fi - fi -]) - - -# ----------------------------------------- -# define switches -# ----------------------------------------- - -# print library options header -AC_ARG_WITH([cfg-dummy1], [ -External Libraries:]) - -# add portmixer option -AC_ARG_WITH([portmixer], - [AS_HELP_STRING([--with-portmixer], - [enable portmixer audio-mixer support @<:@default=check@:>@])], - [with_portmixer=$withval], [with_portmixer="check"]) - -# add projectM option -AC_ARG_WITH([libprojectM], - [AS_HELP_STRING([--with-libprojectM], - [enable projectM visualization support @<:@default=no@:>@])], - [with_libprojectM=$withval], [with_libprojectM="no"]) - -# print path options header -AC_ARG_WITH([cfg-dummy2], [ -Additional directories:]) - -# add suffix option -AC_ARG_WITH([suffix], - [AS_HELP_STRING([--with-suffix=SUFFIX], - [path suffix @<:@default=ultrastardx@:>@])], - [suffix=$withval], [suffix="ultrastardx"]) -if [[ x$suffix = xno -o x$suffix = xyes ]] ; then - AC_MSG_ERROR([Invalid suffix.]); -fi -AC_SUBST(suffix) - -# print misc options header -AC_ARG_WITH([cfg-dummy3], [ -Development options:]) - -LOCAL_BUILD="no" - -# add global option -AC_ARG_ENABLE(global, - [AS_HELP_STRING([--enable-global], - [install into global folders (PREFIX/...) @<:@default=yes@:>@])], - [test $enableval = "no" && LOCAL_BUILD="yes"], []) - -# add local option -AC_ARG_ENABLE(local, - [AS_HELP_STRING([--enable-local], - [install into local folders (../...) (same as --disable-global) @<:@default=no@:>@]))], - [test $enableval = "yes" && LOCAL_BUILD="yes"], []) - -# add dev_layout option -AC_ARG_ENABLE(dev-build, - [AS_HELP_STRING([--enable-dev-build], - [development build (implies local) @<:@default=no@:>@])], - [enable_dev_build=$enableval], [enable_dev_build="no"]) -if [[ x$enable_dev_build = xyes ]]; then - LOCAL_BUILD="yes" -fi - -# set default Makefile install-target according to local/global build-type -AC_SUBST_DEFINE(USE_LOCAL_DIRS, $LOCAL_BUILD) -if [[ x$LOCAL_BUILD = xyes ]]; then - AC_SUBST(install_type, ["local"]) -else - AC_SUBST(install_type, ["global"]) -fi - - -# ----------------------------------------- -# check for compilers -# ----------------------------------------- - -# find and test the freepascal compiler -# sets PFLAGS, FPC_VERSION, FPC_DEBUG, etc. -AC_PROG_FPC -# FPC_VERSION is already defined by FPC, use -# PPC as prefix instead. -AC_SPLIT_VERSION(PPC, $FPC_VERSION) - -# find and test the C compiler (for C-libs and wrappers) -AC_PROG_CC -AC_LANG([C]) - -# find and test the C++ compiler (for C-libs and wrappers) -AC_PROG_CXX -AC_LANG([C++]) - -AC_PROG_RANLIB - -# find pkg-config -PKG_PROG_PKG_CONFIG() -if [[ x$PKG_CONFIG = x ]]; then - AC_MSG_ERROR([ -!!! pkg-config was not found on your system. -!!! It is needed to determine the versions of your libraries. -!!! Install it and try again.]) -fi - - -# ----------------------------------------- -# check for OS -# ----------------------------------------- - -if [[ x$FPC_PLATFORM = xdarwin ]]; then - AC_MSG_CHECKING([for Mac OS X version]) - MACOSX_VERSION=`sw_vers -productVersion` - AC_SPLIT_VERSION(MACOSX, $MACOSX_VERSION) - AC_MSG_RESULT(@<:@$MACOSX_VERSION@:>@) -fi - -# ----------------------------------------- -# check for libraries -# ----------------------------------------- - -# libpng -PKG_HAVE([libpng], [libpng], yes) - -# find sdl -PKG_HAVE([sdl], [sdl], yes) - -# find sqlite3 -PKG_HAVE([sqlite3], [sqlite3], yes) - -# find FFMpeg -# Note: do not use the min/max version parameters with ffmpeg -# otherwise it might fail in ubuntu due to a wrong version number -# format in ffmpeg's .pc-files. -# For example: 0d.51.1.2 instead of the correct 51.1.2. -# A check for version >=52.0.0 will return version 0d.51.1.2 -# although it is lower because pkg-config is confused by the 0d. -# Use [mylib]_VERSION_INT for version-checking instead -PKG_HAVE([libavcodec], [libavcodec], yes) -PKG_VERSION([libavcodec], [libavcodec]) -AC_CHECK_LIB([avcodec], [avcodec_decode_audio], [HAVE_AVCODEC_DECODE_AUDIO="yes"]) -AC_CHECK_LIB([avcodec], [avcodec_decode_audio2], [HAVE_AVCODEC_DECODE_AUDIO2="yes"]) -AC_CHECK_LIB([avcodec], [img_convert], [HAVE_IMG_CONVERT="yes"]) -PKG_HAVE([libavformat], [libavformat], yes) -PKG_VERSION([libavformat], [libavformat]) -PKG_HAVE([libavutil], [libavutil], yes) -PKG_VERSION([libavutil], [libavutil]) -if [[ x$libavcodec_HAVE = xyes -a x$libavformat_HAVE = xyes -a x$libavutil_HAVE = xyes ]]; then - ffmpeg_HAVE=yes -else - ffmpeg_HAVE=no -fi -AC_SUBST_DEFINE(HAVE_FFMPEG, $ffmpeg_HAVE) - -# find FFMpeg's swscale lib (just if FFMpeg is compiled in GPL mode) -PKG_HAVE([libswscale], [libswscale], no) -PKG_VERSION([libswscale], [libswscale]) -AC_SUBST_DEFINE(HAVE_SWSCALE, $libswscale_HAVE) - - -# find projectM version -libprojectM_PKG="libprojectM >= 0.98" -PKG_HAVE([libprojectM], [$libprojectM_PKG], no) -PKG_VERSION([libprojectM], [$libprojectM_PKG]) -AC_SUBST_DEFINE(HAVE_PROJECTM, $libprojectM_HAVE) -# get projectM include-dir -PKG_VALUE([libprojectM], [INCLUDEDIR], [variable=includedir], [$libprojectM_PKG], - [C-Header include-dir (e.g. /usr/include)]) -# get projectM data-dir (for preset- and font-dir) -PKG_VALUE([libprojectM], [DATADIR], [variable=pkgdatadir], [$libprojectM_PKG], - [projectM data-directory for presets etc. (e.g. /usr/share/projectM)]) -# check if we need the c-wrapper -if [[ "$libprojectM_VERSION_MAJOR" -ge 1 ]]; then - libprojectM_NEEDS_CWRAPPER=yes -else - libprojectM_NEEDS_CWRAPPER=no -fi -AC_SUBST_COMMENT(PROJECTM_CWRAPPER, $libprojectM_NEEDS_CWRAPPER) - -# find portaudio -PKG_HAVE([portaudio], [portaudio-2.0], yes) -PKG_VERSION([portaudio], [portaudio-2.0]) -AC_SUBST_DEFINE(HAVE_PORTAUDIO, $portaudio_HAVE) -# find portmixer -PKG_HAVE([portmixer], [portmixer], no) -AC_SUBST_DEFINE(HAVE_PORTMIXER, $portmixer_HAVE) - -# determine linker-flags -#LDFLAGS= -#LIBS= -AC_SUBST(LDFLAGS) -AC_SUBST(LIBS) - -# ----------------------------------------- -# create output files -# ----------------------------------------- - -AC_CONFIG_FILES([config-$FPC_PLATFORM.inc:config.inc.in]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([$usdxroot/tools/ResourceExtractor/Makefile]) -if [[ x$libprojectM_NEEDS_CWRAPPER = xyes ]]; then - AC_CONFIG_FILES([lib/projectM/cwrapper/Makefile]) -fi -AC_OUTPUT - -# ----------------------------------------- -# show results -# ----------------------------------------- - -AC_MSG_NOTICE([ - -!!! -!!! Configuration of $PACKAGE_NAME $PACKAGE_VERSION done! -!!! -!!! Type "make" to compile and -!!! "make install" to install it afterwards. -!!! -!!! For further information on $PACKAGE_NAME visit: -!!! $PACKAGE_WEBSITE -!!! -!!! IMPORTANT: -!!! This is an UNSUPPORTED ALPHA release for developers only. -!!! -!!! DO NOT EXPECT THE MAKEFILE OR THE PROGRAM ITSELF TO WORK -!!! -!!! If you want to contribute, visit the IRC-Channel instead: -!!! $PACKAGE_IRC -!!! -!!! PLEASE DO NOT SEND BUGREPORTS FOR THIS VERSION. -!!! -]) - -# TODO: insert this in the public beta release -#!!! In case you find a bug send a bugreport to: -#!!! $PACKAGE_BUGREPORT -#!!! You might as well ask for help at the IRC-Channel -#!!! $PACKAGE_IRC - - diff --git a/src/install-sh b/src/install-sh deleted file mode 100755 index a5897de6..00000000 --- a/src/install-sh +++ /dev/null @@ -1,519 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2006-12-25.00 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/src/lib/portaudio/delphi/portaudio.pas b/src/lib/portaudio/delphi/portaudio.pas deleted file mode 100644 index f8c08bfd..00000000 --- a/src/lib/portaudio/delphi/portaudio.pas +++ /dev/null @@ -1,1162 +0,0 @@ -{* - * $Id: portaudio.h,v 1.7 2007/08/16 20:45:34 richardash1981 Exp $ - * PortAudio Portable Real-Time Audio Library - * PortAudio API Header File - * Latest version available at: http://www.portaudio.com/ - * - * Copyright (c) 1999-2002 Ross Bencina and Phil Burk - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - *} - -{* - * The text above constitutes the entire PortAudio license; however, - * the PortAudio community also makes the following non-binding requests: - * - * Any person wishing to distribute modifications to the Software is - * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. It is also - * requested that these non-binding requests be included along with the - * license above. - *} - -{** @file - @brief The PortAudio API. -*} - -unit portaudio; - -{$IFDEF FPC} - {$PACKENUM 4} (* use 4-byte enums *) - {$PACKRECORDS C} (* C/C++-compatible record packing *) - {$MODE DELPHI } -{$ELSE} - {$MINENUMSIZE 4} (* use 4-byte enums *) -{$ENDIF} - -interface - -uses - ctypes; - -const -{$IFDEF MSWINDOWS} - LibName = 'portaudio_x86.dll'; -{$ENDIF} -{$IFDEF LINUX} - LibName = 'libportaudio.so'; -{$ENDIF} -{$IFDEF DARWIN} -// this is for portaudio version 19 - LibName = 'libportaudio.2.dylib'; - {$LINKLIB libportaudio.2} -{$ENDIF} - -{** Retrieve the release number of the currently running PortAudio build, - eg 1900. -*} -function Pa_GetVersion(): cint; cdecl; external LibName; - - -{** Retrieve a textual description of the current PortAudio build, - eg "PortAudio V19-devel 13 October 2002". -*} -function Pa_GetVersionText(): PChar; cdecl; external LibName; - - -{** Error codes returned by PortAudio functions. - Note that with the exception of paNoError, all PaErrorCodes are negative. -*} - -type TPaError = cint; -type TPaErrorCode = {enum}cint; const -{enum_begin PaErrorCode} - paNoError = 0; - - paNotInitialized = -10000; - paUnanticipatedHostError = (paNotInitialized+ 1); - paInvalidChannelCount = (paNotInitialized+ 2); - paInvalidSampleRate = (paNotInitialized+ 3); - paInvalidDevice = (paNotInitialized+ 4); - paInvalidFlag = (paNotInitialized+ 5); - paSampleFormatNotSupported = (paNotInitialized+ 6); - paBadIODeviceCombination = (paNotInitialized+ 7); - paInsufficientMemory = (paNotInitialized+ 8); - paBufferTooBig = (paNotInitialized+ 9); - paBufferTooSmall = (paNotInitialized+10); - paNullCallback = (paNotInitialized+11); - paBadStreamPtr = (paNotInitialized+12); - paTimedOut = (paNotInitialized+13); - paInternalError = (paNotInitialized+14); - paDeviceUnavailable = (paNotInitialized+15); - paIncompatibleHostApiSpecificStreamInfo = (paNotInitialized+16); - paStreamIsStopped = (paNotInitialized+17); - paStreamIsNotStopped = (paNotInitialized+18); - paInputOverflowed = (paNotInitialized+19); - paOutputUnderflowed = (paNotInitialized+20); - paHostApiNotFound = (paNotInitialized+21); - paInvalidHostApi = (paNotInitialized+22); - paCanNotReadFromACallbackStream = (paNotInitialized+23); {**< @todo review error code name *} - paCanNotWriteToACallbackStream = (paNotInitialized+24); {**< @todo review error code name *} - paCanNotReadFromAnOutputOnlyStream = (paNotInitialized+25); {**< @todo review error code name *} - paCanNotWriteToAnInputOnlyStream = (paNotInitialized+26); {**< @todo review error code name *} - paIncompatibleStreamHostApi = (paNotInitialized+27); - paBadBufferPtr = (paNotInitialized+28); -{enum_end PaErrorCode} - - -{** Translate the supplied PortAudio error code into a human readable - message. -*} -function Pa_GetErrorText( errorCode: TPaError ): PChar; cdecl; external LibName; - - -{** Library initialization function - call this before using PortAudio. - This function initialises internal data structures and prepares underlying - host APIs for use. With the exception of Pa_GetVersion(), Pa_GetVersionText(), - and Pa_GetErrorText(), this function MUST be called before using any other - PortAudio API functions. - - If Pa_Initialize() is called multiple times, each successful - call must be matched with a corresponding call to Pa_Terminate(). - Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not - required to be fully nested. - - Note that if Pa_Initialize() returns an error code, Pa_Terminate() should - NOT be called. - - @return paNoError if successful, otherwise an error code indicating the cause - of failure. - - @see Pa_Terminate -*} -function Pa_Initialize(): TPaError; cdecl; external LibName; - - -{** Library termination function - call this when finished using PortAudio. - This function deallocates all resources allocated by PortAudio since it was - initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has - been called multiple times, each call must be matched with a corresponding call - to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically - close any PortAudio streams that are still open. - - Pa_Terminate() MUST be called before exiting a program which uses PortAudio. - Failure to do so may result in serious resource leaks, such as audio devices - not being available until the next reboot. - - @return paNoError if successful, otherwise an error code indicating the cause - of failure. - - @see Pa_Initialize -*} -function Pa_Terminate(): TPaError; cdecl; external LibName; - - - -{** The type used to refer to audio devices. Values of this type usually - range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice - and paUseHostApiSpecificDeviceSpecification values. - - @see Pa_GetDeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification -*} -type TPaDeviceIndex = cint; - - -{** A special PaDeviceIndex value indicating that no device is available, - or should be used. - - @see PaDeviceIndex -*} -const paNoDevice = TPaDeviceIndex(-1); - - -{** A special PaDeviceIndex value indicating that the device(s) to be used - are specified in the host api specific stream info structure. - - @see PaDeviceIndex -*} -const paUseHostApiSpecificDeviceSpecification = TPaDeviceIndex(-2); - - -{* Host API enumeration mechanism *} - -{** The type used to enumerate to host APIs at runtime. Values of this type - range from 0 to (Pa_GetHostApiCount()-1). - - @see Pa_GetHostApiCount -*} -type TPaHostApiIndex = cint; - -{** Retrieve the number of available host APIs. Even if a host API is - available it may have no devices available. - - @return A non-negative value indicating the number of available host APIs - or, a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. - - @see PaHostApiIndex -*} -function Pa_GetHostApiCount(): TPaHostApiIndex; cdecl; external LibName; - - -{** Retrieve the index of the default host API. The default host API will be - the lowest common denominator host API on the current platform and is - unlikely to provide the best performance. - - @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) - indicating the default host API index or, a PaErrorCode (which are always - negative) if PortAudio is not initialized or an error is encountered. -*} -function Pa_GetDefaultHostApi(): TPaHostApiIndex; cdecl; external LibName; - - -{** Unchanging unique identifiers for each supported host API. This type - is used in the PaHostApiInfo structure. The values are guaranteed to be - unique and to never change, thus allowing code to be written that - conditionally uses host API specific extensions. - - New type ids will be allocated when support for a host API reaches - "public alpha" status, prior to that developers should use the - paInDevelopment type id. - - @see PaHostApiInfo -*} -type TPaHostApiTypeId = {enum}cint; const -{enum_begin PaHostApiTypeId} - paInDevelopment=0; {* use while developing support for a new host API *} - paDirectSound=1; - paMME=2; - paASIO=3; - paSoundManager=4; - paCoreAudio=5; - paOSS=7; - paALSA=8; - paAL=9; - paBeOS=10; - paWDMKS=11; - paJACK=12; - paWASAPI=13; - paAudioScienceHPI=14; -{enum_end PaHostApiTypeId} - -{** A structure containing information about a particular host API. *} - -type - PPaHostApiInfo = ^TPaHostApiInfo; - TPaHostApiInfo = record - {** this is struct version 1 *} - structVersion: cint; - {** The well known unique identifier of this host API @see PaHostApiTypeId *} - _type: TPaHostApiTypeId; - {** A textual description of the host API for display on user interfaces. *} - name: PChar; - - {** The number of devices belonging to this host API. This field may be - used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate - all devices for this host API. - @see Pa_HostApiDeviceIndexToDeviceIndex - *} - deviceCount: cint; - - {** The default input device for this host API. The value will be a - device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice - if no default input device is available. - *} - defaultInputDevice: TPaDeviceIndex; - - {** The default output device for this host API. The value will be a - device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice - if no default output device is available. - *} - defaultOutputDevice: TPaDeviceIndex; - end; - - -{** Retrieve a pointer to a structure containing information about a specific - host Api. - - @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) - - @return A pointer to an immutable PaHostApiInfo structure describing - a specific host API. If the hostApi parameter is out of range or an error - is encountered, the function returns NULL. - - The returned structure is owned by the PortAudio implementation and must not - be manipulated or freed. The pointer is only guaranteed to be valid between - calls to Pa_Initialize() and Pa_Terminate(). -*} -function Pa_GetHostApiInfo( hostApi: TPaHostApiIndex ): PPaHostApiInfo; cdecl; external LibName; - - -{** Convert a static host API unique identifier, into a runtime - host API index. - - @param type A unique host API identifier belonging to the PaHostApiTypeId - enumeration. - - @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, - a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. - - The paHostApiNotFound error code indicates that the host API specified by the - type parameter is not available. - - @see PaHostApiTypeId -*} -function Pa_HostApiTypeIdToHostApiIndex( _type: TPaHostApiTypeId ): TPaHostApiIndex; cdecl; external LibName; - - -{** Convert a host-API-specific device index to standard PortAudio device index. - This function may be used in conjunction with the deviceCount field of - PaHostApiInfo to enumerate all devices for the specified host API. - - @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) - - @param hostApiDeviceIndex A valid per-host device index in the range - 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) - - @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) - or, a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. - - A paInvalidHostApi error code indicates that the host API index specified by - the hostApi parameter is out of range. - - A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter - is out of range. - - @see PaHostApiInfo -*} -function Pa_HostApiDeviceIndexToDeviceIndex( hostApi: TPaHostApiIndex; - hostApiDeviceIndex: cint ): TPaDeviceIndex; cdecl; external LibName; - - - -{** Structure used to return information about a host error condition. -*} -type - PPaHostErrorInfo = ^TPaHostErrorInfo; - TPaHostErrorInfo = record - hostApiType: TPaHostApiTypeId; {**< the host API which returned the error code *} - errorCode: clong; {**< the error code returned *} - errorText: PChar; {**< a textual description of the error if available, otherwise a zero-length string *} - end; - - -{** Return information about the last host error encountered. The error - information returned by Pa_GetLastHostErrorInfo() will never be modified - asyncronously by errors occurring in other PortAudio owned threads - (such as the thread that manages the stream callback.) - - This function is provided as a last resort, primarily to enhance debugging - by providing clients with access to all available error information. - - @return A pointer to an immutable structure constaining information about - the host error. The values in this structure will only be valid if a - PortAudio function has previously returned the paUnanticipatedHostError - error code. -*} -function Pa_GetLastHostErrorInfo(): PPaHostErrorInfo; cdecl; external LibName; - - - -{* Device enumeration and capabilities *} - -{** Retrieve the number of available devices. The number of available devices - may be zero. - - @return A non-negative value indicating the number of available devices or, - a PaErrorCode (which are always negative) if PortAudio is not initialized - or an error is encountered. -*} -function Pa_GetDeviceCount(): TPaDeviceIndex; cdecl; external LibName; - - -{** Retrieve the index of the default input device. The result can be - used in the inputDevice parameter to Pa_OpenStream(). - - @return The default input device index for the default host API, or paNoDevice - if no default input device is available or an error was encountered. -*} -function Pa_GetDefaultInputDevice(): TPaDeviceIndex; cdecl; external LibName; - - -{** Retrieve the index of the default output device. The result can be - used in the outputDevice parameter to Pa_OpenStream(). - - @return The default output device index for the defualt host API, or paNoDevice - if no default output device is available or an error was encountered. - - @note - On the PC, the user can specify a default device by - setting an environment variable. For example, to use device #1. -
- set PA_RECOMMENDED_OUTPUT_DEVICE=1
-
- The user should first determine the available device ids by using - the supplied application "pa_devs". -*} -function Pa_GetDefaultOutputDevice(): TPaDeviceIndex; cdecl; external LibName; - - -{** The type used to represent monotonic time in seconds that can be used - for syncronisation. The type is used for the outTime argument to the - PaStreamCallback and as the result of Pa_GetStreamTime(). - - @see PaStreamCallback, Pa_GetStreamTime -*} -type TPaTime = cdouble; - - -{** A type used to specify one or more sample formats. Each value indicates - a possible format for sound data passed to and from the stream callback, - Pa_ReadStream and Pa_WriteStream. - - The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 - and aUInt8 are usually implemented by all implementations. - - The floating point representation (paFloat32) uses +1.0 and -1.0 as the - maximum and minimum respectively. - - paUInt8 is an unsigned 8 bit format where 128 is considered "ground" - - The paNonInterleaved flag indicates that a multichannel buffer is passed - as a set of non-interleaved pointers. - - @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo - @see paFloat32, paInt16, paInt32, paInt24, paInt8 - @see paUInt8, paCustomFormat, paNonInterleaved -*} -type TPaSampleFormat = culong; -const - paFloat32 = TPaSampleFormat($00000001); {**< @see PaSampleFormat *} - paInt32 = TPaSampleFormat($00000002); {**< @see PaSampleFormat *} - paInt24 = TPaSampleFormat($00000004); {**< Packed 24 bit format. @see PaSampleFormat *} - paInt16 = TPaSampleFormat($00000008); {**< @see PaSampleFormat *} - paInt8 = TPaSampleFormat($00000010); {**< @see PaSampleFormat *} - paUInt8 = TPaSampleFormat($00000020); {**< @see PaSampleFormat *} - paCustomFormat = TPaSampleFormat($00010000); {**< @see PaSampleFormat *} - paNonInterleaved = TPaSampleFormat($80000000); - -{** A structure providing information and capabilities of PortAudio devices. - Devices may support input, output or both input and output. -*} -type - PPaDeviceInfo = ^TPaDeviceInfo; - TPaDeviceInfo = record - structVersion: cint; {* this is struct version 2 *} - name: PChar; - hostApi: TPaHostApiIndex; {* note this is a host API index, not a type id*} - - maxInputChannels: cint; - maxOutputChannels: cint; - - {* Default latency values for interactive performance. *} - defaultLowInputLatency: TPaTime; - defaultLowOutputLatency: TPaTime; - {* Default latency values for robust non-interactive applications (eg. playing sound files). *} - defaultHighInputLatency: TPaTime; - defaultHighOutputLatency: TPaTime; - - defaultSampleRate: cdouble; - end; - - -{** Retrieve a pointer to a PaDeviceInfo structure containing information - about the specified device. - @return A pointer to an immutable PaDeviceInfo structure. If the device - parameter is out of range the function returns NULL. - - @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) - - @note PortAudio manages the memory referenced by the returned pointer, - the client must not manipulate or free the memory. The pointer is only - guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). - - @see PaDeviceInfo, PaDeviceIndex -*} -function Pa_GetDeviceInfo( device: TPaDeviceIndex ): PPaDeviceInfo; cdecl; external LibName; - - -{** Parameters for one direction (input or output) of a stream. -*} -type - PPaStreamParameters = ^TPaStreamParameters; - TPaStreamParameters = record - {** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) - specifying the device to be used or the special constant - paUseHostApiSpecificDeviceSpecification which indicates that the actual - device(s) to use are specified in hostApiSpecificStreamInfo. - This field must not be set to paNoDevice. - *} - device: TPaDeviceIndex; - - {** The number of channels of sound to be delivered to the - stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). - It can range from 1 to the value of maxInputChannels in the - PaDeviceInfo record for the device specified by the device parameter. - *} - channelCount: cint; - - {** The sample format of the buffer provided to the stream callback, - a_ReadStream() or Pa_WriteStream(). It may be any of the formats described - by the PaSampleFormat enumeration. - *} - sampleFormat: TPaSampleFormat; - - {** The desired latency in seconds. Where practical, implementations should - configure their latency based on these parameters, otherwise they may - choose the closest viable latency instead. Unless the suggested latency - is greater than the absolute upper limit for the device implementations - should round the suggestedLatency up to the next practial value - ie to - provide an equal or higher latency than suggestedLatency wherever possibe. - Actual latency values for an open stream may be retrieved using the - inputLatency and outputLatency fields of the PaStreamInfo structure - returned by Pa_GetStreamInfo(). - @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo - *} - suggestedLatency: TPaTime; - - {** An optional pointer to a host api specific data structure - containing additional information for device setup and/or stream processing. - hostApiSpecificStreamInfo is never required for correct operation, - if not used it should be set to NULL. - *} - hostApiSpecificStreamInfo: Pointer; - end; - - -{** Return code for Pa_IsFormatSupported indicating success. *} -const paFormatIsSupported = (0); - -{** Determine whether it would be possible to open a stream with the specified - parameters. - - @param inputParameters A structure that describes the input parameters used to - open a stream. The suggestedLatency field is ignored. See PaStreamParameters - for a description of these parameters. inputParameters must be NULL for - output-only streams. - - @param outputParameters A structure that describes the output parameters used - to open a stream. The suggestedLatency field is ignored. See PaStreamParameters - for a description of these parameters. outputParameters must be NULL for - input-only streams. - - @param sampleRate The required sampleRate. For full-duplex streams it is the - sample rate for both input and output - - @return Returns 0 if the format is supported, and an error code indicating why - the format is not supported otherwise. The constant paFormatIsSupported is - provided to compare with the return value for success. - - @see paFormatIsSupported, PaStreamParameters -*} -function Pa_IsFormatSupported( inputParameters: PPaStreamParameters; - outputParameters: PPaStreamParameters; - sampleRate: cdouble ): TPaError; cdecl; external LibName; - - - -{* Streaming types and functions *} - - -{** - A single PaStream can provide multiple channels of real-time - streaming audio input and output to a client application. A stream - provides access to audio hardware represented by one or more - PaDevices. Depending on the underlying Host API, it may be possible - to open multiple streams using the same device, however this behavior - is implementation defined. Portable applications should assume that - a PaDevice may be simultaneously used by at most one PaStream. - - Pointers to PaStream objects are passed between PortAudio functions that - operate on streams. - - @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, - Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, - Pa_GetStreamTime, Pa_GetStreamCpuLoad - -*} -type - PPaStream = Pointer; - -{** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() - or Pa_OpenDefaultStream() to indicate that the stream callback will - accept buffers of any size. -*} -const paFramesPerBufferUnspecified = (0); - - -{** Flags used to control the behavior of a stream. They are passed as - parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be - ORed together. - - @see Pa_OpenStream, Pa_OpenDefaultStream - @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, - paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags -*} -type TPaStreamFlags = culong; - -{** @see PaStreamFlags *} -const paNoFlag = TPaStreamFlags(0); - -{** Disable default clipping of out of range samples. - @see PaStreamFlags -*} -const paClipOff = TPaStreamFlags($00000001); - -{** Disable default dithering. - @see PaStreamFlags -*} -const paDitherOff = TPaStreamFlags($00000002); - -{** Flag requests that where possible a full duplex stream will not discard - overflowed input samples without calling the stream callback. This flag is - only valid for full duplex callback streams and only when used in combination - with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using - this flag incorrectly results in a paInvalidFlag error being returned from - Pa_OpenStream and Pa_OpenDefaultStream. - - @see PaStreamFlags, paFramesPerBufferUnspecified -*} -const paNeverDropInput = TPaStreamFlags($00000004); - -{** Call the stream callback to fill initial output buffers, rather than the - default behavior of priming the buffers with zeros (silence). This flag has - no effect for input-only and blocking read/write streams. - - @see PaStreamFlags -*} -const paPrimeOutputBuffersUsingStreamCallback = TPaStreamFlags($00000008); - -{** A mask specifying the platform specific bits. - @see PaStreamFlags -*} -const paPlatformSpecificFlags = TPaStreamFlags($FFFF0000); - -{** - Timing information for the buffers passed to the stream callback. -*} -type - PPaStreamCallbackTimeInfo = ^TPaStreamCallbackTimeInfo; - TPaStreamCallbackTimeInfo = record - inputBufferAdcTime: TPaTime; - currentTime: TPaTime; - outputBufferDacTime: TPaTime; - end; - - -{** - Flag bit constants for the statusFlags to PaStreamCallback. - - @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, - paPrimingOutput -*} -type TPaStreamCallbackFlags = culong; - -{** In a stream opened with paFramesPerBufferUnspecified, indicates that - input data is all silence (zeros) because no real data is available. In a - stream opened without paFramesPerBufferUnspecified, it indicates that one or - more zero samples have been inserted into the input buffer to compensate - for an input underflow. - @see PaStreamCallbackFlags -*} -const paInputUnderflow = TPaStreamCallbackFlags($00000001); - -{** In a stream opened with paFramesPerBufferUnspecified, indicates that data - prior to the first sample of the input buffer was discarded due to an - overflow, possibly because the stream callback is using too much CPU time. - Otherwise indicates that data prior to one or more samples in the - input buffer was discarded. - @see PaStreamCallbackFlags -*} -const paInputOverflow = TPaStreamCallbackFlags($00000002); - -{** Indicates that output data (or a gap) was inserted, possibly because the - stream callback is using too much CPU time. - @see PaStreamCallbackFlags -*} -const paOutputUnderflow = TPaStreamCallbackFlags($00000004); - -{** Indicates that output data will be discarded because no room is available. - @see PaStreamCallbackFlags -*} -const paOutputOverflow = TPaStreamCallbackFlags($00000008); - -{** Some of all of the output data will be used to prime the stream, input - data may be zero. - @see PaStreamCallbackFlags -*} -const paPrimingOutput = TPaStreamCallbackFlags($00000010); - -{** - Allowable return values for the PaStreamCallback. - @see PaStreamCallback -*} -type TPaStreamCallbackResult = {enum}cint; const -{enum_begin PaStreamCallbackResult} - paContinue=0; - paComplete=1; - paAbort=2; -{enum_end PaStreamCallbackResult} - -{** - Functions of type PaStreamCallback are implemented by PortAudio clients. - They consume, process or generate audio in response to requests from an - active PortAudio stream. - - @param input and @param output are arrays of interleaved samples, - the format, packing and number of channels used by the buffers are - determined by parameters to Pa_OpenStream(). - - @param frameCount The number of sample frames to be processed by - the stream callback. - - @param timeInfo The time in seconds when the first sample of the input - buffer was received at the audio input, the time in seconds when the first - sample of the output buffer will begin being played at the audio output, and - the time in seconds when the stream callback was called. - See also Pa_GetStreamTime() - - @param statusFlags Flags indicating whether input and/or output buffers - have been inserted or will be dropped to overcome underflow or overflow - conditions. - - @param userData The value of a user supplied pointer passed to - Pa_OpenStream() intended for storing synthesis data etc. - - @return - The stream callback should return one of the values in the - PaStreamCallbackResult enumeration. To ensure that the callback continues - to be called, it should return paContinue (0). Either paComplete or paAbort - can be returned to finish stream processing, after either of these values is - returned the callback will not be called again. If paAbort is returned the - stream will finish as soon as possible. If paComplete is returned, the stream - will continue until all buffers generated by the callback have been played. - This may be useful in applications such as soundfile players where a specific - duration of output is required. However, it is not necessary to utilise this - mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also - be used to stop the stream. The callback must always fill the entire output - buffer irrespective of its return value. - - @see Pa_OpenStream, Pa_OpenDefaultStream - - @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call - PortAudio API functions from within the stream callback. -*} -type - PPaStreamCallback = ^TPaStreamCallback; - TPaStreamCallback = function( - input: Pointer; output: Pointer; - frameCount: culong; - timeInfo: PPaStreamCallbackTimeInfo; - statusFlags: TPaStreamCallbackFlags; - userData: Pointer ): cint; cdecl; - - -{** Opens a stream for either input, output or both. - - @param stream The address of a PaStream pointer which will receive - a pointer to the newly opened stream. - - @param inputParameters A structure that describes the input parameters used by - the opened stream. See PaStreamParameters for a description of these parameters. - inputParameters must be NULL for output-only streams. - - @param outputParameters A structure that describes the output parameters used by - the opened stream. See PaStreamParameters for a description of these parameters. - outputParameters must be NULL for input-only streams. - - @param sampleRate The desired sampleRate. For full-duplex streams it is the - sample rate for both input and output - - @param framesPerBuffer The number of frames passed to the stream callback - function, or the preferred block granularity for a blocking read/write stream. - The special value paFramesPerBufferUnspecified (0) may be used to request that - the stream callback will recieve an optimal (and possibly varying) number of - frames based on host requirements and the requested latency settings. - Note: With some host APIs, the use of non-zero framesPerBuffer for a callback - stream may introduce an additional layer of buffering which could introduce - additional latency. PortAudio guarantees that the additional latency - will be kept to the theoretical minimum however, it is strongly recommended - that a non-zero framesPerBuffer value only be used when your algorithm - requires a fixed number of frames per stream callback. - - @param streamFlags Flags which modify the behaviour of the streaming process. - This parameter may contain a combination of flags ORed together. Some flags may - only be relevant to certain buffer formats. - - @param streamCallback A pointer to a client supplied function that is responsible - for processing and filling input and output buffers. If this parameter is NULL - the stream will be opened in 'blocking read/write' mode. In blocking mode, - the client can receive sample data using Pa_ReadStream and write sample data - using Pa_WriteStream, the number of samples that may be read or written - without blocking is returned by Pa_GetStreamReadAvailable and - Pa_GetStreamWriteAvailable respectively. - - @param userData A client supplied pointer which is passed to the stream callback - function. It could for example, contain a pointer to instance data necessary - for processing the audio buffers. This parameter is ignored if streamCallback - is NULL. - - @return - Upon success Pa_OpenStream() returns paNoError and places a pointer to a - valid PaStream in the stream argument. The stream is inactive (stopped). - If a call to Pa_OpenStream() fails, a non-zero error code is returned (see - PaError for possible error codes) and the value of stream is invalid. - - @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, - Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable -*} -function Pa_OpenStream( var stream: PPaStream; - inputParameters: PPaStreamParameters; - outputParameters: PPaStreamParameters; - sampleRate: cdouble; - framesPerBuffer: culong; - streamFlags: TPaStreamFlags; - streamCallback: PPaStreamCallback; - userData: Pointer ): TPaError; cdecl; external LibName; - - -{** A simplified version of Pa_OpenStream() that opens the default input - and/or output devices. - - @param stream The address of a PaStream pointer which will receive - a pointer to the newly opened stream. - - @param numInputChannels The number of channels of sound that will be supplied - to the stream callback or returned by Pa_ReadStream. It can range from 1 to - the value of maxInputChannels in the PaDeviceInfo record for the default input - device. If 0 the stream is opened as an output-only stream. - - @param numOutputChannels The number of channels of sound to be delivered to the - stream callback or passed to Pa_WriteStream. It can range from 1 to the value - of maxOutputChannels in the PaDeviceInfo record for the default output dvice. - If 0 the stream is opened as an output-only stream. - - @param sampleFormat The sample format of both the input and output buffers - provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. - sampleFormat may be any of the formats described by the PaSampleFormat - enumeration. - - @param sampleRate Same as Pa_OpenStream parameter of the same name. - @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. - @param streamCallback Same as Pa_OpenStream parameter of the same name. - @param userData Same as Pa_OpenStream parameter of the same name. - - @return As for Pa_OpenStream - - @see Pa_OpenStream, PaStreamCallback -*} -function Pa_OpenDefaultStream( var stream: PPaStream; - numInputChannels: cint; - numOutputChannels: cint; - sampleFormat: TPaSampleFormat; - sampleRate: cdouble; - framesPerBuffer: culong; - streamCallback: PPaStreamCallback; - userData: Pointer ): TPaError; cdecl; external LibName; - - -{** Closes an audio stream. If the audio stream is active it - discards any pending buffers as if Pa_AbortStream() had been called. -*} -function Pa_CloseStream( stream: PPaStream ): TPaError; cdecl; external LibName; - - -{** Functions of type PaStreamFinishedCallback are implemented by PortAudio - clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback - function. Once registered they are called when the stream becomes inactive - (ie once a call to Pa_StopStream() will not block). - A stream will become inactive after the stream callback returns non-zero, - or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio - output, if the stream callback returns paComplete, or Pa_StopStream is called, - the stream finished callback will not be called until all generated sample data - has been played. - - @param userData The userData parameter supplied to Pa_OpenStream() - - @see Pa_SetStreamFinishedCallback -*} -type - PPaStreamFinishedCallback = ^TPaStreamFinishedCallback; - TPaStreamFinishedCallback = procedure( userData: Pointer ); cdecl; - - -{** Register a stream finished callback function which will be called when the - stream becomes inactive. See the description of PaStreamFinishedCallback for - further details about when the callback will be called. - - @param stream a pointer to a PaStream that is in the stopped state - if the - stream is not stopped, the stream's finished callback will remain unchanged - and an error code will be returned. - - @param streamFinishedCallback a pointer to a function with the same signature - as PaStreamFinishedCallback, that will be called when the stream becomes - inactive. Passing NULL for this parameter will un-register a previously - registered stream finished callback function. - - @return on success returns paNoError, otherwise an error code indicating the cause - of the error. - - @see PaStreamFinishedCallback -*} -function Pa_SetStreamFinishedCallback( stream: PPaStream; - streamFinishedCallback: PPaStreamFinishedCallback ): TPaError; cdecl; external LibName; - - -{** Commences audio processing. -*} -function Pa_StartStream( stream: PPaStream ): TPaError; cdecl; external LibName; - - -{** Terminates audio processing. It waits until all pending - audio buffers have been played before it returns. -*} -function Pa_StopStream( stream: PPaStream ): TPaError; cdecl; external LibName; - - -{** Terminates audio processing immediately without waiting for pending - buffers to complete. -*} -function Pa_AbortStream( stream: PPaStream ): TPaError; cdecl; external LibName; - - -{** Determine whether the stream is stopped. - A stream is considered to be stopped prior to a successful call to - Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. - If a stream callback returns a value other than paContinue the stream is NOT - considered to be stopped. - - @return Returns one (1) when the stream is stopped, zero (0) when - the stream is running or, a PaErrorCode (which are always negative) if - PortAudio is not initialized or an error is encountered. - - @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive -*} -function Pa_IsStreamStopped( stream: PPaStream ): TPaError; cdecl; external LibName; - - -{** Determine whether the stream is active. - A stream is active after a successful call to Pa_StartStream(), until it - becomes inactive either as a result of a call to Pa_StopStream() or - Pa_AbortStream(), or as a result of a return value other than paContinue from - the stream callback. In the latter case, the stream is considered inactive - after the last buffer has finished playing. - - @return Returns one (1) when the stream is active (ie playing or recording - audio), zero (0) when not playing or, a PaErrorCode (which are always negative) - if PortAudio is not initialized or an error is encountered. - - @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped -*} -function Pa_IsStreamActive( stream: PPaStream ): TPaError; cdecl; external LibName; - - - -{** A structure containing unchanging information about an open stream. - @see Pa_GetStreamInfo -*} -type - PPaStreamInfo = ^TPaStreamInfo; - TPaStreamInfo = record - {** this is struct version 1 *} - structVersion: cint; - - {** The input latency of the stream in seconds. This value provides the most - accurate estimate of input latency available to the implementation. It may - differ significantly from the suggestedLatency value passed to Pa_OpenStream(). - The value of this field will be zero (0.) for output-only streams. - @see PaTime - *} - inputLatency: TPaTime; - - {** The output latency of the stream in seconds. This value provides the most - accurate estimate of output latency available to the implementation. It may - differ significantly from the suggestedLatency value passed to Pa_OpenStream(). - The value of this field will be zero (0.) for input-only streams. - @see PaTime - *} - outputLatency: TPaTime; - - {** The sample rate of the stream in Hertz (samples per second). In cases - where the hardware sample rate is inaccurate and PortAudio is aware of it, - the value of this field may be different from the sampleRate parameter - passed to Pa_OpenStream(). If information about the actual hardware sample - rate is not available, this field will have the same value as the sampleRate - parameter passed to Pa_OpenStream(). - *} - sampleRate: cdouble; - end; - - -{** Retrieve a pointer to a PaStreamInfo structure containing information - about the specified stream. - @return A pointer to an immutable PaStreamInfo structure. If the stream - parameter invalid, or an error is encountered, the function returns NULL. - - @param stream A pointer to an open stream previously created with Pa_OpenStream. - - @note PortAudio manages the memory referenced by the returned pointer, - the client must not manipulate or free the memory. The pointer is only - guaranteed to be valid until the specified stream is closed. - - @see PaStreamInfo -*} -function Pa_GetStreamInfo( stream: PPaStream ): PPaStreamInfo; cdecl; external LibName; - - -{** Determine the current time for the stream according to the same clock used - to generate buffer timestamps. This time may be used for syncronising other - events to the audio stream, for example synchronizing audio to MIDI. - - @return The stream's current time in seconds, or 0 if an error occurred. - - @see PaTime, PaStreamCallback -*} -function Pa_GetStreamTime( stream: PPaStream ): TPaTime; cdecl; external LibName; - - -{** Retrieve CPU usage information for the specified stream. - The "CPU Load" is a fraction of total CPU time consumed by a callback stream's - audio processing routines including, but not limited to the client supplied - stream callback. This function does not work with blocking read/write streams. - - This function may be called from the stream callback function or the - application. - - @return - A floating point value, typically between 0.0 and 1.0, where 1.0 indicates - that the stream callback is consuming the maximum number of CPU cycles possible - to maintain real-time operation. A value of 0.5 would imply that PortAudio and - the stream callback was consuming roughly 50% of the available CPU time. The - return value may exceed 1.0. A value of 0.0 will always be returned for a - blocking read/write stream, or if an error occurrs. -*} -function Pa_GetStreamCpuLoad( stream: PPaStream ): cdouble; cdecl; external LibName; - - -{** Read samples from an input stream. The function doesn't return until - the entire buffer has been filled - this may involve waiting for the operating - system to supply the data. - - @param stream A pointer to an open stream previously created with Pa_OpenStream. - - @param buffer A pointer to a buffer of sample frames. The buffer contains - samples in the format specified by the inputParameters->sampleFormat field - used to open the stream, and the number of channels specified by - inputParameters->numChannels. If non-interleaved samples were requested, - buffer is a pointer to the first element of an array of non-interleaved - buffer pointers, one for each channel. - - @param frames The number of frames to be read into buffer. This parameter - is not constrained to a specific range, however high performance applications - will want to match this parameter to the framesPerBuffer parameter used - when opening the stream. - - @return On success PaNoError will be returned, or PaInputOverflowed if input - data was discarded by PortAudio after the previous call and before this call. -*} -function Pa_ReadStream( stream: PPaStream; - buffer: Pointer; - frames: culong ): TPaError; cdecl; external LibName; - - -{** Write samples to an output stream. This function doesn't return until the - entire buffer has been consumed - this may involve waiting for the operating - system to consume the data. - - @param stream A pointer to an open stream previously created with Pa_OpenStream. - - @param buffer A pointer to a buffer of sample frames. The buffer contains - samples in the format specified by the outputParameters->sampleFormat field - used to open the stream, and the number of channels specified by - outputParameters->numChannels. If non-interleaved samples were requested, - buffer is a pointer to the first element of an array of non-interleaved - buffer pointers, one for each channel. - - @param frames The number of frames to be written from buffer. This parameter - is not constrained to a specific range, however high performance applications - will want to match this parameter to the framesPerBuffer parameter used - when opening the stream. - - @return On success PaNoError will be returned, or paOutputUnderflowed if - additional output data was inserted after the previous call and before this - call. -*} -function Pa_WriteStream( stream: PPaStream; - buffer: Pointer; - frames: culong ): TPaError; cdecl; external LibName; - - -{** Retrieve the number of frames that can be read from the stream without - waiting. - - @return Returns a non-negative value representing the maximum number of frames - that can be read from the stream without blocking or busy waiting or, a - PaErrorCode (which are always negative) if PortAudio is not initialized or an - error is encountered. -*} -function Pa_GetStreamReadAvailable( stream: PPaStream ): cslong; cdecl; external LibName; - - -{** Retrieve the number of frames that can be written to the stream without - waiting. - - @return Returns a non-negative value representing the maximum number of frames - that can be written to the stream without blocking or busy waiting or, a - PaErrorCode (which are always negative) if PortAudio is not initialized or an - error is encountered. -*} -function Pa_GetStreamWriteAvailable( stream: PPaStream ): cslong; cdecl; external LibName; - - -{** Retrieve the host type handling an open stream. - - @return Returns a non-negative value representing the host API type - handling an open stream or, a PaErrorCode (which are always negative) - if PortAudio is not initialized or an error is encountered. -*} -function Pa_GetStreamHostApiType( stream: PPaStream ): TPaHostApiTypeId; cdecl; external LibName; - - -{* Miscellaneous utilities *} - - -{** Retrieve the size of a given sample format in bytes. - - @return The size in bytes of a single sample in the specified format, - or paSampleFormatNotSupported if the format is not supported. -*} -function Pa_GetSampleSize( format: TPaSampleFormat ): TPaError; cdecl; external LibName; - - -{** Put the caller to sleep for at least 'msec' milliseconds. This function is - provided only as a convenience for authors of portable code (such as the tests - and examples in the PortAudio distribution.) - - The function may sleep longer than requested so don't rely on this for accurate - musical timing. -*} -procedure Pa_Sleep( msec: clong ); cdecl; external LibName; - -implementation - -end. diff --git a/src/lib/portaudio/portaudio.pas b/src/lib/portaudio/portaudio.pas new file mode 100644 index 00000000..f8c08bfd --- /dev/null +++ b/src/lib/portaudio/portaudio.pas @@ -0,0 +1,1162 @@ +{* + * $Id: portaudio.h,v 1.7 2007/08/16 20:45:34 richardash1981 Exp $ + * PortAudio Portable Real-Time Audio Library + * PortAudio API Header File + * Latest version available at: http://www.portaudio.com/ + * + * Copyright (c) 1999-2002 Ross Bencina and Phil Burk + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + *} + +{* + * The text above constitutes the entire PortAudio license; however, + * the PortAudio community also makes the following non-binding requests: + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. It is also + * requested that these non-binding requests be included along with the + * license above. + *} + +{** @file + @brief The PortAudio API. +*} + +unit portaudio; + +{$IFDEF FPC} + {$PACKENUM 4} (* use 4-byte enums *) + {$PACKRECORDS C} (* C/C++-compatible record packing *) + {$MODE DELPHI } +{$ELSE} + {$MINENUMSIZE 4} (* use 4-byte enums *) +{$ENDIF} + +interface + +uses + ctypes; + +const +{$IFDEF MSWINDOWS} + LibName = 'portaudio_x86.dll'; +{$ENDIF} +{$IFDEF LINUX} + LibName = 'libportaudio.so'; +{$ENDIF} +{$IFDEF DARWIN} +// this is for portaudio version 19 + LibName = 'libportaudio.2.dylib'; + {$LINKLIB libportaudio.2} +{$ENDIF} + +{** Retrieve the release number of the currently running PortAudio build, + eg 1900. +*} +function Pa_GetVersion(): cint; cdecl; external LibName; + + +{** Retrieve a textual description of the current PortAudio build, + eg "PortAudio V19-devel 13 October 2002". +*} +function Pa_GetVersionText(): PChar; cdecl; external LibName; + + +{** Error codes returned by PortAudio functions. + Note that with the exception of paNoError, all PaErrorCodes are negative. +*} + +type TPaError = cint; +type TPaErrorCode = {enum}cint; const +{enum_begin PaErrorCode} + paNoError = 0; + + paNotInitialized = -10000; + paUnanticipatedHostError = (paNotInitialized+ 1); + paInvalidChannelCount = (paNotInitialized+ 2); + paInvalidSampleRate = (paNotInitialized+ 3); + paInvalidDevice = (paNotInitialized+ 4); + paInvalidFlag = (paNotInitialized+ 5); + paSampleFormatNotSupported = (paNotInitialized+ 6); + paBadIODeviceCombination = (paNotInitialized+ 7); + paInsufficientMemory = (paNotInitialized+ 8); + paBufferTooBig = (paNotInitialized+ 9); + paBufferTooSmall = (paNotInitialized+10); + paNullCallback = (paNotInitialized+11); + paBadStreamPtr = (paNotInitialized+12); + paTimedOut = (paNotInitialized+13); + paInternalError = (paNotInitialized+14); + paDeviceUnavailable = (paNotInitialized+15); + paIncompatibleHostApiSpecificStreamInfo = (paNotInitialized+16); + paStreamIsStopped = (paNotInitialized+17); + paStreamIsNotStopped = (paNotInitialized+18); + paInputOverflowed = (paNotInitialized+19); + paOutputUnderflowed = (paNotInitialized+20); + paHostApiNotFound = (paNotInitialized+21); + paInvalidHostApi = (paNotInitialized+22); + paCanNotReadFromACallbackStream = (paNotInitialized+23); {**< @todo review error code name *} + paCanNotWriteToACallbackStream = (paNotInitialized+24); {**< @todo review error code name *} + paCanNotReadFromAnOutputOnlyStream = (paNotInitialized+25); {**< @todo review error code name *} + paCanNotWriteToAnInputOnlyStream = (paNotInitialized+26); {**< @todo review error code name *} + paIncompatibleStreamHostApi = (paNotInitialized+27); + paBadBufferPtr = (paNotInitialized+28); +{enum_end PaErrorCode} + + +{** Translate the supplied PortAudio error code into a human readable + message. +*} +function Pa_GetErrorText( errorCode: TPaError ): PChar; cdecl; external LibName; + + +{** Library initialization function - call this before using PortAudio. + This function initialises internal data structures and prepares underlying + host APIs for use. With the exception of Pa_GetVersion(), Pa_GetVersionText(), + and Pa_GetErrorText(), this function MUST be called before using any other + PortAudio API functions. + + If Pa_Initialize() is called multiple times, each successful + call must be matched with a corresponding call to Pa_Terminate(). + Pairs of calls to Pa_Initialize()/Pa_Terminate() may overlap, and are not + required to be fully nested. + + Note that if Pa_Initialize() returns an error code, Pa_Terminate() should + NOT be called. + + @return paNoError if successful, otherwise an error code indicating the cause + of failure. + + @see Pa_Terminate +*} +function Pa_Initialize(): TPaError; cdecl; external LibName; + + +{** Library termination function - call this when finished using PortAudio. + This function deallocates all resources allocated by PortAudio since it was + initializied by a call to Pa_Initialize(). In cases where Pa_Initialise() has + been called multiple times, each call must be matched with a corresponding call + to Pa_Terminate(). The final matching call to Pa_Terminate() will automatically + close any PortAudio streams that are still open. + + Pa_Terminate() MUST be called before exiting a program which uses PortAudio. + Failure to do so may result in serious resource leaks, such as audio devices + not being available until the next reboot. + + @return paNoError if successful, otherwise an error code indicating the cause + of failure. + + @see Pa_Initialize +*} +function Pa_Terminate(): TPaError; cdecl; external LibName; + + + +{** The type used to refer to audio devices. Values of this type usually + range from 0 to (Pa_GetDeviceCount()-1), and may also take on the PaNoDevice + and paUseHostApiSpecificDeviceSpecification values. + + @see Pa_GetDeviceCount, paNoDevice, paUseHostApiSpecificDeviceSpecification +*} +type TPaDeviceIndex = cint; + + +{** A special PaDeviceIndex value indicating that no device is available, + or should be used. + + @see PaDeviceIndex +*} +const paNoDevice = TPaDeviceIndex(-1); + + +{** A special PaDeviceIndex value indicating that the device(s) to be used + are specified in the host api specific stream info structure. + + @see PaDeviceIndex +*} +const paUseHostApiSpecificDeviceSpecification = TPaDeviceIndex(-2); + + +{* Host API enumeration mechanism *} + +{** The type used to enumerate to host APIs at runtime. Values of this type + range from 0 to (Pa_GetHostApiCount()-1). + + @see Pa_GetHostApiCount +*} +type TPaHostApiIndex = cint; + +{** Retrieve the number of available host APIs. Even if a host API is + available it may have no devices available. + + @return A non-negative value indicating the number of available host APIs + or, a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + @see PaHostApiIndex +*} +function Pa_GetHostApiCount(): TPaHostApiIndex; cdecl; external LibName; + + +{** Retrieve the index of the default host API. The default host API will be + the lowest common denominator host API on the current platform and is + unlikely to provide the best performance. + + @return A non-negative value ranging from 0 to (Pa_GetHostApiCount()-1) + indicating the default host API index or, a PaErrorCode (which are always + negative) if PortAudio is not initialized or an error is encountered. +*} +function Pa_GetDefaultHostApi(): TPaHostApiIndex; cdecl; external LibName; + + +{** Unchanging unique identifiers for each supported host API. This type + is used in the PaHostApiInfo structure. The values are guaranteed to be + unique and to never change, thus allowing code to be written that + conditionally uses host API specific extensions. + + New type ids will be allocated when support for a host API reaches + "public alpha" status, prior to that developers should use the + paInDevelopment type id. + + @see PaHostApiInfo +*} +type TPaHostApiTypeId = {enum}cint; const +{enum_begin PaHostApiTypeId} + paInDevelopment=0; {* use while developing support for a new host API *} + paDirectSound=1; + paMME=2; + paASIO=3; + paSoundManager=4; + paCoreAudio=5; + paOSS=7; + paALSA=8; + paAL=9; + paBeOS=10; + paWDMKS=11; + paJACK=12; + paWASAPI=13; + paAudioScienceHPI=14; +{enum_end PaHostApiTypeId} + +{** A structure containing information about a particular host API. *} + +type + PPaHostApiInfo = ^TPaHostApiInfo; + TPaHostApiInfo = record + {** this is struct version 1 *} + structVersion: cint; + {** The well known unique identifier of this host API @see PaHostApiTypeId *} + _type: TPaHostApiTypeId; + {** A textual description of the host API for display on user interfaces. *} + name: PChar; + + {** The number of devices belonging to this host API. This field may be + used in conjunction with Pa_HostApiDeviceIndexToDeviceIndex() to enumerate + all devices for this host API. + @see Pa_HostApiDeviceIndexToDeviceIndex + *} + deviceCount: cint; + + {** The default input device for this host API. The value will be a + device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice + if no default input device is available. + *} + defaultInputDevice: TPaDeviceIndex; + + {** The default output device for this host API. The value will be a + device index ranging from 0 to (Pa_GetDeviceCount()-1), or paNoDevice + if no default output device is available. + *} + defaultOutputDevice: TPaDeviceIndex; + end; + + +{** Retrieve a pointer to a structure containing information about a specific + host Api. + + @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) + + @return A pointer to an immutable PaHostApiInfo structure describing + a specific host API. If the hostApi parameter is out of range or an error + is encountered, the function returns NULL. + + The returned structure is owned by the PortAudio implementation and must not + be manipulated or freed. The pointer is only guaranteed to be valid between + calls to Pa_Initialize() and Pa_Terminate(). +*} +function Pa_GetHostApiInfo( hostApi: TPaHostApiIndex ): PPaHostApiInfo; cdecl; external LibName; + + +{** Convert a static host API unique identifier, into a runtime + host API index. + + @param type A unique host API identifier belonging to the PaHostApiTypeId + enumeration. + + @return A valid PaHostApiIndex ranging from 0 to (Pa_GetHostApiCount()-1) or, + a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + The paHostApiNotFound error code indicates that the host API specified by the + type parameter is not available. + + @see PaHostApiTypeId +*} +function Pa_HostApiTypeIdToHostApiIndex( _type: TPaHostApiTypeId ): TPaHostApiIndex; cdecl; external LibName; + + +{** Convert a host-API-specific device index to standard PortAudio device index. + This function may be used in conjunction with the deviceCount field of + PaHostApiInfo to enumerate all devices for the specified host API. + + @param hostApi A valid host API index ranging from 0 to (Pa_GetHostApiCount()-1) + + @param hostApiDeviceIndex A valid per-host device index in the range + 0 to (Pa_GetHostApiInfo(hostApi)->deviceCount-1) + + @return A non-negative PaDeviceIndex ranging from 0 to (Pa_GetDeviceCount()-1) + or, a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. + + A paInvalidHostApi error code indicates that the host API index specified by + the hostApi parameter is out of range. + + A paInvalidDevice error code indicates that the hostApiDeviceIndex parameter + is out of range. + + @see PaHostApiInfo +*} +function Pa_HostApiDeviceIndexToDeviceIndex( hostApi: TPaHostApiIndex; + hostApiDeviceIndex: cint ): TPaDeviceIndex; cdecl; external LibName; + + + +{** Structure used to return information about a host error condition. +*} +type + PPaHostErrorInfo = ^TPaHostErrorInfo; + TPaHostErrorInfo = record + hostApiType: TPaHostApiTypeId; {**< the host API which returned the error code *} + errorCode: clong; {**< the error code returned *} + errorText: PChar; {**< a textual description of the error if available, otherwise a zero-length string *} + end; + + +{** Return information about the last host error encountered. The error + information returned by Pa_GetLastHostErrorInfo() will never be modified + asyncronously by errors occurring in other PortAudio owned threads + (such as the thread that manages the stream callback.) + + This function is provided as a last resort, primarily to enhance debugging + by providing clients with access to all available error information. + + @return A pointer to an immutable structure constaining information about + the host error. The values in this structure will only be valid if a + PortAudio function has previously returned the paUnanticipatedHostError + error code. +*} +function Pa_GetLastHostErrorInfo(): PPaHostErrorInfo; cdecl; external LibName; + + + +{* Device enumeration and capabilities *} + +{** Retrieve the number of available devices. The number of available devices + may be zero. + + @return A non-negative value indicating the number of available devices or, + a PaErrorCode (which are always negative) if PortAudio is not initialized + or an error is encountered. +*} +function Pa_GetDeviceCount(): TPaDeviceIndex; cdecl; external LibName; + + +{** Retrieve the index of the default input device. The result can be + used in the inputDevice parameter to Pa_OpenStream(). + + @return The default input device index for the default host API, or paNoDevice + if no default input device is available or an error was encountered. +*} +function Pa_GetDefaultInputDevice(): TPaDeviceIndex; cdecl; external LibName; + + +{** Retrieve the index of the default output device. The result can be + used in the outputDevice parameter to Pa_OpenStream(). + + @return The default output device index for the defualt host API, or paNoDevice + if no default output device is available or an error was encountered. + + @note + On the PC, the user can specify a default device by + setting an environment variable. For example, to use device #1. +
+ set PA_RECOMMENDED_OUTPUT_DEVICE=1
+
+ The user should first determine the available device ids by using + the supplied application "pa_devs". +*} +function Pa_GetDefaultOutputDevice(): TPaDeviceIndex; cdecl; external LibName; + + +{** The type used to represent monotonic time in seconds that can be used + for syncronisation. The type is used for the outTime argument to the + PaStreamCallback and as the result of Pa_GetStreamTime(). + + @see PaStreamCallback, Pa_GetStreamTime +*} +type TPaTime = cdouble; + + +{** A type used to specify one or more sample formats. Each value indicates + a possible format for sound data passed to and from the stream callback, + Pa_ReadStream and Pa_WriteStream. + + The standard formats paFloat32, paInt16, paInt32, paInt24, paInt8 + and aUInt8 are usually implemented by all implementations. + + The floating point representation (paFloat32) uses +1.0 and -1.0 as the + maximum and minimum respectively. + + paUInt8 is an unsigned 8 bit format where 128 is considered "ground" + + The paNonInterleaved flag indicates that a multichannel buffer is passed + as a set of non-interleaved pointers. + + @see Pa_OpenStream, Pa_OpenDefaultStream, PaDeviceInfo + @see paFloat32, paInt16, paInt32, paInt24, paInt8 + @see paUInt8, paCustomFormat, paNonInterleaved +*} +type TPaSampleFormat = culong; +const + paFloat32 = TPaSampleFormat($00000001); {**< @see PaSampleFormat *} + paInt32 = TPaSampleFormat($00000002); {**< @see PaSampleFormat *} + paInt24 = TPaSampleFormat($00000004); {**< Packed 24 bit format. @see PaSampleFormat *} + paInt16 = TPaSampleFormat($00000008); {**< @see PaSampleFormat *} + paInt8 = TPaSampleFormat($00000010); {**< @see PaSampleFormat *} + paUInt8 = TPaSampleFormat($00000020); {**< @see PaSampleFormat *} + paCustomFormat = TPaSampleFormat($00010000); {**< @see PaSampleFormat *} + paNonInterleaved = TPaSampleFormat($80000000); + +{** A structure providing information and capabilities of PortAudio devices. + Devices may support input, output or both input and output. +*} +type + PPaDeviceInfo = ^TPaDeviceInfo; + TPaDeviceInfo = record + structVersion: cint; {* this is struct version 2 *} + name: PChar; + hostApi: TPaHostApiIndex; {* note this is a host API index, not a type id*} + + maxInputChannels: cint; + maxOutputChannels: cint; + + {* Default latency values for interactive performance. *} + defaultLowInputLatency: TPaTime; + defaultLowOutputLatency: TPaTime; + {* Default latency values for robust non-interactive applications (eg. playing sound files). *} + defaultHighInputLatency: TPaTime; + defaultHighOutputLatency: TPaTime; + + defaultSampleRate: cdouble; + end; + + +{** Retrieve a pointer to a PaDeviceInfo structure containing information + about the specified device. + @return A pointer to an immutable PaDeviceInfo structure. If the device + parameter is out of range the function returns NULL. + + @param device A valid device index in the range 0 to (Pa_GetDeviceCount()-1) + + @note PortAudio manages the memory referenced by the returned pointer, + the client must not manipulate or free the memory. The pointer is only + guaranteed to be valid between calls to Pa_Initialize() and Pa_Terminate(). + + @see PaDeviceInfo, PaDeviceIndex +*} +function Pa_GetDeviceInfo( device: TPaDeviceIndex ): PPaDeviceInfo; cdecl; external LibName; + + +{** Parameters for one direction (input or output) of a stream. +*} +type + PPaStreamParameters = ^TPaStreamParameters; + TPaStreamParameters = record + {** A valid device index in the range 0 to (Pa_GetDeviceCount()-1) + specifying the device to be used or the special constant + paUseHostApiSpecificDeviceSpecification which indicates that the actual + device(s) to use are specified in hostApiSpecificStreamInfo. + This field must not be set to paNoDevice. + *} + device: TPaDeviceIndex; + + {** The number of channels of sound to be delivered to the + stream callback or accessed by Pa_ReadStream() or Pa_WriteStream(). + It can range from 1 to the value of maxInputChannels in the + PaDeviceInfo record for the device specified by the device parameter. + *} + channelCount: cint; + + {** The sample format of the buffer provided to the stream callback, + a_ReadStream() or Pa_WriteStream(). It may be any of the formats described + by the PaSampleFormat enumeration. + *} + sampleFormat: TPaSampleFormat; + + {** The desired latency in seconds. Where practical, implementations should + configure their latency based on these parameters, otherwise they may + choose the closest viable latency instead. Unless the suggested latency + is greater than the absolute upper limit for the device implementations + should round the suggestedLatency up to the next practial value - ie to + provide an equal or higher latency than suggestedLatency wherever possibe. + Actual latency values for an open stream may be retrieved using the + inputLatency and outputLatency fields of the PaStreamInfo structure + returned by Pa_GetStreamInfo(). + @see default*Latency in PaDeviceInfo, *Latency in PaStreamInfo + *} + suggestedLatency: TPaTime; + + {** An optional pointer to a host api specific data structure + containing additional information for device setup and/or stream processing. + hostApiSpecificStreamInfo is never required for correct operation, + if not used it should be set to NULL. + *} + hostApiSpecificStreamInfo: Pointer; + end; + + +{** Return code for Pa_IsFormatSupported indicating success. *} +const paFormatIsSupported = (0); + +{** Determine whether it would be possible to open a stream with the specified + parameters. + + @param inputParameters A structure that describes the input parameters used to + open a stream. The suggestedLatency field is ignored. See PaStreamParameters + for a description of these parameters. inputParameters must be NULL for + output-only streams. + + @param outputParameters A structure that describes the output parameters used + to open a stream. The suggestedLatency field is ignored. See PaStreamParameters + for a description of these parameters. outputParameters must be NULL for + input-only streams. + + @param sampleRate The required sampleRate. For full-duplex streams it is the + sample rate for both input and output + + @return Returns 0 if the format is supported, and an error code indicating why + the format is not supported otherwise. The constant paFormatIsSupported is + provided to compare with the return value for success. + + @see paFormatIsSupported, PaStreamParameters +*} +function Pa_IsFormatSupported( inputParameters: PPaStreamParameters; + outputParameters: PPaStreamParameters; + sampleRate: cdouble ): TPaError; cdecl; external LibName; + + + +{* Streaming types and functions *} + + +{** + A single PaStream can provide multiple channels of real-time + streaming audio input and output to a client application. A stream + provides access to audio hardware represented by one or more + PaDevices. Depending on the underlying Host API, it may be possible + to open multiple streams using the same device, however this behavior + is implementation defined. Portable applications should assume that + a PaDevice may be simultaneously used by at most one PaStream. + + Pointers to PaStream objects are passed between PortAudio functions that + operate on streams. + + @see Pa_OpenStream, Pa_OpenDefaultStream, Pa_OpenDefaultStream, Pa_CloseStream, + Pa_StartStream, Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive, + Pa_GetStreamTime, Pa_GetStreamCpuLoad + +*} +type + PPaStream = Pointer; + +{** Can be passed as the framesPerBuffer parameter to Pa_OpenStream() + or Pa_OpenDefaultStream() to indicate that the stream callback will + accept buffers of any size. +*} +const paFramesPerBufferUnspecified = (0); + + +{** Flags used to control the behavior of a stream. They are passed as + parameters to Pa_OpenStream or Pa_OpenDefaultStream. Multiple flags may be + ORed together. + + @see Pa_OpenStream, Pa_OpenDefaultStream + @see paNoFlag, paClipOff, paDitherOff, paNeverDropInput, + paPrimeOutputBuffersUsingStreamCallback, paPlatformSpecificFlags +*} +type TPaStreamFlags = culong; + +{** @see PaStreamFlags *} +const paNoFlag = TPaStreamFlags(0); + +{** Disable default clipping of out of range samples. + @see PaStreamFlags +*} +const paClipOff = TPaStreamFlags($00000001); + +{** Disable default dithering. + @see PaStreamFlags +*} +const paDitherOff = TPaStreamFlags($00000002); + +{** Flag requests that where possible a full duplex stream will not discard + overflowed input samples without calling the stream callback. This flag is + only valid for full duplex callback streams and only when used in combination + with the paFramesPerBufferUnspecified (0) framesPerBuffer parameter. Using + this flag incorrectly results in a paInvalidFlag error being returned from + Pa_OpenStream and Pa_OpenDefaultStream. + + @see PaStreamFlags, paFramesPerBufferUnspecified +*} +const paNeverDropInput = TPaStreamFlags($00000004); + +{** Call the stream callback to fill initial output buffers, rather than the + default behavior of priming the buffers with zeros (silence). This flag has + no effect for input-only and blocking read/write streams. + + @see PaStreamFlags +*} +const paPrimeOutputBuffersUsingStreamCallback = TPaStreamFlags($00000008); + +{** A mask specifying the platform specific bits. + @see PaStreamFlags +*} +const paPlatformSpecificFlags = TPaStreamFlags($FFFF0000); + +{** + Timing information for the buffers passed to the stream callback. +*} +type + PPaStreamCallbackTimeInfo = ^TPaStreamCallbackTimeInfo; + TPaStreamCallbackTimeInfo = record + inputBufferAdcTime: TPaTime; + currentTime: TPaTime; + outputBufferDacTime: TPaTime; + end; + + +{** + Flag bit constants for the statusFlags to PaStreamCallback. + + @see paInputUnderflow, paInputOverflow, paOutputUnderflow, paOutputOverflow, + paPrimingOutput +*} +type TPaStreamCallbackFlags = culong; + +{** In a stream opened with paFramesPerBufferUnspecified, indicates that + input data is all silence (zeros) because no real data is available. In a + stream opened without paFramesPerBufferUnspecified, it indicates that one or + more zero samples have been inserted into the input buffer to compensate + for an input underflow. + @see PaStreamCallbackFlags +*} +const paInputUnderflow = TPaStreamCallbackFlags($00000001); + +{** In a stream opened with paFramesPerBufferUnspecified, indicates that data + prior to the first sample of the input buffer was discarded due to an + overflow, possibly because the stream callback is using too much CPU time. + Otherwise indicates that data prior to one or more samples in the + input buffer was discarded. + @see PaStreamCallbackFlags +*} +const paInputOverflow = TPaStreamCallbackFlags($00000002); + +{** Indicates that output data (or a gap) was inserted, possibly because the + stream callback is using too much CPU time. + @see PaStreamCallbackFlags +*} +const paOutputUnderflow = TPaStreamCallbackFlags($00000004); + +{** Indicates that output data will be discarded because no room is available. + @see PaStreamCallbackFlags +*} +const paOutputOverflow = TPaStreamCallbackFlags($00000008); + +{** Some of all of the output data will be used to prime the stream, input + data may be zero. + @see PaStreamCallbackFlags +*} +const paPrimingOutput = TPaStreamCallbackFlags($00000010); + +{** + Allowable return values for the PaStreamCallback. + @see PaStreamCallback +*} +type TPaStreamCallbackResult = {enum}cint; const +{enum_begin PaStreamCallbackResult} + paContinue=0; + paComplete=1; + paAbort=2; +{enum_end PaStreamCallbackResult} + +{** + Functions of type PaStreamCallback are implemented by PortAudio clients. + They consume, process or generate audio in response to requests from an + active PortAudio stream. + + @param input and @param output are arrays of interleaved samples, + the format, packing and number of channels used by the buffers are + determined by parameters to Pa_OpenStream(). + + @param frameCount The number of sample frames to be processed by + the stream callback. + + @param timeInfo The time in seconds when the first sample of the input + buffer was received at the audio input, the time in seconds when the first + sample of the output buffer will begin being played at the audio output, and + the time in seconds when the stream callback was called. + See also Pa_GetStreamTime() + + @param statusFlags Flags indicating whether input and/or output buffers + have been inserted or will be dropped to overcome underflow or overflow + conditions. + + @param userData The value of a user supplied pointer passed to + Pa_OpenStream() intended for storing synthesis data etc. + + @return + The stream callback should return one of the values in the + PaStreamCallbackResult enumeration. To ensure that the callback continues + to be called, it should return paContinue (0). Either paComplete or paAbort + can be returned to finish stream processing, after either of these values is + returned the callback will not be called again. If paAbort is returned the + stream will finish as soon as possible. If paComplete is returned, the stream + will continue until all buffers generated by the callback have been played. + This may be useful in applications such as soundfile players where a specific + duration of output is required. However, it is not necessary to utilise this + mechanism as Pa_StopStream(), Pa_AbortStream() or Pa_CloseStream() can also + be used to stop the stream. The callback must always fill the entire output + buffer irrespective of its return value. + + @see Pa_OpenStream, Pa_OpenDefaultStream + + @note With the exception of Pa_GetStreamCpuLoad() it is not permissable to call + PortAudio API functions from within the stream callback. +*} +type + PPaStreamCallback = ^TPaStreamCallback; + TPaStreamCallback = function( + input: Pointer; output: Pointer; + frameCount: culong; + timeInfo: PPaStreamCallbackTimeInfo; + statusFlags: TPaStreamCallbackFlags; + userData: Pointer ): cint; cdecl; + + +{** Opens a stream for either input, output or both. + + @param stream The address of a PaStream pointer which will receive + a pointer to the newly opened stream. + + @param inputParameters A structure that describes the input parameters used by + the opened stream. See PaStreamParameters for a description of these parameters. + inputParameters must be NULL for output-only streams. + + @param outputParameters A structure that describes the output parameters used by + the opened stream. See PaStreamParameters for a description of these parameters. + outputParameters must be NULL for input-only streams. + + @param sampleRate The desired sampleRate. For full-duplex streams it is the + sample rate for both input and output + + @param framesPerBuffer The number of frames passed to the stream callback + function, or the preferred block granularity for a blocking read/write stream. + The special value paFramesPerBufferUnspecified (0) may be used to request that + the stream callback will recieve an optimal (and possibly varying) number of + frames based on host requirements and the requested latency settings. + Note: With some host APIs, the use of non-zero framesPerBuffer for a callback + stream may introduce an additional layer of buffering which could introduce + additional latency. PortAudio guarantees that the additional latency + will be kept to the theoretical minimum however, it is strongly recommended + that a non-zero framesPerBuffer value only be used when your algorithm + requires a fixed number of frames per stream callback. + + @param streamFlags Flags which modify the behaviour of the streaming process. + This parameter may contain a combination of flags ORed together. Some flags may + only be relevant to certain buffer formats. + + @param streamCallback A pointer to a client supplied function that is responsible + for processing and filling input and output buffers. If this parameter is NULL + the stream will be opened in 'blocking read/write' mode. In blocking mode, + the client can receive sample data using Pa_ReadStream and write sample data + using Pa_WriteStream, the number of samples that may be read or written + without blocking is returned by Pa_GetStreamReadAvailable and + Pa_GetStreamWriteAvailable respectively. + + @param userData A client supplied pointer which is passed to the stream callback + function. It could for example, contain a pointer to instance data necessary + for processing the audio buffers. This parameter is ignored if streamCallback + is NULL. + + @return + Upon success Pa_OpenStream() returns paNoError and places a pointer to a + valid PaStream in the stream argument. The stream is inactive (stopped). + If a call to Pa_OpenStream() fails, a non-zero error code is returned (see + PaError for possible error codes) and the value of stream is invalid. + + @see PaStreamParameters, PaStreamCallback, Pa_ReadStream, Pa_WriteStream, + Pa_GetStreamReadAvailable, Pa_GetStreamWriteAvailable +*} +function Pa_OpenStream( var stream: PPaStream; + inputParameters: PPaStreamParameters; + outputParameters: PPaStreamParameters; + sampleRate: cdouble; + framesPerBuffer: culong; + streamFlags: TPaStreamFlags; + streamCallback: PPaStreamCallback; + userData: Pointer ): TPaError; cdecl; external LibName; + + +{** A simplified version of Pa_OpenStream() that opens the default input + and/or output devices. + + @param stream The address of a PaStream pointer which will receive + a pointer to the newly opened stream. + + @param numInputChannels The number of channels of sound that will be supplied + to the stream callback or returned by Pa_ReadStream. It can range from 1 to + the value of maxInputChannels in the PaDeviceInfo record for the default input + device. If 0 the stream is opened as an output-only stream. + + @param numOutputChannels The number of channels of sound to be delivered to the + stream callback or passed to Pa_WriteStream. It can range from 1 to the value + of maxOutputChannels in the PaDeviceInfo record for the default output dvice. + If 0 the stream is opened as an output-only stream. + + @param sampleFormat The sample format of both the input and output buffers + provided to the callback or passed to and from Pa_ReadStream and Pa_WriteStream. + sampleFormat may be any of the formats described by the PaSampleFormat + enumeration. + + @param sampleRate Same as Pa_OpenStream parameter of the same name. + @param framesPerBuffer Same as Pa_OpenStream parameter of the same name. + @param streamCallback Same as Pa_OpenStream parameter of the same name. + @param userData Same as Pa_OpenStream parameter of the same name. + + @return As for Pa_OpenStream + + @see Pa_OpenStream, PaStreamCallback +*} +function Pa_OpenDefaultStream( var stream: PPaStream; + numInputChannels: cint; + numOutputChannels: cint; + sampleFormat: TPaSampleFormat; + sampleRate: cdouble; + framesPerBuffer: culong; + streamCallback: PPaStreamCallback; + userData: Pointer ): TPaError; cdecl; external LibName; + + +{** Closes an audio stream. If the audio stream is active it + discards any pending buffers as if Pa_AbortStream() had been called. +*} +function Pa_CloseStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Functions of type PaStreamFinishedCallback are implemented by PortAudio + clients. They can be registered with a stream using the Pa_SetStreamFinishedCallback + function. Once registered they are called when the stream becomes inactive + (ie once a call to Pa_StopStream() will not block). + A stream will become inactive after the stream callback returns non-zero, + or when Pa_StopStream or Pa_AbortStream is called. For a stream providing audio + output, if the stream callback returns paComplete, or Pa_StopStream is called, + the stream finished callback will not be called until all generated sample data + has been played. + + @param userData The userData parameter supplied to Pa_OpenStream() + + @see Pa_SetStreamFinishedCallback +*} +type + PPaStreamFinishedCallback = ^TPaStreamFinishedCallback; + TPaStreamFinishedCallback = procedure( userData: Pointer ); cdecl; + + +{** Register a stream finished callback function which will be called when the + stream becomes inactive. See the description of PaStreamFinishedCallback for + further details about when the callback will be called. + + @param stream a pointer to a PaStream that is in the stopped state - if the + stream is not stopped, the stream's finished callback will remain unchanged + and an error code will be returned. + + @param streamFinishedCallback a pointer to a function with the same signature + as PaStreamFinishedCallback, that will be called when the stream becomes + inactive. Passing NULL for this parameter will un-register a previously + registered stream finished callback function. + + @return on success returns paNoError, otherwise an error code indicating the cause + of the error. + + @see PaStreamFinishedCallback +*} +function Pa_SetStreamFinishedCallback( stream: PPaStream; + streamFinishedCallback: PPaStreamFinishedCallback ): TPaError; cdecl; external LibName; + + +{** Commences audio processing. +*} +function Pa_StartStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Terminates audio processing. It waits until all pending + audio buffers have been played before it returns. +*} +function Pa_StopStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Terminates audio processing immediately without waiting for pending + buffers to complete. +*} +function Pa_AbortStream( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Determine whether the stream is stopped. + A stream is considered to be stopped prior to a successful call to + Pa_StartStream and after a successful call to Pa_StopStream or Pa_AbortStream. + If a stream callback returns a value other than paContinue the stream is NOT + considered to be stopped. + + @return Returns one (1) when the stream is stopped, zero (0) when + the stream is running or, a PaErrorCode (which are always negative) if + PortAudio is not initialized or an error is encountered. + + @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamActive +*} +function Pa_IsStreamStopped( stream: PPaStream ): TPaError; cdecl; external LibName; + + +{** Determine whether the stream is active. + A stream is active after a successful call to Pa_StartStream(), until it + becomes inactive either as a result of a call to Pa_StopStream() or + Pa_AbortStream(), or as a result of a return value other than paContinue from + the stream callback. In the latter case, the stream is considered inactive + after the last buffer has finished playing. + + @return Returns one (1) when the stream is active (ie playing or recording + audio), zero (0) when not playing or, a PaErrorCode (which are always negative) + if PortAudio is not initialized or an error is encountered. + + @see Pa_StopStream, Pa_AbortStream, Pa_IsStreamStopped +*} +function Pa_IsStreamActive( stream: PPaStream ): TPaError; cdecl; external LibName; + + + +{** A structure containing unchanging information about an open stream. + @see Pa_GetStreamInfo +*} +type + PPaStreamInfo = ^TPaStreamInfo; + TPaStreamInfo = record + {** this is struct version 1 *} + structVersion: cint; + + {** The input latency of the stream in seconds. This value provides the most + accurate estimate of input latency available to the implementation. It may + differ significantly from the suggestedLatency value passed to Pa_OpenStream(). + The value of this field will be zero (0.) for output-only streams. + @see PaTime + *} + inputLatency: TPaTime; + + {** The output latency of the stream in seconds. This value provides the most + accurate estimate of output latency available to the implementation. It may + differ significantly from the suggestedLatency value passed to Pa_OpenStream(). + The value of this field will be zero (0.) for input-only streams. + @see PaTime + *} + outputLatency: TPaTime; + + {** The sample rate of the stream in Hertz (samples per second). In cases + where the hardware sample rate is inaccurate and PortAudio is aware of it, + the value of this field may be different from the sampleRate parameter + passed to Pa_OpenStream(). If information about the actual hardware sample + rate is not available, this field will have the same value as the sampleRate + parameter passed to Pa_OpenStream(). + *} + sampleRate: cdouble; + end; + + +{** Retrieve a pointer to a PaStreamInfo structure containing information + about the specified stream. + @return A pointer to an immutable PaStreamInfo structure. If the stream + parameter invalid, or an error is encountered, the function returns NULL. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @note PortAudio manages the memory referenced by the returned pointer, + the client must not manipulate or free the memory. The pointer is only + guaranteed to be valid until the specified stream is closed. + + @see PaStreamInfo +*} +function Pa_GetStreamInfo( stream: PPaStream ): PPaStreamInfo; cdecl; external LibName; + + +{** Determine the current time for the stream according to the same clock used + to generate buffer timestamps. This time may be used for syncronising other + events to the audio stream, for example synchronizing audio to MIDI. + + @return The stream's current time in seconds, or 0 if an error occurred. + + @see PaTime, PaStreamCallback +*} +function Pa_GetStreamTime( stream: PPaStream ): TPaTime; cdecl; external LibName; + + +{** Retrieve CPU usage information for the specified stream. + The "CPU Load" is a fraction of total CPU time consumed by a callback stream's + audio processing routines including, but not limited to the client supplied + stream callback. This function does not work with blocking read/write streams. + + This function may be called from the stream callback function or the + application. + + @return + A floating point value, typically between 0.0 and 1.0, where 1.0 indicates + that the stream callback is consuming the maximum number of CPU cycles possible + to maintain real-time operation. A value of 0.5 would imply that PortAudio and + the stream callback was consuming roughly 50% of the available CPU time. The + return value may exceed 1.0. A value of 0.0 will always be returned for a + blocking read/write stream, or if an error occurrs. +*} +function Pa_GetStreamCpuLoad( stream: PPaStream ): cdouble; cdecl; external LibName; + + +{** Read samples from an input stream. The function doesn't return until + the entire buffer has been filled - this may involve waiting for the operating + system to supply the data. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @param buffer A pointer to a buffer of sample frames. The buffer contains + samples in the format specified by the inputParameters->sampleFormat field + used to open the stream, and the number of channels specified by + inputParameters->numChannels. If non-interleaved samples were requested, + buffer is a pointer to the first element of an array of non-interleaved + buffer pointers, one for each channel. + + @param frames The number of frames to be read into buffer. This parameter + is not constrained to a specific range, however high performance applications + will want to match this parameter to the framesPerBuffer parameter used + when opening the stream. + + @return On success PaNoError will be returned, or PaInputOverflowed if input + data was discarded by PortAudio after the previous call and before this call. +*} +function Pa_ReadStream( stream: PPaStream; + buffer: Pointer; + frames: culong ): TPaError; cdecl; external LibName; + + +{** Write samples to an output stream. This function doesn't return until the + entire buffer has been consumed - this may involve waiting for the operating + system to consume the data. + + @param stream A pointer to an open stream previously created with Pa_OpenStream. + + @param buffer A pointer to a buffer of sample frames. The buffer contains + samples in the format specified by the outputParameters->sampleFormat field + used to open the stream, and the number of channels specified by + outputParameters->numChannels. If non-interleaved samples were requested, + buffer is a pointer to the first element of an array of non-interleaved + buffer pointers, one for each channel. + + @param frames The number of frames to be written from buffer. This parameter + is not constrained to a specific range, however high performance applications + will want to match this parameter to the framesPerBuffer parameter used + when opening the stream. + + @return On success PaNoError will be returned, or paOutputUnderflowed if + additional output data was inserted after the previous call and before this + call. +*} +function Pa_WriteStream( stream: PPaStream; + buffer: Pointer; + frames: culong ): TPaError; cdecl; external LibName; + + +{** Retrieve the number of frames that can be read from the stream without + waiting. + + @return Returns a non-negative value representing the maximum number of frames + that can be read from the stream without blocking or busy waiting or, a + PaErrorCode (which are always negative) if PortAudio is not initialized or an + error is encountered. +*} +function Pa_GetStreamReadAvailable( stream: PPaStream ): cslong; cdecl; external LibName; + + +{** Retrieve the number of frames that can be written to the stream without + waiting. + + @return Returns a non-negative value representing the maximum number of frames + that can be written to the stream without blocking or busy waiting or, a + PaErrorCode (which are always negative) if PortAudio is not initialized or an + error is encountered. +*} +function Pa_GetStreamWriteAvailable( stream: PPaStream ): cslong; cdecl; external LibName; + + +{** Retrieve the host type handling an open stream. + + @return Returns a non-negative value representing the host API type + handling an open stream or, a PaErrorCode (which are always negative) + if PortAudio is not initialized or an error is encountered. +*} +function Pa_GetStreamHostApiType( stream: PPaStream ): TPaHostApiTypeId; cdecl; external LibName; + + +{* Miscellaneous utilities *} + + +{** Retrieve the size of a given sample format in bytes. + + @return The size in bytes of a single sample in the specified format, + or paSampleFormatNotSupported if the format is not supported. +*} +function Pa_GetSampleSize( format: TPaSampleFormat ): TPaError; cdecl; external LibName; + + +{** Put the caller to sleep for at least 'msec' milliseconds. This function is + provided only as a convenience for authors of portable code (such as the tests + and examples in the PortAudio distribution.) + + The function may sleep longer than requested so don't rely on this for accurate + musical timing. +*} +procedure Pa_Sleep( msec: clong ); cdecl; external LibName; + +implementation + +end. diff --git a/src/lib/portmixer/delphi/portmixer.pas b/src/lib/portmixer/delphi/portmixer.pas deleted file mode 100644 index d657cf85..00000000 --- a/src/lib/portmixer/delphi/portmixer.pas +++ /dev/null @@ -1,151 +0,0 @@ -{* - * PortMixer - * PortMixer API Header File - * - * Copyright (c) 2002, 2006 - * - * Written by Dominic Mazzoni - * and Leland Lucius - * - * PortMixer is intended to work side-by-side with PortAudio, - * the Portable Real-Time Audio Library by Ross Bencina and - * Phil Burk. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files - * (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, - * publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * Any person wishing to distribute modifications to the Software is - * requested to send the modifications to the original developer so that - * they can be incorporated into the canonical version. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *} -unit portmixer; - -{$IFDEF FPC} - {$PACKRECORDS C} (* GCC/Visual C/C++ compatible record packing *) - {$MODE DELPHI } -{$ENDIF} - -interface - -uses - ctypes, - portaudio; - -const -{$IFDEF MSWINDOWS} - LibName = 'portmixer.dll'; -{$ENDIF} -{$IFDEF LINUX} - LibName = 'libportmixer.so'; -{$ENDIF} -{$IFDEF DARWIN} -// LibName = 'libportmixer.dylib'; -// {$LINKLIB libportaudio} -{$ENDIF} - -type - PPxMixer = Pointer; - TPxVolume = cfloat; {* 0.0 (min) --> 1.0 (max) *} - TPxBalance = cfloat; {* -1.0 (left) --> 1.0 (right) *} - -{* - Px_OpenMixer() returns a mixer which will work with the given PortAudio - audio device. Pass 0 as the index for the first (default) mixer. -*} - -function Px_OpenMixer( pa_stream: Pointer; i: cint ): PPxMixer; cdecl; external LibName; - -{* - Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any - memory associated with it. -*} - -procedure Px_CloseMixer( mixer: PPxMixer ); cdecl; external LibName; - -{* - Px_GetNumMixers returns the number of mixers which could be - used with the given PortAudio device. On most systems, there - will be only one mixer for each device; however there may be - multiple mixers for each device, or possibly multiple mixers - which are independent of any particular PortAudio device. -*} - -function Px_GetNumMixers( mixer: PPxMixer ): cint; cdecl; external LibName; -function Px_GetMixerName( mixer: PPxMixer; i: cint ): PChar; cdecl; external LibName; - -{* - Master (output) volume -*} - -function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; -procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; - -{* - Main output volume -*} - -function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; -procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; -function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): cint; cdecl; external LibName; - -{* - All output volumes -*} - -function Px_GetNumOutputVolumes( mixer: PPxMixer ): cint; cdecl; external LibName; -function Px_GetOutputVolumeName( mixer: PPxMixer; i: cint ): PChar; cdecl; external LibName; -function Px_GetOutputVolume( mixer: PPxMixer; i: cint ): TPxVolume; cdecl; external LibName; -procedure Px_SetOutputVolume( mixer: PPxMixer; i: cint; volume: TPxVolume ); cdecl; external LibName; - -{* - Input source -*} - -function Px_GetNumInputSources( mixer: PPxMixer ): cint; cdecl; external LibName; -function Px_GetInputSourceName( mixer: PPxMixer; i: cint): PChar; cdecl; external LibName; -function Px_GetCurrentInputSource( mixer: PPxMixer ): cint; cdecl; external LibName; {* may return -1 == none *} -procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: cint ); cdecl; external LibName; - -{* - Input volume -*} - -function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; -procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; - -{* - Balance -*} - -function Px_SupportsOutputBalance( mixer: PPxMixer ): cint; cdecl; external LibName; -function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl; external LibName; -procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl; external LibName; - -{* - Playthrough -*} - -function Px_SupportsPlaythrough( mixer: PPxMixer ): cint; cdecl; external LibName; -function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; -procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; - -implementation - -end. diff --git a/src/lib/portmixer/portmixer.pas b/src/lib/portmixer/portmixer.pas new file mode 100644 index 00000000..d657cf85 --- /dev/null +++ b/src/lib/portmixer/portmixer.pas @@ -0,0 +1,151 @@ +{* + * PortMixer + * PortMixer API Header File + * + * Copyright (c) 2002, 2006 + * + * Written by Dominic Mazzoni + * and Leland Lucius + * + * PortMixer is intended to work side-by-side with PortAudio, + * the Portable Real-Time Audio Library by Ross Bencina and + * Phil Burk. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files + * (the "Software"), to deal in the Software without restriction, + * including without limitation the rights to use, copy, modify, merge, + * publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * Any person wishing to distribute modifications to the Software is + * requested to send the modifications to the original developer so that + * they can be incorporated into the canonical version. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *} +unit portmixer; + +{$IFDEF FPC} + {$PACKRECORDS C} (* GCC/Visual C/C++ compatible record packing *) + {$MODE DELPHI } +{$ENDIF} + +interface + +uses + ctypes, + portaudio; + +const +{$IFDEF MSWINDOWS} + LibName = 'portmixer.dll'; +{$ENDIF} +{$IFDEF LINUX} + LibName = 'libportmixer.so'; +{$ENDIF} +{$IFDEF DARWIN} +// LibName = 'libportmixer.dylib'; +// {$LINKLIB libportaudio} +{$ENDIF} + +type + PPxMixer = Pointer; + TPxVolume = cfloat; {* 0.0 (min) --> 1.0 (max) *} + TPxBalance = cfloat; {* -1.0 (left) --> 1.0 (right) *} + +{* + Px_OpenMixer() returns a mixer which will work with the given PortAudio + audio device. Pass 0 as the index for the first (default) mixer. +*} + +function Px_OpenMixer( pa_stream: Pointer; i: cint ): PPxMixer; cdecl; external LibName; + +{* + Px_CloseMixer() closes a mixer opened using Px_OpenMixer and frees any + memory associated with it. +*} + +procedure Px_CloseMixer( mixer: PPxMixer ); cdecl; external LibName; + +{* + Px_GetNumMixers returns the number of mixers which could be + used with the given PortAudio device. On most systems, there + will be only one mixer for each device; however there may be + multiple mixers for each device, or possibly multiple mixers + which are independent of any particular PortAudio device. +*} + +function Px_GetNumMixers( mixer: PPxMixer ): cint; cdecl; external LibName; +function Px_GetMixerName( mixer: PPxMixer; i: cint ): PChar; cdecl; external LibName; + +{* + Master (output) volume +*} + +function Px_GetMasterVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetMasterVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +{* + Main output volume +*} + +function Px_GetPCMOutputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetPCMOutputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; +function Px_SupportsPCMOutputVolume( mixer: PPxMixer ): cint; cdecl; external LibName; + +{* + All output volumes +*} + +function Px_GetNumOutputVolumes( mixer: PPxMixer ): cint; cdecl; external LibName; +function Px_GetOutputVolumeName( mixer: PPxMixer; i: cint ): PChar; cdecl; external LibName; +function Px_GetOutputVolume( mixer: PPxMixer; i: cint ): TPxVolume; cdecl; external LibName; +procedure Px_SetOutputVolume( mixer: PPxMixer; i: cint; volume: TPxVolume ); cdecl; external LibName; + +{* + Input source +*} + +function Px_GetNumInputSources( mixer: PPxMixer ): cint; cdecl; external LibName; +function Px_GetInputSourceName( mixer: PPxMixer; i: cint): PChar; cdecl; external LibName; +function Px_GetCurrentInputSource( mixer: PPxMixer ): cint; cdecl; external LibName; {* may return -1 == none *} +procedure Px_SetCurrentInputSource( mixer: PPxMixer; i: cint ); cdecl; external LibName; + +{* + Input volume +*} + +function Px_GetInputVolume( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetInputVolume( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +{* + Balance +*} + +function Px_SupportsOutputBalance( mixer: PPxMixer ): cint; cdecl; external LibName; +function Px_GetOutputBalance( mixer: PPxMixer ): TPxBalance; cdecl; external LibName; +procedure Px_SetOutputBalance( mixer: PPxMixer; balance: TPxBalance ); cdecl; external LibName; + +{* + Playthrough +*} + +function Px_SupportsPlaythrough( mixer: PPxMixer ): cint; cdecl; external LibName; +function Px_GetPlaythrough( mixer: PPxMixer ): TPxVolume; cdecl; external LibName; +procedure Px_SetPlaythrough( mixer: PPxMixer; volume: TPxVolume ); cdecl; external LibName; + +implementation + +end. diff --git a/src/lib/projectM/cwrapper/Makefile.in b/src/lib/projectM/cwrapper/Makefile.in index d2be8613..fef3b80b 100644 --- a/src/lib/projectM/cwrapper/Makefile.in +++ b/src/lib/projectM/cwrapper/Makefile.in @@ -1,3 +1,13 @@ +################################################# +# projectM C-wrapper +# @configure_input@ +################################################# + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ + OBJECTS = projectM-cwrapper.o LIBRARY = libprojectM-cwrapper.a @@ -28,3 +38,4 @@ distclean: clean strip : strip $(LIBRARY) $(RANLIB) $(LIBRARY) + diff --git a/src/m4/ac_define_dir.m4 b/src/m4/ac_define_dir.m4 deleted file mode 100644 index f3d8734f..00000000 --- a/src/m4/ac_define_dir.m4 +++ /dev/null @@ -1,47 +0,0 @@ -##### http://autoconf-archive.cryp.to/ac_define_dir.html -# -# SYNOPSIS -# -# AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) -# -# DESCRIPTION -# -# This macro sets VARNAME to the expansion of the DIR variable, -# taking care of fixing up ${prefix} and such. -# -# VARNAME is then offered as both an output variable and a C -# preprocessor symbol. -# -# Example: -# -# AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) -# -# LAST MODIFICATION -# -# 2006-10-13 -# -# COPYLEFT -# -# Copyright (c) 2006 Stepan Kasal -# Copyright (c) 2006 Andreas Schwab -# Copyright (c) 2006 Guido U. Draheim -# Copyright (c) 2006 Alexandre Oliva -# -# Copying and distribution of this file, with or without -# modification, are permitted in any medium without royalty provided -# the copyright notice and this notice are preserved. - -AC_DEFUN([AC_DEFINE_DIR], [ - prefix_NONE= - exec_prefix_NONE= - test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix - test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix -dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn -dnl refers to ${prefix}. Thus we have to use `eval' twice. - eval ac_define_dir="\"[$]$2\"" - eval ac_define_dir="\"$ac_define_dir\"" - AC_SUBST($1, "$ac_define_dir") - AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3]) - test "$prefix_NONE" && prefix=NONE - test "$exec_prefix_NONE" && exec_prefix=NONE -]) diff --git a/src/m4/fpc.m4 b/src/m4/fpc.m4 deleted file mode 100644 index 896c53d2..00000000 --- a/src/m4/fpc.m4 +++ /dev/null @@ -1,176 +0,0 @@ -dnl ** Version 1.1 of file is part of the LGPLed -dnl ** J Sound System (http://jss.sourceforge.net) -dnl ** -dnl ** Checks for Free Pascal Compiler by Matti "ccr/TNSP" Hamalainen -dnl ** (C) Copyright 2000-2001 Tecnic Software productions (TNSP) -dnl ** -dnl ** Versions -dnl ** -------- -dnl ** 1.0 - Created -dnl ** -dnl ** 1.1 - Added stuff to enable unix -> win32 -dnl ** cross compilation. -dnl ** -dnl ** 1.x - A few fixes (by the UltraStar Deluxe Team) -dnl ** - -AC_DEFUN([AC_PROG_FPC], [ - -AC_ARG_VAR(PFLAGS, [Free Pascal Compiler flags (replaces all other flags)]) -AC_ARG_VAR(PFLAGS_DEBUG, [Free Pascal Compiler debug flags @<:@-gl -Coi -Xs- -vew -dDEBUG_MODE@:>@]) -AC_ARG_VAR(PFLAGS_RELEASE, [Free Pascal Compiler release flags @<:@-O2 -Xs -vew@:>@]) -AC_ARG_VAR(PFLAGS_EXTRA, [Free Pascal Compiler additional flags]) - -dnl set DEBUG/RELEASE flags to default-values if unset - -dnl - Do not use -dDEBUG because this will enable range-checks that will fail with USDX. -dnl - Disable -Xs which is defined in fpc.cfg (TODO: is this necessary?). -dnl - For FPC we have to use DEBUG_MODE instead of DEBUG to enable the apps debug-mode -dnl because DEBUG enables some additional compiler-flags in fpc.cfg too -PFLAGS_DEBUG=${PFLAGS_DEBUG-"-gl -Xs- -vew -dDEBUG_MODE"} -dnl -dRELEASE works too but we define our own settings -PFLAGS_RELEASE=${PFLAGS_RELEASE-"-O2 -Xs -vew"} - - -AC_ARG_ENABLE(dummy_fpc1,[ -Free Pascal Compiler specific options:]) - -AC_ARG_WITH(fpc, - [AS_HELP_STRING([--with-fpc=DIR], - [Directory of the FPC executable @<:@PATH@:>@])], - [PPC_PATH=$withval], []) - -FPC_DEBUG="no" - -AC_ARG_ENABLE(release, - [AS_HELP_STRING([--enable-release], - [Enable FPC release options @<:@default=yes@:>@])], - [test $enableval = "no" && FPC_DEBUG="yes"], []) - -AC_ARG_ENABLE(debug, - [AS_HELP_STRING([--enable-debug], - [Enable FPC debug options (= --disable-release) @<:@default=no@:>@])], - [test $enableval = "yes" && FPC_DEBUG="yes"], []) - -AC_ARG_ENABLE(profile, - [AS_HELP_STRING([--enable-profile], - [Enable FPC profiling options @<:@default=no@:>@])], - [PFLAGS_EXTRA="$PFLAGS_EXTRA -pg"], []) - - -dnl ** set PFLAGS depending on whether it is already set by the user -dnl Note: the user's PFLAGS must *follow* this script's flags -dnl to enable the user to overwrite the settings. -if test x${PFLAGS+assigned} = x; then -dnl PFLAGS not set by the user - if test x$FPC_DEBUG = xyes; then - PFLAGS="$PFLAGS_DEBUG" - PFLAGS_MAKE="[\$](PFLAGS_DEBUG)" - else - PFLAGS="$PFLAGS_RELEASE" - PFLAGS_MAKE="[\$](PFLAGS_RELEASE)" - fi -else -dnl PFLAGS set by the user, just add additional flags - PFLAGS="$PFLAGS" - PFLAGS_MAKE="$PFLAGS" -fi - -dnl ** find compiler executable - -PPC_CHECK_PROGS="fpc FPC ppc386 ppc PPC386 ppos2" - -if test -z "$PPC_PATH"; then - PPC_PATH=$PATH - AC_CHECK_PROGS(PPC, $PPC_CHECK_PROGS) - AC_CHECK_PROGS(FPCMAKE, [fpcmake]) -else - AC_PATH_PROGS(PPC, $PPC_CHECK_PROGS, [], $PPC_PATH) - AC_PATH_PROGS(FPCMAKE, [fpcmake], [], $PPC_PATH) -fi -if test -z "$PPC"; then - AC_MSG_ERROR([no Free Pascal Compiler found in $PPC_PATH]) -fi -if test -z "$FPCMAKE"; then - AC_MSG_ERROR([fpcmake not found in $PPC_PATH]) -fi - -AC_PROG_FPC_WORKS -AC_PROG_FPC_LINKS - -dnl *** Get the FPC version and some paths -FPC_VERSION=`${PPC} -iV` -FPC_PLATFORM=`${PPC} -iTO` -FPC_PROCESSOR=`${PPC} -iTP` - -if test "x$prefix" != xNONE; then - FPC_PREFIX=$prefix -else - FPC_PREFIX=$ac_default_prefix -fi -FPC_BASE_PATH="${FPC_PREFIX}/lib/fpc/${FPC_VERSION}" -FPC_UNIT_PATH="${FPC_BASE_PATH}/units/${FPC_PLATFORM}" - -AC_SUBST(PFLAGS) -AC_SUBST(PFLAGS_MAKE) -AC_SUBST(PFLAGS_EXTRA) -AC_SUBST(PFLAGS_DEBUG) -AC_SUBST(PFLAGS_RELEASE) - -AC_SUBST(FPC_VERSION) -AC_SUBST(FPC_PLATFORM) -AC_SUBST(FPC_PROCESSOR) - -AC_SUBST(FPC_PREFIX) -AC_SUBST(FPC_BASE_PATH) -AC_SUBST(FPC_UNIT_PATH) -]) - -PFLAGS_TEST="$PFLAGS $PFLAGS_EXTRA" - -dnl *** -dnl *** Check if FPC works and can compile a program -dnl *** -AC_DEFUN([AC_PROG_FPC_WORKS], -[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS_TEST) works], ac_cv_prog_ppc_works, -[ -rm -f conftest* -echo "program foo; begin writeln; end." > conftest.pp -${PPC} ${PFLAGS_TEST} conftest.pp >> config.log - -if test -f conftest || test -f conftest.exe; then -dnl *** It works! - ac_cv_prog_ppc_works="yes" - -else - ac_cv_prog_ppc_works="no" -fi -rm -f conftest* -dnl AC_MSG_RESULT($ac_cv_prog_ppc_works) -if test x$ac_cv_prog_ppc_works = xno; then - AC_MSG_ERROR([installation or configuration problem: Cannot create executables.]) -fi -])]) - - -dnl *** -dnl *** Check if FPC can link with standard libraries -dnl *** -AC_DEFUN([AC_PROG_FPC_LINKS], -[AC_CACHE_CHECK([whether the Free Pascal Compiler ($PPC $PFLAGS_TEST) can link], ac_cv_prog_ppc_works, -[ -rm -f conftest* -echo "program foo; uses crt; begin writeln; end." > conftest.pp -${PPC} ${PFLAGS_TEST} conftest.pp >> config.log -if test -f conftest || test -f conftest.exe; then - ac_cv_prog_ppc_links="yes" -else - ac_cv_prog_ppc_links="no" -fi -rm -f conftest* -AC_MSG_RESULT($ac_cv_prog_ppc_links) -if test x$ac_cv_prog_ppc_links = xno; then - AC_MSG_ERROR([installation or configuration problem: Cannot link with some standard libraries.]) -fi -])]) - diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr index 8d9f952a..d9d380ab 100644 --- a/src/ultrastardx.dpr +++ b/src/ultrastardx.dpr @@ -58,11 +58,11 @@ uses UAudioCore_Bass in 'classes\UAudioCore_Bass.pas', {$ENDIF} {$IFDEF UsePortaudio} - portaudio in 'lib\portaudio\delphi\portaudio.pas', + portaudio in 'lib\portaudio\portaudio.pas', UAudioCore_Portaudio in 'classes\UAudioCore_Portaudio.pas', {$ENDIF} {$IFDEF UsePortmixer} - portmixer in 'lib\portmixer\delphi\portmixer.pas', + portmixer in 'lib\portmixer\portmixer.pas', {$ENDIF} {$IFDEF UseFFmpeg} diff --git a/src/unit-tests/switches.inc b/src/unit-tests/switches.inc deleted file mode 100644 index e69de29b..00000000 diff --git a/src/unit-tests/test_libraries.lpi b/src/unit-tests/test_libraries.lpi deleted file mode 100644 index cc3a6ddf..00000000 --- a/src/unit-tests/test_libraries.lpi +++ /dev/null @@ -1,299 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/unit-tests/test_libraries.lpr b/src/unit-tests/test_libraries.lpr deleted file mode 100644 index 3e3ae380..00000000 --- a/src/unit-tests/test_libraries.lpr +++ /dev/null @@ -1,31 +0,0 @@ -program Test_Libraries; - -{$mode objfpc}{$H+} - -uses - Classes, - consoletestrunner, - TestSQLLite, - SQLite3 in '../lib/SQLite/SQLite3.pas', - - SQLiteTable3 in '../lib/SQLite/SQLiteTable3.pas'; - -type - - { TLazTestRunner } - - TMyTestRunner = class(TTestRunner) - protected - // override the protected methods of TTestRunner to customize its behavior - end; - -var - Application: TMyTestRunner; - -begin - Application := TMyTestRunner.Create(nil); - Application.Initialize; - Application.Title := 'FPCUnit Console test runner'; - Application.Run; - Application.Free; -end. diff --git a/src/unit-tests/testsqllite.pas b/src/unit-tests/testsqllite.pas deleted file mode 100644 index b1b682d2..00000000 --- a/src/unit-tests/testsqllite.pas +++ /dev/null @@ -1,84 +0,0 @@ -unit TestSQLLite; - -{$mode objfpc}{$H+} - -interface - -uses - Classes, SysUtils, fpcunit, testutils, testregistry, SQLiteTable3, unix; - -type - - TTest_SqlLite= class(TTestCase) - private - fSQLLite : TSQLiteDatabase; - fFileName : string; - protected - procedure SetUp; override; - procedure TearDown; override; - published - procedure Test_Random_TableExists; - procedure Test_Delete_NonExistant_Table; - procedure Test_TableExists_On_0Length_File; - end; - -implementation - -procedure TTest_SqlLite.Test_Random_TableExists; -begin - deletefile( fFileName ); - fSQLLite := TSQLiteDatabase.Create( fFileName ); - - // Test if some random table exists - check( not fSQLLite.TableExists( 'testTable'+floattostr(now()) ) , 'Randomly Named Table Should NOT Exists (In an empty database file)' ); -end; - -procedure TTest_SqlLite.Test_Delete_NonExistant_Table; -var - lSQL : String; -begin - deletefile( fFileName ); - fSQLLite := TSQLiteDatabase.Create( fFileName ); - try - lSQL := 'DROP TABLE testtable'; - fSQLLite.execsql( lSQL ); - except - exit; - end; - - Fail('SQLLite did not except when trying to delete a non existant table' ); -end; - -procedure TTest_SqlLite.Test_TableExists_On_0Length_File; -var - lSQL : String; -begin - deletefile( fFileName ); - shell('cat /dev/null > '+fFileName); - - if not fileexists( fFileName ) then - Fail('0 Length file was not created... oops' ); - - fSQLLite := TSQLiteDatabase.Create( fFileName ); - - check( not fSQLLite.TableExists( 'testTable' ) , 'Randomly Named Table Should NOT Exists' ); -end; - - -procedure TTest_SqlLite.SetUp; -begin - fFileName := 'test.db'; -// fSQLLite := TSQLiteDatabase.Create( fFileName ); -end; - - -procedure TTest_SqlLite.TearDown; -begin - freeandnil( fSQLLite ); -end; - -initialization - - RegisterTest(TTest_SqlLite); -end. - -- cgit v1.2.3