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
3dbaa472
Commit
3dbaa472
authored
Nov 10, 2017
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Fix a bug with hardware params.
The buffer size should be set before periods.
parent
eb0e94fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
10 deletions
+9
-10
mini_al.h
mini_al.h
+9
-10
No files found.
mini_al.h
View file @
3dbaa472
...
@@ -5838,7 +5838,6 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
...
@@ -5838,7 +5838,6 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
}
}
// Hardware parameters.
// Hardware parameters.
snd_pcm_hw_params_t
*
pHWParams
=
(
snd_pcm_hw_params_t
*
)
alloca
(((
mal_snd_pcm_hw_params_sizeof_proc
)
pContext
->
alsa
.
snd_pcm_hw_params_sizeof
)());
snd_pcm_hw_params_t
*
pHWParams
=
(
snd_pcm_hw_params_t
*
)
alloca
(((
mal_snd_pcm_hw_params_sizeof_proc
)
pContext
->
alsa
.
snd_pcm_hw_params_sizeof
)());
mal_zero_memory
(
pHWParams
,
((
mal_snd_pcm_hw_params_sizeof_proc
)
pContext
->
alsa
.
snd_pcm_hw_params_sizeof
)());
mal_zero_memory
(
pHWParams
,
((
mal_snd_pcm_hw_params_sizeof_proc
)
pContext
->
alsa
.
snd_pcm_hw_params_sizeof
)());
...
@@ -5948,14 +5947,6 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
...
@@ -5948,14 +5947,6 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
pDevice
->
internalSampleRate
=
sampleRate
;
pDevice
->
internalSampleRate
=
sampleRate
;
// Buffer Size
snd_pcm_uframes_t
actualBufferSize
=
pDevice
->
bufferSizeInFrames
;
if
(((
mal_snd_pcm_hw_params_set_buffer_size_near_proc
)
pContext
->
alsa
.
snd_pcm_hw_params_set_buffer_size_near
)((
snd_pcm_t
*
)
pDevice
->
alsa
.
pPCM
,
pHWParams
,
&
actualBufferSize
)
<
0
)
{
mal_device_uninit__alsa
(
pDevice
);
return
mal_post_error
(
pDevice
,
"[ALSA] Failed to set buffer size for device. snd_pcm_hw_params_set_buffer_size() failed."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
pDevice
->
bufferSizeInFrames
=
actualBufferSize
;
// Periods.
// Periods.
mal_uint32
periods
=
pConfig
->
periods
;
mal_uint32
periods
=
pConfig
->
periods
;
int
dir
=
0
;
int
dir
=
0
;
...
@@ -5965,7 +5956,15 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
...
@@ -5965,7 +5956,15 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
}
}
pDevice
->
periods
=
periods
;
pDevice
->
periods
=
periods
;
// Buffer Size
snd_pcm_uframes_t
actualBufferSize
=
pDevice
->
bufferSizeInFrames
;
if
(((
mal_snd_pcm_hw_params_set_buffer_size_near_proc
)
pContext
->
alsa
.
snd_pcm_hw_params_set_buffer_size_near
)((
snd_pcm_t
*
)
pDevice
->
alsa
.
pPCM
,
pHWParams
,
&
actualBufferSize
)
<
0
)
{
mal_device_uninit__alsa
(
pDevice
);
return
mal_post_error
(
pDevice
,
"[ALSA] Failed to set buffer size for device. snd_pcm_hw_params_set_buffer_size() failed."
,
MAL_FORMAT_NOT_SUPPORTED
);
}
pDevice
->
bufferSizeInFrames
=
actualBufferSize
;
// Apply hardware parameters.
// Apply hardware parameters.
if
(((
mal_snd_pcm_hw_params_proc
)
pContext
->
alsa
.
snd_pcm_hw_params
)((
snd_pcm_t
*
)
pDevice
->
alsa
.
pPCM
,
pHWParams
)
<
0
)
{
if
(((
mal_snd_pcm_hw_params_proc
)
pContext
->
alsa
.
snd_pcm_hw_params
)((
snd_pcm_t
*
)
pDevice
->
alsa
.
pPCM
,
pHWParams
)
<
0
)
{
mal_device_uninit__alsa
(
pDevice
);
mal_device_uninit__alsa
(
pDevice
);
...
@@ -6013,7 +6012,7 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
...
@@ -6013,7 +6012,7 @@ static mal_result mal_device_init__alsa(mal_context* pContext, mal_device_type t
}
}
// Grab the internal channel map. For now we're not going to bother trying to change the channel map and
// Grab the internal channel map. For now we're not going to bother trying to change the channel map and
// instead just do it ourselves.
// instead just do it ourselves.
snd_pcm_chmap_t
*
pChmap
=
((
mal_snd_pcm_get_chmap_proc
)
pContext
->
alsa
.
snd_pcm_get_chmap
)((
snd_pcm_t
*
)
pDevice
->
alsa
.
pPCM
);
snd_pcm_chmap_t
*
pChmap
=
((
mal_snd_pcm_get_chmap_proc
)
pContext
->
alsa
.
snd_pcm_get_chmap
)((
snd_pcm_t
*
)
pDevice
->
alsa
.
pPCM
);
...
...
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