Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
jaxe
Commits
000db168
Commit
000db168
authored
Jan 05, 2022
by
phcoder
Browse files
LIBRETRO: Use audio_batch_cb for resampling
parent
90be00eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libretro.c
View file @
000db168
...
...
@@ -402,12 +402,23 @@ int get_audio_sample(void)
return
x
;
}
static
void
audio_sample
(
int16_t
sample
)
{
// TODO: Use audio_batch_cb
static
void
audio_sample
(
int16_t
sample
)
{
int16_t
buf
[
200
];
// Should be enough to call batch_cb only once
// in most cases
int16_t
*
bufptr
=
buf
;
while
(
audio_counter_resample
>=
ONE_SEC
/
AUDIO_RESAMPLE_RATE
)
{
audio_cb
(
sample
,
sample
);
*
bufptr
++
=
sample
;
*
bufptr
++
=
sample
;
if
(
bufptr
>=
buf
+
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]))
{
audio_batch_cb
(
buf
,
(
bufptr
-
buf
)
/
2
);
bufptr
=
buf
;
}
audio_counter_resample
-=
ONE_SEC
/
AUDIO_RESAMPLE_RATE
;
}
if
(
bufptr
!=
buf
)
{
audio_batch_cb
(
buf
,
(
bufptr
-
buf
)
/
2
);
}
}
void
retro_run
(
void
)
...
...
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