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
d020f0c5
Commit
d020f0c5
authored
May 21, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some helpers for initializing an SRC config.
parent
c1039586
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
7 deletions
+35
-7
mini_al.h
mini_al.h
+35
-7
No files found.
mini_al.h
View file @
d020f0c5
...
@@ -2132,6 +2132,10 @@ mal_result mal_src_set_output_sample_rate(mal_src* pSRC, mal_uint32 sampleRateOu
...
@@ -2132,6 +2132,10 @@ mal_result mal_src_set_output_sample_rate(mal_src* pSRC, mal_uint32 sampleRateOu
mal_uint64
mal_src_read_deinterleaved
(
mal_src
*
pSRC
,
mal_uint64
frameCount
,
void
**
ppSamplesOut
,
void
*
pUserData
);
mal_uint64
mal_src_read_deinterleaved
(
mal_src
*
pSRC
,
mal_uint64
frameCount
,
void
**
ppSamplesOut
,
void
*
pUserData
);
// Helper for creating a sample rate conversion config.
mal_src_config
mal_src_config_init_new
();
mal_src_config
mal_src_config_init
(
mal_uint32
sampleRateIn
,
mal_uint32
sampleRateOut
,
mal_uint32
channels
,
mal_src_read_deinterleaved_proc
onReadDeinterleaved
,
void
*
pUserData
);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
...
@@ -19937,6 +19941,27 @@ mal_uint64 mal_src_read_deinterleaved__linear(mal_src* pSRC, mal_uint64 frameCou
...
@@ -19937,6 +19941,27 @@ mal_uint64 mal_src_read_deinterleaved__linear(mal_src* pSRC, mal_uint64 frameCou
}
}
mal_src_config
mal_src_config_init_new
()
{
mal_src_config
config
;
mal_zero_object
(
&
config
);
return
config
;
}
mal_src_config
mal_src_config_init
(
mal_uint32
sampleRateIn
,
mal_uint32
sampleRateOut
,
mal_uint32
channels
,
mal_src_read_deinterleaved_proc
onReadDeinterleaved
,
void
*
pUserData
)
{
mal_src_config
config
=
mal_src_config_init_new
();
config
.
sampleRateIn
=
sampleRateIn
;
config
.
sampleRateOut
=
sampleRateOut
;
config
.
channels
=
channels
;
config
.
onReadDeinterleaved
=
onReadDeinterleaved
;
config
.
pUserData
=
pUserData
;
return
config
;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//
// Sinc Sample Rate Conversion
// Sinc Sample Rate Conversion
...
@@ -20411,6 +20436,7 @@ mal_result mal_dsp_init(const mal_dsp_config* pConfig, mal_dsp* pDSP)
...
@@ -20411,6 +20436,7 @@ mal_result mal_dsp_init(const mal_dsp_config* pConfig, mal_dsp* pDSP)
preFormatConverterConfig
.
streamFormatOut
=
mal_stream_format_pcm
;
preFormatConverterConfig
.
streamFormatOut
=
mal_stream_format_pcm
;
preFormatConverterConfig
.
onRead
=
mal_dsp__pre_format_converter_on_read
;
preFormatConverterConfig
.
onRead
=
mal_dsp__pre_format_converter_on_read
;
preFormatConverterConfig
.
pUserData
=
pDSP
;
preFormatConverterConfig
.
pUserData
=
pDSP
;
result
=
mal_format_converter_init
(
&
preFormatConverterConfig
,
&
pDSP
->
formatConverterIn
);
result
=
mal_format_converter_init
(
&
preFormatConverterConfig
,
&
pDSP
->
formatConverterIn
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
return
result
;
return
result
;
...
@@ -20444,15 +20470,16 @@ mal_result mal_dsp_init(const mal_dsp_config* pConfig, mal_dsp* pDSP)
...
@@ -20444,15 +20470,16 @@ mal_result mal_dsp_init(const mal_dsp_config* pConfig, mal_dsp* pDSP)
// SRC
// SRC
{
{
mal_src_config
srcConfig
;
mal_src_config
srcConfig
=
mal_src_config_init
(
mal_zero_object
(
&
srcConfig
);
pConfig
->
sampleRateIn
,
srcConfig
.
sampleRateIn
=
pConfig
->
sampleRateIn
;
pConfig
->
sampleRateOut
,
srcConfig
.
sampleRateOut
=
pConfig
->
sampleRateOut
;
((
pConfig
->
channelsIn
<
pConfig
->
channelsOut
)
?
pConfig
->
channelsIn
:
pConfig
->
channelsOut
),
srcConfig
.
channels
=
(
pConfig
->
channelsIn
<
pConfig
->
channelsOut
)
?
pConfig
->
channelsIn
:
pConfig
->
channelsOut
;
mal_dsp__src_on_read_deinterleaved
,
pDSP
);
srcConfig
.
algorithm
=
pConfig
->
srcAlgorithm
;
srcConfig
.
algorithm
=
pConfig
->
srcAlgorithm
;
srcConfig
.
onReadDeinterleaved
=
mal_dsp__src_on_read_deinterleaved
;
srcConfig
.
pUserData
=
pDSP
;
mal_copy_memory
(
&
srcConfig
.
sinc
,
&
pConfig
->
sinc
,
sizeof
(
pConfig
->
sinc
));
mal_copy_memory
(
&
srcConfig
.
sinc
,
&
pConfig
->
sinc
,
sizeof
(
pConfig
->
sinc
));
result
=
mal_src_init
(
&
srcConfig
,
&
pDSP
->
src
);
result
=
mal_src_init
(
&
srcConfig
,
&
pDSP
->
src
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
return
result
;
return
result
;
...
@@ -20469,6 +20496,7 @@ mal_result mal_dsp_init(const mal_dsp_config* pConfig, mal_dsp* pDSP)
...
@@ -20469,6 +20496,7 @@ mal_result mal_dsp_init(const mal_dsp_config* pConfig, mal_dsp* pDSP)
pConfig
->
channelMixMode
,
pConfig
->
channelMixMode
,
mal_dsp__channel_router_on_read_deinterleaved
,
mal_dsp__channel_router_on_read_deinterleaved
,
pDSP
);
pDSP
);
result
=
mal_channel_router_init
(
&
routerConfig
,
&
pDSP
->
channelRouter
);
result
=
mal_channel_router_init
(
&
routerConfig
,
&
pDSP
->
channelRouter
);
if
(
result
!=
MAL_SUCCESS
)
{
if
(
result
!=
MAL_SUCCESS
)
{
return
result
;
return
result
;
...
...
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