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
0c50484b
Commit
0c50484b
authored
Feb 25, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add mal_dsp_set_input_sample_rate().
parent
6978ab26
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
11 deletions
+33
-11
mini_al.h
mini_al.h
+33
-11
No files found.
mini_al.h
View file @
0c50484b
...
...
@@ -1471,6 +1471,9 @@ mal_uint64 mal_src_read_frames_ex(mal_src* pSRC, mal_uint64 frameCount, void* pF
// Initializes a DSP object.
mal_result
mal_dsp_init
(
mal_dsp_config
*
pConfig
,
mal_dsp_read_proc
onRead
,
void
*
pUserData
,
mal_dsp
*
pDSP
);
// Dynamically adjusts the input sample rate.
mal_result
mal_dsp_set_input_sample_rate
(
mal_dsp
*
pDSP
,
mal_uint32
sampleRateOut
);
// Dynamically adjusts the output sample rate.
//
// This is useful for dynamically adjust pitch. Keep in mind, however, that this will speed up or slow down the sound. If this
...
...
@@ -11332,22 +11335,15 @@ mal_result mal_dsp_init(mal_dsp_config* pConfig, mal_dsp_read_proc onRead, void*
return
MAL_SUCCESS
;
}
mal_result
mal_dsp_set_output_sample_rate
(
mal_dsp
*
pDSP
,
mal_uint32
sampleRateOut
)
{
if
(
pDSP
==
NULL
)
return
MAL_INVALID_ARGS
;
// Must have a sample rate of > 0.
if
(
sampleRateOut
==
0
)
{
return
MAL_INVALID_ARGS
;
}
pDSP
->
config
.
sampleRateOut
=
sampleRateOut
;
mal_result
mal_dsp_refresh_sample_rate
(
mal_dsp
*
pDSP
)
{
// If we already have an SRC pipeline initialized we do _not_ want to re-create it. Instead we adjust it. If we didn't previously
// have an SRC pipeline in place we'll need to initialize it.
if
(
pDSP
->
isSRCRequired
)
{
if
(
pDSP
->
config
.
sampleRateIn
!=
pDSP
->
config
.
sampleRateOut
)
{
mal_src_set_output_sample_rate
(
&
pDSP
->
src
,
sampleRateOut
);
mal_src_set_input_sample_rate
(
&
pDSP
->
src
,
pDSP
->
config
.
sampleRateIn
);
mal_src_set_output_sample_rate
(
&
pDSP
->
src
,
pDSP
->
config
.
sampleRateOut
);
}
else
{
pDSP
->
isSRCRequired
=
MAL_FALSE
;
}
...
...
@@ -11383,6 +11379,32 @@ mal_result mal_dsp_set_output_sample_rate(mal_dsp* pDSP, mal_uint32 sampleRateOu
return
MAL_SUCCESS
;
}
mal_result
mal_dsp_set_input_sample_rate
(
mal_dsp
*
pDSP
,
mal_uint32
sampleRateIn
)
{
if
(
pDSP
==
NULL
)
return
MAL_INVALID_ARGS
;
// Must have a sample rate of > 0.
if
(
sampleRateIn
==
0
)
{
return
MAL_INVALID_ARGS
;
}
pDSP
->
config
.
sampleRateIn
=
sampleRateIn
;
return
mal_dsp_refresh_sample_rate
(
pDSP
);
}
mal_result
mal_dsp_set_output_sample_rate
(
mal_dsp
*
pDSP
,
mal_uint32
sampleRateOut
)
{
if
(
pDSP
==
NULL
)
return
MAL_INVALID_ARGS
;
// Must have a sample rate of > 0.
if
(
sampleRateOut
==
0
)
{
return
MAL_INVALID_ARGS
;
}
pDSP
->
config
.
sampleRateOut
=
sampleRateOut
;
return
mal_dsp_refresh_sample_rate
(
pDSP
);
}
mal_uint64
mal_dsp_read_frames
(
mal_dsp
*
pDSP
,
mal_uint64
frameCount
,
void
*
pFramesOut
)
{
return
mal_dsp_read_frames_ex
(
pDSP
,
frameCount
,
pFramesOut
,
MAL_FALSE
);
...
...
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