Commit c0739ca4 authored by jpbl's avatar jpbl

portaudio integration

parent a59ff8a9
SUBDIRS = exosip2 utilspp stund src ringtones m4 SUBDIRS = exosip2 portaudio utilspp stund src ringtones m4
EXTRA_DIST = tools/*.sh EXTRA_DIST = tools/*.sh
ACLOCAL_FLAGS=-I$(top_srcdir)/m4 ACLOCAL_FLAGS=-I$(top_srcdir)/m4
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
/* Define to 1 if you have the `osipparser2' library (-losipparser2). */ /* Define to 1 if you have the `osipparser2' library (-losipparser2). */
#undef HAVE_LIBOSIPPARSER2 #undef HAVE_LIBOSIPPARSER2
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the <malloc.h> header file. */ /* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H #undef HAVE_MALLOC_H
...@@ -30,9 +33,6 @@ ...@@ -30,9 +33,6 @@
/* Define to 1 if you have the <ostream> header file. */ /* Define to 1 if you have the <ostream> header file. */
#undef HAVE_OSTREAM #undef HAVE_OSTREAM
/* Define to 1 if you have the <portaudio.h> header file. */
#undef HAVE_PORTAUDIO_H
/* Define if you have POSIX threads libraries and header files. */ /* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD #undef HAVE_PTHREAD
...@@ -102,12 +102,34 @@ ...@@ -102,12 +102,34 @@
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION
/* Alsa */
#undef PA_USE_ALSA
/* Jack */
#undef PA_USE_JACK
/* OSS */
#undef PA_USE_OSS
/* Define to the necessary symbol if this constant uses a non-standard name on /* Define to the necessary symbol if this constant uses a non-standard name on
your system. */ your system. */
#undef PTHREAD_CREATE_JOINABLE #undef PTHREAD_CREATE_JOINABLE
/* The size of a `int', as computed by sizeof. */
#undef SIZEOF_INT
/* The size of a `long', as computed by sizeof. */
#undef SIZEOF_LONG
/* The size of a `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* Define to 1 if you have the ANSI C header files. */ /* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS #undef STDC_HEADERS
/* Version number of package */ /* Version number of package */
#undef VERSION #undef VERSION
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
...@@ -34,6 +34,15 @@ AM_INIT_AUTOMAKE(sflphoned, $VERSION) ...@@ -34,6 +34,15 @@ AM_INIT_AUTOMAKE(sflphoned, $VERSION)
AC_PROG_LIBTOOL AC_PROG_LIBTOOL
dnl AC_CHECK_COMPILERS dnl AC_CHECK_COMPILERS
dnl check for portaudio
LP_SETUP_PORTAUDIO
dnl check for osip2
LP_CHECK_OSIP2
dnl setup flags for embedded exosip library
LP_SETUP_EXOSIP
CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS" CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS"
SFLPHONE_CXXFLAGS="" SFLPHONE_CXXFLAGS=""
...@@ -53,9 +62,9 @@ dnl Checks for header files. ...@@ -53,9 +62,9 @@ dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS( \ AC_CHECK_HEADERS( \
ostream \ ostream \
portaudio.h \
) )
LIBCCGNU2_MIN_VERSION=1.3.1 LIBCCGNU2_MIN_VERSION=1.3.1
PKG_CHECK_MODULES(libccgnu2, libccgnu2 >= ${LIBCCGNU2_MIN_VERSION}) PKG_CHECK_MODULES(libccgnu2, libccgnu2 >= ${LIBCCGNU2_MIN_VERSION})
SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $libccgnu2_CFLAGS" SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $libccgnu2_CFLAGS"
...@@ -71,11 +80,6 @@ PKG_CHECK_MODULES(libccrtp1, libccrtp1 >= ${LIBCCRT_MIN_VERSION}) ...@@ -71,11 +80,6 @@ PKG_CHECK_MODULES(libccrtp1, libccrtp1 >= ${LIBCCRT_MIN_VERSION})
SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $libccrtp1_CFLAGS" SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $libccrtp1_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $libccrtp1_LIBS" SFLPHONE_LIBS="$SFLPHONE_LIBS $libccrtp1_LIBS"
dnl check for osip2
LP_CHECK_OSIP2
dnl setup flags for embedded exosip library
LP_SETUP_EXOSIP
SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $OSIP_CFLAGS" SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $OSIP_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $OSIP_LIBS" SFLPHONE_LIBS="$SFLPHONE_LIBS $OSIP_LIBS"
...@@ -83,18 +87,6 @@ SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $EXOSIP_CFLAGS" ...@@ -83,18 +87,6 @@ SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $EXOSIP_CFLAGS"
SFLPHONE_LIBS="$SFLPHONE_LIBS $EXOSIP_LIBS" SFLPHONE_LIBS="$SFLPHONE_LIBS $EXOSIP_LIBS"
if test $ac_cv_header_portaudio_h = no; then
AC_MSG_ERROR([*** missing portaudio.h. You need a working PortAudio installation. See http://www.portaudio.com])
else
portaudio_LIBS="-lportaudio -lasound "
portaudio_CFLAGS="-DAUDIO_PORTAUDIO "
fi
SFLPHONE_LIBS="$SFLPHONE_LIBS $portaudio_LIBS"
SFLPHONE_CXXFLAGS=="$SFLPHONE_CXXFLAGS $portaudio_CFLAGS"
AC_SUBST(portaudio_CFLAGS)
AC_SUBST(portaudio_LIB)
AC_SUBST(SFLPHONE_CXXFLAGS) AC_SUBST(SFLPHONE_CXXFLAGS)
AC_SUBST(SFLPHONE_LIBS) AC_SUBST(SFLPHONE_LIBS)
...@@ -142,6 +134,7 @@ sflphoned-fedora.spec \ ...@@ -142,6 +134,7 @@ sflphoned-fedora.spec \
Makefile \ Makefile \
m4/Makefile \ m4/Makefile \
exosip2/Makefile \ exosip2/Makefile \
portaudio/Makefile \
src/Makefile \ src/Makefile \
src/sflphone \ src/sflphone \
src/audio/Makefile \ src/audio/Makefile \
......
lib_LTLIBRARIES = libeXosip2.la noinst_LTLIBRARIES = libeXosip2.la
# #
# Other flags to add someday: # Other flags to add someday:
...@@ -9,7 +9,7 @@ lib_LTLIBRARIES = libeXosip2.la ...@@ -9,7 +9,7 @@ lib_LTLIBRARIES = libeXosip2.la
# -Wstrict-prototypes # -Wstrict-prototypes
# -Werror # -Werror
# #
AM_CFLAGS = @EXOSIP_CFLAGS@ @CFLAGS@ AM_CFLAGS = $(EXOSIP_CFLAGS) @CFLAGS@
libeXosip2_la_SOURCES = \ libeXosip2_la_SOURCES = \
eXosip.c eXconf.c \ eXosip.c eXconf.c \
...@@ -27,7 +27,6 @@ misc.c eXosip2.h \ ...@@ -27,7 +27,6 @@ misc.c eXosip2.h \
jpipe.c jpipe.h jauth.c \ jpipe.c jpipe.h jauth.c \
sdp_offans.c jpublish.c sdp_offans.c jpublish.c
libeXosip2_la_LDFLAGS = -L$(prefix)/lib -version-info $(LIBEXOSIP_SO_VERSION) libeXosip2_la_LIBADD = -losip2 @EXOSIP_LIBS@
libeXosip2_la_LIBADD = -losip2 @EXOSIP_LIBS@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/include -I$(includedir) INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/include -I$(includedir)
...@@ -2,23 +2,6 @@ AC_DEFUN([LP_SETUP_EXOSIP],[ ...@@ -2,23 +2,6 @@ AC_DEFUN([LP_SETUP_EXOSIP],[
AC_REQUIRE([AC_CANONICAL_HOST]) AC_REQUIRE([AC_CANONICAL_HOST])
AC_REQUIRE([LP_CHECK_OSIP2]) AC_REQUIRE([LP_CHECK_OSIP2])
dnl *********************************************************************
dnl Source packaging numbers
EXOSIP_MAJOR_VERSION=1
EXOSIP_MINOR_VERSION=9
EXOSIP_MICRO_VERSION=1
SONAME_MAJOR_VERSION=5
SONAME_MINOR_VERSION=0
SONAME_MICRO_VERSION=0
dnl program extension
EXOSIP_VERSION=$EXOSIP_MAJOR_VERSION.$EXOSIP_MINOR_VERSION.$EXOSIP_MICRO_VERSION
LIBEXOSIP_SO_VERSION=$SONAME_MAJOR_VERSION:$SONAME_MINOR_VERSION:$SONAME_MICRO_VERSION
AC_SUBST(LIBEXOSIP_SO_VERSION)
AC_SUBST(EXOSIP_VERSION)
dnl support for linux-thread or posix thread (pthread.h) dnl support for linux-thread or posix thread (pthread.h)
AC_ARG_ENABLE(pthread, AC_ARG_ENABLE(pthread,
[ --enable-pthread enable support for POSIX threads. (autodetect)], [ --enable-pthread enable support for POSIX threads. (autodetect)],
......
AC_DEFUN([LP_SETUP_PORTAUDIO],[
AC_REQUIRE([AC_CANONICAL_HOST])
CFLAGS_save=$CFLAGS
LIBS_save=$LIBS
CXXFLAGS_save=$CXXFLAGS
AC_ARG_WITH(alsa,
[ --with-alsa (default=yes)],
with_alsa=$withval, with_alsa="yes")
AC_ARG_WITH(jack,
[ --with-jack (default=yes)],
with_jack=$withval, with_jack="yes")
AC_ARG_WITH(oss,
[ --with-oss (default=yes)],
with_oss=$withval, with_oss="yes")
AC_ARG_WITH(host_os,
[ --with-host_os (no default)],
host_os=$withval)
AC_ARG_WITH(winapi,
[ --with-winapi ((wmme/directx/asio) default=wmme)],
with_winapi=$withval, with_winapi="wmme")
dnl Mac API added for ASIO, can have other api's listed
AC_ARG_WITH(macapi,
[ --with-macapi ((asio/core/sm) default=core)],
with_macapi=$withval, with_macapi="core")
AC_ARG_WITH(asiodir,
[ --with-asiodir (default=/usr/local/asiosdk2)],
with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2")
AC_ARG_WITH(dxdir,
[ --with-dxdir (default=/usr/local/dx7sdk)],
with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk")
dnl This must be one of the first tests we do or it will fail...
AC_C_BIGENDIAN
dnl checks for various host APIs and arguments to configure that
dnl turn them on or off
AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
dnl sizeof checks: we will need a 16-bit and a 32-bit type
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
dnl extra variables
AC_SUBST(PADLL)
AC_SUBST(SHARED_FLAGS)
AC_SUBST(DLL_LIBS)
AC_SUBST(CXXFLAGS)
AC_SUBST(NASM)
AC_SUBST(NASMOPT)
AC_SUBST(PORTAUDIO_CFLAGS)
AC_SUBST(PORTAUDIO_CXXFLAGS)
AC_SUBST(PORTAUDIO_LIBS)
CFLAGS="-g -O2 -Wall -pedantic -pipe -fPIC"
if test x$ac_cv_c_bigendian = xyes ; then
CFLAGS="$CFLAGS -DPA_BIG_ENDIAN"
else
CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN"
fi
dnl Unix configuration
AC_CHECK_LIB(pthread, pthread_create,,AC_MSG_ERROR([libpthread not found!]))
if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then
compile_with_alsa=yes
LIBS="$LIBS -lasound"
DLL_LIBS="$DLL_LIBS -lasound"
AC_DEFINE(PA_USE_ALSA, [], [Alsa])
fi
AM_CONDITIONAL(ENABLE_ALSA, test x$compile_with_alsa = xyes)
if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then
compile_with_jack=yes
LIBS="$LIBS $JACK_LIBS"
DLL_LIBS="$DLL_LIBS $JACK_LIBS"
CFLAGS="$CFLAGS $JACK_CFLAGS"
AC_DEFINE(PA_USE_JACK, [], [Jack])
fi
AM_CONDITIONAL(ENABLE_JACK, test x$compile_with_jack = xyes)
if [[ $with_oss != "no" ]] ; then
compile_with_oss=yes
AC_DEFINE(PA_USE_OSS, [], [OSS])
fi
AM_CONDITIONAL(ENABLE_OSS, test x$compile_with_oss = xyes)
LIBS="$LIBS -lm -lpthread";
AM_CONDITIONAL(ENABLE_UNIX, true)
PORTAUDIO_CFLAGS=$CFLAGS
PORTAUDIO_LIBS=$LIBS
PORTAUDIO_CXXFLAGS=$CXXFLAGS
CFLAGS=$CFLAGS_save
LIBS=$LIBS_save
CXXFLAGS=$CXXFLAGS_save
AC_SUBST(OTHER_SOURCES, $OTHER_SOURCES)
])
noinst_LTLIBRARIES = libportaudio.la
libportaudio_la_CFLAGS = $(PORTAUDIO_CFLAGS)
libportaudio_la_LIBS = $(PORTAUDIO_LIBS)
libportaudio_la_CXXFLAGS = $(PORTAUDIO_CXXFLAGS)
libportaudio_la_CPPFLAGS = $(PORTAUDIO_CPPFLAGS) -Ipa_common/
pkginclude_HEADERS = pa_common/portaudio.h
if ENABLE_OSS
OSS=pa_unix_oss/pa_unix_oss.c
endif
if ENABLE_UNIX
UNIX=pa_unix/pa_unix_hostapis.c pa_unix/pa_unix_util.c
endif
if ENABLE_JACK
JACK=pa_jack/pa_jack.c
endif
if ENABLE_ALSA
ALSA=pa_linux_alsa/pa_linux_alsa.c
endif
SOURCES=${OSS} ${UNIX} ${JACK} ${ALSA}
libportaudio_la_SOURCES = ${SOURCES} \
pa_common/pa_allocation.c \
pa_common/pa_converters.c \
pa_common/pa_cpuload.c \
pa_common/pa_dither.c \
pa_common/pa_front.c \
pa_common/pa_process.c \
pa_common/pa_skeleton.c \
pa_common/pa_stream.c \
pa_common/pa_trace.c
/*
* $Id$
* Portable Audio I/O Library allocation group implementation
* memory allocation group for tracking allocation groups
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 1999-2002 Ross Bencina, 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.
*/
/** @file
@brief Allocation Group implementation.
*/
#include "pa_allocation.h"
#include "pa_util.h"
/*
Maintain 3 singly linked lists...
linkBlocks: the buffers used to allocate the links
spareLinks: links available for use in the allocations list
allocations: the buffers currently allocated using PaUtil_ContextAllocateMemory()
Link block size is doubled every time new links are allocated.
*/
#define PA_INITIAL_LINK_COUNT_ 16
struct PaUtilAllocationGroupLink
{
struct PaUtilAllocationGroupLink *next;
void *buffer;
};
/*
Allocate a block of links. The first link will have it's buffer member
pointing to the block, and it's next member set to <nextBlock>. The remaining
links will have NULL buffer members, and each link will point to
the next link except the last, which will point to <nextSpare>
*/
static struct PaUtilAllocationGroupLink *AllocateLinks( long count,
struct PaUtilAllocationGroupLink *nextBlock,
struct PaUtilAllocationGroupLink *nextSpare )
{
struct PaUtilAllocationGroupLink *result;
int i;
result = (struct PaUtilAllocationGroupLink *)PaUtil_AllocateMemory(
sizeof(struct PaUtilAllocationGroupLink) * count );
if( result )
{
/* the block link */
result[0].buffer = result;
result[0].next = nextBlock;
/* the spare links */
for( i=1; i<count; ++i )
{
result[i].buffer = 0;
result[i].next = &result[i+1];
}
result[count-1].next = nextSpare;
}
return result;
}
PaUtilAllocationGroup* PaUtil_CreateAllocationGroup( void )
{
PaUtilAllocationGroup* result = 0;
struct PaUtilAllocationGroupLink *links;
links = AllocateLinks( PA_INITIAL_LINK_COUNT_, 0, 0 );
if( links != 0 )
{
result = (PaUtilAllocationGroup*)PaUtil_AllocateMemory( sizeof(PaUtilAllocationGroup) );
if( result )
{
result->linkCount = PA_INITIAL_LINK_COUNT_;
result->linkBlocks = &links[0];
result->spareLinks = &links[1];
result->allocations = 0;
}
else
{
PaUtil_FreeMemory( links );
}
}
return result;
}
void PaUtil_DestroyAllocationGroup( PaUtilAllocationGroup* group )
{
struct PaUtilAllocationGroupLink *current = group->linkBlocks;
struct PaUtilAllocationGroupLink *next;
while( current )
{
next = current->next;
PaUtil_FreeMemory( current->buffer );
current = next;
}
PaUtil_FreeMemory( group );
}
void* PaUtil_GroupAllocateMemory( PaUtilAllocationGroup* group, long size )
{
struct PaUtilAllocationGroupLink *links, *link;
void *result = 0;
/* allocate more links if necessary */
if( !group->spareLinks )
{
/* double the link count on each block allocation */
links = AllocateLinks( group->linkCount, group->linkBlocks, group->spareLinks );
if( links )
{
group->linkCount += group->linkCount;
group->linkBlocks = &links[0];
group->spareLinks = &links[1];
}
}
if( group->spareLinks )
{
result = PaUtil_AllocateMemory( size );
if( result )
{
link = group->spareLinks;
group->spareLinks = link->next;
link->buffer = result;
link->next = group->allocations;
group->allocations = link;
}
}
return result;
}
void PaUtil_GroupFreeMemory( PaUtilAllocationGroup* group, void *buffer )
{
struct PaUtilAllocationGroupLink *current = group->allocations;
struct PaUtilAllocationGroupLink *previous = 0;
if( buffer == 0 )
return;
/* find the right link and remove it */
while( current )
{
if( current->buffer == buffer )
{
if( previous )
{
previous->next = current->next;
}
else
{
group->allocations = current->next;
}
current->buffer = 0;
current->next = group->spareLinks;
group->spareLinks = current;
break;
}
previous = current;
current = current->next;
}
PaUtil_FreeMemory( buffer ); /* free the memory whether we found it in the list or not */
}
void PaUtil_FreeAllAllocations( PaUtilAllocationGroup* group )
{
struct PaUtilAllocationGroupLink *current = group->allocations;
struct PaUtilAllocationGroupLink *previous = 0;
/* free all buffers in the allocations list */
while( current )
{
PaUtil_FreeMemory( current->buffer );
current->buffer = 0;
previous = current;
current = current->next;
}
/* link the former allocations list onto the front of the spareLinks list */
if( previous )
{
previous->next = group->spareLinks;
group->spareLinks = group->allocations;
group->allocations = 0;
}
}
#ifndef PA_ALLOCATION_H
#define PA_ALLOCATION_H
/*
* $Id$
* Portable Audio I/O Library allocation context header
* memory allocation context for tracking allocation groups
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 1999-2002 Ross Bencina, 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.
*/
/** @file
@brief Allocation Group prototypes. An Allocation Group makes it easy to
allocate multiple blocks of memory and free them all simultanously.
An allocation group is useful for keeping track of multiple blocks
of memory which are allocated at the same time (such as during initialization)
and need to be deallocated at the same time. The allocation group maintains
a list of allocated blocks, and can deallocate them all simultaneously which
can be usefull for cleaning up after a partially initialized object fails.
The allocation group implementation is built on top of the lower
level allocation functions defined in pa_util.h
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef struct
{
long linkCount;
struct PaUtilAllocationGroupLink *linkBlocks;
struct PaUtilAllocationGroupLink *spareLinks;
struct PaUtilAllocationGroupLink *allocations;
}PaUtilAllocationGroup;
/** Create an allocation group.
*/
PaUtilAllocationGroup* PaUtil_CreateAllocationGroup( void );
/** Destroy an allocation group, but not the memory allocated through the group.
*/
void PaUtil_DestroyAllocationGroup( PaUtilAllocationGroup* group );
/** Allocate a block of memory though an allocation group.
*/
void* PaUtil_GroupAllocateMemory( PaUtilAllocationGroup* group, long size );
/** Free a block of memory that was previously allocated though an allocation
group. Calling this function is a relatively time consuming operation.
Under normal circumstances clients should call PaUtil_FreeAllAllocations to
free all allocated blocks simultaneously.
@see PaUtil_FreeAllAllocations
*/
void PaUtil_GroupFreeMemory( PaUtilAllocationGroup* group, void *buffer );
/** Free all blocks of memory which have been allocated through the allocation
group. This function doesn't destroy the group itself.
*/
void PaUtil_FreeAllAllocations( PaUtilAllocationGroup* group );
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* PA_ALLOCATION_H */
/*
* $Id$
* Portable Audio I/O Library sample conversion mechanism
*
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 1999-2002 Phil Burk, Ross Bencina
*
* 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.
*/
/** @file
@brief Conversion functions implementations.
If the C9x function lrintf() is available, define PA_USE_C99_LRINTF to use it
@todo Consider whether functions which dither but don't clip should exist,
V18 automatically enabled clipping whenever dithering was selected. Perhaps