Annotation of /trunk/indra/llaudio/audioengine_openal.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file audioengine_openal.cpp | ||
| 3 : | * @brief implementation of audio engine using OpenAL | ||
| 4 : | * support as a OpenAL 3D implementation | ||
| 5 : | * | ||
| 6 : | * | ||
| 7 : | * $LicenseInfo:firstyear=2002&license=viewergpl$ | ||
| 8 : | * | ||
| 9 : | mjm | 137 | * Copyright (c) 2002-2010, Linden Research, Inc. |
| 10 : | mjm | 135 | * |
| 11 : | * Second Life Viewer Source Code | ||
| 12 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 13 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 14 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 15 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 16 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 17 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 18 : | * | ||
| 19 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 20 : | * it is applied to this Source Code. View the full text of the exception | ||
| 21 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 22 : | * online at | ||
| 23 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 24 : | * | ||
| 25 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 26 : | * that you have read and understood your obligations described above, | ||
| 27 : | * and agree to abide by those obligations. | ||
| 28 : | * | ||
| 29 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 30 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 31 : | * COMPLETENESS OR PERFORMANCE. | ||
| 32 : | * $/LicenseInfo$ | ||
| 33 : | */ | ||
| 34 : | |||
| 35 : | |||
| 36 : | #ifndef LL_AUDIOENGINE_OPENAL_H | ||
| 37 : | #define LL_AUDIOENGINE_OPENAL_H | ||
| 38 : | |||
| 39 : | #include "audioengine.h" | ||
| 40 : | #include "listener_openal.h" | ||
| 41 : | #include "windgen.h" | ||
| 42 : | |||
| 43 : | class LLAudioEngine_OpenAL : public LLAudioEngine | ||
| 44 : | { | ||
| 45 : | public: | ||
| 46 : | LLAudioEngine_OpenAL(); | ||
| 47 : | virtual ~LLAudioEngine_OpenAL(); | ||
| 48 : | |||
| 49 : | virtual bool init(const S32 num_channels, void *user_data); | ||
| 50 : | virtual std::string getDriverName(bool verbose); | ||
| 51 : | virtual void allocateListener(); | ||
| 52 : | |||
| 53 : | virtual void shutdown(); | ||
| 54 : | |||
| 55 : | void setInternalGain(F32 gain); | ||
| 56 : | |||
| 57 : | LLAudioBuffer* createBuffer(); | ||
| 58 : | LLAudioChannel* createChannel(); | ||
| 59 : | |||
| 60 : | /*virtual*/ void initWind(); | ||
| 61 : | /*virtual*/ void cleanupWind(); | ||
| 62 : | /*virtual*/ void updateWind(LLVector3 direction, F32 camera_altitude); | ||
| 63 : | |||
| 64 : | private: | ||
| 65 : | void * windDSP(void *newbuffer, int length); | ||
| 66 : | typedef S16 WIND_SAMPLE_T; | ||
| 67 : | LLWindGen<WIND_SAMPLE_T> *mWindGen; | ||
| 68 : | S16 *mWindBuf; | ||
| 69 : | U32 mWindBufFreq; | ||
| 70 : | U32 mWindBufSamples; | ||
| 71 : | U32 mWindBufBytes; | ||
| 72 : | ALuint mWindSource; | ||
| 73 : | int mNumEmptyWindALBuffers; | ||
| 74 : | |||
| 75 : | static const int MAX_NUM_WIND_BUFFERS = 80; | ||
| 76 : | static const float WIND_BUFFER_SIZE_SEC = 0.05f; // 1/20th sec | ||
| 77 : | }; | ||
| 78 : | |||
| 79 : | class LLAudioChannelOpenAL : public LLAudioChannel | ||
| 80 : | { | ||
| 81 : | public: | ||
| 82 : | LLAudioChannelOpenAL(); | ||
| 83 : | virtual ~LLAudioChannelOpenAL(); | ||
| 84 : | protected: | ||
| 85 : | /*virtual*/ void play(); | ||
| 86 : | /*virtual*/ void playSynced(LLAudioChannel *channelp); | ||
| 87 : | /*virtual*/ void cleanup(); | ||
| 88 : | /*virtual*/ bool isPlaying(); | ||
| 89 : | |||
| 90 : | /*virtual*/ bool updateBuffer(); | ||
| 91 : | /*virtual*/ void update3DPosition(); | ||
| 92 : | /*virtual*/ void updateLoop(); | ||
| 93 : | |||
| 94 : | ALuint mALSource; | ||
| 95 : | ALint mLastSamplePos; | ||
| 96 : | }; | ||
| 97 : | |||
| 98 : | class LLAudioBufferOpenAL : public LLAudioBuffer{ | ||
| 99 : | public: | ||
| 100 : | LLAudioBufferOpenAL(); | ||
| 101 : | virtual ~LLAudioBufferOpenAL(); | ||
| 102 : | |||
| 103 : | bool loadWAV(const std::string& filename); | ||
| 104 : | U32 getLength(); | ||
| 105 : | |||
| 106 : | friend class LLAudioChannelOpenAL; | ||
| 107 : | protected: | ||
| 108 : | void cleanup(); | ||
| 109 : | ALuint getBuffer() {return mALBuffer;} | ||
| 110 : | |||
| 111 : | ALuint mALBuffer; | ||
| 112 : | }; | ||
| 113 : | |||
| 114 : | #endif |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

