You can subscribe to this list here.
2003 |
Jan
|
Feb
(8) |
Mar
(7) |
Apr
(14) |
May
(6) |
Jun
(3) |
Jul
(3) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
|
Mar
(13) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(14) |
Dec
|
2005 |
Jan
(2) |
Feb
(9) |
Mar
(5) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(6) |
Dec
|
2006 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Anders B. <vr-...@us...> - 2006-05-24 08:57:58
|
Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21260/src Modified Files: audioenvironment.cpp sourcebase.cpp streamupdater.cpp Log Message: Minor changes. Moved update source into thread safe area in streamupdater. Index: sourcebase.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/sourcebase.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** sourcebase.cpp 24 Mar 2005 11:47:48 -0000 1.13 --- sourcebase.cpp 24 May 2006 08:57:53 -0000 1.14 *************** *** 67,71 **** delete [] linkedsources_; ! if (alGetError() != AL_FALSE) { std::cerr << "~SourceBase() - Warning - Error deleting sources\n"; --- 67,72 ---- delete [] linkedsources_; ! ALenum status = alGetError(); ! if (status != AL_FALSE) { std::cerr << "~SourceBase() - Warning - Error deleting sources\n"; Index: audioenvironment.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/audioenvironment.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** audioenvironment.cpp 24 Mar 2005 11:47:48 -0000 1.9 --- audioenvironment.cpp 24 May 2006 08:57:53 -0000 1.10 *************** *** 89,96 **** switch(error) { case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for gain"); ! break; default: ! throw FatalError("Error trying to set gain!"); } } --- 89,96 ---- switch(error) { case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for gain"); ! break; default: ! throw FatalError("Error trying to set gain!"); } } Index: streamupdater.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/streamupdater.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** streamupdater.cpp 14 Nov 2005 09:07:02 -0000 1.15 --- streamupdater.cpp 24 May 2006 08:57:53 -0000 1.16 *************** *** 76,81 **** void StreamUpdater::addSource(ALuint sourcename) { - alSourceStop(sourcename); ENTER_CRITICAL; newsources_.push_back(sourcename); if(!sources_.size()) --- 76,81 ---- void StreamUpdater::addSource(ALuint sourcename) { ENTER_CRITICAL; + alSourceStop(sourcename); newsources_.push_back(sourcename); if(!sources_.size()) |
From: Anders B. <vr-...@us...> - 2006-03-28 21:07:49
|
Update of /cvsroot/alpp/openalpp/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9410 Added Files: doxygen.cfg index.html Removed Files: Doxyfile Log Message: --- Doxyfile DELETED --- --- NEW FILE: index.html --- <title>OpenAL++ - Documentation</title> <h2>OpenAL++</h2> <p>OpenAL++ is a c++ library that wraps the OpenAL library. By using reference counting and smart pointers, OpenAL++ make the use of 3D sound an easier task. It has been compiled and tested under Windows (.NET2003) and Linux (gcc3.5). </p> <h2>Documentation</h2> <p><a href="html/index.html">API reference</a></p> <h2></h2> <h2>Dependencies</h2> <p>OpenAL++ depends on OpenThreads and OpenAL.</p> <h2>Comments</h2> <p>Direct your comments, bug reports to <a href="mailto:an...@cs...">an...@cs...</a> </p> <p> </p> --- NEW FILE: doxygen.cfg --- # Doxyfile 1.4.4 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project # # All text after a hash (#) is considered a comment and will be ignored # The format is: # TAG = value [value, ...] # For lists items can also be appended using: # TAG += value [value, ...] # Values that contain spaces should be placed between quotes (" ") #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. [...1190 lines suppressed...] # If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will # generate a legend page explaining the meaning of the various boxes and # arrows in the dot generated graphs. GENERATE_LEGEND = YES # If the DOT_CLEANUP tag is set to YES (the default) Doxygen will # remove the intermediate dot files that are used to generate # the various graphs. DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- # The SEARCHENGINE tag specifies whether or not a search engine should be # used. If set to NO the values of all tags below this one will be ignored. SEARCHENGINE = NO |
From: Anders B. <vr-...@us...> - 2005-11-15 21:39:35
|
Update of /cvsroot/alpp/openalpp/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4511/VisualStudio Modified Files: openalpp.sln Log Message: Index: openalpp.sln =================================================================== RCS file: /cvsroot/alpp/openalpp/VisualStudio/openalpp.sln,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** openalpp.sln 15 Nov 2005 21:37:55 -0000 1.6 --- openalpp.sln 15 Nov 2005 21:39:28 -0000 1.7 *************** *** 31,34 **** --- 31,35 ---- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "playstream", "playstream.vcproj", "{2ACDFA12-B270-4A97-8A7E-0681ACAFB492}" ProjectSection(ProjectDependencies) = postProject + {2BA79A95-C0A7-4F13-9D84-7912AEA4A8B3} = {2BA79A95-C0A7-4F13-9D84-7912AEA4A8B3} EndProjectSection EndProject |
From: Anders B. <vr-...@us...> - 2005-11-15 21:38:03
|
Update of /cvsroot/alpp/openalpp/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4173/VisualStudio Modified Files: openalpp.sln Log Message: Index: openalpp.sln =================================================================== RCS file: /cvsroot/alpp/openalpp/VisualStudio/openalpp.sln,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** openalpp.sln 11 Nov 2004 07:57:57 -0000 1.5 --- openalpp.sln 15 Nov 2005 21:37:55 -0000 1.6 *************** *** 29,32 **** --- 29,36 ---- EndProjectSection EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "playstream", "playstream.vcproj", "{2ACDFA12-B270-4A97-8A7E-0681ACAFB492}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection + EndProject Global GlobalSection(SolutionConfiguration) = preSolution *************** *** 59,62 **** --- 63,70 ---- {B9EDEBD3-BCA0-4FDB-A2BE-CAA2FB2D5271}.Release.ActiveCfg = Release|Win32 {B9EDEBD3-BCA0-4FDB-A2BE-CAA2FB2D5271}.Release.Build.0 = Release|Win32 + {2ACDFA12-B270-4A97-8A7E-0681ACAFB492}.Debug.ActiveCfg = Debug|Win32 + {2ACDFA12-B270-4A97-8A7E-0681ACAFB492}.Debug.Build.0 = Debug|Win32 + {2ACDFA12-B270-4A97-8A7E-0681ACAFB492}.Release.ActiveCfg = Release|Win32 + {2ACDFA12-B270-4A97-8A7E-0681ACAFB492}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution |
From: Anders B. <vr-...@us...> - 2005-11-14 09:07:43
|
Update of /cvsroot/alpp/openalpp/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4541/VisualStudio Added Files: playstream.vcproj Log Message: Added playstream example. Minor fix in streamupdater.cpp --- NEW FILE: playstream.vcproj --- <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" Version="7.10" Name="playstream" ProjectGUID="{2ACDFA12-B270-4A97-8A7E-0681ACAFB492}" SccProjectName="" SccLocalPath=""> <Platforms> <Platform Name="Win32"/> </Platforms> <Configurations> <Configuration Name="Debug|Win32" OutputDirectory="..\bin" IntermediateDirectory=".\playstream_Debug" ConfigurationType="1" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" Optimization="0" OptimizeForProcessor="3" AdditionalIncludeDirectories="../include" PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="2" PrecompiledHeaderFile=".\playstream___Win32_Debug/playstream.pch" AssemblerListingLocation=".\playstream___Win32_Debug/" ObjectFile=".\playstream___Win32_Debug/" ProgramDataBaseFileName=".\playstream___Win32_Debug/" WarningLevel="3" SuppressStartupBanner="TRUE" DebugInformationFormat="4" CompileAs="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" OutputFile="$(OutDir)/$(ProjectName)d.exe" LinkIncremental="2" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="..\lib" IgnoreDefaultLibraryNames="" GenerateDebugInformation="TRUE" ProgramDatabaseFile=".\playstream___Win32_Debug/playstream.pdb" SubSystem="1"/> <Tool Name="VCMIDLTool" TypeLibraryName=".\playstream___Win32_Debug/playstream.tlb"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="_DEBUG" Culture="1053"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> <Configuration Name="Release|Win32" OutputDirectory="..\bin" IntermediateDirectory=".\playstream_Release" ConfigurationType="1" UseOfMFC="0" ATLMinimizesCRunTimeLibraryUsage="FALSE" CharacterSet="2"> <Tool Name="VCCLCompilerTool" InlineFunctionExpansion="1" OptimizeForProcessor="3" AdditionalIncludeDirectories="../include" PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE" StringPooling="TRUE" RuntimeLibrary="2" EnableFunctionLevelLinking="TRUE" UsePrecompiledHeader="2" PrecompiledHeaderFile=".\playstream___Win32_Release/playstream.pch" AssemblerListingLocation=".\playstream___Win32_Release/" ObjectFile=".\playstream___Win32_Release/" ProgramDataBaseFileName=".\playstream___Win32_Release/" WarningLevel="3" SuppressStartupBanner="TRUE" CompileAs="0"/> <Tool Name="VCCustomBuildTool"/> <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" OutputFile="$(OutDir)/$(ProjectName).exe" LinkIncremental="1" SuppressStartupBanner="TRUE" AdditionalLibraryDirectories="..\lib" ProgramDatabaseFile=".\playstream___Win32_Release/playstream.pdb" SubSystem="1"/> <Tool Name="VCMIDLTool" TypeLibraryName=".\playstream___Win32_Release/playstream.tlb"/> <Tool Name="VCPostBuildEventTool"/> <Tool Name="VCPreBuildEventTool"/> <Tool Name="VCPreLinkEventTool"/> <Tool Name="VCResourceCompilerTool" PreprocessorDefinitions="NDEBUG" Culture="1053"/> <Tool Name="VCWebServiceProxyGeneratorTool"/> <Tool Name="VCXMLDataGeneratorTool"/> <Tool Name="VCWebDeploymentTool"/> <Tool Name="VCManagedWrapperGeneratorTool"/> <Tool Name="VCAuxiliaryManagedWrapperGeneratorTool"/> </Configuration> </Configurations> <References> </References> <Files> <Filter Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"> <File RelativePath="..\tests\playstream.cpp"> </File> </Filter> </Files> <Globals> </Globals> </VisualStudioProject> |
From: Anders B. <vr-...@us...> - 2005-11-14 09:07:43
|
Update of /cvsroot/alpp/openalpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4541/tests Added Files: playstream.cpp Log Message: Added playstream example. Minor fix in streamupdater.cpp --- NEW FILE: playstream.cpp --- (This appears to be a binary file; contents omitted.) |
From: Anders B. <vr-...@us...> - 2005-11-14 09:07:43
|
Update of /cvsroot/alpp/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4541 Modified Files: NEWS Log Message: Added playstream example. Minor fix in streamupdater.cpp Index: NEWS =================================================================== RCS file: /cvsroot/alpp/openalpp/NEWS,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NEWS 24 Mar 2005 11:47:46 -0000 1.9 --- NEWS 14 Nov 2005 09:07:35 -0000 1.10 *************** *** 1,3 **** --- 1,6 ---- NEWS + 2005-11-14 Anders Backman + Added playstream example to be able to play ogg files from cmd-line. + 2005-03-23 Dewitt Colclough [de...@tw...] Added seek() method to move in ogg streams. |
From: Anders B. <vr-...@us...> - 2005-11-14 09:07:10
|
Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4431 Modified Files: streamupdater.cpp Log Message: Added initial value to alBuffer to avoid debug error in .NET Index: streamupdater.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/streamupdater.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** streamupdater.cpp 24 Mar 2005 11:47:48 -0000 1.14 --- streamupdater.cpp 14 Nov 2005 09:07:02 -0000 1.15 *************** *** 104,108 **** ALint processed,state; ! ALuint albuffer; ENTER_CRITICAL; --- 104,108 ---- ALint processed,state; ! ALuint albuffer=0; ENTER_CRITICAL; |
From: Anders B. <vr-...@us...> - 2005-04-22 13:00:49
|
Update of /cvsroot/alpp/openalpp/include/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20238 Modified Files: windowsstuff.h Log Message: removed define of usleep, replaced with inline function Index: windowsstuff.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/windowsstuff.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** windowsstuff.h 24 Mar 2005 11:47:48 -0000 1.6 --- windowsstuff.h 22 Apr 2005 13:00:39 -0000 1.7 *************** *** 35,39 **** #include <windows.h> ! #define usleep(x) Sleep((x)/1000) #include <AL/alut.h> --- 35,40 ---- #include <windows.h> ! ! inline void usleep( int x ) { Sleep( x /1000 ); }; #include <AL/alut.h> |
From: Anders B. <vr-...@us...> - 2005-03-24 12:25:20
|
Update of /cvsroot/alpp/openalpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2704 Modified Files: README Log Message: Index: README =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/README,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** README 24 Mar 2005 11:47:49 -0000 1.5 --- README 24 Mar 2005 12:25:07 -0000 1.6 *************** *** 5,18 **** moving - Play the file bee.wav and moves it left/right (from the tutorial). testmic - Read from the default input device and play it to a source placed on (0,0,0). Stop when return is pressed. testsend - Load a file (gamebeginning.wav - not included) and send it through a socket, in packets of 1024 bytes. To be used in conjunction with teststream. - multiple - Loads and plays and deletes several wav files. Tests the reference pointer deallocation teststream - Connect a socket to a source and play it. Run testsend directly after running this. - More tests might be added in the future. The stranger tests that I used while developing have been removed as they would probably not be very interesting. --- 5,24 ---- moving - Play the file bee.wav and moves it left/right (from the tutorial). + + multiple - Loads and plays and deletes several wav files. Tests the reference pointer deallocation + + testftream - Load and plays ogg files, pause, etc.. + + + Deprecated tests listed below: + testmic - Read from the default input device and play it to a source placed on (0,0,0). Stop when return is pressed. testsend - Load a file (gamebeginning.wav - not included) and send it through a socket, in packets of 1024 bytes. To be used in conjunction with teststream. teststream - Connect a socket to a source and play it. Run testsend directly after running this. More tests might be added in the future. The stranger tests that I used while developing have been removed as they would probably not be very interesting. |
From: Anders B. <vr-...@us...> - 2005-03-24 11:48:01
|
Update of /cvsroot/alpp/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14023 Modified Files: INSTALL NEWS configure Removed Files: Doxyfile Log Message: Ogg streaming revised by Dewitt Colclough [de...@tw...]. --- Doxyfile DELETED --- Index: NEWS =================================================================== RCS file: /cvsroot/alpp/openalpp/NEWS,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NEWS 7 Feb 2005 19:42:37 -0000 1.8 --- NEWS 24 Mar 2005 11:47:46 -0000 1.9 *************** *** 1,3 **** --- 1,9 ---- NEWS + 2005-03-23 Dewitt Colclough [de...@tw...] + Added seek() method to move in ogg streams. + Major stability, memory leak fix for streaming ogg files. + Fixed pause() method when streaming. + + 2005-02-07 Anders Backman Minor patches applied to buildsystem Index: configure =================================================================== RCS file: /cvsroot/alpp/openalpp/configure,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** configure 25 Feb 2005 14:31:46 -0000 1.10 --- configure 24 Mar 2005 11:47:46 -0000 1.11 *************** *** 242,245 **** --- 242,256 ---- + # Find the correct PATH separator. Usually this is `:', but + # DJGPP uses `;' like DOS. + if test "X${PATH_SEPARATOR+set}" != Xset; then + UNAME=${UNAME-`uname 2>/dev/null`} + case X$UNAME in + *-DOS) lt_cv_sys_path_separator=';' ;; + *) lt_cv_sys_path_separator=':' ;; [...18098 lines suppressed...] + /^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 $dirpart/$fdir" >&5 + echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done + ;; + esac + done + _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF Index: INSTALL =================================================================== RCS file: /cvsroot/alpp/openalpp/INSTALL,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** INSTALL 5 Mar 2004 10:14:02 -0000 1.7 --- INSTALL 24 Mar 2005 11:47:46 -0000 1.8 *************** *** 17,22 **** Portable thread library ! Portaudio - ! Portable library for handling input/output devices in a platform independent way. Download --- 17,23 ---- Portable thread library ! Deprecated: ! (Portaudio - ! Portable library for handling input/output devices in a platform independent way.) Download *************** *** 24,28 **** To build OpenAL++ you first need to download and install OggVorbis, OpenAL, OpenThreads. ! The use of Portaudio is not well tested and should be considered unstable! Building OpenAL++ under Linux/Unix --- 25,29 ---- To build OpenAL++ you first need to download and install OggVorbis, OpenAL, OpenThreads. ! (The use of Portaudio is not well tested and should be considered unstable!) Building OpenAL++ under Linux/Unix *************** *** 46,49 **** --- 47,52 ---- By default, all the files will be installed under /usr/local (e.g. the include-files under /usr/local/include). This can be changed by using the --prefix flag for autogen.sh (e.g. ./autogen.sh --prefix=/usr). + The CMake configurationfiles should be considered out of date. + Windows ------- |
From: Anders B. <vr-...@us...> - 2005-03-24 11:48:00
|
Update of /cvsroot/alpp/openalpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14023/tests Modified Files: CMakeLists.txt README moving.cpp multiple.cpp simple.cpp testfstream.cpp testmic.cpp testsend.cpp teststream.cpp Added Files: one_ten_b.ogg test1.ogg test2.ogg test3.ogg Log Message: Ogg streaming revised by Dewitt Colclough [de...@tw...]. Index: teststream.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/teststream.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** teststream.cpp 11 Nov 2004 07:57:58 -0000 1.10 --- teststream.cpp 24 Mar 2005 11:47:49 -0000 1.11 *************** *** 1,63 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * CommonC++ (http://cplusplus.sourceforge.net/) ! * ! * 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. ! * ! * Example where a soundfile is loaded using alutLoadWav and streamed over a UDP socket ! * to a receiver that will read the datastream and play it. ! * A sound Source is created and connected to the UDP stream of data ! */ ! #include <cc++/socket.h> ! #include <cc++/thread.h> ! #include <openalpp/alpp.h> ! ! using namespace openalpp; ! ! int main(int argc,char **argv) { ! // Buffersize in #samples. <-- This has changed from earlier releases! ! unsigned int buffersize=4096; ! if(argc>1) ! buffersize=atoi(argv[1]); ! ! try { ! // Create a socket and listen for streamed data ! ost::UDPSocket socket(ost::InetAddress("127.0.0.1"),33333); ! ! // Create a soundstream that will read its data from the socket ! // Unless you want to send lots of data, it's a good idea to go for a ! // low rate and/or small sample format. ! NetStream stream(&socket,Mono16,44100,buffersize); ! ! // Create a soundsource that uses the net-streamed soundstream. ! Source source(stream); ! ! source.SetAmbient(); ! source.Play(); ! std::cout << "Press return to continue\n"; ! std::cin.get(); ! source.Stop(); ! } catch(openalpp::Error e) { ! std::cerr << e << "\n"; ! } catch(...) { ! std::cerr << "Unknown error!\n"; ! } ! return 0; ! } --- 1,63 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * CommonC++ (http://cplusplus.sourceforge.net/) ! * ! * 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. ! * ! * Example where a soundfile is loaded using alutLoadWav and streamed over a UDP socket ! * to a receiver that will read the datastream and play it. ! * A sound Source is created and connected to the UDP stream of data ! */ ! #include <cc++/socket.h> ! #include <cc++/thread.h> ! #include <openalpp/alpp.h> ! ! using namespace openalpp; ! ! int main(int argc,char **argv) { ! // Buffersize in #samples. <-- This has changed from earlier releases! ! unsigned int buffersize=4096; ! if(argc>1) ! buffersize=atoi(argv[1]); ! ! try { ! // Create a socket and listen for streamed data ! ost::UDPSocket socket(ost::InetAddress("127.0.0.1"),33333); ! ! // Create a soundstream that will read its data from the socket ! // Unless you want to send lots of data, it's a good idea to go for a ! // low rate and/or small sample format. ! NetStream stream(&socket,Mono16,44100,buffersize); ! ! // Create a soundsource that uses the net-streamed soundstream. ! Source source(stream); ! ! source.SetAmbient(); ! source.Play(); ! std::cout << "Press return to continue\n"; ! std::cin.get(); ! source.Stop(); ! } catch(openalpp::Error e) { ! std::cerr << e << "\n"; ! } catch(...) { ! std::cerr << "Unknown error!\n"; ! } ! return 0; ! } --- NEW FILE: test1.ogg --- (This appears to be a binary file; contents omitted.) Index: multiple.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/multiple.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** multiple.cpp 11 Nov 2004 07:57:58 -0000 1.1 --- multiple.cpp 24 Mar 2005 11:47:49 -0000 1.2 *************** *** 1,66 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 <openalpp/alpp.h> ! #include <iostream> ! #include <string> ! #include <vector> ! ! using namespace openalpp; ! ! int main() ! { ! openalpp::ref_ptr<Sample> sample; ! ! std::cerr << "Loads a sample at the time, plays it for a while, then loads another one etc.." << std::endl; ! try { ! ! std::vector<std::string> file_vector; ! ! file_vector.push_back("a.wav"); ! file_vector.push_back("high-e.wav"); ! file_vector.push_back("low-e.wav"); ! ! openalpp::ref_ptr<Source> source = new Source; ! unsigned int delay = 500; ! for(int i = 0; i < 10; i++) { ! if (sample.valid()) { ! source->stop(); ! } ! std::string file = file_vector[i % file_vector.size()]; ! std::cerr << "Loading and playing " << file << " for " << delay/1000.0 << " seconds" << std::endl; ! sample = new Sample(file); ! source->setSound(sample.get()); ! source->setGain(1); ! source->setLooping(); ! source->play(); ! usleep(delay*1000); // Wait for delay milliseconds ! } ! } catch(Error e) { ! std::cerr << e << "\n"; ! } ! ! return 0; ! } ! --- 1,66 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 <openalpp/alpp.h> ! #include <iostream> ! #include <string> ! #include <vector> ! ! using namespace openalpp; ! ! int main() ! { ! openalpp::ref_ptr<Sample> sample; ! ! std::cerr << "Loads a sample at the time, plays it for a while, then loads another one etc.." << std::endl; ! try { ! ! std::vector<std::string> file_vector; ! ! file_vector.push_back("a.wav"); ! file_vector.push_back("high-e.wav"); ! file_vector.push_back("low-e.wav"); ! ! openalpp::ref_ptr<Source> source = new Source; ! unsigned int delay = 500; ! for(int i = 0; i < 10; i++) { ! if (sample.valid()) { ! source->stop(); ! } ! std::string file = file_vector[i % file_vector.size()]; ! std::cerr << "Loading and playing " << file << " for " << delay/1000.0 << " seconds" << std::endl; ! sample = new Sample(file); ! source->setSound(sample.get()); ! source->setGain(1); ! source->setLooping(); ! source->play(); ! usleep(delay*1000); // Wait for delay milliseconds ! } ! } catch(Error e) { ! std::cerr << e << "\n"; ! } ! ! return 0; ! } ! Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/CMakeLists.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CMakeLists.txt 2 Mar 2004 07:50:27 -0000 1.3 --- CMakeLists.txt 24 Mar 2005 11:47:49 -0000 1.4 *************** *** 1,44 **** ! LINK_DIRECTORIES(../src) ! ! FIND_LIBRARY(EXTRALIBS openal ${LIBDIRS}) ! ! IF(CCGNU_FOUND) ! FIND_LIBRARY(CCGNULIB ccgnu2 ${LIBDIRS}) ! IF(CCGNULIB) ! FIND_LIBRARY(THREADLIB pthread ${LIBDIRS}) ! FIND_LIBRARY(DLLIB dl ${LIBDIRS}) ! SET(EXTRALIBS ${EXTRALIBS} ${CCGNULIB} ${DLLIB} ${THREADLIB}) ! ENDIF(CCGNULIB) ! ! IF(PORTAUDIO_FOUND) ! FIND_LIBRARY(PALIB portaudio ${LIBDIRS}) ! IF(PALIB) ! SET(EXTRALIBS ${EXTRALIBS} ${PALIB}) ! ENDIF(PALIB) ! ENDIF(PORTAUDIO_FOUND) ! ! IF(VORBIS_FOUND) ! FIND_LIBRARY(VORBISFILELIB vorbisfile ${LIBDIRS}) ! FIND_LIBRARY(VORBISLIB vorbis ${LIBDIRS}) ! FIND_LIBRARY(OGGLIB ogg ${LIBDIRS}) ! IF(VORBISLIB) ! SET(EXTRALIBS ${EXTRALIBS} ${VORBISFILELIB} ${VORBISLIB} ${OGGLIB}) ! ENDIF(VORBISLIB) ! ENDIF(VORBIS_FOUND) ! ENDIF(CCGNU_FOUND) ! ! IF(CCGNU_FOUND) ! ADD_EXECUTABLE(moving moving.cpp) ! TARGET_LINK_LIBRARIES(moving openalpp ${EXTRALIBS}) ! ADD_EXECUTABLE(simple simple.cpp) ! TARGET_LINK_LIBRARIES(simple openalpp ${EXTRALIBS}) ! ADD_EXECUTABLE(testmic testmic.cpp) ! TARGET_LINK_LIBRARIES(testmic openalpp ${EXTRALIBS}) ! # ADD_EXECUTABLE(testsend testsend.cpp) ! # TARGET_LINK_LIBRARIES(testsend openalpp ${EXTRALIBS}) ! # ADD_EXECUTABLE(teststream teststream.cpp) ! # TARGET_LINK_LIBRARIES(teststream openalpp ${EXTRALIBS}) ! ENDIF(CCGNU_FOUND) ! ADD_EXECUTABLE(testfstream testfstream.cpp) ! ! TARGET_LINK_LIBRARIES(testfstream openalpp ${EXTRALIBS}) --- 1,44 ---- ! LINK_DIRECTORIES(../src) ! ! FIND_LIBRARY(EXTRALIBS openal ${LIBDIRS}) ! ! IF(CCGNU_FOUND) ! FIND_LIBRARY(CCGNULIB ccgnu2 ${LIBDIRS}) ! IF(CCGNULIB) ! FIND_LIBRARY(THREADLIB pthread ${LIBDIRS}) ! FIND_LIBRARY(DLLIB dl ${LIBDIRS}) ! SET(EXTRALIBS ${EXTRALIBS} ${CCGNULIB} ${DLLIB} ${THREADLIB}) ! ENDIF(CCGNULIB) ! ! IF(PORTAUDIO_FOUND) ! FIND_LIBRARY(PALIB portaudio ${LIBDIRS}) ! IF(PALIB) ! SET(EXTRALIBS ${EXTRALIBS} ${PALIB}) ! ENDIF(PALIB) ! ENDIF(PORTAUDIO_FOUND) ! ! IF(VORBIS_FOUND) ! FIND_LIBRARY(VORBISFILELIB vorbisfile ${LIBDIRS}) ! FIND_LIBRARY(VORBISLIB vorbis ${LIBDIRS}) ! FIND_LIBRARY(OGGLIB ogg ${LIBDIRS}) ! IF(VORBISLIB) ! SET(EXTRALIBS ${EXTRALIBS} ${VORBISFILELIB} ${VORBISLIB} ${OGGLIB}) ! ENDIF(VORBISLIB) ! ENDIF(VORBIS_FOUND) ! ENDIF(CCGNU_FOUND) ! ! IF(CCGNU_FOUND) ! ADD_EXECUTABLE(moving moving.cpp) ! TARGET_LINK_LIBRARIES(moving openalpp ${EXTRALIBS}) ! ADD_EXECUTABLE(simple simple.cpp) ! TARGET_LINK_LIBRARIES(simple openalpp ${EXTRALIBS}) ! ADD_EXECUTABLE(testmic testmic.cpp) ! TARGET_LINK_LIBRARIES(testmic openalpp ${EXTRALIBS}) ! # ADD_EXECUTABLE(testsend testsend.cpp) ! # TARGET_LINK_LIBRARIES(testsend openalpp ${EXTRALIBS}) ! # ADD_EXECUTABLE(teststream teststream.cpp) ! # TARGET_LINK_LIBRARIES(teststream openalpp ${EXTRALIBS}) ! ENDIF(CCGNU_FOUND) ! ADD_EXECUTABLE(testfstream testfstream.cpp) ! ! TARGET_LINK_LIBRARIES(testfstream openalpp ${EXTRALIBS}) Index: testmic.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/testmic.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** testmic.cpp 11 Nov 2004 07:57:58 -0000 1.13 --- testmic.cpp 24 Mar 2005 11:47:49 -0000 1.14 *************** *** 1,96 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * Example where sound is streamed from a microphone. ! */ ! #include "openalpp/alpp.h" ! #include <iostream> ! ! using namespace openalpp; ! ! #ifndef M_PI ! #define M_PI 3.14159265358979323846 ! #endif ! ! int main() { ! ! #ifdef ALPP_USE_PORTAUDIO ! ! ! try { ! InputDevice mic; ! ! Source source(mic); ! source.setGain(2); ! //source.SetLooping(); ! source.play(); ! usleep(3000*1000); ! ! float limits[2] = {0.5,-0.5}; ! //float delay=10; ! //float time=0,angle=0; ! ! source.setPosition(limits[0],0.0,0.0); ! source.play(); ! ! //const int no_laps=5; ! ! std::cerr << "Moving sound 5 times..." << std::endl; ! ! // Do a cheat time loop. ! #if 0 ! while(angle<(M_PI*no_laps)) { ! usleep(delay*1000); // Wait for delay milliseconds ! ! time +=delay/1000; // Calculate the time in the loop ! angle=M_PI *time; // What is the resulting angle ! ! // Calculate a new position ! std::cerr << cos(angle) << ", " << sin(angle) << std::endl; ! source.setPosition(limits[0]*cos(0),0.0,limits[1]*sin(0)); ! } ! #else ! std::cerr << "Moved to the left" << std::endl; ! source.setPosition(-0.5,0.0,0); ! usleep(3000*1000); ! std::cerr << "Moved to the right" << std::endl; ! source.setPosition(+0.5,0.0,0); ! usleep(3000*1000); ! #endif ! } catch(Error e) { ! std::cerr << e << "\n"; ! return -1; ! } ! ! ! std::cerr << "Press return to continue\n"; ! ! std::cin.get(); ! #else ! std::cerr << "Use of portaudio is not compiled to the project" << std::endl; ! std::cerr << "Look into the config.h and modify that if you inted to use PortAudio" << std::endl; ! #endif ! ! return 0; ! ! } ! --- 1,96 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * Example where sound is streamed from a microphone. ! */ ! #include "openalpp/alpp.h" ! #include <iostream> ! ! using namespace openalpp; ! ! #ifndef M_PI ! #define M_PI 3.14159265358979323846 ! #endif ! ! int main() { ! ! #ifdef ALPP_USE_PORTAUDIO ! ! ! try { ! InputDevice mic; ! ! Source source(mic); ! source.setGain(2); ! //source.SetLooping(); ! source.play(); ! usleep(3000*1000); ! ! float limits[2] = {0.5,-0.5}; ! //float delay=10; ! //float time=0,angle=0; ! ! source.setPosition(limits[0],0.0,0.0); ! source.play(); ! ! //const int no_laps=5; ! ! std::cerr << "Moving sound 5 times..." << std::endl; ! ! // Do a cheat time loop. ! #if 0 ! while(angle<(M_PI*no_laps)) { ! usleep(delay*1000); // Wait for delay milliseconds ! ! time +=delay/1000; // Calculate the time in the loop ! angle=M_PI *time; // What is the resulting angle ! ! // Calculate a new position ! std::cerr << cos(angle) << ", " << sin(angle) << std::endl; ! source.setPosition(limits[0]*cos(0),0.0,limits[1]*sin(0)); ! } ! #else ! std::cerr << "Moved to the left" << std::endl; ! source.setPosition(-0.5,0.0,0); ! usleep(3000*1000); ! std::cerr << "Moved to the right" << std::endl; ! source.setPosition(+0.5,0.0,0); ! usleep(3000*1000); ! #endif ! } catch(Error e) { ! std::cerr << e << "\n"; ! return -1; ! } ! ! ! std::cerr << "Press return to continue\n"; ! ! std::cin.get(); ! #else ! std::cerr << "Use of portaudio is not compiled to the project" << std::endl; ! std::cerr << "Look into the config.h and modify that if you inted to use PortAudio" << std::endl; ! #endif ! ! return 0; ! ! } ! --- NEW FILE: test2.ogg --- (This appears to be a binary file; contents omitted.) Index: simple.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/simple.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** simple.cpp 19 Nov 2004 07:47:55 -0000 1.15 --- simple.cpp 24 Mar 2005 11:47:49 -0000 1.16 *************** *** 1,65 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * Simple example for using OpenAL++. ! * Plays a file bee.wav in the background. ! */ ! #include <openalpp/alpp.h> ! #include <iostream> ! ! using namespace openalpp; ! ! ! int main(int argc,char **argv) { ! ! std::string file; ! file = "bee.wav"; ! ! if (argc > 1) ! file = argv[1]; ! ! std::cout << "Playing " << file << "\n"; ! ! try { ! openalpp::ref_ptr<Source> bgsound = new Source; //(file); // Create source and load sound ! bgsound->stop(); ! openalpp::ref_ptr<Sample> sample = new Sample(file); ! bgsound->setSound(sample.get()); ! bgsound->setGain(0.6f); // Lower gain (volume) ! bgsound->setLooping(); ! bgsound->setAmbient(); // Make sound ambient (i.e. not attenuated) ! bgsound->play(); // Start playing ! ! ! std::cerr << "Press return to stop: " << std::endl; ! ! std::string str; ! std::getline(std::cin, str); ! bgsound->stop(); ! std::cerr << "Done " << std::endl; ! ! } catch(Error e) { ! std::cerr << e << "\n"; ! return -1; ! } ! return 0; ! } --- 1,65 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * Simple example for using OpenAL++. ! * Plays a file bee.wav in the background. ! */ ! #include <openalpp/alpp.h> ! #include <iostream> ! ! using namespace openalpp; ! ! ! int main(int argc,char **argv) { ! ! std::string file; ! file = "bee.wav"; ! ! if (argc > 1) ! file = argv[1]; ! ! std::cout << "Playing " << file << "\n"; ! ! try { ! openalpp::ref_ptr<Source> bgsound = new Source; //(file); // Create source and load sound ! bgsound->stop(); ! openalpp::ref_ptr<Sample> sample = new Sample(file); ! bgsound->setSound(sample.get()); ! bgsound->setGain(0.6f); // Lower gain (volume) ! bgsound->setLooping(); ! bgsound->setAmbient(); // Make sound ambient (i.e. not attenuated) ! bgsound->play(); // Start playing ! ! ! std::cerr << "Press return to stop: " << std::endl; ! ! std::string str; ! std::getline(std::cin, str); ! bgsound->stop(); ! std::cerr << "Done " << std::endl; ! ! } catch(Error e) { ! std::cerr << e << "\n"; ! return -1; ! } ! return 0; ! } --- NEW FILE: one_ten_b.ogg --- (This appears to be a binary file; contents omitted.) Index: moving.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/moving.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** moving.cpp 11 Nov 2004 07:57:58 -0000 1.14 --- moving.cpp 24 Mar 2005 11:47:49 -0000 1.15 *************** *** 1,71 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * ! * Simple example for using OpenAL++. ! * Plays a file bee.wav and moves it left right. ! */ ! #include <openalpp/alpp.h> ! #include <iostream> ! ! ! using namespace openalpp; ! ! #ifndef M_PI ! #define M_PI 3.14159265358979323846 ! #endif ! ! ! int main() { ! try { ! openalpp::ref_ptr<Source> beesound = new Source("bee.wav"); ! beesound->setGain(1); ! beesound->setLooping(); ! ! float limits[2] = {5,-15}; ! float delay=10; ! float time=0,angle=0; ! ! beesound->setPosition(limits[0],0.0,0.0); ! beesound->play(); ! ! const int no_laps=5; ! ! std::cerr << "Moving sound 5 laps..." << std::endl; ! ! // Do a cheat time loop. ! while(angle<(M_PI*2.0*no_laps)) { ! usleep(delay*1000); // Wait for delay milliseconds ! ! time +=delay/1000; // Calculate the time in the loop ! angle=M_PI *time; // What is the resulting angle ! ! // Calculate a new position ! beesound->setPosition(limits[0]*cos(angle),0.0,limits[1]*sin(angle)); ! } ! } catch(Error e) { ! std::cerr << e << "\n"; ! return -1; ! } ! return 0; ! } ! --- 1,71 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * ! * Simple example for using OpenAL++. ! * Plays a file bee.wav and moves it left right. ! */ ! #include <openalpp/alpp.h> ! #include <iostream> ! ! ! using namespace openalpp; ! ! #ifndef M_PI ! #define M_PI 3.14159265358979323846 ! #endif ! ! ! int main() { ! try { ! openalpp::ref_ptr<Source> beesound = new Source("bee.wav"); ! beesound->setGain(1); ! beesound->setLooping(); ! ! float limits[2] = {5,-15}; ! float delay=10; ! float time=0,angle=0; ! ! beesound->setPosition(limits[0],0.0,0.0); ! beesound->play(); ! ! const int no_laps=5; ! ! std::cerr << "Moving sound 5 laps..." << std::endl; ! ! // Do a cheat time loop. ! while(angle<(M_PI*2.0*no_laps)) { ! usleep(delay*1000); // Wait for delay milliseconds ! ! time +=delay/1000; // Calculate the time in the loop ! angle=M_PI *time; // What is the resulting angle ! ! // Calculate a new position ! beesound->setPosition(limits[0]*cos(angle),0.0,limits[1]*sin(angle)); ! } ! } catch(Error e) { ! std::cerr << e << "\n"; ! return -1; ! } ! return 0; ! } ! Index: README =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/README,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README 11 Nov 2004 07:57:58 -0000 1.4 --- README 24 Mar 2005 11:47:49 -0000 1.5 *************** *** 1,21 **** ! Some small test/example programs. These are primarily for streaming, and might not work on all platforms yet.. ! ! simple - Play the file bee.wav. The basic test from the tutorial. ! ! moving - Play the file bee.wav and moves it left/right (from the tutorial). ! ! testmic - Read from the default input device and play it to a source placed on (0,0,0). Stop when return is pressed. ! ! testsend - Load a file (gamebeginning.wav - not included) and send it through a socket, in packets of 1024 bytes. To be used in conjunction with teststream. ! ! multiple - Loads and plays and deletes several wav files. Tests the reference pointer deallocation ! ! teststream - Connect a socket to a source and play it. Run testsend directly after running this. ! ! ! ! More tests might be added in the future. The stranger tests that I used while developing have been removed as they would ! probably not be very interesting. ! ! /Anders Backman, VRlab, 2004 ! Tomas Hämälä, VRlab, 2002 --- 1,21 ---- ! Some small test/example programs. These are primarily for streaming, and might not work on all platforms yet.. ! ! simple - Play the file bee.wav. The basic test from the tutorial. ! ! moving - Play the file bee.wav and moves it left/right (from the tutorial). ! ! testmic - Read from the default input device and play it to a source placed on (0,0,0). Stop when return is pressed. ! ! testsend - Load a file (gamebeginning.wav - not included) and send it through a socket, in packets of 1024 bytes. To be used in conjunction with teststream. ! ! multiple - Loads and plays and deletes several wav files. Tests the reference pointer deallocation ! ! teststream - Connect a socket to a source and play it. Run testsend directly after running this. ! ! ! ! More tests might be added in the future. The stranger tests that I used while developing have been removed as they would ! probably not be very interesting. ! ! /Anders Backman, VRlab, 2004 ! Tomas Hämälä, VRlab, 2002 --- NEW FILE: test3.ogg --- (This appears to be a binary file; contents omitted.) Index: testsend.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/testsend.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** testsend.cpp 11 Nov 2004 07:57:58 -0000 1.9 --- testsend.cpp 24 Mar 2005 11:47:49 -0000 1.10 *************** *** 1,99 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * CommonC++ (http://cplusplus.sourceforge.net/) ! * ! * 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. ! * ! * Example where a soundfile is loaded using alutLoadWav and streamed over a ! * UDP socket to a receiver that will read the datastream and play it. ! * ! * Note about selecting rate, format and sending rate: ! * Rate is given in samples per second, and format gives the size of one ! * sample. This means that, for example: ! * If the format is Mono16, we have one channel with 16 bit per channel, i.e. ! * 16 bit or 2 bytes per sample. ! * Say we have a frequency of 44100 samples per second. 2 byte samples will ! * mean that we need to stream 88200 bytes per second. ! * If we can send (and receive) ten packets per second, each packet should be ! * at least 8820 bytes. ! * If we instead had a frequency of 11025, then it would be enough with 2205 ! * bytes per packet. ! * Of course it's a good idea to add a few hundred bytes to those numbers ;) ! */ ! ! #include <cc++/thread.h> ! #include <cc++/socket.h> ! #include <iostream> ! #include <stdlib.h> ! #include <AL/al.h> ! #include <AL/alut.h> ! #include "openalpp/windowsstuff.h" ! ! using namespace ost; ! ! int main(int argc,char **argv) { ! ALvoid *data; ! ALsizei bits,freq,size; ! ALenum format; ! ALboolean success; ! // Default packet size (in bytes) ! // Note that this doesn't necessarily have to have anything to do with the ! // buffer size of the receiver. Just set it to something appropriate ! // (depending on the connection), and the receiver will take care of the ! // playing the sound correctly... ! unsigned int packetsize=10000; ! const char defaultfile[]="bee.wav"; ! const char *filename; ! ! if(argc>1) ! filename=argv[1]; ! else ! filename=defaultfile; ! if(argc>2) ! packetsize=atoi(argv[2]); ! ! try { ! success=alutLoadWAV(filename,&data,&format,&size,&bits,&freq); ! std::cerr << "Bits: " << bits << " Freq: " << freq << std::endl; ! ! if(success==AL_FALSE) { ! std::cerr << "Error loading " << filename << "\n"; ! exit(1); ! } ! ! UDPSocket socket; ! socket.setPeer(InetHostAddress("127.0.0.1"),33333); ! ! int totalsent=0; ! while(totalsent<size) { ! // Send data in packets with a 60 ms delay between packets ! if((totalsent+packetsize)>size) ! packetsize=size-totalsent; ! totalsent+=socket.send((char *)data+totalsent,packetsize); ! ost::Thread::sleep(60); ! } ! ! free(data); ! } catch(...) { ! std::cerr << "Error caught!\n"; ! } ! ! return 0; ! } --- 1,99 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * CommonC++ (http://cplusplus.sourceforge.net/) ! * ! * 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. ! * ! * Example where a soundfile is loaded using alutLoadWav and streamed over a ! * UDP socket to a receiver that will read the datastream and play it. ! * ! * Note about selecting rate, format and sending rate: ! * Rate is given in samples per second, and format gives the size of one ! * sample. This means that, for example: ! * If the format is Mono16, we have one channel with 16 bit per channel, i.e. ! * 16 bit or 2 bytes per sample. ! * Say we have a frequency of 44100 samples per second. 2 byte samples will ! * mean that we need to stream 88200 bytes per second. ! * If we can send (and receive) ten packets per second, each packet should be ! * at least 8820 bytes. ! * If we instead had a frequency of 11025, then it would be enough with 2205 ! * bytes per packet. ! * Of course it's a good idea to add a few hundred bytes to those numbers ;) ! */ ! ! #include <cc++/thread.h> ! #include <cc++/socket.h> ! #include <iostream> ! #include <stdlib.h> ! #include <AL/al.h> ! #include <AL/alut.h> ! #include "openalpp/windowsstuff.h" ! ! using namespace ost; ! ! int main(int argc,char **argv) { ! ALvoid *data; ! ALsizei bits,freq,size; ! ALenum format; ! ALboolean success; ! // Default packet size (in bytes) ! // Note that this doesn't necessarily have to have anything to do with the ! // buffer size of the receiver. Just set it to something appropriate ! // (depending on the connection), and the receiver will take care of the ! // playing the sound correctly... ! unsigned int packetsize=10000; ! const char defaultfile[]="bee.wav"; ! const char *filename; ! ! if(argc>1) ! filename=argv[1]; ! else ! filename=defaultfile; ! if(argc>2) ! packetsize=atoi(argv[2]); ! ! try { ! success=alutLoadWAV(filename,&data,&format,&size,&bits,&freq); ! std::cerr << "Bits: " << bits << " Freq: " << freq << std::endl; ! ! if(success==AL_FALSE) { ! std::cerr << "Error loading " << filename << "\n"; ! exit(1); ! } ! ! UDPSocket socket; ! socket.setPeer(InetHostAddress("127.0.0.1"),33333); ! ! int totalsent=0; ! while(totalsent<size) { ! // Send data in packets with a 60 ms delay between packets ! if((totalsent+packetsize)>size) ! packetsize=size-totalsent; ! totalsent+=socket.send((char *)data+totalsent,packetsize); ! ost::Thread::sleep(60); ! } ! ! free(data); ! } catch(...) { ! std::cerr << "Error caught!\n"; ! } ! ! return 0; ! } Index: testfstream.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/testfstream.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** testfstream.cpp 11 Nov 2004 07:57:58 -0000 1.7 --- testfstream.cpp 24 Mar 2005 11:47:49 -0000 1.8 *************** *** 1,72 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * Example of streaming from a file. Only ogg files are supported at the ! * moment (2003-02-15). The program takes one argument; the name of the file ! * to stream data from. ! */ ! ! #include <openalpp/alpp.h> ! #include <iostream> ! ! using namespace openalpp; ! ! int main(int argc,char **argv) { ! if(argc<=1) { ! std::cerr << "Syntax:\n " << argv[0] << " <audiofile>\n"; ! return 1; ! } ! ! std::cout << argv[1] << "\n"; ! ! try { ! ! std::vector<openalpp::ref_ptr<Source> > vec; ! std::vector<openalpp::ref_ptr<FileStream> > fstream_vec; ! ! for(int i=0; i < 1; i++) { ! ! openalpp::ref_ptr<FileStream> stream = new FileStream(argv[1]); ! fstream_vec.push_back(stream); ! stream->setLooping(); // Remove this to play file once only. ! ! ! Source *source = new Source(*stream.get()); ! vec.push_back(source); ! source->setAmbient(); ! source->play(); ! ! } ! std::cerr << "Press return to stop " << std::endl; ! std::cin.get(); ! ! for(unsigned int i=0; i < vec.size(); i++) ! vec[i]->stop(); ! usleep(1000*1000); ! ! } catch(openalpp::Error e) { ! std::cerr << e << "\n"; ! } catch(...) { ! std::cerr << "Unknown error!\n"; ! } ! return 0; ! } --- 1,208 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! * ! * Example of streaming from a file. Only ogg files are supported at the ! * moment (2003-02-15). The program takes one argument; the name of the file ! * to stream data from. ! */ ! ! #include <openalpp/alpp.h> ! #include <iostream> ! ! ! #define CRTDBG_MAP_ALLOC ! #include <stdlib.h> ! #ifdef WIN32 ! #include <crtdbg.h> ! #endif ! ! ! ! using namespace openalpp; ! ! void WaitForPlaying(Source* source) ! { ! while (source->getState() != openalpp::Playing) ! { ! usleep(1000); ! int checkCount = 0; ! if (checkCount++ > 1000) ! { ! throw openalpp::Error("Timed out while waiting for stream to play"); ! } ! } ! } ! ! void WaitForStopped(Source* source) ! { ! while (source->getState() != openalpp::Stopped) ! { ! usleep(1000); ! int checkCount = 0; ! if (checkCount++ > 1000) ! { ! throw openalpp::Error("Timed out while waiting for stream to stop"); ! } ! } ! } ! ! void TestSeek() ! { ! std::string numbers("one_ten_b.ogg"); ! ! ! std::vector<float> seekPoints; ! seekPoints.push_back(7.0); ! seekPoints.push_back(5.0); ! seekPoints.push_back(2.0); ! seekPoints.push_back(3.0); ! ! try ! { ! openalpp::ref_ptr<Source> source = new Source; ! ! source->setSound(new FileStream(numbers)); ! source->setAmbient(); ! ! for (size_t k=0; k<seekPoints.size(); ++k) ! { ! fprintf(stdout, "%.0f ", seekPoints[k]); ! source->seek(seekPoints[k]); ! if (k==0) ! { ! source->play(); ! } ! usleep(500*1000); ! } ! fprintf(stdout, "\n"); ! ! source->stop(); ! ! WaitForStopped(source.get()); ! ! } ! catch(openalpp::Error e) ! { ! std::cerr << e << "\n"; ! } ! catch(...) ! { ! std::cerr << "Unknown error!\n"; ! } ! ! } ! ! ! ! int main(int argc,char **argv) { ! #ifdef WIN32 ! // MSVC memory leak detection ! _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // {,,msvcr71d.dll}_crtBreakAlloc ! #endif ! std::string file1("test1.ogg"); ! std::string file2("test2.ogg"); ! std::string file3("test3.ogg"); ! ! TestSeek(); ! usleep(500000); ! try ! { ! ! openalpp::ref_ptr<Source> source = new Source; ! ! source->setSound(new FileStream(file1)); ! source->setAmbient(); ! source->play(); ! ! // Test transition to audio file when first finishes ! std::cout << "Waiting for first audio file to stop" << std::endl; ! ! WaitForStopped(source.get()); ! ! std::cout << "Playing second audio file" << std::endl; ! ! // For now, the source has to be re-created for stable behavior ! source = new Source; ! ! source->setSound(new FileStream(file3)); ! source->setAmbient(); ! source->play(); ! ! // Test pause and resume ! std::cout << "Press return to pause audio file" << std::endl; ! std::cin.get(); ! ! source->pause(); ! ! std::cout << "Press return to resume audio file" << std::endl; ! std::cin.get(); ! ! source->play(); ! ! // Test switching between files mid-stream ! std::cout << "Press return to switch to next audio file" << std::endl; ! std::cin.get(); ! ! ! for (int nSwitch = 0; nSwitch < 2; nSwitch++) ! { ! source = new Source; ! ! source->setSound(new FileStream(file2)); ! source->setAmbient(); ! source->play(); ! ! std::cout << "Press return to switch to next audio file" << std::endl; ! std::cin.get(); ! ! source->stop(); ! WaitForStopped(source.get()); ! ! source = new Source; ! ! source->setSound(new FileStream(file1)); ! source->setAmbient(); ! source->play(); ! ! std::cout << "Press return to switch to next audio file" << std::endl; ! std::cin.get(); ! ! source->stop(); ! WaitForStopped(source.get()); ! ! } ! ! std::cout << "Press return to exit" << std::endl; ! std::cin.get(); ! } ! catch(openalpp::Error e) ! { ! std::cerr << e << "\n"; ! } ! catch(...) ! { ! std::cerr << "Unknown error!\n"; ! } ! ! ! return 0; ! } |
Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14023/src Modified Files: CMakeLists.txt audiobase.cpp audioconvert.cpp audioenvironment.cpp deviceupdater.cpp error.cpp filestream.cpp filestreamupdater.cpp groupsource.cpp inputdevice.cpp listener.cpp netstream.cpp netupdater.cpp nofilestream.cpp noinputdevice.cpp nostreaming.cpp openalpp.cpp referenced.cpp sample.cpp sounddata.cpp source.cpp sourcebase.cpp stream.cpp streamupdater.cpp Log Message: Ogg streaming revised by Dewitt Colclough [de...@tw...]. Index: nofilestream.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/nofilestream.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nofilestream.cpp 11 Nov 2004 07:57:58 -0000 1.7 --- nofilestream.cpp 24 Mar 2005 11:47:48 -0000 1.8 *************** *** 1,47 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/filestream.h" ! ! namespace openalpp { ! ! FileStream::FileStream(const std::string& ,const int) ! throw (NameError,InitError,FileError) : Stream() { ! throw InitError("No support for streaming from files compiled in."); ! } ! ! FileStream::FileStream(const FileStream &stream) ! : Stream((const Stream &)stream) { ! } ! ! FileStream::~FileStream() { ! } ! ! FileStream &FileStream::operator=(const FileStream &/*stream*/) { ! return *this; ! } ! ! void FileStream::setLooping(bool) { ! } ! ! } --- 1,47 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/filestream.h" ! ! namespace openalpp { ! ! FileStream::FileStream(const std::string& ,const int) ! throw (NameError,InitError,FileError) : Stream() { ! throw InitError("No support for streaming from files compiled in."); ! } ! ! FileStream::FileStream(const FileStream &stream) ! : Stream((const Stream &)stream) { ! } ! ! FileStream::~FileStream() { ! } ! ! FileStream &FileStream::operator=(const FileStream &/*stream*/) { ! return *this; ! } ! ! void FileStream::setLooping(bool) { ! } ! ! } Index: sourcebase.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/sourcebase.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** sourcebase.cpp 12 Nov 2004 09:10:18 -0000 1.12 --- sourcebase.cpp 24 Mar 2005 11:47:48 -0000 1.13 *************** *** 1,440 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/sourcebase.h" ! ! /** ! * TODO: Should error checking be optional? ! * (a static bool throwflag in AudioBase)? ! */ ! ! using namespace openalpp; ! ! void SourceBase::init() throw (MemoryError,NameError) { ! alGenSources(1,&sourcename_); ! if(alGetError()!=AL_FALSE) ! throw NameError("Couldn't generate source name"); ! ! nlinkedsources_=1; ! alloclinkedsources_=2; ! //linkedsources_=(ALuint *)malloc(sizeof(ALuint)*alloclinkedsources_); ! linkedsources_ = new ALuint[alloclinkedsources_]; ! ! if(!linkedsources_) ! throw MemoryError("new failed"); ! linkedsources_[0]=sourcename_; ! reverbscale_=0.25; ! reverbdelay_=0.0; ! streaming_=false; ! } ! ! SourceBase::SourceBase() throw (MemoryError,NameError) : PositionedObject() { ! init(); ! } ! ! SourceBase::SourceBase(float x,float y,float z) ! throw (MemoryError,NameError) : PositionedObject() { ! ! init(); ! setPosition(x,y,z); ! } ! ! SourceBase::~SourceBase() { ! stop(); ! alDeleteSources(1,&sourcename_); ! //free(linkedsources_); ! delete [] linkedsources_; ! } ! ! SourceBase::SourceBase(const SourceBase &sourcebase) ! : PositionedObject(sourcebase) { ! ! if(this==&sourcebase) ! return; ! ! *this = sourcebase; ! ! ! /* float a,b,c; ! sourcebase.getPosition(a,b,c); ! setPosition(a,b,c); ! sourcebase.getVelocity(a,b,c); ! setVelocity(a,b,c); ! setPitch(sourcebase.getPitch()); ! sourcebase.getDirection(a,b,c); ! setDirection(a,b,c); ! sourcebase.getSoundCone(a,b,c); ! setSoundCone(a,b,c); ! sourcebase.getMinMaxGain(a,b); ! setMinMaxGain(a,b); ! setReferenceDistance(sourcebase.getReferenceDistance()); ! setRolloffFactor(sourcebase.getRolloffFactor()); ! setMaxDistance(sourcebase.getMaxDistance()); ! setLooping(sourcebase.isLooping()); ! setGain(sourcebase.getGain());*/ ! } ! ! SourceBase &SourceBase::operator=(const SourceBase &sourcebase) { ! if(this==&sourcebase) ! return *this; ! ! float a,b,c; ! sourcebase.getPosition(a,b,c); ! setPosition(a,b,c); ! sourcebase.getVelocity(a,b,c); ! setVelocity(a,b,c); ! setPitch(sourcebase.getPitch()); ! sourcebase.getDirection(a,b,c); ! setDirection(a,b,c); ! sourcebase.getSoundCone(a,b,c); ! setSoundCone(a,b,c); ! sourcebase.getMinMaxGain(a,b); ! setMinMaxGain(a,b); ! setReferenceDistance(sourcebase.getReferenceDistance()); ! setRolloffFactor(sourcebase.getRolloffFactor()); ! setMaxDistance(sourcebase.getMaxDistance()); ! setLooping(sourcebase.isLooping()); ! setGain(sourcebase.getGain()); ! ! return *this; ! } ! ! void SourceBase::play() { ! alSourcePlayv(nlinkedsources_,linkedsources_); ! } ! ! void SourceBase::pause() { ! alSourcePausev(nlinkedsources_,linkedsources_); ! } ! ! void SourceBase::stop() { ! alSourceStopv(nlinkedsources_,linkedsources_); ! } ! ! void SourceBase::rewind() { ! alSourceRewindv(nlinkedsources_,linkedsources_); ! } ! ! SourceState SourceBase::getState() const { ! ALint state; ! alGetSourceiv(sourcename_,AL_SOURCE_STATE,&state); ! switch(state) { ! case(AL_INITIAL): ! return Initial; ! case(AL_PLAYING): ! return Playing; ! case(AL_PAUSED): ! return Paused; ! case(AL_STOPPED): ! return Stopped; ! default: ! throw FatalError("AL_SOURCE_STATE is unknown"); ! } ! } ! ! void SourceBase::setLooping(bool loop) { ! if(loop && !streaming_) ! alSourcei(sourcename_,AL_LOOPING,AL_TRUE); ! else ! alSourcei(sourcename_,AL_LOOPING,AL_FALSE); ! } ! ! bool SourceBase::isLooping() const { ! ALint looping; ! alGetSourceiv(sourcename_,AL_LOOPING,&looping); ! return (looping==AL_TRUE); ! } ! ! void SourceBase::setDirection(float directionx, float directiony, float directionz) { ! alSource3f(sourcename_,AL_DIRECTION,directionx,directiony,directionz); ! } ! ! void SourceBase::getDirection(float &directionx, float &directiony, float &directionz) const { ! ALfloat direction[3]; ! alGetSourcefv(sourcename_,AL_DIRECTION,direction); ! directionx=direction[0]; ! directiony=direction[1]; ! directionz=direction[2]; ! } ! ! void SourceBase::makeOmniDirectional() { ! alSource3f(sourcename_,AL_DIRECTION,0.0,0.0,0.0); ! } ! ! void SourceBase::setSoundCone(float innerangle, float outerangle, float outergain) { ! alSourcef(sourcename_,AL_CONE_INNER_ANGLE,innerangle); ! alSourcef(sourcename_,AL_CONE_OUTER_ANGLE,outerangle); ! alSourcef(sourcename_,AL_CONE_OUTER_GAIN,outergain); ! } ! ! void SourceBase::getSoundCone(float &innerangle, float &outerangle, float &outergain) const { ! alGetSourcefv(sourcename_,AL_CONE_INNER_ANGLE,&innerangle); ! alGetSourcefv(sourcename_,AL_CONE_OUTER_ANGLE,&outerangle); ! alGetSourcefv(sourcename_,AL_CONE_OUTER_GAIN,&outergain); ! } ! ! void SourceBase::setGain(float gain) { ! alSourcef(sourcename_,AL_GAIN,gain); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for gain"); ! break; ! default: ! throw FatalError("Error trying to set gain!"); ! } ! } ! ! float SourceBase::getGain() const { ! ALfloat gain; ! alGetSourcefv(sourcename_,AL_GAIN,&gain); ! return gain; ! } ! ! void SourceBase::setMinMaxGain(float min, float max) { ! alSourcef(sourcename_,AL_MIN_GAIN,min); ! alSourcef(sourcename_,AL_MAX_GAIN,max); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for min/max gain"); ! break; ! default: ! throw FatalError("Error trying to set min/max gain!"); ! } ! } ! ! void SourceBase::getMinMaxGain(float & min, float &max) const { ! alGetSourcefv(sourcename_,AL_MIN_GAIN,&min); ! alGetSourcefv(sourcename_,AL_MAX_GAIN,&max); ! } ! ! void SourceBase::setAmbient(bool ambient) { ! if(ambient) { ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); ! alSourcef(sourcename_,AL_ROLLOFF_FACTOR,0.0); ! // TODO: if AL_ROLLOFF_FACTOR doesn't work; set ! // AL_MAX_GAIN=AL_MIN_GAIN=AL_GAIN for this source.. ! makeOmniDirectional(); ! } else { ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_FALSE); ! alSourcef(sourcename_,AL_ROLLOFF_FACTOR,1.0); ! } ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to make/unmake sound ambient!"); ! } ! ! bool SourceBase::isAmbient() const { ! ALint relative; ! alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); ! ALfloat rolloff; ! alGetSourcefv(sourcename_,AL_ROLLOFF_FACTOR,&rolloff); ! return (relative==AL_TRUE && rolloff<0.001); ! } ! ! void SourceBase::setRelative(bool relative) { ! if(relative) ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); ! else ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_FALSE); ! } ! ! bool SourceBase::isRelative() const { ! ALint relative; ! alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); ! return (relative==AL_TRUE); ! } ! ! void SourceBase::setReferenceDistance(float distance) { ! alSourcef(sourcename_,AL_REFERENCE_DISTANCE,distance); ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to set reference distance!"); ! } ! ! float SourceBase::getReferenceDistance() const { ! ALfloat ref; ! alGetSourcefv(sourcename_,AL_REFERENCE_DISTANCE,&ref); ! return ref; ! } ! ! void SourceBase::setMaxDistance(float distance) { ! alSourcef(sourcename_,AL_MAX_DISTANCE,distance); ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to set max distance!"); ! } ! ! float SourceBase::getMaxDistance() const { ! ALfloat maxdistance; ! alGetSourcefv(sourcename_,AL_MAX_DISTANCE,&maxdistance); ! return maxdistance; ! } ! ! void SourceBase::setRolloffFactor(float factor) { ! alSourcef(sourcename_,AL_ROLLOFF_FACTOR,factor); ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to set rolloff factor!"); ! } ! ! float SourceBase::getRolloffFactor() const { ! ALfloat factor; ! alGetSourcefv(sourcename_,AL_ROLLOFF_FACTOR,&factor); ! return factor; ! } ! ! void SourceBase::setPitch(float pitch) { ! alSourcef(sourcename_,AL_PITCH,pitch); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for pitch"); ! break; ! default: ! throw FatalError("Error trying to set pitch!"); ! } ! } ! ! float SourceBase::getPitch() const { ! ALfloat pitch; ! alGetSourcefv(sourcename_,AL_PITCH,&pitch); ! return pitch; ! } ! ! void SourceBase::setReverbScale(float scale) throw (InitError,ValueError) { ! if(reverbinitiated_) { ! alReverbScale(sourcename_,scale); ! if(alGetError()!=AL_FALSE) ! throw ValueError("Reverb scale must be in range [0.0,1.0]"); ! reverbscale_=scale; ! } else ! throw InitError("Reverb not initialized"); ! } ! ! void SourceBase::setReverbDelay(float delay) throw (InitError,ValueError) { ! if(reverbinitiated_) { ! alReverbDelay(sourcename_,delay); ! if(alGetError()!=AL_FALSE) ! throw ValueError("Reverb delay must be in range [0.0,2.0]"); ! reverbdelay_=delay; ! } else ! throw InitError("Reverb not initialized"); ! } ! ! float SourceBase::getReverbScale() throw (InitError) { ! if(!reverbinitiated_) ! throw InitError("Reverb not initialized"); ! return reverbscale_; ! } ! ! float SourceBase::getReverbDelay() throw (InitError) { ! if(!reverbinitiated_) ! throw InitError("Reverb not initialized"); ! return reverbdelay_; ! } ! ! ALuint SourceBase::link(const SourceBase *source) throw (MemoryError) { ! if(nlinkedsources_>=alloclinkedsources_) { ! alloclinkedsources_+=5; ! linkedsources_=(ALuint *)realloc(linkedsources_, ! sizeof(ALuint)*alloclinkedsources_); ! if(!linkedsources_) ! throw MemoryError("realloc failed"); ! } ! linkedsources_[nlinkedsources_++]=source->getAlSource(); ! return source->getAlSource(); ! } ! ! void SourceBase::unlink(const SourceBase *source) throw (NameError) { ! if(source->sourcename_==sourcename_) ! throw(NameError("Can't unlink a source from itself!")); ! for(unsigned int i=0;i<nlinkedsources_;i++) ! if(linkedsources_[i]==source->sourcename_) { ! linkedsources_[i]=linkedsources_[--nlinkedsources_]; ! return; ! } ! throw NameError("Source not linked"); ! } ! ! void SourceBase::unlink(const ALuint name) throw (NameError) { ! if(name==sourcename_) ! throw(NameError("Can't unlink a source from itself!")); ! for(unsigned int i=0;i<nlinkedsources_;i++) ! if(linkedsources_[i]==name) { ! linkedsources_[i]=linkedsources_[--nlinkedsources_]; ! return; ! } ! throw NameError("Source not linked"); ! } ! ! void SourceBase::unlinkAll() { ! nlinkedsources_=1; ! } ! ! ALuint SourceBase::getAlSource() const { ! return sourcename_; ! } ! ! void SourceBase::setPosition(float x, float y, float z) { ! alSource3f(sourcename_,AL_POSITION,x,y,z); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for position"); ! break; ! default: ! throw FatalError("Error trying to set position!"); ! } ! } ! ! void SourceBase::getPosition(float &x, float &y, float &z) const { ! ALfloat position[3]; ! alGetSourcefv(sourcename_,AL_POSITION,position); ! x=position[0]; ! y=position[1]; ! z=position[2]; ! } ! ! void SourceBase::setVelocity(float vx, float vy, float vz) { ! alSource3f(sourcename_,AL_VELOCITY,vx,vy,vz); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for velocity"); ! break; ! default: ! throw FatalError("Error trying to set velocity!"); ! } ! } ! ! void SourceBase::getVelocity(float &vx, float &vy, float &vz) const { ! ALfloat velocity[3]; ! alGetSourcefv(sourcename_,AL_VELOCITY,velocity); ! vx=velocity[0]; ! vy=velocity[1]; ! vz=velocity[2]; ! } ! --- 1,484 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/sourcebase.h" ! ! /** ! * TODO: Should error checking be optional? ! * (a static bool throwflag in AudioBase)? ! */ ! ! using namespace openalpp; ! ! void SourceBase::init() throw (MemoryError,NameError) { ! alGenSources(1,&sourcename_); ! if(alGetError()!=AL_FALSE) ! throw NameError("Couldn't generate source name"); ! ! nlinkedsources_=1; ! alloclinkedsources_=2; ! //linkedsources_=(ALuint *)malloc(sizeof(ALuint)*alloclinkedsources_); ! linkedsources_ = new ALuint[alloclinkedsources_]; ! ! if(!linkedsources_) ! throw MemoryError("new failed"); ! linkedsources_[0]=sourcename_; ! reverbscale_=0.25; ! reverbdelay_=0.0; ! streaming_=false; ! } ! ! SourceBase::SourceBase() throw (MemoryError,NameError) : PositionedObject() { ! init(); ! } ! ! SourceBase::SourceBase(float x,float y,float z) ! throw (MemoryError,NameError) : PositionedObject() { ! ! init(); ! setPosition(x,y,z); ! } ! ! SourceBase::~SourceBase() { ! stop(); ! ! alDeleteSources(1,&sourcename_); ! //free(linkedsources_); ! delete [] linkedsources_; ! ! if (alGetError() != AL_FALSE) ! { ! std::cerr << "~SourceBase() - Warning - Error deleting sources\n"; ! } ! } ! ! SourceBase::SourceBase(const SourceBase &sourcebase) ! : PositionedObject(sourcebase) { ! ! if(this==&sourcebase) ! return; ! ! *this = sourcebase; ! ! ! /* float a,b,c; ! sourcebase.getPosition(a,b,c); ! setPosition(a,b,c); ! sourcebase.getVelocity(a,b,c); ! setVelocity(a,b,c); ! setPitch(sourcebase.getPitch()); ! sourcebase.getDirection(a,b,c); ! setDirection(a,b,c); ! sourcebase.getSoundCone(a,b,c); ! setSoundCone(a,b,c); ! sourcebase.getMinMaxGain(a,b); ! setMinMaxGain(a,b); ! setReferenceDistance(sourcebase.getReferenceDistance()); ! setRolloffFactor(sourcebase.getRolloffFactor()); ! setMaxDistance(sourcebase.getMaxDistance()); ! setLooping(sourcebase.isLooping()); ! setGain(sourcebase.getGain());*/ ! } ! ! SourceBase &SourceBase::operator=(const SourceBase &sourcebase) { ! if(this==&sourcebase) ! return *this; ! ! float a,b,c; ! sourcebase.getPosition(a,b,c); ! setPosition(a,b,c); ! sourcebase.getVelocity(a,b,c); ! setVelocity(a,b,c); ! setPitch(sourcebase.getPitch()); ! sourcebase.getDirection(a,b,c); ! setDirection(a,b,c); ! sourcebase.getSoundCone(a,b,c); ! setSoundCone(a,b,c); ! sourcebase.getMinMaxGain(a,b); ! setMinMaxGain(a,b); ! setReferenceDistance(sourcebase.getReferenceDistance()); ! setRolloffFactor(sourcebase.getRolloffFactor()); ! setMaxDistance(sourcebase.getMaxDistance()); ! setLooping(sourcebase.isLooping()); ! setGain(sourcebase.getGain()); ! ! return *this; ! } ! ! void SourceBase::play() { ! alSourcePlayv(nlinkedsources_,linkedsources_); ! ! if (alGetError() != AL_NO_ERROR) ! { ! std::cerr << "SourceBase::play() - Warning - Error playing sources\n"; ! } ! } ! ! void SourceBase::pause() ! { ! if (getState() != Playing) return; // only pause when playing ! ! alSourcePausev(nlinkedsources_,linkedsources_); ! ! if (alGetError() != AL_NO_ERROR) ! { ! std::cerr << "SourceBase::pause() - Warning - Error pausing sources\n"; ! } ! } ! ! void SourceBase::stop() { ! ! SourceState state = getState(); ! ! if (state == Stopped) return; // already stopped ! ! alSourceStopv(nlinkedsources_,linkedsources_); ! ! if (alGetError() != AL_FALSE) ! { ! std::cerr << "SourceBase::stop() - Warning - Error stopping sources\n"; ! } ! } ! ! void SourceBase::rewind() { ! alSourceRewindv(nlinkedsources_,linkedsources_); ! } ! ! SourceState SourceBase::getState() const { ! ALint state; ! alGetSourceiv(sourcename_,AL_SOURCE_STATE,&state); ! ! if (ALenum errorCode = alGetError() != AL_FALSE) ! { ! /** error occurs here when switching files ! fprintf(stderr, "SourceBase::getState() - Warning - Error getting state (%d)\n", ! errorCode); ! */ ! } ! ! ! switch(state) { ! case(AL_INITIAL): ! return Initial; ! case(AL_PLAYING): ! return Playing; ! case(AL_PAUSED): ! return Paused; ! case(AL_STOPPED): ! return Stopped; ! default: ! throw FatalError("AL_SOURCE_STATE is unknown"); ! } ! } ! ! void SourceBase::setLooping(bool loop) { ! if(loop && !streaming_) ! alSourcei(sourcename_,AL_LOOPING,AL_TRUE); ! else ! alSourcei(sourcename_,AL_LOOPING,AL_FALSE); ! } ! ! bool SourceBase::isLooping() const { ! ALint looping; ! alGetSourceiv(sourcename_,AL_LOOPING,&looping); ! return (looping==AL_TRUE); ! } ! ! bool SourceBase::isPaused() const ! { ! return (getState() == Paused); ! } ! ! void SourceBase::setDirection(float directionx, float directiony, float directionz) { ! alSource3f(sourcename_,AL_DIRECTION,directionx,directiony,directionz); ! } ! ! void SourceBase::getDirection(float &directionx, float &directiony, float &directionz) const { ! ALfloat direction[3]; ! alGetSourcefv(sourcename_,AL_DIRECTION,direction); ! directionx=direction[0]; ! directiony=direction[1]; ! directionz=direction[2]; ! } ! ! void SourceBase::makeOmniDirectional() { ! alSource3f(sourcename_,AL_DIRECTION,0.0,0.0,0.0); ! } ! ! void SourceBase::setSoundCone(float innerangle, float outerangle, float outergain) { ! alSourcef(sourcename_,AL_CONE_INNER_ANGLE,innerangle); ! alSourcef(sourcename_,AL_CONE_OUTER_ANGLE,outerangle); ! alSourcef(sourcename_,AL_CONE_OUTER_GAIN,outergain); ! } ! ! void SourceBase::getSoundCone(float &innerangle, float &outerangle, float &outergain) const { ! alGetSourcefv(sourcename_,AL_CONE_INNER_ANGLE,&innerangle); ! alGetSourcefv(sourcename_,AL_CONE_OUTER_ANGLE,&outerangle); ! alGetSourcefv(sourcename_,AL_CONE_OUTER_GAIN,&outergain); ! } ! ! void SourceBase::setGain(float gain) { ! alSourcef(sourcename_,AL_GAIN,gain); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for gain"); ! break; ! default: ! throw FatalError("Error trying to set gain!"); ! } ! } ! ! float SourceBase::getGain() const { ! ALfloat gain; ! alGetSourcefv(sourcename_,AL_GAIN,&gain); ! return gain; ! } ! ! void SourceBase::setMinMaxGain(float min, float max) { ! alSourcef(sourcename_,AL_MIN_GAIN,min); ! alSourcef(sourcename_,AL_MAX_GAIN,max); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for min/max gain"); ! break; ! default: ! throw FatalError("Error trying to set min/max gain!"); ! } ! } ! ! void SourceBase::getMinMaxGain(float & min, float &max) const { ! alGetSourcefv(sourcename_,AL_MIN_GAIN,&min); ! alGetSourcefv(sourcename_,AL_MAX_GAIN,&max); ! } ! ! void SourceBase::setAmbient(bool ambient) { ! if(ambient) { ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); ! alSourcef(sourcename_,AL_ROLLOFF_FACTOR,0.0); ! // TODO: if AL_ROLLOFF_FACTOR doesn't work; set ! // AL_MAX_GAIN=AL_MIN_GAIN=AL_GAIN for this source.. ! makeOmniDirectional(); ! } else { ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_FALSE); ! alSourcef(sourcename_,AL_ROLLOFF_FACTOR,1.0); ! } ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to make/unmake sound ambient!"); ! } ! ! bool SourceBase::isAmbient() const { ! ALint relative; ! alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); ! ALfloat rolloff; ! alGetSourcefv(sourcename_,AL_ROLLOFF_FACTOR,&rolloff); ! return (relative==AL_TRUE && rolloff<0.001); ! } ! ! void SourceBase::setRelative(bool relative) { ! if(relative) ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_TRUE); ! else ! alSourcei(sourcename_,AL_SOURCE_RELATIVE,AL_FALSE); ! } ! ! bool SourceBase::isRelative() const { ! ALint relative; ! alGetSourceiv(sourcename_,AL_SOURCE_RELATIVE,&relative); ! return (relative==AL_TRUE); ! } ! ! void SourceBase::setReferenceDistance(float distance) { ! alSourcef(sourcename_,AL_REFERENCE_DISTANCE,distance); ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to set reference distance!"); ! } ! ! float SourceBase::getReferenceDistance() const { ! ALfloat ref; ! alGetSourcefv(sourcename_,AL_REFERENCE_DISTANCE,&ref); ! return ref; ! } ! ! void SourceBase::setMaxDistance(float distance) { ! alSourcef(sourcename_,AL_MAX_DISTANCE,distance); ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to set max distance!"); ! } ! ! float SourceBase::getMaxDistance() const { ! ALfloat maxdistance; ! alGetSourcefv(sourcename_,AL_MAX_DISTANCE,&maxdistance); ! return maxdistance; ! } ! ! void SourceBase::setRolloffFactor(float factor) { ! alSourcef(sourcename_,AL_ROLLOFF_FACTOR,factor); ! if(alGetError()!=AL_FALSE) ! throw FatalError("Error trying to set rolloff factor!"); ! } ! ! float SourceBase::getRolloffFactor() const { ! ALfloat factor; ! alGetSourcefv(sourcename_,AL_ROLLOFF_FACTOR,&factor); ! return factor; ! } ! ! void SourceBase::setPitch(float pitch) { ! alSourcef(sourcename_,AL_PITCH,pitch); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for pitch"); ! break; ! default: ! throw FatalError("Error trying to set pitch!"); ! } ! } ! ! float SourceBase::getPitch() const { ! ALfloat pitch; ! alGetSourcefv(sourcename_,AL_PITCH,&pitch); ! return pitch; ! } ! ! void SourceBase::setReverbScale(float scale) throw (InitError,ValueError) { ! if(reverbinitiated_) { ! alReverbScale(sourcename_,scale); ! if(alGetError()!=AL_FALSE) ! throw ValueError("Reverb scale must be in range [0.0,1.0]"); ! reverbscale_=scale; ! } else ! throw InitError("Reverb not initialized"); ! } ! ! void SourceBase::setReverbDelay(float delay) throw (InitError,ValueError) { ! if(reverbinitiated_) { ! alReverbDelay(sourcename_,delay); ! if(alGetError()!=AL_FALSE) ! throw ValueError("Reverb delay must be in range [0.0,2.0]"); ! reverbdelay_=delay; ! } else ! throw InitError("Reverb not initialized"); ! } ! ! float SourceBase::getReverbScale() throw (InitError) { ! if(!reverbinitiated_) ! throw InitError("Reverb not initialized"); ! return reverbscale_; ! } ! ! float SourceBase::getReverbDelay() throw (InitError) { ! if(!reverbinitiated_) ! throw InitError("Reverb not initialized"); ! return reverbdelay_; ! } ! ! ALuint SourceBase::link(const SourceBase *source) throw (MemoryError) { ! if(nlinkedsources_>=alloclinkedsources_) { ! alloclinkedsources_+=5; ! linkedsources_=(ALuint *)realloc(linkedsources_, ! sizeof(ALuint)*alloclinkedsources_); ! if(!linkedsources_) ! throw MemoryError("realloc failed"); ! } ! linkedsources_[nlinkedsources_++]=source->getAlSource(); ! return source->getAlSource(); ! } ! ! void SourceBase::unlink(const SourceBase *source) throw (NameError) { ! if(source->sourcename_==sourcename_) ! throw(NameError("Can't unlink a source from itself!")); ! for(unsigned int i=0;i<nlinkedsources_;i++) ! if(linkedsources_[i]==source->sourcename_) { ! linkedsources_[i]=linkedsources_[--nlinkedsources_]; ! return; ! } ! throw NameError("Source not linked"); ! } ! ! void SourceBase::unlink(const ALuint name) throw (NameError) { ! if(name==sourcename_) ! throw(NameError("Can't unlink a source from itself!")); ! for(unsigned int i=0;i<nlinkedsources_;i++) ! if(linkedsources_[i]==name) { ! linkedsources_[i]=linkedsources_[--nlinkedsources_]; ! return; ! } ! throw NameError("Source not linked"); ! } ! ! void SourceBase::unlinkAll() { ! nlinkedsources_=1; ! } ! ! ALuint SourceBase::getAlSource() const { ! return sourcename_; ! } ! ! void SourceBase::setPosition(float x, float y, float z) { ! alSource3f(sourcename_,AL_POSITION,x,y,z); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for position"); ! break; ! default: ! throw FatalError("Error trying to set position!"); ! } ! } ! ! void SourceBase::getPosition(float &x, float &y, float &z) const { ! ALfloat position[3]; ! alGetSourcefv(sourcename_,AL_POSITION,position); ! x=position[0]; ! y=position[1]; ! z=position[2]; ! } ! ! void SourceBase::setVelocity(float vx, float vy, float vz) { ! alSource3f(sourcename_,AL_VELOCITY,vx,vy,vz); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for velocity"); ! break; ! default: ! throw FatalError("Error trying to set velocity!"); ! } ! } ! ! void SourceBase::getVelocity(float &vx, float &vy, float &vz) const { ! ALfloat velocity[3]; ! alGetSourcefv(sourcename_,AL_VELOCITY,velocity); ! vx=velocity[0]; ! vy=velocity[1]; ! vz=velocity[2]; ! } ! Index: netstream.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/netstream.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** netstream.cpp 11 Nov 2004 07:57:58 -0000 1.8 --- netstream.cpp 24 Mar 2005 11:47:48 -0000 1.9 *************** *** 1,82 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * CommonC++ (http://cplusplus.sourceforge.net/) ! * ! * 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 "openalpp/netupdater.h" ! #include "openalpp/netstream.h" ! #include "openalpp/sample.h" ! ! namespace openalpp { ! ! NetStream::NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket) ! : Stream() { ! unsigned int frequency=11025,buffersize=2048; ! ALenum format=AL_FORMAT_MONO8; ! if(controlsocket) { ! *controlsocket >> format; ! *controlsocket >> frequency; ! *controlsocket >> buffersize; ! } ! updater_=new NetUpdater(socket,controlsocket, ! buffername_,buffer2_->GetName(), ! format,frequency,buffersize*SampleSize(format)); ! } ! ! NetStream::NetStream(ost::UDPSocket *socket,SampleFormat format, ! unsigned int frequency,unsigned int buffersize) ! : Stream() { ! ALenum alformat=0; ! switch(format) { ! case(Mono8): ! alformat=AL_FORMAT_MONO8; ! break; ! case(Mono16): ! alformat=AL_FORMAT_MONO16; ! break; ! case(Stereo8): ! alformat=AL_FORMAT_STEREO8; ! break; ! case(Stereo16): ! alformat=AL_FORMAT_STEREO16; ! break; ! } ! updater_=new NetUpdater(socket,NULL,buffername_,buffer2_->GetName(), ! alformat,frequency,buffersize*SampleSize(format)); ! } ! ! ! NetStream::NetStream(const NetStream &stream) : Stream((const Stream &)stream){ ! } ! ! NetStream::~NetStream() { ! } ! ! NetStream &NetStream::operator=(const NetStream &stream) { ! if(&stream!=this) { ! Stream::operator=((const Stream &)stream); ! } ! return *this; ! } ! ! } ! --- 1,82 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * CommonC++ (http://cplusplus.sourceforge.net/) ! * ! * 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 "openalpp/netupdater.h" ! #include "openalpp/netstream.h" ! #include "openalpp/sample.h" ! ! namespace openalpp { ! ! NetStream::NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket) ! : Stream() { ! unsigned int frequency=11025,buffersize=2048; ! ALenum format=AL_FORMAT_MONO8; ! if(controlsocket) { ! *controlsocket >> format; ! *controlsocket >> frequency; ! *controlsocket >> buffersize; ! } ! updater_=new NetUpdater(socket,controlsocket, ! buffername_,buffer2_->GetName(), ! format,frequency,buffersize*SampleSize(format)); ! } ! ! NetStream::NetStream(ost::UDPSocket *socket,SampleFormat format, ! unsigned int frequency,unsigned int buffersize) ! : Stream() { ! ALenum alformat=0; ! switch(format) { ! case(Mono8): ! alformat=AL_FORMAT_MONO8; ! break; ! case(Mono16): ! alformat=AL_FORMAT_MONO16; ! break; ! case(Stereo8): ! alformat=AL_FORMAT_STEREO8; ! break; ! case(Stereo16): ! alformat=AL_FORMAT_STEREO16; ! break; ! } ! updater_=new NetUpdater(socket,NULL,buffername_,buffer2_->GetName(), ! alformat,frequency,buffersize*SampleSize(format)); ! } ! ! ! NetStream::NetStream(const NetStream &stream) : Stream((const Stream &)stream){ ! } ! ! NetStream::~NetStream() { ! } ! ! NetStream &NetStream::operator=(const NetStream &stream) { ! if(&stream!=this) { ! Stream::operator=((const Stream &)stream); ! } ! return *this; ! } ! ! } ! Index: error.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/error.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** error.cpp 11 Nov 2004 07:57:58 -0000 1.6 --- error.cpp 24 Mar 2005 11:47:48 -0000 1.7 *************** *** 1,36 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/error.h" ! ! using namespace openalpp; ! ! //##ModelId=3BDD35A001D5 ! std::ostream &openalpp::Error::put(std::ostream &stream) const { ! return (stream << what()); ! } ! ! std::ostream &openalpp::operator<<(std::ostream &stream,const Error &error) { ! return error.put(stream); ! } ! --- 1,36 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/error.h" ! ! using namespace openalpp; ! ! //##ModelId=3BDD35A001D5 ! std::ostream &openalpp::Error::put(std::ostream &stream) const { ! return (stream << what()); ! } ! ! std::ostream &openalpp::operator<<(std::ostream &stream,const Error &error) { ! return error.put(stream); ! } ! Index: audioenvironment.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/audioenvironment.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** audioenvironment.cpp 11 Nov 2004 07:57:58 -0000 1.8 --- audioenvironment.cpp 24 Mar 2005 11:47:48 -0000 1.9 *************** *** 1,158 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/audioenvironment.h" ! ! using namespace openalpp; ! ! AudioEnvironment::AudioEnvironment() throw (InitError): AudioBase() { ! } ! ! AudioEnvironment::AudioEnvironment(int frequency,int refresh,bool synchronous) ! throw (InitError) ! : AudioBase(frequency,refresh,synchronous) { ! } ! ! AudioEnvironment::AudioEnvironment(int frequency,int refresh) throw (InitError) ! : AudioBase(frequency,refresh) { ! } ! ! void AudioEnvironment::setSoundVelocity(float speed) throw(ValueError,FatalError){ ! alDopplerVelocity(speed); ! ALenum error; ! if((error=alGetError())!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError((const char *)alGetString(error)); ! break; ! default: ! throw FatalError("Unknown error in AudioEnvironment::SetSoundSpeed()"); ! break; ! } ! } ! ! float AudioEnvironment::getSoundVelocity() throw (FatalError) { ! ALfloat speed; ! alGetFloatv(AL_DOPPLER_VELOCITY,&speed); ! if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnviroment::GetSoundVelocity()"); ! return speed; ! } ! ! void AudioEnvironment::setDopplerFactor(float factor) ! throw (ValueError,FatalError) { ! alDopplerFactor(factor); ! ALenum error; ! if((error=alGetError())!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError((const char *)alGetString(error)); ! break; ! default: ! throw FatalError("Unknown error in AudioEnvironment::SetDopplerFactor()"); ! break; ! } ! } ! ! float AudioEnvironment::getDopplerFactor() throw (FatalError) { ! ALfloat(factor); ! alGetFloatv(AL_DOPPLER_FACTOR,&factor); ! if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnvironment::GetDopplerFactor()"); ! return factor; ! } ! ! void AudioEnvironment::setGain(float gain) { ! alListenerf(AL_GAIN,gain); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for gain"); ! break; ! default: ! throw FatalError("Error trying to set gain!"); ! } ! } ! ! float AudioEnvironment::getGain() throw (FatalError) { ! ALfloat gain; ! alGetListenerf(AL_GAIN,&gain); ! if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnvironment::GetGain()"); ! return gain; ! } ! ! void AudioEnvironment::setDistanceModel(DistanceModel model) ! throw (FatalError){ ! switch(model) { ! case(None): ! alDistanceModel(AL_NONE); ! break; ! case(InverseDistance): ! alDistanceModel(AL_INVERSE_DISTANCE); ! break; ! case(InverseDistanceClamped): ! alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); ! break; ! default: ! throw FatalError("Unknown model in AudioEnvironment::SetDistanceModel()"); ! } ! if(alGetError()!=AL_FALSE) ! throw FatalError("alDistanceModel failed in AudioEnvironment::SetDistanceModel()"); ! } ! ! DistanceModel AudioEnvironment::getDistanceModel() throw (FatalError) { ! int almodel; ! alGetIntegerv(AL_DISTANCE_MODEL,&almodel); ! switch(almodel) { ! case(AL_NONE): ! return None; ! case(AL_INVERSE_DISTANCE): ! return InverseDistance; ! case(AL_INVERSE_DISTANCE_CLAMPED): ! return InverseDistanceClamped; ! default: ! throw FatalError("Unknown distance model in AudioEnvironment::GetDistanceModel"); ! } ! } ! ! // Static fields in AudioBase ! bool AudioBase::reverbinitiated_; ! void (*AudioBase::alReverbScale)(ALuint sid, ALfloat param); ! void (*AudioBase::alReverbDelay)(ALuint sid, ALfloat param); ! ! void AudioEnvironment::initiateReverb() throw (InitError) { ! if (reverbinitiated_) ! return; ! ! alReverbScale=(void (*)(ALuint sid, ALfloat param)) ! alGetProcAddress((ALubyte *)"alReverbScale_LOKI"); ! alReverbDelay=(void (*)(ALuint sid, ALfloat param)) ! alGetProcAddress((ALubyte *)"alReverbDelay_LOKI"); ! if(!(alReverbScale && alReverbDelay)) { ! throw InitError("Couldn't initiate reverb"); ! } else ! reverbinitiated_=true; ! } ! --- 1,158 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/audioenvironment.h" ! ! using namespace openalpp; ! ! AudioEnvironment::AudioEnvironment() throw (InitError): AudioBase() { ! } ! ! AudioEnvironment::AudioEnvironment(int frequency,int refresh,bool synchronous) ! throw (InitError) ! : AudioBase(frequency,refresh,synchronous) { ! } ! ! AudioEnvironment::AudioEnvironment(int frequency,int refresh) throw (InitError) ! : AudioBase(frequency,refresh) { ! } ! ! void AudioEnvironment::setSoundVelocity(float speed) throw(ValueError,FatalError){ ! alDopplerVelocity(speed); ! ALenum error; ! if((error=alGetError())!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError((const char *)alGetString(error)); ! break; ! default: ! throw FatalError("Unknown error in AudioEnvironment::SetSoundSpeed()"); ! break; ! } ! } ! ! float AudioEnvironment::getSoundVelocity() throw (FatalError) { ! ALfloat speed; ! alGetFloatv(AL_DOPPLER_VELOCITY,&speed); ! if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnviroment::GetSoundVelocity()"); ! return speed; ! } ! ! void AudioEnvironment::setDopplerFactor(float factor) ! throw (ValueError,FatalError) { ! alDopplerFactor(factor); ! ALenum error; ! if((error=alGetError())!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError((const char *)alGetString(error)); ! break; ! default: ! throw FatalError("Unknown error in AudioEnvironment::SetDopplerFactor()"); ! break; ! } ! } ! ! float AudioEnvironment::getDopplerFactor() throw (FatalError) { ! ALfloat(factor); ! alGetFloatv(AL_DOPPLER_FACTOR,&factor); ! if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnvironment::GetDopplerFactor()"); ! return factor; ! } ! ! void AudioEnvironment::setGain(float gain) { ! alListenerf(AL_GAIN,gain); ! ALenum error=alGetError(); ! if(error!=AL_FALSE) ! switch(error) { ! case(AL_INVALID_VALUE): ! throw ValueError("Invalid value for gain"); ! break; ! default: ! throw FatalError("Error trying to set gain!"); ! } ! } ! ! float AudioEnvironment::getGain() throw (FatalError) { ! ALfloat gain; ! alGetListenerf(AL_GAIN,&gain); ! if(alGetError()!=AL_FALSE) // This isn't strictly necessary... ! throw FatalError("Unknown error in AudioEnvironment::GetGain()"); ! return gain; ! } ! ! void AudioEnvironment::setDistanceModel(DistanceModel model) ! throw (FatalError){ ! switch(model) { ! case(None): ! alDistanceModel(AL_NONE); ! break; ! case(InverseDistance): ! alDistanceModel(AL_INVERSE_DISTANCE); ! break; ! case(InverseDistanceClamped): ! alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); ! break; ! default: ! throw FatalError("Unknown model in AudioEnvironment::SetDistanceModel()"); ! } ! if(alGetError()!=AL_FALSE) ! throw FatalError("alDistanceModel failed in AudioEnvironment::SetDistanceModel()"); ! } ! ! DistanceModel AudioEnvironment::getDistanceModel() throw (FatalError) { ! int almodel; ! alGetIntegerv(AL_DISTANCE_MODEL,&almodel); ! switch(almodel) { ! case(AL_NONE): ! return None; ! case(AL_INVERSE_DISTANCE): ! return InverseDistance; ! case(AL_INVERSE_DISTANCE_CLAMPED): ! return InverseDistanceClamped; ! default: ! throw FatalError("Unknown distance model in AudioEnvironment::GetDistanceModel"); ! } ! } ! ! // Static fields in AudioBase ! bool AudioBase::reverbinitiated_; ! void (*AudioBase::alReverbScale)(ALuint sid, ALfloat param); ! void (*AudioBase::alReverbDelay)(ALuint sid, ALfloat param); ! ! void AudioEnvironment::initiateReverb() throw (InitError) { ! if (reverbinitiated_) ! return; ! ! alReverbScale=(void (*)(ALuint sid, ALfloat param)) ! alGetProcAddress((ALubyte *)"alReverbScale_LOKI"); ! alReverbDelay=(void (*)(ALuint sid, ALfloat param)) ! alGetProcAddress((ALubyte *)"alReverbDelay_LOKI"); ! if(!(alReverbScale && alReverbDelay)) { ! throw InitError("Couldn't initiate reverb"); ! } else ! reverbinitiated_=true; ! } ! Index: CMakeLists.txt =================================================================== RCS file: /cvsroot/alpp/openalpp/src/CMakeLists.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CMakeLists.txt 11 Nov 2004 07:57:58 -0000 1.3 --- CMakeLists.txt 24 Mar 2005 11:47:48 -0000 1.4 *************** *** 1,19 **** ! SET(SOURCEFILES audiobase audioconvert audioenvironment error groupsource listener sample sounddata source sourcebase referenced) ! ! IF(CCGNU_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} stream netstream streamupdater netupdater) ! IF(PORTAUDIO_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} inputdevice deviceupdater) ! ELSE(PORTAUDIO_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} noinputdevice) ! ENDIF(PORTAUDIO_FOUND) ! IF(VORBIS_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} filestream filestreamupdater) ! ELSE(VORBIS_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} nofilestream) ! ENDIF(VORBIS_FOUND) ! ELSE(CCGNU_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} nostreaming noinputdevice nofilestream) ! ENDIF(CCGNU_FOUND) ! ! ADD_LIBRARY(openalpp SOURCEFILES) --- 1,19 ---- ! SET(SOURCEFILES audiobase audioconvert audioenvironment error groupsource listener sample sounddata source sourcebase referenced) ! ! IF(CCGNU_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} stream netstream streamupdater netupdater) ! IF(PORTAUDIO_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} inputdevice deviceupdater) ! ELSE(PORTAUDIO_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} noinputdevice) ! ENDIF(PORTAUDIO_FOUND) ! IF(VORBIS_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} filestream filestreamupdater) ! ELSE(VORBIS_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} nofilestream) ! ENDIF(VORBIS_FOUND) ! ELSE(CCGNU_FOUND) ! SET(SOURCEFILES ${SOURCEFILES} nostreaming noinputdevice nofilestream) ! ENDIF(CCGNU_FOUND) ! ! ADD_LIBRARY(openalpp SOURCEFILES) Index: listener.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/listener.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** listener.cpp 11 Nov 2004 07:57:58 -0000 1.5 --- listener.cpp 24 Mar 2005 11:47:48 -0000 1.6 *************** *** 1,145 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/listener.h" ! ! using namespace openalpp; ! ! Listener *Listener::selectedlistener_=NULL; ! ! /** ! * Internal function for initialisation. ! */ ! void Listener::init(float x,float y,float z, ! float vx,float vy,float vz, ! float directionx, float directiony, float directionz, ! float upx, float upy, float upz) { ! setPosition(x,y,z); ! setVelocity(vx,vy,vz); ! setOrientation(directionx,directiony,directionz, ! upx,upy,upz); ! if(!selectedlistener_) ! select(); ! } ! ! Listener::Listener() : PositionedObject() { ! init(0,0,0, 0,0,0, 0,0,-1, 0,1,0); ! } ! ! Listener::Listener(const Listener &listener) : PositionedObject() { ! listener.getPosition(position_[0],position_[1],position_[2]); ! listener.getVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.getOrientation(orientation_[0],orientation_[1],orientation_[2], ! orientation_[3],orientation_[4],orientation_[5]); ! } ! ! Listener::Listener(float x,float y,float z, ! float directionx, float directiony, float directionz, ! float upx, float upy, float upz) : PositionedObject() { ! ! init(x,y,z, 0,0,0, directionx,directiony,directionz, upx,upy,upz); ! ! } ! ! Listener::Listener(float x, float y, float z) : PositionedObject() { ! init(x,y,z, 0,0,0, 0,0,-1, 0,1,0); ! } ! ! Listener::~Listener() { ! if(selectedlistener_==this) ! selectedlistener_=NULL; ! } ! ! void Listener::select() { ! alListenerfv(AL_POSITION,position_); ! alListenerfv(AL_VELOCITY,velocity_); ! alListenerfv(AL_ORIENTATION,orientation_); ! selectedlistener_=this; ! } ! ! bool Listener::isSelected() { ! return (selectedlistener_==this); ! } ! ! void Listener::setOrientation(float directionx,float directiony, ! float directionz, ! float upx, float upy, float upz) { ! orientation_[0]=directionx; ! orientation_[1]=directiony; ! orientation_[2]=directionz; ! orientation_[3]=upx; ! orientation_[4]=upy; ! orientation_[5]=upz; ! if(isSelected()) ! alListenerfv(AL_ORIENTATION,orientation_); ! } ! ! void Listener::getOrientation(float &directionx,float &directiony, ! float &directionz, ! float &upx, float &upy, float &upz) const { ! directionx=orientation_[0]; ! directiony=orientation_[1]; ! directionz=orientation_[2]; ! upx=orientation_[3]; ! upy=orientation_[4]; ! upz=orientation_[5]; ! } ! ! Listener &Listener::operator=(const Listener &listener) { ! if(this!=&listener) { ! listener.getPosition(position_[0],position_[1],position_[2]); ! listener.getVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.getOrientation(orientation_[0],orientation_[1],orientation_[2], ! orientation_[3],orientation_[4],orientation_[5]); ! } ! return *this; ! } ! ! void Listener::setPosition(float x, float y, float z) { ! position_[0]=x; ! position_[1]=y; ! position_[2]=z; ! if(isSelected()) ! alListenerfv(AL_POSITION,position_); ! } ! ! void Listener::getPosition(float &x, float &y, float &z) const { ! x=position_[0]; ! y=position_[1]; ! z=position_[2]; ! } ! ! void Listener::setVelocity(float vx, float vy, float vz) { ! velocity_[0]=vx; ! velocity_[1]=vy; ! velocity_[2]=vz; ! if(isSelected()) ! alListenerfv(AL_VELOCITY,velocity_); ! } ! ! void Listener::getVelocity(float &vx, float &vy, float &vz) const { ! vx=velocity_[0]; ! vy=velocity_[1]; ! vz=velocity_[2]; ! } ! --- 1,145 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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 "openalpp/listener.h" ! ! using namespace openalpp; ! ! Listener *Listener::selectedlistener_=NULL; ! ! /** ! * Internal function for initialisation. ! */ ! void Listener::init(float x,float y,float z, ! float vx,float vy,float vz, ! float directionx, float directiony, float directionz, ! float upx, float upy, float upz) { ! setPosition(x,y,z); ! setVelocity(vx,vy,vz); ! setOrientation(directionx,directiony,directionz, ! upx,upy,upz); ! if(!selectedlistener_) ! select(); ! } ! ! Listener::Listener() : PositionedObject() { ! init(0,0,0, 0,0,0, 0,0,-1, 0,1,0); ! } ! ! Listener::Listener(const Listener &listener) : PositionedObject() { ! listener.getPosition(position_[0],position_[1],position_[2]); ! listener.getVelocity(velocity_[0],velocity_[1],velocity_[2]); ! listener.getOrientation(orientation_[0],orientation_[1],orientation_[2], ! orientation_[3],orientation_[4],orientation_[5]); ! } ! ! Listener::Listener(float x,float y,float z, ! float directionx, float directiony, float directionz, ! float upx, float upy, float upz) : PositionedObject() { ! ! init(x,y,z, 0,0,0, directionx,directiony,directionz, upx,upy,upz); ! ! } ! ! Listener::Listener(float x, float y, float z) : PositionedObject() { ! init(x,y,z, 0,0,0, 0,0,-1, 0,1,0); ... [truncated message content] |
Update of /cvsroot/alpp/openalpp/include/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14023/include/openalpp Modified Files: Makefile.am alpp.h audiobase.h audioconvert.h audioenvironment.h config.h deviceupdater.h error.h export.h filestream.h filestreamupdater.h groupsource.h inputdevice.h listener.h netstream.h netupdater.h positionedobject.h ref_ptr.h referenced.h sample.h sounddata.h source.h sourcebase.h stream.h streamupdater.h windowsstuff.h Log Message: Ogg streaming revised by Dewitt Colclough [de...@tw...]. Index: source.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/source.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** source.h 11 Nov 2004 07:57:57 -0000 1.5 --- source.h 24 Mar 2005 11:47:48 -0000 1.6 *************** *** 1,169 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef SOURCE_H_INCLUDED_C419B739 ! #define SOURCE_H_INCLUDED_C419B739 ! ! #include "openalpp/export.h" ! #include "openalpp/stream.h" ! #include "openalpp/sourcebase.h" ! #include "openalpp/sample.h" ! ! namespace openalpp { ! ! /** ! * Class for "normal" sources. ! * This is used for standard OpenAL sources, whether streaming or not. ! */ ! class OPENALPP_API Source : public SourceBase { ! public: ! /** ! * Constructor. ! * Creates the source with the specified position. ! * @param x x coordinate. ! * @param y y coordinate. ! * @param z z coordinate. ! */ ! Source(float x = 0.0, float y = 0.0, float z = 0.0); ! ! /** ! * Constructor. ! * Creates the source and a buffer with the specified file. ! * @param filename is the name of the file. ! */ ! Source(const std::string& filename,float x=0.0,float y=0.0,float z=0.0); ! ! /** ! * Constructor. ! * Creates the source with the specified buffer. ! * @param buffer is the buffer to use. ! */ ! Source(const Sample &buffer,float x=0.0,float y=0.0,float z=0.0); ! ! /** ! * Constructor. ! * Creates the source with the specified stream. ! * @param stream is the stream to use. ! */ ! Source(const Stream &stream,float x=0.0,float y=0.0,float z=0.0); ! ! /** ! * Copy constructor. ! */ ! Source(const Source &source); ! ! ! /** ! * Create a buffer for the source and load a file into it. ! * The source should _not_ be playing when doing this. ! * @param filename is the name of the file. ! */ ! void setSound(const std::string& filename); ! ! /** ! * Sets a new buffer for the source. ! * The source should _not_ be playing when doing this. ! * @param buffer is the new buffer. ! */ ! void setSound(const Sample *buffer); ! ! /** ! * Sets a new (streamed) buffer for the source. ! * The source should _not_ be playing when doing this. ! * @param stream is the new buffer. ! */ ! void setSound(const Stream *stream); ! ! /** ! * Gets the buffer associated with the source. ! * @return the buffer. ! */ ! const SoundData *getSound() const; ! ! /** ! * Play a file on the source. ! * This will change the source's buffer. ! * @param filename is the name of the file to play. ! */ ! void play(const std::string& filename); ! ! /** ! * Play a buffer on the source. ! * This will change the source's buffer. ! * @param buffer is the buffer to play. ! */ ! void play(const Sample *buffer); ! ! /** ! * Play a stream on the source. ! * This will change the source's buffer. ! * @param stream is the stream to play. ! */ ! void play(const Stream *stream); ! ! /** ! * Play this source. ! * This is only here, because the above Play(...) hides SourceBase::Play() ! */ ! void play(); ! ! /** ! * Stop this source. ! * This is needed here for streaming sources... ! */ ! void stop(); ! ! /** ! * Pause this source. ! * This is needed here for streaming sources... ! */ ! void pause(); ! ! ! /** ! * Check if the source is streaming. ! * @return true if the source is streaming, false otherwise. ! */ ! bool isStreaming(); ! ! /** ! * Assignment operator. ! */ ! Source &operator=(const Source &source); ! ! protected: ! /** ! * Destructor. ! */ ! virtual ~Source(); ! ! private: ! /** ! * Pointer to the SoundData (buffer) associated with this source. ! */ ! openalpp::ref_ptr<SoundData> sounddata_; ! }; ! ! } ! ! #endif /* SOURCE_H_INCLUDED_C419B739 */ --- 1,177 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef SOURCE_H_INCLUDED_C419B739 ! #define SOURCE_H_INCLUDED_C419B739 ! ! #include "openalpp/export.h" ! #include "openalpp/stream.h" ! #include "openalpp/sourcebase.h" ! #include "openalpp/sample.h" ! ! namespace openalpp { ! ! /** ! * Class for "normal" sources. ! * This is used for standard OpenAL sources, whether streaming or not. ! */ ! class OPENALPP_API Source : public SourceBase { ! public: ! /** ! * Constructor. ! * Creates the source with the specified position. ! * @param x x coordinate. ! * @param y y coordinate. ! * @param z z coordinate. ! */ ! Source(float x = 0.0, float y = 0.0, float z = 0.0); ! ! /** ! * Constructor. ! * Creates the source and a buffer with the specified file. ! * @param filename is the name of the file. ! */ ! Source(const std::string& filename,float x=0.0,float y=0.0,float z=0.0); ! ! /** ! * Constructor. ! * Creates the source with the specified buffer. ! * @param buffer is the buffer to use. ! */ ! Source(const Sample &buffer,float x=0.0,float y=0.0,float z=0.0); ! ! /** ! * Constructor. ! * Creates the source with the specified stream. ! * @param stream is the stream to use. ! */ ! Source(const Stream &stream,float x=0.0,float y=0.0,float z=0.0); ! ! /** ! * Copy constructor. ! */ ! Source(const Source &source); ! ! ! /** ! * Create a buffer for the source and load a file into it. ! * The source should _not_ be playing when doing this. ! * @param filename is the name of the file. ! */ ! void setSound(const std::string& filename); ! ! /** ! * Sets a new buffer for the source. ! * The source should _not_ be playing when doing this. ! * @param buffer is the new buffer. ! */ ! void setSound(const Sample *buffer); ! ! /** ! * Sets a new (streamed) buffer for the source. ! * The source should _not_ be playing when doing this. ! * @param stream is the new buffer. ! */ ! void setSound(Stream *stream); ! ! void setSound(const Stream *stream); ! ! /** ! * Gets the buffer associated with the source. ! * @return the buffer. ! */ ! const SoundData *getSound() const; ! ! /** ! * Play a file on the source. ! * This will change the source's buffer. ! * @param filename is the name of the file to play. ! */ ! void play(const std::string& filename); ! ! /** ! * Play a buffer on the source. ! * This will change the source's buffer. ! * @param buffer is the buffer to play. ! */ ! void play(const Sample *buffer); ! ! /** ! * Play a stream on the source. ! * This will change the source's buffer. ! * @param stream is the stream to play. ! */ ! void play(const Stream *stream); ! ! /** ! * Play this source. ! * This is only here, because the above Play(...) hides SourceBase::Play() ! */ ! void play(); ! ! /** ! * Stop this source. ! * This is needed here for streaming sources... ! */ ! void stop(); ! ! /** ! * Pause this source. ! * This is needed here for streaming sources... ! */ ! void pause(); ! ! ! /** ! * Seek this source to specified time ! * (streaming sources) ! */ ! void seek(float time_s); ! ! /** ! * Check if the source is streaming. ! * @return true if the source is streaming, false otherwise. ! */ ! bool isStreaming(); ! ! /** ! * Assignment operator. ! */ ! Source &operator=(const Source &source); ! ! protected: ! /** ! * Destructor. ! */ ! virtual ~Source(); ! ! private: ! /** ! * Pointer to the SoundData (buffer) associated with this source. ! */ ! openalpp::ref_ptr<SoundData> sounddata_; ! }; ! ! } ! ! #endif /* SOURCE_H_INCLUDED_C419B739 */ Index: audioconvert.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/audioconvert.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** audioconvert.h 11 Nov 2004 07:57:57 -0000 1.4 --- audioconvert.h 24 Mar 2005 11:47:48 -0000 1.5 *************** *** 1,164 **** ! /** ! * Parts of this file are copied from OpenAL source code. ! * Copyright (C) Loki Games, licensed under the LGPL. ! * ! * This code has since been (more or less) modified to be a part of: ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef AUDIOCONVERT_H_INCLUDED ! #define AUDIOCONVERT_H_INCLUDED ! ! #include "openalpp/export.h" ! #include <AL/al.h> ! #include <stdlib.h> ! #include <string.h> ! #include "openalpp/error.h" ! ! namespace openalpp { ! ! /** ! * Class for converting audio. ! */ ! class OPENALPP_API AudioConvert { ! unsigned short channels_,bits_; ! unsigned int frequency_; ! ALenum format_; ! public: ! /** ! * Constructor. ! * @param format is the (OpenAL) format that data will be converted to. ! * @param frequency is the frequency the data will be converted to. ! */ ! AudioConvert(ALenum format,unsigned int frequency); ! ! /** ! * Apply the conversion to data. ! * @param data is the data to convert. ! * @param format is the (OpenAL) format of the data. ! * @param frequency is the frequency of the data. ! * @param size is the size of the data. It will be updated to the new size. ! */ ! void *apply(void *data,ALenum format,unsigned int frequency,unsigned int &size); ! }; ! ! typedef struct _acAudioCVT { ! int needed; /* Set to 1 if conversion possible */ ! ALushort src_format; /* Source audio format */ ! ALushort dst_format; /* Target audio format */ ! double rate_incr; /* Rate conversion increment */ ! void *buf; /* Buffer to hold entire audio data */ ! int len; /* Length of original audio buffer */ ! int len_cvt; /* Length of converted audio buffer */ ! int len_mult; /* buffer must be len*len_mult big */ ! double len_ratio; /* Given len, final size is len*len_ratio */ ! void (*filters[10])(struct _acAudioCVT *cvt, ALushort format); ! int filter_index; /* Current audio conversion function */ ! } acAudioCVT; ! ! /* Audio format flags (defaults to LSB byte order) */ ! #define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ ! #define AUDIO_S8 0x8008 /* Signed 8-bit samples */ ! #define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ ! #define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ ! #define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ ! #define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ ! ! /* Native audio byte ordering */ ! #ifndef WORDS_BIGENDIAN ! #define AUDIO_U16 AUDIO_U16LSB ! #define AUDIO_S16 AUDIO_S16LSB ! #define swap16le(x) (x) ! #define swap32le(x) (x) ! #define swap16be(x) swap16(x) ! #define swap32be(x) swap32(x) ! #else ! #define AUDIO_U16 AUDIO_U16MSB ! #define AUDIO_S16 AUDIO_S16MSB ! #define swap16le(x) swap16(x) ! #define swap32le(x) swap32(x) ! #define swap16be(x) (x) ! #define swap32be(x) (x) ! #endif ! ! #define _al_ALCHANNELS(fmt) ((fmt==AL_FORMAT_MONO16||fmt==AL_FORMAT_MONO8)?1:2) ! ! #define DATA 0x61746164 /* "data" */ ! #define FACT 0x74636166 /* "fact" */ ! #define LIST 0x5453494c /* "LIST" */ ! #define RIFF 0x46464952 ! #define WAVE 0x45564157 ! #define FMT 0x20746D66 ! ! #define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000 ! #define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001 ! #define AL_FORMAT_WAVE_EXT 0x10002 ! ! #define NELEMS(x) ((sizeof x) / (sizeof *x)) ! ! #define PCM_CODE 0x0001 ! #define MS_ADPCM_CODE 0x0002 ! #define IMA_ADPCM_CODE 0x0011 ! ! #define MS_ADPCM_max ((1<<(16-1))-1) ! #define MS_ADPCM_min -(1<<(16-1)) ! ! typedef struct Chunk { ! ALuint magic; ! ALuint length; ! void *data; ! } Chunk; ! ! struct MS_ADPCM_decodestate_FULL { ! ALubyte hPredictor; ! ALushort iDelta; ! ALshort iSamp1; ! ALshort iSamp2; ! }; ! ! typedef struct WaveFMT { ! ALushort encoding; ! ALushort channels; /* 1 = mono, 2 = stereo */ ! ALuint frequency; /* One of 11025, 22050, or 44100 Hz */ ! ALuint byterate; /* Average bytes per second */ ! ALushort blockalign; /* Bytes per sample block */ ! ALushort bitspersample; ! } alWaveFMT_LOKI; ! ! typedef struct IMA_ADPCM_decodestate_s { ! ALint valprev; /* Previous output value */ ! ALbyte index; /* Index into stepsize table */ ! } alIMAADPCM_decodestate_LOKI; ! ! typedef struct IMA_ADPCM_decoder { ! alWaveFMT_LOKI wavefmt; ! ALushort wSamplesPerBlock; ! alIMAADPCM_decodestate_LOKI state[2]; ! } alIMAADPCM_state_LOKI; ! /* ! void *AudioConvert(ALvoid *data, ! ALenum f_format, ALuint f_size, ALuint f_freq, ! ALenum t_format, ALuint t_freq, ALuint *retsize); ! */ ! } ! ! #endif --- 1,164 ---- ! /** ! * Parts of this file are copied from OpenAL source code. ! * Copyright (C) Loki Games, licensed under the LGPL. ! * ! * This code has since been (more or less) modified to be a part of: ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef AUDIOCONVERT_H_INCLUDED ! #define AUDIOCONVERT_H_INCLUDED ! ! #include "openalpp/export.h" ! #include <AL/al.h> ! #include <stdlib.h> ! #include <string.h> ! #include "openalpp/error.h" ! ! namespace openalpp { ! ! /** ! * Class for converting audio. ! */ ! class OPENALPP_API AudioConvert { ! unsigned short channels_,bits_; ! unsigned int frequency_; ! ALenum format_; ! public: ! /** ! * Constructor. ! * @param format is the (OpenAL) format that data will be converted to. ! * @param frequency is the frequency the data will be converted to. ! */ ! AudioConvert(ALenum format,unsigned int frequency); ! ! /** ! * Apply the conversion to data. ! * @param data is the data to convert. ! * @param format is the (OpenAL) format of the data. ! * @param frequency is the frequency of the data. ! * @param size is the size of the data. It will be updated to the new size. ! */ ! void *apply(void *data,ALenum format,unsigned int frequency,unsigned int &size); ! }; ! ! typedef struct _acAudioCVT { ! int needed; /* Set to 1 if conversion possible */ ! ALushort src_format; /* Source audio format */ ! ALushort dst_format; /* Target audio format */ ! double rate_incr; /* Rate conversion increment */ ! void *buf; /* Buffer to hold entire audio data */ ! int len; /* Length of original audio buffer */ ! int len_cvt; /* Length of converted audio buffer */ ! int len_mult; /* buffer must be len*len_mult big */ ! double len_ratio; /* Given len, final size is len*len_ratio */ ! void (*filters[10])(struct _acAudioCVT *cvt, ALushort format); ! int filter_index; /* Current audio conversion function */ ! } acAudioCVT; ! ! /* Audio format flags (defaults to LSB byte order) */ ! #define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ ! #define AUDIO_S8 0x8008 /* Signed 8-bit samples */ ! #define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ ! #define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ ! #define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ ! #define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ ! ! /* Native audio byte ordering */ ! #ifndef WORDS_BIGENDIAN ! #define AUDIO_U16 AUDIO_U16LSB ! #define AUDIO_S16 AUDIO_S16LSB ! #define swap16le(x) (x) ! #define swap32le(x) (x) ! #define swap16be(x) swap16(x) ! #define swap32be(x) swap32(x) ! #else ! #define AUDIO_U16 AUDIO_U16MSB ! #define AUDIO_S16 AUDIO_S16MSB ! #define swap16le(x) swap16(x) ! #define swap32le(x) swap32(x) ! #define swap16be(x) (x) ! #define swap32be(x) (x) ! #endif ! ! #define _al_ALCHANNELS(fmt) ((fmt==AL_FORMAT_MONO16||fmt==AL_FORMAT_MONO8)?1:2) ! ! #define DATA 0x61746164 /* "data" */ ! #define FACT 0x74636166 /* "fact" */ ! #define LIST 0x5453494c /* "LIST" */ ! #define RIFF 0x46464952 ! #define WAVE 0x45564157 ! #define FMT 0x20746D66 ! ! #define AL_FORMAT_IMA_ADPCM_MONO16_EXT 0x10000 ! #define AL_FORMAT_IMA_ADPCM_STEREO16_EXT 0x10001 ! #define AL_FORMAT_WAVE_EXT 0x10002 ! ! #define NELEMS(x) ((sizeof x) / (sizeof *x)) ! ! #define PCM_CODE 0x0001 ! #define MS_ADPCM_CODE 0x0002 ! #define IMA_ADPCM_CODE 0x0011 ! ! #define MS_ADPCM_max ((1<<(16-1))-1) ! #define MS_ADPCM_min -(1<<(16-1)) ! ! typedef struct Chunk { ! ALuint magic; ! ALuint length; ! void *data; ! } Chunk; ! ! struct MS_ADPCM_decodestate_FULL { ! ALubyte hPredictor; ! ALushort iDelta; ! ALshort iSamp1; ! ALshort iSamp2; ! }; ! ! typedef struct WaveFMT { ! ALushort encoding; ! ALushort channels; /* 1 = mono, 2 = stereo */ ! ALuint frequency; /* One of 11025, 22050, or 44100 Hz */ ! ALuint byterate; /* Average bytes per second */ ! ALushort blockalign; /* Bytes per sample block */ ! ALushort bitspersample; ! } alWaveFMT_LOKI; ! ! typedef struct IMA_ADPCM_decodestate_s { ! ALint valprev; /* Previous output value */ ! ALbyte index; /* Index into stepsize table */ ! } alIMAADPCM_decodestate_LOKI; ! ! typedef struct IMA_ADPCM_decoder { ! alWaveFMT_LOKI wavefmt; ! ALushort wSamplesPerBlock; ! alIMAADPCM_decodestate_LOKI state[2]; ! } alIMAADPCM_state_LOKI; ! /* ! void *AudioConvert(ALvoid *data, ! ALenum f_format, ALuint f_size, ALuint f_freq, ! ALenum t_format, ALuint t_freq, ALuint *retsize); ! */ ! } ! ! #endif Index: netstream.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/netstream.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** netstream.h 11 Nov 2004 07:57:57 -0000 1.8 --- netstream.h 24 Mar 2005 11:47:48 -0000 1.9 *************** *** 1,87 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef NETSTREAM_H_INCLUDED_C419F72E ! #define NETSTREAM_H_INCLUDED_C419F72E ! ! #include "openalpp/stream.h" ! #include "openalpp/export.h" ! ! namespace ost { ! class UDPSocket; ! class TCPStream; ! } ! ! namespace openalpp { ! ! /** ! * Class for handling streams through sockets. ! * Preliminary tests indicate that packets smaller than ca 1 kb should not ! * be used (tests were done with Mono8, 11025 Hz). ! */ ! class OPENALPP_API NetStream : public Stream { ! public: ! /** ! * Constructor. ! * @param socket is the socket to stream data through. ! * @param controlsocket is an (optional) TCPStream that can be used to send ! * information about the stream. The constructor will begin with trying to ! * read SampleFormat, frequency, and buffer size. The sender can also use the ! * control socket to send "EXIT" when it's run out of data to send. If ! * this parameter is not given, defaults will be used (format=Mono8, ! * frequency=11025, buffersize=4096). ! */ ! NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket=NULL); ! ! /** ! * Constructor. ! * @param socket is the socket to stream data through. ! * @param format is the format the data will be in. ! * @param frequency is the frequency of the sound. ! * @param buffersize is the size of the sound buffer. Note that the actual ! * packets sent over the network can be smaller (or bigger!); this is just ! * the size of the buffer OpenAL++ will use to receive the data. ! */ ! NetStream(ost::UDPSocket *socket,SampleFormat format,unsigned int frequency, ! unsigned int buffersize); ! ! /** ! * Copy constructor. ! */ ! NetStream(const NetStream &stream); ! ! /** ! * Destructor. ! */ ! ~NetStream(); ! ! /** ! * Assignment operator. ! */ ! NetStream &operator=(const NetStream &stream); ! }; ! ! } ! ! #endif /* NETSTREAM_H_INCLUDED_C419F72E */ ! --- 1,87 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef NETSTREAM_H_INCLUDED_C419F72E ! #define NETSTREAM_H_INCLUDED_C419F72E ! ! #include "openalpp/stream.h" ! #include "openalpp/export.h" ! ! namespace ost { ! class UDPSocket; ! class TCPStream; ! } ! ! namespace openalpp { ! ! /** ! * Class for handling streams through sockets. ! * Preliminary tests indicate that packets smaller than ca 1 kb should not ! * be used (tests were done with Mono8, 11025 Hz). ! */ ! class OPENALPP_API NetStream : public Stream { ! public: ! /** ! * Constructor. ! * @param socket is the socket to stream data through. ! * @param controlsocket is an (optional) TCPStream that can be used to send ! * information about the stream. The constructor will begin with trying to ! * read SampleFormat, frequency, and buffer size. The sender can also use the ! * control socket to send "EXIT" when it's run out of data to send. If ! * this parameter is not given, defaults will be used (format=Mono8, ! * frequency=11025, buffersize=4096). ! */ ! NetStream(ost::UDPSocket *socket,ost::TCPStream *controlsocket=NULL); ! ! /** ! * Constructor. ! * @param socket is the socket to stream data through. ! * @param format is the format the data will be in. ! * @param frequency is the frequency of the sound. ! * @param buffersize is the size of the sound buffer. Note that the actual ! * packets sent over the network can be smaller (or bigger!); this is just ! * the size of the buffer OpenAL++ will use to receive the data. ! */ ! NetStream(ost::UDPSocket *socket,SampleFormat format,unsigned int frequency, ! unsigned int buffersize); ! ! /** ! * Copy constructor. ! */ ! NetStream(const NetStream &stream); ! ! /** ! * Destructor. ! */ ! ~NetStream(); ! ! /** ! * Assignment operator. ! */ ! NetStream &operator=(const NetStream &stream); ! }; ! ! } ! ! #endif /* NETSTREAM_H_INCLUDED_C419F72E */ ! Index: error.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/error.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** error.h 11 Nov 2004 07:57:57 -0000 1.6 --- error.h 24 Mar 2005 11:47:48 -0000 1.7 *************** *** 1,160 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef ERROR_H_INCLUDED_C416C52E ! #define ERROR_H_INCLUDED_C416C52E ! ! #include <iostream> ! #include <string> ! #include <stdexcept> ! #include "openalpp/export.h" ! namespace openalpp { ! ! /** ! * Error class for throwing. ! * The descendants of this class are different error types, and the exact ! * error can be displayed by using "cout << error;" where error is an instance ! * of Error (or one of its descendants) ! */ ! class Error : public std::runtime_error { ! public: ! /** ! * Constructor. ! * Will use a default error message. ! */ ! Error() : runtime_error("No error description") {} ! ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! Error(const char *description) : runtime_error(description) {} ! ! /** ! * Copy constructor. ! */ ! Error(const Error &error) : runtime_error(error.what()) {} ! ! /** ! * Function used for printing. ! * @param stream is stream to print to ! * @return the stream with the error message appended. ! */ ! std::ostream &put(std::ostream &stream) const; ! ! protected: ! /** ! * A description of the error ! */ ! }; ! ! /** ! * Fatal error. ! * Caused by error in implementation, corrupted memory etc. ! */ ! class FatalError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! FatalError(const char *description) : Error(description) {} ! }; ! ! /** ! * File error. ! * Caused by wrong file permissions, missing files etc. ! */ ! class FileError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! FileError(const char *description) : Error(description) {} ! }; ! ! /** ! * Memory error. ! * Caused by insufficient memory etc. ! */ ! class MemoryError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! MemoryError(const char *description) : Error(description) {} ! }; ! ! /** ! * Name error. ! * Caused by invalid (OpenAL) names. ! */ ! class NameError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! NameError(const char *description) : Error(description) {} ! }; ! ! /** ! * Value error. ! * Caused by values out of range etc. ! */ ! class ValueError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! ValueError(const char *description) : Error(description) {} ! }; ! ! /** ! * Init error. ! * Caused by trying to do actions without proper initialization. ! */ ! class InitError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! InitError(const char *description) : Error(description) {} ! }; ! ! /** ! * Out stream operator. ! * Used to print error messages to a stream (i.e. "cerr << error;"). ! * @param stream is the stream to print to. ! * @param error is the error to print. ! * @return the stream. ! */ ! OPENALPP_API std::ostream &operator<<(std::ostream &stream,const Error &error); ! ! } ! ! #endif /* ERROR_H_INCLUDED_C416C52E */ --- 1,160 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef ERROR_H_INCLUDED_C416C52E ! #define ERROR_H_INCLUDED_C416C52E ! ! #include <iostream> ! #include <string> ! #include <stdexcept> ! #include "openalpp/export.h" ! namespace openalpp { ! ! /** ! * Error class for throwing. ! * The descendants of this class are different error types, and the exact ! * error can be displayed by using "cout << error;" where error is an instance ! * of Error (or one of its descendants) ! */ ! class Error : public std::runtime_error { ! public: ! /** ! * Constructor. ! * Will use a default error message. ! */ ! Error() : runtime_error("No error description") {} ! ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! Error(const char *description) : runtime_error(description) {} ! ! /** ! * Copy constructor. ! */ ! Error(const Error &error) : runtime_error(error.what()) {} ! ! /** ! * Function used for printing. ! * @param stream is stream to print to ! * @return the stream with the error message appended. ! */ ! std::ostream &put(std::ostream &stream) const; ! ! protected: ! /** ! * A description of the error ! */ ! }; ! ! /** ! * Fatal error. ! * Caused by error in implementation, corrupted memory etc. ! */ ! class FatalError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! FatalError(const char *description) : Error(description) {} ! }; ! ! /** ! * File error. ! * Caused by wrong file permissions, missing files etc. ! */ ! class FileError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! FileError(const char *description) : Error(description) {} ! }; ! ! /** ! * Memory error. ! * Caused by insufficient memory etc. ! */ ! class MemoryError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! MemoryError(const char *description) : Error(description) {} ! }; ! ! /** ! * Name error. ! * Caused by invalid (OpenAL) names. ! */ ! class NameError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! NameError(const char *description) : Error(description) {} ! }; ! ! /** ! * Value error. ! * Caused by values out of range etc. ! */ ! class ValueError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! ValueError(const char *description) : Error(description) {} ! }; ! ! /** ! * Init error. ! * Caused by trying to do actions without proper initialization. ! */ ! class InitError : public Error { ! public: ! /** ! * Constructor. ! * @param description is error message to use. ! */ ! InitError(const char *description) : Error(description) {} ! }; ! ! /** ! * Out stream operator. ! * Used to print error messages to a stream (i.e. "cerr << error;"). ! * @param stream is the stream to print to. ! * @param error is the error to print. ! * @return the stream. ! */ ! OPENALPP_API std::ostream &operator<<(std::ostream &stream,const Error &error); ! ! } ! ! #endif /* ERROR_H_INCLUDED_C416C52E */ Index: audiobase.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/audiobase.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** audiobase.h 11 Nov 2004 07:57:57 -0000 1.7 --- audiobase.h 24 Mar 2005 11:47:48 -0000 1.8 *************** *** 1,128 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef AUDIOBASE_H_INCLUDED_C41996D8 ! #define AUDIOBASE_H_INCLUDED_C41996D8 ! ! #include "openalpp/export.h" ! #include <cstdlib> ! extern "C" { ! #include <AL/al.h> ! #include <AL/alut.h> ! #include <AL/alc.h> ! } ! #include "openalpp/windowsstuff.h" ! #include "openalpp/error.h" ! #include "openalpp/referenced.h" ! #include "openalpp/ref_ptr.h" ! /** ! * \mainpage ! * OpenAL++ is an object oriented API for OpenAL (www.openal.org). It also uses ! * PortAudio (www.portaudio.com) for audio capture. ! * In addition to the functionality of OpenAL and ALUT (the OpenAL utility ! * library). ! * ! * OpenAL++ has been tested on Windows and Linux. ! * ! * Every class in OpenAL++ that is available to the user is a descendant of the ! * virtual base class AudioBase. This class takes care of initialization and ! * shutdown, so there is no need to do it explicitly. ! */ ! ! /** ! * Namespace for OpenAL++. ! */ ! ! namespace openalpp { ! ! /** ! * Format for sound data. Mono/Stereo, 8 or 16 bits. ! */ ! typedef enum SampleFormat {Mono8,Stereo8,Mono16,Stereo16}; ! ! /** ! * Base class for enviroment, listener and source classes. ! * Takes care of initialisation/shutdown of anything necessary (e.g. ALut) ! */ ! class OPENALPP_API AudioBase : public Referenced{ ! /** ! * Counter for #instances for enviroment, listener and source classes. ! * Used to determine when init and shutdown functions should be called ! */ ! static int instances_; ! ! /** ! * Pointer to device. ! */ ! static ALCdevice *device_; ! ! /** ! * Pointer to context. ! */ ! #ifndef WIN32 ! static void *context_; ! #else ! static struct ALCcontext_struct *context_; ! #endif ! protected: ! /** ! * Constructor. ! * @param frequency is the output frequency, in Hz. ! * @param refresh is the refresh rate, in Hz. ! * @param is a flag for syncronous context. Values <0 indicates that the ! * default should be used. ! */ ! AudioBase(int frequency=-1,int refresh=-1,int synchronous=-1) ! throw (InitError); ! ! /** ! * Destructor. ! */ ! virtual ~AudioBase(); ! ! /** ! * Flag for whether reverb has been initiated. ! * Reverb can be initiated with AudioEnviroment::InitiateReverb() ! */ ! static bool reverbinitiated_; ! ! /** ! * Set reverb scale. ! * This pointer will be set by AudioEnviroment::InitiateReverb() ! * @param sid is the OpenAL name for the source ! * @param param is the reverb scale. Range [0.0,1.0]. ! */ ! static void (*alReverbScale)(ALuint sid, ALfloat param); ! ! /** ! * Set reverb delay. ! * This pointer will be set by AudioEnviroment::InitiateReverb() ! * @param sid is the OpenAL name for the source ! * @param param is the reverb delay. Range [0.0,2.0]. ! */ ! static void (*alReverbDelay)(ALuint sid, ALfloat param); ! }; ! ! } ! ! #endif /* AUDIOBASE_H_INCLUDED_C41996D8 */ --- 1,128 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef AUDIOBASE_H_INCLUDED_C41996D8 ! #define AUDIOBASE_H_INCLUDED_C41996D8 ! ! #include "openalpp/export.h" ! #include <cstdlib> ! extern "C" { ! #include <AL/al.h> ! #include <AL/alut.h> ! #include <AL/alc.h> ! } ! #include "openalpp/windowsstuff.h" ! #include "openalpp/error.h" ! #include "openalpp/referenced.h" ! #include "openalpp/ref_ptr.h" ! /** ! * \mainpage ! * OpenAL++ is an object oriented API for OpenAL (www.openal.org). It also uses ! * PortAudio (www.portaudio.com) for audio capture. ! * In addition to the functionality of OpenAL and ALUT (the OpenAL utility ! * library). ! * ! * OpenAL++ has been tested on Windows and Linux. ! * ! * Every class in OpenAL++ that is available to the user is a descendant of the ! * virtual base class AudioBase. This class takes care of initialization and ! * shutdown, so there is no need to do it explicitly. ! */ ! ! /** ! * Namespace for OpenAL++. ! */ ! ! namespace openalpp { ! ! /** ! * Format for sound data. Mono/Stereo, 8 or 16 bits. ! */ ! typedef enum SampleFormat {Mono8,Stereo8,Mono16,Stereo16}; ! ! /** ! * Base class for enviroment, listener and source classes. ! * Takes care of initialisation/shutdown of anything necessary (e.g. ALut) ! */ ! class OPENALPP_API AudioBase : public Referenced{ ! /** ! * Counter for #instances for enviroment, listener and source classes. ! * Used to determine when init and shutdown functions should be called ! */ ! static int instances_; ! ! /** ! * Pointer to device. ! */ ! static ALCdevice *device_; ! ! /** ! * Pointer to context. ! */ ! #ifndef WIN32 ! static void *context_; ! #else ! static struct ALCcontext_struct *context_; ! #endif ! protected: ! /** ! * Constructor. ! * @param frequency is the output frequency, in Hz. ! * @param refresh is the refresh rate, in Hz. ! * @param is a flag for syncronous context. Values <0 indicates that the ! * default should be used. ! */ ! AudioBase(int frequency=-1,int refresh=-1,int synchronous=-1) ! throw (InitError); ! ! /** ! * Destructor. ! */ ! virtual ~AudioBase(); ! ! /** ! * Flag for whether reverb has been initiated. ! * Reverb can be initiated with AudioEnviroment::InitiateReverb() ! */ ! static bool reverbinitiated_; ! ! /** ! * Set reverb scale. ! * This pointer will be set by AudioEnviroment::InitiateReverb() ! * @param sid is the OpenAL name for the source ! * @param param is the reverb scale. Range [0.0,1.0]. ! */ ! static void (*alReverbScale)(ALuint sid, ALfloat param); ! ! /** ! * Set reverb delay. ! * This pointer will be set by AudioEnviroment::InitiateReverb() ! * @param sid is the OpenAL name for the source ! * @param param is the reverb delay. Range [0.0,2.0]. ! */ ! static void (*alReverbDelay)(ALuint sid, ALfloat param); ! }; ! ! } ! ! #endif /* AUDIOBASE_H_INCLUDED_C41996D8 */ Index: audioenvironment.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/audioenvironment.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** audioenvironment.h 11 Nov 2004 07:57:57 -0000 1.5 --- audioenvironment.h 24 Mar 2005 11:47:48 -0000 1.6 *************** *** 1,160 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef AUDIOENVIROMENT_H_INCLUDED_C4211030 ! #define AUDIOENVIROMENT_H_INCLUDED_C4211030 ! ! #include "openalpp/audiobase.h" ! ! namespace openalpp { ! ! /** ! * Enum for setting/getting the current distance model. ! * None means no model is in use, i.e. no attenuation.\n ! * InverseDistance:\n ! * - \f$G=GAIN-20*log_{10}*(1+ROLLOFF*\frac{dist-REFERENCE\_DISTANCE}{REFERENCE\_DISTANCE})\f$ ! * - \f$G=min (G,MAX\_GAIN)\f$ ! * - \f$G=max (G,MIN\_GAIN)\f$ ! * ! * InverseDistanceClamped:\n ! * - \f$dist=max (dist,REFERENCE\_DISTANCE)\f$ ! * - \f$dist=min (dist,MAX\_DISTANCE)\f$ ! * - And then the calculations in InverseDistance... This is equivalent to the ! * <a href="http://www.iasig.org>IASIG</a> I3DL2 distance model.\n ! * ! * In the above calculations, the variables have the following meanings:\n ! * - dist is the distance from the listener to the source.\n ! * - REFERENCE_DISTANCE are the distance at which the listener will experience ! * GAIN. Both are set per source.\n ! * - ROLLOFF is a source specific factor of attenuation. If it's set to one, ! * the InverseDistance model will describe a "physically correct" inverse ! * square behaviour.\n ! * - MIN_GAIN, MAX_GAIN and MAX_DISTANCE are values used for clamping gain ! * and distance, respectively. ! */ ! ! #include "openalpp/export.h" ! ! #ifdef None ! #undef None // Defined in X-headers ! #endif ! typedef enum DistanceModel {None,InverseDistance,InverseDistanceClamped}; ! ! /** ! * Class for setting global parameters. ! * This doesn't have to be instantiated if one does not need to set global ! * parameters. ! */ ! class OPENALPP_API AudioEnvironment : public AudioBase { ! public: ! /** ! * Constructor. ! */ ! AudioEnvironment() throw (InitError); ! ! /** ! * Constructor. ! * The parameters are ignored if this isn't the first object to be ! * instatiated of the AudioBase descendants. ! * @param frequency is the playing frequency of the enviroment (in Hz) ! * @param refresh is the refresh rate of the enviroment (in Hz) ! * @param synchronous is true if the enviroment is synchronous ! */ ! AudioEnvironment(int frequency,int refresh,bool synchronous) ! throw (InitError); ! ! ! /** ! * Constructor. ! * The parameters are ignored if this isn't the first object to be ! * instatiated of the AudioBase descendants. ! * @param frequency is the playing frequency of the enviroment (in Hz) ! * @param refresh is the refresh rate of the enviroment (in Hz) ! */ ! AudioEnvironment(int frequency,int refresh=-1) ! throw (InitError); ! ! /** ! * Sets the speed of sound in the enviroment. ! * This is used in doppler calculations. ! * @param speed is the speed of sound in length units per second. ! */ ! void setSoundVelocity(float speed) throw (ValueError,FatalError); ! ! /** ! * Get the speed of sound in the enviroment. ! * @return speed of sound in length units per second. ! */ ! float getSoundVelocity() throw (FatalError); ! ! /** ! * Sets the doppler factor. ! * This can be used to exaggerate, deemphasize or completely turn off the ! * doppler effect. ! * @param factor has a default value of one. ! */ ! void setDopplerFactor(float factor) throw (ValueError,FatalError); ! ! /** ! * Gets the doppler factor. ! * @return doppler factor. ! */ ! float getDopplerFactor() throw (FatalError); ! ! /** ! * Sets global gain (volume). ! * The volume a source will be played at will be multiplied by this _after_ ! * the attenuation calculations. ! * Note: In todays's implementation on Linux, gain is clamped to [0.0,1.0]. ! * This will be changed in future releases of OpenAL. ! * @param gain is the gain [0.0,... ! */ ! void setGain(float gain); ! ! /** ! * Gets the global gain ! * @return global gain ! */ ! float getGain() throw (FatalError); ! ! /** ! * Sets the distance model used in attenuation calculations. ! * @param model is one of: None, InverseDistance, InverseDistanceClamped. ! */ ! void setDistanceModel(DistanceModel model) throw (FatalError); ! ! /** ! * Gets the distance model used in attenuation calculations. ! * @return the model. ! */ ! DistanceModel getDistanceModel() throw (FatalError); ! ! /** ! * Initiates Loki's reverb implementation. ! */ ! void initiateReverb() throw (InitError); ! }; ! ! } ! ! #endif /* AUDIOENVIROMENT_H_INCLUDED_C4211030 */ --- 1,160 ---- ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef AUDIOENVIROMENT_H_INCLUDED_C4211030 ! #define AUDIOENVIROMENT_H_INCLUDED_C4211030 ! ! #include "openalpp/audiobase.h" ! ! namespace openalpp { ! ! /** ! * Enum for setting/getting the current distance model. ! * None means no model is in use, i.e. no attenuation.\n ! * InverseDistance:\n ! * - \f$G=GAIN-20*log_{10}*(1+ROLLOFF*\frac{dist-REFERENCE\_DISTANCE}{REFERENCE\_DISTANCE})\f$ ! * - \f$G=min (G,MAX\_GAIN)\f$ ! * - \f$G=max (G,MIN\_GAIN)\f$ ! * ! * InverseDistanceClamped:\n ! * - \f$dist=max (dist,REFERENCE\_DISTANCE)\f$ ! * - \f$dist=min (dist,MAX\_DISTANCE)\f$ ! * - And then the calculations in InverseDistance... This is equivalent to the ! * <a href="http://www.iasig.org>IASIG</a> I3DL2 distance model.\n ! * ! * In the above calculations, the variables have the following meanings:\n ! * - dist is the distance from the listener to the source.\n ! * - REFERENCE_DISTANCE are the distance at which the listener will experience ! * GAIN. Both are set per source.\n ! * - ROLLOFF is a source specific factor of attenuation. If it's set to one, ! * the InverseDistance model will describe a "physically correct" inverse ! * square behaviour.\n ! * - MIN_GAIN, MAX_GAIN and MAX_DISTANCE are values used for clamping gain ! * and distance, respectively. ! */ ! ! #include "openalpp/export.h" ! ! #ifdef None ! #undef None // Defined in X-headers ! #endif ! typedef enum DistanceModel {None,InverseDistance,InverseDistanceClamped}; ! ! /** ! * Class for setting global parameters. ! * This doesn't have to be instantiated if one does not need to set global ! * parameters. ! */ ! class OPENALPP_API AudioEnvironment : public AudioBase { ! public: ! /** ! * Constructor. ! */ ! AudioEnvironment() throw (InitError); ! ! /** ! * Constructor. ! * The parameters are ignored if this isn't the first object to be ! * instatiated of the AudioBase descendants. ! * @param frequency is the playing frequency of the enviroment (in Hz) ! * @param refresh is the refresh rate of the enviroment (in Hz) ! * @param synchronous is true if the enviroment is synchronous ! */ ! AudioEnvironment(int frequency,int refresh,bool synchronous) ! throw (InitError); ! ! ! /** ! * Constructor. ! * The parameters are ignored if this isn't the first object to be ! * instatiated of the AudioBase descendants. ! * @param frequency is the playing frequency of the enviroment (in Hz) ! * @param refresh is the refresh rate of the enviroment (in Hz) ! */ ! AudioEnvironment(int frequency,int refresh=-1) ! throw (InitError); ! ! /** ! * Sets the speed of sound in the enviroment. ! * This is used in doppler calculations. ! * @param speed is the speed of sound in length units per second. ! */ ! void setSoundVelocity(float speed) throw (ValueError,FatalError); ! ! /** ! * Get the speed of sound in the enviroment. ! * @return speed of sound in length units per second. ! */ ! float getSoundVelocity() throw (FatalError); ! ! /** ! * Sets the doppler factor. ! * This can be used to exaggerate, deemphasize or completely turn off the ! * doppler effect. ! * @param factor has a default value of one. ! */ ! void setDopplerFactor(float factor) throw (ValueError,FatalError); ! ! /** ! * Gets the doppler factor. ! * @return doppler factor. ! */ ! float getDopplerFactor() throw (FatalError); ! ! /** ! * Sets global gain (volume). ! * The volume a source will be played at will be multiplied by this _after_ ! * the attenuation calculations. ! * Note: In todays's implementation on Linux, gain is clamped to [0.0,1.0]. ! * This will be changed in future releases of OpenAL. ! * @param gain is the gain [0.0,... ! */ ! void setGain(float gain); ! ! /** ! * Gets the global gain ! * @return global gain ! */ ! float getGain() throw (FatalError); ! ! /** ! * Sets the distance model used in attenuation calculations. ! * @param model is one of: None, InverseDistance, InverseDistanceClamped. ! */ ! void setDistanceModel(DistanceModel model) throw (FatalError); ! ! /** ! * Gets the distance model used in attenuation calculations. ! * @return the model. ! */ ! DistanceModel getDistanceModel() throw (FatalError); ! ! /** ! * Initiates Loki's reverb implementation. ! */ ! void initiateReverb() throw (InitError); ! }; ! ! } ! ! #endif /* AUDIOENVIROMENT_H_INCLUDED_C4211030 */ Index: listener.h =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/listener.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** listener.h 11 Nov 2004 07:57:57 -0000 1.4 --- listener.h 24 Mar 2005 11:47:48 -0000 1.5 *************** *** 1,155 **** ! /** ! * OpenAL++ - an object oriented toolkit for spatial sound ! * Copyright (C) 2002 VRlab, Umeå University ! * ! * OpenAL++ was created using the libraries: ! * OpenAL (http://www.openal.org), ! * PortAudio (http://www.portaudio.com/), and ! * ! * 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. ! */ ! ! #ifndef LISTENER_H_INCLUDED_C419EF1E ! #define LISTENER_H_INCLUDED_C419EF1E ! ! ! #include "openalpp/export.h" ! #include "openalpp/positionedobject.h" ! ! namespace openalpp { ! ! /** ! * Class for listeners. ! */ ! class OPENALPP_API Listener : public PositionedObject { ! float position_[3]; ! float orientation_[6]; ! float velocity_[3]; ! static Listener *selectedlistener_; ! void init(float x,float y,float z, ! float vx,float vy,float vz, ! float directionx, float directiony, float directionz, ! float upx, float upy, float upz); ! ! protected: ! /** ! * Destructor. ! */ ! virtual ~Listener(); ! ! public: ! /** ! * Constructor. ! * Creates the listener at the default position. ! */ ! Listener(); ! ! ! /** ! * Copy constructor. ! */ ! Listener(const Listener &listener); ! ! /** ! * Constructor. ! * Creates the listener at the specified position and orientation. ! * @param x x coordinate ! * @param y y coordinate ! * @param z z coordinate ! * @param directionx x value of the direction vector ! * @param directiony y value of the direction vector ! * @param directionz z value of the direction vector ! * @param upx x value of the up vector ! * @param upy y value of the up vector ! * @param upz z value ... [truncated message content] |
From: Anders B. <vr-...@us...> - 2005-02-25 14:32:07
|
Update of /cvsroot/alpp/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25065 Modified Files: configure Log Message: Index: configure =================================================================== RCS file: /cvsroot/alpp/openalpp/configure,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** configure 5 Mar 2004 09:44:39 -0000 1.9 --- configure 25 Feb 2005 14:31:46 -0000 1.10 *************** *** 1,8 **** #! /bin/sh # Guess values for system-dependent variables and create Makefiles. ! # 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. --- 1,7 ---- #! /bin/sh [...20615 lines suppressed...] - /^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 $dirpart/$fdir" >&5 - echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} - { (exit 1); exit 1; }; }; } - - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done - done - ;; - esac - done - _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF --- 20136,20139 ---- |
From: Anders B. <vr-...@us...> - 2005-02-25 14:32:04
|
Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25065/src Modified Files: Makefile.am Log Message: Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/src/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.am 11 Nov 2004 07:57:58 -0000 1.7 --- Makefile.am 25 Feb 2005 14:31:48 -0000 1.8 *************** *** 14,18 **** groupsource.cpp \ referenced.cpp - if WITH_CCGNU streamfiles = \ streamupdater.cpp \ --- 14,17 ---- *************** *** 32,38 **** devicefiles = noinputdevice.cpp endif ! else ! streamfiles=nostreaming.cpp noinputdevice.cpp nofilestream.cpp ! endif libopenalpp_la_SOURCES = $(basicfiles) $(streamfiles) $(devicefiles) $(oggfiles) --- 31,35 ---- devicefiles = noinputdevice.cpp endif ! #streamfiles=nostreaming.cpp noinputdevice.cpp nofilestream.cpp libopenalpp_la_SOURCES = $(basicfiles) $(streamfiles) $(devicefiles) $(oggfiles) |
From: Anders B. <vr-...@us...> - 2005-02-25 14:32:02
|
Update of /cvsroot/alpp/openalpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25065/tests Modified Files: Makefile.am Log Message: Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/Makefile.am,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Makefile.am 8 Feb 2005 19:45:37 -0000 1.9 --- Makefile.am 25 Feb 2005 14:31:48 -0000 1.10 *************** *** 2,8 **** INCLUDES = -I$(top_builddir)/include - if WITH_CCGNU - ccgnulibs = @CCGNULIBS@ - endif if WITH_PORTAUDIO portaudiolibs = -lportaudio --- 2,5 ---- *************** *** 13,17 **** ! LDADD = ../src/libopenalpp.la $(ccgnulibs) -lopenal $(portaudiolibs) $(ogglibs) -lOpenThreads --- 10,14 ---- ! LDADD = ../src/libopenalpp.la -lopenal $(portaudiolibs) $(ogglibs) -lOpenThreads |
From: Anders B. <vr-...@us...> - 2005-02-25 08:18:22
|
Update of /cvsroot/alpp/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26244 Modified Files: configure.in Log Message: REmoved linking of commonc++ Index: configure.in =================================================================== RCS file: /cvsroot/alpp/openalpp/configure.in,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** configure.in 5 Mar 2004 09:44:39 -0000 1.10 --- configure.in 25 Feb 2005 08:17:56 -0000 1.11 *************** *** 70,86 **** AC_CHECK_LIB(openal,main) - # Common C++ - #AC_CHECK_LIB(ccgnu2,main,WITH_CCGNU="no",,-lpthread -ldl) - #AC_SUBST(CCGNULIBS) - #AC_SUBST(CCGNUCFLAGS) - WITH_CCGNU="no" - - if test "$WITH_CCGNU" = "yes"; then - CCGNULIBS="`ccgnu2-config --libs`" - CCGNUCFLAGS="-I`ccgnu2-config --includes`" - CPPFLAGS="$CPPFLAGS $CCGNUCFLAGS" - fi - AM_CONDITIONAL(WITH_CCGNU, test "$WITH_CCGNU" = "yes") - # PortAudio AC_CHECK_LIB(portaudio,main,WITH_PORTAUDIO="yes") --- 70,73 ---- |
From: Anders B. <vr-...@us...> - 2005-02-08 19:46:06
|
Update of /cvsroot/alpp/openalpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30078/tests Modified Files: Makefile.am Log Message: Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Makefile.am 7 Feb 2005 19:42:42 -0000 1.8 --- Makefile.am 8 Feb 2005 19:45:37 -0000 1.9 *************** *** 16,20 **** - bin_PROGRAMS = testfstream multiple testmic simple moving noinst_PROGRAMS = testfstream multiple testmic simple moving --- 16,19 ---- |
From: Anders B. <vr-...@us...> - 2005-02-07 19:43:32
|
Update of /cvsroot/alpp/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31472 Modified Files: Makefile.am NEWS autogen.sh Log Message: Minor patches applied Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile.am 13 Dec 2002 13:03:42 -0000 1.1 --- Makefile.am 7 Feb 2005 19:42:36 -0000 1.2 *************** *** 2,6 **** SUBDIRS = src include tests ! EXTRA_DIST = diff_ignore autogen.sh openalpp.pc.in pkgconfigdir = $(libdir)/pkgconfig --- 2,6 ---- SUBDIRS = src include tests ! EXTRA_DIST = diff_ignore autogen.sh openalpp.pc.in VisualStudio pkgconfigdir = $(libdir)/pkgconfig Index: autogen.sh =================================================================== RCS file: /cvsroot/alpp/openalpp/autogen.sh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** autogen.sh 16 Apr 2003 11:14:56 -0000 1.3 --- autogen.sh 7 Feb 2005 19:42:38 -0000 1.4 *************** *** 1,6 **** #!/bin/sh aclocal libtoolize --force automake --foreign --add-missing autoconf ! ./configure --disable-libtool-lock $@ --- 1,7 ---- #!/bin/sh + mkdir -p config aclocal libtoolize --force automake --foreign --add-missing autoconf ! Index: NEWS =================================================================== RCS file: /cvsroot/alpp/openalpp/NEWS,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NEWS 21 Jan 2005 14:20:19 -0000 1.7 --- NEWS 7 Feb 2005 19:42:37 -0000 1.8 *************** *** 1,5 **** NEWS 2005-01-21 Anders Backman: ! Changed default device to NULL when initializing OpenAL. THis is regarded to be Best quality/performance. (See OpenAL website) 2004-11-23 Anders Backman: --- 1,8 ---- NEWS + 2005-02-07 Anders Backman + Minor patches applied to buildsystem + 2005-01-21 Anders Backman: ! Changed default device to NULL when initializing OpenAL. This is regarded to be Best quality/performance. (See OpenAL website) 2004-11-23 Anders Backman: |
From: Anders B. <vr-...@us...> - 2005-02-07 19:43:32
|
Update of /cvsroot/alpp/openalpp/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31472/tests Modified Files: Makefile.am Log Message: Minor patches applied Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/tests/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Makefile.am 11 Nov 2004 07:57:58 -0000 1.7 --- Makefile.am 7 Feb 2005 19:42:42 -0000 1.8 *************** *** 15,23 **** LDADD = ../src/libopenalpp.la $(ccgnulibs) -lopenal $(portaudiolibs) $(ogglibs) -lOpenThreads - bin_PROGRAMS = testfstream multiple testmic simple moving #testsend teststream - - #teststream_SOURCES = teststream.cpp ! #testsend_SOURCES = testsend.cpp testmic_SOURCES = testmic.cpp --- 15,21 ---- LDADD = ../src/libopenalpp.la $(ccgnulibs) -lopenal $(portaudiolibs) $(ogglibs) -lOpenThreads ! bin_PROGRAMS = testfstream multiple testmic simple moving ! noinst_PROGRAMS = testfstream multiple testmic simple moving testmic_SOURCES = testmic.cpp *************** *** 27,31 **** moving_SOURCES = moving.cpp - testfstream_SOURCES = testfstream.cpp --- 25,28 ---- |
From: Anders B. <vr-...@us...> - 2005-02-07 19:43:31
|
Update of /cvsroot/alpp/openalpp/include/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31472/include/openalpp Modified Files: Makefile.am Log Message: Minor patches applied Index: Makefile.am =================================================================== RCS file: /cvsroot/alpp/openalpp/include/openalpp/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile.am 11 Nov 2004 07:57:57 -0000 1.6 --- Makefile.am 7 Feb 2005 19:42:39 -0000 1.7 *************** *** 24,27 **** referenced.h \ ref_ptr.h ! # netstream.h \ ! # netupdater.h \ --- 24,26 ---- referenced.h \ ref_ptr.h ! |
From: Anders B. <vr-...@us...> - 2005-02-07 19:43:31
|
Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31472/src Modified Files: groupsource.cpp Log Message: Minor patches applied Index: groupsource.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/groupsource.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** groupsource.cpp 11 Nov 2004 07:57:58 -0000 1.9 --- groupsource.cpp 7 Feb 2005 19:42:41 -0000 1.10 *************** *** 44,48 **** } ! ALfloat FilterDoppler(ALuint source) { // This space intentionally left blank. Doppler effects don't really make // much sense for group sources. --- 44,48 ---- } ! ALfloat FilterDoppler(ALuint) { // This space intentionally left blank. Doppler effects don't really make // much sense for group sources. *************** *** 376,381 **** bsize=loadsize; bdata=(ALshort *)converter.apply(loaddata,format, ! (unsigned int)freq,(unsigned int)bsize); if(!bdata) --- 376,384 ---- bsize=loadsize; + + // Fix to make g++3.4.2 happy + unsigned int usize=bsize; bdata=(ALshort *)converter.apply(loaddata,format, ! (unsigned int)freq,usize); if(!bdata) *************** *** 394,399 **** size=loadsize; data=(ALshort *)converter.apply(loaddata,format, ! (unsigned int)freq,(unsigned int)size); if(!data) throw FatalError("Error converting data to internal format!"); --- 397,403 ---- size=loadsize; + unsigned int usize = size; data=(ALshort *)converter.apply(loaddata,format, ! (unsigned int)freq,usize); if(!data) throw FatalError("Error converting data to internal format!"); *************** *** 412,416 **** } ALint amp; ! for(unsigned int i=0;i<(size/2);i++) { amp=bdata[i]+data[i]; if(amp>32767) --- 416,420 ---- } ALint amp; ! for(ALsizei i=0;i<(size/2);i++) { amp=bdata[i]+data[i]; if(amp>32767) |
From: Anders B. <vr-...@us...> - 2005-01-21 14:20:29
|
Update of /cvsroot/alpp/openalpp/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24289/src Modified Files: audiobase.cpp Log Message: Use NULL as default device for initialing OpenAL device. Index: audiobase.cpp =================================================================== RCS file: /cvsroot/alpp/openalpp/src/audiobase.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** audiobase.cpp 11 Nov 2004 07:57:58 -0000 1.14 --- audiobase.cpp 21 Jan 2005 14:20:20 -0000 1.15 *************** *** 34,38 **** // to open a read (input) device later.. #ifdef _WIN32 ! char *initString = "DirectSound3D"; device_ =alcOpenDevice((unsigned char *)initString); --- 34,38 ---- // to open a read (input) device later.. #ifdef _WIN32 ! char *initString = 0L;//"DirectSound", "DirectSound3D", ; device_ =alcOpenDevice((unsigned char *)initString); |
From: Anders B. <vr-...@us...> - 2005-01-21 14:20:28
|
Update of /cvsroot/alpp/openalpp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24289 Modified Files: NEWS Log Message: Use NULL as default device for initialing OpenAL device. Index: NEWS =================================================================== RCS file: /cvsroot/alpp/openalpp/NEWS,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NEWS 23 Nov 2004 14:06:00 -0000 1.6 --- NEWS 21 Jan 2005 14:20:19 -0000 1.7 *************** *** 1,3 **** --- 1,5 ---- NEWS + 2005-01-21 Anders Backman: + Changed default device to NULL when initializing OpenAL. THis is regarded to be Best quality/performance. (See OpenAL website) 2004-11-23 Anders Backman: |