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] |