Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
872c394e
Commit
872c394e
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fixes to openal support
parent
a19c5b04
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/llaudio/llaudioengine_openal.cpp
+58
-39
58 additions, 39 deletions
indra/llaudio/llaudioengine_openal.cpp
with
58 additions
and
39 deletions
indra/llaudio/llaudioengine_openal.cpp
+
58
−
39
View file @
872c394e
...
@@ -74,7 +74,7 @@ bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata, const st
...
@@ -74,7 +74,7 @@ bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata, const st
ALCdevice
*
device
=
alcGetContextsDevice
(
alcGetCurrentContext
());
ALCdevice
*
device
=
alcGetContextsDevice
(
alcGetCurrentContext
());
alcGetIntegerv
(
device
,
ALC_MAJOR_VERSION
,
1
,
&
major
);
alcGetIntegerv
(
device
,
ALC_MAJOR_VERSION
,
1
,
&
major
);
alcGetIntegerv
(
device
,
ALC_M
AJ
OR_VERSION
,
1
,
&
minor
);
alcGetIntegerv
(
device
,
ALC_M
IN
OR_VERSION
,
1
,
&
minor
);
LL_INFOS
()
<<
"ALC version: "
<<
major
<<
"."
<<
minor
<<
LL_ENDL
;
LL_INFOS
()
<<
"ALC version: "
<<
major
<<
"."
<<
minor
<<
LL_ENDL
;
LL_INFOS
()
<<
"ALC default device: "
LL_INFOS
()
<<
"ALC default device: "
...
@@ -176,6 +176,8 @@ LLAudioChannelOpenAL::~LLAudioChannelOpenAL()
...
@@ -176,6 +176,8 @@ LLAudioChannelOpenAL::~LLAudioChannelOpenAL()
void
LLAudioChannelOpenAL
::
cleanup
()
void
LLAudioChannelOpenAL
::
cleanup
()
{
{
alSourceStop
(
mALSource
);
alSourceStop
(
mALSource
);
alSourcei
(
mALSource
,
AL_BUFFER
,
AL_NONE
);
mCurrentBufferp
=
NULL
;
mCurrentBufferp
=
NULL
;
}
}
...
@@ -322,7 +324,14 @@ void LLAudioBufferOpenAL::cleanup()
...
@@ -322,7 +324,14 @@ void LLAudioBufferOpenAL::cleanup()
{
{
if
(
mALBuffer
!=
AL_NONE
)
if
(
mALBuffer
!=
AL_NONE
)
{
{
alGetError
();
// clear error
alDeleteBuffers
(
1
,
&
mALBuffer
);
alDeleteBuffers
(
1
,
&
mALBuffer
);
ALenum
error
=
alutGetError
();
if
(
ALC_NO_ERROR
!=
error
)
{
LL_WARNS
(
"OpenAL"
)
<<
"Error: "
<<
alutGetErrorString
(
error
)
<<
" when cleaning up a buffer"
<<
LL_ENDL
;
}
mALBuffer
=
AL_NONE
;
mALBuffer
=
AL_NONE
;
}
}
}
}
...
@@ -439,6 +448,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
...
@@ -439,6 +448,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
F64
pitch
;
F64
pitch
;
F64
center_freq
;
F64
center_freq
;
ALenum
error
;
ALenum
error
;
ALuint
*
buffers
=
NULL
;
if
(
!
mEnableWind
)
if
(
!
mEnableWind
)
return
;
return
;
...
@@ -452,7 +462,6 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
...
@@ -452,7 +462,6 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
// wind comes in as Linden coordinate (+X = forward, +Y = left, +Z = up)
// wind comes in as Linden coordinate (+X = forward, +Y = left, +Z = up)
// need to convert this to the conventional orientation DS3D and OpenAL use
// need to convert this to the conventional orientation DS3D and OpenAL use
// where +X = right, +Y = up, +Z = backwards
// where +X = right, +Y = up, +Z = backwards
wind_vec
.
setVec
(
-
wind_vec
.
mV
[
1
],
wind_vec
.
mV
[
2
],
-
wind_vec
.
mV
[
0
]);
wind_vec
.
setVec
(
-
wind_vec
.
mV
[
1
],
wind_vec
.
mV
[
2
],
-
wind_vec
.
mV
[
0
]);
pitch
=
1.0
+
mapWindVecToPitch
(
wind_vec
);
pitch
=
1.0
+
mapWindVecToPitch
(
wind_vec
);
...
@@ -483,57 +492,67 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
...
@@ -483,57 +492,67 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude)
//LL_INFOS() << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << LL_ENDL;
//LL_INFOS() << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << LL_ENDL;
while
(
processed
--
)
// unqueue old buffers
//delete the old wind buffers
buffers
=
new
ALuint
[
processed
];
alGetError
();
/* clear error */
alSourceUnqueueBuffers
(
mWindSource
,
processed
,
&
buffers
[
0
]);
error
=
alGetError
();
if
(
error
!=
AL_NO_ERROR
)
{
{
ALuint
buffer
;
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers"
<<
LL_ENDL
;
ALenum
error
;
}
alGetError
();
/* clear error */
else
alSourceUnqueueBuffers
(
mWindSource
,
1
,
&
buffer
);
{
error
=
alGetError
();
alDeleteBuffers
(
processed
,
&
buffers
[
0
]);
if
(
error
!=
AL_NO_ERROR
)
{
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers"
<<
LL_ENDL
;
}
else
{
alDeleteBuffers
(
1
,
&
buffer
);
}
}
}
// We dont need to keep track of the buffers' id now.
delete
[]
buffers
;
buffers
=
NULL
;
//create the buffers for the empty wind buffers
unprocessed
+=
mNumEmptyWindALBuffers
;
unprocessed
+=
mNumEmptyWindALBuffers
;
while
(
mNumEmptyWindALBuffers
>
0
)
// fill+queue new buffers
buffers
=
new
ALuint
[
mNumEmptyWindALBuffers
];
alGetError
();
/* clear error */
alGenBuffers
(
mNumEmptyWindALBuffers
,
&
buffers
[
0
]);
if
((
error
=
alGetError
())
!=
AL_NO_ERROR
)
{
{
ALuint
buffer
;
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: "
<<
error
<<
LL_ENDL
;
alGetError
();
/* clear error */
//break;
alGenBuffers
(
1
,
&
buffer
);
}
if
((
error
=
alGetError
())
!=
AL_NO_ERROR
)
{
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: "
<<
error
<<
LL_ENDL
;
break
;
}
alBufferData
(
buffer
,
//fill the buffers with generated wind.
AL_FORMAT_STEREO16
,
int
errors
=
0
;
mWindGen
->
windGenerate
(
mWindBuf
,
for
(
int
i
=
0
;
i
<
mNumEmptyWindALBuffers
;
i
++
)
mWindBufSamples
),
{
mWindBufBytes
,
alBufferData
(
buffers
[
i
],
mWindBufFreq
);
AL_FORMAT_STEREO16
,
mWindGen
->
windGenerate
(
mWindBuf
,
mWindBufSamples
),
mWindBufBytes
,
mWindBufFreq
);
error
=
alGetError
();
error
=
alGetError
();
if
(
error
!=
AL_NO_ERROR
)
if
(
error
!=
AL_NO_ERROR
)
{
{
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers"
<<
LL_ENDL
;
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers"
<<
LL_ENDL
;
errors
++
;
}
}
}
alSourceQueueBuffers
(
mWindSource
,
1
,
&
buffer
);
error
=
alGetError
();
if
(
error
!=
AL_NO_ERROR
)
{
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers"
<<
LL_ENDL
;
}
--
mNumEmptyWindALBuffers
;
//queue the buffers
alSourceQueueBuffers
(
mWindSource
,
mNumEmptyWindALBuffers
,
&
buffers
[
0
]);
error
=
alGetError
();
if
(
error
!=
AL_NO_ERROR
)
{
LL_WARNS
()
<<
"LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers"
<<
LL_ENDL
;
}
}
mNumEmptyWindALBuffers
=
errors
;
// We dont need to keep track of the buffers' id now.
delete
[]
buffers
;
buffers
=
NULL
;
//restart playing if not playing
ALint
playing
;
ALint
playing
;
alGetSourcei
(
mWindSource
,
AL_SOURCE_STATE
,
&
playing
);
alGetSourcei
(
mWindSource
,
AL_SOURCE_STATE
,
&
playing
);
if
(
playing
!=
AL_PLAYING
)
if
(
playing
!=
AL_PLAYING
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment