diff --git a/AUTHORS b/AUTHORS index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..26673b7f7d38c21ddffffaec3fc6abae2ad23e70 100644 --- a/AUTHORS +++ b/AUTHORS @@ -0,0 +1,10 @@ +Jerome Oufella (jerome dot oufella at savoirfairelinux dot com) + - Many portions of code and bug fixes + +Laurielle LEA (laurielle dot lea at savoirfairelinux dot com) + _ Implementation of SFLphone + +Jean-Philippe Barrette-LaPierre +(jean-philippe dot barrette-lapierre at savoirfairelinux dot com) + - Autotools support + diff --git a/CHANGES b/CHANGES index 2b112b45029a2312b92991de32106e9355718bea..7893929bb7b33c6eafe7dc1e2fd8c2207a4bb299 100644 --- a/CHANGES +++ b/CHANGES @@ -1,9 +1,15 @@ -SFLphone (0.3.1) / 2005-06-01 +SFLphone (0.4) / 2005-07-06 + * Add autotools support + * Test on iMac with Ubuntu: Ok + * Handle CANCEL method + * PortAudio replace OSS and ALSA devices choice + * Add PortAudioCpp to make easy use of RingBuffer object for audio callback * Add PortAudio library to make easy sound portability + * Fix a few memory leak * Reorganisation of SFLphone architecture * Handle error messages on screen - * Handle refused call + * Handle "refused call" * Notification of remote RINGING event added * Call management updated diff --git a/ChangeLog b/ChangeLog index ab534fc2d0bd2d8c38e0711ec5897e80cff78142..9828436f5981376ad9d793e9c5f43d4bff2ca1f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,2 +1,18 @@ -Jean-Philippe Barrette-LaPierre (9 June 2005) version 0.3.1 -- Added the autotools support. \ No newline at end of file +Laurielle LEA (8 July 2005) version 0.4 +- Stop program when error opening skin file +- Divide toggle() of qtguimainwindow.cpp in small functions + +Laurielle LEA (7 July 2005) version 0.4 +- Cleanup audiortp.cpp +- Replace #define by global variable in codecDescriptor.cpp +- Set mutex of ringbuffer in the functions of RingBuffer object +- Divide run() of audiortp.cpp in 3 small functions +- Changed device static function in Manager for configurationpanel.ui.h +- Updated README + +Jean-Philippe Barrette-LaPierre (6 July 2005) version 0.4 +- Fixed all autotools problems. +- Updated all autotools scripts to use PortAudioCpp + +Jean-Philippe Barrette-LaPierre (9 June 2005) version 0.4 +- Added the autotools support. diff --git a/README b/README index ce1793f7ade6466d582323052d45bac3442eeb61..4385d39b876fe89def76fb195b7a97a71053438e 100644 --- a/README +++ b/README @@ -1,7 +1,8 @@ -This is SFLPhone-0.3.1 release. +This is SFLPhone-0.4 release. You need ccrtp-1.3.0 which needs commoncpp2>=1.3.0 libeXosip-0.9.0 needs libosip2-2.2.0 +You also need PortAudio_v19 See http://www.sflphone.org/#downloads to download required libraries. Dependencies build instructions: @@ -27,16 +28,17 @@ Dependencies build instructions: make make install - +5/ For PortAudio_v19 + ./configure [option] + make + make install + How to compile SFLphone ? ------------------------- -If you want to activate alsa option in the setup configuration interface, -add -alsa: - -./configure [-alsa] +./configure [option] make -make install +make install (as root) ( Be sure you have the correct permissions). @@ -67,9 +69,13 @@ Why does it not compile ? Fedora Core 2 Linux. Someone reported it works on gcc 3.4. - If error occured while loading shared libraries, - you have to export LD_LIBRARY_PATH with your lib directory + you have to export LD_LIBRARY_PATH with your lib directory. ( example: export LD_LIBRARY_PATH=/opt/lib:${LD_LIBRARY_PATH} ) + - If you don't install dependencies in classic install directories, + you have to export CXXFLAGS. + ( example: export CXXFLAGS="-I/opt/include" ) + Of course we love patches. And contribution. See http://www.sflphone.org/ . The project infrastructure (CVS, bugtraqer, MLs) is maintained on : http://forge.novell.com/modules/xfmod/project/?sflphone @@ -79,4 +85,5 @@ forge.novell mailing-list. Laurielle Lea (laurielle.lea@savoirfairelinux.com) +Jerome Oufella (jerome.oufella@savoirfairelinux.com) diff --git a/README.cvs b/README.cvs new file mode 100644 index 0000000000000000000000000000000000000000..03fa59a1236841ad2e51495d67b8397174e74e1e --- /dev/null +++ b/README.cvs @@ -0,0 +1,10 @@ +Starting from CVS there are a few things that need to be done before +the normal build procedure. These require autoconf and automake to +be installed. + +Then run the following; + +make -f Makefile.cvs + +After this the normal build procedure in the README file can be +followed. \ No newline at end of file diff --git a/TODO b/TODO index 06f5ec8586ccc4c6f4ec2341aa999cf33d6b6b59..73435c74186c4860186ec22097de0f9c93b0ea6c 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,18 @@ -- We need to remove the KDE check -- We need to clean the optimization flags handling. -- We need to cleanup the compilation libs. -- We need to get rid of the pa_converters.h and pa_dither.h -- We need to cleanup the -O* handling \ No newline at end of file +ForGUI: +------- +Add Clear button for GUI to clear screen (like Ctrl+L) +Add screen shell to display debug + +For project core: +---------------- +Management Config like about:config in Mozilla +Improvement of STUN +Add ZeroConf +Management of account (add, remove, ...) +Management of exceptions +Remove all warnings in compilation +Add unregister method when application is closed + +For project dependencies: +------------------------ +Improve the autotools scripts of PortAudioCpp \ No newline at end of file diff --git a/config.h.in b/config.h.in index 157075daae6be5b35ccaf6ee88f83d13f50218a7..35f2516284c6792300322b539bec03d3de744ae5 100644 --- a/config.h.in +++ b/config.h.in @@ -1,8 +1,5 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if you have the <alsa/asoundlib.h> header file. */ -#undef HAVE_ALSA_ASOUNDLIB_H - /* Define to 1 if you have the <Carbon/Carbon.h> header file. */ #undef HAVE_CARBON_CARBON_H @@ -54,9 +51,6 @@ /* Define if you have the res_init prototype */ #undef HAVE_RES_INIT_PROTO -/* Define if you have a STL implementation by SGI */ -#undef HAVE_SGI_STL - /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF @@ -144,9 +138,6 @@ /* Version number of package */ #undef VERSION -/* Defined if compiling without arts */ -#undef WITHOUT_ARTS - /* * jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system * headers and I'm too lazy to write a configure test as long as only diff --git a/configure.ac b/configure.ac index 00b48d59661a8ccdfca965f2e87f1d61c4f635b0..690a996d0f9961b21dab496e7df5f6765a072b89 100644 --- a/configure.ac +++ b/configure.ac @@ -3,19 +3,14 @@ AC_INIT(acinclude.m4) AM_CONFIG_HEADER(config.h) dnl figure out the sflphone version -VERSION=`sed -ne 's/^#define SFLPHONE_VERSION "\(.*\)"/\1/p' ${srcdir}/src/global.h` +VERSION=`sed -ne 's/^#define VERSION "\(.*\)"/\1/p' src/global.h` AC_SUBST(VERSION) - dnl get rid of release number RPM_VERSION=`echo $VERSION | sed -ne 's/-//p' ` AC_SUBST(RPM_VERSION) LIBS="$LIBS -lstdc++" -dnl -dnl we extract the numerical version -VERSIONNUM=`sed -ne 's/^#define SFLPHONE_VERSION_NUM 0x\(\\d\)/\1/p' ${srcdir}/src/global.h` -AC_SUBST(VERSIONNUM) dnl dnl Solaris pkgadd support definitions @@ -31,9 +26,16 @@ AC_LANG_CPLUSPLUS AC_PROG_CXX AC_PROG_CC -KDE_USE_QT(3.3) -KDE_DO_IT_ALL(sflphone, $VERSION) +AC_PATH_QT +dnl KDE_USE_QT(3.3) +AC_CANONICAL_SYSTEM +AC_ARG_PROGRAM +AM_INIT_AUTOMAKE(sflphone, $VERSION) +AM_DISABLE_LIBRARIES +AC_PROG_LIBTOOL +AC_CHECK_COMPILERS +CXXFLAGS="$CXXFLAGS $USE_EXCEPTIONS " SFLPHONE_CXXFLAGS="" @@ -53,10 +55,13 @@ AC_HEADER_STDC AC_CHECK_HEADERS( \ ostream \ eXosip/eXosip.h \ -alsa/asoundlib.h \ portaudio.h \ ) +LIBCCGNU2_MIN_VERSION=1.3.1 +PKG_CHECK_MODULES(libccgnu2, libccgnu2 >= ${LIBCCGNU2_MIN_VERSION}) +SFLPHONE_CXXFLAGS="$SFLPHONE_CXXFLAGS $libccgnu2_CFLAGS" +SFLPHONE_LIBS="$SFLPHONE_LIBS $libccgnu2_LIBS" LIBCCEXT2_MIN_VERSION=1.3.1 PKG_CHECK_MODULES(libccext2, libccext2 >= ${LIBCCEXT2_MIN_VERSION}) @@ -83,47 +88,6 @@ dnl AC_MSG_ERROR([*** missing gsm.h. You need a working GSM 06.10 lossy speec dnl fi dnl SFLPHONE_LIBS="$SFLPHONE_LIBS -lgsm" -if test $ac_cv_header_alsa_asoundlib_h = no; then - AC_MSG_ERROR([*** missing alsa/asoundlib.h. You need a working alsa-lib installation. See http://www.alsa-project.org/]) -fi -SFLPHONE_LIBS="$SFLPHONE_LIBS -lasound" - - -AC_MSG_CHECKING([warning make an error on compilation]) -AC_ARG_ENABLE(ewarning, -[ --enable-ewarning Enable error on compilation warning [default=yes]], -[ -AC_MSG_RESULT(no) -], -[ -AC_MSG_RESULT(yes) -CXXFLAGS="$CXXFLAGS -Werror" -] -) - -AC_MSG_CHECKING([whether to disable -O* optimization flags]) -AC_ARG_ENABLE(oflags, -[ --disable-oflags Disable -O* optimization flags [default=no]], -[ -AC_MSG_RESULT(yes) - NEWFLAGS="" - for flag in $CXXFLAGS; do - case "$flag" in - -O*) - dnl echo "cut off $flag" - ;; - *) - NEWFLAGS="$NEWFLAGS $flag" - ;; - esac - done - CXXFLAGS=$NEWFLAGS -], -[ -AC_MSG_RESULT(no) -] -) - AC_MSG_CHECKING([whether to enable the maintener code]) AC_ARG_ENABLE(maintener, [ --enable-maintener Enable maintener code [default=no]], @@ -158,10 +122,16 @@ LIBS="$LIBS $SFLPHONE_LIBS $LIBQT" dnl AC_CONFIG_FILES( AC_OUTPUT( +sflphone.spec \ Makefile \ src/Makefile \ src/audio/Makefile \ src/audio/gsm/Makefile \ +src/audio/pacpp/Makefile \ +src/audio/pacpp/include/Makefile \ +src/audio/pacpp/include/portaudiocpp/Makefile \ +src/audio/pacpp/source/Makefile \ +src/audio/pacpp/source/portaudiocpp/Makefile \ src/gui/Makefile \ src/gui/qt/Makefile \ stund/Makefile \ diff --git a/sflphone.spec b/sflphone.spec.in similarity index 100% rename from sflphone.spec rename to sflphone.spec.in diff --git a/src/Makefile.am b/src/Makefile.am index 36e294a99fc9a4c37cc007aff809c14c300d79ce..877193b94edf433bb01df5a1027b062a958773dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,6 @@ sflphone_SOURCES = \ voIPLink.cpp \ sipcall.cpp \ skin.cpp \ - trayicon_x11.cpp \ manager.h \ global.h \ configitem.h \ @@ -36,13 +35,12 @@ sflphone_SOURCES = \ sflphone_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" - -sflphone_LDFLAGS = $(KDE_RPATH) $(all_libraries) +sflphone_LDFLAGS = $(QT_LDFLAGS) $(X_LDFLAGS) sflphone_LDADD = gui/libguiframework.la audio/libaudio.la ../stund/libstun.la -lpthread KDE_CXXFLAGS = $(USE_EXCEPTIONS) -AM_CPPFLAGS = -I$(qt_includes) $(all_includes) +AM_CPPFLAGS = $(QT_INCLUDES) $(X_INCLUDES) -Iaudio/pacpp/include diff --git a/src/audio/Makefile.am b/src/audio/Makefile.am index f67419b7c5c2cfeb9b5a59e7e49a9933dae79088..37345c6b1d96445fa6c62ebedd41fd9481a15373 100644 --- a/src/audio/Makefile.am +++ b/src/audio/Makefile.am @@ -1,16 +1,12 @@ -SUBDIRS = gsm +SUBDIRS = gsm pacpp noinst_LTLIBRARIES = libaudio.la libaudio_la_SOURCES = \ alaw.cpp alaw.h \ - audiobuffer.cpp audiobuffer.h \ audiocodec.cpp audiocodec.h \ - audiodrivers.cpp audiodrivers.h \ - audiodriversalsa.cpp audiodriversalsa.h \ - audiodriversoss.cpp audiodriversoss.h \ - audiodriversportaudio.cpp audiodriversportaudio.h \ + audiolayer.cpp audiolayer.h \ audiortp.cpp audiortp.h \ codecDescriptor.cpp codecDescriptor.h \ common.h \ @@ -18,9 +14,10 @@ libaudio_la_SOURCES = \ dtmfgenerator.cpp dtmfgenerator.h \ g711.cpp g711.h \ gsmcodec.cpp gsmcodec.h \ - pa_converters.h pa_dither.h \ + ringbuffer.cpp ringbuffer.h \ tonegenerator.cpp tonegenerator.h \ ulaw.cpp ulaw.h -libaudio_la_LIBADD = gsm/libgsm.la +AM_CXXFLAGS = -Ipacpp/include/ +libaudio_la_LIBADD = gsm/libgsm.la pacpp/source/portaudiocpp/libportaudiocpp.la diff --git a/src/audio/audiobuffer.cpp b/src/audio/audiobuffer.cpp deleted file mode 100644 index 54ed0003db92be1874059b9f12bb601adfaba632..0000000000000000000000000000000000000000 --- a/src/audio/audiobuffer.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "audiobuffer.h" -#include "../global.h" - -#include <string.h> - -AudioBuffer::AudioBuffer (void) { - data = new short[SIZEBUF]; - bzero(data, SIZEBUF); - size = SIZEBUF; - realsize = size; -} - -AudioBuffer::~AudioBuffer (void) -{ - delete[] static_cast<short *>(data); -} - -void AudioBuffer::resize (size_t newsize) -{ - if (newsize > realsize) { - delete[] static_cast<short *>(data); - data = new short[newsize]; - size = newsize; - realsize = newsize; - } else { - size = newsize; - } -} - -void -AudioBuffer::setData (short *buf, int vol) { - short *databuf = (short*)data; - - for (int i = 0; i < (int)size; i++) { - databuf[i] = buf[i]*vol/100; - } -} - diff --git a/src/audio/audiobuffer.h b/src/audio/audiobuffer.h deleted file mode 100644 index 386c774403aa1aba44c9277e3ce1ce78cdc9c64b..0000000000000000000000000000000000000000 --- a/src/audio/audiobuffer.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -#ifndef __AUDIOBUFFER_H__ -#define __AUDIOBUFFER_H__ - -#include <stddef.h> -#include <stdlib.h> -#include <stdio.h> - - -/** - * Small class for passing around buffers of audio data. - */ -class AudioBuffer { -public: - /** - * Creates an audio buffer of @param length bytes. - */ - AudioBuffer (void); - - /** - * Deletes the audio buffer, freeing the data. - */ - ~AudioBuffer (void); - - /** - * Returns a pointer to the audio data. - */ - void *getData (void) { - return data; - } - - /** - * Returns the size of the buffer. - */ - size_t getSize (void) { - return size; - } - - /** - * Resizes the buffer to size newlength. Will only allocate new memory - * if the size is larger than what has been previously allocated. - */ - void resize (size_t newsize); - - void setData (short *buf, int); -void *data; -private: - - size_t realsize; - size_t size; -}; - -#endif // __AUDIOBUFFER_H__ diff --git a/src/audio/audiocodec.cpp b/src/audio/audiocodec.cpp index 8746bee50d11a0ca484c493d51812f781061c676..6a7e124ad0dcc5d36b96d6d53d21a4ae38b2a5dc 100644 --- a/src/audio/audiocodec.cpp +++ b/src/audio/audiocodec.cpp @@ -26,10 +26,8 @@ #include <string.h> #include <iostream> #include <string> -#include <portaudio.h> -#include "pa_converters.h" -#include "pa_dither.h" +#include "portaudio.h" #include "../global.h" @@ -59,29 +57,4 @@ AudioCodec::getCodecName (void) return _codecName; } -void -AudioCodec::float32ToInt16 (float32* src, int16* dst, int size) { - PaUtilConverter* myconverter; - struct PaUtilTriangularDitherGenerator tdg; - PaUtil_InitializeTriangularDitherState (&tdg); - - myconverter = PaUtil_SelectConverter (paFloat32, paInt16, paNoFlag); - if (myconverter != NULL) { - myconverter(dst, 1, src, 1, size, &tdg); - } else { - _debug("Format conversion is not supported\n"); - } -} - -void -AudioCodec::int16ToFloat32 (int16* src, float32* dst, int size) { - PaUtilConverter* myconverter; - - myconverter = PaUtil_SelectConverter (paInt16, paFloat32, paNoFlag); - if (myconverter != NULL) { - myconverter(dst, 1, src, 1, size, NULL); - } else { - _debug("Format conversion is not supported\n"); - } -} diff --git a/src/audio/audiocodec.h b/src/audio/audiocodec.h index 689dc8027328529d1854b6547da3e1e0fc3c8242..a464ba76c362ac2cb7474f7393ad6ea15695ea07 100644 --- a/src/audio/audiocodec.h +++ b/src/audio/audiocodec.h @@ -38,8 +38,6 @@ public: void setCodecName (const string& codec); string getCodecName (void); - void float32ToInt16 (float32* src, int16* dst, int size); - void int16ToFloat32 (int16* src, float32* dst, int size); private: string _codecName; diff --git a/src/audio/audiodrivers.cpp b/src/audio/audiodrivers.cpp deleted file mode 100644 index 30509e3f8601b11797d861115cf38275d15ced18..0000000000000000000000000000000000000000 --- a/src/audio/audiodrivers.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include "audiodrivers.h" - - -AudioDrivers::AudioDrivers (void) { - this->devstate = AudioDrivers::DeviceClosed; -} - -AudioDrivers::~AudioDrivers (void) { -} - - - -// EOF diff --git a/src/audio/audiodrivers.h b/src/audio/audiodrivers.h deleted file mode 100644 index 2ab79069b4ee3369a7aec4ae3138f26781c90379..0000000000000000000000000000000000000000 --- a/src/audio/audiodrivers.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author : Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __AUDIO_DRIVERS_H__ -#define __AUDIO_DRIVERS_H__ - -#include "audiobuffer.h" - -class AudioDrivers { -public: - AudioDrivers (void); - virtual ~AudioDrivers (void); - AudioBuffer audio_buf; // Buffer that the application fills - - enum DeviceState { - DeviceOpened, - DeviceClosed }; - - enum DeviceMode { - ReadOnly, - WriteOnly, - ReadWrite }; - - virtual int initDevice (DeviceMode) = 0; - virtual int resetDevice (void) = 0; - virtual int writeBuffer (void) = 0; - virtual int readBuffer (void *, int) = 0; - virtual unsigned int readableBytes (void) = 0; - - -protected: - DeviceState devstate; // Current state - DeviceMode devmode; // Current mode -}; - - -#endif// __AUDIO_DRIVERS_H__ diff --git a/src/audio/audiodriversalsa.cpp b/src/audio/audiodriversalsa.cpp deleted file mode 100644 index f37125ef7b5774aacc619f045c817e6c94c23e9c..0000000000000000000000000000000000000000 --- a/src/audio/audiodriversalsa.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -//#if defined(AUDIO_ALSA) - -#include <sys/ioctl.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/soundcard.h> - -#include <fcntl.h> -#include <unistd.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#include "audiodriversalsa.h" -#include "../global.h" - -#define ALSA_DEVICE "plughw:0,0" - -AudioDriversALSA::AudioDriversALSA(DeviceMode mode, Error *error) : - AudioDrivers () { - this->error = error; - audio_hdl = (snd_pcm_t *) NULL; - initDevice(mode); -} - -AudioDriversALSA::~AudioDriversALSA (void) { - /* Close the audio handle */ - this->closeDevice(); -} - -void -AudioDriversALSA::closeDevice (void) { - if (audio_hdl != NULL) { - snd_pcm_close (audio_hdl); - audio_hdl = (snd_pcm_t *) NULL; - } -} - -int -AudioDriversALSA::initDevice (DeviceMode mode) { - int err; - - if (devstate == DeviceOpened) { - error->errorName(DEVICE_ALREADY_OPEN, NULL); - return -1; - } - - // Open the audio device - switch (mode) { - case ReadOnly: - /* Only read sound from the device */ - err = snd_pcm_open (&audio_hdl, ALSA_DEVICE,SND_PCM_STREAM_CAPTURE, - SND_PCM_NONBLOCK); - break; - - case WriteOnly: - /* Only write sound to the device */ - err = snd_pcm_open (&audio_hdl, ALSA_DEVICE,SND_PCM_STREAM_PLAYBACK, - SND_PCM_NONBLOCK); - break; - default: - break; - } - - if (err < 0) { - _debug ("ERROR: ALSA/snd_pcm_open: Cannot open audio device (%s)\n", - snd_strerror (err)); - error->errorName(OPEN_FAILED_DEVICE, NULL); - return -1; - } - //////////////////////////////////////////////////////////////////////////// - // BEGIN DEVICE SETUP - //////////////////////////////////////////////////////////////////////////// - // Allocate space for device configuration - snd_pcm_hw_params_t *hw_params; - - err = snd_pcm_hw_params_malloc (&hw_params); - if (err < 0) { - _debug ("Cannot allocate hardware parameter structure (%s)\n", - snd_strerror (err)); - error->errorName(PARAMETER_STRUCT_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - - // Init hwparams with full configuration space - if ((err = snd_pcm_hw_params_any (audio_hdl, hw_params)) < 0) { - _debug ("Cannot initialize hardware parameter structure (%s)\n", - snd_strerror (err)); - error->errorName(PARAMETER_STRUCT_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - - err = snd_pcm_hw_params_set_access (audio_hdl, hw_params, - SND_PCM_ACCESS_RW_INTERLEAVED); - if (err < 0) { - _debug ("Cannot set access type (%s)\n", snd_strerror (err)); - error->errorName(ACCESS_TYPE_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - - // Set sample formats (Signed, 16Bits, little endian) - err = snd_pcm_hw_params_set_format (audio_hdl, hw_params, - SND_PCM_FORMAT_S16_LE); - if (err < 0) { - _debug ("Cannot set sample format (%s)\n", snd_strerror (err)); - error->errorName(SAMPLE_FORMAT_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - - unsigned int rate = SAMPLING_RATE; - unsigned int exact_rate; - - exact_rate = rate; - // Set sampling rate (8kHz) - err = snd_pcm_hw_params_set_rate_near (audio_hdl, hw_params, - &exact_rate, 0); - if (err < 0) { - _debug ("Cannot set sample rate (%s)\n", snd_strerror (err)); - error->errorName(SAMPLE_RATE_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - if (exact_rate != rate) { - _debug("The rate %d Hz is not supported by your hardware.\n ==> Using %d Hz instead.\n", rate, exact_rate); - } - - // Set number of channels - Mono(1) or Stereo(2) - err = snd_pcm_hw_params_set_channels (audio_hdl, hw_params, MONO); - if (err < 0) { - _debug ("Cannot set channel count (%s)\n", snd_strerror (err)); - error->errorName(CHANNEL_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - - // Apply previously setup parameters - err = snd_pcm_hw_params (audio_hdl, hw_params); - if (err < 0) { - _debug ("Cannot set parameters (%s)\n", snd_strerror (err)); - error->errorName(PARAM_SETUP_ALSA, (char*)snd_strerror(err)); - return -1; - } - - // Free temp variable used for configuration. - snd_pcm_hw_params_free (hw_params); - - //////////////////////////////////////////////////////////////////////////// - // END DEVICE SETUP - //////////////////////////////////////////////////////////////////////////// - - // Success - devstate = DeviceOpened; - return 0; -} - -int -AudioDriversALSA::writeBuffer (void) { - if (devstate != DeviceOpened) { - error->errorName(DEVICE_NOT_OPEN, NULL); - return -1; - } - - int rc; - size_t count = audio_buf.getSize()/2; - short* buf = (short *)audio_buf.getData(); - while (count > 0) { - rc = snd_pcm_writei(audio_hdl, buf, count); - snd_pcm_wait(audio_hdl, 1); - if (rc == -EPIPE) { - snd_pcm_prepare(audio_hdl); - } else if (rc == -EAGAIN) { - continue; - } else if (rc < 0) { - break; - } - buf += rc; - count -= rc; - } - return rc; -} - -int -AudioDriversALSA::readBuffer (void *ptr, int bytes) { - if( devstate != DeviceOpened ) { - error->errorName(DEVICE_NOT_OPEN, NULL); - return -1; - } - - ssize_t count = bytes; - ssize_t rc; - do { - rc = snd_pcm_readi(audio_hdl, (short*)ptr, count); - } while (rc == -EAGAIN); - if (rc == -EPIPE) { - snd_pcm_prepare(audio_hdl); - bzero(ptr, bytes); - rc = 320; - } - if (rc != 320) - rc = rc * 2; - return rc; -} - -int -AudioDriversALSA::resetDevice (void) { - int err; - - _debug("Resetting...\n"); - if ((err = snd_pcm_drop(audio_hdl)) < 0) { - _debug ("ALSA: drop() error: %s\n", snd_strerror (err)); - error->errorName(DROP_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - - if ((err = snd_pcm_prepare(audio_hdl)) < 0) { - _debug ("ALSA: prepare() error: %s\n", snd_strerror (err)); - error->errorName(PREPARE_ERROR_ALSA, (char*)snd_strerror(err)); - return -1; - } - return 0; -} - -//#endif // defined(AUDIO_ALSA) -// EOF diff --git a/src/audio/audiodriversalsa.h b/src/audio/audiodriversalsa.h deleted file mode 100644 index 8f4e7ade34c0fcb1987328d0e35c175433d99f67..0000000000000000000000000000000000000000 --- a/src/audio/audiodriversalsa.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -//#ifdef AUDIO_ALSA - -#ifndef _AUDIO_DRIVERS_ALSA_H_ -#define _AUDIO_DRIVERS_ALSA_H_ - -#include <alsa/asoundlib.h> - -#include "audiodrivers.h" -#include "../error.h" - - -/** - * This is the ALSA implementation of DspOut. - * Note that you cannot change how many fragments - * this class requests, yet. - */ -class AudioDriversALSA : public AudioDrivers { -public: - /** - * Constructs a AudioDriversALSA object representing the given - * filename. Default is /dev/dsp. - */ - AudioDriversALSA(DeviceMode, Error*); - - /** - * Destructor. Will close the device if it is open. - */ - virtual ~AudioDriversALSA( void ); - - int initDevice (DeviceMode); - int resetDevice (void); - int writeBuffer (void); - int readBuffer (void *, int); - unsigned int readableBytes (void) { return 0; } - -private: - Error * error; - - snd_pcm_t *audio_hdl; - void closeDevice (void); -}; - -#endif // _AUDIO_DRIVERS_ALSA_H_ - -//#endif // defined(AUDIO_ALSA) diff --git a/src/audio/audiodriversoss.cpp b/src/audio/audiodriversoss.cpp deleted file mode 100644 index b762ffe2165bbdf3caa364729349210562c2695b..0000000000000000000000000000000000000000 --- a/src/audio/audiodriversoss.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#if defined(AUDIO_OSS) - -#include <errno.h> -#include <string.h> -#include <sys/ioctl.h> -#include <sys/fcntl.h> -#include <sys/soundcard.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <sys/unistd.h> - -#include <stdio.h> - -#include "audiodriversoss.h" -#include "../global.h" - - -AudioDriversOSS::AudioDriversOSS (DeviceMode mode, Error *error) : - AudioDrivers () { - this->error = error; - audio_fd = -1; - initDevice(mode); -} - -AudioDriversOSS::~AudioDriversOSS (void) { - if (audio_fd > 0) { - this->closeDevice(); - } -} - -int -AudioDriversOSS::resetDevice (void) { - _debug ("Resetting...\n"); - if (ioctl(audio_fd, SNDCTL_DSP_RESET) < 0) { - perror("ioctl"); - return -1; - } - return 0; -} - -int -AudioDriversOSS::initDevice (DeviceMode mode) { - int oflag; - switch (mode) { - case ReadOnly: - oflag = O_RDONLY; - break; - case WriteOnly: - oflag = O_WRONLY; - break; - default: - oflag = O_RDWR; - break; - } - - if (devstate == DeviceOpened) { - error->errorName(DEVICE_ALREADY_OPEN, NULL); - return -1; - } - - // Open device in non-blocking mode - audio_fd = open (AUDIO_DEVICE, oflag | O_NONBLOCK ); - if (audio_fd == -1) { - error->errorName(OPEN_FAILED_DEVICE, NULL); - return -1; - } - - // Remove O_NONBLOCK - int flags = fcntl(audio_fd, F_GETFL) & ~O_NONBLOCK; - fcntl (audio_fd, F_SETFL, flags); - - // Fragments : No limit (0x7FFF), - int frag = ( ( 0x7FFF << 16 ) | 7 ); - if (ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag)) { - _debug ("ERROR: SETFRAG %s\n", strerror(errno)); - error->errorName(FRAGMENT_ERROR_OSS, strerror(errno)); - return -1; - } - - // Setup sample format 16 bit signed little endian - int format; - format = AFMT_S16_LE; - - if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format) == -1) { - _debug("ERROR: SETFMT %s\n", strerror(errno)); - error->errorName(SAMPLE_FORMAT_ERROR_OSS, strerror(errno)); - return -1; - } - if (format != AFMT_S16_LE) { - _debug ("ERROR: Format not supported\n"); - return -1; - } - - // Setup number of channels - int channels = MONO; - if (ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels) == -1) { - _debug ("ERROR: DSP_STEREO %s\n", strerror(errno)); - error->errorName(CHANNEL_ERROR_OSS, strerror(errno)); - return -1; - } - if (channels != MONO) { - _debug ("ERROR: Unsupported Number of Channels\n"); - return -1; - } - - // Setup sampling rate 8KHz - int rate = SAMPLING_RATE; - if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate ) == -1 ) { - _debug ("ERROR: DSP_SPEED %s\n", strerror(errno)); - error->errorName(SAMPLE_RATE_ERROR_OSS, strerror(errno)); - return -1; - } - - if (rate != SAMPLING_RATE) { - _debug ("WARNING: driver rounded %d Hz request to %d Hz, off by %f%%\n" - , 8000, rate, 100*((rate-8000)/8000.0)); - } - - // Buffering parameters - audio_buf_info info; - if (mode == WriteOnly) { - if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) == -1) { - _debug ("ERROR: GETISPACE %s\n", strerror(errno)); - error->errorName(GETISPACE_ERROR_OSS, strerror(errno)); - return -1; - } - } else { - if (ioctl(audio_fd, SNDCTL_DSP_GETISPACE, &info ) == -1) { - _debug ("ERROR: GETOSPACE %s\n", strerror(errno)); - error->errorName(GETOSPACE_ERROR_OSS, strerror(errno)); - return -1; - } - } -// audio_buf.resize (info.fragsize * sizeof(short)); - devstate = DeviceOpened; - - return 0; -} - -int -AudioDriversOSS::closeDevice (void) { - close (audio_fd); - audio_fd = -1; - return 1; -} - -bool -AudioDriversOSS::openDevice (int exist_fd) { - audio_fd = exist_fd; - if (audio_fd == -1) { - _debug ("ERROR: Open Failed\n"); - return false; - } - - audio_buf_info info; - if (ioctl(audio_fd, SNDCTL_DSP_GETISPACE, &info) == -1) { - _debug ("ERROR: GETISPACE %s\n", strerror(errno)); - return false; - } -// audio_buf.resize (info.fragsize * sizeof(short)); - - - devstate = DeviceOpened; - return true; -} - - -int -AudioDriversOSS::readBuffer (void *ptr, int bytes) { - if( devstate != DeviceOpened ) { - return false; - } - ssize_t count = bytes; - ssize_t rc; - - rc = read (audio_fd, ptr, count); - if (rc < 0) { - _debug ("rc < 0 read(): %s\n", strerror(errno)); - } - - else if (rc != count) { - _debug ("WARNING: asked microphone for %d got %d\n", count, rc); - } - - return rc; -} - - -int -AudioDriversOSS::writeBuffer (void) { - if (devstate != DeviceOpened ) { - error->errorName(DEVICE_NOT_OPEN, NULL); - return -1; - } - - size_t count = audio_buf.getSize(); - short *buf = (short*)audio_buf.getData(); - - audio_buf_info info; - if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) == 0 ) { - if (info.fragstotal - info.fragments > 15) { - // drop the fragment if the buffer starts to fill up - return 1; - } - } - // Loop into write() while buffer not complete. - for (;;) { - int a; - if ((a = write(audio_fd, buf, count)) < 0) { - _debug ("write(): %s\n", strerror(errno)); - break; - } - if (a > 0) { - return a; - break; - } - } - return 1; -} - - -unsigned int -AudioDriversOSS::readableBytes(void) { - audio_buf_info info; - struct timeval timeout; - fd_set read_fds; - - if (devstate != DeviceOpened) { - return 0; - } - - timeout.tv_sec = 0; - timeout.tv_usec = 0; - FD_ZERO( &read_fds ); - FD_SET( audio_fd, &read_fds ); - - if (select (audio_fd + 1, &read_fds, NULL, NULL, &timeout) == -1) { - return 0; - } - if (!FD_ISSET (audio_fd, &read_fds)) { - return 0; - } - if (ioctl (audio_fd, SNDCTL_DSP_GETISPACE, &info) == -1) { - _debug ("ERROR: readableBytes %s\n", strerror(errno)); - return 0; - } - - return info.bytes; -} - -#endif // defined(AUDIO_OSS) - diff --git a/src/audio/audiodriversoss.h b/src/audio/audiodriversoss.h deleted file mode 100644 index dc33c764aec651fdbeaf6f4f1b97831d9d00df6b..0000000000000000000000000000000000000000 --- a/src/audio/audiodriversoss.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. - * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> - * - * Portions Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> - * Portions Copyright (c) 2004 Wirlab <kphone@wirlab.net> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#if defined(AUDIO_OSS) - -#ifndef _AUDIO_DRIVERS_OSS_H -#define _AUDIO_DRIVERS_OSS_H - - -#include "audiodrivers.h" -#include "../error.h" - -// TODO : a mettre dans config -#define AUDIO_DEVICE "/dev/dsp" - -class AudioDriversOSS : public AudioDrivers { -public: - AudioDriversOSS (DeviceMode, Error*); - ~AudioDriversOSS (void); - - int initDevice (DeviceMode); - int resetDevice (void); - bool openDevice (int); - int writeBuffer (void); - int readBuffer (void *, int); - unsigned int readableBytes (void); - - int audio_fd; -private: - int closeDevice (void); - Error * error; -}; - -#endif // _AUDIO_DRIVERS_OSS_H - -#endif // defined(AUDIO_OSS) diff --git a/src/audio/audiodriversportaudio.cpp b/src/audio/audiodriversportaudio.cpp deleted file mode 100644 index 1c1e8d2ddb43f1e49b2a473b6124db07df869e75..0000000000000000000000000000000000000000 --- a/src/audio/audiodriversportaudio.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/** - * Copyright (C) 2005 Savoir-Faire Linux inc. - * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifdef AUDIO_PORTAUDIO - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "audiodriversportaudio.h" -#include "../global.h" -#include "../manager.h" - -AudioDriversPortAudio::AudioDriversPortAudio (Manager* manager) { - _manager = manager; - mydata.urg_remain = 0; - mydata.dataIn = NULL; - mydata.dataOut = NULL; - mydata.urg_data = NULL; - this->initDevice(); -} - -// Destructor -AudioDriversPortAudio::~AudioDriversPortAudio (void) -{ - closeDevice(); - Pa_Terminate (); -} - -int -AudioDriversPortAudio::resetDevice (void) { - return 1; -} - -int -AudioDriversPortAudio::initDevice (void) { - int err; - - err = Pa_Initialize(); - if (err != paNoError) { - _debug ("PortAudio error in Pa_Initialize(): %s\n", Pa_GetErrorText(err)); - exit (1); - //TODO: change exit to a clean GUI dialog (fatal). - } - return 1; -} - -int -AudioDriversPortAudio::closeDevice (void) { - int err = Pa_CloseStream(_stream); - if (err != paNoError) { - _debug ("PortAudio error in Pa_CloseStream: %s\n", Pa_GetErrorText(err)); - exit (1); - //TODO: change exit to a clean GUI dialog (fatal). - } - return 1; -} - -bool -AudioDriversPortAudio::openDevice (void) { - int err = Pa_OpenDefaultStream ( - &_stream, /* passes back stream pointer */ - 2, /* input channel */ - 2, /* output channel */ - paFloat32, /* 32 bit float output */ - SAMPLING_RATE, /* sample rate */ - FRAME_PER_BUFFER, /* frames per buffer */ - audioCallback, /* specify our custom callback */ - &mydata); /* pass our data through to callback */ - - if (err != paNoError) { - _debug ("PortAudio error in Pa_OpenDefaultStream: %s\n", Pa_GetErrorText(err)); - exit (1); - //TODO: change exit to a clean GUI dialog (fatal). - } - return true; -} - - -int -AudioDriversPortAudio::readBuffer (void *ptr, int bytes) { - (void) ptr; - (void) bytes; - return 1; -} - -int -AudioDriversPortAudio::writeBuffer (void *ptr, int len) { - (void) ptr; - (void) len; - return 1; -} - -int -AudioDriversPortAudio::startStream(void) -{ - int err; - if (!Pa_IsStreamActive(_stream)) { - err = Pa_StartStream (_stream); - if( err != paNoError ) { - _debug ("PortAudio error in Pa_StartStream: %s\n", - Pa_GetErrorText(err)); - return 0; - } - } - - return 1; -} - -int -AudioDriversPortAudio::stopStream(void) -{ - int err; - - if (!Pa_IsStreamStopped(_stream)) { - err = Pa_StopStream (_stream); - if( err != paNoError ) { - _debug ("PortAudio error in Pa_StopStream: %s\n", - Pa_GetErrorText(err)); - return 0; - } - } - - return 1; -} - -void -AudioDriversPortAudio::sleep(int msec) -{ - Pa_Sleep(msec); -} - -int -AudioDriversPortAudio::isStreamActive (void) -{ - return Pa_IsStreamActive (_stream); -} - -int -AudioDriversPortAudio::isStreamStopped (void) -{ - return Pa_IsStreamStopped (_stream); -} - -int -AudioDriversPortAudio::getDeviceCount (void) -{ - return Pa_GetDeviceCount(); -} - -int -AudioDriversPortAudio::audioCallback (const void *inputBuffer, - void *outputBuffer, - unsigned long framesPerBuffer, - const PaStreamCallbackTimeInfo* timeInfo, - PaStreamCallbackFlags statusFlags, - void *userData) { - (void) timeInfo; - (void) statusFlags; - - float32 *in = (float32 *) inputBuffer; - float32 *out = (float32 *) outputBuffer; - - paData* data = (paData*) userData; - int i; - int it; - - /* Fill output buffer */ - for (i = 0; i < (int)framesPerBuffer; i++) { - it = 2*i; - if (data->urg_remain - i > 0) { - out[it] = out[it+1] = data->urg_ptr[i]; - } else { - out[it] = out[it+1] = data->dataOut[i]; - } - } - - if ((data->urg_remain -i) > 0) { - data->urg_ptr +=i; - data->urg_remain-= i; - } else { - data->urg_remain = 0; - } - - /* Read input buffer */ - if (data->dataIn != NULL) { - memcpy (data->dataIn, in, 2*sizeof(float32) * framesPerBuffer); - } - - return paContinue; -} -#endif // defined(AUDIO_PORTAUDIO) - diff --git a/src/audio/audiolayer.cpp b/src/audio/audiolayer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bfc626bcb68e6386855d769141f3b8b415c9dd74 --- /dev/null +++ b/src/audio/audiolayer.cpp @@ -0,0 +1,172 @@ +/** + * Copyright (C) 2005 Savoir-Faire Linux inc. + * Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifdef AUDIO_PORTAUDIO + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "audiolayer.h" +#include "ringbuffer.h" +#include "../error.h" +#include "../global.h" +#include "../manager.h" + +using namespace std; + +AudioLayer::AudioLayer (Manager* manager) { + _manager = manager; + initDevice(); + + _urgentRingBuffer = new RingBuffer(SIZEBUF); + _mainSndRingBuffer = new RingBuffer(SIZEBUF); + _micRingBuffer = new RingBuffer(SIZEBUF); +} + +// Destructor +AudioLayer::~AudioLayer (void) +{ + closeStream(); + autoSys->terminate(); + + delete autoSys; + delete _urgentRingBuffer; + delete _mainSndRingBuffer; + delete _micRingBuffer; + +} + +void +AudioLayer::initDevice (void) { + autoSys = new portaudio::AutoSystem(); + autoSys->initialize(); +} + +void +AudioLayer::closeStream (void) { + _stream->close(); +} + +void +AudioLayer::openDevice (int index) +{ + // Set up the System: + portaudio::System &sys = portaudio::System::instance(); + + // Set up the parameters required to open a (Callback)Stream: + portaudio::DirectionSpecificStreamParameters outParams( + sys.deviceByIndex(index), 2, portaudio::INT16, true, + sys.deviceByIndex(index).defaultLowOutputLatency(), NULL); + + portaudio::DirectionSpecificStreamParameters inParams( + sys.deviceByIndex(index), 2, portaudio::INT16, true, + sys.deviceByIndex(index).defaultLowInputLatency(), NULL); + + portaudio::StreamParameters const params(inParams, outParams, + SAMPLING_RATE, FRAME_PER_BUFFER, paNoFlag); + + // Create (and open) a new Stream, using the AudioLayer::audioCallback + _stream = new portaudio::MemFunCallbackStream<AudioLayer>( + params, *this, &AudioLayer::audioCallback); +} + +void +AudioLayer::startStream(void) +{ + if (_manager->isDriverLoaded()) { + if (!_stream->isActive()) { + _stream->start(); + } + } +} + +void +AudioLayer::stopStream(void) +{ + if (_manager->isDriverLoaded()) { + if (!_stream->isStopped()) { + _stream->stop(); + } + } +} + +void +AudioLayer::sleep(int msec) +{ + portaudio::System &sys = portaudio::System::instance(); + sys.sleep(msec); +} + +int +AudioLayer::isStreamActive (void) +{ + return _stream->isActive(); +} + +int +AudioLayer::isStreamStopped (void) +{ + return _stream->isStopped(); +} + +int +AudioLayer::audioCallback (const void *inputBuffer, void *outputBuffer, + unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo *timeInfo, + PaStreamCallbackFlags statusFlags) { + (void) timeInfo; + (void) statusFlags; + + int16 *in = (int16 *) inputBuffer; + int16 *out = (int16 *) outputBuffer; + int toGet, toPut, urgentAvail, normalAvail, micAvailPut; + + urgentAvail = _urgentRingBuffer->AvailForGet(); + if (urgentAvail > 0) { + // Urgent data (dtmf, incoming call signal) come first. + if (urgentAvail < (int)framesPerBuffer) { + toGet = urgentAvail; + } else { + toGet = framesPerBuffer; + } + _urgentRingBuffer->Get(out, SAMPLES_SIZE(toGet)); + + // Consume the regular one as well + _mainSndRingBuffer->Discard(SAMPLES_SIZE(toGet)); + } + else { + // If nothing urgent, play the regular sound samples + normalAvail = _mainSndRingBuffer->AvailForGet(); + toGet = (normalAvail < (int)framesPerBuffer) ? normalAvail : + framesPerBuffer; + _mainSndRingBuffer->Get(out, SAMPLES_SIZE(toGet)); + } + + // Additionally handle the mike's audio stream + micAvailPut = _micRingBuffer->AvailForPut(); + toPut = (micAvailPut <= (int)framesPerBuffer) ? micAvailPut : + framesPerBuffer; + _micRingBuffer->Put(in, SAMPLES_SIZE(toPut)); + + return paContinue; +} + +#endif // defined(AUDIO_PORTAUDIO) + diff --git a/src/audio/audiodriversportaudio.h b/src/audio/audiolayer.h similarity index 53% rename from src/audio/audiodriversportaudio.h rename to src/audio/audiolayer.h index 2a9759b0b02e7c0d4efb87d2004c09e126884d2c..4ff749efd61e330ef615bf4055539f0057e708b3 100644 --- a/src/audio/audiodriversportaudio.h +++ b/src/audio/audiolayer.h @@ -17,53 +17,56 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "../global.h" -#ifdef AUDIO_PORTAUDIO +#if defined(AUDIO_PORTAUDIO) + +#ifndef _AUDIO_LAYER_H +#define _AUDIO_LAYER_H -#ifndef _AUDIO_DRIVERS_PORTAUDIO_H -#define _AUDIO_DRIVERS_PORTAUDIO_H +#include "portaudiocpp/PortAudioCpp.hxx" -#include <portaudio.h> -#define TABLE_SIZE 360 +#include "../global.h" + #define FRAME_PER_BUFFER 160 +#define MIC_CHANNELS 2 // 1=mono 2=stereo +#define SAMPLE_BYTES sizeof(int16) +#define SAMPLES_SIZE(i) (i * MIC_CHANNELS * SAMPLE_BYTES) + +class RingBuffer; class Manager; -class AudioDriversPortAudio { + +class AudioLayer { public: - struct paData { - float32 *dataIn; // From mic - float32 *dataOut; // To spk - float32 *urg_data; // data in priority - float32 *urg_ptr; - int urg_remain; // data remained in urg_data - }; - paData mydata; - - AudioDriversPortAudio (Manager*); - ~AudioDriversPortAudio (void); - - int resetDevice (void); - int initDevice (void); - bool openDevice (void); - int writeBuffer (void *, int); - int readBuffer (void *, int); - int startStream (void); - int stopStream (void); + AudioLayer (Manager*); + ~AudioLayer (void); + + void initDevice (void); + void openDevice (int); + void startStream (void); + void stopStream (void); void sleep (int); int isStreamActive (void); int isStreamStopped (void); - int getDeviceCount (void); - static int audioCallback (const void *, void *, unsigned long, - const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags, void *); + int audioCallback (const void *, void *, unsigned long, + const PaStreamCallbackTimeInfo*, PaStreamCallbackFlags); + + inline RingBuffer* urgentRingBuffer(void) { return _urgentRingBuffer; } + inline RingBuffer* mainSndRingBuffer(void) { return _mainSndRingBuffer; } + inline RingBuffer* micRingBuffer(void) { return _micRingBuffer; } private: - int closeDevice (void); - Manager* _manager; - PaStream* _stream; + void closeStream (void); + Manager* _manager; + RingBuffer* _urgentRingBuffer; + RingBuffer* _mainSndRingBuffer; + RingBuffer* _micRingBuffer; + + portaudio::MemFunCallbackStream<AudioLayer> *_stream; + portaudio::AutoSystem *autoSys; }; -#endif // _AUDIO_DRIVERS_PORTAUDIO_H_ +#endif // _AUDIO_LAYER_H_ #endif // defined(AUDIO_PORTAUDIO) diff --git a/src/audio/audiortp.cpp b/src/audio/audiortp.cpp index 939d60571085b64d52bb734d123695b4e1a8daaf..83400b2f7f95bdc7a8991ff7038a609a8b205698 100644 --- a/src/audio/audiortp.cpp +++ b/src/audio/audiortp.cpp @@ -20,17 +20,21 @@ #include <cstdio> #include <cstdlib> #include <ccrtp/rtp.h> -#include <assert.h> +#include <assert.h> #include <iostream> #include <string> +#include "audiocodec.h" +#include "audiortp.h" +#include "audiolayer.h" +#include "codecDescriptor.h" +#include "ringbuffer.h" #include "../configuration.h" #include "../manager.h" #include "../global.h" #include "../user_cfg.h" #include "../sipcall.h" #include "../../stund/stun.h" -#include "audiortp.h" using namespace ost; using namespace std; @@ -40,21 +44,12 @@ using namespace std; // AudioRtp //////////////////////////////////////////////////////////////////////////////// AudioRtp::AudioRtp (Manager *manager) { - string svr; - _manager = manager; _RTXThread = NULL; - - if (!manager->useStun()) { - if (get_config_fields_str(SIGNALISATION, PROXY).empty()) { - svr = get_config_fields_str(SIGNALISATION, PROXY); - } - } else { - svr = get_config_fields_str(SIGNALISATION, HOST_PART); - } } AudioRtp::~AudioRtp (void) { + delete _RTXThread; } int @@ -70,6 +65,10 @@ AudioRtp::createNewSession (SipCall *ca) { _RTXThread = new AudioRtpRTX (ca, _manager->getAudioDriver(), _manager, _symetric); + // Start PortAudio + _manager->getAudioDriver()->micRingBuffer()->flush(); + _manager->getAudioDriver()->startStream(); + if (_RTXThread->start() != 0) { return -1; } @@ -88,15 +87,17 @@ AudioRtp::closeRtpSession (SipCall *ca) { delete _RTXThread; _RTXThread = NULL; } - // Flush audio read buffer + + // Stop portaudio and flush ringbuffer _manager->getAudioDriver()->stopStream(); + _manager->getAudioDriver()->mainSndRingBuffer()->flush(); } } //////////////////////////////////////////////////////////////////////////////// // AudioRtpRTX Class // //////////////////////////////////////////////////////////////////////////////// -AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDriversPortAudio* driver, +AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioLayer* driver, Manager *mngr, bool sym) { time = new Time(); _manager = mngr; @@ -107,19 +108,16 @@ AudioRtpRTX::AudioRtpRTX (SipCall *sipcall, AudioDriversPortAudio* driver, // TODO: Change bind address according to user settings. InetHostAddress local_ip("0.0.0.0"); + _debug("Audiortp localport : %d\n", _ca->getLocalAudioPort()); if (!_sym) { - _debug("Audiortp localport : %d\n", _ca->getLocalAudioPort()); _sessionRecv = new RTPSession (local_ip, _ca->getLocalAudioPort()); _sessionSend = new RTPSession (local_ip); } else { - int forcedPort = _manager->getFirewallPort(); - _session = new SymmetricRTPSession (local_ip, forcedPort); + _session = new SymmetricRTPSession (local_ip, _ca->getLocalAudioPort()); } } AudioRtpRTX::~AudioRtpRTX () { - terminate(); - if (!_sym) { if (_sessionRecv != NULL) { delete _sessionRecv; @@ -138,26 +136,8 @@ AudioRtpRTX::~AudioRtpRTX () { } void -AudioRtpRTX::run (void) { - unsigned char *data_to_send; - int16 *data_from_mic_int16; - float32 *data_mute; - float32 *data_from_mic; - float32 *data_from_mic_tmp; - int compSize, - timestamp; - int expandedSize; - int countTime = 0; - int16 *data_for_speakers = NULL; - float32 *data_for_speakers_float = NULL; - float32 *data_for_speakers_float_tmp = NULL; - - data_from_mic = new float32[1024]; - data_from_mic_tmp = new float32[1024]; - data_mute = new float32[1024]; - data_to_send = new unsigned char[1024]; - data_for_speakers = new int16[2048]; - +AudioRtpRTX::initAudioRtpSession (void) +{ InetHostAddress remote_ip(_ca->getRemoteSdpAudioIp()); if (!remote_ip) { @@ -209,6 +189,127 @@ AudioRtpRTX::run (void) { setCancel(cancelImmediate); } } +} + +void +AudioRtpRTX::sendSessionFromMic (unsigned char* data_to_send, int16* data_from_mic, int16* data_from_mic_tmp, int timestamp, int micVolume) +{ + int k; + int compSize; + + if (_manager->getCall(_ca->getId())->isOnMute() or + !_manager->isCurrentId(_ca->getId())) { + // Mute :send 0's over the network. + _manager->getAudioDriver()->micRingBuffer()->Get(data_from_mic, + RTP_FRAMES2SEND*2*sizeof(int16)); + } else { + // Control volume for micro + int availFromMic = _manager->getAudioDriver()->micRingBuffer()->AvailForGet(); + int bytesAvail; + if (availFromMic < (int)RTP_FRAMES2SEND) { + bytesAvail = availFromMic; + } else { + bytesAvail = (int)RTP_FRAMES2SEND; + } + + // Get bytes from micRingBuffer to data_from_mic + _manager->getAudioDriver()->micRingBuffer()->Get(data_from_mic, + SAMPLES_SIZE(bytesAvail)); + // control volume and stereo->mono + for (int j = 0; j < RTP_FRAMES2SEND; j++) { + k = j*2; + data_from_mic_tmp[j] = (int16)(0.5f*(data_from_mic[k] + + data_from_mic[k+1]) * + micVolume/100); + } + } + // Encode acquired audio sample + compSize = _ca->getAudioCodec()->codecEncode (data_to_send, + data_from_mic_tmp, + RTP_FRAMES2SEND*2); + // Send encoded audio sample over the network + if (!_sym) { + _sessionSend->putData(timestamp, data_to_send, compSize); + } else { + _session->putData(timestamp, data_to_send, compSize); + } + +} + +void +AudioRtpRTX::receiveSessionForSpkr (int16* data_for_speakers, + int16* data_for_speakers_tmp, int spkrVolume) +{ + int expandedSize; + int k; + int countTime = 0; + const AppDataUnit* adu = NULL; + + // Get audio data stream + do { + Thread::sleep(5); // in msec. + if (!_sym) { + adu = _sessionRecv->getData(_sessionRecv->getFirstTimestamp()); + } else { + adu = _session->getData(_session->getFirstTimestamp()); + } + } while (adu == NULL); + + // Decode data with relevant codec + CodecDescriptor* cd = new CodecDescriptor (adu->getType()); + + AudioCodec* ac = cd->alloc(adu->getType(), ""); + + expandedSize = ac->codecDecode (data_for_speakers, + (unsigned char*) adu->getData(), + adu->getSize()); + + // control volume for speakers and mono->stereo + for (int j = 0; j < expandedSize; j++) { + k = j*2; + data_for_speakers_tmp[k] = data_for_speakers_tmp[k+1]= + data_for_speakers[j] * spkrVolume/100; + } + + // If the current call is the call which is answered + if (_manager->isCurrentId(_ca->getId())) { + // Set decoded data to sound device + _manager->getAudioDriver()->mainSndRingBuffer()->Put(data_for_speakers_tmp, SAMPLES_SIZE(RTP_FRAMES2SEND)); + } + + // Notify (with a bip) an incoming call when there is already a call + countTime += time->getSecond(); + if (_manager->getNumberOfCalls() > 0 and _manager->getbRingtone()) { + countTime = countTime % 2000; + if (countTime < 10 and countTime > 0) { + _manager->notificationIncomingCall(); + } + } + _manager->getAudioDriver()->startStream(); + + delete cd; + delete adu; +} + +void +AudioRtpRTX::run (void) { + int micVolume; + int spkrVolume; + unsigned char *data_to_send; + int16 *data_from_mic; + int16 *data_from_mic_tmp; + int timestamp; + int16 *data_for_speakers = NULL; + int16 *data_for_speakers_tmp = NULL; + + data_from_mic = new int16[SIZEDATA]; + data_from_mic_tmp = new int16[SIZEDATA]; + data_to_send = new unsigned char[SIZEDATA]; + data_for_speakers = new int16[SIZEDATA]; + data_for_speakers_tmp = new int16[SIZEDATA*2]; + + // Init the session + initAudioRtpSession(); timestamp = 0; @@ -223,106 +324,35 @@ AudioRtpRTX::run (void) { } else { _session->startRunning(); } - + while (_ca->enable_audio != -1) { + // Store volume values + micVolume = _manager->getMicroVolume(); + spkrVolume = _manager->getSpkrVolume(); + //////////////////////////// // Send session //////////////////////////// - int size = 320; - if (!_manager->getCall(_ca->getId())->isOnMute()) { - _manager->getAudioDriver()->mydata.dataIn = data_from_mic; - } else { - // When IP-phone user click on mute button, we read buffer of a - // temp buffer to avoid delay in sound. - _manager->getAudioDriver()->mydata.dataIn = data_mute; - } + sendSessionFromMic(data_to_send, data_from_mic, data_from_mic_tmp, + timestamp, micVolume); - // Control volume for micro - for (int j = 0; j < size; j++) { - data_from_mic_tmp[j] = data_from_mic[j] * - _manager->getMicroVolume()/100; - } + timestamp += RTP_FRAMES2SEND; - // Convert float32 buffer to int16 to encode - data_from_mic_int16 = new int16[size]; - _ca->getAudioCodec()->float32ToInt16 (data_from_mic_tmp, - data_from_mic_int16, size); - - // Encode acquired audio sample - compSize = _ca->getAudioCodec()->codecEncode (data_to_send, - data_from_mic_int16, - size); - // Send encoded audio sample - if (!_sym) { - _sessionSend->putData(timestamp, data_to_send, compSize); - } else { - _session->putData(timestamp, data_to_send, compSize); - } - timestamp += MY_TIMESTAMP; //////////////////////////// // Recv session //////////////////////////// - const AppDataUnit* adu = NULL; - - do { - Thread::sleep(5); // in msec. - if (!_sym) { - adu = _sessionRecv->getData(_sessionRecv->getFirstTimestamp()); - } else { - adu = _session->getData(_session->getFirstTimestamp()); - } - } while (adu == NULL); - - // Decode data with relevant codec - CodecDescriptor* cd = new CodecDescriptor (adu->getType()); + receiveSessionForSpkr(data_for_speakers, data_for_speakers_tmp, + spkrVolume); - AudioCodec* ac = cd->alloc(adu->getType(), ""); - - expandedSize = ac->codecDecode (data_for_speakers, - (unsigned char*) adu->getData(), - adu->getSize()); - - // To convert int16 to float32 after decoding - data_for_speakers_float = new float32[expandedSize]; - ac->int16ToFloat32 (data_for_speakers, data_for_speakers_float, - expandedSize); - - // control volume for speakers - data_for_speakers_float_tmp = new float32[expandedSize]; - for (int j = 0; j < expandedSize; j++) { - data_for_speakers_float_tmp[j] = data_for_speakers_float[j] * - _manager->getSpkrVolume()/100; - } - // Set decoded data to sound device - _manager->getAudioDriver()->mydata.dataOut =data_for_speakers_float_tmp; - - // Notify (with a bip) an incoming call when there is already a call - countTime += time->getSecond(); - if (_manager->getNumberOfCalls() > 0 and _manager->getbRingtone()) { - countTime = countTime % 2000; - if (countTime < 10 and countTime > 0) { - _manager->notificationIncomingCall(); - } - } - - delete cd; - delete adu; - // Let's wait for the next transmit cycle Thread::sleep(TimerPort::getTimer()); TimerPort::incTimer(frameSize); // 'frameSize' ms - - // Start PortAudio - _manager->getAudioDriver()->startStream(); } delete[] data_for_speakers; - delete[] data_for_speakers_float; - delete[] data_for_speakers_float_tmp; + delete[] data_for_speakers_tmp; delete[] data_from_mic; - delete[] data_from_mic_int16; delete[] data_from_mic_tmp; - delete[] data_mute; delete[] data_to_send; exit(); } diff --git a/src/audio/audiortp.h b/src/audio/audiortp.h index dbb65b3d846ff11cf5c0eedd27f6760bba8f00f4..2bc9f8cee88cbe1dcd90573d4523018b38a74cf3 100644 --- a/src/audio/audiortp.h +++ b/src/audio/audiortp.h @@ -28,9 +28,10 @@ using namespace ost; -#define MY_TIMESTAMP 160 +#define RTP_FRAMES2SEND 160 +#define SIZEDATA SAMPLES_SIZE(RTP_FRAMES2SEND) -class AudioDriversPortAudio; +class AudioLayer; class Manager; class SipCall; @@ -39,7 +40,7 @@ class SipCall; /////////////////////////////////////////////////////////////////////////////// class AudioRtpRTX : public Thread, public TimerPort { public: - AudioRtpRTX (SipCall *, AudioDriversPortAudio*, Manager *, bool); + AudioRtpRTX (SipCall *, AudioLayer*, Manager *, bool); ~AudioRtpRTX(); Time *time; // For incoming call notification @@ -47,12 +48,16 @@ public: private: SipCall* _ca; - AudioDriversPortAudio* _audioDevice; + AudioLayer* _audioDevice; RTPSession* _sessionSend; RTPSession* _sessionRecv; SymmetricRTPSession* _session; Manager* _manager; bool _sym; + + void initAudioRtpSession (void); + void sendSessionFromMic (unsigned char*, int16*, int16*, int, int); + void receiveSessionForSpkr (int16*, int16*, int); }; /////////////////////////////////////////////////////////////////////////////// diff --git a/src/audio/codecDescriptor.cpp b/src/audio/codecDescriptor.cpp index e4b36f40a6067d034e61f82ec9bcbeb6e1aafdc8..4c7daeab1b5412aef5dc66aa5bd845325baf786b 100644 --- a/src/audio/codecDescriptor.cpp +++ b/src/audio/codecDescriptor.cpp @@ -25,6 +25,14 @@ #include "ulaw.h" #include "codecDescriptor.h" + +const char* CODEC_ALAW = "G711a"; +const char* CODEC_ULAW = "G711u"; +const char* CODEC_GSM = "GSM"; +const char* CODEC_ILBC = "iLBC"; +const char* CODEC_SPEEX = "SPEEX"; + + CodecDescriptor::CodecDescriptor (int payload) { _payload = payload; diff --git a/src/audio/codecDescriptor.h b/src/audio/codecDescriptor.h index 81370da8c341dbc7e8796e81310531a7249710a3..e3e63e36a5c03086bd729eaa31f7494abf785d9d 100644 --- a/src/audio/codecDescriptor.h +++ b/src/audio/codecDescriptor.h @@ -33,12 +33,6 @@ typedef enum { PAYLOAD_CODEC_SPEEX = 110 } codecType; -#define CODEC_ALAW string("G711a") -#define CODEC_ULAW string("G711u") -#define CODEC_GSM string("GSM") -#define CODEC_ILBC string("iLBC") -#define CODEC_SPEEX string("SPEEX") - class AudioCodec; class CodecDescriptor diff --git a/src/audio/dtmf.cpp b/src/audio/dtmf.cpp index fc596cb010a7549041dad33f5ad0a665f3ac6b96..d0b9cd39ee3f9be115b0a762b7e92669144e3c3f 100644 --- a/src/audio/dtmf.cpp +++ b/src/audio/dtmf.cpp @@ -36,7 +36,7 @@ DTMF::startTone (char code) { } bool -DTMF::generateDTMF (float32* buffer, size_t n) { +DTMF::generateDTMF (int16* buffer, size_t n) { if (!buffer) return false; if (currentTone != 0) { diff --git a/src/audio/dtmf.h b/src/audio/dtmf.h index 0fdee6a08743a6cb53a420e6d88c8efd5175dcd8..bddc409a2e790fed3715c4acfbd4ed9df71581e6 100644 --- a/src/audio/dtmf.h +++ b/src/audio/dtmf.h @@ -32,7 +32,7 @@ public: ~DTMF (void); void startTone (char); - bool generateDTMF (float32*, size_t); + bool generateDTMF (int16*, size_t); char currentTone; char newTone; diff --git a/src/audio/dtmfgenerator.cpp b/src/audio/dtmfgenerator.cpp index 169bfc9e467e21a525373577a1673a701e4ff135..7d1d87e57a0cbd203d699316f071a4f09c41d9a5 100644 --- a/src/audio/dtmfgenerator.cpp +++ b/src/audio/dtmfgenerator.cpp @@ -92,10 +92,10 @@ DTMFGenerator::~DTMFGenerator() { /* * Get n samples of the signal of code code */ -void DTMFGenerator::getSamples(float32* buffer, size_t n, unsigned char code) throw(DTMFException) { +void DTMFGenerator::getSamples(int16* buffer, size_t n, unsigned char code) throw(DTMFException) { size_t i; if (!buffer) { - // throw DTMFException("Invalid parameter value"); + throw DTMFException("Invalid parameter value"); } switch(code) { @@ -120,7 +120,7 @@ void DTMFGenerator::getSamples(float32* buffer, size_t n, unsigned char code) th case '*': state.sample = samples[14]; break; case '#': state.sample = samples[15]; break; default: - // throw DTMFException("Invalid code"); + throw DTMFException("Invalid code"); return; break; } @@ -137,17 +137,17 @@ void DTMFGenerator::getSamples(float32* buffer, size_t n, unsigned char code) th * Get next n samples (continues where previous call to * genSample or genNextSamples stopped */ -void DTMFGenerator::getNextSamples(float32* buffer, size_t n) throw(DTMFException) +void DTMFGenerator::getNextSamples(int16* buffer, size_t n) throw(DTMFException) { size_t i; if (!buffer) { - // throw DTMFException("Invalid parameter"); + throw DTMFException("Invalid parameter"); return; } if (state.sample == 0) { - // throw DTMFException("DTMF generator not initialized"); + throw DTMFException("DTMF generator not initialized"); return; } @@ -162,22 +162,22 @@ void DTMFGenerator::getNextSamples(float32* buffer, size_t n) throw(DTMFExceptio /* * Generate a tone sample */ -float32* DTMFGenerator::generateSample(unsigned char code) throw (DTMFException) { - float32* ptr; +int16* DTMFGenerator::generateSample(unsigned char code) throw (DTMFException) { + int16* ptr; - // try { - ptr = new float32[SAMPLING_RATE]; + try { + ptr = new int16[SAMPLING_RATE]; if (!ptr) { - //throw new DTMFException("No memory left"); + throw new DTMFException("No memory left"); return 0; } generateSin(tones[code].higher, tones[code].lower, ptr); return ptr; - // } catch(...) { - // throw new DTMFException("No memory left"); - // return 0; - // } + } catch(...) { + throw new DTMFException("No memory left"); + return 0; + } } diff --git a/src/audio/dtmfgenerator.h b/src/audio/dtmfgenerator.h index a07201039cd1604e7f22c3b269129859e3bef77f..798729b3691fbb6cf7ac7d4763283f29705a403c 100644 --- a/src/audio/dtmfgenerator.h +++ b/src/audio/dtmfgenerator.h @@ -62,13 +62,13 @@ private: */ struct DTMFState { unsigned int offset; // Offset in the sample currently being played - float32* sample; // Currently generated code + int16* sample; // Currently generated code }; DTMFState state; static const DTMFTone tones[NUM_TONES]; - float32* samples[NUM_TONES]; // Generated samples + int16* samples[NUM_TONES]; // Generated samples public: DTMFGenerator(); @@ -77,16 +77,16 @@ public: /* * Get n samples of the signal of code code */ - void getSamples(float32* buffer, size_t n, unsigned char code) throw (DTMFException); + void getSamples(int16* buffer, size_t n, unsigned char code) throw (DTMFException); /* * Get next n samples (continues where previous call to * genSample or genNextSamples stopped */ - void getNextSamples(float32* buffer, size_t n) throw (DTMFException); + void getNextSamples(int16* buffer, size_t n) throw (DTMFException); private: - float32* generateSample(unsigned char code) throw (DTMFException); + int16* generateSample(unsigned char code) throw (DTMFException); }; diff --git a/src/audio/gsm/Makefile.am b/src/audio/gsm/Makefile.am index f34fce856a9e7967e5c7d428017fe664bee95171..fa024619ac14ccb38dd076e0088d36d90ea30137 100644 --- a/src/audio/gsm/Makefile.am +++ b/src/audio/gsm/Makefile.am @@ -1,4 +1,3 @@ - EXTRA_DIST = ChangeLog INSTALL MACHINES MANIFEST README COPYRIGHT noinst_LTLIBRARIES = libgsm.la diff --git a/src/audio/gsmcodec.cpp b/src/audio/gsmcodec.cpp index 26f6987025daf4ddbe955e1e7f6ac0c34085a796..9f18951de4d7cae9779dc6f989eb31847f35613b 100644 --- a/src/audio/gsmcodec.cpp +++ b/src/audio/gsmcodec.cpp @@ -18,8 +18,8 @@ */ #include <iostream> -#include "../global.h" #include "gsmcodec.h" +#include "../global.h" Gsm::Gsm(int payload, const string& codec) : AudioCodec(payload, codec) { @@ -27,7 +27,7 @@ Gsm::Gsm(int payload, const string& codec) : AudioCodec(payload, codec) _payload = payload; if (!(_decode_gsmhandle = gsm_create() )) - _debug("AudioCodec: ERROR: decode_gsm_create\n"); + _debug("ERROR: decode_gsm_create\n"); if (!(_encode_gsmhandle = gsm_create() )) _debug("AudioCodec: ERROR: encode_gsm_create\n"); } @@ -36,11 +36,13 @@ Gsm::~Gsm (void) { gsm_destroy(_decode_gsmhandle); gsm_destroy(_encode_gsmhandle); + } int Gsm::codecDecode (short *dst, unsigned char *src, unsigned int size) { + (void)size; if (gsm_decode(_decode_gsmhandle, (gsm_byte*)src, (gsm_signal*)dst) < 0) { _debug("ERROR: gsm_decode\n"); } @@ -50,6 +52,7 @@ Gsm::codecDecode (short *dst, unsigned char *src, unsigned int size) int Gsm::codecEncode (unsigned char *dst, short *src, unsigned int size) { + (void)size; gsm_encode(_encode_gsmhandle, (gsm_signal*)src, (gsm_byte*)dst); return 33; } diff --git a/src/audio/gsmcodec.h b/src/audio/gsmcodec.h index 1a433bd0f1ed16aac388eadc714edd675d266778..03fcd3542731a337c43a1713df34632d482275de 100644 --- a/src/audio/gsmcodec.h +++ b/src/audio/gsmcodec.h @@ -21,7 +21,6 @@ #define __GSM_H__ #include "audiocodec.h" - extern "C" { #include "gsm/gsm.h" } diff --git a/src/audio/pa_converters.h b/src/audio/pa_converters.h deleted file mode 100644 index 1d83c990bb48f3355801019aa914062d982bbefd..0000000000000000000000000000000000000000 --- a/src/audio/pa_converters.h +++ /dev/null @@ -1,254 +0,0 @@ -#ifndef PA_CONVERTERS_H -#define PA_CONVERTERS_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 used to convert buffers of samples from one - format to another. -*/ - - -#include "portaudio.h" /* for PaSampleFormat */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - -struct PaUtilTriangularDitherGenerator; - - -/** Choose an available sample format which is most appropriate for - representing the requested format. If the requested format is not available - higher quality formats are considered before lower quality formates. - @param availableFormats A variable containing the logical OR of all available - formats. - @param format The desired format. - @return The most appropriate available format for representing the requested - format. -*/ -PaSampleFormat PaUtil_SelectClosestAvailableFormat( - PaSampleFormat availableFormats, PaSampleFormat format ); - - -/* high level conversions functions for use by implementations */ - - -/** The generic sample converter prototype. Sample converters convert count - samples from sourceBuffer to destinationBuffer. The actual type of the data - pointed to by these parameters varys for different converter functions. - @param destinationBuffer A pointer to the first sample of the destination. - @param destinationStride An offset between successive destination samples - expressed in samples (not bytes.) It may be negative. - @param sourceBuffer A pointer to the first sample of the source. - @param sourceStride An offset between successive source samples - expressed in samples (not bytes.) It may be negative. - @param count The number of samples to convert. - @param ditherState State information used to calculate dither. Converters - that do not perform dithering will ignore this parameter, in which case - NULL or invalid dither state may be passed. -*/ -typedef void PaUtilConverter( - void *destinationBuffer, signed int destinationStride, - void *sourceBuffer, signed int sourceStride, - unsigned int count, struct PaUtilTriangularDitherGenerator *ditherGenerator ); - - -/** Find a sample converter function for the given source and destinations - formats and flags (clip and dither.) - @return - A pointer to a PaUtilConverter which will perform the requested - conversion, or NULL if the given format conversion is not supported. - For conversions where clipping or dithering is not necessary, the - clip and dither flags are ignored and a non-clipping or dithering - version is returned. - If the source and destination formats are the same, a function which - copies data of the appropriate size will be returned. -*/ -PaUtilConverter* PaUtil_SelectConverter( PaSampleFormat sourceFormat, - PaSampleFormat destinationFormat, PaStreamFlags flags ); - - -/** The generic buffer zeroer prototype. Buffer zeroers copy count zeros to - destinationBuffer. The actual type of the data pointed to varys for - different zeroer functions. - @param destinationBuffer A pointer to the first sample of the destination. - @param destinationStride An offset between successive destination samples - expressed in samples (not bytes.) It may be negative. - @param count The number of samples to zero. -*/ -typedef void PaUtilZeroer( - void *destinationBuffer, signed int destinationStride, unsigned int count ); - - -/** Find a buffer zeroer function for the given destination format. - @return - A pointer to a PaUtilZeroer which will perform the requested - zeroing. -*/ -PaUtilZeroer* PaUtil_SelectZeroer( PaSampleFormat destinationFormat ); - -/*----------------------------------------------------------------------------*/ -/* low level functions and data structures which may be used for - substituting conversion functions */ - - -/** The type used to store all sample conversion functions. - @see paConverters; -*/ -typedef struct{ - PaUtilConverter *Float32_To_Int32; - PaUtilConverter *Float32_To_Int32_Dither; - PaUtilConverter *Float32_To_Int32_Clip; - PaUtilConverter *Float32_To_Int32_DitherClip; - - PaUtilConverter *Float32_To_Int24; - PaUtilConverter *Float32_To_Int24_Dither; - PaUtilConverter *Float32_To_Int24_Clip; - PaUtilConverter *Float32_To_Int24_DitherClip; - - PaUtilConverter *Float32_To_Int16; - PaUtilConverter *Float32_To_Int16_Dither; - PaUtilConverter *Float32_To_Int16_Clip; - PaUtilConverter *Float32_To_Int16_DitherClip; - - PaUtilConverter *Float32_To_Int8; - PaUtilConverter *Float32_To_Int8_Dither; - PaUtilConverter *Float32_To_Int8_Clip; - PaUtilConverter *Float32_To_Int8_DitherClip; - - PaUtilConverter *Float32_To_UInt8; - PaUtilConverter *Float32_To_UInt8_Dither; - PaUtilConverter *Float32_To_UInt8_Clip; - PaUtilConverter *Float32_To_UInt8_DitherClip; - - PaUtilConverter *Int32_To_Float32; - PaUtilConverter *Int32_To_Int24; - PaUtilConverter *Int32_To_Int24_Dither; - PaUtilConverter *Int32_To_Int16; - PaUtilConverter *Int32_To_Int16_Dither; - PaUtilConverter *Int32_To_Int8; - PaUtilConverter *Int32_To_Int8_Dither; - PaUtilConverter *Int32_To_UInt8; - PaUtilConverter *Int32_To_UInt8_Dither; - - PaUtilConverter *Int24_To_Float32; - PaUtilConverter *Int24_To_Int32; - PaUtilConverter *Int24_To_Int16; - PaUtilConverter *Int24_To_Int16_Dither; - PaUtilConverter *Int24_To_Int8; - PaUtilConverter *Int24_To_Int8_Dither; - PaUtilConverter *Int24_To_UInt8; - PaUtilConverter *Int24_To_UInt8_Dither; - - PaUtilConverter *Int16_To_Float32; - PaUtilConverter *Int16_To_Int32; - PaUtilConverter *Int16_To_Int24; - PaUtilConverter *Int16_To_Int8; - PaUtilConverter *Int16_To_Int8_Dither; - PaUtilConverter *Int16_To_UInt8; - PaUtilConverter *Int16_To_UInt8_Dither; - - PaUtilConverter *Int8_To_Float32; - PaUtilConverter *Int8_To_Int32; - PaUtilConverter *Int8_To_Int24; - PaUtilConverter *Int8_To_Int16; - PaUtilConverter *Int8_To_UInt8; - - PaUtilConverter *UInt8_To_Float32; - PaUtilConverter *UInt8_To_Int32; - PaUtilConverter *UInt8_To_Int24; - PaUtilConverter *UInt8_To_Int16; - PaUtilConverter *UInt8_To_Int8; - - PaUtilConverter *Copy_8_To_8; /* copy without any conversion */ - PaUtilConverter *Copy_16_To_16; /* copy without any conversion */ - PaUtilConverter *Copy_24_To_24; /* copy without any conversion */ - PaUtilConverter *Copy_32_To_32; /* copy without any conversion */ -} PaUtilConverterTable; - - -/** A table of pointers to all required converter functions. - PaUtil_SelectConverter() uses this table to lookup the appropriate - conversion functions. The fields of this structure are initialized - with default conversion functions. Fields may be NULL, indicating that - no conversion function is available. User code may substitue optimised - conversion functions by assigning different function pointers to - these fields. - - @note - If the PA_NO_STANDARD_CONVERTERS preprocessor variable is defined, - PortAudio's standard converters will not be compiled, and all fields - of this structure will be initialized to NULL. In such cases, users - should supply their own conversion functions if the require PortAudio - to open a stream that requires sample conversion. - - @see PaUtilConverterTable, PaUtilConverter, PaUtil_SelectConverter -*/ -extern PaUtilConverterTable paConverters; - - -/** The type used to store all buffer zeroing functions. - @see paZeroers; -*/ -typedef struct{ - PaUtilZeroer *ZeroU8; /* unsigned 8 bit, zero == 128 */ - PaUtilZeroer *Zero8; - PaUtilZeroer *Zero16; - PaUtilZeroer *Zero24; - PaUtilZeroer *Zero32; -} PaUtilZeroerTable; - - -/** A table of pointers to all required zeroer functions. - PaUtil_SelectZeroer() uses this table to lookup the appropriate - conversion functions. The fields of this structure are initialized - with default conversion functions. User code may substitue optimised - conversion functions by assigning different function pointers to - these fields. - - @note - If the PA_NO_STANDARD_ZEROERS preprocessor variable is defined, - PortAudio's standard zeroers will not be compiled, and all fields - of this structure will be initialized to NULL. In such cases, users - should supply their own zeroing functions for the sample sizes which - they intend to use. - - @see PaUtilZeroerTable, PaUtilZeroer, PaUtil_SelectZeroer -*/ -extern PaUtilZeroerTable paZeroers; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* PA_CONVERTERS_H */ diff --git a/src/audio/pa_dither.h b/src/audio/pa_dither.h deleted file mode 100644 index 148db275fb8b77c3dbd51e19ae68cd537e5d08d9..0000000000000000000000000000000000000000 --- a/src/audio/pa_dither.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef PA_DITHER_H -#define PA_DITHER_H -/* - * $Id$ - * Portable Audio I/O Library triangular dither generator - * - * 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 Functions for generating dither noise -*/ - - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - - -/** @brief State needed to generate a dither signal */ -typedef struct PaUtilTriangularDitherGenerator{ - unsigned long previous; - unsigned long randSeed1; - unsigned long randSeed2; -} PaUtilTriangularDitherGenerator; - - -/** @brief Initialize dither state */ -void PaUtil_InitializeTriangularDitherState( PaUtilTriangularDitherGenerator *ditherState ); - - -/** - @brief Calculate 2 LSB dither signal with a triangular distribution. - Ranged for adding to a 1 bit right-shifted 32 bit integer - prior to >>15. eg: -<pre> - signed long in = * - signed long dither = PaUtil_Generate16BitTriangularDither( ditherState ); - signed short out = (signed short)(((in>>1) + dither) >> 15); -</pre> - @return - A signed long with a range of +32767 to -32768 -*/ -signed long PaUtil_Generate16BitTriangularDither( PaUtilTriangularDitherGenerator *ditherState ); - - -/** - @brief Calculate 2 LSB dither signal with a triangular distribution. - Ranged for adding to a pre-scaled float. -<pre> - float in = * - float dither = PaUtil_GenerateFloatTriangularDither( ditherState ); - // use smaller scaler to prevent overflow when we add the dither - signed short out = (signed short)(in*(32766.0f) + dither ); -</pre> - @return - A float with a range of -2.0 to +1.99999. -*/ -float PaUtil_GenerateFloatTriangularDither( PaUtilTriangularDitherGenerator *ditherState ); - - - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* PA_DITHER_H */ diff --git a/src/audio/pacpp/CHANGELOG b/src/audio/pacpp/CHANGELOG new file mode 100644 index 0000000000000000000000000000000000000000..296b6907827203d292e812fe3aeb52839e8142f5 --- /dev/null +++ b/src/audio/pacpp/CHANGELOG @@ -0,0 +1,168 @@ +PortAudioCpp v19 revision 15 xx/xx/xx: + + mblaauw: + - Changed some exception handling code in HostApi's constructor. + - Added accessors to PortAudio PaStream from PortAudioCpp Stream (their absense being pointed out + by Tom Jordan). + - Fixed a bug/typo in MemFunToCallbackInterfaceAdapter::init() thanks to Fredrik Viklund. + - Fixed issue with concrete Stream classes possibly throwing an exception and fixed documentation w.r.t. this. + - Moved files to portaudio/binding/cpp/. Made new msvc 7.1 projects to reflect the change and removed msvc 6.0 + and 7.0 projects (because I can no longer maintain them myself). Gnu projects will probably need updating. + +PortAudioCpp v19 revision 14 03/10/24: + + mblaauw: + - Fixed some error handling bugs in Stream and System (pointed out by Tom Jordan). + - Updated documentation a little (main page). + - Fixed order of members so initializer list was in the right order in + StreamParameters (pointed out by Ludwig Schwardt). + - Added new lines at EOF's (as indicated by Ludwig Schwardt). + +PortAudioCpp v19 revision 13 03/10/19: + + lschwardt: + - Added build files for GNU/Linux. + - Fixed bug in Exception where the inherited what() member function (and destructor) had looser + exception specification (namely no exception specification, i.e. could throw anything) than + the std::exception base class's what() member function (which had throw(), i.e. no-throw guarantee). + - Changed the iterators so that they have a set of public typedefs instead of deriving the C++ standard + library std::iterator<> struct. G++ 2.95 doesn't support std::exception<> and composition-by-aggregation + is prefered over composition-by-inheritance in this case. + - Changed some minor things to avoid G++ warning messages. + + mblaauw: + - Renamed this file (/WHATSNEW.txt) to /CHANGELOG. + - Renamed /PA_ISSUES.txt to /PA_ISSUES. + - Added /INSTALL file with some build info for GNU/Linux and VC6. + - Added MSVC 6.0 projects for building PortAudioCpp as a staticly or dynamically linkable library. + - Moved build files to /build/(gnu/ or vc6/). + - Moved Doxygen configuration files to /doc/ and output to /doc/api_reference/. + - Added a /doc/README with some info how to generate Doxygen documentation. + +PortAudioCpp v19 revision 12 03/09/02: + + mblaauw: + - Updated code to reflect changes on V19-devel CVS branch. + - Fixed some typos in the documentation. + +PortAudioCpp v19 revision 11 03/07/31: + + mblaauw: + - Renamed SingleDirecionStreamParameters to DirectionSpecificStreamParameters. + - Implemented BlockingStream. + - Updated code to reflect recent changes to PortAudio V19-devel. + - Fixed a potential memory leak when an exception was thrown in the HostApi + constructor. + - Renamed ``Latency'' to ``BufferSize'' in AsioDeviceAdapter. + - Updated class documentation. + +PortAudioCpp v19 revision 10 03/07/18: + + mblaauw: + - SingleDirectionStreamParameters now has a (static) null() method. + - StreamParameters uses references for the direction-specific stream parameters + instead of pointers (use null() method (above) instead of NULL). + - StreamParameters and SingleDirectionStreamParameters must now be fully specified + and now default values are used (because this was not very useful in general and + only made things more complex). + - Updated documentation. + +PortAudioCpp v19 revision 09 03/06/25: + + mblaauw: + - Changed some things in SingleDirectionStreamParameters to ease it's usage. + - Placed all SingleDirectionStreamParameters stuff into a separate file. + + Totally redid the callback stuff, now it's less ackward and supports C++ functions. + +PortAudioCpp v19 revision 08 03/06/20: + + mblaauw: + - Made deconstructors for Device and HostApi private. + + Added a AsioDeviceWrapper host api specific device extension class. + - Refactored Exception into a Exception base class and PaException and PaCppException + derived classes. + - Added ASIO specific device info to the devs.cxx example. + - Fixed a bug in System::hostApiCount() and System::defaultHostApi(). + + Moved Device::null to System::nullDevice. + - Fixed some bugs in Device and System. + +PortAudioCpp v19 revision 07 03/06/08: + + mblaauw: + - Updated some doxy comments. + + Renamed CbXyz to CallbackXyz. + + Renamed all ``configurations'' to ``parameters''. + + Renamed HalfDuplexStreamConfiguration to SingleDirectionStreamConfiguration. + - Renamed SingleDirectionStreamParameters::streamParameters() to + SingleDirectionStreamParameters::paSteamParameters. + - Added a non-constant version of SingleDirectionStreamParameters::paStreamParameters(). + - A few improvements to SingleDirectionStreamParameters. + - Allowed AutoSystem to be created without initializing the System singleton + (using a ctor flag). + - Added a BlockingStream class (not implemented for now). + - Fixed many bugs in the implementation of the iterators. + - Fixed a bug in Device::operator==(). + + Added a C++ version of the patest_sine.c test/example. + - Added a ctor for StreamParameters for a default half-duplex stream. + - Added SingleDirectionStreamParameters::setDevice() and setNumChannels(). + - Renamed System::numHostApis() to System::hostApiCount(). + + Rewrote the iterators and related classes. They are now fully STL compliant. The System now + has a static array of all HostApis and all Devices. Only the System can create HostApis and + Devices and they are non-copyable now. All HostApis and Devices are now passed by-reference. + - Renamed (System::) getVersion() to version() and getVersionText() to versionText(). + - Renamed (Device::) numXyzChannels() to maxXyzChannels(). + - Changed some stuff in StreamParameters. + + Added a C++ version of the patest_devs.c test/example. + +PortAudioCpp v19 revision 06 03/06/04: + + mblaauw: + + Added this file to the project (roughly, a `+' denotes a major change, a `-' a minor change). + - Added System::deviceByIndex(), useful when a Device's index is stored for instance. + - Renamed System::hostApiFromTypeId() to System::hostApiByTypeId(). + - Updated and added some Doxygen documentation. + - Made Stream::usedIntputLatency(), Stream::usedOutputLatency() and + Stream::usedSampleRate() throw an paInternalError equivalent exception instead of paBadStreamPtr. + - Changed exception handling in Stream::open() functions. They now follow the PA error handling + mechanism better and a couple of bugs regarding ownership of objects were fixed. + - Renamed Device::isDefaultXyzDevice() to Device::isSystemDefaultXyzDevice(). + - Added Device::isHostApiDefaultXyzDevice(). + - Added StreamConfiguration::unsetFlag(). + - Removed CUSTOM from SampleDataFormat. + - System::hostApiByTypeId() now throws an paInternalError if the type id was out-of-range; this + is a temporary work-around (see comments). + - Changed CbInterface to use paCallbackFun() instead of operator()(). + - Renamed ``object'' to ``instance'' in CbMemFunAdapter.hxx. + - Added StreamConfiguration::setXyzHostApiSpecificSampleFormat(). + - Added StreamConfiguration::isXyzSampleFormatHostApiSpecific(). + - Changed error handling in System::terminate(), it can now throw an Exception. + - Added error handling in System::defaultHostApi(). + - Added error handling in System::hostApisEnd(). + - Changed some (but probably not all) C casts to C++ casts to avoid confusion with a + certain Python person. + - Renamed RaiiSystem to AutoSystem (class and file) as this is a come common convention. + - Renamed System::numDevices() to System::deviceCount() to be more compatible with PortAudio + (although PortAudio uses Pa_CountDevices() instead, see comment). + - Renamed HostApi::numDevices() to HostApi::deviceCount(). + - Changed INC_ to INCLUDED_ in the header multiple include guards. + - Changed the order of functions in the StreamConfiguration class' header. + - Written some more info in PortAudioCpp.hxx (Doxygen). + - Added CallbackStream.hxx and CallbackStream.cxx files. + + Refactored StreamConfiguration to remove the duplication which was there. There is now a + HalfDuplexStreamConfiguration class. Also made some improvements to these classes while + doing the refactoring. + + Moved all code files to source/portaudiocpp/ and changed includes. + + Moved all header files to include/portaudiocpp/ to easy a binary build if needed. The project + must be set to have .../include/ as a path to look for includes. + + Refactored the Stream class into a Stream base class and a CallbackStream derived class. + - Renamed Stream::usingXyz() to Stream::xyz(). + - Updated some doxy comments. + - Changed ``using namespace portaudio'' in .cxx files to ``namespace portaudio { ... }''. + +PortAudioCpp v19 revision 05 03/04/09: + + mblaauw: + - Initial release on the PortAudio mailinglist. + + + diff --git a/src/audio/pacpp/INSTALL b/src/audio/pacpp/INSTALL new file mode 100644 index 0000000000000000000000000000000000000000..d328f78d36500cfe92928a1566f5c57bc5754bd1 --- /dev/null +++ b/src/audio/pacpp/INSTALL @@ -0,0 +1,39 @@ +GNU(/Linux) build notes: +------------------------ + +Change to the 'build/gnu' directory. + +Make sure the configure script is executable by running 'chmod +x configure'. + +Run './configure' to create the Makefile. If this doesn't work out for you, run +'autoconf' first to recreate the configure script. + +Run 'make' to create all the test programs in the 'examples' directory, as well +as the static and dynamic libraries in the 'lib' directory. + +Run 'make docs' to generate the Doxygen HTML documentation. And 'make clean' does +the normal thing too. + +Currently, PortAudioCpp compiles under g++-2.95 as well as g++-3.3. The setup still +needs testing under Darwin (I don't know how the library dependencies work on the Mac). + +Ludwig Schwardt +9 October 2003 + + + +MS Visual C++ 6.0 build notes: +------------------------------ + +Open either one of the .dsp files in the /build/vc6/ folder. Simply select +Build->Build ... (F7) to build the project. + +These projects assume you have downloaded and installed PortAudio V19 in a folder called +``portaudio_v19'', which must be a `sibling' folder of this (the ``PortAudioCpp'') +folder. If this is not the case, you will have to edit the ``Additional include directories'' +field from the projects settings (Project->Settings...->C/C++ tab->Preprocessor category). + +To compile the dynamic-link library project, you'll either have to include the source +files needed from PortAudio V19, or link against a pre-compiled library of PortAudio V19. + +The output files (.lib or .dll and .lib) will be placed in the /lib/ folder. \ No newline at end of file diff --git a/src/audio/pacpp/Makefile.am b/src/audio/pacpp/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..4f6f53c3b4ef980e775a60942c5e0f298b6010ea --- /dev/null +++ b/src/audio/pacpp/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = source include \ No newline at end of file diff --git a/src/audio/pacpp/PA_ISSUES b/src/audio/pacpp/PA_ISSUES new file mode 100644 index 0000000000000000000000000000000000000000..87d77b26790eec4636cb9f398caf2125e7e1638b --- /dev/null +++ b/src/audio/pacpp/PA_ISSUES @@ -0,0 +1,23 @@ +x1) Pa_HostApiTypeIdToHostApiIndex() should probably return a PaError and +there should be an additional error code called paHostApiNotFoundError. +Currently the function returns -1 on error, but there's no corresponding +PaError (this is a minor issue for PaCpp as all exceptions are mappings of +corresponding PaError codes). + +x2.1) Pa_CountHostApis() should probably be renamed Pa_GetHostApiCount(), because +the actual counting of host apis is done in Pa_Initialize(). + +x2.2) Pa_CountDevices() should probably be renamed Pa_GetDeviceCount(), because +the actual counting of devices is done in Pa_Initialize(). + +x3) Pa_CountDevices() should probably return a PaError on error, instead of returning 0. +Host apis might very well have 0 devices (like the `skeleton implementation' host api). + +4) PaAsio_GetAvailableLatencyValues() uses the term `latency' for number of frames per buffer +values which isn't the same as `latency' in the rest of PA. + +5) Possibly rename Pa_GetStreamReadAvailable() to Pa_GetStreamAvailableReadSize() and +Pa_GetStreamWriteAvailable() to Pa_GetStreamAvailableWriteSize(). + +x6) Input void *'s (in callback function prototype and blocking i/o write method) should +probably be const void *'s. diff --git a/src/audio/pacpp/build/gnu/Makefile.in b/src/audio/pacpp/build/gnu/Makefile.in new file mode 100644 index 0000000000000000000000000000000000000000..0bc6f28e755a03fa5d5464e3b848ac54b37c3456 --- /dev/null +++ b/src/audio/pacpp/build/gnu/Makefile.in @@ -0,0 +1,106 @@ +# +# Makefile template for PortAudioCpp +# Ludwig Schwardt +# 01/10/2003 +# +# Not much to edit here - rather check configure.ac +# + +PREFIX = @prefix@ +CC = @CC@ +CXX = @CXX@ +CFLAGS = @CFLAGS@ @DEFS@ +CXXFLAGS = @CXXFLAGS@ +SHARED_FLAGS = @SHARED_FLAGS@ +LIBS = @LIBS@ +DLL_LIBS = @DLL_LIBS@ +AR = @AR@ +RANLIB = @RANLIB@ +INSTALL = @INSTALL@ + +PACPP_ROOT = @PACPP_ROOT@ +PORTAUDIO = @PORTAUDIO@ +PADLL = @PADLL@ +PACPP_DLL = @PACPP_DLL@ +PALIB = libportaudio.a +PACPP_LIB = libportaudiocpp.a +PACPP_DLLV = $(PACPP_DLL).0.0.12 + +SRCDIR = $(PACPP_ROOT)/source/portaudiocpp +BINDIR = $(PACPP_ROOT)/example +LIBDIR = $(PACPP_ROOT)/lib +DOCDIR = $(PACPP_ROOT)/doc + +OBJS = \ + $(SRCDIR)/BlockingStream.o \ + $(SRCDIR)/CallbackInterface.o \ + $(SRCDIR)/CallbackStream.o \ + $(SRCDIR)/CFunCallbackStream.o \ + $(SRCDIR)/CppFunCallbackStream.o \ + $(SRCDIR)/Device.o \ + $(SRCDIR)/DirectionSpecificStreamParameters.o \ + $(SRCDIR)/Exception.o \ + $(SRCDIR)/HostApi.o \ + $(SRCDIR)/InterfaceCallbackStream.o \ + $(SRCDIR)/MemFunCallbackStream.o \ + $(SRCDIR)/Stream.o \ + $(SRCDIR)/StreamParameters.o \ + $(SRCDIR)/System.o \ + $(SRCDIR)/SystemDeviceIterator.o \ + $(SRCDIR)/SystemHostApiIterator.o + +# Not supported yet +# $(SRCDIR)/AsioDeviceAdapter.o + +EXAMPLES = \ + $(BINDIR)/devs \ + $(BINDIR)/sine + +.PHONY: all clean docs + +all: $(EXAMPLES) $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLL) + +clean: + rm -rf $(SRCDIR)/*.o $(BINDIR)/*.o $(EXAMPLES) $(LIBDIR) $(DOCDIR)/api_reference + rm -rf autom4te.cache config.status config.log + +docs: + cd $(DOCDIR); doxygen config.doxy.linux + +%.o: %.c + $(CC) -c $(CFLAGS) $< -o $@ + +%.o: %.cxx + $(CXX) -c $(CXXFLAGS) $< -o $@ + + +$(EXAMPLES): $(BINDIR)/%: $(BINDIR)/%.o $(OBJS) + $(CXX) $^ -o $@ $(LIBS) + +$(LIBDIR)/$(PACPP_LIB): $(LIBDIR) $(OBJS) + $(AR) ruv $(LIBDIR)/$(PACPP_LIB) $(OBJS) + $(RANLIB) $(LIBDIR)/$(PACPP_LIB) + +$(LIBDIR)/$(PACPP_DLLV): $(LIBDIR) $(OBJS) + $(CXX) $(SHARED_FLAGS) -o $(LIBDIR)/$(PACPP_DLLV) $(OBJS) $(DLL_LIBS) + +$(LIBDIR)/$(PACPP_DLL): $(LIBDIR) $(OBJS) + $(CXX) $(SHARED_FLAGS) -o $(LIBDIR)/$(PACPP_DLL) $(OBJS) $(DLL_LIBS) + +#install: $(LIBDIR)/$(PACPP_LIB) $(LIBDIR)/$(PACPP_DLLV) +# $(INSTALL) -m 644 $(LIBDIR)/$(PACPP_DLLV) $(PREFIX)/lib/$(PACPP_DLLV) +# $(INSTALL) -m 644 $(LIBDIR)/$(PACPP_LIB) $(PREFIX)/lib/$(PACPP_LIB) +# cd $(PREFIX)/lib && rm -f $(PACPP_DLL) && ln -s $(PACPP_DLLV) $(PACPP_DLL) +# @echo "" +# @echo "------------------------------------------------------------" +# @echo "PortAudioCpp was successfully installed." +# @echo "" +# @echo "On some systems (e.g. Linux) you should run 'ldconfig' now" +# @echo "to make the shared object available. You may also need to" +# @echo "modify your LD_LIBRARY_PATH environment variable to include" +# @echo "the directory $(PREFIX)/lib" +# @echo "------------------------------------------------------------" +# @echo "" + +$(LIBDIR): + mkdir $(LIBDIR) diff --git a/src/audio/pacpp/build/gnu/OUT_OF_DATE b/src/audio/pacpp/build/gnu/OUT_OF_DATE new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/audio/pacpp/build/gnu/aclocal.m4 b/src/audio/pacpp/build/gnu/aclocal.m4 new file mode 100644 index 0000000000000000000000000000000000000000..c80e0acfc4fccf781044ca49a0ea179a82f2d9a6 --- /dev/null +++ b/src/audio/pacpp/build/gnu/aclocal.m4 @@ -0,0 +1,57 @@ + +dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not) +dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page +dnl also defines GSTUFF_PKG_ERRORS on error +AC_DEFUN(PKG_CHECK_MODULES, [ + succeeded=no + + if test -z "$PKG_CONFIG"; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + AC_MSG_CHECKING(for $2) + + if $PKG_CONFIG --exists "$2" ; then + AC_MSG_RESULT(yes) + succeeded=yes + + AC_MSG_CHECKING($1_CFLAGS) + $1_CFLAGS=`$PKG_CONFIG --cflags "$2"` + AC_MSG_RESULT($$1_CFLAGS) + + AC_MSG_CHECKING($1_LIBS) + $1_LIBS=`$PKG_CONFIG --libs "$2"` + AC_MSG_RESULT($$1_LIBS) + else + $1_CFLAGS="" + $1_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + ifelse([$4], ,echo $$1_PKG_ERRORS,) + fi + + AC_SUBST($1_CFLAGS) + AC_SUBST($1_LIBS) + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + ifelse([$3], , :, [$3]) + else + ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4]) + fi +]) + + diff --git a/src/audio/pacpp/build/gnu/config.guess b/src/audio/pacpp/build/gnu/config.guess new file mode 100644 index 0000000000000000000000000000000000000000..297e5c30f41b65e95341322c77994c4d1d447134 --- /dev/null +++ b/src/audio/pacpp/build/gnu/config.guess @@ -0,0 +1,1308 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-10-05' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner <bothner@cygnus.com>. +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + sparc*) machine=`uname -p`-unknown ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <<EOF >$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in + big) echo mips-unknown-linux-gnu && exit 0 ;; + little) echo mipsel-unknown-linux-gnu && exit 0 ;; + esac + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + ld_supported_targets=`cd /; ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + cat >$dummy.c <<EOF +#include <features.h> +#ifdef __cplusplus +#include <stdio.h> /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-pc-linux-gnu\n", argv[1]); +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-pc-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-pc-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include <sys/param.h> +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 +rm -f $dummy.c $dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 <<EOF +$0: unable to guess system type + +This script, last modified $timestamp, has failed to recognize +the operating system you are using. It is advised that you +download the most up to date version of the config scripts from + + ftp://ftp.gnu.org/pub/gnu/config/ + +If the version you run ($0) is already up to date, please +send the following data and any information you think might be +pertinent to <config-patches@gnu.org> in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/audio/pacpp/build/gnu/config.sub b/src/audio/pacpp/build/gnu/config.sub new file mode 100644 index 0000000000000000000000000000000000000000..6eea72728397be8ff2576ff2874998620dd1a617 --- /dev/null +++ b/src/audio/pacpp/build/gnu/config.sub @@ -0,0 +1,1505 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-07-17' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to <config-patches@gnu.org>. Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/src/audio/pacpp/build/gnu/configure b/src/audio/pacpp/build/gnu/configure new file mode 100755 index 0000000000000000000000000000000000000000..69070c66d4f20c3c0d865bd202095a8f649f1eaf --- /dev/null +++ b/src/audio/pacpp/build/gnu/configure @@ -0,0 +1,4297 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.57 for PortAudioCpp 12. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='PortAudioCpp' +PACKAGE_TARNAME='portaudiocpp' +PACKAGE_VERSION='12' +PACKAGE_STRING='PortAudioCpp 12' +PACKAGE_BUGREPORT='' + +ac_unique_file="../../include/portaudiocpp/PortAudioCpp.hxx" +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX LN_S RANLIB ac_ct_RANLIB INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA AR PACPP_ROOT PORTAUDIO PADLL PACPP_DLL PACPP_INC SHARED_FLAGS DLL_LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os PKG_CONFIG JACK_CFLAGS JACK_LIBS LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures PortAudioCpp 12 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of PortAudioCpp 12:";; + esac + cat <<\_ACEOF + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-alsa (default=auto) + --with-jack (default=auto) + --with-oss (default=yes) + --with-host_os (no default) + --with-winapi ((wmme/directx/asio) default=wmme) + --with-macapi (asio) default=asio) + --with-asiodir (default=/usr/local/asiosdk2) + --with-dxdir (default=/usr/local/dx7sdk) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir> + CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir> + CXX C++ compiler command + CXXFLAGS C++ compiler flags + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +PortAudioCpp configure 12 +generated by GNU Autoconf 2.57 + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by PortAudioCpp $as_me 12, which was +generated by GNU Autoconf 2.57. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +###### Top-level directory of pacpp +###### This makes it easy to shuffle the build directories +###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! +PACPP_ROOT="../.." + +###### +###### SET THIS TO PORTAUDIO DIRECTORY +###### +PORTAUDIO="$PACPP_ROOT/../portaudio" + +# Various other variables and flags + +PACPP_INC="$PACPP_ROOT/include" +INCLUDES="-I$PACPP_INC -I$PORTAUDIO -I$PORTAUDIO/pa_common" +CFLAGS="-g -O2 -Wall -ansi -pedantic $INCLUDES" +CXXFLAGS="$CFLAGS" +PALIBDIR="$PORTAUDIO/lib" + +# Checks for programs + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 + (eval $ac_compiler --version </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 + (eval $ac_compiler -v </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 + (eval $ac_compiler -V </dev/null >&5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 +if test "${ac_cv_cxx_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include <stdlib.h> +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +echo "$as_me:$LINENO: checking whether ln -s works" >&5 +echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:$LINENO: result: no, using $LN_S" >&5 +echo "${ECHO_T}no, using $LN_S" >&6 +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_AR" && ac_cv_path_AR="no" + ;; +esac +fi +AR=$ac_cv_path_AR + +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if [ $AR = "no" ] ; then + { { echo "$as_me:$LINENO: error: \"Could not find ar - needed to create a library\"" >&5 +echo "$as_me: error: \"Could not find ar - needed to create a library\"" >&2;} + { (exit 1); exit 1; }; }; +fi + +# This must be one of the first tests we do or it will fail... + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/types.h> +#include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.$ac_objext conftest.$ac_ext +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +int +main () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + + +# Transfer these variables to the Makefile + + + + + + + + + +##################### CHECK FOR INSTALLED PACKAGES ############################ + +# checks for various host APIs and arguments to configure that +# turn them on or off + +echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5 +echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6 +if test "${ac_cv_lib_asound_snd_pcm_open+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lasound $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char snd_pcm_open (); +int +main () +{ +snd_pcm_open (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_asound_snd_pcm_open=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_asound_snd_pcm_open=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 +echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6 +if test $ac_cv_lib_asound_snd_pcm_open = yes; then + have_alsa=yes +else + have_alsa=no +fi + + +# Determine the host description for the subsequent test. +# PKG_CHECK_MODULES seems to check and set the host variable also, but +# that then requires pkg-config availability which is not standard on +# MinGW systems and can be a pain to install. +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + + + + succeeded=no + + if test -z "$PKG_CONFIG"; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + fi + + if test "$PKG_CONFIG" = "no" ; then + echo "*** The pkg-config script could not be found. Make sure it is" + echo "*** in your path, or set the PKG_CONFIG environment variable" + echo "*** to the full path to pkg-config." + echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config." + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + echo "$as_me:$LINENO: checking for jack" >&5 +echo $ECHO_N "checking for jack... $ECHO_C" >&6 + + if $PKG_CONFIG --exists "jack" ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + succeeded=yes + + echo "$as_me:$LINENO: checking JACK_CFLAGS" >&5 +echo $ECHO_N "checking JACK_CFLAGS... $ECHO_C" >&6 + JACK_CFLAGS=`$PKG_CONFIG --cflags "jack"` + echo "$as_me:$LINENO: result: $JACK_CFLAGS" >&5 +echo "${ECHO_T}$JACK_CFLAGS" >&6 + + echo "$as_me:$LINENO: checking JACK_LIBS" >&5 +echo $ECHO_N "checking JACK_LIBS... $ECHO_C" >&6 + JACK_LIBS=`$PKG_CONFIG --libs "jack"` + echo "$as_me:$LINENO: result: $JACK_LIBS" >&5 +echo "${ECHO_T}$JACK_LIBS" >&6 + else + JACK_CFLAGS="" + JACK_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + JACK_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "jack"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + have_jack=yes + else + have_jack=no + fi + + + +# Check whether --with-alsa or --without-alsa was given. +if test "${with_alsa+set}" = set; then + withval="$with_alsa" + with_alsa=$withval +else + with_alsa="yes" +fi; + + +# Check whether --with-jack or --without-jack was given. +if test "${with_jack+set}" = set; then + withval="$with_jack" + with_jack=$withval +else + with_jack="yes" +fi; + + +# Check whether --with-oss or --without-oss was given. +if test "${with_oss+set}" = set; then + withval="$with_oss" + with_oss=$withval +else + with_oss="yes" +fi; + + +# Check whether --with-host_os or --without-host_os was given. +if test "${with_host_os+set}" = set; then + withval="$with_host_os" + host_os=$withval +fi; + + +# Check whether --with-winapi or --without-winapi was given. +if test "${with_winapi+set}" = set; then + withval="$with_winapi" + with_winapi=$withval +else + with_winapi="wmme" +fi; + +# Mac API added for ASIO, can have other api's listed + +# Check whether --with-macapi or --without-macapi was given. +if test "${with_macapi+set}" = set; then + withval="$with_macapi" + with_macapi=$withval +else + with_macapi="asio" +fi; + + +# Check whether --with-asiodir or --without-asiodir was given. +if test "${with_asiodir+set}" = set; then + withval="$with_asiodir" + with_asiodir=$withval +else + with_asiodir="/usr/local/asiosdk2" +fi; + + +# Check whether --with-dxdir or --without-dxdir was given. +if test "${with_dxdir+set}" = set; then + withval="$with_dxdir" + with_dxdir=$withval +else + with_dxdir="/usr/local/dx7sdk" +fi; + + +##################### HOST-SPECIFIC LIBRARY SETTINGS ########################## + +case "${host_os}" in + darwin* ) + # Mac OS X configuration + + LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio"; + PADLL="libportaudio.dylib"; + PACPP_DLL="libportaudiocpp.dylib"; + SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox"; + SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib"; + if [ $with_macapi = "asio" ] ; then + if [ $with_asiodir ] ; then + ASIODIR="$with_asiodir"; + else + ASIODIR="/usr/local/asiosdk2"; + fi + echo "ASIODIR: $ASIODIR"; + fi + ;; + + mingw* ) + # MingW configuration + + echo "WINAPI: $with_winapi" + if [ $with_winapi = "directx" ] ; then + if [ $with_dxdir ] ; then + DXDIR="$with_dxdir"; + else + DXDIR="/usr/local/dx7sdk"; + fi + echo "DXDIR: $DXDIR" + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm -ldsound -lole32"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm -lm -L./dx7sdk/lib -ldsound -lole32"; + CFLAGS="$CFLAGS -DPA_NO_WMME -DPA_NO_ASIO"; + CXXFLAGS="$CFLAGS" + elif [ $with_winapi = "asio" ] ; then + if [ $with_asiodir ] ; then + ASIODIR="$with_asiodir"; + else + ASIODIR="/usr/local/asiosdk2"; + fi + echo "ASIODIR: $ASIODIR" + + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"; + CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -DPA_NO_WMME -DPA_NO_DS -DWINDOWS"; + CXXFLAGS="$CFLAGS"; + else # WMME default + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm"; + CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_ASIO"; + CXXFLAGS="$CFLAGS"; + fi + ;; + + cygwin* ) + # Cygwin configuration + + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm"; + ;; + + *) + # Unix OSS configuration + + +echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_create=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 +if test $ac_cv_lib_pthread_pthread_create = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPTHREAD 1 +_ACEOF + + LIBS="-lpthread $LIBS" + +else + { { echo "$as_me:$LINENO: error: libpthread not found!" >&5 +echo "$as_me: error: libpthread not found!" >&2;} + { (exit 1); exit 1; }; } +fi + + + LIBS="$LIBS -L$PALIBDIR -lportaudio" + + if [ $have_jack = "yes" ] && [ $with_jack != "no" ] ; then + LIBS="$LIBS $JACK_LIBS" + CFLAGS="$CFLAGS $JACK_CFLAGS" + cat >>confdefs.h <<\_ACEOF +#define PA_USE_JACK 1 +_ACEOF + + fi + + if [ $have_alsa = "yes" ] && [ $with_alsa != "no" ] ; then + LIBS="$LIBS -lasound" + cat >>confdefs.h <<\_ACEOF +#define PA_USE_ALSA 1 +_ACEOF + + fi + + if [ $with_oss != "no" ] ; then + cat >>confdefs.h <<\_ACEOF +#define PA_USE_OSS 1 +_ACEOF + + fi + LIBS="$LIBS -lm -lpthread"; + PADLL="libportaudio.so"; + PACPP_DLL="libportaudiocpp.so"; + SHARED_FLAGS="-shared"; +esac + + ac_config_files="$ac_config_files Makefile" + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by PortAudioCpp $as_me 12, which was +generated by GNU Autoconf 2.57. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <bug-autoconf@gnu.org>." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +PortAudioCpp config.status 12 +configured by $0, generated by GNU Autoconf 2.57, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + + + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@LN_S@,$LN_S,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@AR@,$AR,;t t +s,@PACPP_ROOT@,$PACPP_ROOT,;t t +s,@PORTAUDIO@,$PORTAUDIO,;t t +s,@PADLL@,$PADLL,;t t +s,@PACPP_DLL@,$PACPP_DLL,;t t +s,@PACPP_INC@,$PACPP_INC,;t t +s,@SHARED_FLAGS@,$SHARED_FLAGS,;t t +s,@DLL_LIBS@,$DLL_LIBS,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@JACK_CFLAGS@,$JACK_CFLAGS,;t t +s,@JACK_LIBS@,$JACK_LIBS,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac +# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be +# absolute. +ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` +ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` +ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` +ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/src/audio/pacpp/build/gnu/configure.ac b/src/audio/pacpp/build/gnu/configure.ac new file mode 100644 index 0000000000000000000000000000000000000000..5457c53420da289775c26c4892820b1c86e5cc64 --- /dev/null +++ b/src/audio/pacpp/build/gnu/configure.ac @@ -0,0 +1,214 @@ +# +# PortAudioCpp V19 autoconf input file +# Shamelessly ripped from the PortAudio one by Dominic Mazzoni +# Ludwig Schwardt +# + +# Require autoconf >= 2.13 +AC_PREREQ(2.13) + +AC_INIT([PortAudioCpp], [12]) +AC_CONFIG_SRCDIR([../../include/portaudiocpp/PortAudioCpp.hxx]) + +###### Top-level directory of pacpp +###### This makes it easy to shuffle the build directories +###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! +PACPP_ROOT="../.." + +###### +###### SET THIS TO PORTAUDIO DIRECTORY +###### +PORTAUDIO="$PACPP_ROOT/../portaudio" + +# Various other variables and flags + +PACPP_INC="$PACPP_ROOT/include" +INCLUDES="-I$PACPP_INC -I$PORTAUDIO -I$PORTAUDIO/pa_common" +CFLAGS="-g -O2 -Wall -ansi -pedantic $INCLUDES" +CXXFLAGS="$CFLAGS" +PALIBDIR="$PORTAUDIO/lib" + +# Checks for programs + +AC_PROG_CC +AC_PROG_CXX +AC_PROG_LN_S +AC_PROG_RANLIB +AC_PROG_INSTALL +AC_PATH_PROG(AR, ar, no) +if [[ $AR = "no" ]] ; then + AC_MSG_ERROR("Could not find ar - needed to create a library"); +fi + +# This must be one of the first tests we do or it will fail... +AC_C_BIGENDIAN + +# Transfer these variables to the Makefile +AC_SUBST(PACPP_ROOT) +AC_SUBST(PORTAUDIO) +AC_SUBST(PADLL) +AC_SUBST(PACPP_DLL) +AC_SUBST(PACPP_INC) +AC_SUBST(SHARED_FLAGS) +AC_SUBST(DLL_LIBS) +AC_SUBST(CXXFLAGS) + +##################### CHECK FOR INSTALLED PACKAGES ############################ + +# checks for various host APIs and arguments to configure that +# turn them on or off + +AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) + +# Determine the host description for the subsequent test. +# PKG_CHECK_MODULES seems to check and set the host variable also, but +# that then requires pkg-config availability which is not standard on +# MinGW systems and can be a pain to install. +AC_CANONICAL_HOST + +PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) + +AC_ARG_WITH(alsa, + [ --with-alsa (default=auto)], + with_alsa=$withval, with_alsa="yes") + +AC_ARG_WITH(jack, + [ --with-jack (default=auto)], + 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") + +# Mac API added for ASIO, can have other api's listed +AC_ARG_WITH(macapi, + [ --with-macapi (asio) default=asio)], + with_macapi=$withval, with_macapi="asio") + +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") + + +##################### HOST-SPECIFIC LIBRARY SETTINGS ########################## + +case "${host_os}" in + darwin* ) + # Mac OS X configuration + + LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio"; + PADLL="libportaudio.dylib"; + PACPP_DLL="libportaudiocpp.dylib"; + SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox"; + SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib"; + if [[ $with_macapi = "asio" ]] ; then + if [[ $with_asiodir ]] ; then + ASIODIR="$with_asiodir"; + else + ASIODIR="/usr/local/asiosdk2"; + fi + echo "ASIODIR: $ASIODIR"; + fi + ;; + + mingw* ) + # MingW configuration + + echo "WINAPI: $with_winapi" + if [[ $with_winapi = "directx" ]] ; then + if [[ $with_dxdir ]] ; then + DXDIR="$with_dxdir"; + else + DXDIR="/usr/local/dx7sdk"; + fi + echo "DXDIR: $DXDIR" + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm -ldsound -lole32"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm -lm -L./dx7sdk/lib -ldsound -lole32"; + CFLAGS="$CFLAGS -DPA_NO_WMME -DPA_NO_ASIO"; + CXXFLAGS="$CFLAGS" + elif [[ $with_winapi = "asio" ]] ; then + if [[ $with_asiodir ]] ; then + ASIODIR="$with_asiodir"; + else + ASIODIR="/usr/local/asiosdk2"; + fi + echo "ASIODIR: $ASIODIR" + + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"; + CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -DPA_NO_WMME -DPA_NO_DS -DWINDOWS"; + CXXFLAGS="$CFLAGS"; + else # WMME default + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm"; + CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_ASIO"; + CXXFLAGS="$CFLAGS"; + fi + ;; + + cygwin* ) + # Cygwin configuration + + LIBS="-L$PALIBDIR -lportaudio" + LIBS="$LIBS -lwinmm -lm"; + PADLL="portaudio.dll"; + PACPP_DLL="portaudiocpp.dll"; + SHARED_FLAGS="-shared -mthreads"; + DLL_LIBS="-lwinmm"; + ;; + + *) + # Unix OSS configuration + + AC_CHECK_LIB(pthread, pthread_create, + , + AC_MSG_ERROR([libpthread not found!])) + + LIBS="$LIBS -L$PALIBDIR -lportaudio" + + if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then + LIBS="$LIBS $JACK_LIBS" + CFLAGS="$CFLAGS $JACK_CFLAGS" + AC_DEFINE(PA_USE_JACK) + fi + + if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then + LIBS="$LIBS -lasound" + AC_DEFINE(PA_USE_ALSA) + fi + + if [[ $with_oss != "no" ]] ; then + AC_DEFINE(PA_USE_OSS) + fi + LIBS="$LIBS -lm -lpthread"; + PADLL="libportaudio.so"; + PACPP_DLL="libportaudiocpp.so"; + SHARED_FLAGS="-shared"; +esac + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/src/audio/pacpp/build/gnu/install-sh b/src/audio/pacpp/build/gnu/install-sh new file mode 100644 index 0000000000000000000000000000000000000000..e9de23842dcd44d2953129c866b1ad25f7e1f1d9 --- /dev/null +++ b/src/audio/pacpp/build/gnu/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# 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. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# 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 $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/src/audio/pacpp/build/vc7_1/devs_example.sln b/src/audio/pacpp/build/vc7_1/devs_example.sln new file mode 100644 index 0000000000000000000000000000000000000000..c443bce5b17f4915a0b0c8da707404e4e5391801 --- /dev/null +++ b/src/audio/pacpp/build/vc7_1/devs_example.sln @@ -0,0 +1,30 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "devs_example", "devs_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}" + ProjectSection(ProjectDependencies) = postProject + {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32 + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32 + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32 + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/src/audio/pacpp/build/vc7_1/devs_example.vcproj b/src/audio/pacpp/build/vc7_1/devs_example.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..1fbe45f506f10a854d1752141f0e4af907288f7c --- /dev/null +++ b/src/audio/pacpp/build/vc7_1/devs_example.vcproj @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="devs_example" + ProjectGUID="{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="../../include/;../../../../pa_common/;../../../../;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="../../lib/portaudiocpp-vc7_1-d.lib" + OutputFile="../../bin/devs_example.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/devs_example.pdb" + SubSystem="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="../../include/;../../../../pa_common/;../../../../;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="../../lib/portaudiocpp-vc7_1-r.lib" + OutputFile="../../bin/devs_example.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Files" + Filter=""> + <File + RelativePath="..\..\example\devs.cxx"> + </File> + </Filter> + <Filter + Name="PortAudio v19 Files" + Filter=""> + <File + RelativePath="..\..\..\..\pa_win_ds\dsound_wrapper.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_allocation.c"> + </File> + <File + RelativePath="..\..\..\..\pa_asio\pa_asio.cpp"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_converters.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_cpuload.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_dither.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_front.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_process.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_skeleton.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_stream.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_trace.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win_ds\pa_win_ds.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win\pa_win_hostapis.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win\pa_win_util.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win_wmme\pa_win_wmme.c"> + </File> + </Filter> + <Filter + Name="ASIO 2 SDK Files" + Filter=""> + <File + RelativePath="..\..\..\..\..\asiosdk2\common\asio.cpp"> + </File> + <File + RelativePath="..\..\..\..\..\asiosdk2\host\asiodrivers.cpp"> + </File> + <File + RelativePath="..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/src/audio/pacpp/build/vc7_1/sine_example.sln b/src/audio/pacpp/build/vc7_1/sine_example.sln new file mode 100644 index 0000000000000000000000000000000000000000..7be7c583c847e77613daa8a8fdc488bbb0284ad0 --- /dev/null +++ b/src/audio/pacpp/build/vc7_1/sine_example.sln @@ -0,0 +1,30 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sine_example", "sine_example.vcproj", "{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}" + ProjectSection(ProjectDependencies) = postProject + {D18EA0C9-8C65-441D-884C-55EB43A84F2A} = {D18EA0C9-8C65-441D-884C-55EB43A84F2A} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.ActiveCfg = Debug|Win32 + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Debug.Build.0 = Debug|Win32 + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.ActiveCfg = Release|Win32 + {1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}.Release.Build.0 = Release|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/src/audio/pacpp/build/vc7_1/sine_example.vcproj b/src/audio/pacpp/build/vc7_1/sine_example.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..88e21d1767b150cee34a8a63bd04fc5ef64d1a5c --- /dev/null +++ b/src/audio/pacpp/build/vc7_1/sine_example.vcproj @@ -0,0 +1,187 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="sine_example" + ProjectGUID="{1B9A038D-80A3-4DBD-9F0D-AF10B49B863A}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="../../include/;../../../../pa_common/;../../../../;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="../../lib/portaudiocpp-vc7_1-d.lib" + OutputFile="../../bin/sine_example.exe" + LinkIncremental="2" + GenerateDebugInformation="TRUE" + ProgramDatabaseFile="$(OutDir)/sine_example.pdb" + SubSystem="1" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="../../include/;../../../../pa_common/;../../../../;../../../../../asiosdk2/common/,../../../../../asiosdk2/host/,../../../../../asiosdk2/host/pc/" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="../../lib/portaudiocpp-vc7_1-r.lib" + OutputFile="../../bin/sine_example.exe" + LinkIncremental="1" + GenerateDebugInformation="TRUE" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCWebDeploymentTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Files" + Filter=""> + <File + RelativePath="..\..\example\sine.cxx"> + </File> + </Filter> + <Filter + Name="PortAudio v19 Files" + Filter=""> + <File + RelativePath="..\..\..\..\pa_win_ds\dsound_wrapper.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_allocation.c"> + </File> + <File + RelativePath="..\..\..\..\pa_asio\pa_asio.cpp"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_converters.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_cpuload.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_dither.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_front.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_process.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_skeleton.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_stream.c"> + </File> + <File + RelativePath="..\..\..\..\pa_common\pa_trace.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win_ds\pa_win_ds.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win\pa_win_hostapis.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win\pa_win_util.c"> + </File> + <File + RelativePath="..\..\..\..\pa_win_wmme\pa_win_wmme.c"> + </File> + </Filter> + <Filter + Name="ASIO 2 SDK Files" + Filter=""> + <File + RelativePath="..\..\..\..\..\asiosdk2\common\asio.cpp"> + </File> + <File + RelativePath="..\..\..\..\..\asiosdk2\host\asiodrivers.cpp"> + </File> + <File + RelativePath="..\..\..\..\..\asiosdk2\host\pc\asiolist.cpp"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/src/audio/pacpp/build/vc7_1/static_library.sln b/src/audio/pacpp/build/vc7_1/static_library.sln new file mode 100644 index 0000000000000000000000000000000000000000..36f2ac1a4fa2f467fb1135663fb27f139162aa65 --- /dev/null +++ b/src/audio/pacpp/build/vc7_1/static_library.sln @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "static_library", "static_library.vcproj", "{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.ActiveCfg = Debug|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Debug.Build.0 = Debug|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.ActiveCfg = Release|Win32 + {D18EA0C9-8C65-441D-884C-55EB43A84F2A}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/src/audio/pacpp/build/vc7_1/static_library.vcproj b/src/audio/pacpp/build/vc7_1/static_library.vcproj new file mode 100644 index 0000000000000000000000000000000000000000..3f2bdf82eb17de1ae6fd5dbb26acf7b0918dae33 --- /dev/null +++ b/src/audio/pacpp/build/vc7_1/static_library.vcproj @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="static_library" + ProjectGUID="{D18EA0C9-8C65-441D-884C-55EB43A84F2A}" + Keyword="Win32Proj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="../../lib/" + IntermediateDirectory="Debug" + ConfigurationType="4" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="../../include/;../../../../pa_common/;../../../../" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB" + MinimalRebuild="TRUE" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)/portaudiocpp-vc7_1-d.lib"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="../../lib/" + IntermediateDirectory="Release" + ConfigurationType="4" + CharacterSet="2"> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="../../include/;../../../../pa_common/;../../../../" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="TRUE" + DebugInformationFormat="3"/> + <Tool + Name="VCCustomBuildTool"/> + <Tool + Name="VCLibrarianTool" + OutputFile="$(OutDir)/portaudiocpp-vc7_1-r.lib"/> + <Tool + Name="VCMIDLTool"/> + <Tool + Name="VCPostBuildEventTool"/> + <Tool + Name="VCPreBuildEventTool"/> + <Tool + Name="VCPreLinkEventTool"/> + <Tool + Name="VCResourceCompilerTool"/> + <Tool + Name="VCWebServiceProxyGeneratorTool"/> + <Tool + Name="VCXMLDataGeneratorTool"/> + <Tool + Name="VCManagedWrapperGeneratorTool"/> + <Tool + Name="VCAuxiliaryManagedWrapperGeneratorTool"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Files" + Filter=""> + <File + RelativePath="..\..\source\portaudiocpp\AsioDeviceAdapter.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\AsioDeviceAdapter.hxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\AutoSystem.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\BlockingStream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\BlockingStream.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\CallbackInterface.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\CallbackInterface.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\CallbackStream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\CallbackStream.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\CFunCallbackStream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\CFunCallbackStream.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\CppFunCallbackStream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\CppFunCallbackStream.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\Device.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\Device.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\DirectionSpecificStreamParameters.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\DirectionSpecificStreamParameters.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\Exception.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\Exception.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\HostApi.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\HostApi.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\InterfaceCallbackStream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\InterfaceCallbackStream.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\MemFunCallbackStream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\MemFunCallbackStream.hxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\PortAudioCpp.hxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\SampleDataFormat.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\Stream.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\Stream.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\StreamParameters.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\StreamParameters.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\System.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\System.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\SystemDeviceIterator.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\SystemDeviceIterator.hxx"> + </File> + <File + RelativePath="..\..\source\portaudiocpp\SystemHostApiIterator.cxx"> + </File> + <File + RelativePath="..\..\include\portaudiocpp\SystemHostApiIterator.hxx"> + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/src/audio/pacpp/example/devs.cxx b/src/audio/pacpp/example/devs.cxx new file mode 100644 index 0000000000000000000000000000000000000000..31a560f884e6cd3322d78e2f43b64c2a23af3054 --- /dev/null +++ b/src/audio/pacpp/example/devs.cxx @@ -0,0 +1,177 @@ +#include <iostream> +#include "portaudiocpp/PortAudioCpp.hxx" + +#ifdef WIN32 +#include "portaudiocpp/AsioDeviceAdapter.hxx" +#endif + +// --------------------------------------------------------------------------------------- + +void printSupportedStandardSampleRates( + const portaudio::DirectionSpecificStreamParameters &inputParameters, + const portaudio::DirectionSpecificStreamParameters &outputParameters) +{ + static double STANDARD_SAMPLE_RATES[] = { + 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0, + 44100.0, 48000.0, 88200.0, 96000.0, -1 }; // negative terminated list + + int printCount = 0; + + for (int i = 0; STANDARD_SAMPLE_RATES[i] > 0; ++i) + { + portaudio::StreamParameters tmp = portaudio::StreamParameters(inputParameters, outputParameters, STANDARD_SAMPLE_RATES[i], 0, paNoFlag); + + if (tmp.isSupported()) + { + if (printCount == 0) + { + std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2 + printCount = 1; + } + else if (printCount == 4) + { + std::cout << "," << std::endl; + std::cout << " " << STANDARD_SAMPLE_RATES[i]; // 8.2 + printCount = 1; + } + else + { + std::cout << ", " << STANDARD_SAMPLE_RATES[i]; // 8.2 + ++printCount; + } + } + } + + if (printCount == 0) + std::cout << "None" << std::endl; + else + std::cout << std::endl; +} + +// --------------------------------------------------------------------------------------- + +int main(int, char*[]); +int main(int, char*[]) +{ + try + { + portaudio::AutoSystem autoSys; + + portaudio::System &sys = portaudio::System::instance(); + + std::cout << "PortAudio version number = " << sys.version() << std::endl; + std::cout << "PortAudio version text = '" << sys.versionText() << "'" << std::endl; + + int numDevices = sys.deviceCount(); + std::cout << "Number of devices = " << numDevices << std::endl; + + for (portaudio::System::DeviceIterator i = sys.devicesBegin(); i != sys.devicesEnd(); ++i) + { + std::cout << "--------------------------------------- device #" << (*i).index() << std::endl; + + // Mark global and API specific default devices: + bool defaultDisplayed = false; + + if ((*i).isSystemDefaultInputDevice()) + { + std::cout << "[ Default Input"; + defaultDisplayed = true; + } + else if ((*i).isHostApiDefaultInputDevice()) + { + std::cout << "[ Default " << (*i).hostApi().name() << " Input"; + defaultDisplayed = true; + } + + if ((*i).isSystemDefaultOutputDevice()) + { + std::cout << (defaultDisplayed ? "," : "["); + std::cout << " Default Output"; + defaultDisplayed = true; + } + else if ((*i).isHostApiDefaultOutputDevice()) + { + std::cout << (defaultDisplayed ? "," : "["); + std::cout << " Default " << (*i).hostApi().name() << " Output"; + defaultDisplayed = true; + } + + if (defaultDisplayed) + std::cout << " ]" << std::endl; + + // Print device info: + std::cout << "Name = " << (*i).name() << std::endl; + std::cout << "Host API = " << (*i).hostApi().name() << std::endl; + std::cout << "Max inputs = " << (*i).maxInputChannels() << ", Max outputs = " << (*i).maxOutputChannels() << std::endl; + + std::cout << "Default low input latency = " << (*i).defaultLowInputLatency() << std::endl; // 8.3 + std::cout << "Default low output latency = " << (*i).defaultLowOutputLatency() << std::endl; // 8.3 + std::cout << "Default high input latency = " << (*i).defaultHighInputLatency() << std::endl; // 8.3 + std::cout << "Default high output latency = " << (*i).defaultHighOutputLatency() << std::endl; // 8.3 + +#ifdef WIN32 + // ASIO specific latency information: + if ((*i).hostApi().typeId() == paASIO) + { + portaudio::AsioDeviceAdapter asioDevice((*i)); + + std::cout << "ASIO minimum buffer size = " << asioDevice.minBufferSize() << std::endl; + std::cout << "ASIO maximum buffer size = " << asioDevice.maxBufferSize() << std::endl; + std::cout << "ASIO preferred buffer size = " << asioDevice.preferredBufferSize() << std::endl; + + if (asioDevice.granularity() == -1) + std::cout << "ASIO buffer granularity = power of 2" << std::endl; + else + std::cout << "ASIO buffer granularity = " << asioDevice.granularity() << std::endl; + } +#endif // WIN32 + + std::cout << "Default sample rate = " << (*i).defaultSampleRate() << std::endl; // 8.2 + + // Poll for standard sample rates: + portaudio::DirectionSpecificStreamParameters inputParameters((*i), (*i).maxInputChannels(), portaudio::INT16, true, 0.0, NULL); + portaudio::DirectionSpecificStreamParameters outputParameters((*i), (*i).maxOutputChannels(), portaudio::INT16, true, 0.0, NULL); + + if (inputParameters.numChannels() > 0) + { + std::cout << "Supported standard sample rates" << std::endl; + std::cout << " for half-duplex 16 bit " << inputParameters.numChannels() << " channel input = " << std::endl; + printSupportedStandardSampleRates(inputParameters, portaudio::DirectionSpecificStreamParameters::null()); + } + + if (outputParameters.numChannels() > 0) + { + std::cout << "Supported standard sample rates" << std::endl; + std::cout << " for half-duplex 16 bit " << outputParameters.numChannels() << " channel output = " << std::endl; + printSupportedStandardSampleRates(portaudio::DirectionSpecificStreamParameters::null(), outputParameters); + } + + if (inputParameters.numChannels() > 0 && outputParameters.numChannels() > 0) + { + std::cout << "Supported standard sample rates" << std::endl; + std::cout << " for full-duplex 16 bit " << inputParameters.numChannels() << " channel input, " << outputParameters.numChannels() << " channel output = " << std::endl; + printSupportedStandardSampleRates(inputParameters, outputParameters); + } + } + + std::cout << "----------------------------------------------" << std::endl; + } + catch (const portaudio::PaException &e) + { + std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl; + } + catch (const portaudio::PaCppException &e) + { + std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl; + } + catch (const std::exception &e) + { + std::cout << "A generic exception occured: " << e.what() << std::endl; + } + catch (...) + { + std::cout << "An unknown exception occured." << std::endl; + } + + return 0; +} diff --git a/src/audio/pacpp/example/sine.cxx b/src/audio/pacpp/example/sine.cxx new file mode 100644 index 0000000000000000000000000000000000000000..577a24724f76fccf0a420e85df4535b5b446eee2 --- /dev/null +++ b/src/audio/pacpp/example/sine.cxx @@ -0,0 +1,137 @@ +// --------------------------------------------------------------------------------------- + +#include <iostream> +#include <cmath> +#include <cassert> +#include <cstddef> +#include "portaudiocpp/PortAudioCpp.hxx" + +// --------------------------------------------------------------------------------------- + +// Some constants: +const int NUM_SECONDS = 5; +const double SAMPLE_RATE = 44100.0; +const int FRAMES_PER_BUFFER = 64; +const int TABLE_SIZE = 200; + +// --------------------------------------------------------------------------------------- + +// SineGenerator class: +class SineGenerator +{ +public: + SineGenerator(int tableSize) : tableSize_(tableSize), leftPhase_(0), rightPhase_(0) + { + const double PI = 3.14159265; + table_ = new float[tableSize]; + for (int i = 0; i < tableSize; ++i) + { + table_[i] = 0.125f * (float)sin(((double)i/(double)tableSize)*PI*2.); + } + } + + ~SineGenerator() + { + delete[] table_; + } + + int generate(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) + { + assert(outputBuffer != NULL); + + float **out = static_cast<float **>(outputBuffer); + + for (unsigned int i = 0; i < framesPerBuffer; ++i) + { + out[0][i] = table_[leftPhase_]; + out[1][i] = table_[rightPhase_]; + + leftPhase_ += 1; + if (leftPhase_ >= tableSize_) + leftPhase_ -= tableSize_; + + rightPhase_ += 3; + if (rightPhase_ >= tableSize_) + rightPhase_ -= tableSize_; + } + + return paContinue; + } + +private: + float *table_; + int tableSize_; + int leftPhase_; + int rightPhase_; +}; + +// --------------------------------------------------------------------------------------- + +// main: +int main(int, char *[]); +int main(int, char *[]) +{ + try + { + // Create a SineGenerator object: + SineGenerator sineGenerator(TABLE_SIZE); + + std::cout << "Setting up PortAudio..." << std::endl; + + // Set up the System: + portaudio::AutoSystem autoSys; + portaudio::System &sys = portaudio::System::instance(); + + // Set up the parameters required to open a (Callback)Stream: + portaudio::DirectionSpecificStreamParameters outParams(sys.defaultOutputDevice(), 2, portaudio::FLOAT32, false, sys.defaultOutputDevice().defaultLowOutputLatency(), NULL); + portaudio::StreamParameters params(portaudio::DirectionSpecificStreamParameters::null(), outParams, SAMPLE_RATE, FRAMES_PER_BUFFER, paClipOff); + + std::cout << "Opening stereo output stream..." << std::endl; + + // Create (and open) a new Stream, using the SineGenerator::generate function as a callback: + portaudio::MemFunCallbackStream<SineGenerator> stream(params, sineGenerator, &SineGenerator::generate); + + std::cout << "Starting playback for " << NUM_SECONDS << " seconds." << std::endl; + + // Start the Stream (audio playback starts): + stream.start(); + + // Wait for 5 seconds: + sys.sleep(NUM_SECONDS * 1000); + + std::cout << "Closing stream..." <<std::endl; + + // Stop the Stream (not strictly needed as termintating the System will also stop all open Streams): + stream.stop(); + + // Close the Stream (not strictly needed as terminating the System will also close all open Streams): + stream.close(); + + // Terminate the System (not strictly needed as the AutoSystem will also take care of this when it + // goes out of scope): + sys.terminate(); + + std::cout << "Test finished." << std::endl; + } + catch (const portaudio::PaException &e) + { + std::cout << "A PortAudio error occured: " << e.paErrorText() << std::endl; + } + catch (const portaudio::PaCppException &e) + { + std::cout << "A PortAudioCpp error occured: " << e.what() << std::endl; + } + catch (const std::exception &e) + { + std::cout << "A generic exception occured: " << e.what() << std::endl; + } + catch (...) + { + std::cout << "An unknown exception occured." << std::endl; + } + + return 0; +} + + diff --git a/src/audio/pacpp/include/Makefile.am b/src/audio/pacpp/include/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..d8e4f6c8040c22a3ae292a50043907a0995b46bb --- /dev/null +++ b/src/audio/pacpp/include/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = portaudiocpp \ No newline at end of file diff --git a/src/audio/pacpp/include/portaudiocpp/AsioDeviceAdapter.hxx b/src/audio/pacpp/include/portaudiocpp/AsioDeviceAdapter.hxx new file mode 100644 index 0000000000000000000000000000000000000000..3637c597470ef7cf331d0221c227e36f30d662b7 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/AsioDeviceAdapter.hxx @@ -0,0 +1,41 @@ +#ifndef INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX +#define INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX + +namespace portaudio +{ + + // Forward declaration(s): + class Device; + + // Declaration(s): + ////// + /// @brief Adapts the given Device to an ASIO specific extension. + /// + /// Deleting the AsioDeviceAdapter does not affect the underlaying + /// Device. + ////// + class AsioDeviceAdapter + { + public: + AsioDeviceAdapter(Device &device); + + Device &device(); + + long minBufferSize() const; + long maxBufferSize() const; + long preferredBufferSize() const; + long granularity() const; + + void showControlPanel(void *systemSpecific); + + private: + Device *device_; + + long minBufferSize_; + long maxBufferSize_; + long preferredBufferSize_; + long granularity_; + }; +} + +#endif // INCLUDED_PORTAUDIO_ASIODEVICEADAPTER_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/AutoSystem.hxx b/src/audio/pacpp/include/portaudiocpp/AutoSystem.hxx new file mode 100644 index 0000000000000000000000000000000000000000..16cac5ed502f623a659f596a042b96a49620a5d1 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/AutoSystem.hxx @@ -0,0 +1,62 @@ +#ifndef INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX +#define INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudiocpp/System.hxx" + +// --------------------------------------------------------------------------------------- + +namespace portaudio +{ + + + ////// + /// @brief A RAII idiom class to ensure automatic clean-up when an exception is + /// raised. + /// + /// A simple helper class which uses the 'Resource Acquisition is Initialization' + /// idiom (RAII). Use this class to initialize/terminate the System rather than + /// using System directly. AutoSystem must be created on stack and must be valid + /// throughout the time you wish to use PortAudioCpp. Your 'main' function might be + /// a good place for it. + /// + /// To avoid having to type portaudio::System::instance().xyz() all the time, it's usually + /// a good idea to make a reference to the System which can be accessed directly. + /// @verbatim + /// portaudio::AutoSys autoSys; + /// portaudio::System &sys = portaudio::System::instance(); + /// @endverbatim + ////// + class AutoSystem + { + public: + AutoSystem(bool initialize = true) + { + if (initialize) + System::initialize(); + } + + ~AutoSystem() + { + if (System::exists()) + System::terminate(); + } + + void initialize() + { + System::initialize(); + } + + void terminate() + { + System::terminate(); + } + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_AUTOSYSTEM_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/BlockingStream.hxx b/src/audio/pacpp/include/portaudiocpp/BlockingStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..37fa76652dc19a770f54d8ecd5a2fccd5f61d8f2 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/BlockingStream.hxx @@ -0,0 +1,45 @@ +#ifndef INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX +#define INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudiocpp/Stream.hxx" + +// --------------------------------------------------------------------------------------- + +namespace portaudio +{ + + + + ////// + /// @brief Stream class for blocking read/write-style input and output. + ////// + class BlockingStream : public Stream + { + public: + BlockingStream(); + BlockingStream(const StreamParameters ¶meters); + ~BlockingStream(); + + void open(const StreamParameters ¶meters); + + void read(void *buffer, unsigned long numFrames); + void write(const void *buffer, unsigned long numFrames); + + signed long availableReadSize() const; + signed long availableWriteSize() const; + + private: + BlockingStream(const BlockingStream &); // non-copyable + BlockingStream &operator=(const BlockingStream &); // non-copyable + }; + + + +} // portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_BLOCKINGSTREAM_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/CFunCallbackStream.hxx b/src/audio/pacpp/include/portaudiocpp/CFunCallbackStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b3e3b5c1b88a1cd85ffa9b704fbe6a93626a8683 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/CFunCallbackStream.hxx @@ -0,0 +1,49 @@ +#ifndef INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX +#define INCLUDED_PORTAUDIO_CFUNCALLBACKSTREAM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/CallbackStream.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s) +namespace portaudio +{ + class StreamParameters; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Callback stream using a free function with C linkage. It's important that the function + /// the passed function pointer points to is declared ``extern "C"''. + ////// + class CFunCallbackStream : public CallbackStream + { + public: + CFunCallbackStream(); + CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); + ~CFunCallbackStream(); + + void open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData); + + private: + CFunCallbackStream(const CFunCallbackStream &); // non-copyable + CFunCallbackStream &operator=(const CFunCallbackStream &); // non-copyable + }; + + // ----------------------------------------------------------------------------------- +} // portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/CallbackInterface.hxx b/src/audio/pacpp/include/portaudiocpp/CallbackInterface.hxx new file mode 100644 index 0000000000000000000000000000000000000000..d498ec5b780306c655d6c4d5f077edad995a568e --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/CallbackInterface.hxx @@ -0,0 +1,45 @@ +#ifndef INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX +#define INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +// --------------------------------------------------------------------------------------- + +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Interface for an object that's callable as a PortAudioCpp callback object (ie that implements the + /// paCallbackFun method). + ////// + class CallbackInterface + { + public: + virtual ~CallbackInterface() {} + + virtual int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) = 0; + }; + + // ----------------------------------------------------------------------------------- + + namespace impl + { + extern "C" + { + int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, + void *userData); + } // extern "C" + } + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_CALLBACKINTERFACE_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/CallbackStream.hxx b/src/audio/pacpp/include/portaudiocpp/CallbackStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..0382275e3ac2e3b7add3aa7a314b48d614163d6d --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/CallbackStream.hxx @@ -0,0 +1,40 @@ +#ifndef INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX +#define INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/Stream.hxx" + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief Base class for all Streams which use a callback-based mechanism. + ////// + class CallbackStream : public Stream + { + protected: + CallbackStream(); + virtual ~CallbackStream(); + + public: + // stream info (time-varying) + double cpuLoad() const; + + private: + CallbackStream(const CallbackStream &); // non-copyable + CallbackStream &operator=(const CallbackStream &); // non-copyable + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_CALLBACKSTREAM_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/CppFunCallbackStream.hxx b/src/audio/pacpp/include/portaudiocpp/CppFunCallbackStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e0c001274dd3f7fb55a80f60ed5b56aad66d5f8e --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/CppFunCallbackStream.hxx @@ -0,0 +1,86 @@ +#ifndef INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX +#define INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/CallbackStream.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class StreamParameters; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + namespace impl + { + extern "C" + { + int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, + void *userData); + } // extern "C" + } + + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Callback stream using a C++ function (either a free function or a static function) + /// callback. + ////// + class FunCallbackStream : public CallbackStream + { + public: + typedef int (*CallbackFunPtr)(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, + void *userData); + + // ------------------------------------------------------------------------------- + + ////// + /// @brief Simple structure containing a function pointer to the C++ callback function and a + /// (void) pointer to the user supplied data. + ////// + struct CppToCCallbackData + { + CppToCCallbackData(); + CppToCCallbackData(CallbackFunPtr funPtr, void *userData); + void init(CallbackFunPtr funPtr, void *userData); + + CallbackFunPtr funPtr; + void *userData; + }; + + // ------------------------------------------------------------------------------- + + FunCallbackStream(); + FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); + ~FunCallbackStream(); + + void open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData); + + private: + FunCallbackStream(const FunCallbackStream &); // non-copyable + FunCallbackStream &operator=(const FunCallbackStream &); // non-copyable + + CppToCCallbackData adapterData_; + + void open(const StreamParameters ¶meters); + }; + + +} // portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_CPPFUNCALLBACKSTREAM_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/Device.hxx b/src/audio/pacpp/include/portaudiocpp/Device.hxx new file mode 100644 index 0000000000000000000000000000000000000000..ffde7aa8e33f54b6b2d2a950c65b00a0f92ce5be --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/Device.hxx @@ -0,0 +1,91 @@ +#ifndef INCLUDED_PORTAUDIO_DEVICE_HXX +#define INCLUDED_PORTAUDIO_DEVICE_HXX + +// --------------------------------------------------------------------------------------- + +#include <iterator> + +#include "portaudio.h" + +#include "portaudiocpp/SampleDataFormat.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class System; + class HostApi; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + ////// + /// @brief Class which represents a PortAudio device in the System. + /// + /// A single physical device in the system may have multiple PortAudio + /// Device representations using different HostApi 's though. A Device + /// can be half-duplex or full-duplex. A half-duplex Device can be used + /// to create a half-duplex Stream. A full-duplex Device can be used to + /// create a full-duplex Stream. If supported by the HostApi, two + /// half-duplex Devices can even be used to create a full-duplex Stream. + /// + /// Note that Device objects are very light-weight and can be passed around + /// by-value. + ////// + class Device + { + public: + // query info: name, max in channels, max out channels, + // default low/hight input/output latency, default sample rate + PaDeviceIndex index() const; + const char *name() const; + int maxInputChannels() const; + int maxOutputChannels() const; + PaTime defaultLowInputLatency() const; + PaTime defaultHighInputLatency() const; + PaTime defaultLowOutputLatency() const; + PaTime defaultHighOutputLatency() const; + double defaultSampleRate() const; + + bool isInputOnlyDevice() const; // extended + bool isOutputOnlyDevice() const; // extended + bool isFullDuplexDevice() const; // extended + bool isSystemDefaultInputDevice() const; // extended + bool isSystemDefaultOutputDevice() const; // extended + bool isHostApiDefaultInputDevice() const; // extended + bool isHostApiDefaultOutputDevice() const; // extended + + bool operator==(const Device &rhs); + bool operator!=(const Device &rhs); + + // host api reference + HostApi &hostApi(); + const HostApi &hostApi() const; + + private: + PaDeviceIndex index_; + const PaDeviceInfo *info_; + + private: + friend class System; + + explicit Device(PaDeviceIndex index); + ~Device(); + + Device(const Device &); // non-copyable + Device &operator=(const Device &); // non-copyable + }; + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_DEVICE_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx b/src/audio/pacpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx new file mode 100644 index 0000000000000000000000000000000000000000..dd5ae0b90859eaf92982dcf72dc1f1f57f43f1e1 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/DirectionSpecificStreamParameters.hxx @@ -0,0 +1,77 @@ +#ifndef INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX +#define INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX + +// --------------------------------------------------------------------------------------- + +#include <cstddef> + +#include "portaudio.h" + +#include "portaudiocpp/System.hxx" +#include "portaudiocpp/SampleDataFormat.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class Device; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + ////// + /// @brief All parameters for one direction (either in or out) of a Stream. Together with + /// parameters common to both directions, two DirectionSpecificStreamParameters can make up + /// a StreamParameters object which contains all parameters for a Stream. + ////// + class DirectionSpecificStreamParameters + { + public: + static DirectionSpecificStreamParameters null(); + + DirectionSpecificStreamParameters(); + DirectionSpecificStreamParameters(const Device &device, int numChannels, SampleDataFormat format, + bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo); + + // Set up methods: + void setDevice(const Device &device); + void setNumChannels(int numChannels); + + void setSampleFormat(SampleDataFormat format, bool interleaved = true); + void setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved = true); + + void setSuggestedLatency(PaTime latency); + + void setHostApiSpecificStreamInfo(void *streamInfo); + + // Accessor methods: + PaStreamParameters *paStreamParameters(); + const PaStreamParameters *paStreamParameters() const; + + Device &device() const; + int numChannels() const; + + SampleDataFormat sampleFormat() const; + bool isSampleFormatInterleaved() const; + bool isSampleFormatHostApiSpecific() const; + PaSampleFormat hostApiSpecificSampleFormat() const; + + PaTime suggestedLatency() const; + + void *hostApiSpecificStreamInfo() const; + + private: + PaStreamParameters paStreamParameters_; + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_SINGLEDIRECTIONSTREAMPARAMETERS_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/Exception.hxx b/src/audio/pacpp/include/portaudiocpp/Exception.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a70c2f1d6e725edf3b4e659b8a6f2e73ab91f020 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/Exception.hxx @@ -0,0 +1,108 @@ +#ifndef INCLUDED_PORTAUDIO_EXCEPTION_HXX +#define INCLUDED_PORTAUDIO_EXCEPTION_HXX + +// --------------------------------------------------------------------------------------- + +#include <exception> + +#include "portaudio.h" + +// --------------------------------------------------------------------------------------- + +namespace portaudio +{ + + ////// + /// @brief Base class for all exceptions PortAudioCpp can throw. + /// + /// Class is derived from std::exception. + ////// + class Exception : public std::exception + { + public: + virtual ~Exception() throw() {} + + virtual const char *what() const throw() = 0; + }; + + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Wrapper for PortAudio error codes to C++ exceptions. + /// + /// It wraps up PortAudio's error handling mechanism using + /// C++ exceptions and is derived from std::exception for + /// easy exception handling and to ease integration with + /// other code. + /// + /// To know what exceptions each function may throw, look up + /// the errors that can occure in the PortAudio documentation + /// for the equivalent functions. + /// + /// Some functions are likely to throw an exception (such as + /// Stream::open(), etc) and these should always be called in + /// try{} catch{} blocks and the thrown exceptions should be + /// handled properly (ie. the application shouldn't just abort, + /// but merely display a warning dialog to the user or something). + /// However nearly all functions in PortAudioCpp are capable + /// of throwing exceptions. When a function like Stream::isStopped() + /// throws an exception, it's such an exceptional state that it's + /// not likely that it can be recovered. PaExceptions such as these + /// can ``safely'' be left to be handled by some outer catch-all-like + /// mechanism for unrecoverable errors. + ////// + class PaException : public Exception + { + public: + explicit PaException(PaError error); + + const char *what() const throw(); + + PaError paError() const; + const char *paErrorText() const; + + bool isHostApiError() const; // extended + long lastHostApiError() const; + const char *lastHostApiErrorText() const; + + bool operator==(const PaException &rhs) const; + bool operator!=(const PaException &rhs) const; + + private: + PaError error_; + }; + + // ----------------------------------------------------------------------------------- + + ////// + /// @brief Exceptions specific to PortAudioCpp (ie. exceptions which do not have an + /// equivalent PortAudio error code). + ////// + class PaCppException : public Exception + { + public: + enum ExceptionSpecifier + { + UNABLE_TO_ADAPT_DEVICE + }; + + PaCppException(ExceptionSpecifier specifier); + + const char *what() const throw(); + + ExceptionSpecifier specifier() const; + + bool operator==(const PaCppException &rhs) const; + bool operator!=(const PaCppException &rhs) const; + + private: + ExceptionSpecifier specifier_; + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_EXCEPTION_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/HostApi.hxx b/src/audio/pacpp/include/portaudiocpp/HostApi.hxx new file mode 100644 index 0000000000000000000000000000000000000000..899fc42d768198c5d2dd140d38e57b4fa036f911 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/HostApi.hxx @@ -0,0 +1,76 @@ +#ifndef INCLUDED_PORTAUDIO_HOSTAPI_HXX +#define INCLUDED_PORTAUDIO_HOSTAPI_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/System.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class Device; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief HostApi represents a host API (usually type of driver) in the System. + /// + /// A single System can support multiple HostApi's each one typically having + /// a set of Devices using that HostApi (usually driver type). All Devices in + /// the HostApi can be enumerated and the default input/output Device for this + /// HostApi can be retreived. + ////// + class HostApi + { + public: + typedef System::DeviceIterator DeviceIterator; + + // query info: id, name, numDevices + PaHostApiTypeId typeId() const; + PaHostApiIndex index() const; + const char *name() const; + int deviceCount() const; + + // iterate devices + DeviceIterator devicesBegin(); + DeviceIterator devicesEnd(); + + // default devices + Device &defaultInputDevice() const; + Device &defaultOutputDevice() const; + + // comparison operators + bool operator==(const HostApi &rhs) const; + bool operator!=(const HostApi &rhs) const; + + private: + const PaHostApiInfo *info_; + Device **devices_; + + private: + friend class System; + + explicit HostApi(PaHostApiIndex index); + ~HostApi(); + + HostApi(const HostApi &); // non-copyable + HostApi &operator=(const HostApi &); // non-copyable + }; + + +} + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_HOSTAPI_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/InterfaceCallbackStream.hxx b/src/audio/pacpp/include/portaudiocpp/InterfaceCallbackStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..e496dd272a0d7e5c5c89f54597026aebf5bb452a --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/InterfaceCallbackStream.hxx @@ -0,0 +1,49 @@ +#ifndef INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX +#define INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/CallbackStream.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s) +namespace portaudio +{ + class StreamParameters; + class CallbackInterface; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief Callback stream using an instance of an object that's derived from the CallbackInterface + /// interface. + ////// + class InterfaceCallbackStream : public CallbackStream + { + public: + InterfaceCallbackStream(); + InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance); + ~InterfaceCallbackStream(); + + void open(const StreamParameters ¶meters, CallbackInterface &instance); + + private: + InterfaceCallbackStream(const InterfaceCallbackStream &); // non-copyable + InterfaceCallbackStream &operator=(const InterfaceCallbackStream &); // non-copyable + }; + + +} // portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_INTERFACECALLBACKSTREAM_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/Makefile.am b/src/audio/pacpp/include/portaudiocpp/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..c594894e3c06b2d84d76d0a083e6e1f84b3e3222 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/Makefile.am @@ -0,0 +1,20 @@ +noinst_HEADERS = \ + AutoSystem.hxx \ + BlockingStream.hxx \ + CFunCallbackStream.hxx \ + CallbackInterface.hxx \ + CallbackStream.hxx \ + CppFunCallbackStream.hxx \ + Device.hxx \ + DirectionSpecificStreamParameters.hxx \ + Exception.hxx \ + HostApi.hxx \ + InterfaceCallbackStream.hxx \ + MemFunCallbackStream.hxx \ + PortAudioCpp.hxx \ + SampleDataFormat.hxx \ + Stream.hxx \ + StreamParameters.hxx \ + System.hxx \ + SystemDeviceIterator.hxx \ + SystemHostApiIterator.hxx diff --git a/src/audio/pacpp/include/portaudiocpp/MemFunCallbackStream.hxx b/src/audio/pacpp/include/portaudiocpp/MemFunCallbackStream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a9e50ca6377ea8c94751857900e6955c8ce9709c --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/MemFunCallbackStream.hxx @@ -0,0 +1,107 @@ +#ifndef INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX +#define INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/CallbackStream.hxx" +#include "portaudiocpp/CallbackInterface.hxx" +#include "portaudiocpp/StreamParameters.hxx" +#include "portaudiocpp/Exception.hxx" +#include "portaudiocpp/InterfaceCallbackStream.hxx" + +// --------------------------------------------------------------------------------------- + +namespace portaudio +{ + + + ////// + /// @brief Callback stream using a class's member function as a callback. Template argument T is the type of the + /// class of which a member function is going to be used. + /// + /// Example usage: + /// @verbatim MemFunCallback<MyClass> stream = MemFunCallbackStream(parameters, *this, &MyClass::myCallbackFunction); @endverbatim + ////// + template<typename T> + class MemFunCallbackStream : public CallbackStream + { + public: + typedef int (T::*CallbackFunPtr)(const void *, void *, unsigned long, const PaStreamCallbackTimeInfo *, + PaStreamCallbackFlags); + + // ------------------------------------------------------------------------------- + + MemFunCallbackStream() + { + } + + MemFunCallbackStream(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) : adapter_(instance, memFun) + { + open(parameters); + } + + ~MemFunCallbackStream() + { + close(); + } + + void open(const StreamParameters ¶meters, T &instance, CallbackFunPtr memFun) + { + // XXX: need to check if already open? + + adapter_.init(instance, memFun); + open(parameters); + } + + private: + MemFunCallbackStream(const MemFunCallbackStream &); // non-copyable + MemFunCallbackStream &operator=(const MemFunCallbackStream &); // non-copyable + + ////// + /// @brief Inner class which adapts a member function callback to a CallbackInterface compliant + /// class (so it can be adapted using the paCallbackAdapter function). + ////// + class MemFunToCallbackInterfaceAdapter : public CallbackInterface + { + public: + MemFunToCallbackInterfaceAdapter() {} + MemFunToCallbackInterfaceAdapter(T &instance, CallbackFunPtr memFun) : instance_(&instance), memFun_(memFun) {} + + void init(T &instance, CallbackFunPtr memFun) + { + instance_ = &instance; + memFun_ = memFun; + } + + int paCallbackFun(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags) + { + return (instance_->*memFun_)(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags); + } + + private: + T *instance_; + CallbackFunPtr memFun_; + }; + + MemFunToCallbackInterfaceAdapter adapter_; + + void open(const StreamParameters ¶meters) + { + PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), + parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, + static_cast<void *>(&adapter_)); + + if (err != paNoError) + throw PaException(err); + } + }; + + +} // portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_MEMFUNCALLBACKSTREAM_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/PortAudioCpp.hxx b/src/audio/pacpp/include/portaudiocpp/PortAudioCpp.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f11e7fb9f4e4ff601950806567c1b18d2668234f --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/PortAudioCpp.hxx @@ -0,0 +1,109 @@ +#ifndef INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX +#define INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX + +// --------------------------------------------------------------------------------------- + +////// +/// @mainpage PortAudioCpp +/// +/// <h1>PortAudioCpp - A Native C++ Binding of PortAudio V19</h1> +/// <h2>PortAudio</h2> +/// <p> +/// PortAudio is a portable and mature C API for accessing audio hardware. It offers both callback-based and blocking +/// style input and output, deals with sample data format conversions, dithering and much more. There are a large number +/// of implementations available for various platforms including Windows MME, Windows DirectX, Windows and MacOS (Classic) +/// ASIO, MacOS Classic SoundManager, MacOS X CoreAudio, OSS (Linux), Linux ALSA, JACK (MacOS X and Linux) and SGI Irix +/// AL. Note that, currently not all of these implementations are equally complete or up-to-date (as PortAudio V19 is +/// still in development). Because PortAudio has a C API, it can easily be called from a variety of other programming +/// languages. +/// </p> +/// <h2>PortAudioCpp</h2> +/// <p> +/// Although, it is possible to use PortAudio's C API from within a C++ program, this is usually a little awkward +/// as procedural and object-oriented paradigms need to be mixed. PortAudioCpp aims to resolve this by encapsulating +/// PortAudio's C API to form an equivalent object-oriented C++ API. It provides a more natural integration of PortAudio +/// into C++ programs as well as a more structured interface. PortAudio's concepts were preserved as much as possible and +/// no additional features were added except for some `convenience methods'. +/// </p> +/// <p> +/// PortAudioCpp's main features are: +/// <ul> +/// <li>Structured object model.</li> +/// <li>C++ exception handling instead of C-style error return codes.</li> +/// <li>Handling of callbacks using free functions (C and C++), static functions, member functions or instances of classes +/// derived from a given interface.</li> +/// <li>STL compliant iterators to host APIs and devices.</li> +/// <li>Some additional convenience functions to more easily set up and use PortAudio.</li> +/// </ul> +/// </p> +/// <p> +/// PortAudioCpp requires a recent version of the PortAudio V19 source code. This can be obtained from CVS or as a snapshot +/// from the website. The examples also require the ASIO 2 SDK which can be obtained from the Steinberg website. Alternatively, the +/// examples can easily be modified to compile without needing ASIO. +/// </p> +/// <p> +/// Supported platforms: +/// <ul> +/// <li>Microsoft Visual C++ 6.0, 7.0 (.NET 2002) and 7.1 (.NET 2003).</li> +/// <li>GNU G++ 2.95 and G++ 3.3.</li> +/// </ul> +/// Other platforms should be easily supported as PortAudioCpp is platform-independent and (reasonably) C++ standard compliant. +/// </p> +/// <p> +/// This documentation mainly provides information specific to PortAudioCpp. For a more complete explaination of all of the +/// concepts used, please consult the PortAudio documentation. +/// </p> +/// <p> +/// PortAudioCpp was developed by Merlijn Blaauw with many great suggestions and help from Ross Bencina. Ludwig Schwardt provided +/// GNU/Linux build files and checked G++ compatibility. PortAudioCpp may be used under the same licensing, conditions and +/// warranty as PortAudio. See <a href="http://www.portaudio.com/license.html">the PortAudio license</a> for more details. +/// </p> +/// <h2>Links</h2> +/// <p> +/// <a href="http://www.portaudio.com/">Official PortAudio site.</a><br> +/// </p> +////// + +// --------------------------------------------------------------------------------------- + +////// +/// @namespace portaudio +/// +/// To avoid name collision, everything in PortAudioCpp is in the portaudio +/// namespace. If this name is too long it's usually pretty safe to use an +/// alias like ``namespace pa = portaudio;''. +////// + +// --------------------------------------------------------------------------------------- + +////// +/// @file PortAudioCpp.hxx +/// An include-all header file (for lazy programmers and using pre-compiled headers). +////// + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/AutoSystem.hxx" +#include "portaudiocpp/BlockingStream.hxx" +#include "portaudiocpp/CallbackInterface.hxx" +#include "portaudiocpp/CallbackStream.hxx" +#include "portaudiocpp/CFunCallbackStream.hxx" +#include "portaudiocpp/CppFunCallbackStream.hxx" +#include "portaudiocpp/Device.hxx" +#include "portaudiocpp/Exception.hxx" +#include "portaudiocpp/HostApi.hxx" +#include "portaudiocpp/InterfaceCallbackStream.hxx" +#include "portaudiocpp/MemFunCallbackStream.hxx" +#include "portaudiocpp/SampleDataFormat.hxx" +#include "portaudiocpp/DirectionSpecificStreamParameters.hxx" +#include "portaudiocpp/Stream.hxx" +#include "portaudiocpp/StreamParameters.hxx" +#include "portaudiocpp/System.hxx" +#include "portaudiocpp/SystemDeviceIterator.hxx" +#include "portaudiocpp/SystemHostApiIterator.hxx" + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_PORTAUDIOCPP_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/SampleDataFormat.hxx b/src/audio/pacpp/include/portaudiocpp/SampleDataFormat.hxx new file mode 100644 index 0000000000000000000000000000000000000000..a7e25b24136789a8f62983dcedbfcfb2fa5889f3 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/SampleDataFormat.hxx @@ -0,0 +1,35 @@ +#ifndef INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX +#define INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +// --------------------------------------------------------------------------------------- + +namespace portaudio +{ + + + ////// + /// @brief PortAudio sample data formats. + /// + /// Small helper enum to wrap the PortAudio defines. + ////// + enum SampleDataFormat + { + INVALID_FORMAT = 0, + FLOAT32 = paFloat32, + INT32 = paInt32, + INT24 = paInt24, + INT16 = paInt16, + INT8 = paInt8, + UINT8 = paUInt8 + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_SAMPLEDATAFORMAT_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/Stream.hxx b/src/audio/pacpp/include/portaudiocpp/Stream.hxx new file mode 100644 index 0000000000000000000000000000000000000000..8a255ec7684e684b305cc63a47863a2c4ac6e1a1 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/Stream.hxx @@ -0,0 +1,82 @@ +#ifndef INCLUDED_PORTAUDIO_STREAM_HXX +#define INCLUDED_PORTAUDIO_STREAM_HXX + +#include "portaudio.h" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class StreamParameters; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief A Stream represents an active or inactive input and/or output data + /// stream in the System. + /// + /// Concrete Stream classes should ensure themselves being in a closed state at + /// destruction (i.e. by calling their own close() method in their deconstructor). + /// Following good C++ programming practices, care must be taken to ensure no + /// exceptions are thrown by the deconstructor of these classes. As a consequence, + /// clients need to explicitly call close() to ensure the stream closed successfully. + /// + /// The Stream object can be used to manipulate the Stream's state. Also, time-constant + /// and time-varying information about the Stream can be retreived. + ////// + class Stream + { + public: + // Opening/closing: + virtual ~Stream(); + + virtual void close(); + bool isOpen() const; + + // Additional set up: + void setStreamFinishedCallback(PaStreamFinishedCallback *callback); + + // State management: + void start(); + void stop(); + void abort(); + + bool isStopped() const; + bool isActive() const; + + // Stream info (time-constant, but might become time-variant soon): + PaTime inputLatency() const; + PaTime outputLatency() const; + double sampleRate() const; + + // Stream info (time-varying): + PaTime time() const; + + // Accessors for PortAudio PaStream, useful for interfacing + // with PortAudio add-ons (such as PortMixer) for instance: + const PaStream *paStream() const; + PaStream *paStream(); + + protected: + Stream(); // abstract class + + PaStream *stream_; + + private: + Stream(const Stream &); // non-copyable + Stream &operator=(const Stream &); // non-copyable + }; + + +} // namespace portaudio + + +#endif // INCLUDED_PORTAUDIO_STREAM_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/StreamParameters.hxx b/src/audio/pacpp/include/portaudiocpp/StreamParameters.hxx new file mode 100644 index 0000000000000000000000000000000000000000..2b6aa2ef4c39e2a1d6e8509f68a5a28a7dcf80c4 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/StreamParameters.hxx @@ -0,0 +1,77 @@ +#ifndef INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX +#define INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +#include "portaudiocpp/DirectionSpecificStreamParameters.hxx" + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + ////// + /// @brief The entire set of parameters needed to configure and open + /// a Stream. + /// + /// It contains parameters of input, output and shared parameters. + /// Using the isSupported() method, the StreamParameters can be + /// checked if opening a Stream using this StreamParameters would + /// succeed or not. Accessors are provided to higher-level parameters + /// aswell as the lower-level parameters which are mainly intended for + /// internal use. + ////// + class StreamParameters + { + public: + StreamParameters(); + StreamParameters(const DirectionSpecificStreamParameters &inputParameters, + const DirectionSpecificStreamParameters &outputParameters, double sampleRate, + unsigned long framesPerBuffer, PaStreamFlags flags); + + // Set up for direction-specific: + void setInputParameters(const DirectionSpecificStreamParameters ¶meters); + void setOutputParameters(const DirectionSpecificStreamParameters ¶meters); + + // Set up for common parameters: + void setSampleRate(double sampleRate); + void setFramesPerBuffer(unsigned long framesPerBuffer); + void setFlag(PaStreamFlags flag); + void unsetFlag(PaStreamFlags flag); + void clearFlags(); + + // Validation: + bool isSupported() const; + + // Accessors (direction-specific): + DirectionSpecificStreamParameters &inputParameters(); + const DirectionSpecificStreamParameters &inputParameters() const; + DirectionSpecificStreamParameters &outputParameters(); + const DirectionSpecificStreamParameters &outputParameters() const; + + // Accessors (common): + double sampleRate() const; + unsigned long framesPerBuffer() const; + PaStreamFlags flags() const; + bool isFlagSet(PaStreamFlags flag) const; + + private: + // Half-duplex specific parameters: + DirectionSpecificStreamParameters inputParameters_; + DirectionSpecificStreamParameters outputParameters_; + + // Common parameters: + double sampleRate_; + unsigned long framesPerBuffer_; + PaStreamFlags flags_; + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_STREAMPARAMETERS_HXX diff --git a/src/audio/pacpp/include/portaudiocpp/System.hxx b/src/audio/pacpp/include/portaudiocpp/System.hxx new file mode 100644 index 0000000000000000000000000000000000000000..f5fb7132afd4da74f580affd2f188bef2f283b52 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/System.hxx @@ -0,0 +1,107 @@ +#ifndef INCLUDED_PORTAUDIO_SYSTEM_HXX +#define INCLUDED_PORTAUDIO_SYSTEM_HXX + +// --------------------------------------------------------------------------------------- + +#include "portaudio.h" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class Device; + class Stream; + class HostApi; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief System singleton which represents the PortAudio system. + /// + /// The System is used to initialize/terminate PortAudio and provide + /// a single acccess point to the PortAudio System (instance()). + /// It can be used to iterate through all HostApi 's in the System as + /// well as all devices in the System. It also provides some utility + /// functionality of PortAudio. + /// + /// Terminating the System will also abort and close the open streams. + /// The Stream objects will need to be deallocated by the client though + /// (it's usually a good idea to have them cleaned up automatically). + ////// + class System + { + public: + class HostApiIterator; // forward declaration + class DeviceIterator; // forward declaration + + // ------------------------------------------------------------------------------- + + static int version(); + static const char *versionText(); + + static void initialize(); + static void terminate(); + + static System &instance(); + static bool exists(); + + // ------------------------------------------------------------------------------- + + // host apis: + HostApiIterator hostApisBegin(); + HostApiIterator hostApisEnd(); + + HostApi &defaultHostApi(); + + HostApi &hostApiByTypeId(PaHostApiTypeId type); + HostApi &hostApiByIndex(PaHostApiIndex index); + + int hostApiCount(); + + // ------------------------------------------------------------------------------- + + // devices: + DeviceIterator devicesBegin(); + DeviceIterator devicesEnd(); + + Device &defaultInputDevice(); + Device &defaultOutputDevice(); + + Device &deviceByIndex(PaDeviceIndex index); + + int deviceCount(); + + static Device &nullDevice(); + + // ------------------------------------------------------------------------------- + + // misc: + void sleep(long msec); + int sizeOfSample(PaSampleFormat format); + + private: + System(); + ~System(); + + static System *instance_; + static int initCount_; + + static HostApi **hostApis_; + static Device **devices_; + + static Device *nullDevice_; + }; + + +} // namespace portaudio + + +#endif // INCLUDED_PORTAUDIO_SYSTEM_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/SystemDeviceIterator.hxx b/src/audio/pacpp/include/portaudiocpp/SystemDeviceIterator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..613fc3db51a025b48b3e71c25d05741d65efaa05 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/SystemDeviceIterator.hxx @@ -0,0 +1,66 @@ +#ifndef INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX +#define INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX + +// --------------------------------------------------------------------------------------- + +#include <iterator> +#include <cstddef> + +#include "portaudiocpp/System.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class Device; + class HostApi; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief Iterator class for iterating through all Devices in a System. + /// + /// Devices will be iterated by iterating all Devices in each + /// HostApi in the System. Compliant with the STL bidirectional + /// iterator concept. + ////// + class System::DeviceIterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef Device value_type; + typedef ptrdiff_t difference_type; + typedef Device * pointer; + typedef Device & reference; + + Device &operator*() const; + Device *operator->() const; + + DeviceIterator &operator++(); + DeviceIterator operator++(int); + DeviceIterator &operator--(); + DeviceIterator operator--(int); + + bool operator==(const DeviceIterator &rhs); + bool operator!=(const DeviceIterator &rhs); + + private: + friend class System; + friend class HostApi; + Device **ptr_; + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_SYSTEMDEVICEITERATOR_HXX + diff --git a/src/audio/pacpp/include/portaudiocpp/SystemHostApiIterator.hxx b/src/audio/pacpp/include/portaudiocpp/SystemHostApiIterator.hxx new file mode 100644 index 0000000000000000000000000000000000000000..b9b13b85eb73571d515839fad201e4d1ab0d4a47 --- /dev/null +++ b/src/audio/pacpp/include/portaudiocpp/SystemHostApiIterator.hxx @@ -0,0 +1,61 @@ +#ifndef INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX +#define INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX + +// --------------------------------------------------------------------------------------- + +#include <iterator> +#include <cstddef> + +#include "portaudiocpp/System.hxx" + +// --------------------------------------------------------------------------------------- + +// Forward declaration(s): +namespace portaudio +{ + class HostApi; +} + +// --------------------------------------------------------------------------------------- + +// Declaration(s): +namespace portaudio +{ + + + ////// + /// @brief Iterator class for iterating through all HostApis in a System. + /// + /// Compliant with the STL bidirectional iterator concept. + ////// + class System::HostApiIterator + { + public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef Device value_type; + typedef ptrdiff_t difference_type; + typedef HostApi * pointer; + typedef HostApi & reference; + + HostApi &operator*() const; + HostApi *operator->() const; + + HostApiIterator &operator++(); + HostApiIterator operator++(int); + HostApiIterator &operator--(); + HostApiIterator operator--(int); + + bool operator==(const HostApiIterator &rhs); + bool operator!=(const HostApiIterator &rhs); + + private: + friend class System; + HostApi **ptr_; + }; + + +} // namespace portaudio + +// --------------------------------------------------------------------------------------- + +#endif // INCLUDED_PORTAUDIO_SYSTEMHOSTAPIITERATOR_HXX diff --git a/src/audio/pacpp/source/Makefile.am b/src/audio/pacpp/source/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..d8e4f6c8040c22a3ae292a50043907a0995b46bb --- /dev/null +++ b/src/audio/pacpp/source/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = portaudiocpp \ No newline at end of file diff --git a/src/audio/pacpp/source/portaudiocpp/AsioDeviceAdapter.cxx b/src/audio/pacpp/source/portaudiocpp/AsioDeviceAdapter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..295c26709a4c8ffe1826cc44e94cd7da29396126 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/AsioDeviceAdapter.cxx @@ -0,0 +1,61 @@ +#include "portaudiocpp/AsioDeviceAdapter.hxx" + +#include "portaudio.h" +#include "pa_asio/pa_asio.h" + +#include "portaudiocpp/Device.hxx" +#include "portaudiocpp/HostApi.hxx" +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + AsioDeviceAdapter::AsioDeviceAdapter(Device &device) + { + if (device.hostApi().typeId() != paASIO) + throw PaCppException(PaCppException::UNABLE_TO_ADAPT_DEVICE); + + device_ = &device; + + PaError err = PaAsio_GetAvailableLatencyValues(device_->index(), &minBufferSize_, &maxBufferSize_, + &preferredBufferSize_, &granularity_); + + if (err != paNoError) + throw PaException(err); + + } + + Device &AsioDeviceAdapter::device() + { + return *device_; + } + + long AsioDeviceAdapter::minBufferSize() const + { + return minBufferSize_; + } + + long AsioDeviceAdapter::maxBufferSize() const + { + return maxBufferSize_; + } + + long AsioDeviceAdapter::preferredBufferSize() const + { + return preferredBufferSize_; + } + + long AsioDeviceAdapter::granularity() const + { + return granularity_; + } + + void AsioDeviceAdapter::showControlPanel(void *systemSpecific) + { + PaError err = PaAsio_ShowControlPanel(device_->index(), systemSpecific); + + if (err != paNoError) + throw PaException(err); + } +} + + diff --git a/src/audio/pacpp/source/portaudiocpp/BlockingStream.cxx b/src/audio/pacpp/source/portaudiocpp/BlockingStream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c21535f0618699f4c7f7410033586844afd867dc --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/BlockingStream.cxx @@ -0,0 +1,100 @@ +#include "portaudiocpp/BlockingStream.hxx" + +#include "portaudio.h" + +#include "portaudiocpp/StreamParameters.hxx" +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + + // -------------------------------------------------------------------------------------- + + BlockingStream::BlockingStream() + { + } + + BlockingStream::BlockingStream(const StreamParameters ¶meters) + { + open(parameters); + } + + BlockingStream::~BlockingStream() + { + try + { + close(); + } + catch (...) + { + // ignore all errors + } + } + + // -------------------------------------------------------------------------------------- + + void BlockingStream::open(const StreamParameters ¶meters) + { + PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), + parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), NULL, NULL); + + if (err != paNoError) + { + throw PaException(err); + } + } + + // -------------------------------------------------------------------------------------- + + void BlockingStream::read(void *buffer, unsigned long numFrames) + { + PaError err = Pa_ReadStream(stream_, buffer, numFrames); + + if (err != paNoError) + { + throw PaException(err); + } + } + + void BlockingStream::write(const void *buffer, unsigned long numFrames) + { + PaError err = Pa_WriteStream(stream_, buffer, numFrames); + + if (err != paNoError) + { + throw PaException(err); + } + } + + // -------------------------------------------------------------------------------------- + + signed long BlockingStream::availableReadSize() const + { + signed long avail = Pa_GetStreamReadAvailable(stream_); + + if (avail < 0) + { + throw PaException(avail); + } + + return avail; + } + + signed long BlockingStream::availableWriteSize() const + { + signed long avail = Pa_GetStreamWriteAvailable(stream_); + + if (avail < 0) + { + throw PaException(avail); + } + + return avail; + } + + // -------------------------------------------------------------------------------------- + +} // portaudio + + + diff --git a/src/audio/pacpp/source/portaudiocpp/CFunCallbackStream.cxx b/src/audio/pacpp/source/portaudiocpp/CFunCallbackStream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fd2fb53be7c8268a167cfea927578367d33aa0a4 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/CFunCallbackStream.cxx @@ -0,0 +1,41 @@ +#include "portaudiocpp/CFunCallbackStream.hxx" + +#include "portaudiocpp/StreamParameters.hxx" +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + CFunCallbackStream::CFunCallbackStream() + { + } + + CFunCallbackStream::CFunCallbackStream(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData) + { + open(parameters, funPtr, userData); + } + + CFunCallbackStream::~CFunCallbackStream() + { + try + { + close(); + } + catch (...) + { + // ignore all errors + } + } + + // ---------------------------------------------------------------------------------== + + void CFunCallbackStream::open(const StreamParameters ¶meters, PaStreamCallback *funPtr, void *userData) + { + PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), + parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), funPtr, userData); + + if (err != paNoError) + { + throw PaException(err); + } + } +} diff --git a/src/audio/pacpp/source/portaudiocpp/CallbackInterface.cxx b/src/audio/pacpp/source/portaudiocpp/CallbackInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7e343122f7a8255f4a89a3c896babde1bb962bc1 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/CallbackInterface.cxx @@ -0,0 +1,25 @@ +#include "portaudiocpp/CallbackInterface.hxx" + +namespace portaudio +{ + + namespace impl + { + + ////// + /// Adapts any CallbackInterface object to a C-callable function (ie this function). A + /// pointer to the object should be passed as ``userData'' when setting up the callback. + ////// + int callbackInterfaceToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) + { + CallbackInterface *cb = static_cast<CallbackInterface *>(userData); + return cb->paCallbackFun(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags); + } + + + } // namespace impl + +} // namespace portaudio + + diff --git a/src/audio/pacpp/source/portaudiocpp/CallbackStream.cxx b/src/audio/pacpp/source/portaudiocpp/CallbackStream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4204dbba9b51fc9d31a7db61a952b24665cfdfdd --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/CallbackStream.cxx @@ -0,0 +1,20 @@ +#include "portaudiocpp/CallbackStream.hxx" + +namespace portaudio +{ + CallbackStream::CallbackStream() + { + } + + CallbackStream::~CallbackStream() + { + } + + // ----------------------------------------------------------------------------------- + + double CallbackStream::cpuLoad() const + { + return Pa_GetStreamCpuLoad(stream_); + } + +} // namespace portaudio diff --git a/src/audio/pacpp/source/portaudiocpp/CppFunCallbackStream.cxx b/src/audio/pacpp/source/portaudiocpp/CppFunCallbackStream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..95381398e34a3d86b06bbf89b088e6af8ada8254 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/CppFunCallbackStream.cxx @@ -0,0 +1,81 @@ +#include "portaudiocpp/CppFunCallbackStream.hxx" + +#include "portaudiocpp/StreamParameters.hxx" +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + namespace impl + { + ////// + /// Adapts any a C++ callback to a C-callable function (ie this function). A + /// pointer to a struct with the C++ function pointer and the actual user data should be + /// passed as the ``userData'' parameter when setting up the callback. + ////// + int cppCallbackToPaCallbackAdapter(const void *inputBuffer, void *outputBuffer, unsigned long numFrames, + const PaStreamCallbackTimeInfo *timeInfo, PaStreamCallbackFlags statusFlags, void *userData) + { + FunCallbackStream::CppToCCallbackData *data = static_cast<FunCallbackStream::CppToCCallbackData *>(userData); + return data->funPtr(inputBuffer, outputBuffer, numFrames, timeInfo, statusFlags, data->userData); + } + } + + // ----------------------------------------------------------------------------------- + + FunCallbackStream::CppToCCallbackData::CppToCCallbackData() + { + } + + FunCallbackStream::CppToCCallbackData::CppToCCallbackData(CallbackFunPtr funPtr, void *userData) : funPtr(funPtr), userData(userData) + { + } + + void FunCallbackStream::CppToCCallbackData::init(CallbackFunPtr funPtr, void *userData) + { + this->funPtr = funPtr; + this->userData = userData; + } + + // ----------------------------------------------------------------------------------- + + FunCallbackStream::FunCallbackStream() + { + } + + FunCallbackStream::FunCallbackStream(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) : adapterData_(funPtr, userData) + { + open(parameters); + } + + FunCallbackStream::~FunCallbackStream() + { + try + { + close(); + } + catch (...) + { + // ignore all errors + } + } + + void FunCallbackStream::open(const StreamParameters ¶meters, CallbackFunPtr funPtr, void *userData) + { + adapterData_.init(funPtr, userData); + open(parameters); + } + + void FunCallbackStream::open(const StreamParameters ¶meters) + { + PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), + parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::cppCallbackToPaCallbackAdapter, + static_cast<void *>(&adapterData_)); + + if (err != paNoError) + { + throw PaException(err); + } + } + + // ----------------------------------------------------------------------------------- +} diff --git a/src/audio/pacpp/source/portaudiocpp/Device.cxx b/src/audio/pacpp/source/portaudiocpp/Device.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cd7eb7cbd65acb15aa9b549e5cccbd5f98b0aff3 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/Device.cxx @@ -0,0 +1,168 @@ +#include "portaudiocpp/Device.hxx" + +#include <cstddef> + +#include "portaudiocpp/HostApi.hxx" +#include "portaudiocpp/System.hxx" +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + + // ------------------------------------------------------------------------------- + + Device::Device(PaDeviceIndex index) : index_(index) + { + if (index == paNoDevice) + info_ = NULL; + else + info_ = Pa_GetDeviceInfo(index); + } + + Device::~Device() + { + } + + PaDeviceIndex Device::index() const + { + return index_; + } + + const char *Device::name() const + { + if (info_ == NULL) + return ""; + + return info_->name; + } + + int Device::maxInputChannels() const + { + if (info_ == NULL) + return 0; + + return info_->maxInputChannels; + } + + int Device::maxOutputChannels() const + { + if (info_ == NULL) + return 0; + + return info_->maxOutputChannels; + } + + PaTime Device::defaultLowInputLatency() const + { + if (info_ == NULL) + return static_cast<PaTime>(0.0); + + return info_->defaultLowInputLatency; + } + + PaTime Device::defaultHighInputLatency() const + { + if (info_ == NULL) + return static_cast<PaTime>(0.0); + + return info_->defaultHighInputLatency; + } + + PaTime Device::defaultLowOutputLatency() const + { + if (info_ == NULL) + return static_cast<PaTime>(0.0); + + return info_->defaultLowOutputLatency; + } + + PaTime Device::defaultHighOutputLatency() const + { + if (info_ == NULL) + return static_cast<PaTime>(0.0); + + return info_->defaultHighOutputLatency; + } + + double Device::defaultSampleRate() const + { + if (info_ == NULL) + return 0.0; + + return info_->defaultSampleRate; + } + + // ------------------------------------------------------------------------------- + + bool Device::isInputOnlyDevice() const + { + return (maxOutputChannels() == 0); + } + + bool Device::isOutputOnlyDevice() const + { + return (maxInputChannels() == 0); + } + + bool Device::isFullDuplexDevice() const + { + return (maxInputChannels() > 0 && maxOutputChannels() > 0); + } + + bool Device::isSystemDefaultInputDevice() const + { + return (System::instance().defaultInputDevice() == *this); + } + + bool Device::isSystemDefaultOutputDevice() const + { + return (System::instance().defaultOutputDevice() == *this); + } + + bool Device::isHostApiDefaultInputDevice() const + { + return (hostApi().defaultInputDevice() == *this); + } + + bool Device::isHostApiDefaultOutputDevice() const + { + return (hostApi().defaultOutputDevice() == *this); + } + + // ------------------------------------------------------------------------------- + + bool Device::operator==(const Device &rhs) + { + return (index_ == rhs.index_); + } + + bool Device::operator!=(const Device &rhs) + { + return !(*this == rhs); + } + + // ------------------------------------------------------------------------------- + + HostApi &Device::hostApi() + { + // NOTE: will cause an exception when called for the null device + if (info_ == NULL) + throw PaException(paInternalError); + + return System::instance().hostApiByIndex(info_->hostApi); + } + + const HostApi &Device::hostApi() const + { + // NOTE; will cause an exception when called for the null device + if (info_ == NULL) + throw PaException(paInternalError); + + return System::instance().hostApiByIndex(info_->hostApi); + } + + // ------------------------------------------------------------------------------- + +} // namespace portaudio + + diff --git a/src/audio/pacpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx b/src/audio/pacpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d3c307c311acd6323d1d41b6ee4758edd3eee4fd --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/DirectionSpecificStreamParameters.cxx @@ -0,0 +1,163 @@ +#include "portaudiocpp/DirectionSpecificStreamParameters.hxx" + +#include "portaudiocpp/Device.hxx" + +namespace portaudio +{ + + // ----------------------------------------------------------------------------------- + + ////// + /// Returns a `nil' DirectionSpecificStreamParameters object. This can be used to + /// specify that one direction of a Stream is not required (i.e. when creating + /// a half-duplex Stream). All fields of the null DirectionSpecificStreamParameters + /// object are invalid except for the device and the number of channel, which are set + /// to paNoDevice and 0 respectively. + ////// + DirectionSpecificStreamParameters DirectionSpecificStreamParameters::null() + { + DirectionSpecificStreamParameters tmp; + tmp.paStreamParameters_.device = paNoDevice; + tmp.paStreamParameters_.channelCount = 0; + return tmp; + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Default constructor -- all parameters will be uninitialized. + ////// + DirectionSpecificStreamParameters::DirectionSpecificStreamParameters() + { + } + + ////// + /// Constructor which sets all required fields. + ////// + DirectionSpecificStreamParameters::DirectionSpecificStreamParameters(const Device &device, int numChannels, + SampleDataFormat format, bool interleaved, PaTime suggestedLatency, void *hostApiSpecificStreamInfo) + { + setDevice(device); + setNumChannels(numChannels); + setSampleFormat(format, interleaved); + setSuggestedLatency(suggestedLatency); + setHostApiSpecificStreamInfo(hostApiSpecificStreamInfo); + } + + // ----------------------------------------------------------------------------------- + + void DirectionSpecificStreamParameters::setDevice(const Device &device) + { + paStreamParameters_.device = device.index(); + } + + void DirectionSpecificStreamParameters::setNumChannels(int numChannels) + { + paStreamParameters_.channelCount = numChannels; + } + + void DirectionSpecificStreamParameters::setSampleFormat(SampleDataFormat format, bool interleaved) + { + paStreamParameters_.sampleFormat = static_cast<PaSampleFormat>(format); + + if (!interleaved) + paStreamParameters_.sampleFormat |= paNonInterleaved; + } + + void DirectionSpecificStreamParameters::setHostApiSpecificSampleFormat(PaSampleFormat format, bool interleaved) + { + paStreamParameters_.sampleFormat = format; + + paStreamParameters_.sampleFormat |= paCustomFormat; + + if (!interleaved) + paStreamParameters_.sampleFormat |= paNonInterleaved; + } + + void DirectionSpecificStreamParameters::setSuggestedLatency(PaTime latency) + { + paStreamParameters_.suggestedLatency = latency; + } + + void DirectionSpecificStreamParameters::setHostApiSpecificStreamInfo(void *streamInfo) + { + paStreamParameters_.hostApiSpecificStreamInfo = streamInfo; + } + + // ----------------------------------------------------------------------------------- + + PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() + { + if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice) + return &paStreamParameters_; + else + return NULL; + } + + const PaStreamParameters *DirectionSpecificStreamParameters::paStreamParameters() const + { + if (paStreamParameters_.channelCount > 0 && paStreamParameters_.device != paNoDevice) + return &paStreamParameters_; + else + return NULL; + } + + Device &DirectionSpecificStreamParameters::device() const + { + return System::instance().deviceByIndex(paStreamParameters_.device); + } + + int DirectionSpecificStreamParameters::numChannels() const + { + return paStreamParameters_.channelCount; + } + + ////// + /// Returns the (non host api-specific) sample format, without including + /// the paNonInterleaved flag. If the sample format is host api-spefific, + /// INVALID_FORMAT (0) will be returned. + ////// + SampleDataFormat DirectionSpecificStreamParameters::sampleFormat() const + { + if (isSampleFormatHostApiSpecific()) + return INVALID_FORMAT; + else + return static_cast<SampleDataFormat>(paStreamParameters_.sampleFormat & ~paNonInterleaved); + } + + bool DirectionSpecificStreamParameters::isSampleFormatInterleaved() const + { + return ((paStreamParameters_.sampleFormat & paNonInterleaved) == 0); + } + + bool DirectionSpecificStreamParameters::isSampleFormatHostApiSpecific() const + { + return ((paStreamParameters_.sampleFormat & paCustomFormat) == 0); + } + + ////// + /// Returns the host api-specific sample format, without including any + /// paCustomFormat or paNonInterleaved flags. Will return 0 if the sample format is + /// not host api-specific. + ////// + PaSampleFormat DirectionSpecificStreamParameters::hostApiSpecificSampleFormat() const + { + if (isSampleFormatHostApiSpecific()) + return paStreamParameters_.sampleFormat & ~paCustomFormat & ~paNonInterleaved; + else + return 0; + } + + PaTime DirectionSpecificStreamParameters::suggestedLatency() const + { + return paStreamParameters_.suggestedLatency; + } + + void *DirectionSpecificStreamParameters::hostApiSpecificStreamInfo() const + { + return paStreamParameters_.hostApiSpecificStreamInfo; + } + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio diff --git a/src/audio/pacpp/source/portaudiocpp/Exception.cxx b/src/audio/pacpp/source/portaudiocpp/Exception.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2e7e70137c5d3181b7fc41747568a2e5944d1b2c --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/Exception.cxx @@ -0,0 +1,123 @@ +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + // PaException: + // ----------------------------------------------------------------------------------- + + ////// + /// Wraps a PortAudio error into a PortAudioCpp PaException. + ////// + PaException::PaException(PaError error) : error_(error) + { + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Alias for paErrorText(), to have std::exception compliance. + ////// + const char *PaException::what() const throw() + { + return paErrorText(); + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Returns the PortAudio error code (PaError). + ////// + PaError PaException::paError() const + { + return error_; + } + + ////// + /// Returns the error as a (zero-terminated) text string. + ////// + const char *PaException::paErrorText() const + { + return Pa_GetErrorText(error_); + } + + ////// + /// Returns true is the error is a HostApi error. + ////// + bool PaException::isHostApiError() const + { + return (error_ == paUnanticipatedHostError); + } + + ////// + /// Returns the last HostApi error (which is the current one if + /// isHostApiError() returns true) as an error code. + ////// + long PaException::lastHostApiError() const + { + return Pa_GetLastHostErrorInfo()->errorCode; + } + + ////// + /// Returns the last HostApi error (which is the current one if + /// isHostApiError() returns true) as a (zero-terminated) text + /// string, if it's available. + ////// + const char *PaException::lastHostApiErrorText() const + { + return Pa_GetLastHostErrorInfo()->errorText; + } + + // ----------------------------------------------------------------------------------- + + bool PaException::operator==(const PaException &rhs) const + { + return (error_ == rhs.error_); + } + + bool PaException::operator!=(const PaException &rhs) const + { + return !(*this == rhs); + } + + // ----------------------------------------------------------------------------------- + // PaCppException: + // ----------------------------------------------------------------------------------- + + PaCppException::PaCppException(ExceptionSpecifier specifier) : specifier_(specifier) + { + } + + const char *PaCppException::what() const throw() + { + switch (specifier_) + { + case UNABLE_TO_ADAPT_DEVICE: + { + return "Unable to adapt the given device to the specified host api specific device extension"; + } + } + + return "Unknown exception"; + } + + PaCppException::ExceptionSpecifier PaCppException::specifier() const + { + return specifier_; + } + + bool PaCppException::operator==(const PaCppException &rhs) const + { + return (specifier_ == rhs.specifier_); + } + + bool PaCppException::operator!=(const PaCppException &rhs) const + { + return !(*this == rhs); + } + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio + + diff --git a/src/audio/pacpp/source/portaudiocpp/HostApi.cxx b/src/audio/pacpp/source/portaudiocpp/HostApi.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c6ae019ad43813fcb5c41da7c6c861a010f34af2 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/HostApi.cxx @@ -0,0 +1,121 @@ +#include "portaudiocpp/HostApi.hxx" + +#include "portaudiocpp/System.hxx" +#include "portaudiocpp/Device.hxx" +#include "portaudiocpp/SystemDeviceIterator.hxx" +#include "portaudiocpp/Exception.hxx" + +namespace portaudio +{ + + // ----------------------------------------------------------------------------------- + + HostApi::HostApi(PaHostApiIndex index) : devices_(NULL) + { + try + { + info_ = Pa_GetHostApiInfo(index); + + // Create and populate devices array: + int numDevices = deviceCount(); + + devices_ = new Device*[numDevices]; + + for (int i = 0; i < numDevices; ++i) + { + PaDeviceIndex deviceIndex = Pa_HostApiDeviceIndexToDeviceIndex(index, i); + + if (deviceIndex < 0) + { + throw PaException(deviceIndex); + } + + devices_[i] = &System::instance().deviceByIndex(deviceIndex); + } + } + catch (const std::exception &e) + { + // Delete any (partially) constructed objects (deconstructor isn't called): + delete[] devices_; // devices_ is either NULL or valid + + // Re-throw exception: + throw e; + } + } + + HostApi::~HostApi() + { + // Destroy devices array: + delete[] devices_; + } + + // ----------------------------------------------------------------------------------- + + PaHostApiTypeId HostApi::typeId() const + { + return info_->type; + } + + PaHostApiIndex HostApi::index() const + { + PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(typeId()); + + if (index < 0) + throw PaException(index); + + return index; + } + + const char *HostApi::name() const + { + return info_->name; + } + + int HostApi::deviceCount() const + { + return info_->deviceCount; + } + + // ----------------------------------------------------------------------------------- + + HostApi::DeviceIterator HostApi::devicesBegin() + { + DeviceIterator tmp; + tmp.ptr_ = &devices_[0]; // begin (first element) + return tmp; + } + + HostApi::DeviceIterator HostApi::devicesEnd() + { + DeviceIterator tmp; + tmp.ptr_ = &devices_[deviceCount()]; // end (one past last element) + return tmp; + } + + // ----------------------------------------------------------------------------------- + + Device &HostApi::defaultInputDevice() const + { + return System::instance().deviceByIndex(info_->defaultInputDevice); + } + + Device &HostApi::defaultOutputDevice() const + { + return System::instance().deviceByIndex(info_->defaultOutputDevice); + } + + // ----------------------------------------------------------------------------------- + + bool HostApi::operator==(const HostApi &rhs) const + { + return (typeId() == rhs.typeId()); + } + + bool HostApi::operator!=(const HostApi &rhs) const + { + return !(*this == rhs); + } + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio diff --git a/src/audio/pacpp/source/portaudiocpp/InterfaceCallbackStream.cxx b/src/audio/pacpp/source/portaudiocpp/InterfaceCallbackStream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..09e02de67847f48ab0dfdadebf394aacb72879f5 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/InterfaceCallbackStream.cxx @@ -0,0 +1,45 @@ +#include "portaudiocpp/InterfaceCallbackStream.hxx" + +#include "portaudiocpp/StreamParameters.hxx" +#include "portaudiocpp/Exception.hxx" +#include "portaudiocpp/CallbackInterface.hxx" + +namespace portaudio +{ + + // ---------------------------------------------------------------------------------== + + InterfaceCallbackStream::InterfaceCallbackStream() + { + } + + InterfaceCallbackStream::InterfaceCallbackStream(const StreamParameters ¶meters, CallbackInterface &instance) + { + open(parameters, instance); + } + + InterfaceCallbackStream::~InterfaceCallbackStream() + { + try + { + close(); + } + catch (...) + { + // ignore all errors + } + } + + // ---------------------------------------------------------------------------------== + + void InterfaceCallbackStream::open(const StreamParameters ¶meters, CallbackInterface &instance) + { + PaError err = Pa_OpenStream(&stream_, parameters.inputParameters().paStreamParameters(), parameters.outputParameters().paStreamParameters(), + parameters.sampleRate(), parameters.framesPerBuffer(), parameters.flags(), &impl::callbackInterfaceToPaCallbackAdapter, static_cast<void *>(&instance)); + + if (err != paNoError) + { + throw PaException(err); + } + } +} diff --git a/src/audio/pacpp/source/portaudiocpp/Makefile.am b/src/audio/pacpp/source/portaudiocpp/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..2704bf039cc649e60431f36eb3a9887425bf5195 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/Makefile.am @@ -0,0 +1,22 @@ +noinst_LTLIBRARIES = libportaudiocpp.la + +libportaudiocpp_la_SOURCES = \ + BlockingStream.cxx \ + CallbackInterface.cxx \ + CallbackStream.cxx \ + CFunCallbackStream.cxx \ + CppFunCallbackStream.cxx \ + Device.cxx \ + DirectionSpecificStreamParameters.cxx \ + Exception.cxx \ + HostApi.cxx \ + InterfaceCallbackStream.cxx \ + MemFunCallbackStream.cxx \ + Stream.cxx \ + StreamParameters.cxx \ + System.cxx \ + SystemDeviceIterator.cxx \ + SystemHostApiIterator.cxx + + +AM_CXXFLAGS = -I../../include diff --git a/src/audio/pacpp/source/portaudiocpp/MemFunCallbackStream.cxx b/src/audio/pacpp/source/portaudiocpp/MemFunCallbackStream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..113fe5a4dd382c557e92d6537c639101e014fd48 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/MemFunCallbackStream.cxx @@ -0,0 +1,4 @@ +#include "portaudiocpp/MemFunCallbackStream.hxx" + +// (... template class ...) + diff --git a/src/audio/pacpp/source/portaudiocpp/Stream.cxx b/src/audio/pacpp/source/portaudiocpp/Stream.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3b21f09082efa3c58ea959d36764ac0ee209ac9b --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/Stream.cxx @@ -0,0 +1,195 @@ +#include "portaudiocpp/Stream.hxx" + +#include <cstddef> + +#include "portaudiocpp/Exception.hxx" +#include "portaudiocpp/System.hxx" + +namespace portaudio +{ + + // ----------------------------------------------------------------------------------- + + Stream::Stream() : stream_(NULL) + { + } + + Stream::~Stream() + { + // (can't call close here, + // the derived class should atleast call + // close() in it's deconstructor) + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Closes the Stream if it's open, else does nothing. + ////// + void Stream::close() + { + if (isOpen() && System::exists()) + { + PaError err = Pa_CloseStream(stream_); + stream_ = NULL; + + if (err != paNoError) + throw PaException(err); + } + } + + ////// + /// Returns true if the Stream is open. + ////// + bool Stream::isOpen() const + { + return (stream_ != NULL); + } + + // ----------------------------------------------------------------------------------- + + void Stream::setStreamFinishedCallback(PaStreamFinishedCallback *callback) + { + PaError err = Pa_SetStreamFinishedCallback(stream_, callback); + + if (err != paNoError) + throw PaException(err); + } + + // ----------------------------------------------------------------------------------- + + void Stream::start() + { + PaError err = Pa_StartStream(stream_); + + if (err != paNoError) + throw PaException(err); + } + + void Stream::stop() + { + PaError err = Pa_StopStream(stream_); + + if (err != paNoError) + throw PaException(err); + } + + void Stream::abort() + { + PaError err = Pa_AbortStream(stream_); + + if (err != paNoError) + throw PaException(err); + } + + bool Stream::isStopped() const + { + PaError ret = Pa_IsStreamStopped(stream_); + + if (ret < 0) + throw PaException(ret); + + return (ret == 1); + } + + bool Stream::isActive() const + { + PaError ret = Pa_IsStreamActive(stream_); + + if (ret < 0) + throw PaException(ret); + + return (ret == 1); + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Returns the best known input latency for the Stream. This value may differ from the + /// suggested input latency set in the StreamParameters. Includes all sources of + /// latency known to PortAudio such as internal buffering, and Host API reported latency. + /// Doesn't include any estimates of unknown latency. + ////// + PaTime Stream::inputLatency() const + { + const PaStreamInfo *info = Pa_GetStreamInfo(stream_); + if (info == NULL) + { + throw PaException(paInternalError); + return PaTime(0.0); + } + + return info->inputLatency; + } + + ////// + /// Returns the best known output latency for the Stream. This value may differ from the + /// suggested output latency set in the StreamParameters. Includes all sources of + /// latency known to PortAudio such as internal buffering, and Host API reported latency. + /// Doesn't include any estimates of unknown latency. + ////// + PaTime Stream::outputLatency() const + { + const PaStreamInfo *info = Pa_GetStreamInfo(stream_); + if (info == NULL) + { + throw PaException(paInternalError); + return PaTime(0.0); + } + + return info->outputLatency; + } + + ////// + /// Returns the sample rate of the Stream. Usually this will be the + /// best known estimate of the used sample rate. For instance when opening a + /// Stream setting 44100.0 Hz in the StreamParameters, the actual sample + /// rate might be something like 44103.2 Hz (due to imperfections in the + /// sound card hardware). + ////// + double Stream::sampleRate() const + { + const PaStreamInfo *info = Pa_GetStreamInfo(stream_); + if (info == NULL) + { + throw PaException(paInternalError); + return 0.0; + } + + return info->sampleRate; + } + + // ----------------------------------------------------------------------------------- + + PaTime Stream::time() const + { + return Pa_GetStreamTime(stream_); + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Accessor (const) for PortAudio PaStream pointer, useful for interfacing with + /// PortAudio add-ons such as PortMixer for instance. Normally accessing this + /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's + /// functionality. + ////// + const PaStream *Stream::paStream() const + { + return stream_; + } + + ////// + /// Accessor (non-const) for PortAudio PaStream pointer, useful for interfacing with + /// PortAudio add-ons such as PortMixer for instance. Normally accessing this + /// pointer should not be needed as PortAudioCpp aims to provide all of PortAudio's + /// functionality. + ////// + PaStream *Stream::paStream() + { + return stream_; + } + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio diff --git a/src/audio/pacpp/source/portaudiocpp/StreamParameters.cxx b/src/audio/pacpp/source/portaudiocpp/StreamParameters.cxx new file mode 100644 index 0000000000000000000000000000000000000000..670873bfdb9d1f159955ff635db113cd4950a167 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/StreamParameters.cxx @@ -0,0 +1,165 @@ +#include "portaudiocpp/StreamParameters.hxx" + +#include <cstddef> + +#include "portaudiocpp/Device.hxx" + +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + + ////// + /// Default constructor; does nothing. + ////// + StreamParameters::StreamParameters() + { + } + + ////// + /// Sets up the all parameters needed to open either a half-duplex or full-duplex Stream. + /// + /// @param inputParameters The parameters for the input direction of the to-be opened + /// Stream or DirectionSpecificStreamParameters::null() for an output-only Stream. + /// @param outputParameters The parameters for the output direction of the to-be opened + /// Stream or DirectionSpecificStreamParameters::null() for an input-only Stream. + /// @param sampleRate The to-be opened Stream's sample rate in Hz. + /// @param framesPerBuffer The number of frames per buffer for a CallbackStream, or + /// the preferred buffer granularity for a BlockingStream. + /// @param flags The flags for the to-be opened Stream; default paNoFlag. + ////// + StreamParameters::StreamParameters(const DirectionSpecificStreamParameters &inputParameters, + const DirectionSpecificStreamParameters &outputParameters, double sampleRate, unsigned long framesPerBuffer, + PaStreamFlags flags) : inputParameters_(inputParameters), outputParameters_(outputParameters), + sampleRate_(sampleRate), framesPerBuffer_(framesPerBuffer), flags_(flags) + { + } + + // ----------------------------------------------------------------------------------- + + ////// + /// Sets the requested sample rate. If this sample rate isn't supported by the hardware, the + /// Stream will fail to open. The real-life sample rate used might differ slightly due to + /// imperfections in the sound card hardware; use Stream::sampleRate() to retreive the + /// best known estimate for this value. + ////// + void StreamParameters::setSampleRate(double sampleRate) + { + sampleRate_ = sampleRate; + } + + ////// + /// Either the number of frames per buffer for a CallbackStream, or + /// the preferred buffer granularity for a BlockingStream. See PortAudio + /// documentation. + ////// + void StreamParameters::setFramesPerBuffer(unsigned long framesPerBuffer) + { + framesPerBuffer_ = framesPerBuffer; + } + + ////// + /// Sets the specified flag or does nothing when the flag is already set. Doesn't + /// `unset' any previously existing flags (use clearFlags() for that). + ////// + void StreamParameters::setFlag(PaStreamFlags flag) + { + flags_ |= flag; + } + + ////// + /// Unsets the specified flag or does nothing if the flag isn't set. Doesn't affect + /// any other flags. + ////// + void StreamParameters::unsetFlag(PaStreamFlags flag) + { + flags_ &= ~flag; + } + + ////// + /// Clears or `unsets' all set flags. + ////// + void StreamParameters::clearFlags() + { + flags_ = paNoFlag; + } + + // ----------------------------------------------------------------------------------- + + void StreamParameters::setInputParameters(const DirectionSpecificStreamParameters ¶meters) + { + inputParameters_ = parameters; + } + + void StreamParameters::setOutputParameters(const DirectionSpecificStreamParameters ¶meters) + { + outputParameters_ = parameters; + } + + // ----------------------------------------------------------------------------------- + + bool StreamParameters::isSupported() const + { + return (Pa_IsFormatSupported(inputParameters_.paStreamParameters(), + outputParameters_.paStreamParameters(), sampleRate_) == paFormatIsSupported); + } + + // ----------------------------------------------------------------------------------- + + double StreamParameters::sampleRate() const + { + return sampleRate_; + } + + unsigned long StreamParameters::framesPerBuffer() const + { + return framesPerBuffer_; + } + + ////// + /// Returns all currently set flags as a binary combined + /// integer value (PaStreamFlags). Use isFlagSet() to + /// avoid dealing with the bitmasks. + ////// + PaStreamFlags StreamParameters::flags() const + { + return flags_; + } + + ////// + /// Returns true if the specified flag is currently set + /// or false if it isn't. + ////// + bool StreamParameters::isFlagSet(PaStreamFlags flag) const + { + return ((flags_ & flag) != 0); + } + + // ----------------------------------------------------------------------------------- + + DirectionSpecificStreamParameters &StreamParameters::inputParameters() + { + return inputParameters_; + } + + const DirectionSpecificStreamParameters &StreamParameters::inputParameters() const + { + return inputParameters_; + } + + DirectionSpecificStreamParameters &StreamParameters::outputParameters() + { + return outputParameters_; + } + + const DirectionSpecificStreamParameters &StreamParameters::outputParameters() const + { + return outputParameters_; + } + + // ----------------------------------------------------------------------------------- +} // namespace portaudio + + + + + diff --git a/src/audio/pacpp/source/portaudiocpp/System.cxx b/src/audio/pacpp/source/portaudiocpp/System.cxx new file mode 100644 index 0000000000000000000000000000000000000000..692c7a10ac00b5bc2bc7fec0594e76ed0efe866e --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/System.cxx @@ -0,0 +1,308 @@ +#include "portaudiocpp/System.hxx" + +#include <cstddef> +#include <cassert> + +#include "portaudiocpp/HostApi.hxx" +#include "portaudiocpp/Device.hxx" +#include "portaudiocpp/Stream.hxx" +#include "portaudiocpp/Exception.hxx" +#include "portaudiocpp/SystemHostApiIterator.hxx" +#include "portaudiocpp/SystemDeviceIterator.hxx" + +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + + // Static members: + System *System::instance_ = NULL; + int System::initCount_ = 0; + HostApi **System::hostApis_ = NULL; + Device **System::devices_ = NULL; + Device *System::nullDevice_ = NULL; + + // ----------------------------------------------------------------------------------- + + int System::version() + { + return Pa_GetVersion(); + } + + const char *System::versionText() + { + return Pa_GetVersionText(); + } + + void System::initialize() + { + ++initCount_; + + if (initCount_ == 1) + { + // Create singleton: + assert(instance_ == NULL); + instance_ = new System(); + + // Initialize the PortAudio system: + { + PaError err = Pa_Initialize(); + + if (err != paNoError) + throw PaException(err); + } + + // Create and populate device array: + { + int numDevices = instance().deviceCount(); + + devices_ = new Device*[numDevices]; + + for (int i = 0; i < numDevices; ++i) + devices_[i] = new Device(i); + } + + // Create and populate host api array: + { + int numHostApis = instance().hostApiCount(); + + hostApis_ = new HostApi*[numHostApis]; + + for (int i = 0; i < numHostApis; ++i) + hostApis_[i] = new HostApi(i); + } + + // Create null device: + nullDevice_ = new Device(paNoDevice); + } + } + + void System::terminate() + { + PaError err = paNoError; + + if (initCount_ == 1) + { + // Destroy null device: + delete nullDevice_; + + // Destroy host api array: + { + if (hostApis_ != NULL) + { + int numHostApis = instance().hostApiCount(); + + for (int i = 0; i < numHostApis; ++i) + delete hostApis_[i]; + + delete[] hostApis_; + hostApis_ = NULL; + } + } + + // Destroy device array: + { + if (devices_ != NULL) + { + int numDevices = instance().deviceCount(); + + for (int i = 0; i < numDevices; ++i) + delete devices_[i]; + + delete[] devices_; + devices_ = NULL; + } + } + + // Terminate the PortAudio system: + assert(instance_ != NULL); + err = Pa_Terminate(); + + // Destroy singleton: + delete instance_; + instance_ = NULL; + } + + if (initCount_ > 0) + --initCount_; + + if (err != paNoError) + throw PaException(err); + } + + + System &System::instance() + { + assert(exists()); + + return *instance_; + } + + bool System::exists() + { + return (instance_ != NULL); + } + + // ----------------------------------------------------------------------------------- + + System::HostApiIterator System::hostApisBegin() + { + System::HostApiIterator tmp; + tmp.ptr_ = &hostApis_[0]; // begin (first element) + return tmp; + } + + System::HostApiIterator System::hostApisEnd() + { + int count = hostApiCount(); + + System::HostApiIterator tmp; + tmp.ptr_ = &hostApis_[count]; // end (one past last element) + return tmp; + } + + HostApi &System::defaultHostApi() + { + PaHostApiIndex defaultHostApi = Pa_GetDefaultHostApi(); + + if (defaultHostApi < 0) + throw PaException(defaultHostApi); + + return *hostApis_[defaultHostApi]; + } + + HostApi &System::hostApiByTypeId(PaHostApiTypeId type) + { + PaHostApiIndex index = Pa_HostApiTypeIdToHostApiIndex(type); + + if (index < 0) + throw PaException(index); + + return *hostApis_[index]; + } + + HostApi &System::hostApiByIndex(PaHostApiIndex index) + { + if (index < 0 || index >= hostApiCount()) + throw PaException(paInternalError); + + return *hostApis_[index]; + } + + int System::hostApiCount() + { + PaHostApiIndex count = Pa_GetHostApiCount(); + + if (count < 0) + throw PaException(count); + + return count; + } + + // ----------------------------------------------------------------------------------- + + System::DeviceIterator System::devicesBegin() + { + DeviceIterator tmp; + tmp.ptr_ = &devices_[0]; + + return tmp; + } + + System::DeviceIterator System::devicesEnd() + { + int count = deviceCount(); + + DeviceIterator tmp; + tmp.ptr_ = &devices_[count]; + + return tmp; + } + + ////// + /// Returns the System's default input Device, or the null Device if none + /// was available. + ////// + Device &System::defaultInputDevice() + { + PaDeviceIndex index = Pa_GetDefaultInputDevice(); + return deviceByIndex(index); + } + + ////// + /// Returns the System's default output Device, or the null Device if none + /// was available. + ////// + Device &System::defaultOutputDevice() + { + PaDeviceIndex index = Pa_GetDefaultOutputDevice(); + return deviceByIndex(index); + } + + ////// + /// Returns the Device for the given index. + /// Will throw a paInternalError equivalent PaException if the given index + /// is out of range. + ////// + Device &System::deviceByIndex(PaDeviceIndex index) + { + if (index < -1 || index >= deviceCount()) + { + throw PaException(paInternalError); + } + + if (index == -1) + return System::instance().nullDevice(); + + return *devices_[index]; + } + + int System::deviceCount() + { + PaDeviceIndex count = Pa_GetDeviceCount(); + + if (count < 0) + throw PaException(count); + + return count; + } + + Device &System::nullDevice() + { + return *nullDevice_; + } + + // ----------------------------------------------------------------------------------- + + void System::sleep(long msec) + { + Pa_Sleep(msec); + } + + int System::sizeOfSample(PaSampleFormat format) + { + PaError err = Pa_GetSampleSize(format); + if (err < 0) + { + throw PaException(err); + return 0; + } + + return err; + } + + // ----------------------------------------------------------------------------------- + + System::System() + { + // (left blank intentionally) + } + + System::~System() + { + // (left blank intentionally) + } + + // ----------------------------------------------------------------------------------- + +} // namespace portaudio + diff --git a/src/audio/pacpp/source/portaudiocpp/SystemDeviceIterator.cxx b/src/audio/pacpp/source/portaudiocpp/SystemDeviceIterator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c3c00f70e53c0b32b89065b77f8ea18b81deb097 --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/SystemDeviceIterator.cxx @@ -0,0 +1,60 @@ +#include "portaudiocpp/SystemDeviceIterator.hxx" + +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + + Device &System::DeviceIterator::operator*() const + { + return **ptr_; + } + + Device *System::DeviceIterator::operator->() const + { + return &**this; + } + + // ----------------------------------------------------------------------------------- + + System::DeviceIterator &System::DeviceIterator::operator++() + { + ++ptr_; + return *this; + } + + System::DeviceIterator System::DeviceIterator::operator++(int) + { + System::DeviceIterator prev = *this; + ++*this; + return prev; + } + + System::DeviceIterator &System::DeviceIterator::operator--() + { + --ptr_; + return *this; + } + + System::DeviceIterator System::DeviceIterator::operator--(int) + { + System::DeviceIterator prev = *this; + --*this; + return prev; + } + + // ----------------------------------------------------------------------------------- + + bool System::DeviceIterator::operator==(const System::DeviceIterator &rhs) + { + return (ptr_ == rhs.ptr_); + } + + bool System::DeviceIterator::operator!=(const System::DeviceIterator &rhs) + { + return !(*this == rhs); + } + + // ----------------------------------------------------------------------------------- +} // namespace portaudio + + diff --git a/src/audio/pacpp/source/portaudiocpp/SystemHostApiIterator.cxx b/src/audio/pacpp/source/portaudiocpp/SystemHostApiIterator.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f34ca40c939792a615894753bad11889fb78bf5a --- /dev/null +++ b/src/audio/pacpp/source/portaudiocpp/SystemHostApiIterator.cxx @@ -0,0 +1,59 @@ +#include "portaudiocpp/SystemHostApiIterator.hxx" + +namespace portaudio +{ + // ----------------------------------------------------------------------------------- + + HostApi &System::HostApiIterator::operator*() const + { + return **ptr_; + } + + HostApi *System::HostApiIterator::operator->() const + { + return &**this; + } + + // ----------------------------------------------------------------------------------- + + System::HostApiIterator &System::HostApiIterator::operator++() + { + ++ptr_; + return *this; + } + + System::HostApiIterator System::HostApiIterator::operator++(int) + { + System::HostApiIterator prev = *this; + ++*this; + return prev; + } + + System::HostApiIterator &System::HostApiIterator::operator--() + { + --ptr_; + return *this; + } + + System::HostApiIterator System::HostApiIterator::operator--(int) + { + System::HostApiIterator prev = *this; + --*this; + return prev; + } + + // ----------------------------------------------------------------------------------- + + bool System::HostApiIterator::operator==(const System::HostApiIterator &rhs) + { + return (ptr_ == rhs.ptr_); + } + + bool System::HostApiIterator::operator!=(const System::HostApiIterator &rhs) + { + return !(*this == rhs); + } + + // ----------------------------------------------------------------------------------- +} // namespace portaudio + diff --git a/src/audio/ringbuffer.cpp b/src/audio/ringbuffer.cpp new file mode 100644 index 0000000000000000000000000000000000000000..258e1d510807a9b569d0d644965a6d977f052696 --- /dev/null +++ b/src/audio/ringbuffer.cpp @@ -0,0 +1,171 @@ +/********************************************************************** + Portions (c) Dominic Mazzoni (Audacity) + + This class is thread-safe, assuming that there is only one + thread writing, and one thread reading. If two threads both + need to read, or both need to write, they need to lock this + class from outside using their own mutex. + + AvailForPut and AvailForGet may underestimate but will never + overestimate. + +**********************************************************************/ +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "ringbuffer.h" +#include "../global.h" + +#define MIN_BUFFER_SIZE 1280 + + + +// Create a ring buffer with 'size' bytes +RingBuffer::RingBuffer(int size) { + mBufferSize = (size > MIN_BUFFER_SIZE ? size : MIN_BUFFER_SIZE); + mStart = 0; + mEnd = 0; + mBuffer = (samplePtr) malloc (mBufferSize); + assert (mBuffer != NULL); +} + +// Free memory on object deletion +RingBuffer::~RingBuffer() { + free (mBuffer); +} + +void +RingBuffer::lock (void) +{ + mMutex.enterMutex(); +} + +void +RingBuffer::unlock (void) +{ + mMutex.leaveMutex(); +} + +void +RingBuffer::flush (void) { + lock(); + mStart = 0; + mEnd = 0; + unlock(); +} + +int +RingBuffer::Len() { + return (mEnd + mBufferSize - mStart) % mBufferSize; +} + +// +// For the writer only: +// +int +RingBuffer::AvailForPut() { + return (mBufferSize-4) - Len(); +} + +// This one puts some data inside the ring buffer. +int +RingBuffer::Put(void* buffer, int toCopy) { + samplePtr src; + int block; + int copied; + int pos; + int len = Len(); + + lock(); + if (toCopy > (mBufferSize-4) - len) + toCopy = (mBufferSize-4) - len; + + src = (samplePtr) buffer; + + copied = 0; + pos = mEnd; + + while(toCopy) { + block = toCopy; + if (block > mBufferSize - pos) // from current pos. to end of buffer + block = mBufferSize - pos; + + // put the data inside the buffer. + bcopy (src, mBuffer + pos, block); + + src += block; + pos = (pos + block) % mBufferSize; + toCopy -= block; + copied += block; + } + + mEnd = pos; + + unlock(); + + // How many items copied. + return copied; +} + +// +// For the reader only: +// + +int +RingBuffer::AvailForGet() { + // Used space + return Len(); +} + +// Get will move 'toCopy' bytes from the internal FIFO to 'buffer' +int +RingBuffer::Get(void *buffer, int toCopy) { + samplePtr dest; + int block; + int copied; + int len = Len(); + + lock(); + if (toCopy > len) + toCopy = len; + + dest = (samplePtr) buffer; + copied = 0; + + while(toCopy) { + block = toCopy; + if (block > mBufferSize - mStart) + block = mBufferSize - mStart; + + bcopy (mBuffer + mStart, dest, block); + + dest += block; + mStart = (mStart + block) % mBufferSize; + toCopy -= block; + copied += block; + } + + unlock(); + return copied; +} + +// Used to discard some bytes. +int +RingBuffer::Discard(int toDiscard) { + int len = Len(); + + if (toDiscard > len) + toDiscard = len; + + mStart = (mStart + toDiscard) % mBufferSize; + + return toDiscard; +} + +/* +T +RingBuffer::getNextItem (void) { + return (T) 0; +} +*/ diff --git a/src/audio/ringbuffer.h b/src/audio/ringbuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..9deb11da641d4da085182b8f404f7f76f0520816 --- /dev/null +++ b/src/audio/ringbuffer.h @@ -0,0 +1,61 @@ +/********************************************************************** + + Audacity: A Digital Audio Editor + + RingBuffer.h + + Dominic Mazzoni + +**********************************************************************/ + +#ifndef __RING_BUFFER__ +#define __RING_BUFFER__ + +#include <cc++/thread.h> + +#include "../global.h" + +using namespace ost; + +typedef unsigned char* samplePtr; + +// template <typename T> +class RingBuffer { + public: + RingBuffer(int size); + ~RingBuffer(); + + // To set counters to 0 + void flush (void); + + // + // For the writer only: + // + int AvailForPut (void); + int Put (void*, int); + + // + // For the reader only: + // + int AvailForGet (void); + int Get (void *, int); + int Discard(int); + + int Len(); + + private: + // T getNextSample(void); + + void lock (void); + void unlock (void); + + Mutex mMutex; + int mStart; + int mEnd; + int mBufferSize; + samplePtr mBuffer; +}; + +#endif /* __RING_BUFFER__ */ + + diff --git a/src/audio/tonegenerator.cpp b/src/audio/tonegenerator.cpp index a3985c07a2d4e64b9e89128fe28eaa891b938f0d..7de00447c5c40227905acb224415e087ba5bc472 100644 --- a/src/audio/tonegenerator.cpp +++ b/src/audio/tonegenerator.cpp @@ -15,53 +15,59 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <math.h> + */ + +#include <math.h> #include <iostream> #include <fstream> -#include <stdlib.h> - +#include <stdlib.h> + +#include "audiolayer.h" +#include "audiortp.h" #include "codecDescriptor.h" +#include "ringbuffer.h" #include "ulaw.h" #include "tonegenerator.h" -#include "../configuration.h" +#include "../configuration.h" #include "../global.h" #include "../manager.h" #include "../user_cfg.h" using namespace std; -#define DTMF_FREQ_MIX_RATE 0.45f +int AMPLITUDE = 8192; + /////////////////////////////////////////////////////////////////////////////// // ToneThread implementation /////////////////////////////////////////////////////////////////////////////// -ToneThread::ToneThread (Manager *mngr, float32 *buf, int size) { +ToneThread::ToneThread (Manager *mngr, int16 *buf, int size) : Thread () { this->mngr = mngr; - this->buffer = buf; + this->buffer = buf; this->size = size; - this->buf_ctrl_vol = new float32[size]; + this->buf_ctrl_vol = new int16[size*CHANNELS]; } ToneThread::~ToneThread (void) { delete[] buf_ctrl_vol; - this->terminate(); } void ToneThread::run (void) { + int k; + int spkrVolume; while (mngr->getTonezone()) { - // Control volume + spkrVolume = mngr->getSpkrVolume(); + // control volume + mono->stereo for (int j = 0; j < size; j++) { - this->buf_ctrl_vol[j] = buffer[j] * mngr->getSpkrVolume()/100; - } - - if (mngr->getAudioDriver()->mydata.urg_remain <= 160) { - mngr->getAudioDriver()->mydata.urg_ptr = this->buf_ctrl_vol; - mngr->getAudioDriver()->mydata.urg_remain = size; + k = j*2; + buf_ctrl_vol[k] = buf_ctrl_vol[k+1] = buffer[j] * spkrVolume/100; } + if (mngr->getAudioDriver()->mainSndRingBuffer()->Len() == 0) { + mngr->getAudioDriver()->mainSndRingBuffer()->Put(buf_ctrl_vol, + SAMPLES_SIZE(size)); + } mngr->getAudioDriver()->startStream(); } } @@ -73,7 +79,7 @@ ToneThread::run (void) { ToneGenerator::ToneGenerator (Manager *mngr) { this->initTone(); this->manager = mngr; - buf = new float32[SIZEBUF]; + buf = new int16[SIZEBUF]; tonethread = NULL; } @@ -140,14 +146,15 @@ ToneGenerator::initTone (void) { * @param ptr for result buffer */ void -ToneGenerator::generateSin (int lowerfreq, int higherfreq, float32*ptr) { +ToneGenerator::generateSin (int lowerfreq, int higherfreq, int16* ptr) { double var1, var2; var1 = (double)2 * (double)M_PI * (double)higherfreq / (double)SAMPLING_RATE; var2 = (double)2 * (double)M_PI * (double)lowerfreq / (double)SAMPLING_RATE; for(int t = 0; t < SAMPLING_RATE; t++) { - ptr[t] = DTMF_FREQ_MIX_RATE * (float32)(sin(var1 * t) + sin(var2 * t)); + ptr[t] = (int16)((double)(AMPLITUDE >> 2) * sin(var1 * t) + + (double)(AMPLITUDE >> 2) * sin(var2 * t)); } } @@ -160,13 +167,13 @@ ToneGenerator::generateSin (int lowerfreq, int higherfreq, float32*ptr) { * @param ns section number of format tone */ void -ToneGenerator::buildTone (int idCountry, int idTones, float32* temp) { +ToneGenerator::buildTone (int idCountry, int idTones, int16* temp) { string s; int count = 0; int byte = 0, byte_temp = 0; static int nbcomma = 0; - float32 *buffer = new float32[SIZEBUF]; + int16 *buffer = new int16[SIZEBUF]; int pos; string str(toneZone[idCountry][idTones]); @@ -242,34 +249,20 @@ ToneGenerator::idZoneName (const string& name) { */ void ToneGenerator::toneHandle (int idr) { - manager->getAudioDriver()->mydata.urg_remain = 0; - int idz = idZoneName(get_config_fields_str(PREFERENCES, ZONE_TONE)); if (idz != -1) { buildTone (idz, idr, buf); - float32* tmp_urg_data; - // Free urg_data pointer - tmp_urg_data = manager->getAudioDriver()->mydata.urg_data; - if (tmp_urg_data != NULL) { - free (tmp_urg_data); - } - - // Init struct mydata - tmp_urg_data = buf; - manager->getAudioDriver()->mydata.urg_ptr = tmp_urg_data; - manager->getAudioDriver()->mydata.urg_remain = totalbytes; - // New thread for the tone if (tonethread == NULL) { - tonethread = new ToneThread (manager, tmp_urg_data, totalbytes); + tonethread = new ToneThread (manager, buf, totalbytes); tonethread->start(); } if (!manager->getTonezone()) { manager->getAudioDriver()->stopStream(); - manager->getAudioDriver()->mydata.urg_remain = 0; + manager->getAudioDriver()->mainSndRingBuffer()->flush(); if (tonethread != NULL) { delete tonethread; tonethread = NULL; @@ -282,10 +275,9 @@ ToneGenerator::toneHandle (int idr) { int ToneGenerator::playRingtone (const char *fileName) { short* dst = NULL; - float32* floatdst = NULL; char* src = NULL; int expandedsize, length; - Ulaw* ulaw = new Ulaw (PAYLOAD_CODEC_ULAW, CODEC_ULAW); + Ulaw* ulaw = new Ulaw (PAYLOAD_CODEC_ULAW, "G711u"); if (fileName == NULL) { return 0; @@ -311,37 +303,23 @@ ToneGenerator::playRingtone (const char *fileName) { // Decode file.ul expandedsize = ulaw->codecDecode (dst, (unsigned char *)src, length); - - floatdst = new float32[expandedsize]; - ulaw->int16ToFloat32 (dst, floatdst, expandedsize); - - float32* tmp_urg_data; - // Free urg_data pointer - tmp_urg_data = manager->getAudioDriver()->mydata.urg_data; - if (tmp_urg_data != NULL) { - free (tmp_urg_data); - } - // Init struct mydata - tmp_urg_data = floatdst; - manager->getAudioDriver()->mydata.urg_ptr = tmp_urg_data; - manager->getAudioDriver()->mydata.urg_remain = expandedsize; - // Start tone thread if (tonethread == NULL) { - tonethread = new ToneThread (manager, tmp_urg_data, expandedsize); + tonethread = new ToneThread (manager, (int16*)dst, expandedsize); tonethread->start(); } if (!manager->getTonezone()) { manager->getAudioDriver()->stopStream(); - manager->getAudioDriver()->mydata.urg_remain = 0; + manager->getAudioDriver()->mainSndRingBuffer()->flush(); if (tonethread != NULL) { delete tonethread; tonethread = NULL; delete[] dst; delete[] src; - delete[] floatdst; + delete ulaw; } } + file.close(); return 1; } diff --git a/src/audio/tonegenerator.h b/src/audio/tonegenerator.h index 7243514cf0dadd3cab6479e2eb8e7e65c85a01ae..636119ddeb688ce1a7ef4fe284c75420297fb817 100644 --- a/src/audio/tonegenerator.h +++ b/src/audio/tonegenerator.h @@ -20,9 +20,9 @@ #ifndef __TONE_GENRATOR_H__ #define __TONE_GENRATOR_H__ -#include <cc++/thread.h> #include <string> +#include "../global.h" #include "../manager.h" using namespace std; @@ -45,19 +45,20 @@ using namespace ost; #define ID_ITALY 5 #define ID_JAPAN 6 + /////////////////////////////////////////////////////////////////////////////// // ToneThread /////////////////////////////////////////////////////////////////////////////// class ToneThread : public Thread { public: - ToneThread (Manager *, float32 *, int); + ToneThread (Manager *, int16 *, int); ~ToneThread (void); virtual void run (); private: Manager* mngr; - float32* buffer; - float32* buf_ctrl_vol; + int16* buffer; + int16* buf_ctrl_vol; int size; }; @@ -74,18 +75,18 @@ public: int idZoneName (const string &); - void generateSin (int, int, float32 *); - void buildTone (int, int, float32*); + void generateSin (int, int, int16 *); + void buildTone (int, int, int16*); void toneHandle (int); int playRingtone (const char*); - float32 *sample; + int16 *sample; int freq1, freq2; int time; int totalbytes; - float32 *buf; + int16 *buf; private: /* * Initialisation of the supported tones according to the countries. diff --git a/src/call.cpp b/src/call.cpp index aa7098e03600150e53d8c91dad97c8f6cd592d0b..db19d5a97b9165ee1fc9731e1ea8edb5ac8b7634 100644 --- a/src/call.cpp +++ b/src/call.cpp @@ -18,6 +18,7 @@ */ #include <iostream> + #include "call.h" #include "manager.h" #include "sipvoiplink.h" @@ -256,9 +257,9 @@ Call::isIncomingType (void) } int -Call::outgoingCall (const string& to) +Call::outgoingCall (short id, const string& to) { - return _voIPLink->outgoingInvite(to); + return _voIPLink->outgoingInvite(id, to); } int @@ -269,6 +270,14 @@ Call::hangup (void) return i; } +int +Call::cancel (void) +{ + int i = _voIPLink->cancel(_id); + _voIPLink->deleteSipCall(_id); + return i; +} + int Call::answer (void) { diff --git a/src/call.h b/src/call.h index bab86b01696a58c121b27f0512ec20f3fbadce05..a3e21218dd03ff824ca3bea0ca00b0e1b62d045a 100644 --- a/src/call.h +++ b/src/call.h @@ -22,11 +22,8 @@ #include <string> #include <vector> -using namespace std; - -#include "sipvoiplink.h" -#include "voIPLink.h" +using namespace std; enum CallState { NotExist = 0, @@ -50,7 +47,9 @@ enum CallType { Outgoing }; -#include "manager.h" + +class Manager; +class VoIPLink; class Call { public: @@ -100,8 +99,9 @@ public: bool isOutgoingType (void); bool isIncomingType (void); - int outgoingCall (const string& to); + int outgoingCall (short id, const string& to); int hangup (void); + int cancel (void); int answer (void); int onHold (void); int offHold (void); diff --git a/src/configurationtree.cpp b/src/configurationtree.cpp index f5c649d7cc82dc68924972ae654e601b63114bbf..e885d5c15a0d8539880b0af5222139d5ef5d63f0 100644 --- a/src/configurationtree.cpp +++ b/src/configurationtree.cpp @@ -45,9 +45,7 @@ ConfigurationTree::populateFromFile (const string& fileName) { file.open(fileName.data(), fstream::out); out = true; if (!file.is_open()) { - _debug("(%s:%d) Error opening file: %s\n", - __FILE__, - __LINE__, + _debug("(%s:%d) Error opening file: %s\n", __FILE__, __LINE__, fileName.c_str()); return 0; } @@ -80,6 +78,14 @@ ConfigurationTree::populateFromFile (const string& fileName) { if (key.length() > 0 and val.length() > 0) { setValue(section, key, val); } + + // To display tree +#if 0 + if (!section.empty()) { + cout << section << "." << key << " " << val << endl; + } + /////////////////// +#endif } } diff --git a/src/error.cpp b/src/error.cpp index a46b5643221c5ebdc9c7491412882a08d8db5a7c..6d8e736ffff98e540a83bd0a52dbdb83d02c7629 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -1,9 +1,28 @@ +/** + * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <string> #include "error.h" #include "global.h" #include "manager.h" -#include <string> using namespace std; Error::Error (Manager *mngr){ @@ -12,101 +31,15 @@ Error::Error (Manager *mngr){ } int -Error::errorName (Error_enum num_name, char* err) { -#if 1 +Error::errorName (Error_enum num_name) { string str; switch (num_name){ // Handle opening device errors - case DEVICE_NOT_OPEN: - _debug("ERROR: Device Not Open\n"); - _mngr->displayError("Device not open "); - issetError = 2; - break; - case DEVICE_ALREADY_OPEN: - _debug ("ERROR: Device Already Open !\n"); - _mngr->displayError("Device already open "); - issetError = 2; - break; case OPEN_FAILED_DEVICE: - _debug ("ERROR: Open Failed\n"); - _mngr->displayError("Open device failed "); + _mngr->displayErrorText("Open device failed "); issetError = 2; break; - // Handle ALSA errors - case PARAMETER_STRUCT_ERROR_ALSA: - str = str.append("Error with hardware parameter structure: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case ACCESS_TYPE_ERROR_ALSA: - str = str.append("Cannot set access type: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case SAMPLE_FORMAT_ERROR_ALSA: - str = str.append("Cannot set sample format: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case SAMPLE_RATE_ERROR_ALSA: - str = str.append("Cannot set sample rate: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case CHANNEL_ERROR_ALSA: - str = str.append("Cannot set channel: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case PARAM_SETUP_ALSA: - str = str.append("Cannot set parameters: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case DROP_ERROR_ALSA: - str = str.append("Error: drop(): ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case PREPARE_ERROR_ALSA: - str = str.append("Error: prepare(): ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - - // Handle OSS errors - case FRAGMENT_ERROR_OSS: - str = str.append("Error: SNDCTL_DSP_SETFRAGMENT: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case SAMPLE_FORMAT_ERROR_OSS: - str = str.append("Error: SNDCTL_DSP_SETFMT: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case CHANNEL_ERROR_OSS: - str = str.append("Error: SNDCTL_DSP_CHANNELS: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case SAMPLE_RATE_ERROR_OSS: - str = str.append("Error: SNDCTL_DSP_SPEED: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case GETISPACE_ERROR_OSS: - str = str.append("Error: SNDCTL_DSP_GETISPACE: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - case GETOSPACE_ERROR_OSS: - str = str.append("Error: SNDCTL_DSP_GETOSPACE: ") + err; - _mngr->displayError((char*)str.data()); - issetError = 1; - break; - // Handle setup errors case HOST_PART_FIELD_EMPTY: _mngr->displayError("Fill host part field"); @@ -136,7 +69,5 @@ Error::errorName (Error_enum num_name, char* err) { break; } return issetError; -#endif - return 1; } diff --git a/src/error.h b/src/error.h index 983acaee0ae56966f720904ff84c2b39b687ab47..b87994644339a89c35144a7c03996198a546a1b9 100644 --- a/src/error.h +++ b/src/error.h @@ -1,3 +1,22 @@ +/** + * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef __ERROR_H__ #define __ERROR_H__ @@ -5,26 +24,8 @@ typedef enum { - DEVICE_NOT_OPEN = 0, - DEVICE_ALREADY_OPEN, - OPEN_FAILED_DEVICE, + OPEN_FAILED_DEVICE = 0, - PARAMETER_STRUCT_ERROR_ALSA, - ACCESS_TYPE_ERROR_ALSA, - SAMPLE_FORMAT_ERROR_ALSA, - SAMPLE_RATE_ERROR_ALSA, - CHANNEL_ERROR_ALSA, - PARAM_SETUP_ALSA, - DROP_ERROR_ALSA, - PREPARE_ERROR_ALSA, - - FRAGMENT_ERROR_OSS, - SAMPLE_FORMAT_ERROR_OSS, - CHANNEL_ERROR_OSS, - SAMPLE_RATE_ERROR_OSS, - GETISPACE_ERROR_OSS, - GETOSPACE_ERROR_OSS, - HOST_PART_FIELD_EMPTY, USER_PART_FIELD_EMPTY, PASSWD_FIELD_EMPTY, @@ -40,7 +41,7 @@ public: Error (Manager *mngr); ~Error (void) {}; - int errorName (Error_enum, char *); + int errorName (Error_enum); inline int getError (void) { return issetError; } inline void setError(int err) { issetError = err; } diff --git a/src/eventthread.cpp b/src/eventthread.cpp index e9cc4ac27349582537944b47a01b8062fb61012d..f68e346277d13433cd3ab32a0c69df6e9e32e123 100644 --- a/src/eventthread.cpp +++ b/src/eventthread.cpp @@ -31,7 +31,6 @@ EventThread::EventThread (SipVoIPLink* sip) : Thread () EventThread::~EventThread (void) { - terminate(); } /** diff --git a/src/global.h b/src/global.h index b9fe487775e2b649f32626e2e2ec82e504e3bf69..69f11f60da63e3b9a89fa362d2df48dd97a74c8b 100644 --- a/src/global.h +++ b/src/global.h @@ -21,6 +21,7 @@ #define __GLOBAL_H__ #include <assert.h> +#include <stdio.h> typedef float float32; typedef short int16; @@ -34,8 +35,9 @@ typedef short int16; #define _debug(...) #endif -#define SFLPHONE_VERSION "0.3.0" -#define SFLPHONE_VERSION_NUM 0x000300 +#define VERSION "0.4" +#define VERSIONNUM 0x000400 + #define PROGNAME "sflphone" #define SKINDIR "skins" @@ -53,13 +55,11 @@ typedef short int16; #define PIXMAP_ABOUT "about.png" #define MONO 1 +#define CHANNELS 2 #define SAMPLING_RATE 8000 #define SIZEBUF 1024*1024 -#define FORMAT 4 // for 16 bits format +#define FORMAT 4 #define OCTETS SAMPLING_RATE * FORMAT // Number of writen // bytes in buffer -#define OSS_DRIVER 0 -#define ALSA_DRIVER 1 - #endif // __GLOBAL_H__ diff --git a/src/gui/guiframework.cpp b/src/gui/guiframework.cpp index 8395fed417c0e0bdac26f5b110aeb054173fe160..d7e6e01ec947a45956670d4d2b9e0945287739eb 100644 --- a/src/gui/guiframework.cpp +++ b/src/gui/guiframework.cpp @@ -1,4 +1,4 @@ -/** +/** * Copyright (C) 2004-2005 Savoir-Faire Linux inc. * Author: Laurielle Lea <laurielle.lea@savoirfairelinux.com> * @@ -46,6 +46,16 @@ GuiFramework::hangupCall (short id) } } +int +GuiFramework::cancelCall (short id) +{ + if (_manager->cancelCall(id)) { + return 1; + } else { + return 0; + } +} + int GuiFramework::answerCall (short id) { diff --git a/src/gui/guiframework.h b/src/gui/guiframework.h index dcfb5851b87e597db82e432f13384ac91fe926db..3a22171cc24b16cb9b34210af219f4b8a9c3ac18 100644 --- a/src/gui/guiframework.h +++ b/src/gui/guiframework.h @@ -26,8 +26,7 @@ #include <string> using namespace std; -#include "../manager.h" - +class Manager; class GuiFramework { public: GuiFramework (Manager* manager); @@ -39,16 +38,19 @@ public: virtual int peerRingingCall (short id) = 0; virtual int peerHungupCall (short id) = 0; virtual void displayTextMessage (short id, const string& message) = 0; + virtual void displayErrorText (const string& message) = 0; virtual void displayError (const string& error) = 0; virtual void displayStatus (const string& status) = 0; virtual void displayContext (short id) = 0; virtual string getRingtoneFile (void) = 0; virtual void setup (void) = 0; virtual int selectedCall (void) = 0; + virtual bool isCurrentId (short) = 0; /* Child class to parent class */ int outgoingCall (const string& to); int hangupCall (short id); + int cancelCall (short id); int answerCall (short id); int onHoldCall (short id); int offHoldCall (short id); diff --git a/src/gui/qt/Makefile.am b/src/gui/qt/Makefile.am index 0c4d975d5b4392cd8fa95a54bdb1f50b09b499ec..e1ed20325bf3da804c3976277deff5956cf01b69 100644 --- a/src/gui/qt/Makefile.am +++ b/src/gui/qt/Makefile.am @@ -1,24 +1,20 @@ noinst_LTLIBRARIES = libsflphoneqt.la - -sflphone_UI = \ +BUILT_SOURCES = \ configurationpanel.h\ configurationpanelui.cpp\ configurationpanelmoc.cpp\ url_input.h \ url_inputui.cpp \ - url_inputmoc.cpp - -BUILT_SOURCES = \ - $(sflphone_UI) \ + url_inputmoc.cpp \ + jpushbuttonmoc.cpp \ trayiconmoc.cpp\ volumecontrolmoc.cpp\ - jpushbuttonmoc.cpp \ numerickeypadmoc.cpp \ qtGUImainwindowmoc.cpp libsflphoneqt_la_SOURCES = \ - $(sflphone_UI)\ + $(BUILT_SOURCES) \ jpushbutton.cpp \ mydisplay.cpp \ numerickeypad.cpp \ @@ -39,11 +35,8 @@ CLEANFILES = \ libsflphoneqt_la_CXXFLAGS = -DPREFIX=\"$(prefix)\" -DPROGSHAREDIR=\"${datadir}/sflphone\" - -AM_LDFLAGS = $(KDE_RPATH) - KDE_CXXFLAGS = $(USE_EXCEPTIONS) -AM_CPPFLAGS = -I$(qt_includes) $(all_includes) +AM_CPPFLAGS = -I../../audio/pacpp/include/ $(QT_INCLUDES) $(X_INCLUDES) %.h: %.ui diff --git a/src/gui/qt/configurationpanel.ui b/src/gui/qt/configurationpanel.ui index 9b402883c71fd0291885f763ee16e15f8a015cb9..1b3ba0e67d30a761f2c40c1f00478a93ef630365 100644 --- a/src/gui/qt/configurationpanel.ui +++ b/src/gui/qt/configurationpanel.ui @@ -156,7 +156,7 @@ </widget> <widget class="QLayoutWidget" row="0" column="1"> <property name="name"> - <cstring>layout19</cstring> + <cstring>layout17</cstring> </property> <vbox> <property name="name"> @@ -679,40 +679,13 @@ <rect> <x>10</x> <y>10</y> - <width>104</width> - <height>81</height> + <width>410</width> + <height>180</height> </rect> </property> <property name="title"> - <string>Drivers</string> + <string>Drivers list</string> </property> - <vbox> - <property name="name"> - <cstring>unnamed</cstring> - </property> - <widget class="QRadioButton"> - <property name="name"> - <cstring>ossButton</cstring> - </property> - <property name="text"> - <string>OSS</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - <widget class="QRadioButton"> - <property name="name"> - <cstring>alsaButton</cstring> - </property> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="text"> - <string>ALSA</string> - </property> - </widget> - </vbox> </widget> </widget> <widget class="QWidget"> @@ -960,10 +933,10 @@ </property> <widget class="QLabel"> <property name="name"> - <cstring>textLabel1_2</cstring> + <cstring>labelToneZone</cstring> </property> <property name="text"> - <string>Zone tone:</string> + <string>Tone zone:</string> </property> </widget> <widget class="QComboBox"> @@ -1134,7 +1107,7 @@ <string><p align="center"> Copyright (C) 2004-2005 Savoir-faire Linux inc.<br><br> Laurielle LEA &lt;laurielle.lea@savoirfairelinux.com&gt;<br><br> -SFLPhone-0.3.1 is released under the General Public License.<br> +SFLPhone-0.4 is released under the General Public License.<br> For more information, see http://www.sflphone.org<br> </p></string> </property> @@ -1195,7 +1168,7 @@ Montreal, Quebec H2T 1S6</p></string> <data format="XPM.GZ" length="58862">789ced5d596fe3b8b27e9f5f114cbd0d0eea6475625cdc878eb3b4b34ca72799e9745f9c07c74b76c776363b07e7bfdf629194488ad49249e4f40151109292488a923e7dac85a2fff9dbc2e9d1e1c26ffffce5fea1f370d95de85e74260bbff51e6f6f67fff7affffdf72fbfae2c2d2f34971696165717967ffdc72fbfe21f0bdd05682c37d61a52ffcc7a87f40eebbb4a6f2a7d47e93da57f17fafa4aa3b7be2274e8487d7d49eab8a4f43575fc96f533d2cf58df547a53e953a5f794fe22f48d95f5de866caf2df58d25a9c34ce96beaf8b9d4cf96cf56f9f890f5333a2edb1b2bbd29757c547a4f1d1f495dd7c78b44efb13e507a43e9db426fae6ef49af27c7da93797943e50fa9ad4f145ea49fd65a577947ea8f5ee1ad7df557a5f1e872dadcbe3f8c47a97daefb2fea0f4a6d2ef95de53faa5d4757de849bdbbacf496d03babcd5e47f6ff52ea9d25a583d2d7a48e7da927f59f125d5ecf27a537947ec47a97eacbfe4c94de51fab1d2fb528767a927f5af94de913a74b5de93e7df577a5f955f14fad96aa7af9ee758eac9f36d28bda1f0b22775dd1e9e28bdaff403a9f79695bece7a2f799e23a5ebe7f9ac74f5fc7045eaba3e7c4af43e1f5f557a43eac0f8eaae25cffb4eeafa7ee354e90da5f7a4aeebe3b5d23baa3d7e3fba3d7d3fe14ee9ea7ee250e9eafec195d4757dfc5debfd06eb6b4aefabf62fb42e8fc367a9f79795ceef5b6f2db99f33a927f7734fe90da57f937a52ff20d1657fba4a6fa8fefc99e8f238bf2fd43b7d3f51e9fa7a6e95aefa8f9b52d7f5e14ce91dd5de86d0fb0d7d7df855eaba7fd854baea0fec285dd587b6d607f2f8b5d2fbaafd2f5a57c7f97dee27fdc153a5ebf6264ad7f5ffd2baac8f37521f2c2bfd4ce90da5ff10fa20391fee4b3d29df52ba2edf49f4019fff46e91da533df0c06fa3882d2d5f1af0f4a1f683d4a94fa24622e4add123117a56e89988b52b744cc45a95b22e6a2d42d117351ea9688b928754bc45c94ba25622e4add123117a56e89988b52b744cc45a95b22e6a2d42d7f177308d821399bf77544f979e4b598c32ef6b08f033cc70bb55de2155ee3cdbcafe8e30bdee210ef7084639ce03d3ee0233ed1df09e9cf38c519decebb87ef2bd53147ac768d2f8cb601612dfbf7136ecefbaa3ea2600bb70855dbb883bbf8b960dbc5366171847bb83fef7ebfbd54c51c1e58dc16da0e3f0eeef81df91dbfbc4bdbfb848b23622d282cf99570f4c7abb6e379dfc1b7962a98c31b1a3ffddce6fb7b52aac53f091107344a5ff2d87c42e8f8eb2daf0fbf25fd7973d4e1293392e0a5eff8a3a0ec6221b785b6a5b7eef7bca53ce6e8e915f39bbd2de7f916c43f57c17a2b7ebb903c966f6447ae166c6b29be08cdbaddde5bdf3b6c187c342a28bbe4e1b0255c278edcc0267e05c42d00e8f8b80ef0ad7b3e5f298b39465c96cb06849b2b42c8359ce1267433c797b1e36d0d88db2e0ab8f2c41db108a56539f602bfa9f324fbe1cd31077d838f724740ea4786bf60e02b07e7597b0fcedfbae7f3957298f372dc00d7ac327f911597e5ac818fb108a7699915dc14c8c40e9cc105f48cba874ead9ea7fdd0c67da3676df8d56f7defc8df4cb928b7751a855deeea602b507694e1bac5b7eef97ca50ce6f08b974baecd32c47321cec93c0db2e0521f37c38364e3ad32838ae3dfac73749df69709bb3d204e931bc915fd774dffabbec14d5e3ffeae900f9a72513ee6006e1d9edb0a9786a1c373776fddf3f94a29cc2dfbb8c4ba4b6730cae19c15abb52fc9fee073a267744163ab331a1242cd7657a13016581fcf6151d99151760727b9656fd9fa53e561f8d6fd9eb714638ec63eafdd649559ceb7afe0dadb5ec5f8b1652f96b2ce98e7743fde97e7c685a587e42734b3f13698900771ef29dfa211f9166790d766618c46956bc2234ee9fca76f7d0f5e234598a3912ec45f3725caa80d9e8c7bfca4f62f57ed2b3c57e5ac6a3c87fb70477e64533c49dcc7198ef101a6f81d66788477d9676ff1dc1fd2d2a7e7fa0c973084195c12b70523bad4b3676a7da6f90c3a30a61acd40e91f7847e567844260940e71421ecc928e1e877009f7e40bbfa49c293816c80dae7ae7df568a30079fcac4df380b96ef4b265137b6d5c4fe4f55fb6ad87307256b54b0e70861a94fd9f1c6ca1c5bdee439e6ba4e12af4bda8147efb9a6b0e9cf3f402bcb4584c5cf057ddbf58dd6701eb80eb204ca32e47b4821cf0d82fc3548fb4dcfd66bf319db956a2fe144c8b1a2037d49ec39b82859a302cf116b14e604888b8c676bf35cb0ceb6739e0d62a6dc3a84310311706ff154f83cb6853d8171ee39a64551ecf7937ccc4149eee2d859418e425bfc894ffa37ecb9b29833edb97c8cc343b9bc00f99f498cc3e539ff465c6322085d2ef46e064e7156a65fcca98955483ed8b0b04e7b5e5c5780b96e0e772dbb1126f20ef2b84e656089add27c43a5ab4eed3928392e97e7395f3e1436c9f619e13d8f50e9fe84e9caf11c6d897f41c8dec91cff4ee36cb64edab359e9dc6ce2e11253da1cb8497bc66401dad7f72131c7fe68c817ddf194ff421e4288eb5655995563ff7295b900863d57d287b0ecb9c3dc92599e3347d16d63ffae1e95b23c0703c2e83159edf6fe84b518a5d639a4f5c6734edaceb199aa93e1397811ef029dcbe52e957f33f2c09f79144d7c06f2904d3bf27b282efdbe92873908fba397e18c395c046cc0849bac5cc33969d7e5f2ef567ceeba548dd7f39ce32fc038cb412ecfe9d82db6c0e226d00c3fb4b8a7a351a5fbca2832b849ed77788ed84af11379d98e1da86a3c18fb3fdb769b7d9daead598fe4610ebf0438ab2036a66c3bb75e12d123241c7a8ef7b1879b79715e279fbb92df0bae61c6e772633336cfd93618f779cb3caef6d93c67645c9969b2e56d2ef5cc0ae051362dc3fce4f09cc54d60e571a1aff6764c4ecc9c636a5c67e6681d928bb96e96af60b7242765e78c185164c2c20a86e6e1898cd6375f9b467c4ee57269cf09b1a42d9be96c1693e7f27d0887e71a9eb34f8de3724434796ed78ec5391cc8c74c5b0ebc36059c5b9cc628b679ce9e1940bd36cb735c86fc629b17ad5929ecc398c7e71025ce1d5bcf325c5421a606570e9739f32838bf15f6750fb3a36726df1afeab50f76a7bce1335b5388547c5bc3c04581c28222c840593af02790b93a3a41de8f09c937b25de73cb8f1c3b8fd80cef69ef049f4c8e53dbccdf8ff7945c9edb7478a56214173edbf5bde7001ac1d788ad2e3dbce7ccb374f2ad79db4dd27aba2f17738e9de3cb45ad1bfcf0cc7bcc7925ce1be5d85a6453c1a3c55781f94966ec0ea6bcc7b6e79cecabe5f34a9e9b94f673c5f6fc1628aa26b93cd7b6b8a354ae8afcd6d574ae0878edb990e00d95bfb238cb9a7f97999f774863ab98a3796d6e84f4c4267c9d3d07de397f8c22cd5b6ced59f69c930720567379cea8af6d35cf3dc8f4c3e1b90da757e30ccfdd67b82c67f3e749de577279cef65bd3b9b7c44df464fd3697f4493fe9a33c37d3f15bf385ce7a62d88f8615e6d873d725be427815cff96d2df23a537e38e23da6cde662ceb60f7f64e6c505ec28b8346d446ec9e63907ab561f183fe4d796e5b85d7a6be610a32b88cfa5398313b56713b59de68d3d305e64fcaec7333121c9af96f0339356560dae4bfc34d39e2b9789b0ecb9f27eab27f2e8f014fb9c16cfb9b195877c9e0bcd37b7da6cf31e8be7dc6cbe555ef2dc83cd6564cd1d1147cf5c216fe263c68493f9bc623612f9142f066f9c786b98b9089e73492894ba971773ceece42fac7c6bc95cadc573b963bbc34b9ef920786c1c67abaa22cfd97c159887697d3721f754e4393cb2ec46af9d305f29c0dcb5b68792586f9abff4320d5c383ee441e29b56fad69ff854b7b39ab49dda732539d3b2e7cef3de6b87973c2c0426dfb0556571cc716e7b82e79a165f79470998581cb5ce67a9ca730dab8dc2797df54b01e63a094f64e36dde6f02c907f5fb92157d5e6c2575137e34f2adaf9957720139b90bc76fcde484a83fd9785b259e7338cc6bd1d9795299d7a8cc73b7561b7e0b08e6397bb370fedc5e300ee6650d62466f79a8b8a289f18d57ea8526f65cd9d62c7bee22ef8b5b273eb7eb8eae3831b84667a52ad9733cea99e7c85eb39527d57da8ca734e1ee2366b27e0a2884e136fcf213627a4107367c118981f7327deb2b93ea3b79d6b6d131afbd2f85cc9595036cfe5f1a39b6fd579247517d0e21a9d4bafca734de71c1607e186fd0dace6daaa3ca7a2d7693b632b5b36219426b6dec7cbf1ababfa1488f5fba3584f5e4eec5a2d7e29c20c8d6487b23e18350d7baee437f98e3d27da7bc26bfe4aec0c76f026b5313df34a1e93f9235bc416296725b9d86af61cd77062678487a9980bcf2b99d8f3eabeeb79ead5790ef7ed6f64a9f777c4a12d7a73d6ad3cc72eeebd359eca4809cc75d03f4fe44f4fd91b1f278215eb861ecab973413f965a39d4fc68bda3697cae24e65c9ef36df024d8cfbf9e08bc40dfcab38a2dc9c556e539f12e79e7cae5e607aaf31cc7654a9c43e639ea9752df1afee9e52e8f756ac5d5923cab3d57c498537268e62cd4d18ecafecbfa16b68cf85ce9b547f025688f5a9c5d7a9ef0d8988d6bd671fc43e215b3debeb17fa9c479ccb97b95798ef717ae8f42e89fd3ecf492dff11f7839c2f10369b4cae44c61e4ceedc41bd8b2ca5c72066b8dc6bc7dec9bf1347b44b66276a5a39999b928be6d10e2b90cefb5cc33e3c4389659338e9ea93e66dd01f12d56ee7976ecd89df33d843b37fbd8386665897196c7a9e4417cd0ef218c2b58f172841127232bed30cb21bed9c41cc53bcce59e174260c6e6c3dfd5f10a1e49609d15fbef75a9ef2176325fd3fc20ab4b1e6b7bce7cac8e7dcfe6f3f1ab9527357dd5a32c16f029e1a6ec9a08a9afbbebe662bf8a6fd9be67cf43e79e8b1da7a5c2ba4c2b7e8e202611ab21f9befbbac89b794e185dc1cb6c7be4b3acf96b243c7a55e50af10b5c65e6d8a5f24d62db89cf6d8ad506f116ce0939c46770e7fff29438eb0e4710f2e167b01d5ef781fcd4291e93bdb8091db21bc70070e79bcfc2e74142cfc8df07f2b7ee704cfdf0f7615f7c718b47d4fe0c0506a7f3febab5e2fa73df8cfc6be15ff2154a45d1e89e7dc12e1c10a20af334342e1f54cba1951587e7d6dfe31c51a4545b67932cfcb273d856e77d65d5c4b1e7fecb57f49daf545f4f18ce3cebcc59f3e4b057cc581f4d2c9efb3ecfafdcfffbe575eba613dfadaa58b1c96dcb7812b2c53eba58f3e7e6f265cacf254994fb156b6cffbddf87c01659619bbcc666096bec230b790c29cfcdbd37957b7f1b9a1bf54ee79b605bcc3026ff7b884fc15253ff4c82f83b385ae025b1e77e8a95cac9537dd4cf148f0803019ff75dcedda7bbb52efa407f3d7122eed30f98fa675245cc6949e69ded64e35c1f51a08f6d9d8703a0ff6bf47b08ed7c6e62b2761073b774ccfbf646cca5c22b03ce7e8e5f01c12631db4b92d53f224ea9317b8adb74be06af36360dadb543e3ee4be4b9aa8220a2baf82c249d394c96df3eaf8ad8247c9a6b81006ee008c5bccb75f5053e582b324d6cfe34d6779af1d7a723dc4a66ac00b5b108e7380cc589517c952884bf06123c074311b9a636c4b70fd64a50740d47b84eef53c1db04f738c6276a690cad74bd46c2ce3936685ba7f6f5fcaa323c774ac7bcbf60103117161abd8e047a080153fdcee20f7a26e24edf132a1e04d7c84c83989706537af6e2c91fd3336b094b3bcd55c13d3dc9699a3d23dc3e0a1c93d5d3a2273862643cc240cdeedc127692380fb5ef99274f3d7a54fd78e49537c56a9a6dfebda60798d179fa12a9544eac43774c489ca2f82e312707c1f938d9c63db5a1381487b84d75c53b764af7635baf6020ed39be2f219e8310f746cc85c5e405badb6da103f38bcea0121bb465665d7872aebf4b8c933c0f40ae97cc04854769f513e2da3ac34a3ca34ac09d6431f20a037379457d3ece7599e7668a5d9b023bb28764a3b6d3160889399683b8428d4a14efceb6ea53bab2a5e895fc46a304cf718b5e8c47cc95131ecbf6388ed74e5732a7777906721d89470fe6c8e6d2775da09339418f4e13815562b7a9594bd86522064123aae0b87e78ee07f1a4e04048eb19ebe22d4aeb9d38746622826c84b66f25163ec69c9a9ffbc73d7d8d65ec3931c3c0bf3f62ae8c306371448a79cef8f681ac37f915ea3a3353c35979eb51e7f84539168dc16dc144b2969e1387fb0223e249499ecbff5d0818a4f612fbad49691a0fd9cee335eddae96a13c2560bc51e39da92fb8d188fad8a87cbf15c287a1331972fbc7afabde4288101c173e69a21642bb5d53aeb6c0d11f7b4d2df39c4b1b4e8041f12beee68ec92df729dca919af889ed3042e494acf47b14489ae9b857becd0f2de2448d6830ed3ee6e24bf9a6703bf41fa1f888da7e0afd2e19db0ea17b704a0c3911f6a8b01f794f097b2e2c117321c1167b09fcf536bde3438939e639e38b6ec154fa7fb27deea43f49a5e52a3a5bd25aa367ced8a3b148f2c4a2fcc2465873f42cd14597e4b982fedda74cc83c675a9fcc73b0adbcd912d11fb6e63c5fe4d01508bbe007db78e2ad929e45299e0b49c45c48c4334d474acef69c2b9e33ec7ab6d2adf71c26621c250e427e4ec2b34cd0c156d8808f4b5d708767652469cf15f58fb84dfb32c29e4b7a21ceca3c37947fcb5e6d766c657b33b100c5fb26cb94b3e7421231e717810ecbba9f04786e94c58688a7249ee391b2e3b46fda521ea9f47685e5e5fb6587923c67d973e6ac7969cf9d9a9e72416b23ee97b326077be3497e83af3df2dcbb094cf819682ff394b5a987e746ca9e33c625b6a75ea4b720d0435c90c6e59e9903d3b89df00492f9bf34864ba40ec379cca4ec84da51dfae727c2ec3733c86bfa4ab7d91b5300dfa98fb6caf6d2719dc0deaa988eebda416204764c6b2d7ca9e1be6d97310f855b388b990f00828be09ddc031fb93722685e00e234a4b969a8c9534e8dd5f17bf8e04d2a6532312790f633342c1f113834f84374825d6a9ddafb00d331561c6222f52fbd26a55b2a30ccfc9d8728bfde545dc00b16eec76deec059cb1cd3aa41a138ef08937e996e37e77e25de0b743c70f5b9263a5671c686f3fe621aa0bee894c02bdef7b34aaece9cc8fbd8616dd5995d1a2e313fe052f61bf19712ef1bcac1a5fed118cd8846a127300e156b10c79230d7745cdac48bb51b02e21d62a0d8f464e6e28fa457d1a17fdde35e1f252bc5d847cd01904eafdb6f88e82aeee2b217028475a7a0ff95706443fc3bf688c81bc47c4dccf2c345abef91783ef3fc721622e4add123117a56e89988b52b744cc45a95b22e6a2d42d117351ea9688b928754bc45c94ba25622e4add123117a56e89988b52b744cc45a95b22e6a2d42d117351ea9688b928754bc45c94ba25622e4add123117a56e89988b52b744cc45a95b7efdcffffcf2ff6d14cd7e</data> </image> <image name="image1"> - <data format="PNG" length="4951">89504e470d0a1a0a0000000d49484452000000ad0000003008060000006357fade0000131e49444154789ced5d7f681b579eff3c735be4e02d52d91629d062972658de6341da181a850d917a85ad1c173aba5d88eddd522949c93a774b6ba770e44771ec72248e127267efe2247230b565c8462a38b67364b1547cc85e925a2a592c19a7d8c1596ce32eb6d01ad79883effd31d64823cd483392b34db77a603e4de7bdeffb7edf7cdfe77ddf77de8cb00ae006809d4222225a2022220a6d236d11ed743f25fcfe62d10e3a3cbb48a1052253cf18a18d086db765d1da47d4726f8a8888be6dc34bf8ddc5821a4eaf100dcf12692fdc26dcda764c95a81d22720e51c9814ba81a55352022b2f6e56754b568ed235a4c6c944288122a424515698b8f4f0b615435d83e3e5d72dc12e6c5bc15a65756c9d4b3b3cc9a0b4d3d63a590a184393167055a21d20e3d7d86cd44ed85db25c72da12cca5e985e5925ed850218b37b98d043849e31420f91ddcf670b6e471729b4a85cce4e382e115157cf0d721e7366fd75ba3b896689161717bf33210911d1f0d030d1c6ce4de88dc40675ba3bc979cc49fb0f59c979cc49345b98fca7a19f14ee0cc35eb84d73ab4494a09c2534477f17c6a504d1d4ad6932ee33d1e97ded64dc6712fea4fe7dbaadfd3bc1eca7dbda05fd77ca3186ddc359e3f19b532d054de4a7a19f22a6ddd822d50caba43847a70a8a710b715ce731a7e846580fdba9abe706d10a51ff403fcdb9e7c87ad82eaa33159e7ae6199788d79f5676c6216885446360dc67e299b6c009bcd3fa29665aeb7d95316820bfc39a064245c5b8d6be31c50e454422461df384640790668936c21b343c349c533ecdd28e842a39af17c14cb448aa998d8868ff216bd60a34373a9773bcfe1efad162eef16637007000fc00ec09a2dd577c001c0094a1b3360ccf5b66c815d7dd307a1f9815cb93c3fe77e661ffc9abcc9fa6af14ce87a7a8e9f851a17fabd5868e4e77de76e9e85a2172fcb611b14731499bac561b5a8f3543bbf7555677c84af1f538b4155a4cdc0ac0f31263e9f222e3213a73ee0ce2eb7118f718611ff4b2a49e9ec14d441ef0d7d28b718f11fbf799d0fa612b3c2c25cfe69ea3ba410700a0eb72174c070f306fcf0deabede2db4d5eb0d585e5e02004c7d1082b7711793b233a9b754897ac3f0ec65cc354b64fbb04e90975eb4155a7459bb6038a68366f76ea6543f6d8556b037a99f8b88baaf79e0bbe3cfea4baf3760a0be1fda231a6c3ebf8bf9019409378a886a7eef038cdb8ea210b96a79879d98077ad7cdaae4c9e1c9c755d06d11e57338b349ac8f2ea885e3b09d6ca37314190f916b83289fe3d6d8cd883d8a415ba145d41be6ffc6c3b05a6de0c021180ca0f1b80bba041107fe26c5d7e3b039ebb2e4c52ec6849bb4f6b73838001e7727351d3f8a60f0246ceb36e8f506741e69c77e9309ce0a17628f62e81df4a2a6d60cd76c4adfba410738700000238cf003a85cd78becb52cef17fefb93afdcb2768e5d1e0100415eb2749de802f4dbe3d0608665793ff47a03a2de30faafdd10c621be1e47d39d26f88f8f428d7eb6759b483f171159ac36745fefc6f2f2129af5cde0ea398c9cf7c1b8c708cbf27ebc71fd0dbcf1761d74b3fcfd1798b675688a7a230530a23e003a6e835471cd03bd9f16c7b0e9d87ec2014306934932e52c514d83fc6402f8196fdc5305db211b1a1b1a458ce622a270248c2af34fb318fac03e13256544c7c3e8fed4837426191b1a1198c7454435b5293da2de3046664670eafc594187e6632ed81b9b44fd340c6cd04faf1c48b51b0dc3f31263eeb4be9b8f35a3e1fda3acf59893262311916dc63d46388f34c0f2f661363ad04f135f566133ee010098f759d07cdc050f632cb31fae9e43d5c767f38e43965de3617876a9d7afaebe0eaee32e24af5bad36983bdda2fbeb6e6b27ff1d3f0060bfc904cbf55e56c601d06d11f9512023ea6c887e9de51300004f058a66d87474dff4c145f999d2b397b1e883309c471a70bafe347f433218c5b66ec36424824faeb851536b867d7c5590eb618ca5dfa8f9f014358437c871d82edc140e1c3003341f77415ba14dc9ff4a23e871e67c87d05fb3be199ebd8cb9af2d0beda51c9603e06ddcc5fa3fea4fb5ed6ccdd01ee08c1c5fbf9a13d93776790cf6412fb3bc7d98f9017c72c58d60f0240c912a4c4622e8bede8d01ef003800e5c6f2943c70e8a83f231ec78c71d085891ac21b64abaf138d6778265c907e7804c161397058fecb125c2b44f3e129726d10e9c6898c300ad7272311b88888dd4061b16c3a9a5e7320dc00c97269721ea7fe585590dc6262db4cdc5c5c2483d680c0171330c68c38f9f9c9ac9835fa200c0fe363b9e6ebad883c0867c59ba2fadb0cb3e6eea4de412f009e3d278201cc3f9a47e37197d0bef35c3b2c6f1f6622a6deee4f4adfc878884e7e785290e9fa3ca888c95abe886431d5d25fe685eb1aad0edd172ff1766e10d51ccc66ccf4154bcd38a8d52fb3ff7c455ba1c5d8d0081fd3d60da228068c7ce593eda8757f153adf2c4e7e3acec7ab143b6a3a6a76ef669e5d8c990e1e60a3efbfc06e0c7a59e7b9761163745ff3c0746b9a6a1acc0806030080a96b214487c2883e08e3f4072d920cd37aa455f87fb6751b6a6acda86b7020be1e07070e7abd0149e613b58f8465f5b5e92dc0767d4d45b9d02ad93e93c9205c17cb69f9f82cb35cef6597aef732cbf55ed6d1e966c989c2eb9f6d8f1f80de3d4c350d66e8825a682acaf9b83e6d1c52fdf12b4e21fa65f6cfd573888e87d1f2458485be88b04c747d1e649bcfef62659b890d8a2c03886d335a81e88b65ef3093a5753f70fb9f97004de1f2937836983f4470d1f61293a75eddbfd4c10fbfa0e737eb6b68bad80420c5985ef32eb6b69b310f63ccded8c426f493427d73b5197e006bbb19e3eaf9c14f9797fcf7407dbfd0ef9229c57a9e41afec44737cdc28b4bf54db29484dcaf7c7fc7cfd99ccfe944f645eff54fba43dae15a253837cdc1da808207067049ebd4c1887c68646917da84641fa994de2fe3b4e9c11317de64a99fc7719508ea219f0472370180dc8551c4603e80430fcabe21977e0cfb91db6a6d60cfff151d4d49a51e509d1e8403f1f2325885c4414190f91e9d6b468696ad637a3b556cc988888e59e39d542c9944c3ac3f801749c3b23b237c920da0a2d0c4774423dcf558f703d180ca0ca13a2e4ae38e930478f3490f19151686f3e56a3386654b302612643df6d7b46fe3422bb22b888c8d1d058704c9b19338f9cf709d72dbfb489b225ba04917d7c95ea0e59a9fb6d4f2a7be02c346b90c41f8d807e5307b5855d0b00cbb682fa6d79cf01e32bd2335293d8a0a6f78fcae658a58a718f1197da3a50b5a70a8e06717e56af376073fd1bc9982e330634b54d53d39d26519d646c279a582b4436a774fe33bde8f506782e7741bb978fe13d69b955a99851af37a07178346f762573820bf62463faed3454bacd4ac661e0b05d98d452fa2563f34c3dd2f70472c5b8c7089f77001ec618ebba4f74f2ee3693c5d4a1fd9fc218794779209d595a8351b8ff5aa3ba5feb3780ef5d967333e65a21baf4e92518614472a903f819ed871fa7eb4f2386183a8e9c8167af38dd35e01d8076590bff8c1f5c3587d1e5202e1d69470c3118d6abe08ff9e1ac6d40f96be5587b3ea5872e4114fe9f28baffe80657cd2186185c2da764f59c181a26c36695503fd95f0c31b4feaa35eb41c5c4d030e11130ba1c4c6da688c875dc05ae9a4379ad0ea68307543f48e9fecc03676d03bce65da271e8bee641e5ba5ed06b723d82d3f52d28473996d6d7847148b6cba71ff6202db6cf9e4099fdf967fc687eb305667d0dd60ea6c619059d7b75f3a7b676a284e65609ddeafad75e78f60fb794f0299e3d507b16e04694f29ee6525d1244ed61757ae4328cb6881613442df788acf7f997291713547a2bf81f0419da6e93a25852e3037dc43fb27c5a65620938705d596c7be363f927631d57891ec725f2c97a079adfcfff442d176ab688ca7f004c3c5983e5659d649ed54544c9eb134fd6607ce505d579e55cfd6f3e971d1ac5165649abd1c13f1305aa6b608a2fc1b27777d1fd7aefcf51585b85f9c900badeb2015883e1a5943d13b38be49e34000800b00108c0f6960d2ecd37d06c9f1550d3dfd2ca2af9a143e06e4a9ece644357654a9e32a6ed1ede616a952f73abc5336da1ed9460fbb8581e9138542192ee37b450fc29b1e4dbcfa61ef18a4109e973caa185e25696aefbd972b543623bfa1fcadfa7967bca8f7b121171b7e44f03a68f7359defce8bcafa0ec40a1a54a07ccfd5bfe7c6dae195b683b2578362896d7f1bf51717ef50f1392fd1eb8e9c3401f9146c1a11f29ec7e308ff8262f2fb29c61ef0f21696f40531cb3af5566cb8d47c47972ae1ab0564a8fb77bd28c377ac6f2e6cb5d4454f55f23f0c72c927242ef39442b5a59bebce8d30809a25f031d11c0279395121c37d7e9329901e0779785b55382d9a7dc6a326eb445b6ffe0631f0efc09585a51efb8d6ca2a593b269e64eb05a34394472e0431232d77e249aadee6738c35becbd8e2070e6835d976477436e82efad0b025edb8f60491eea20f8f0d7559fd546a4740e71c8865a437cb2a974620c74ca6d79e4e0c5bf32270f68e0ffffa0780fd6e0497d680a5bf7d23aa53a503ecbf90d14bffed316d96bc9968c6f540cefe23411f0edce4635055fdcf4465edb0bc9cad17623e70d545c6d0d5d2722d2f67d71f7d9eb1b58f1c30ad65db1fdf7460d77ffad07195a87b7c9a9656883eb937451d57f9332fc91524bd5d8b368cf97faf93dc33f0718b544c3244925982d50d22bb9f08e3fcbb61b845843ef5b12b0212fdf685c495124418cdaec7ddca1dab3dcd983653de74c6ab25b2e32981fd0f95c79cd32bf276d082744c5bec7724dac7a725e5529e58b97d5cddbb809931733ef9656b9be2199c44fbff85f95869bbb406a3609781173a7d18fd3380a00fd89e21a137a1be3c9260a4c716b08bbe549d1f02f6cd7056bdf6437996f06f91697d7998361d9b3ee3cf3117cbb490615a64842eaa43a1ea1a69b9124c9b8ecd07190bbdbe06adcab32626bd038b3f07d65ec9fde04876b72b62c5eee19c33e476b400a61dcf3de3e65653ccae7657fc6d326de63b76a671febb67447c3d229e01d3df76e66e8584eb85306d4896698bcb1ec831a6d2ac849ab7ba2bef91e23c7a99873126e9f9db85fd6e04f86b5dce19e230427dc9c348affeb70f662ff0c2a7e27ada791f8cf966e23314d3865e072c7b99701cd0c3186b3ef863b6f873807b87afe78f5960be16c8797aadf74bf18a937efd59886925efc38b403ca2946947801f28935bc601e08cc8daf58dcc03ecf208f062f6ae4e843f2b70b366b4e5969b3ca7ab13d7eb7f27bfe37d9bd903479a5dd6ca00a41e04f8c1efbaed3f612cf45e6a97cdcefb605ce04fa325ebb988c87b9fc81d37cbda0199ec41e684528d3351e9717c92bfbd8bf8ac80d2d37b8f0d7579276e12cbfc007cbf4096e71ffed407ace76658c0013c9990f5cb9c4545ec978e3acd5a7ec7cad17e33b151509e5429d38a635a5b5e79b15718dbf80f7e0549e673d915e085b6db74b48d889df7e1e45d897ed3ed7d4a316dbc527d4cabd922322ef07a4b6505726164994f8fd913b91db72cb96455ee5736233271f8671659bfcc5914306d265a2ba1e891684e39287faa4c2bb64b995cef737cba482acfa964c5887e9dad178c0e04ee16170af93e1b91942bf78a906e81a8e673e0c04d69bd4d7a60fa8403edd62842eff179d8cc7af12a07765ff161f3be78c5c9625a0e40877e1e8530dfefbe0c4bfa64de1254d70f623e047eadd0b172c8d97dc5878959a2d8c26ade27358530ad7805512ed7c3e4f39cf96273c34b8c49e5db838f81eef1e9825696d6a1297a1ccf5e699d9aec57845cc4e75dd94de0f164b6be26bd03a1d7d730f63e63932ff1317dec15c6c2bf3dccba2ae725b30c27effaa0fb3d7ff621ebfeae22b52bb3f68da9cfaf8dabcf1c90ca6f7aa1ed3659ef2b7f765f487e500ebbeef3bbffa47c35795a355fc64947e750fef1c96c4724ff65766b1fd1c656fedd396df1f52aaf4a678ba43ec34a245f5fe9990b4a1099726493ac7d24ea57f4851917f1b1089f3d508e744edd664cedf710b41a07a227949f1a3ada4654c81b11b93079aaec8536f1a9b8766b14cd077f2ce895fefd086ba5038def1676aa6cf4e11c357d26ff16b3d429b7e433fcc7f13ad976d64afed49429ce9f06c34c1481f91ac4370388e47893c45a1940e0d7362134d06c119d5d06dc37a5eb6b353e2c7ee080f739e5f64fcc12f50ee69797e5f98b09f58cd412985697a375e7cefb16f3e4681540cbbda91d63dacc274b99795829e6499d722a2e4f4a0bd20c64eac9cde0fd0ff91ced4ed8dfff503a2f9beb7497b5aff00f63e75a31d0769b36b688241b3a67b72b2a7d93e102ff068292a2f6eb89cea1c2be66b8b1c5f7175a582d0ae50636dff59dfc0d894cbdd4b4eb7f3847ed2bbc2359fbb69772992fb05bfbf8071ded2bfcaf16e572bcfe877364eddb76b0365e3ef7906fb713f676dde7e5277fe3a3f2eab0f0db1cb2b14dae18431203fcf7677395ce0975b16ca1316109ffb131275315f25b0bc92f7f6716d34048951c258f364bf8fdc4bc1586675532ee0e60a1214109bf1fa8a8e2622215bba8655e35a8bdc0c760cfc2c094f0d945c51589b683e2a7c4b0d6fb449428bd2d5bc2fca8ba41686195ac7d3bc7b0c5a4474af8fdc4821b12f179c8ca7bea99b5f2ea30ff0be525662d6101b8238292f9c0e9157ed79fccaf25917bc827e837b64abf815bc2e2f1ff01e7c125e6c297007b0000000049454e44ae426082</data> + <data format="PNG" length="3615">89504e470d0a1a0a0000000d49484452000000ad0000003008060000006357fade00000de649444154789ced5d5f685bd719fff450484b18cad8835dd8b0cb5290c706f2dc813d567cf556c729d4de06b143c7a43865755f5a277b499aa0aa305c552d19f683522b60b01b304e068edc813b2945450e34d3f53093032928c50cb988a1181194e03dfcf67075a5fbe79c7bcfbd9253a7d181f06b75ef39e73be77ee777bef3ddefbb2610d11c11b50c01601b00806c0db107b4bc9f363eb5d8b48226ef160100fe780a140628bccc45691e985acb0100beeb81b7f1c9455715f325a05c05bcd3cba0f59a623a44af0c0457d056e0363a4667150048f3f68cea14a579a058a9b64d88360aa1d08dd85318d10da33ac14826df56dc36daa2ed0df95219fe786b99d50afdf154db6468a3255ade8012e095f79f618de89d5e6e2b6e1bb9c8bd902f95e19d76c198b349501ca0780a140786ae2bde82e5ad62c3c41068a7258a0b60263e87e044d0f42f1a8b0255a0582c3e39260980e44ab2a50bba5aa9221a8b22381144ffa084e04410a8ba6c7f1fe463616b18b6a660a8c0b2640b782c8c8b0a8075c0d7e747b22f055f9fbffe8ff5ffe7c2912782d9cf852375f95b256f79a96c9a8f37cf4eb95ac8fb219f10d356f7e09861454af0b39c2b1bd78de2062782ba07210d0f61263e070058585c006280343ca4bb2727e70e3ee3aaf2b74a2100dd1cf8fafc0ad3ba6dbfd5f271d0f48354746883deb55758ff62b6291b579a4f892b14f40c5b5de34f20ee0228d5b6348b76511b63b30ad2d4752bf98a2ee403d03f289976206cdaccd76390cfee7ecf1c11858828414421009ef7ae11d128118961f0259912aff412af84fe2ed395dbbdc2edf170e1b57b34fe8b173c09adbc0c94e51c4e9e3e55ef5f9202341b8dd9d6d32180d1b171baf3f51de698242940672626a9fbc5173c038312761fec92f7b097d66fa629e1f178b4eda533599cbf709e761fec92efa88f86ae7eea51e54c5ceda58ddb01da7db0ab6bdf77d447fd7d7e3af3ce197d7b31a0e7aa32d7331fcd50e0e55f7b66e37398fd64b65eb7a3a393befd76878888b6de962931ae974745556e56d9cac89478cee3095581c0ef8fd5dbd316ef612fad4b69da99d8a1cee79ff788cae73decad8fb72e1f80d9cb09ba76e3baa9af8e8e4e4a1f5fa587271ed2b33f78ce9320d2af3c376fb8ca7b7c86756ac3dabd41138a61306c79c9be14a4e12160134865b2422b5eaddb3f2801554065da37cf4ed519a97f50022a407630a733438cede586f3a6ebd158d4245f79a98ce04450d79eafcfaf3b14e918b1a0fcceb249d5ff3e178ef0e7abc4b6f9ab6b50ce269afea4e121a00ac584aacd43ddac1ace37279f81f173c379e5f74d60e4c4987ebe6b4c5f67dad04a0e57365c3062479a703ac05cb1a1ff115df94b730cabc5c88551eaf4b099438755a0e7653efb13292bde77b49b0283011a1f1bd7331a007943a6dede5f9a18baa7cf0fb58daddb32cd5e4e909649522bab0de601d0f352438ead8c4cabff58a5b3efbd5b9761722244e3e327f5fd2c023d1f6beadd9629e1f178629abe27272669f28d539ed04410b736367463f31df551f0c4181d7b75d8b3b8b880f57f8dd3a3dd101111f5f60dd0e4e990325e433f23c747a8fbe2bbf6f3601c975bf98e1fa3d0e910a9d7252940bdd198eef99e0f4770fdc6752222eaf7fb69e0932b1ec586d86bce1f9b2f71a8b6d43aa675ec4d00108d4551481485bc082a33b0dacbc939a0a43fbc25fb52808c3a53181906a49ca68d8c24d59837d997520e2d3cf9d71b3b867a9a67c9ab3219abff394d1ded78d57e21c33c1e8b79858cfa3c68db530fb14ee5c35d7dff2327c60034181d19989e1f00284cebc296d5a2ffa7a3248f11b37c78eb1e9dfdbcdb55bbcdd8b646dc2916d1d9d949e92fd72970678046bf30dbac2a6384aac0e4c533b4715b36d99bacfbefc7a2b872f55322a2ba6d7befeb7b347e3a54af1fbd10a163af0e7b8c4c6db481b5b6f05befbc556f33f4c54d21269bfae78689a976fe73af7efd90f708cd7ef0a1d22f8731b53b969379702c9fa17fbbe23deca5d4caaaa2f1fe78f38c6855a2ebad63dc9405233ac5e44a52c71833f1396819ae7f50024a807a9a5d585c60320c8a7ac660dad4b57e59f599f25561aa2f62333a197f4ece31c7636448d5a6d5ce038ba19dca67ec5fd45fee2956aa78fee367a959065cfedd0e8dfa3ab9abe4da9d1dfaed8d4ea247cd332e2e8c72194a678bf97b6defd3aef4e089313232a6b17e607808f5d3b98699b4b697b16c4dc8947843b94fcb3c2c1b4ec5d11363507782ade332252eba60323be431ade677e63c3461d35a31add5ceb3532c423d2b10d002069c4d5a326dbd5480f25ef3fd2d6c5ad85e30fb695587b7fac62e95c9ea1855b53991b1b0f1a03f35b3aeb36c66d5cb60259fceff09c6a9b9d860325b9b91372f0ce4d9b4da1da87f50d2ef0806f91cdbb44639361bf3a17a6beaf25500141a6786baf720e8d66ba0e28f56096f1e23a7c573394df46dc055bf531746c9c759910f2b559c7ce314d7c7ca2abea33efa30fc3e751fed26a37fb6a3a3931e3d78c8b4e94ccc10067a6ee86d3495718c0c1738cef67f6a4b474727253e9aa1ee17151b3ea1f1adb298aca3a393c6939fb584690724bdff58641e1635bb104b3ed53637caa13d13f08aefa88fae7dba48098fc74339a76fc034a806c3b82d53e9bccb3764164c4b0d4688c6a2e0f9090b89a26243198343a030b3ea372d2f9595d37ba976aa2d2841382841cfa044f59807b55e3416b59433b992d4ddafab07b36d975c4936e451afa3513f95c93a7f6385c67858bf6be53a178e28e396a19b0751f92cdf3c32fa0b4e0481750019fd3c93e328aef03228d688da6ab6640b65d0acb3febdd3073fb8a58dfb87e494e9f215d84673392e15205572e8adb018989a6931b50648c54632653b2bf8fb81e24c3b2d16cdd56c1195c76a605d97d8f5fcf1e619ba5a5b10d9ed32004e7b9aebd9ed724b174a95b3f0d4fe22993c22a86549b7a0bf99af0a08566b414b00f225fd7892778b90e695eb2a46e03ee72f5f2a23027d7b23657d7b624c2bea1d6851699669ddd613c154c1ec9f362a2ccf8fdd9402a1111be28feb15171530c79bdd662bb8b8c29adbf5cafa7114cafce734b5e620dc13c0c8123f1a503b7ff64cfb9818d6589a615ab7f584b626437bc664cc91a52c576e691ee031a508e371c7c199af48930b25c26957ab40d53de560cc9b6fa19c3f005d9792dc7933d6b765dafd28f99262c32e6f0928ee01635a3b06956cbc31fe422d56c369ffe08f23bbcd66da48c6453f1a8c641c3038f8518296312316f5ba2eb15377c84ac3fd8bfba1b21a85ace5944551b3590c65a8e2ce36fd2e9956e4bb10de69e7b66e249377ccb45c4571ba5044db85f59786ba2e356ceea9b51c78670f0a5b7f8988efa795c1f5120c5d07a8a0980eb40ed0bc0ba5bdcbe8773eabbfa902d0a6f9be91251c58a675e2f7b67cb3c75320c638c065dae6be2311c9b0fde8b0b195790c2d825ed9be7dd30a56d1f8e2602a9d07c5f82bcfb1d2f256a4c1861eba6ece2d332aca93c6b45a0cae881d56dc30ede3b0697998dd769ecded8f8bd9fc96a7ddba82cd262d57889d6dca54da02bf3d53ff22369551b10e884deb2f00496d8e191445d7c62f8f2c096454803f8e0361d332d0495677d71684fde85c66d229accd0a7153b84cab5d798be6fbbcd3f68a77909896c71cd53d60a4dcb8cfee943db596e38f03fce7d2d4789b6d97539f85bc43179b69896864c9bca2ca7b00c5ac1996c2cb42d9b84ca5b5615a1e96053e24f15d32add6a615ca2286b93d635418cb5faa63b40366d3aa723bcd3914fd2456f3990b5deb84d707c869711be595fde37d1af8c90f2d33174e85015efde2db0fa9b396d5e924f341454f7819daf622d2169d7ff967f5f602f329dcfc461997d4354ae37f10c8690370e4836bb4fb487c1ee62eeae35b59cf4f38a78e837700c418ed5ac5333fdc039e7d86c8ad3e790f5da3fb7fb68e97ae6b70d7964be6b3c8c66d35d34af3022b9cc89a69055672ab6c5a5179dd3093b67e9e938be7a87f06765d62efb45c1b761bb0d2237f5c79f6914c1e40ed8502677cb9224c51747aa625a2c5cd024efecd792ed7d0cf655a7d4d3ccf472d6e56a26dc602d9332dd1350a9e1da5d07fefd3c08f8f08b5b7ef4c4b0dc6ecbd9ca60d811d48c7b444d47d29896f768f99ee33ca278abcececa05fa6c4abe6ecdc339fcb14bbc58ecbf6778cd2cc2bec1d72f6ab02cedfeca65d46468bf7d028bd2fdda3c95fe97302751a2ccda79cfbd70a2e68d6c5f710a4a23843bad931ac567c529359d0729b9681c115fbf971c2d492ea47b7399dabd1713c0664da9c368c29b2b3a102f82d765e557e13d35ad946220ce8a438fd1e82f7d0286dfd49dc16b5635a37a8329b1dd36a19ca31d36ad06ee73332adfafcbaffba4a2cc65551ea4ad391e301f2ff7b8be8373d445f6e51fa5e0fed3eb26678a92b4de9d703f59de9e11ef0ee33442c9b57d43635e27a15b812b56fcff6342b8253e9bc23a215f24a68d0d19b23aab9875ac4b4c653b8d66665328966fea6d69cc9cdb211590ce48f5b33f8c226608c46738b8532db2f6b15dda58631ba1ab7c58ea1ce37b362b05abb51f4cdceb4928120529c7e3d51f48d91118d71af6e9137b176d75bfa37248c7239a8b7b059d0c5a7f2624dfc71e5fac852b6118f6ba1780b9b0548f335050b37e25e5b12c70b60e6ab423d9e56f5e34af3cabc726d1b2b1b838977956f775915a7df3f706b13b6f1fb8d964ce5e66f2df0921dfd8bfc3853160abdda6ce35389b63794ab0e19b705e8d62468e3d3816237a261bb38655e27e89d566cb08330316d3cb8285ea166ccef17c34a166f40dad8462d3aae90dd2e5be60439c5a6dc236d7c2ad17d0350fc906e6216d430b436b3b6d10db6a6a19a3f10504efdaa7f4dc591722348a2fd3770dbd82cfe1f56e248ff2a0dd6000000000049454e44ae426082</data> </image> </images> <connections> @@ -1249,17 +1222,18 @@ Montreal, Quebec H2T 1S6</p></string> </connection> </connections> <tabstops> - <tabstop>Tab_Signalisations</tabstop> <tabstop>fullName</tabstop> + <tabstop>userPart</tabstop> <tabstop>username</tabstop> <tabstop>password</tabstop> <tabstop>hostPart</tabstop> <tabstop>sipproxy</tabstop> <tabstop>autoregister</tabstop> + <tabstop>Register</tabstop> <tabstop>buttonSave</tabstop> <tabstop>buttonOk</tabstop> <tabstop>buttonCancel</tabstop> - <tabstop>userPart</tabstop> + <tabstop>Tab_Signalisations</tabstop> <tabstop>buttonHelp</tabstop> <tabstop>SkinChoice</tabstop> <tabstop>zoneToneChoice</tabstop> @@ -1273,13 +1247,11 @@ Montreal, Quebec H2T 1S6</p></string> <tabstop>sendDTMFas</tabstop> <tabstop>Menu</tabstop> <tabstop>Tab_Audio</tabstop> - <tabstop>ossButton</tabstop> <tabstop>codec1</tabstop> <tabstop>codec2</tabstop> <tabstop>codec3</tabstop> <tabstop>Tab_Preferences</tabstop> <tabstop>Tab_About</tabstop> - <tabstop>Register</tabstop> <tabstop>useStunNo</tabstop> <tabstop>ringsChoice</tabstop> <tabstop>buttonApplySkin</tabstop> diff --git a/src/gui/qt/configurationpanel.ui.h b/src/gui/qt/configurationpanel.ui.h new file mode 100644 index 0000000000000000000000000000000000000000..14f3c5d010c0296a1b3f8d61ddca89c6266195b0 --- /dev/null +++ b/src/gui/qt/configurationpanel.ui.h @@ -0,0 +1,246 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you want to add, delete, or rename functions or slots, use +** Qt Designer to update this file, preserving your code. +** +** You should not define a constructor or destructor in this file. +** Instead, write your code in functions called init() and destroy(). +** These will automatically be called by the form's constructor and +** destructor. +*****************************************************************************/ +#include <qdir.h> +#include <qstringlist.h> + +#include "../../configuration.h" +#include "../../global.h" +#include "../../manager.h" +#include "../../skin.h" +#include "../../user_cfg.h" +#include "../../audio/audiolayer.h" +#include "qjlistboxpixmap.h" +#include "qmessagebox.h" +#include "qtGUImainwindow.h" + +void ConfigurationPanel::init() +{ + // For reading settings at application startup + // List skin choice from "skins" directory + QDir dir(Skin::getPath(QString(SKINDIR))); + if ( !dir.exists() ) { + _debug("\nCannot find 'skins' directory\n"); + return; + } else { + dir.setFilter( QDir::Dirs | QDir::NoSymLinks); + dir.setSorting( QDir::Name ); + + QStringList list; + list = dir.entryList(); + for (unsigned int i = 0; i < dir.count(); i++) { + if (list[i] != "." && list[i] != ".." && list[i] != "CVS") { + SkinChoice->insertItem(list[i]); + } + } + } + + // List ring choice from "rings" directory + QDir ringdir(Skin::getPath(QString(RINGDIR))); + if ( !ringdir.exists() ) { + _debug ("\nCannot find 'rings' directory\n"); + return; + } else { + ringdir.setFilter( QDir::Files | QDir::NoSymLinks); + ringdir.setSorting( QDir::Name ); + + QStringList ringlist; + ringlist = ringdir.entryList(); + for (unsigned int i = 0; i < ringdir.count(); i++) { + if (ringlist[i] != "." && ringlist[i] != ".." && ringlist[i] != "CVS") { + ringsChoice->insertItem(ringlist[i]); + } + } + } + // List audio devices from audiolayer + const char* devicename ; + const char* hostapiname; + + int top = 0; + device_t devStruct; + + portaudio::AutoSystem autoSys; + // For each device + for (int i = 0; i < Manager::deviceCount(); i++) { + // Fill the device structure + devStruct = Manager::deviceList(i); + hostapiname = devStruct.hostApiName; + devicename = devStruct.deviceName; + + QString hostNameApi(hostapiname) ; + QString name = hostNameApi + " (device #" + QString::number(i) + ")"; + + // New radio button with found device name + QRadioButton* device = new QRadioButton(DriverChoice, name); + device->setGeometry( QRect( 10, 30 + top, 390, 21 ) ); + + // Set label of radio button + device->setText(name); + + // Add tooltip for each one + QToolTip::add(device , devicename ); + + top += 30; + if (Manager::defaultDevice(i)) { + device->setChecked(true); + } + } + // Set position of the button group, with appropriate length + DriverChoice->setGeometry( QRect( 10, 10, 410, top + 30 ) ); + + // For signalisations tab + fullName->setText(QString(get_config_fields_str(SIGNALISATION, FULL_NAME))); + userPart->setText(QString(get_config_fields_str(SIGNALISATION, USER_PART))); + username->setText(QString(get_config_fields_str(SIGNALISATION, AUTH_USER_NAME))); + password->setText(QString(get_config_fields_str(SIGNALISATION, PASSWORD))); + hostPart->setText(QString(get_config_fields_str(SIGNALISATION, HOST_PART))); + sipproxy->setText(QString(get_config_fields_str(SIGNALISATION, PROXY))); + autoregister->setChecked(get_config_fields_int(SIGNALISATION, AUTO_REGISTER)); + playTones->setChecked(get_config_fields_int(SIGNALISATION, PLAY_TONES)); + pulseLength->setValue(get_config_fields_int(SIGNALISATION, PULSE_LENGTH)); + sendDTMFas->setCurrentItem(get_config_fields_int(SIGNALISATION, SEND_DTMF_AS)); + STUNserver->setText(QString(get_config_fields_str(SIGNALISATION, STUN_SERVER))); +((QRadioButton*)stunButtonGroup->find(get_config_fields_int(SIGNALISATION, USE_STUN)))->setChecked(true); + // For audio tab + +((QRadioButton*)DriverChoice->find(get_config_fields_int(AUDIO, DRIVER_NAME)))->setChecked(true); + + codec1->setCurrentText(QString(get_config_fields_str(AUDIO, CODEC1))); + codec2->setCurrentText(QString(get_config_fields_str(AUDIO, CODEC2))); + codec3->setCurrentText(QString(get_config_fields_str(AUDIO, CODEC3))); + + ringsChoice->setCurrentText(QString(get_config_fields_str(AUDIO, RING_CHOICE))); + + // For preferences tab + SkinChoice->setCurrentText(QString(get_config_fields_str( + PREFERENCES, SKIN_CHOICE))); + confirmationToQuit->setChecked(get_config_fields_int( + PREFERENCES, CONFIRM_QUIT)); + zoneToneChoice->setCurrentText(QString(get_config_fields_str( + PREFERENCES, ZONE_TONE))); + checkedTray->setChecked(get_config_fields_int( + PREFERENCES, CHECKED_TRAY)); + voicemailNumber->setText(QString(get_config_fields_str( + PREFERENCES, VOICEMAIL_NUM))); + + // Init tab view order + Tab_Signalisations->show(); + Tab_Audio->hide(); + Tab_Preferences->hide(); + Tab_About->hide(); + + // Set items for QListBox + new QjListBoxPixmap (QjListBoxPixmap::Above, + QPixmap(Skin::getPathPixmap(QString(PIXDIR),QString(PIXMAP_SIGNALISATIONS))), "Signalisation", Menu ); + new QjListBoxPixmap (QjListBoxPixmap::Above, + QPixmap(Skin::getPathPixmap(QString(PIXDIR), QString(PIXMAP_AUDIO))) , + "Audio", Menu ); + + new QjListBoxPixmap (QjListBoxPixmap::Above, + QPixmap(Skin::getPathPixmap(QString(PIXDIR), QString(PIXMAP_PREFERENCES))), + "Preferences", Menu ); + new QjListBoxPixmap (QjListBoxPixmap::Above, + QPixmap(Skin::getPathPixmap(QString(PIXDIR), QString(PIXMAP_ABOUT))), + "About", Menu ); +} + +// For saving settings at application 'save' +void ConfigurationPanel::saveSlot() +{ + Config::set("VoIPLink", "SIP.fullName", string(fullName->text().ascii())); + Config::set("VoIPLink", "SIP.userPart", string(userPart->text().ascii())); + Config::set("VoIPLink", "SIP.username", string(username->text().ascii())); + Config::set("VoIPLink", "SIP.password", string(password->text().ascii())); + Config::set("VoIPLink", "SIP.hostPart", string(hostPart->text().ascii())); + Config::set("VoIPLink", "SIP.proxy", string(sipproxy->text().ascii())); + Config::set("VoIPLink", "SIP.autoregister",autoregister->isChecked()); + Config::set("VoIPLink", "DTMF.pulseLength", pulseLength->value()); + Config::set("VoIPLink", "DTMF.playTones", playTones->isChecked()); + Config::set("VoIPLink", "DTMF.sendDTMFas" , sendDTMFas->currentItem()); + Config::set("VoIPLink", "STUN.STUNserver", string(STUNserver->text().ascii())); + + Config::set("Audio", "Codecs.codec1", string(codec1->currentText().ascii())); + Config::set("Audio", "Codecs.codec2", string(codec2->currentText().ascii())); + Config::set("Audio", "Codecs.codec3", string(codec3->currentText().ascii())); + + if (ringsChoice->currentText() != NULL) + Config::set("Audio", "Rings.ringChoice", + string(ringsChoice->currentText().ascii())); + + Config::set("Preferences", "Themes.skinChoice", + string(SkinChoice->currentText().ascii())); + Config::set("Preferences", "Options.zoneToneChoice", + string(zoneToneChoice->currentText().ascii())); + Config::set("Preferences", "Options.confirmQuit", + confirmationToQuit->isChecked()); + Config::set("Preferences", "Options.checkedTray", checkedTray->isChecked()); + + Config::set("Preferences", "Options.voicemailNumber", + string(voicemailNumber->text().ascii())); +#if 0 + QMessageBox::information(this, "Save settings", + "You must restart SFLPhone", + QMessageBox::Yes); +#endif +} + +// Handle tab view according to current item of listbox +void ConfigurationPanel::changeTabSlot() +{ + switch (Menu->currentItem()) { + case 0: + TitleTab->setText("Setup signalisation"); + Tab_Signalisations->show(); + Tab_Audio->hide(); + Tab_Preferences->hide(); + Tab_About->hide(); + break; + case 1: + TitleTab->setText("Setup audio"); + Tab_Signalisations->hide(); + Tab_Audio->show(); + Tab_Preferences->hide(); + Tab_About->hide(); + break; + case 2: + TitleTab->setText("Setup preferences"); + Tab_Signalisations->hide(); + Tab_Audio->hide(); + Tab_Preferences->show(); + Tab_About->hide(); + break; + case 3: + TitleTab->setText("About"); + Tab_Signalisations->hide(); + Tab_Audio->hide(); + Tab_Preferences->hide(); + Tab_About->show(); + break; + } +} + + +void ConfigurationPanel::useStunSlot(int id) +{ + Config::set("VoIPLink", "STUN.useStun", id); +} + + +void ConfigurationPanel::applySkinSlot() +{ + Config::set("Preferences", "Themes.skinChoice", string(SkinChoice->currentText().ascii())); +} + + +void ConfigurationPanel::driverSlot(int id) +{ +Config::set("Audio", "Drivers.driverName", id); +} diff --git a/src/gui/qt/configurationpanelui.h b/src/gui/qt/configurationpanelui.h new file mode 100644 index 0000000000000000000000000000000000000000..701dddf0aa5929ce900c960e8e15d8d7e0b28015 --- /dev/null +++ b/src/gui/qt/configurationpanelui.h @@ -0,0 +1,163 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'configurationpanel.ui' +** +** Created: Wed Jul 6 11:32:13 2005 +** by: The User Interface Compiler ($Id$) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ + +#ifndef CONFIGURATIONPANEL_H +#define CONFIGURATIONPANEL_H + +#include <qvariant.h> +#include <qpixmap.h> +#include <qdialog.h> + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QSpacerItem; +class QFrame; +class QPushButton; +class QListBox; +class QListBoxItem; +class QLabel; +class QTabWidget; +class QWidget; +class QGroupBox; +class QLineEdit; +class QCheckBox; +class QButtonGroup; +class QRadioButton; +class QSpinBox; +class QComboBox; + +class ConfigurationPanel : public QDialog +{ + Q_OBJECT + +public: + ConfigurationPanel( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~ConfigurationPanel(); + + QFrame* line1; + QPushButton* buttonHelp; + QPushButton* buttonSave; + QPushButton* buttonOk; + QPushButton* buttonCancel; + QListBox* Menu; + QLabel* TitleTab; + QFrame* line2; + QTabWidget* Tab_Signalisations; + QWidget* SIPPage; + QGroupBox* groupBox1; + QLabel* textLabel2; + QLineEdit* fullName; + QLineEdit* userPart; + QLabel* textLabel3; + QLabel* textLabel2_3; + QLineEdit* username; + QLineEdit* hostPart; + QLineEdit* sipproxy; + QLabel* textLabel3_2_2; + QLineEdit* password; + QLabel* textLabel1_3; + QLabel* textLabel3_2; + QCheckBox* autoregister; + QPushButton* Register; + QWidget* STUNPage; + QGroupBox* groupBox3; + QLabel* textLabel1_5; + QLineEdit* STUNserver; + QButtonGroup* stunButtonGroup; + QRadioButton* useStunNo; + QRadioButton* useStunYes; + QWidget* DTMFPage; + QGroupBox* SettingsDTMF; + QCheckBox* playTones; + QLabel* labelPulseLength; + QSpinBox* pulseLength; + QLabel* labelSendDTMF; + QComboBox* sendDTMFas; + QTabWidget* Tab_Audio; + QWidget* DriversPage; + QButtonGroup* DriverChoice; + QWidget* CodecsPage; + QButtonGroup* CodecsChoice; + QComboBox* codec1; + QComboBox* codec2; + QComboBox* codec3; + QLabel* textLabel1_4; + QLabel* textLabel1_4_2; + QLabel* textLabel1_4_3; + QWidget* RingPage; + QComboBox* ringsChoice; + QTabWidget* Tab_Preferences; + QWidget* DriversPage_2; + QComboBox* SkinChoice; + QPushButton* buttonApplySkin; + QWidget* TabPage; + QLabel* labelToneZone; + QComboBox* zoneToneChoice; + QCheckBox* confirmationToQuit; + QCheckBox* checkedTray; + QLabel* textLabel1_6; + QLineEdit* voicemailNumber; + QTabWidget* Tab_About; + QWidget* DriversPage_3; + QLabel* pixmapLabel1; + QLabel* textLabel2_2; + QWidget* CodecsPage_2; + QLabel* textLabel1; + QLabel* pixmapLabel2; + +public slots: + virtual void saveSlot(); + virtual void changeTabSlot(); + virtual void useStunSlot( int id ); + virtual void applySkinSlot(); + virtual void driverSlot( int id ); + +protected: + QGridLayout* ConfigurationPanelLayout; + QVBoxLayout* layout19; + QHBoxLayout* layout28; + QSpacerItem* Horizontal_Spacing2; + QVBoxLayout* layout17; + QVBoxLayout* layout24; + QGridLayout* groupBox1Layout; + QVBoxLayout* layout23; + QSpacerItem* spacer9; + QHBoxLayout* layout19_2; + QSpacerItem* spacer7; + QVBoxLayout* stunButtonGroupLayout; + QGridLayout* SettingsDTMFLayout; + QVBoxLayout* layout11; + QHBoxLayout* layout10; + QSpacerItem* spacer6; + QHBoxLayout* layout7; + QSpacerItem* spacer3; + QHBoxLayout* layout8; + QSpacerItem* spacer4; + QGridLayout* layout18; + QVBoxLayout* layout17_2; + QVBoxLayout* layout18_2; + QVBoxLayout* layout17_3; + QHBoxLayout* layout16; + QSpacerItem* spacer5; + QHBoxLayout* layout16_2; + QSpacerItem* spacer6_2; + +protected slots: + virtual void languageChange(); + +private: + QPixmap image0; + QPixmap image1; + + void init(); + +}; + +#endif // CONFIGURATIONPANEL_H diff --git a/src/gui/qt/jpushbutton.cpp b/src/gui/qt/jpushbutton.cpp index e4bc29f047e5a444703e8340254849eb92db2184..99cdddb06cc4d755579553174c230cd0c47bcb22 100644 --- a/src/gui/qt/jpushbutton.cpp +++ b/src/gui/qt/jpushbutton.cpp @@ -194,4 +194,3 @@ JPushButton::mouseMoveEvent (QMouseEvent *e) { e->accept(); } -#include "jpushbuttonmoc.cpp" diff --git a/src/gui/qt/numerickeypad.cpp b/src/gui/qt/numerickeypad.cpp index 67c1fa383fbecaa7d340956146fd2c22df0c320b..48035a40608ffdb7cb4addc3a2a445a0614e0f67 100644 --- a/src/gui/qt/numerickeypad.cpp +++ b/src/gui/qt/numerickeypad.cpp @@ -116,4 +116,3 @@ NumericKeypad::keyPressEvent (QKeyEvent* e) { } -#include "numerickeypadmoc.cpp" diff --git a/src/gui/qt/phoneline.cpp b/src/gui/qt/phoneline.cpp index a196ce46fe8256aac4f765826929ccc9204aab31..4589e9811cca67084b9f3b9f4676dc6c67783213 100644 --- a/src/gui/qt/phoneline.cpp +++ b/src/gui/qt/phoneline.cpp @@ -31,6 +31,7 @@ PhoneLine::PhoneLine (void) { b_dial = false; b_ringing = false; _callid = 0; + _status = ""; } PhoneLine::~PhoneLine (void) { diff --git a/src/gui/qt/phoneline.h b/src/gui/qt/phoneline.h index 0a3829c93c4973824f0522ded8e1750a9435f2b4..e2c003b101c11321c7f18768b52fd7b8dd6ffd7a 100644 --- a/src/gui/qt/phoneline.h +++ b/src/gui/qt/phoneline.h @@ -23,7 +23,6 @@ #include <qpushbutton.h> #include <qdatetime.h> -#include "jpushbutton.h" #define NUMBER_OF_LINES 6 #define NUMBER_OF_STATES 2 // for the init of phoneline button pixmap @@ -36,6 +35,7 @@ enum line_state { OFFHOLD // Line is on hold }; +class JPushButton; class PhoneLine { public: PhoneLine (void); diff --git a/src/gui/qt/point.cpp b/src/gui/qt/point.cpp index a30dace943503e86fd81b1b1f5022dc3b601f827..348692f6b5233c37a882af4622338862743d19b7 100644 --- a/src/gui/qt/point.cpp +++ b/src/gui/qt/point.cpp @@ -27,8 +27,13 @@ using namespace std; * Create a config-tree from file 'filename' */ Point::Point (const string& filename) { + int opened = 1; skinConfigTree = new ConfigurationTree(); - skinConfigTree->populateFromFile (filename); + opened = skinConfigTree->populateFromFile (filename); + if (opened != 1) { + // If opening failed, stop the application + exit(0); + } } Point::~Point (void) { diff --git a/src/gui/qt/qtGUImainwindow.cpp b/src/gui/qt/qtGUImainwindow.cpp index dc57428d2da60bcf088b46438b6a807af4986cd9..99fe151715f9147fbd964944023b50e6d6f4a004 100644 --- a/src/gui/qt/qtGUImainwindow.cpp +++ b/src/gui/qt/qtGUImainwindow.cpp @@ -21,28 +21,30 @@ #include "../../configurationtree.h" #include <stdio.h> -#include <qbitmap.h> #include <qcheckbox.h> #include <qcombobox.h> #include <qevent.h> -#include <qinputdialog.h> #include <qlineedit.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qregexp.h> -#include <qsettings.h> #include <qspinbox.h> -#include <qtimer.h> +#include <qtimer.h> #include <qtooltip.h> -#include "../../audio/audiodrivers.h" +#include "../../audio/audiolayer.h" +#include "../../audio/dtmf.h" +#include "../../audio/ringbuffer.h" #include "../../configuration.h" +#include "../../error.h" #include "../../global.h" #include "../../manager.h" #include "../../user_cfg.h" #include "../../skin.h" -#include "configurationpanel.h" +#include "configurationpanelui.h" #include "jpushbutton.h" +#include "mydisplay.h" +#include "numerickeypad.h" #include "numerickeypadtools.h" #include "point.h" #include "phoneline.h" @@ -53,6 +55,7 @@ #define QCHAR_TO_STRIP "-" #define REG_EXPR "(-|\\(|\\)| )" +using namespace std; /////////////////////////////////////////////////////////////////////////////// // Tray Icon implementation @@ -115,7 +118,7 @@ QtGUIMainWindow::QtGUIMainWindow (QWidget *parent, const char *name, WFlags f, // For DTMF _key = new DTMF (); - _buf = new float32[SIZEBUF]; + _buf = new int16[SIZEBUF]; // Create new display and numeric _keypad _lcd = new MyDisplay(this, 0, this); @@ -134,6 +137,7 @@ QtGUIMainWindow::QtGUIMainWindow (QWidget *parent, const char *name, WFlags f, // Initialisation of all that concern the skin initSkin(); + this->initBlinkTimer(); @@ -605,7 +609,7 @@ int QtGUIMainWindow::putOnHoldBusyLine (int line) { if (line != -1 and !phLines[line]->getbRinging()) { - if (!getCall(line2id(line))->isRinging()) { + if (!getCall(line2id(line))->isRinging() and !getCall(line2id(line))->isProgressing()) { // Occurs when newly off-hook line replaces another one. _debug("On hold line %d [id=%d]\n", line, line2id(line)); qt_onHoldCall(line2id(line)); @@ -618,17 +622,114 @@ QtGUIMainWindow::putOnHoldBusyLine (int line) void QtGUIMainWindow::dialtone (bool var) { - if (_callmanager->error()->getError() == 0) { - if (_dialtone != var) { - _dialtone = var; - } - _callmanager->setTonezone(var); - _callmanager->getTonegenerator()->toneHandle(ZT_TONE_DIALTONE); - } else { - _callmanager->error()->errorName(DEVICE_NOT_OPEN, NULL); + if (_callmanager->isDriverLoaded()) { + if (_dialtone != var) { + _dialtone = var; + } + _callmanager->setTonezone(var); + _callmanager->getTonegenerator()->toneHandle(ZT_TONE_DIALTONE); + } else { + _callmanager->error()->errorName(OPEN_FAILED_DEVICE); } } +void +QtGUIMainWindow::callIsRinging(int id, int line, int busyLine) +{ + changeLineStatePixmap(line, BUSY); + putOnHoldBusyLine(busyLine); + displayContext(id); + if (getChooseLine()) { + // If a free line is off-hook, set this line to free state + setChooseLine(false); + changeLineStatePixmap(getChosenLine(), FREE); + dialtone(false); + } +} + +void +QtGUIMainWindow::callIsProgressing (int id, int line, int busyLine) +{ + changeLineStatePixmap(line, BUSY); + putOnHoldBusyLine(busyLine); + displayContext(id); + if (getChooseLine()) { + // If a free line is off-hook, set this line to free state + setChooseLine(false); + changeLineStatePixmap(getChosenLine(), FREE); + dialtone(false); + } +} + +void +QtGUIMainWindow::callIsBusy (Call* call, int id, int line, int busyLine) +{ + if(call->isAnswered() and getPrevLine() != line) { + // If the current line is not the line which is answered + _debug("CASE 3 Call %d already answered\n", id); + changeLineStatePixmap(line, BUSY); + putOnHoldBusyLine(busyLine); + if (getChooseLine()) { + // If a free line is off-hook, set this line to free state + changeLineStatePixmap(getChosenLine(), FREE); + dialtone(false); + } + peerAnsweredCall(id); + displayContext(id); + } else { + // If call is busy, put this call on hold + _debug("CASE 4 Put Call %d on-hold\n", id); + changeLineStatePixmap(line, ONHOLD); + displayStatus(ONHOLD_STATUS); + qt_onHoldCall(id); + } +} + +void +QtGUIMainWindow::callIsOnHold(int id, int line, int busyLine) +{ + changeLineStatePixmap(line, BUSY); + putOnHoldBusyLine(busyLine); + if (getChooseLine()) { + // If a free line is off-hook, set this line to free state + setChooseLine(false); + changeLineStatePixmap(getChosenLine(), FREE); + dialtone(false); + } + _lcd->setInFunction(true); + qt_offHoldCall(id); + displayContext(id); +} + +void +QtGUIMainWindow::callIsIncoming (int id, int line, int busyLine) +{ + changeLineStatePixmap(line, BUSY); + putOnHoldBusyLine(busyLine); + qt_answerCall(id); +} + +void +QtGUIMainWindow::clickOnFreeLine(int line, int busyLine) +{ + phLines[line]->button()->setPixmap(TabLinePixmap[line][BUSY]); + displayStatus(ENTER_NUMBER_STATUS); + setChooseLine(true); + setChosenLine(line); + + putOnHoldBusyLine(busyLine); + if (getPrevLine() != -1 and getPrevLine() != line + and phLines[getPrevLine()]->isFree()) { + changeLineStatePixmap(getPrevLine(), FREE); + } + + setPrevLine(line); + + _lcd->setInFunction(false); + _lcd->clearBuffer(); + dialtone(true); +} + //////////////////////////////////////////////////////////////////////////// // Public functions //////////////////////////////////////////////////////////////////////////// @@ -692,6 +793,16 @@ QtGUIMainWindow::setCurrentLine (int current) _currentLine = current; } +bool +QtGUIMainWindow::isCurrentId (short id) +{ + if (line2id(getCurrentLine()) == id) { + return true; + } else { + return false; + } +} + int QtGUIMainWindow::getElapse (void) { @@ -726,9 +837,11 @@ QtGUIMainWindow::incomingCall (short id) int QtGUIMainWindow::peerAnsweredCall (short id) { + dialtone(false); getPhoneLine(id)->setStatus(QString(getCall(id)->getStatus())); // Afficher call-timer startCallTimer(id); + _callmanager->displayStatus(CONNECTED_STATUS); setChooseLine(false); return 1; @@ -771,10 +884,18 @@ QtGUIMainWindow::peerHungupCall (short id) void QtGUIMainWindow::displayTextMessage (short id, const string& message) { + (void)id; // To remove warning message of unused parameter _lcd->clearBuffer(); _lcd->appendText(message); } +void +QtGUIMainWindow::displayErrorText (const string& message) +{ + _lcd->clearBuffer(); + _lcd->appendText(message); +} + void QtGUIMainWindow::displayError (const string& error) { @@ -828,7 +949,8 @@ QtGUIMainWindow::selectedCall (void) int QtGUIMainWindow::qt_outgoingCall (void) { - int id, line; + int id; + int line = -1; if (_lcd->getTextBuffer() == NULL) { _callmanager->displayStatus(ENTER_NUMBER_STATUS); return -1; @@ -864,6 +986,16 @@ QtGUIMainWindow::qt_hangupCall (short id) return i; } +int +QtGUIMainWindow::qt_cancelCall (short id) +{ + int i; + i = cancelCall(id); + displayStatus(HUNGUP_STATUS); + setCurrentLine(-1); + return i; +} + int QtGUIMainWindow::qt_answerCall (short id) { @@ -929,7 +1061,6 @@ QtGUIMainWindow::qt_refuseCall (short id) { int i; i = refuseCall(id); -// getPhoneLine(id)->setStatus(QString(getCall(id)->getStatus())); displayStatus(HUNGUP_STATUS); getPhoneLine(id)->setbRinging(false); _TabIncomingCalls[id2line(id)] = -1; @@ -956,6 +1087,7 @@ QtGUIMainWindow::toggleLine (int line) { int id; int busyLine; + Call* call; if (line == -1) { @@ -972,61 +1104,33 @@ QtGUIMainWindow::toggleLine (int line) if (call == NULL) { // Check if the call exists return -1; - } else if (call->isRinging()){ + } else if (call->isRinging()) { // If call is ringing _debug("CASE 1: Call %d is ringing\n", id); - changeLineStatePixmap(line, BUSY); - putOnHoldBusyLine(busyLine); - displayContext(id); - } else if (call->isBusy()){ - // If call is busy, put this call on hold - _debug("CASE 2 Put Call %d on-hold\n", id); - changeLineStatePixmap(line, ONHOLD); - displayStatus(ONHOLD_STATUS); - qt_onHoldCall(id); + callIsRinging(id, line, busyLine); + } else if (!call->isIncomingType() and call->isProgressing()) { + // If call is progressing + _debug("CASE 2: Call %d is progressing\n", id); + callIsProgressing (id, line, busyLine); + } else if (call->isBusy()) { + callIsBusy (call, id, line, busyLine); } else if (call->isOnHold()) { // If call is on hold, put this call on busy state - _debug("CASE 3: Put Call %d off-hold\n", id); - changeLineStatePixmap(line, BUSY); - putOnHoldBusyLine(busyLine); - if (getChooseLine()) { - // If a free line is off-hook, set this line to free state - setChooseLine(false); - changeLineStatePixmap(getChosenLine(), FREE); - dialtone(false); - } - _lcd->setInFunction(true); - qt_offHoldCall(id); - displayContext(id); + _debug("CASE 5: Put Call %d off-hold\n", id); + callIsOnHold(id, line, busyLine); } else if (call->isIncomingType()) { // If incoming call occurs - _debug("CASE 4: Answer call %d\n", id); - changeLineStatePixmap(line, BUSY); - putOnHoldBusyLine(busyLine); - qt_answerCall(id); + _debug("CASE 6: Answer call %d\n", id); + callIsIncoming (id, line, busyLine); } else { _debug("Others cases to handle\n"); return -1; } + setPrevLine(line); } else { // If just click on free line - _debug("CASE 5: New line off-hook\n"); - phLines[line]->button()->setPixmap(TabLinePixmap[line][BUSY]); - displayStatus(ENTER_NUMBER_STATUS); - setChooseLine(true); - setChosenLine(line); - - putOnHoldBusyLine(busyLine); - if (getPrevLine() != -1 and getPrevLine() != line - and phLines[getPrevLine()]->isFree()) { - changeLineStatePixmap(getPrevLine(), FREE); - } - - setPrevLine(line); - - _lcd->setInFunction(false); - _lcd->clearBuffer(); - dialtone(true); + _debug("CASE 7: New line off-hook\n"); + clickOnFreeLine(line, busyLine); } return 1; } @@ -1041,20 +1145,24 @@ QtGUIMainWindow::dial (void) short i; int line = -1; - if ((i = isThereIncomingCall()) > 0) { - // If new incoming call - line = id2line(i); - _TabIncomingCalls[line] = -1; - toggleLine(line); - } else if (getTransfer()){ - // If call transfer - qt_transferCall (line2id(getCurrentLine())); - } else { - // If new outgoing call - if (getCurrentLine() < 0 or getChooseLine()) { - line = qt_outgoingCall(); - } - } + try { + if ((i = isThereIncomingCall()) > 0) { + // If new incoming call + line = id2line(i); + _TabIncomingCalls[line] = -1; + toggleLine(line); + } else if (getTransfer()){ + // If call transfer + qt_transferCall (line2id(getCurrentLine())); + } else { + // If new outgoing call + if (getCurrentLine() < 0 or getChooseLine()) { + line = qt_outgoingCall(); + } + } + } catch (const exception &e) { + _callmanager->displayErrorText(e.what()); + } } /** @@ -1066,33 +1174,42 @@ QtGUIMainWindow::hangupLine (void) int i; int line = getCurrentLine(); int id = phLines[line]->getCallId(); - if (_callmanager->getbCongestion()) { - // If congestion tone - changeLineStatePixmap(line, FREE); - _lcd->clear(QString(ENTER_NUMBER_STATUS)); - qt_hangupCall(id); - _callmanager->congestion(false); - phLines[line]->setCallId(0); - } else if (line >= 0 and id > 0 and getCall(id)->isProgressing()) { - // If I want to cancel a call before ringing, i have to wait. - } else if (line >= 0 and id > 0) { - // If hangup current line normally - _debug("Hangup line %d\n", line); - qt_hangupCall(id); - changeLineStatePixmap(line, FREE); - phLines[line]->setCallId(0); - setChooseLine(false); - } else if ((i = isThereIncomingCall()) > 0){ - // To refuse new incoming call - _debug("Refuse call %d\n", id); - qt_refuseCall(i); - changeLineStatePixmap(id2line(i), FREE); - } else if (line >= 0) { - _debug("Just load free pixmap for the line %d\n", line); - changeLineStatePixmap(line, FREE); - dialtone(false); - setChooseLine(false); - setCurrentLine(-1); + + try { + if (_callmanager->getbCongestion()) { + // If congestion tone + changeLineStatePixmap(line, FREE); + _lcd->clear(QString(ENTER_NUMBER_STATUS)); + qt_hangupCall(id); + _callmanager->congestion(false); + phLines[line]->setCallId(0); + } else if (line >= 0 and id > 0 and getCall(id)->isProgressing()) { + // If I want to cancel a call before ringing. + qt_cancelCall(id); + changeLineStatePixmap(line, FREE); + phLines[line]->setCallId(0); + setChooseLine(false); + } else if (line >= 0 and id > 0) { + // If hangup current line normally + _debug("Hangup line %d\n", line); + qt_hangupCall(id); + changeLineStatePixmap(line, FREE); + phLines[line]->setCallId(0); + setChooseLine(false); + } else if ((i = isThereIncomingCall()) > 0){ + // To refuse new incoming call + _debug("Refuse call %d\n", id); + qt_refuseCall(i); + changeLineStatePixmap(id2line(i), FREE); + } else if (line >= 0) { + _debug("Just load free pixmap for the line %d\n", line); + changeLineStatePixmap(line, FREE); + dialtone(false); + setChooseLine(false); + setCurrentLine(-1); + } + } catch (const exception &e) { + _callmanager->displayErrorText(e.what()); } } @@ -1429,8 +1546,8 @@ QtGUIMainWindow::pressedKeySlot (int id) { char code = 0; int pulselen = 0; int callid; - float32* tmp_urg_data; - float32* buf_ctrl_vol; + int k, spkrVolume; + int16* buf_ctrl_vol; // Stop dial tone if (_dialtone) { @@ -1455,39 +1572,36 @@ QtGUIMainWindow::pressedKeySlot (int id) { callid = line2id(getCurrentLine()); if (callid != -1 and getCall(callid)->isBusy()) { sendDtmf(callid, code); // pour envoyer DTMF - } else { + } else if (_callmanager->isDriverLoaded()) { _lcd->appendText (code); } // Handle dtmf - _key->startTone(code); - _key->generateDTMF(_buf, SAMPLING_RATE); - + _key->startTone(code); + _key->generateDTMF(_buf, SAMPLING_RATE); + + // Determine dtmf pulse length pulselen = get_config_fields_int(SIGNALISATION, PULSE_LENGTH); - int size = pulselen * (OCTETS/1000); - - // Control volume - buf_ctrl_vol = new float32[size]; - for (int j = 0; j < size; j++) { - buf_ctrl_vol[j] = _buf[j] * _callmanager->getSpkrVolume()/100; - } + int size = pulselen * (OCTETS /1000); + + buf_ctrl_vol = new int16[size*CHANNELS]; + spkrVolume = _callmanager->getSpkrVolume(); - // Free urg_data pointer - tmp_urg_data = _callmanager->getAudioDriver()->mydata.urg_data; - if (tmp_urg_data != NULL) { - free (tmp_urg_data); + // Control volume and format mono->stereo + for (int j = 0; j < size; j++) { + k = j*2; + buf_ctrl_vol[k] = buf_ctrl_vol[k+1] = _buf[j] * spkrVolume/100; } - - // Init struct mydata - tmp_urg_data = buf_ctrl_vol; - _callmanager->getAudioDriver()->mydata.urg_ptr = tmp_urg_data; - _callmanager->getAudioDriver()->mydata.urg_remain = size; - + + // Counters reset + _callmanager->getAudioDriver()->urgentRingBuffer()->flush(); + // Put buffer to urgentRingBuffer + _callmanager->getAudioDriver()->urgentRingBuffer()->Put(buf_ctrl_vol, + size * CHANNELS); _callmanager->getAudioDriver()->startStream(); _callmanager->getAudioDriver()->sleep(pulselen); _callmanager->getAudioDriver()->stopStream(); - _callmanager->getAudioDriver()->mydata.urg_remain = 0; - + delete[] buf_ctrl_vol; } @@ -1712,7 +1826,4 @@ QtGUIMainWindow::keyPressEvent(QKeyEvent *e) { } } - -#include "qtGUImainwindowmoc.cpp" - // EOF diff --git a/src/gui/qt/qtGUImainwindow.h b/src/gui/qt/qtGUImainwindow.h index 16021e8b076cad5350f7e9ff3759e8d4e3c4dc88..66a899bb27dc8f86c81bf4dfddd817a9484d00c8 100644 --- a/src/gui/qt/qtGUImainwindow.h +++ b/src/gui/qt/qtGUImainwindow.h @@ -20,40 +20,37 @@ #ifndef __QT_GUI_MAIN_WINDOW_H__ #define __QT_GUI_MAIN_WINDOW_H__ -#include <qbitmap.h> #include <qimage.h> -#include <qdragobject.h> -#include <qevent.h> #include <qpixmap.h> #include <qpopupmenu.h> -#include <qpushbutton.h> -#include <qsettings.h> -#include <qthread.h> #include <qwidget.h> -#include "../../call.h" #include "../../configuration.h" -#include "../../manager.h" -#include "../../sipvoiplink.h" #include "../../skin.h" #include "../guiframework.h" -#include "../../audio/dtmf.h" -#include "configurationpanel.h" -#include "jpushbutton.h" -#include "mydisplay.h" -#include "numerickeypad.h" -#include "point.h" +#include "configurationpanelui.h" #include "phoneline.h" #include "transqwidget.h" #include "trayicon.h" #include "url_input.h" -#include "vector.h" -#include "volumecontrol.h" #define MAIN_INITIAL_POSITION 20 #define TEXT_MODE 0 #define NUM_MODE 1 +class Call; +class DTMF; +class JPushButton; +class MyDisplay; +class Manager; +class MyTrayIcon; +class NumericKeypad; +class PhoneLine; +class Point; +class SipVoIPLink; +class URL_Input; +class VolumeControl; +class Vector; /////////////////////////////////////////////////////////////////////////////// // Tray Icon class /////////////////////////////////////////////////////////////////////////////// @@ -91,6 +88,7 @@ public: virtual int peerRingingCall (short id); virtual int peerHungupCall (short id); virtual void displayTextMessage (short id, const string& message); + virtual void displayErrorText (const string& message); virtual void displayError (const string& error); virtual void displayStatus (const string& status); virtual void displayContext (short id); @@ -104,6 +102,7 @@ public: // Handle IP-phone user actions int qt_outgoingCall (void); int qt_hangupCall (short id); + int qt_cancelCall (short id); int qt_answerCall (short id); int qt_onHoldCall (short id); int qt_offHoldCall (short id); @@ -132,6 +131,11 @@ public: */ void setCurrentLine (int current); + /* + * Check if 'id' is the current id + */ + bool isCurrentId (short id); + /* * Return elapse for call-timer */ @@ -144,7 +148,7 @@ public: /** * Sets the corresponding pixmap button according to its state. * Handle operations between lines (on hold, off hold) when you click on - * a line. + * a line. Manage the different cases which could occur. * * @param line: number of the current line */ @@ -246,7 +250,7 @@ private: JPushButton* dial_button; JPushButton* mute_button; JPushButton* dtmf_button; - float32* _buf; + int16* _buf; // Configuration skin file Point* pt; @@ -361,6 +365,16 @@ private: */ void dialtone (bool var); + /* + * Functions of toggle function + */ + void callIsRinging(int id, int line, int busyLine); + void callIsProgressing (int id, int line, int busyLine); + void callIsBusy (Call* call, int id, int line, int busyLine); + void callIsOnHold(int id, int line, int busyLine); + void callIsIncoming (int id, int line, int busyLine); + void clickOnFreeLine(int line, int busyLine); + }; diff --git a/src/gui/qt/trayicon.cpp b/src/gui/qt/trayicon.cpp index 3eed140a6cf96fbdb3a32fab5466a8b8c62022b2..4eb1d3e7db82cd4bc192358fbf2eba496d5de1bc 100644 --- a/src/gui/qt/trayicon.cpp +++ b/src/gui/qt/trayicon.cpp @@ -293,5 +293,3 @@ void TrayIcon::gotCloseEvent() closed(); } -#include "trayiconmoc.cpp" - diff --git a/src/gui/qt/url_input.ui.h b/src/gui/qt/url_input.ui.h new file mode 100644 index 0000000000000000000000000000000000000000..799834218081035ecd7ba791fe2ae519f9f59de7 --- /dev/null +++ b/src/gui/qt/url_input.ui.h @@ -0,0 +1,12 @@ +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you want to add, delete, or rename functions or slots, use +** Qt Designer to update this file, preserving your code. +** +** You should not define a constructor or destructor in this file. +** Instead, write your code in functions called init() and destroy(). +** These will automatically be called by the form's constructor and +** destructor. +*****************************************************************************/ + diff --git a/src/gui/qt/vector.cpp b/src/gui/qt/vector.cpp index 5038b9a0cdc510eea66fbf1058ea86b54ffb944d..c58d02b1f3bd2bb12b48afcc363a607858a55cf8 100644 --- a/src/gui/qt/vector.cpp +++ b/src/gui/qt/vector.cpp @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - + #include "vector.h" #include "point.h" #include "transqwidget.h" diff --git a/src/gui/qt/vector.h b/src/gui/qt/vector.h index 75da06d7bea822751f0781d6918d43ae618c4d18..ef0774808578582a46f7ff06ca146a182a290ba9 100644 --- a/src/gui/qt/vector.h +++ b/src/gui/qt/vector.h @@ -20,9 +20,9 @@ #ifndef __VECTOR_H__ #define __VECTOR_H__ -#include "point.h" class TransQWidget; +class Point; class QtGUIMainWindow; class Vector { diff --git a/src/gui/qt/volumecontrol.cpp b/src/gui/qt/volumecontrol.cpp index 06cd507ebf6c3726a6b0f753126ae2c1c6eeb257..98e249b125701e2302edbedcb7b8aab8b0769b61 100644 --- a/src/gui/qt/volumecontrol.cpp +++ b/src/gui/qt/volumecontrol.cpp @@ -19,7 +19,9 @@ #include <qapplication.h> +#include "point.h" #include "qtGUImainwindow.h" +#include "vector.h" #include "volumecontrol.h" #include "../../skin.h" diff --git a/src/gui/qt/volumecontrol.h b/src/gui/qt/volumecontrol.h index c59e859228d93816f2f0edb1bda714eb592383b8..41816c82ca8e81e8e6dd96db5e0397c6be120bd4 100644 --- a/src/gui/qt/volumecontrol.h +++ b/src/gui/qt/volumecontrol.h @@ -20,9 +20,9 @@ #ifndef __VOLUME_CONTROL_H__ #define __VOLUME_CONTROL_H__ -#include "vector.h" #include "jpushbutton.h" +class Vector; class VolumeControl : public JPushButton { Q_OBJECT public: diff --git a/src/main.cpp b/src/main.cpp index a21deb942b845754ac70acec458c6a7b8abb996c..8fdfb0f301e2640b53768c5895f4134c5dd17948 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,7 +18,8 @@ */ #include <getopt.h> -#include "user_cfg.h" + +#define GUI_QT // remove when others UI are implemented #if defined(GUI_QT) # include <qapplication.h> @@ -29,121 +30,33 @@ # error "GUI_COCOA not implemented yet." #endif +#include "gui/guiframework.h" #include "configuration.h" #include "configurationtree.h" #include "manager.h" -int OptionProcess (int argc,char **argv, Manager* manager); - int main (int argc, char **argv) { Manager* manager; Config::setTree(new ConfigurationTree()); manager = new Manager(); + GuiFramework *GUI; - // Faire partir la gui selon l'option choisie #if defined(GUI_QT) QApplication a(argc, argv); - QtGUIMainWindow *qtgui = new QtGUIMainWindow (0, 0 , + GUI = new QtGUIMainWindow (0, 0 , Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder, manager); - manager->setGui(qtgui); + manager->setGui(GUI); manager->init(); - a.setMainWidget(qtgui); + a.setMainWidget((QtGUIMainWindow*)GUI); return a.exec(); #endif - int ret = OptionProcess (argc,argv, manager); - return ret; } -int OptionProcess (int argc,char **argv, Manager* manager) -{ - int c; - - while (1) { - int option_index = 0; - static struct option long_options[] = - { - {"ui", 1, 0, 'i'}, - {"phonenumber", 1, 0, 'p'}, - {"stun", 1, 0, 's'}, - {"verbose", 0, 0, 'v'}, - {"help", 0, 0, 'h'}, - {0, 0, 0, 0} - }; - - c = getopt_long (argc, argv, "i:p:s:vh", long_options, &option_index); - if (c == -1) - break; - - switch (c) { - case 'i': - { - string optStr(optarg); -#ifdef GUI_QT - if (optStr.compare("qt") == 0) { - QApplication a(argc, argv); - QtGUIMainWindow *qtgui = new QtGUIMainWindow (0, 0 , - Qt::WDestructiveClose | - Qt::WStyle_Customize | - Qt::WStyle_NoBorder, - manager); - // GUI= new QTGUIbidule(); - a.setMainWidget(qtgui); - return a.exec(); - } -#endif - -#ifdef GUI_TEXT1 - if (optStr.compare("text1")) { - // GUI=new Text1GUIbidule(); - // ND - } -#endif - -#if !defined(GUI_QT) && !defined(GUI_TEXT1) && !defined(GUI_COCOA) -# error You MUST define at least one GUI to use !! -#endif - - // Manager ne doit pas prendre un qtwindow - // mais un GUIFramework - //manager->setGui(GUI); - manager->init(); - } - break; - case 'v': - break; - case 'p': - cout << "Phone number to call : " << optarg << endl; - break; - case 's': - break; - case '?': - case 'h': - cout << "Usage: sflphone [OPTIONS] " << endl - << "Valid Options:" << endl - << "-i <interface>, --ui=<interface>" << endl - << " Select an user interface (right now just qt interface is available)" << endl - << "-v, --verbose" << endl - << " Display all messages for debbugging" << endl - << "-p <number>, --phonenumber=<number>" << endl - << " Compose directly the phone number that you want" - << endl - << "-h, --help" << endl - << " Display help options message" << endl; - break; - default: - cout << "Option " << c << "doesn't exist" <<endl; - break; - } - } - -// return GUI->run(); - return 0; -} // EOF diff --git a/src/manager.cpp b/src/manager.cpp index ec73c108c6456639d1b44e0d967744da74cf3378..79c799efce763887bfb187cae571e38f515b0a12 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -28,30 +28,33 @@ #include <arpa/inet.h> #include <cc++/thread.h> -#include <cstdlib> +#include <cstdlib> #include <iostream> -#include <fstream> +#include <fstream> #include <string> #include <vector> -#include "user_cfg.h" +#include "manager.h" #include "audio/audiocodec.h" +#include "audio/audiolayer.h" #include "audio/codecDescriptor.h" +#include "audio/ringbuffer.h" #include "audio/tonegenerator.h" #include "call.h" -#include "configuration.h" -#include "configurationtree.h" -#include "manager.h" +#include "configuration.h" +#include "configurationtree.h" +#include "error.h" #include "sipvoiplink.h" -#include "skin.h" -#include "voIPLink.h" - -#include "audio/audiodriversportaudio.h" - +#include "skin.h" +#include "user_cfg.h" +#include "voIPLink.h" +#include "gui/guiframework.h" using namespace std; using namespace ost; +device_t Manager::deviceParam; + Manager::Manager (void) { // initialize random generator @@ -76,8 +79,8 @@ Manager::Manager (void) _congestion = false; _ringtone = false; _ringback = false; - _useAlsa = false; _exist = 0; + _loaded = false; initConfigFile(); _exist = createSettingsPath(); @@ -104,7 +107,28 @@ Manager::init (void) _gui->setup(); } initAudioCodec(); - selectAudioDriver(); + + try { + selectAudioDriver(); + loaded(true); + } + catch (const portaudio::PaException &e) + { + displayErrorText(e.paErrorText()); + } + catch (const portaudio::PaCppException &e) + { + displayErrorText(e.what()); + } + catch (const exception &e) + { + displayErrorText(e.what()); + } + catch (...) + { + displayErrorText("An unknown exception occured."); + } + _voIPLinkVector->at(DFT_VOIP_LINK)->init(); if (get_config_fields_int(SIGNALISATION, AUTO_REGISTER) == YES and _exist == 1) { @@ -130,7 +154,7 @@ Manager::error (void) return _error; } -AudioDriversPortAudio* +AudioLayer* Manager::getAudioDriver(void) { return _audiodriverPA; @@ -245,7 +269,7 @@ Manager::outgoingCall (const string& to) call->setStatus(string(TRYING_STATUS)); call->setState(Progressing); - if (call->outgoingCall(to) == 0) { + if (call->outgoingCall(id, to) == 0) { return id; } else { return 0; @@ -271,6 +295,25 @@ Manager::hangupCall (short id) return 1; } +int +Manager::cancelCall (short id) +{ + Call* call; + + call = getCall(id); + call->setStatus(string(HUNGUP_STATUS)); + call->setState(Hungup); + call->cancel(); + _mutex.enterMutex(); + _nCalls -= 1; + _mutex.leaveMutex(); + deleteCall(id); + if (getbRingback()) { + ringback(false); + } + return 1; +} + int Manager::answerCall (short id) { @@ -371,11 +414,11 @@ Manager::quitApplication (void) // Quit VoIP-link library _voIPLinkVector->at(DFT_VOIP_LINK)->quit(); if (saveConfig()) { + Config::deleteTree(); return 1; } else { return 0; } - Config::deleteTree(); } int @@ -442,12 +485,16 @@ Manager::peerAnsweredCall (short id) { Call* call; + if (getbRingback()) { + ringback(false); + } call = getCall(id); call->setStatus(string(CONNECTED_STATUS)); + call->setState(Answered); - ringback(false); - _gui->peerAnsweredCall(id); - displayStatus(CONNECTED_STATUS); + if (isCurrentId(id)) { + _gui->peerAnsweredCall(id); + } return 1; } @@ -459,6 +506,7 @@ Manager::peerRingingCall (short id) call = getCall(id); call->setStatus(string(RINGING_STATUS)); call->setState(Ringing); + ringback(true); _gui->peerRingingCall(id); displayStatus(RINGING_STATUS); @@ -474,7 +522,9 @@ Manager::peerHungupCall (short id) call->setStatus(string(HUNGUP_STATUS)); call->setState(Hungup); _gui->peerHungupCall(id); - ringback(false); + if (getbRingback()) { + ringback(false); + } _mutex.enterMutex(); _nCalls -= 1; _mutex.leaveMutex(); @@ -488,6 +538,12 @@ Manager::displayTextMessage (short id, const string& message) _gui->displayTextMessage(id, message); } +void +Manager::displayErrorText (const string& message) +{ + _gui->displayErrorText(message); +} + void Manager::displayError (const string& error) { @@ -506,78 +562,85 @@ Manager::selectedCall (void) return _gui->selectedCall(); } +bool +Manager::isCurrentId (short id) +{ + return _gui->isCurrentId(id); +} + void Manager::congestion (bool var) { - if (_error->getError() == 0) { - if (_congestion != var) { - _congestion = var; - } - _tonezone = var; - _tone->toneHandle(ZT_TONE_CONGESTION); - } else { - _error->errorName(DEVICE_NOT_OPEN, NULL); + if (isDriverLoaded()) { + if (_congestion != var) { + _congestion = var; + } + _tonezone = var; + _tone->toneHandle(ZT_TONE_CONGESTION); + } else { + _error->errorName(OPEN_FAILED_DEVICE); } } void Manager::ringback (bool var) { - if (_ringback != var) { - _ringback = var; + if (isDriverLoaded()) { + if (_ringback != var) { + _ringback = var; + } + _tonezone = var; + _tone->toneHandle(ZT_TONE_RINGTONE); + } else { + _error->errorName(OPEN_FAILED_DEVICE); } - _tonezone = var; - _tone->toneHandle(ZT_TONE_RINGTONE); } void -Manager::ringtone (bool var) { - - if (getNumberOfCalls() > 1 and _tonezone and var == false) { - // If more than one line is ringing - _tonezone = false; - _tone->playRingtone((_gui->getRingtoneFile()).data()); - } - - if (_ringtone != var) { - _ringtone = var; +Manager::ringtone (bool var) +{ + if (isDriverLoaded()) { + if (getNumberOfCalls() > 1 and _tonezone and var == false) { + // If more than one line is ringing + _tonezone = false; + _tone->playRingtone((_gui->getRingtoneFile()).data()); + } + + if (_ringtone != var) { + _ringtone = var; + } + + _tonezone = var; + if (getNumberOfCalls() == 1) { + // If just one line is ringing + _tone->playRingtone((_gui->getRingtoneFile()).data()); + } + } else { + _error->errorName(OPEN_FAILED_DEVICE); } - - _tonezone = var; - if (getNumberOfCalls() == 1) { - // If just one line is ringing - _tone->playRingtone((_gui->getRingtoneFile()).data()); - } } void Manager::notificationIncomingCall (void) { - float32* tmp_urg_data; - float32* buf_ctrl_vol; - float32* buffer = new float32[SAMPLING_RATE]; + int16* buf_ctrl_vol; + int16* buffer = new int16[SAMPLING_RATE]; int size = SAMPLING_RATE/2; + int k, spkrVolume; _tone->generateSin(440, 0, buffer); // Control volume - buf_ctrl_vol = new float32[size]; + buf_ctrl_vol = new int16[size]; + spkrVolume = getSpkrVolume(); for (int j = 0; j < size; j++) { - buf_ctrl_vol[j] = buffer[j] * getSpkrVolume()/100; + k = j*2; + buf_ctrl_vol[k] = buf_ctrl_vol[k+1] = buffer[j] * spkrVolume/100; } - // Free urg_data pointer - tmp_urg_data = getAudioDriver()->mydata.urg_data; - if (tmp_urg_data != NULL) { - free (tmp_urg_data); - } - - // Init struct mydata - tmp_urg_data = buf_ctrl_vol; - getAudioDriver()->mydata.urg_ptr = tmp_urg_data; - getAudioDriver()->mydata.urg_remain = size; + getAudioDriver()->urgentRingBuffer()->Put(buf_ctrl_vol, + size * CHANNELS); getAudioDriver()->startStream(); - getAudioDriver()->sleep(250); + getAudioDriver()->sleep(NOTIFICATION_LEN); getAudioDriver()->stopStream(); - getAudioDriver()->mydata.urg_remain = 0; delete[] buffer; delete[] buf_ctrl_vol; @@ -612,6 +675,40 @@ Manager::getStunInfo (StunAddress4& stunSvrAddr) { } } +device_t +Manager::deviceList (int index) +{ + portaudio::AutoSystem autoSys; + portaudio::System &sys = portaudio::System::instance(); + deviceParam.hostApiName = sys.deviceByIndex(index).hostApi().name(); + deviceParam.deviceName = sys.deviceByIndex(index).name(); + return deviceParam; +} + +int +Manager::deviceCount (void) +{ + int numDevices = 0; + + portaudio::AutoSystem autoSys; + portaudio::System &sys = portaudio::System::instance(); + numDevices = sys.deviceCount(); + return numDevices; +} + +bool +Manager::defaultDevice (int index) +{ + bool defaultDisplayed = false; + + portaudio::AutoSystem autoSys; + portaudio::System &sys = portaudio::System::instance(); + if (sys.deviceByIndex(index).isSystemDefaultInputDevice()) { + defaultDisplayed = true; + } + return defaultDisplayed; +} + bool Manager::useStun (void) { if (get_config_fields_int(SIGNALISATION, USE_STUN) == YES) { @@ -734,10 +831,8 @@ Manager::selectAudioDriver (void) { #if defined(AUDIO_PORTAUDIO) - _audiodriverPA = new AudioDriversPortAudio(this); - if (_audiodriverPA->openDevice()) { - _debug("Open device succeeded\n"); - } + _audiodriverPA = new AudioLayer(this); + _audiodriverPA->openDevice(get_config_fields_int(AUDIO, DRIVER_NAME)); #else # error You must define one AUDIO driver to use. #endif diff --git a/src/manager.h b/src/manager.h index 2d84514ed2ec25a269c84985f417fec57523c6c1..2a4414ee011cfcd9bda28aa50d454e6bc56de8ab 100644 --- a/src/manager.h +++ b/src/manager.h @@ -25,18 +25,20 @@ #include <string> #include <vector> -#include "audio/codecDescriptor.h" -#include "audio/audiodriversportaudio.h" -#include "error.h" -#include "call.h" -#include "user_cfg.h" -#include "voIPLink.h" -#include "gui/guiframework.h" #include "../stund/stun.h" +#include "call.h" using namespace std; using namespace ost; +class AudioLayer; +class CodecDescriptor; +class Error; +class GuiFramework; +class ToneGenerator; +class VoIPLink; + +#define NOTIFICATION_LEN 250 // Status #define CONNECTED_STATUS "Connected" #define LOGGED_IN_STATUS "Logged in" @@ -63,18 +65,23 @@ typedef vector<VoIPLink*, allocator<VoIPLink*> > VoIPLinkVector; */ typedef vector<CodecDescriptor*, allocator<CodecDescriptor*> > CodecDescriptorVector; -class GuiFramework; -class ToneGenerator; +struct device_t{ + const char* hostApiName; + const char* deviceName; +}; + class Manager { public: Manager (void); ~Manager (void); + static device_t deviceParam; + void init (void); void setGui (GuiFramework* gui); ToneGenerator* getTonegenerator(void); Error* error(void); - AudioDriversPortAudio* getAudioDriver(void); + AudioLayer* getAudioDriver(void); // Accessor to number of calls unsigned int getNumberOfCalls (void); @@ -120,6 +127,7 @@ public: int outgoingCall (const string& to); int hangupCall (short id); + int cancelCall (short id); int answerCall (short id); int onHoldCall (short id); int offHoldCall (short id); @@ -148,9 +156,11 @@ public: int peerRingingCall (short id); int peerHungupCall (short id); void displayTextMessage (short id, const string& message); + void displayErrorText (const string& message); void displayError (const string& error); void displayStatus (const string& status); int selectedCall (void); + bool isCurrentId (short id); /* * Handle audio sounds heard by a caller while they wait for their @@ -176,8 +186,7 @@ public: inline bool getbCongestion (void) { return _congestion; } inline bool getbRingback (void) { return _ringback; } inline bool getbRingtone (void) { return _ringtone; } - inline bool useAlsa (void) { return _useAlsa; } - + inline int getSpkrVolume (void) { return _spkr_volume; } inline void setSpkrVolume (int spkr_vol) { _spkr_volume = spkr_vol; } inline int getMicroVolume (void) { return _mic_volume; } @@ -187,6 +196,13 @@ public: inline void setFirewallPort (int port) { _firewallPort = port; } inline string getFirewallAddress (void) { return _firewallAddr; } + inline bool isDriverLoaded (void) { return _loaded; } + inline void loaded (bool l) { _loaded = l; } + + static device_t deviceList (int); + static int deviceCount (void); + static bool defaultDevice (int); + private: /* @@ -218,7 +234,8 @@ private: ToneGenerator* _tone; Error* _error; GuiFramework* _gui; - AudioDriversPortAudio* _audiodriverPA; + AudioLayer* _audiodriverPA; + /* * Vector of VoIPLink */ @@ -259,8 +276,6 @@ private: bool _ringback; bool _ringtone; - bool _useAlsa; - // To handle volume control int _spkr_volume; int _mic_volume; @@ -268,6 +283,9 @@ private: // To handle firewall int _firewallPort; string _firewallAddr; + + // Variables used in exception + bool _loaded; }; #endif // __MANAGER_H__ diff --git a/src/sipcall.cpp b/src/sipcall.cpp index d839c5cfdbe1b81341c258a5e3d5a29b75c19de9..10f9c1b5871f6d0966c62b64e38449d0999cab6b 100644 --- a/src/sipcall.cpp +++ b/src/sipcall.cpp @@ -21,10 +21,11 @@ #include <osipparser2/sdp_message.h> #include <string.h> - + #include <iostream> #include "audio/audiocodec.h" +#include "audio/codecDescriptor.h" #include "global.h" #include "sipcall.h" diff --git a/src/sipcall.h b/src/sipcall.h index 0766cbaaa405746e070492d8e08de4d8fb8f05cb..2b37a5d77b895ca5ad59d43b0c4663b16a15b1e6 100644 --- a/src/sipcall.h +++ b/src/sipcall.h @@ -25,15 +25,14 @@ #include <eXosip/eXosip.h> #include <vector> -#include "audio/audiocodec.h" -#include "audio/codecDescriptor.h" +class CodecDescriptor; +class AudioCodec; #define NOT_USED 0 using namespace std; typedef vector<CodecDescriptor*, allocator<CodecDescriptor*> > CodecDescriptorVector; -class AudioCodec; class SipCall { public: SipCall (short id, CodecDescriptorVector* cdv); diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 0854c5d38280fd690981c48f774d674cfe0755f7..86928116713437fce10765d356d16ce15c838071 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -18,19 +18,22 @@ */ #include <sys/time.h> -#include <eXosip/eXosip.h> +#include <eXosip/eXosip.h> #include <osip2/osip.h> #include <osipparser2/osip_const.h> #include <osipparser2/osip_headers.h> #include <osipparser2/osip_body.h> #include <cc++/thread.h> +#include <stdexcept> #include <iostream> #include <string> #include <vector> #include "audio/audiortp.h" +#include "audio/codecDescriptor.h" #include "call.h" +#include "error.h" #include "eventthread.h" #include "global.h" #include "manager.h" @@ -52,6 +55,7 @@ SipVoIPLink::SipVoIPLink (short id, Manager* manager) : VoIPLink (id, manager) { setId(id); _localPort = 0; + _cid = 0; _manager = manager; _evThread = new EventThread (this); _sipcallVector = new SipCallVector(); @@ -89,27 +93,16 @@ SipVoIPLink::init (void) // If use STUN server, firewall address setup if (_manager->useStun()) { eXosip_set_user_agent(tmp.data()); - StunAddress4 stunSvrAddr; - stunSvrAddr.addr = 0; - - // Stun server - string svr = get_config_fields_str(SIGNALISATION, STUN_SERVER); - - // Convert char* to StunAddress4 structure - bool ret = stunParseServerName ((char*)svr.data(), stunSvrAddr); - if (!ret) { - _debug("SIP: Stun server address not valid\n"); + if (behindNat() != 1) { + return 0; } - - // Firewall address - _debug("STUN server: %s\n", svr.data()); - _manager->getStunInfo(stunSvrAddr); + eXosip_set_firewallip((_manager->getFirewallAddress()).data()); } eXosip_set_user_agent(tmp.data()); - _evThread->start(); initRtpmapCodec(); + _evThread->start(); return 1; } @@ -174,35 +167,36 @@ SipVoIPLink::setRegister (void) get_config_fields_str(SIGNALISATION, HOST_PART)); if (get_config_fields_str(SIGNALISATION, HOST_PART).empty()) { - _manager->error()->errorName(HOST_PART_FIELD_EMPTY, NULL); + _manager->error()->errorName(HOST_PART_FIELD_EMPTY); return -1; } if (get_config_fields_str(SIGNALISATION, USER_PART).empty()) { - _manager->error()->errorName(USER_PART_FIELD_EMPTY, NULL); + _manager->error()->errorName(USER_PART_FIELD_EMPTY); return -1; } eXosip_lock(); if (setAuthentication() == -1) { + _debug("No authentication\n"); eXosip_unlock(); return -1; } _debug("register From: %s\n", from.data()); if (!get_config_fields_str(SIGNALISATION, PROXY).empty()) { - reg_id = eXosip_register_init((char*)from.data(), (char*)proxy.data(), - NULL); + reg_id = eXosip_register_init((char*)from.data(), + (char*)proxy.data(),NULL); } else { - reg_id = eXosip_register_init((char*)from.data(),(char*)hostname.data(), - NULL); + reg_id = eXosip_register_init((char*)from.data(), + (char*)hostname.data(), NULL); } if (reg_id < 0) { eXosip_unlock(); return -1; } - // TODO: port SIP session timer dans config int i = eXosip_register(reg_id, EXPIRES_VALUE); + if (i == -2) { _debug("cannot build registration, check the setup\n"); eXosip_unlock(); @@ -218,7 +212,7 @@ SipVoIPLink::setRegister (void) return 0; } int -SipVoIPLink::outgoingInvite (const string& to_url) +SipVoIPLink::outgoingInvite (short id, const string& to_url) { string from; string to; @@ -239,7 +233,7 @@ SipVoIPLink::outgoingInvite (const string& to_url) if (get_config_fields_str(SIGNALISATION, PROXY).empty()) { // If no SIP proxy setting for direct call with only IP address - if (startCall(from, to, "", "") <= 0) { + if (startCall(id, from, to, "", "") <= 0) { _debug("Warning SipVoIPLink: call not started\n"); return -1; } @@ -248,7 +242,7 @@ SipVoIPLink::outgoingInvite (const string& to_url) // If SIP proxy setting string route = "<sip:" + get_config_fields_str(SIGNALISATION, PROXY) + ";lr>"; - if (startCall(from, to, "", route) <= 0) { + if (startCall(id, from, to, "", route) <= 0) { _debug("Warning SipVoIPLink: call not started\n"); return -1; } @@ -262,8 +256,8 @@ SipVoIPLink::answer (short id) int i; char tmpbuf[64]; bzero (tmpbuf, 64); - // Get local port - snprintf (tmpbuf, 63, "%d", getSipCall(id)->getLocalAudioPort()); + // Get port + snprintf (tmpbuf, 63, "%d", getSipCall(id)->getLocalAudioPort()); _debug("Answer call [id = %d, cid = %d, did = %d]\n", id, getSipCall(id)->getCid(), getSipCall(id)->getDid()); @@ -302,6 +296,21 @@ SipVoIPLink::hangup (short id) return i; } +int +SipVoIPLink::cancel (short id) +{ + int i = 1; + if (!_manager->getbCongestion()) { + _debug("Cancel call [id = %d, cid = %d]\n", id, getCid()); + // Release SIP stack. + eXosip_lock(); + i = eXosip_terminate_call (getCid(), -1); + eXosip_unlock(); + } + deleteSipCall(id); + return i; +} + int SipVoIPLink::onhold (short id) { @@ -372,7 +381,6 @@ SipVoIPLink::getEvent (void) char *name; static int countReg = 0; - eXosip_automatic_refresh(); event = eXosip_event_wait (0, 50); if (event == NULL) { @@ -382,7 +390,15 @@ SipVoIPLink::getEvent (void) // IP-Phone user receives a new call case EXOSIP_CALL_NEW: // // Set local random port for incoming call - setLocalPort(RANDOM_LOCAL_PORT); + if (!_manager->useStun()) { + setLocalPort(RANDOM_LOCAL_PORT); + } else { + if (behindNat() != 0) { + setLocalPort(_manager->getFirewallPort()); + } else { + _debug("behindNat function returns 0\n"); + } + } id = _manager->generateNewCallId(); _manager->pushBackNewCall(id, Incoming); @@ -413,10 +429,9 @@ SipVoIPLink::getEvent (void) id = findCallId(event); if (id == 0) { id = findCallIdWhenRinging(); - getSipCall(id)->setLocalAudioPort(_localPort); } - _debug("Call is answered [id = %d, cid = %d, did = %d]\n", - id, event->cid, event->did); + _debug("Call is answered [id = %d, cid = %d, did = %d], localport=%d\n", + id, event->cid, event->did,getSipCall(id)->getLocalAudioPort()); // Answer if (id > 0 and !_manager->getCall(id)->isOnHold() @@ -425,7 +440,6 @@ SipVoIPLink::getEvent (void) getSipCall(id)->answeredCall(event); _manager->peerAnsweredCall(id); - // Outgoing call is answered, start the sound channel. if (_audiortp->createNewSession (getSipCall(id)) < 0) { _debug("FATAL: Unable to start sound (%s:%d)\n", @@ -442,7 +456,6 @@ SipVoIPLink::getEvent (void) id, event->cid, event->did); if (id > 0) { - getSipCall(id)->setLocalAudioPort(_localPort); getSipCall(id)->ringingCall(event); _manager->peerRingingCall(id); } @@ -545,6 +558,7 @@ SipVoIPLink::getEvent (void) break; case EXOSIP_REGISTRATION_FAILURE: + _debug("-- Registration failed --\n"); if (countReg <= 3) { setRegister(); countReg++; @@ -689,14 +703,35 @@ SipVoIPLink::getAudioCodec (short callid) // Private functions /////////////////////////////////////////////////////////////////////////////// +int +SipVoIPLink::behindNat (void) +{ + StunAddress4 stunSvrAddr; + stunSvrAddr.addr = 0; + + // Stun server + string svr = get_config_fields_str(SIGNALISATION, STUN_SERVER); + + // Convert char* to StunAddress4 structure + bool ret = stunParseServerName ((char*)svr.data(), stunSvrAddr); + if (!ret) { + _debug("SIP: Stun server address not valid\n"); + return 0; + } + + // Firewall address + _debug("STUN server: %s\n", svr.data()); + _manager->getStunInfo(stunSvrAddr); + + return 1; +} + int SipVoIPLink::getLocalIp (void) { - char* myIPAddress; - if (getLocalIpAddress().empty()) { - myIPAddress = new char[64]; - } - int ret = eXosip_guess_localip (2, myIPAddress, 64); + int ret = 0; + char* myIPAddress = new char[65]; + ret = eXosip_guess_localip (2, myIPAddress, 64); setLocalIpAddress(string(myIPAddress)); return ret; @@ -734,13 +769,12 @@ SipVoIPLink::setAuthentication (void) } pass = get_config_fields_str(SIGNALISATION, PASSWORD); if (pass.empty()) { - _manager->error()->errorName(PASSWD_FIELD_EMPTY, NULL); + _manager->error()->errorName(PASSWD_FIELD_EMPTY); return -1; } if (eXosip_add_authentication_info(login.data(), login.data(), pass.data(), NULL, NULL) != 0) { - _debug("No authentication\n"); return -1; } return 0; @@ -765,18 +799,18 @@ SipVoIPLink::toHeader(const string& to) } int -SipVoIPLink::startCall (const string& from, const string& to, +SipVoIPLink::startCall (short id, const string& from, const string& to, const string& subject, const string& route) { osip_message_t *invite; int i; if (checkUrl(from) != 0) { - _manager->error()->errorName(FROM_ERROR, NULL); + _manager->error()->errorName(FROM_ERROR); return -1; } if (checkUrl(to) != 0) { - _manager->error()->errorName(TO_ERROR, NULL); + _manager->error()->errorName(TO_ERROR); return -1; } @@ -793,21 +827,21 @@ SipVoIPLink::startCall (const string& from, const string& to, // Set random port for outgoing call setLocalPort(RANDOM_LOCAL_PORT); _debug("Local audio port: %d\n",_localPort); - - bzero (port, 64); - snprintf (port, 63, "%d", getLocalPort()); - - i = eXosip_initiate_call (invite, NULL, NULL, port); - } else { // If use Stun server - bzero (port, 64); - snprintf (port, 63, "%d", _manager->getFirewallPort()); - - i = eXosip_initiate_call(invite, NULL, NULL, port); - - _debug("sip invite: firewall port = %s\n", port); + if (behindNat() != 0) { + _debug("sip invite: firewall port = %d\n",_manager->getFirewallPort()); + setLocalPort(_manager->getFirewallPort()); + } else { + return -1; + } } + + getSipCall(id)->setLocalAudioPort(_localPort); + bzero (port, 64); + snprintf (port, 63, "%d", getLocalPort()); + + i = eXosip_initiate_call(invite, NULL, NULL, port); if (i <= 0) { eXosip_unlock(); @@ -815,6 +849,10 @@ SipVoIPLink::startCall (const string& from, const string& to, } eXosip_unlock(); + + // Keep the cid in case of cancelling + setCid(i); + return i; } diff --git a/src/sipvoiplink.h b/src/sipvoiplink.h index a6c321f919262ba5791002e7e2f8389253a3495a..7f27bde05b9627ae431efd3d963cd747041a0913 100644 --- a/src/sipvoiplink.h +++ b/src/sipvoiplink.h @@ -25,13 +25,11 @@ #include <string> #include <vector> -#include "audio/audiocodec.h" -#include "audio/codecDescriptor.h" #include "voIPLink.h" using namespace std; -#define EXPIRES_VALUE 3600 +#define EXPIRES_VALUE 180 // 1XX responses #define DIALOG_ESTABLISHED 101 // 4XX Errors @@ -55,6 +53,7 @@ using namespace std; class AudioCodec; class AudioRtp; +class CodecDescriptor; class EventThread; class Manager; class SipCall; @@ -71,9 +70,10 @@ public: virtual void initRtpmapCodec (void); virtual void quit (void); virtual int setRegister (void); - virtual int outgoingInvite (const string& to_url); + virtual int outgoingInvite (short id, const string& to_url); virtual int answer (short id); virtual int hangup (short id); + virtual int cancel (short id); virtual int onhold (short id); virtual int offhold (short id); virtual int transfer (short id, const string& to); @@ -101,14 +101,19 @@ public: SipCall* getSipCall(short callid); AudioCodec* getAudioCodec(short callid); + + // To Cancel + inline void setCid (int cid) { _cid = cid; } + inline int getCid (void) { return _cid; } private: + int behindNat (void); int getLocalIp (void); int checkUrl(const string& url); int setAuthentication (void); string fromHeader (const string& user, const string& host); string toHeader(const string& to); - int startCall (const string& from, const string& to, + int startCall (short id, const string& from, const string& to, const string& subject, const string& route); /* * Look for call with same cid/did @@ -123,6 +128,7 @@ private: SipCallVector* _sipcallVector; AudioRtp* _audiortp; int _localPort; + int _cid; }; diff --git a/src/trayicon_x11.cpp b/src/trayicon_x11.cpp deleted file mode 100644 index 15f401e7f60fa4aff2b01d5cc1aeb57ed9cf6560..0000000000000000000000000000000000000000 --- a/src/trayicon_x11.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/* - * trayicon_x11.cpp - X11 trayicon (for use with KDE and GNOME) - * Copyright (C) 2003 Justin Karneges - * GNOME2 Notification Area support: Tomasz Sterna - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "gui/qt/trayicon.h" - -#include<qapplication.h> -#include<qimage.h> -#include<qpixmap.h> -#include<qtooltip.h> -#include<qpainter.h> - -#include<X11/Xlib.h> -#include<X11/Xutil.h> -#include<X11/Xatom.h> - -//#if QT_VERSION < 0x030200 -extern Time qt_x_time; -//#endif - -//---------------------------------------------------------------------------- -// common stuff -//---------------------------------------------------------------------------- - -// for Gnome2 Notification Area -static XErrorHandler old_handler = 0; -static int dock_xerror = 0; -extern "C" int dock_xerrhandler(Display* dpy, XErrorEvent* err) -{ - dock_xerror = err->error_code; - return old_handler(dpy, err); -} - -static void trap_errors() -{ - dock_xerror = 0; - old_handler = XSetErrorHandler(dock_xerrhandler); -} - -static bool untrap_errors() -{ - XSetErrorHandler(old_handler); - return (dock_xerror == 0); -} - -static bool send_message( - Display* dpy, /* display */ - Window w, /* sender (tray icon window) */ - long message, /* message opcode */ - long data1, /* message data 1 */ - long data2, /* message data 2 */ - long data3 /* message data 3 */ -) { - XEvent ev; - - memset(&ev, 0, sizeof(ev)); - ev.xclient.type = ClientMessage; - ev.xclient.window = w; - ev.xclient.message_type = XInternAtom (dpy, "_NET_SYSTEM_TRAY_OPCODE", False ); - ev.xclient.format = 32; - ev.xclient.data.l[0] = CurrentTime; - ev.xclient.data.l[1] = message; - ev.xclient.data.l[2] = data1; - ev.xclient.data.l[3] = data2; - ev.xclient.data.l[4] = data3; - - trap_errors(); - XSendEvent(dpy, w, False, NoEventMask, &ev); - XSync(dpy, False); - return untrap_errors(); -} - -#define SYSTEM_TRAY_REQUEST_DOCK 0 -#define SYSTEM_TRAY_BEGIN_MESSAGE 1 -#define SYSTEM_TRAY_CANCEL_MESSAGE 2 - -//---------------------------------------------------------------------------- -// TrayIcon::TrayIconPrivate -//---------------------------------------------------------------------------- - -class TrayIcon::TrayIconPrivate : public QWidget -{ -public: - TrayIconPrivate(TrayIcon *object, int size); - ~TrayIconPrivate() { } - - virtual void initWM(WId icon); - - virtual void setPixmap(const QPixmap &pm); - - virtual void paintEvent(QPaintEvent *); - virtual void enterEvent(QEvent *); - virtual void mouseMoveEvent(QMouseEvent *e); - virtual void mousePressEvent(QMouseEvent *e); - virtual void mouseReleaseEvent(QMouseEvent *e); - virtual void mouseDoubleClickEvent(QMouseEvent *e); - virtual void closeEvent(QCloseEvent *e); - -private: - TrayIcon *iconObject; - QPixmap pix; - int size; -}; - -TrayIcon::TrayIconPrivate::TrayIconPrivate(TrayIcon *object, int _size) - : QWidget(0, "psidock", WRepaintNoErase) -{ - iconObject = object; - size = _size; - - setFocusPolicy(NoFocus); - setBackgroundMode(X11ParentRelative); - - setMinimumSize(size, size); - setMaximumSize(size, size); -} - -// This base stuff is required by both FreeDesktop specification and WindowMaker -void TrayIcon::TrayIconPrivate::initWM(WId icon) -{ - Display *dsp = x11Display(); - WId leader = winId(); - - // set the class hint - XClassHint classhint; - classhint.res_name = (char*)"psidock"; - classhint.res_class = (char*)"Psi"; - XSetClassHint(dsp, leader, &classhint); - - // set the Window Manager hints - XWMHints *hints; - hints = XGetWMHints(dsp, leader); // init hints - hints->flags = WindowGroupHint | IconWindowHint | StateHint; // set the window group hint - hints->window_group = leader; // set the window hint - hints->initial_state = WithdrawnState; // initial state - hints->icon_window = icon; // in WM, this should be winId() of separate widget - hints->icon_x = 0; - hints->icon_y = 0; - XSetWMHints(dsp, leader, hints); // set the window hints for WM to use. - XFree( hints ); -} - -void TrayIcon::TrayIconPrivate::setPixmap(const QPixmap &pm) -{ - pix = pm; - setIcon(pix); - repaint(); -} - -void TrayIcon::TrayIconPrivate::paintEvent(QPaintEvent *) -{ - QPainter p(this); - p.drawPixmap((width() - pix.width())/2, (height() - pix.height())/2, pix); -} - -void TrayIcon::TrayIconPrivate::enterEvent(QEvent *e) -{ - // Taken from KSystemTray.. -//#if QT_VERSION < 0x030200 - //if ( !qApp->focusWidget() ) { - XEvent ev; - memset(&ev, 0, sizeof(ev)); - ev.xfocus.display = qt_xdisplay(); - ev.xfocus.type = FocusIn; - ev.xfocus.window = winId(); - ev.xfocus.mode = NotifyNormal; - ev.xfocus.detail = NotifyAncestor; - Time time = qt_x_time; - qt_x_time = 1; - qApp->x11ProcessEvent( &ev ); - qt_x_time = time; - //} -//#endif - QWidget::enterEvent(e); -} - -void TrayIcon::TrayIconPrivate::mouseMoveEvent(QMouseEvent *e) -{ - QApplication::sendEvent(iconObject, e); -} - -void TrayIcon::TrayIconPrivate::mousePressEvent(QMouseEvent *e) -{ - QApplication::sendEvent(iconObject, e); -} - -void TrayIcon::TrayIconPrivate::mouseReleaseEvent(QMouseEvent *e) -{ - QApplication::sendEvent(iconObject, e); -} - -void TrayIcon::TrayIconPrivate::mouseDoubleClickEvent(QMouseEvent *e) -{ - QApplication::sendEvent(iconObject, e); -} - -void TrayIcon::TrayIconPrivate::closeEvent(QCloseEvent *e) -{ - iconObject->gotCloseEvent(); - e->accept(); -} - -//---------------------------------------------------------------------------- -// TrayIconFreeDesktop -//---------------------------------------------------------------------------- - -class TrayIconFreeDesktop : public TrayIcon::TrayIconPrivate -{ -public: - TrayIconFreeDesktop(TrayIcon *object, const QPixmap &pm); -protected: - virtual bool x11Event(XEvent*); -}; - -TrayIconFreeDesktop::TrayIconFreeDesktop(TrayIcon *object, const QPixmap &pm) - : TrayIconPrivate(object, 22) -{ - initWM( winId() ); - - // initialize NetWM - Display *dsp = x11Display(); - - // dock the widget (adapted from SIM-ICQ) - Screen *screen = XDefaultScreenOfDisplay(dsp); // get the screen - int screen_id = XScreenNumberOfScreen(screen); // and it's number - - // tell X that we want to see ClientMessage and Deleted events, which - // are picked up by QApplication::x11EventFilter - Window root_window = QApplication::desktop()->winId(); - XWindowAttributes attr; - - XGetWindowAttributes(dsp, root_window, &attr); - XSelectInput(dsp, root_window, attr.your_event_mask | StructureNotifyMask); - - char buf[32]; - snprintf(buf, sizeof(buf), "_NET_SYSTEM_TRAY_S%d", screen_id); - Atom selection_atom = XInternAtom(dsp, buf, false); - XGrabServer(dsp); - Window manager_window = XGetSelectionOwner(dsp, selection_atom); - if ( manager_window != None ) - XSelectInput(dsp, manager_window, StructureNotifyMask); - XUngrabServer(dsp); - XFlush(dsp); - - if ( manager_window != None ) - send_message(dsp, manager_window, SYSTEM_TRAY_REQUEST_DOCK, winId(), 0, 0); - else - { - object->hide(); - return; - } - - // some KDE mumbo-jumbo... why is it there? anybody? - Atom kwm_dockwindow_atom = XInternAtom(dsp, "KWM_DOCKWINDOW", false); - Atom kde_net_system_tray_window_for_atom = XInternAtom(dsp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", false); - - long data = 0; - XChangeProperty(dsp, winId(), kwm_dockwindow_atom, kwm_dockwindow_atom, 32, PropModeReplace, (uchar*)&data, 1); - XChangeProperty(dsp, winId(), kde_net_system_tray_window_for_atom, XA_WINDOW, 32, PropModeReplace, (uchar*)&data, 1); - - setPixmap(pm); -} - -bool TrayIconFreeDesktop::x11Event(XEvent *ev) -{ - switch(ev->type) - { - case ReparentNotify: - show(); - - } - return false; -} - -//---------------------------------------------------------------------------- -// TrayIconWindowMaker -//---------------------------------------------------------------------------- - -class TrayIconWharf : public TrayIcon::TrayIconPrivate -{ -public: - TrayIconWharf(TrayIcon *object, const QPixmap &pm) - : TrayIconPrivate(object, 44) - { - // set the class hint - XClassHint classhint; - classhint.res_name = (char*)"psidock-wharf"; - classhint.res_class = (char*)"Psi"; - XSetClassHint(x11Display(), winId(), &classhint); - - setPixmap(pm); - } - - void setPixmap(const QPixmap &_pm) - { - QPixmap pm; - QImage i = _pm.convertToImage(); - i = i.scale(i.width() * 2, i.height() * 2); - pm.convertFromImage(i); - - TrayIconPrivate::setPixmap(pm); - - // thanks to Robert Spier for this: - // for some reason the repaint() isn't being honored, or isn't for - // the icon. So force one on the widget behind the icon - erase(); - QPaintEvent pe( rect() ); - paintEvent(&pe); - } -}; - -class TrayIconWindowMaker : public TrayIcon::TrayIconPrivate -{ -public: - TrayIconWindowMaker(TrayIcon *object, const QPixmap &pm); - ~TrayIconWindowMaker(); - - void setPixmap(const QPixmap &pm); - -private: - TrayIconWharf *wharf; -}; - -TrayIconWindowMaker::TrayIconWindowMaker(TrayIcon *object, const QPixmap &pm) - : TrayIconPrivate(object, 32) -{ - wharf = new TrayIconWharf(object, pm); - - initWM( wharf->winId() ); -} - -TrayIconWindowMaker::~TrayIconWindowMaker() -{ - delete wharf; -} - -void TrayIconWindowMaker::setPixmap(const QPixmap &pm) -{ - wharf->setPixmap(pm); -} - -//---------------------------------------------------------------------------- -// TrayIcon -//---------------------------------------------------------------------------- - -void TrayIcon::sysInstall() -{ - if ( d ) - return; - - if ( v_isWMDock ) - d = (TrayIconPrivate *)(new TrayIconWindowMaker(this, pm)); - else - d = (TrayIconPrivate *)(new TrayIconFreeDesktop(this, pm)); - - sysUpdateToolTip(); - - if ( v_isWMDock ) - d->show(); -} - -void TrayIcon::sysRemove() -{ - if ( !d ) - return; - - delete d; - d = 0; -} - -void TrayIcon::sysUpdateIcon() -{ - if ( !d ) - return; - - QPixmap pix = pm; - d->setPixmap(pix); -} - -void TrayIcon::sysUpdateToolTip() -{ - if ( !d ) - return; - - if ( tip.isEmpty() ) - QToolTip::remove(d); - else - QToolTip::add(d, tip); -} - diff --git a/src/user_cfg.h b/src/user_cfg.h index f299895470670b2b3b9200c0f6cace1f02c5a4de..c57c2a220b8f62d031612b314ea172147bf6c1a7 100644 --- a/src/user_cfg.h +++ b/src/user_cfg.h @@ -89,7 +89,7 @@ #define DFT_PULSE_LENGTH 250 #define SIP_INFO 0 #define DFT_STUN_SERVER "stun.fwdnet.net:3478" -#define DFT_DRIVER OSS_DRIVER +#define DFT_DRIVER 0 #define DFT_NB_CODEC 3 #define DFT_CODEC "G711u" #define DFT_VOL_SPKR_X 365 diff --git a/src/voIPLink.cpp b/src/voIPLink.cpp index a3d9ef8bdabcab7376bc2f38881810db1964791a..fd50a2f646971d5e3b83fe7aee2d5b993d8413a3 100644 --- a/src/voIPLink.cpp +++ b/src/voIPLink.cpp @@ -18,7 +18,7 @@ */ #include <string> - + #include "user_cfg.h" #include "voIPLink.h" diff --git a/src/voIPLink.h b/src/voIPLink.h index 3d46697935da4d4e0984ac0a101057592bf46aa3..d3d026a8fb45a425f59edeaf077263f89fee8cf8 100644 --- a/src/voIPLink.h +++ b/src/voIPLink.h @@ -21,7 +21,6 @@ #define __VOIP_LINK_H__ #include <string> -#include "audio/audiocodec.h" using namespace std; @@ -30,6 +29,7 @@ enum VoIPLinkType { Iax }; +class AudioCodec; class Call; class Manager; class VoIPLink { @@ -44,9 +44,10 @@ public: virtual void newOutgoingCall (short callid) = 0; virtual void newIncomingCall (short callid) = 0; virtual void deleteSipCall (short callid) = 0; - virtual int outgoingInvite (const string& to_url) = 0; + virtual int outgoingInvite (short id, const string& to_url) = 0; virtual int answer (short id) = 0; virtual int hangup (short id) = 0; + virtual int cancel (short id) = 0; virtual int onhold (short id) = 0; virtual int offhold (short id) = 0; virtual int transfer (short id, const string& to) = 0; diff --git a/stund/stun.cxx b/stund/stun.cxx index 7e2ae421960a5d894153386461847c7bf8f79744..3343d6214bb403a0ed91751f8d1928a026d6baf8 100644 --- a/stund/stun.cxx +++ b/stund/stun.cxx @@ -667,7 +667,7 @@ stunRand() tick = hightick; tick <<= 32; tick |= lowtick; -#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) ) +#elif defined(__GNUC__) && ( defined(__i686__) || defined(__i386__) || defined(__x86_64__)) asm("rdtsc" : "=A" (tick)); #elif defined (__SUNPRO_CC) || defined( __sparc__ ) tick = gethrtime(); @@ -719,6 +719,10 @@ randomPort() static void computeHmac(char* hmac, const char* input, int length, const char* key, int sizeKey) { + (void)input; + (void)length; + (void)key; + (void)sizeKey; strncpy(hmac,"hmac-not-implemented",20); } #else