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
3e8f261c
Commit
3e8f261c
authored
Jan 19, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor restructuring in preparation for some Speex work.
parent
6894d10d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
research/ma_resampler.h
research/ma_resampler.h
+10
-7
No files found.
research/ma_resampler.h
View file @
3e8f261c
...
@@ -56,7 +56,10 @@ typedef struct
...
@@ -56,7 +56,10 @@ typedef struct
}
x1
;
/* The next input frame. */
}
x1
;
/* The next input frame. */
ma_lpf
lpf
;
ma_lpf
lpf
;
}
linear
;
}
linear
;
void
*
pSpeex
;
/* SpeexResamplerState* */
struct
{
void
*
pSpeexResamplerState
;
/* SpeexResamplerState* */
}
speex
;
}
state
;
}
state
;
}
ma_resampler
;
}
ma_resampler
;
...
@@ -217,8 +220,8 @@ ma_result ma_resampler_init(const ma_resampler_config* pConfig, ma_resampler* pR
...
@@ -217,8 +220,8 @@ ma_result ma_resampler_init(const ma_resampler_config* pConfig, ma_resampler* pR
{
{
#if defined(MA_HAS_SPEEX_RESAMPLER)
#if defined(MA_HAS_SPEEX_RESAMPLER)
int
speexErr
;
int
speexErr
;
pResampler
->
state
.
pSpeex
=
speex_resampler_init
(
pConfig
->
channels
,
pConfig
->
sampleRateIn
,
pConfig
->
sampleRateOut
,
pConfig
->
speex
.
quality
,
&
speexErr
);
pResampler
->
state
.
speex
.
pSpeexResamplerState
=
speex_resampler_init
(
pConfig
->
channels
,
pConfig
->
sampleRateIn
,
pConfig
->
sampleRateOut
,
pConfig
->
speex
.
quality
,
&
speexErr
);
if
(
pResampler
->
state
.
pSpeex
==
NULL
)
{
if
(
pResampler
->
state
.
speex
.
pSpeexResamplerState
==
NULL
)
{
return
ma_result_from_speex_err
(
speexErr
);
return
ma_result_from_speex_err
(
speexErr
);
}
}
#else
#else
...
@@ -241,7 +244,7 @@ void ma_resampler_uninit(ma_resampler* pResampler)
...
@@ -241,7 +244,7 @@ void ma_resampler_uninit(ma_resampler* pResampler)
#if defined(MA_HAS_SPEEX_RESAMPLER)
#if defined(MA_HAS_SPEEX_RESAMPLER)
if
(
pResampler
->
config
.
algorithm
==
ma_resample_algorithm_speex
)
{
if
(
pResampler
->
config
.
algorithm
==
ma_resample_algorithm_speex
)
{
speex_resampler_destroy
(
pResampler
->
state
.
pSpeex
);
speex_resampler_destroy
(
pResampler
->
state
.
speex
.
pSpeexResamplerState
);
}
}
#endif
#endif
}
}
...
@@ -532,9 +535,9 @@ static ma_result ma_resampler_process__read__speex(ma_resampler* pResampler, con
...
@@ -532,9 +535,9 @@ static ma_result ma_resampler_process__read__speex(ma_resampler* pResampler, con
pFramesOutThisIteration
=
ma_offset_ptr
(
pFramesOut
,
framesProcessedOut
*
ma_get_bytes_per_frame
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
));
pFramesOutThisIteration
=
ma_offset_ptr
(
pFramesOut
,
framesProcessedOut
*
ma_get_bytes_per_frame
(
pResampler
->
config
.
format
,
pResampler
->
config
.
channels
));
if
(
pResampler
->
config
.
format
==
ma_format_f32
)
{
if
(
pResampler
->
config
.
format
==
ma_format_f32
)
{
speexErr
=
speex_resampler_process_interleaved_float
((
SpeexResamplerState
*
)
pResampler
->
state
.
pSpeex
,
pFramesInThisIteration
,
&
frameCountInThisIteration
,
pFramesOutThisIteration
,
&
frameCountOutThisIteration
);
speexErr
=
speex_resampler_process_interleaved_float
((
SpeexResamplerState
*
)
pResampler
->
state
.
speex
.
pSpeexResamplerState
,
pFramesInThisIteration
,
&
frameCountInThisIteration
,
pFramesOutThisIteration
,
&
frameCountOutThisIteration
);
}
else
if
(
pResampler
->
config
.
format
==
ma_format_s16
)
{
}
else
if
(
pResampler
->
config
.
format
==
ma_format_s16
)
{
speexErr
=
speex_resampler_process_interleaved_int
((
SpeexResamplerState
*
)
pResampler
->
state
.
pSpeex
,
pFramesInThisIteration
,
&
frameCountInThisIteration
,
pFramesOutThisIteration
,
&
frameCountOutThisIteration
);
speexErr
=
speex_resampler_process_interleaved_int
((
SpeexResamplerState
*
)
pResampler
->
state
.
speex
.
pSpeexResamplerState
,
pFramesInThisIteration
,
&
frameCountInThisIteration
,
pFramesOutThisIteration
,
&
frameCountOutThisIteration
);
}
else
{
}
else
{
/* Format not supported. Should never get here. */
/* Format not supported. Should never get here. */
MA_ASSERT
(
MA_FALSE
);
MA_ASSERT
(
MA_FALSE
);
...
@@ -640,7 +643,7 @@ ma_result ma_resampler_set_rate(ma_resampler* pResampler, ma_uint32 sampleRateIn
...
@@ -640,7 +643,7 @@ ma_result ma_resampler_set_rate(ma_resampler* pResampler, ma_uint32 sampleRateIn
case
ma_resample_algorithm_speex
:
case
ma_resample_algorithm_speex
:
{
{
#if defined(MA_HAS_SPEEX_RESAMPLER)
#if defined(MA_HAS_SPEEX_RESAMPLER)
return
ma_result_from_speex_err
(
speex_resampler_set_rate
((
SpeexResamplerState
*
)
pResampler
->
state
.
pSpeex
,
sampleRateIn
,
sampleRateOut
));
return
ma_result_from_speex_err
(
speex_resampler_set_rate
((
SpeexResamplerState
*
)
pResampler
->
state
.
speex
.
pSpeexResamplerState
,
sampleRateIn
,
sampleRateOut
));
#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