Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
867e1ee7
Commit
867e1ee7
authored
Jan 19, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SRC: Implement ma_speex_resampler_get_expected_output_frame_count().
parent
f7ff9ee1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
extras/speex_resampler/ma_speex_resampler.h
extras/speex_resampler/ma_speex_resampler.h
+42
-0
research/ma_resampler.h
research/ma_resampler.h
+7
-2
No files found.
extras/speex_resampler/ma_speex_resampler.h
View file @
867e1ee7
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
#define spx_uint64_t unsigned long long
#define spx_uint64_t unsigned long long
int
ma_speex_resampler_get_required_input_frame_count
(
SpeexResamplerState
*
st
,
spx_uint64_t
out_len
,
spx_uint64_t
*
in_len
);
int
ma_speex_resampler_get_required_input_frame_count
(
SpeexResamplerState
*
st
,
spx_uint64_t
out_len
,
spx_uint64_t
*
in_len
);
int
ma_speex_resampler_get_expected_output_frame_count
(
SpeexResamplerState
*
st
,
spx_uint64_t
in_len
,
spx_uint64_t
*
out_len
);
#endif
/* ma_speex_resampler_h */
#endif
/* ma_speex_resampler_h */
...
@@ -54,4 +55,45 @@ EXPORT int ma_speex_resampler_get_required_input_frame_count(SpeexResamplerState
...
@@ -54,4 +55,45 @@ EXPORT int ma_speex_resampler_get_required_input_frame_count(SpeexResamplerState
return
RESAMPLER_ERR_SUCCESS
;
return
RESAMPLER_ERR_SUCCESS
;
}
}
EXPORT
int
ma_speex_resampler_get_expected_output_frame_count
(
SpeexResamplerState
*
st
,
spx_uint64_t
in_len
,
spx_uint64_t
*
out_len
)
{
spx_uint64_t
count
;
spx_uint64_t
last_sample
;
spx_uint32_t
samp_frac_num
;
if
(
st
==
NULL
||
out_len
==
NULL
)
{
return
RESAMPLER_ERR_INVALID_ARG
;
}
*
out_len
=
0
;
if
(
out_len
==
0
)
{
return
RESAMPLER_ERR_SUCCESS
;
/* Nothing to do. */
}
/* miniaudio only uses interleaved APIs so we can safely just use channel index 0 for the calculations. */
if
(
st
->
nb_channels
==
0
)
{
return
RESAMPLER_ERR_BAD_STATE
;
}
count
=
0
;
last_sample
=
st
->
last_sample
[
0
];
samp_frac_num
=
st
->
samp_frac_num
[
0
];
while
(
!
(
last_sample
>=
in_len
))
{
count
+=
1
;
last_sample
+=
st
->
int_advance
;
samp_frac_num
+=
st
->
frac_advance
;
if
(
samp_frac_num
>=
st
->
den_rate
)
{
samp_frac_num
-=
st
->
den_rate
;
last_sample
+=
1
;
}
}
*
out_len
=
count
;
return
RESAMPLER_ERR_SUCCESS
;
}
#endif
#endif
\ No newline at end of file
research/ma_resampler.h
View file @
867e1ee7
...
@@ -802,8 +802,13 @@ ma_uint64 ma_resampler_get_expected_output_frame_count(ma_resampler* pResampler,
...
@@ -802,8 +802,13 @@ ma_uint64 ma_resampler_get_expected_output_frame_count(ma_resampler* pResampler,
case
ma_resample_algorithm_speex
:
case
ma_resample_algorithm_speex
:
{
{
#if defined(MA_HAS_SPEEX_RESAMPLER)
#if defined(MA_HAS_SPEEX_RESAMPLER)
/* TODO: Implement me. */
ma_uint64
count
;
return
0
;
int
speexErr
=
ma_speex_resampler_get_expected_output_frame_count
((
SpeexResamplerState
*
)
pResampler
->
state
.
speex
.
pSpeexResamplerState
,
inputFrameCount
,
&
count
);
if
(
speexErr
!=
RESAMPLER_ERR_SUCCESS
)
{
return
0
;
}
return
count
;
#else
#else
break
;
break
;
#endif
#endif
...
...
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