Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
0a427890
Commit
0a427890
authored
Dec 13, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/openal: move code to inline functions
parent
e735abe3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
openal_output_plugin.c
src/output/openal_output_plugin.c
+25
-9
No files found.
src/output/openal_output_plugin.c
View file @
0a427890
...
@@ -83,6 +83,29 @@ openal_audio_format(struct audio_format *audio_format)
...
@@ -83,6 +83,29 @@ openal_audio_format(struct audio_format *audio_format)
}
}
}
}
G_GNUC_PURE
static
inline
ALint
openal_get_source_i
(
const
struct
openal_data
*
od
,
ALenum
param
)
{
ALint
value
;
alGetSourcei
(
od
->
source
,
param
,
&
value
);
return
value
;
}
G_GNUC_PURE
static
inline
bool
openal_has_processed
(
const
struct
openal_data
*
od
)
{
return
openal_get_source_i
(
od
,
AL_BUFFERS_PROCESSED
)
>
0
;
}
G_GNUC_PURE
static
inline
ALint
openal_is_playing
(
const
struct
openal_data
*
od
)
{
return
openal_get_source_i
(
od
,
AL_SOURCE_STATE
)
==
AL_PLAYING
;
}
static
bool
static
bool
openal_setup_context
(
struct
openal_data
*
od
,
openal_setup_context
(
struct
openal_data
*
od
,
GError
**
error
)
GError
**
error
)
...
@@ -195,21 +218,18 @@ openal_play(struct audio_output *ao, const void *chunk, size_t size,
...
@@ -195,21 +218,18 @@ openal_play(struct audio_output *ao, const void *chunk, size_t size,
{
{
struct
openal_data
*
od
=
(
struct
openal_data
*
)
ao
;
struct
openal_data
*
od
=
(
struct
openal_data
*
)
ao
;
ALuint
buffer
;
ALuint
buffer
;
ALint
num
,
state
;
if
(
alcGetCurrentContext
()
!=
od
->
context
)
{
if
(
alcGetCurrentContext
()
!=
od
->
context
)
{
alcMakeContextCurrent
(
od
->
context
);
alcMakeContextCurrent
(
od
->
context
);
}
}
alGetSourcei
(
od
->
source
,
AL_BUFFERS_PROCESSED
,
&
num
);
if
(
od
->
filled
<
NUM_BUFFERS
)
{
if
(
od
->
filled
<
NUM_BUFFERS
)
{
/* fill all buffers */
/* fill all buffers */
buffer
=
od
->
buffers
[
od
->
filled
];
buffer
=
od
->
buffers
[
od
->
filled
];
od
->
filled
++
;
od
->
filled
++
;
}
else
{
}
else
{
/* wait for processed buffer */
/* wait for processed buffer */
while
(
num
<
1
)
{
while
(
!
openal_has_processed
(
od
)
)
{
if
(
!
od
->
timer
->
started
)
{
if
(
!
od
->
timer
->
started
)
{
timer_start
(
od
->
timer
);
timer_start
(
od
->
timer
);
}
else
{
}
else
{
...
@@ -217,8 +237,6 @@ openal_play(struct audio_output *ao, const void *chunk, size_t size,
...
@@ -217,8 +237,6 @@ openal_play(struct audio_output *ao, const void *chunk, size_t size,
}
}
timer_add
(
od
->
timer
,
size
);
timer_add
(
od
->
timer
,
size
);
alGetSourcei
(
od
->
source
,
AL_BUFFERS_PROCESSED
,
&
num
);
}
}
alSourceUnqueueBuffers
(
od
->
source
,
1
,
&
buffer
);
alSourceUnqueueBuffers
(
od
->
source
,
1
,
&
buffer
);
...
@@ -226,11 +244,9 @@ openal_play(struct audio_output *ao, const void *chunk, size_t size,
...
@@ -226,11 +244,9 @@ openal_play(struct audio_output *ao, const void *chunk, size_t size,
alBufferData
(
buffer
,
od
->
format
,
chunk
,
size
,
od
->
frequency
);
alBufferData
(
buffer
,
od
->
format
,
chunk
,
size
,
od
->
frequency
);
alSourceQueueBuffers
(
od
->
source
,
1
,
&
buffer
);
alSourceQueueBuffers
(
od
->
source
,
1
,
&
buffer
);
alGetSourcei
(
od
->
source
,
AL_SOURCE_STATE
,
&
state
);
if
(
state
!=
AL_PLAYING
)
{
if
(
!
openal_is_playing
(
od
))
alSourcePlay
(
od
->
source
);
alSourcePlay
(
od
->
source
);
}
return
size
;
return
size
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment