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
8dc54984
Commit
8dc54984
authored
Apr 26, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Improvements to reading and writing logic.
Public issue
https://github.com/mackron/miniaudio/issues/291
parent
db53bdfc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
miniaudio.h
miniaudio.h
+6
-12
No files found.
miniaudio.h
View file @
8dc54984
...
@@ -20778,7 +20778,7 @@ static ma_result ma_device_read__alsa(ma_device* pDevice, void* pFramesOut, ma_u
...
@@ -20778,7 +20778,7 @@ static ma_result ma_device_read__alsa(ma_device* pDevice, void* pFramesOut, ma_u
*pFramesRead = 0;
*pFramesRead = 0;
}
}
for (;;
) {
while (ma_device_get_state(pDevice) == MA_STATE_STARTED
) {
ma_result result;
ma_result result;
/* The first thing to do is wait for data to become available for reading. This will return an error code if the device has been stopped. */
/* The first thing to do is wait for data to become available for reading. This will return an error code if the device has been stopped. */
...
@@ -20811,10 +20811,7 @@ static ma_result ma_device_read__alsa(ma_device* pDevice, void* pFramesOut, ma_u
...
@@ -20811,10 +20811,7 @@ static ma_result ma_device_read__alsa(ma_device* pDevice, void* pFramesOut, ma_u
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to start device after underrun.", ma_result_from_errno((int)-resultALSA));
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to start device after underrun.", ma_result_from_errno((int)-resultALSA));
}
}
resultALSA = ((ma_snd_pcm_readi_proc)pDevice->pContext->alsa.snd_pcm_readi)((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture, pFramesOut, frameCount);
continue; /* Try reading again. */
if (resultALSA < 0) {
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to read data from the internal device.", ma_result_from_errno((int)-resultALSA));
}
}
}
}
}
}
}
...
@@ -20837,7 +20834,7 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames,
...
@@ -20837,7 +20834,7 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames,
*pFramesWritten = 0;
*pFramesWritten = 0;
}
}
for (;;
) {
while (ma_device_get_state(pDevice) == MA_STATE_STARTED
) {
ma_result result;
ma_result result;
/* The first thing to do is wait for space to become available for writing. This will return an error code if the device has been stopped. */
/* The first thing to do is wait for space to become available for writing. This will return an error code if the device has been stopped. */
...
@@ -20859,8 +20856,8 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames,
...
@@ -20859,8 +20856,8 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames,
#endif
#endif
/* Underrun. Recover and try again. If this fails we need to return an error. */
/* Underrun. Recover and try again. If this fails we need to return an error. */
resultALSA = ((ma_snd_pcm_recover_proc)pDevice->pContext->alsa.snd_pcm_recover)((ma_snd_pcm_t*)pDevice->alsa.pPCMPlayback, resultALSA, MA_TRUE);
resultALSA = ((ma_snd_pcm_recover_proc)pDevice->pContext->alsa.snd_pcm_recover)((ma_snd_pcm_t*)pDevice->alsa.pPCMPlayback, resultALSA, MA_TRUE);
/* MA_TRUE=silent (don't print anything on error). */
if (resultALSA < 0) {
/* MA_TRUE=silent (don't print anything on error). */
if (resultALSA < 0) {
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to recover device after underrun.", ma_result_from_errno((int)-resultALSA));
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to recover device after underrun.", ma_result_from_errno((int)-resultALSA));
}
}
...
@@ -20876,10 +20873,7 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames,
...
@@ -20876,10 +20873,7 @@ static ma_result ma_device_write__alsa(ma_device* pDevice, const void* pFrames,
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to start device after underrun.", ma_result_from_errno((int)-resultALSA));
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to start device after underrun.", ma_result_from_errno((int)-resultALSA));
}
}
resultALSA = ((ma_snd_pcm_writei_proc)pDevice->pContext->alsa.snd_pcm_writei)((ma_snd_pcm_t*)pDevice->alsa.pPCMPlayback, pFrames, frameCount);
continue; /* Try writing again. */
if (resultALSA < 0) {
return ma_post_error(pDevice, MA_LOG_LEVEL_ERROR, "[ALSA] Failed to write data to device after underrun.", ma_result_from_errno((int)-resultALSA));
}
}
}
}
}
}
}
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