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
50786617
Commit
50786617
authored
Apr 26, 2021
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA: Add some debug output.
parent
8dc54984
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
miniaudio.h
miniaudio.h
+35
-4
No files found.
miniaudio.h
View file @
50786617
...
...
@@ -20689,19 +20689,33 @@ static ma_result ma_device_start__alsa(ma_device* pDevice)
static ma_result ma_device_stop__alsa(ma_device* pDevice)
{
#if 1
if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) {
((ma_snd_pcm_drain_proc)pDevice->pContext->alsa.snd_pcm_drain)((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture);
#ifdef MA_DEBUG_OUTPUT
printf("[ALSA] Dropping capture device... ");
#endif
((ma_snd_pcm_drop_proc)pDevice->pContext->alsa.snd_pcm_drop)((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture);
#ifdef MA_DEBUG_OUTPUT
printf("Done\n");
#endif
/* We need to prepare the device again, otherwise we won't be able to restart the device. */
if (((ma_snd_pcm_prepare_proc)pDevice->pContext->alsa.snd_pcm_prepare)((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture) < 0) {
#ifdef MA_DEBUG_OUTPUT
printf("[ALSA] Failed to prepare capture device after stopping.\n
");
printf("[ALSA] Preparing capture device...
");
#endif
if (((ma_snd_pcm_prepare_proc)pDevice->pContext->alsa.snd_pcm_prepare)((ma_snd_pcm_t*)pDevice->alsa.pPCMCapture) < 0) {
#ifdef MA_DEBUG_OUTPUT
printf("[ALSA] Failed to prepare capture device after stopping.\n");
#endif
} else {
#ifdef MA_DEBUG_OUTPUT
printf("Done\n");
#endif
}
}
if (pDevice->type == ma_device_type_playback || pDevice->type == ma_device_type_duplex) {
((ma_snd_pcm_dr
ain_proc)pDevice->pContext->alsa.snd_pcm_drain
)((ma_snd_pcm_t*)pDevice->alsa.pPCMPlayback);
((ma_snd_pcm_dr
op_proc)pDevice->pContext->alsa.snd_pcm_drop
)((ma_snd_pcm_t*)pDevice->alsa.pPCMPlayback);
/* We need to prepare the device again, otherwise we won't be able to restart the device. */
if (((ma_snd_pcm_prepare_proc)pDevice->pContext->alsa.snd_pcm_prepare)((ma_snd_pcm_t*)pDevice->alsa.pPCMPlayback) < 0) {
...
...
@@ -20710,6 +20724,10 @@ static ma_result ma_device_stop__alsa(ma_device* pDevice)
#endif
}
}
#else
/* Nothing to do. We'll stop the device by simply not reading or writing. */
(void)pDevice;
#endif
return MA_SUCCESS;
}
...
...
@@ -20732,6 +20750,11 @@ static ma_result ma_device_wait__alsa(ma_device* pDevice, ma_snd_pcm_t* pPCM, st
if ((pPollDescriptors[0].revents & POLLIN) != 0) {
ma_uint64 t;
read(pPollDescriptors[0].fd, &t, sizeof(t)); /* <-- Important that we read here so that the next write() does not block. */
#ifdef MA_DEBUG_OUTPUT
printf("[ALSA] POLLIN set for wakeupfd\n");
#endif
return MA_DEVICE_NOT_STARTED;
}
...
...
@@ -20891,6 +20914,10 @@ static ma_result ma_device_data_loop_wakeup__alsa(ma_device* pDevice)
MA_ASSERT(pDevice != NULL);
#ifdef MA_DEBUG_OUTPUT
printf("[ALSA] Waking up... ");
#endif
/* Write to an eventfd to trigger a wakeup from poll() and abort any reading or writing. */
if (pDevice->alsa.pPollDescriptorsCapture != NULL) {
write(pDevice->alsa.wakeupfdCapture, &t, sizeof(t));
...
...
@@ -20899,6 +20926,10 @@ static ma_result ma_device_data_loop_wakeup__alsa(ma_device* pDevice)
write(pDevice->alsa.wakeupfdPlayback, &t, sizeof(t));
}
#ifdef MA_DEBUG_OUTPUT
printf("Done\n");
#endif
return MA_SUCCESS;
}
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