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
1e3c8faf
Commit
1e3c8faf
authored
Aug 11, 2018
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up.
parent
d5530a46
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
57 deletions
+12
-57
mini_al.h
mini_al.h
+12
-57
No files found.
mini_al.h
View file @
1e3c8faf
...
@@ -9823,7 +9823,10 @@ mal_uint32 mal_device__wait_for_frames__alsa(mal_device* pDevice, mal_bool32* pR
...
@@ -9823,7 +9823,10 @@ mal_uint32 mal_device__wait_for_frames__alsa(mal_device* pDevice, mal_bool32* pR
return 0;
return 0;
}
}
if (pRequiresRestart) *pRequiresRestart = MAL_TRUE; // A device recovery means a restart for mmap mode.
// A device recovery means a restart for mmap mode.
if (pRequiresRestart) {
*pRequiresRestart = MAL_TRUE;
}
// Try again, but if it fails this time just return an error.
// Try again, but if it fails this time just return an error.
framesAvailable = ((mal_snd_pcm_avail_update_proc)pDevice->pContext->alsa.snd_pcm_avail_update)((mal_snd_pcm_t*)pDevice->alsa.pPCM);
framesAvailable = ((mal_snd_pcm_avail_update_proc)pDevice->pContext->alsa.snd_pcm_avail_update)((mal_snd_pcm_t*)pDevice->alsa.pPCM);
...
@@ -9846,64 +9849,14 @@ mal_uint32 mal_device__wait_for_frames__alsa(mal_device* pDevice, mal_bool32* pR
...
@@ -9846,64 +9849,14 @@ mal_uint32 mal_device__wait_for_frames__alsa(mal_device* pDevice, mal_bool32* pR
return 0;
return 0;
}
}
if (pRequiresRestart) *pRequiresRestart = MAL_TRUE; // A device recovery means a restart for mmap mode.
// A device recovery means a restart for mmap mode.
}
if (pRequiresRestart) {
}
*pRequiresRestart = MAL_TRUE;
}
}
#if 0
while (!pDevice->alsa.breakFromMainLoop) {
int waitResult = ((mal_snd_pcm_wait_proc)pDevice->pContext->alsa.snd_pcm_wait)((mal_snd_pcm_t*)pDevice->alsa.pPCM, -1);
if (waitResult < 0) {
if (waitResult == -EPIPE) {
if (((mal_snd_pcm_recover_proc)pDevice->pContext->alsa.snd_pcm_recover)((mal_snd_pcm_t*)pDevice->alsa.pPCM, waitResult, MAL_TRUE) < 0) {
return 0;
}
if (pRequiresRestart) *pRequiresRestart = MAL_TRUE; // A device recovery means a restart for mmap mode.
}
}
if (pDevice->alsa.breakFromMainLoop) {
return 0;
}
mal_snd_pcm_sframes_t framesAvailable = ((mal_snd_pcm_avail_update_proc)pDevice->pContext->alsa.snd_pcm_avail_update)((mal_snd_pcm_t*)pDevice->alsa.pPCM);
if (framesAvailable < 0) {
if (framesAvailable == -EPIPE) {
if (((mal_snd_pcm_recover_proc)pDevice->pContext->alsa.snd_pcm_recover)((mal_snd_pcm_t*)pDevice->alsa.pPCM, framesAvailable, MAL_TRUE) < 0) {
return 0;
}
if (pRequiresRestart) *pRequiresRestart = MAL_TRUE; // A device recovery means a restart for mmap mode.
// Try again, but if it fails this time just return an error.
framesAvailable = ((mal_snd_pcm_avail_update_proc)pDevice->pContext->alsa.snd_pcm_avail_update)((mal_snd_pcm_t*)pDevice->alsa.pPCM);
if (framesAvailable < 0) {
return 0;
}
}
}
}
}
}
// Ideally I'd like to keep the number of frames consistent with the period size, but unfortunately it appears
// this does not work correctly in some situations. In my testing, this breaks when the period size is <= 1024
// when using "hw:0,0" in a VirtualBox guest. What's happening is that it looks like snd_pcm_writei() (and
// snd_pcm_mmap_commit() in MMAP mode) are not physically writing the data to the internal buffers. As a result,
// snd_pcm_wait() is returning immediately, always reporting the full buffer size as available. I'm not sure if
// this is me not doing something right, or if it's some kind of driver bug, but to fix this we just need to
// report the exact value returned by snd_pcm_avail_update() and not clamp it to the period size.
#if 1
return framesAvailable;
#else
mal_uint32 periodSizeInFrames = pDevice->bufferSizeInFrames / pDevice->periods;
if (framesAvailable >= periodSizeInFrames) {
return periodSizeInFrames;
}
}
#endif
}
}
#endif
// We'll get here if the loop was terminated. Just return whatever's available.
// We'll get here if the loop was terminated. Just return whatever's available.
mal_snd_pcm_sframes_t framesAvailable = ((mal_snd_pcm_avail_update_proc)pDevice->pContext->alsa.snd_pcm_avail_update)((mal_snd_pcm_t*)pDevice->alsa.pPCM);
mal_snd_pcm_sframes_t framesAvailable = ((mal_snd_pcm_avail_update_proc)pDevice->pContext->alsa.snd_pcm_avail_update)((mal_snd_pcm_t*)pDevice->alsa.pPCM);
...
@@ -27191,6 +27144,8 @@ mal_uint64 mal_sine_wave_read(mal_sine_wave* pSineWave, mal_uint64 count, float*
...
@@ -27191,6 +27144,8 @@ mal_uint64 mal_sine_wave_read(mal_sine_wave* pSineWave, mal_uint64 count, float*
// - Add support for specifying the size of a device's buffer in milliseconds. You can still set the buffer size in
// - Add support for specifying the size of a device's buffer in milliseconds. You can still set the buffer size in
// frames if that suits you. When bufferSizeInFrames is 0, bufferSizeInMilliseconds will be used. If both are non-0
// frames if that suits you. When bufferSizeInFrames is 0, bufferSizeInMilliseconds will be used. If both are non-0
// then bufferSizeInFrames will take priority. If both are set to 0 the default buffer size is used.
// then bufferSizeInFrames will take priority. If both are set to 0 the default buffer size is used.
// - Fix a bug with the ALSA backend that was causing problems on Raspberry Pi. This significantly improves the
// Raspberry Pi experience.
// - Fix a bug where an incorrect number of samples is returned from sinc resampling.
// - Fix a bug where an incorrect number of samples is returned from sinc resampling.
// - Add support for setting the value to be passed to internal calls to CoInitializeEx().
// - Add support for setting the value to be passed to internal calls to CoInitializeEx().
//
//
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