diff options
author | McCabe Maxsted | 2010-09-13 17:18:52 -0700 |
---|---|---|
committer | McCabe Maxsted | 2011-06-21 22:53:14 -0700 |
commit | aa817c7cb4caad98628543c60eeb34909413dee2 (patch) | |
tree | 6d148250c0506fc34da3dbb777c13c4eaf07ae2f /linden/indra/llaudio/llaudioengine_openal.cpp | |
parent | Fixed the word 'beta' missing from the imp installer (diff) | |
download | meta-impy-aa817c7cb4caad98628543c60eeb34909413dee2.zip meta-impy-aa817c7cb4caad98628543c60eeb34909413dee2.tar.gz meta-impy-aa817c7cb4caad98628543c60eeb34909413dee2.tar.bz2 meta-impy-aa817c7cb4caad98628543c60eeb34909413dee2.tar.xz |
Updated openal device loading and added debug info for startup
Diffstat (limited to 'linden/indra/llaudio/llaudioengine_openal.cpp')
-rw-r--r-- | linden/indra/llaudio/llaudioengine_openal.cpp | 69 |
1 files changed, 54 insertions, 15 deletions
diff --git a/linden/indra/llaudio/llaudioengine_openal.cpp b/linden/indra/llaudio/llaudioengine_openal.cpp index 93bc42b..c33b992 100644 --- a/linden/indra/llaudio/llaudioengine_openal.cpp +++ b/linden/indra/llaudio/llaudioengine_openal.cpp | |||
@@ -48,7 +48,9 @@ LLAudioEngine_OpenAL::LLAudioEngine_OpenAL() | |||
48 | mWindBufSamples(0), | 48 | mWindBufSamples(0), |
49 | mWindBufBytes(0), | 49 | mWindBufBytes(0), |
50 | mWindSource(AL_NONE), | 50 | mWindSource(AL_NONE), |
51 | mNumEmptyWindALBuffers(MAX_NUM_WIND_BUFFERS) | 51 | mNumEmptyWindALBuffers(MAX_NUM_WIND_BUFFERS), |
52 | mContext(NULL), | ||
53 | mDevice(NULL) | ||
52 | { | 54 | { |
53 | } | 55 | } |
54 | 56 | ||
@@ -69,30 +71,63 @@ bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) | |||
69 | return false; | 71 | return false; |
70 | } | 72 | } |
71 | 73 | ||
74 | // check for extensions | ||
75 | if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) | ||
76 | { | ||
77 | llinfos << "Results for ALC_ENUMERATION_EXT:\n" | ||
78 | << ll_safe_string(alcGetString(NULL, ALC_DEVICE_SPECIFIER)) | ||
79 | << llendl; | ||
80 | } | ||
81 | |||
82 | // initialize device | ||
83 | ALCdevice* mDevice = alcOpenDevice(NULL); | ||
84 | if (!mDevice) | ||
85 | { | ||
86 | llinfos << "OpenAL could not find an installed audio device. Aborting" << llendl; | ||
87 | ALCenum error = alcGetError(mDevice); | ||
88 | if (error != ALC_NO_ERROR) | ||
89 | { | ||
90 | llinfos << "ALC error:" << ll_safe_string(alcGetString(mDevice, error)) << llendl; | ||
91 | } | ||
92 | return false; | ||
93 | } | ||
94 | |||
95 | // create context | ||
96 | ALCcontext* mContext = alcCreateContext(mDevice, NULL); | ||
97 | if (mContext != NULL) | ||
98 | { | ||
99 | alcMakeContextCurrent(mContext); | ||
100 | if (alGetError() != AL_NO_ERROR) | ||
101 | { | ||
102 | llinfos << "ALC error:" << alGetError() << ". Could not set current context!" << llendl; | ||
103 | } | ||
104 | } | ||
105 | else | ||
106 | { | ||
107 | llinfos << "ALC error: could not create context from device!" << llendl; | ||
108 | } | ||
109 | |||
72 | llinfos << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << llendl; | 110 | llinfos << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << llendl; |
73 | 111 | ||
112 | llinfos << "ALC default device: " | ||
113 | << ll_safe_string(alcGetString(mDevice, ALC_DEFAULT_DEVICE_SPECIFIER)) | ||
114 | << llendl; | ||
115 | |||
74 | llinfos << "OpenAL version: " | 116 | llinfos << "OpenAL version: " |
75 | << ll_safe_string(alGetString(AL_VERSION)) << llendl; | 117 | << ll_safe_string(alGetString(AL_VERSION)) << llendl; |
76 | llinfos << "OpenAL vendor: " | 118 | llinfos << "OpenAL vendor: " |
77 | << ll_safe_string(alGetString(AL_VENDOR)) << llendl; | 119 | << ll_safe_string(alGetString(AL_VENDOR)) << llendl; |
78 | llinfos << "OpenAL renderer: " | 120 | llinfos << "OpenAL renderer: " |
79 | << ll_safe_string(alGetString(AL_RENDERER)) << llendl; | 121 | << ll_safe_string(alGetString(AL_RENDERER)) << llendl; |
80 | 122 | ||
81 | ALint major = alutGetMajorVersion (); | 123 | ALint major = alutGetMajorVersion(); |
82 | ALint minor = alutGetMinorVersion (); | 124 | ALint minor = alutGetMinorVersion(); |
83 | llinfos << "ALUT version: " << major << "." << minor << llendl; | 125 | llinfos << "ALUT version: " << major << "." << minor << llendl; |
84 | 126 | ||
85 | ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); | 127 | alcGetIntegerv(mDevice, ALC_MAJOR_VERSION, 1, &major); |
86 | 128 | alcGetIntegerv(mDevice, ALC_MINOR_VERSION, 1, &minor); | |
87 | alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); | ||
88 | alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor); | ||
89 | llinfos << "ALC version: " << major << "." << minor << llendl; | 129 | llinfos << "ALC version: " << major << "." << minor << llendl; |
90 | 130 | ||
91 | llinfos << "ALC default device: " | ||
92 | << ll_safe_string(alcGetString(device, | ||
93 | ALC_DEFAULT_DEVICE_SPECIFIER)) | ||
94 | << llendl; | ||
95 | |||
96 | return true; | 131 | return true; |
97 | } | 132 | } |
98 | 133 | ||
@@ -148,6 +183,10 @@ void LLAudioEngine_OpenAL::shutdown() | |||
148 | llwarns << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << llendl; | 183 | llwarns << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << llendl; |
149 | } | 184 | } |
150 | 185 | ||
186 | alcMakeContextCurrent(NULL); | ||
187 | alcDestroyContext(mContext); | ||
188 | alcCloseDevice(mDevice); | ||
189 | |||
151 | llinfos << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << llendl; | 190 | llinfos << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << llendl; |
152 | 191 | ||
153 | delete mListenerp; | 192 | delete mListenerp; |