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
a38fe4a0
Commit
a38fe4a0
authored
Sep 30, 2019
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WASAPI: Correctly handle AUDCLNT_BUFFERFLAGS_SILENT.
parent
c69b1e48
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
8 deletions
+42
-8
miniaudio.h
miniaudio.h
+42
-8
No files found.
miniaudio.h
View file @
a38fe4a0
...
@@ -5715,10 +5715,17 @@ ma_uint32 ma_device__pcm_converter__on_read_from_buffer_capture(ma_pcm_converter
...
@@ -5715,10 +5715,17 @@ ma_uint32 ma_device__pcm_converter__on_read_from_buffer_capture(ma_pcm_converter
}
}
bytesToRead = framesToRead * ma_get_bytes_per_frame(pConverter->formatConverterIn.config.formatIn, pConverter->channelRouter.config.channelsIn);
bytesToRead = framesToRead * ma_get_bytes_per_frame(pConverter->formatConverterIn.config.formatIn, pConverter->channelRouter.config.channelsIn);
ma_copy_memory(pFramesOut, pDevice->capture._dspFrames, bytesToRead);
pDevice->capture._dspFrameCount -= framesToRead;
pDevice->capture._dspFrames += bytesToRead;
/* pDevice->capture._dspFrames can be null in which case it should be treated as silence. */
if (pDevice->capture._dspFrames != NULL) {
ma_copy_memory(pFramesOut, pDevice->capture._dspFrames, bytesToRead);
pDevice->capture._dspFrames += bytesToRead;
} else {
ma_zero_memory(pFramesOut, bytesToRead);
}
pDevice->capture._dspFrameCount -= framesToRead;
return framesToRead;
return framesToRead;
}
}
...
@@ -5740,10 +5747,17 @@ ma_uint32 ma_device__pcm_converter__on_read_from_buffer_playback(ma_pcm_converte
...
@@ -5740,10 +5747,17 @@ ma_uint32 ma_device__pcm_converter__on_read_from_buffer_playback(ma_pcm_converte
}
}
bytesToRead = framesToRead * ma_get_bytes_per_frame(pConverter->formatConverterIn.config.formatIn, pConverter->channelRouter.config.channelsIn);
bytesToRead = framesToRead * ma_get_bytes_per_frame(pConverter->formatConverterIn.config.formatIn, pConverter->channelRouter.config.channelsIn);
ma_copy_memory(pFramesOut, pDevice->playback._dspFrames, bytesToRead);
pDevice->playback._dspFrameCount -= framesToRead;
pDevice->playback._dspFrames += bytesToRead;
/* pDevice->playback._dspFrames can be null in which case it should be treated as silence. */
if (pDevice->playback._dspFrames != NULL) {
ma_copy_memory(pFramesOut, pDevice->playback._dspFrames, bytesToRead);
pDevice->playback._dspFrames += bytesToRead;
} else {
ma_zero_memory(pFramesOut, bytesToRead);
}
pDevice->playback._dspFrameCount -= framesToRead;
return framesToRead;
return framesToRead;
}
}
...
@@ -6918,6 +6932,8 @@ WASAPI Backend
...
@@ -6918,6 +6932,8 @@ WASAPI Backend
#endif /* 0 */
#endif /* 0 */
/* Some compilers don't define VerifyVersionInfoW. Need to write this ourselves. */
/* Some compilers don't define VerifyVersionInfoW. Need to write this ourselves. */
#define MA_WIN32_WINNT_VISTA 0x0600
#define MA_WIN32_WINNT_VISTA 0x0600
#define MA_VER_MINORVERSION 0x01
#define MA_VER_MINORVERSION 0x01
...
@@ -7027,6 +7043,11 @@ typedef ma_int64 MA_REFERENCE_TIME;
...
@@ -7027,6 +7043,11 @@ typedef ma_int64 MA_REFERENCE_TIME;
#define MA_AUDCLNT_S_BUFFER_EMPTY (143196161)
#define MA_AUDCLNT_S_BUFFER_EMPTY (143196161)
#define MA_AUDCLNT_E_DEVICE_IN_USE (-2004287478)
#define MA_AUDCLNT_E_DEVICE_IN_USE (-2004287478)
/* Buffer flags. */
#define MA_AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY 1
#define MA_AUDCLNT_BUFFERFLAGS_SILENT 2
#define MA_AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR 4
typedef enum
typedef enum
{
{
ma_eRender = 0,
ma_eRender = 0,
...
@@ -9137,17 +9158,30 @@ ma_result ma_device_main_loop__wasapi(ma_device* pDevice)
...
@@ -9137,17 +9158,30 @@ ma_result ma_device_main_loop__wasapi(ma_device* pDevice)
break;
break;
}
}
/* TODO: How do we handle the capture flags returned by GetBuffer()? In particular, AUDCLNT_BUFFERFLAGS_SILENT (1). */
/*
Debug output for IAudioCaptureClient_GetBuffer(). The flagsCapture variable will contain information. A glitch will occur when
AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY (1) is set.
*/
#ifdef MA_DEBUG_OUTPUT
#ifdef MA_DEBUG_OUTPUT
if (flagsCapture != 0) {
if (flagsCapture != 0) {
printf("[WASAPI] Capture Flags: %d\n", flagsCapture);
printf("[WASAPI] Capture Flags: %d\n", flagsCapture);
}
}
#endif
#endif
if ((flagsCapture & MA_AUDCLNT_BUFFERFLAGS_DATA_DISCONTINUITY) == 0) {
/* Glitched. Probably due to an overrun. */
}
mappedBufferFramesRemainingCapture = mappedBufferSizeInFramesCapture;
mappedBufferFramesRemainingCapture = mappedBufferSizeInFramesCapture;
pDevice->capture._dspFrameCount = mappedBufferSizeInFramesCapture;
pDevice->capture._dspFrameCount = mappedBufferSizeInFramesCapture;
pDevice->capture._dspFrames = (const ma_uint8*)pMappedBufferCapture;
if ((flagsCapture & MA_AUDCLNT_BUFFERFLAGS_SILENT) == 0) {
pDevice->capture._dspFrames = (const ma_uint8*)pMappedBufferCapture;
} else {
pDevice->capture._dspFrames = NULL;
}
}
}
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