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
fb4cc866
Commit
fb4cc866
authored
Nov 13, 2016
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WASAPI: Add initial support for capture.
parent
16c3856d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
9 deletions
+43
-9
mini_al.h
mini_al.h
+43
-9
No files found.
mini_al.h
View file @
fb4cc866
...
...
@@ -1508,6 +1508,10 @@ static mal_result mal_device__main_loop__null(mal_device* pDevice)
return
MAL_FALSE
;
}
if
(
framesAvailable
+
pDevice
->
null_device
.
lastProcessedFrame
>
pDevice
->
bufferSizeInFrames
)
{
framesAvailable
=
pDevice
->
bufferSizeInFrames
-
pDevice
->
null_device
.
lastProcessedFrame
;
}
mal_uint32
sampleCount
=
framesAvailable
*
pDevice
->
channels
;
mal_uint32
lockOffset
=
pDevice
->
null_device
.
lastProcessedFrame
*
pDevice
->
channels
*
mal_get_sample_size_in_bytes
(
pDevice
->
format
);
mal_uint32
lockSize
=
sampleCount
*
mal_get_sample_size_in_bytes
(
pDevice
->
format
);
...
...
@@ -1864,6 +1868,7 @@ static mal_uint32 mal_device__get_available_frames__wasapi(mal_device* pDevice)
{
mal_assert
(
pDevice
!=
NULL
);
if
(
pDevice
->
type
==
mal_device_type_playback
)
{
UINT32
paddingFramesCount
;
HRESULT
hr
=
((
IAudioClient
*
)
pDevice
->
wasapi
.
pAudioClient
)
->
lpVtbl
->
GetCurrentPadding
((
IAudioClient
*
)
pDevice
->
wasapi
.
pAudioClient
,
&
paddingFramesCount
);
if
(
FAILED
(
hr
))
{
...
...
@@ -1871,6 +1876,15 @@ static mal_uint32 mal_device__get_available_frames__wasapi(mal_device* pDevice)
}
return
pDevice
->
bufferSizeInFrames
-
paddingFramesCount
;
}
else
{
UINT32
framesAvailable
;
HRESULT
hr
=
((
IAudioCaptureClient
*
)
pDevice
->
wasapi
.
pCaptureClient
)
->
lpVtbl
->
GetNextPacketSize
((
IAudioCaptureClient
*
)
pDevice
->
wasapi
.
pCaptureClient
,
&
framesAvailable
);
if
(
FAILED
(
hr
))
{
return
0
;
}
return
framesAvailable
;
}
}
static
mal_uint32
mal_device__wait_for_frames__wasapi
(
mal_device
*
pDevice
)
...
...
@@ -1924,7 +1938,26 @@ static mal_result mal_device__main_loop__wasapi(mal_device* pDevice)
return
MAL_FAILED_TO_READ_DATA_FROM_CLIENT
;
}
}
else
{
// TODO: Implement me.
UINT32
framesRemaining
=
framesAvailable
;
while
(
framesRemaining
>
0
)
{
BYTE
*
pData
;
UINT32
framesToSend
;
DWORD
flags
;
HRESULT
hr
=
((
IAudioCaptureClient
*
)
pDevice
->
wasapi
.
pCaptureClient
)
->
lpVtbl
->
GetBuffer
((
IAudioCaptureClient
*
)
pDevice
->
wasapi
.
pCaptureClient
,
&
pData
,
&
framesToSend
,
&
flags
,
NULL
,
NULL
);
if
(
FAILED
(
hr
))
{
break
;
}
// NOTE: Do we need to handle the case when the AUDCLNT_BUFFERFLAGS_SILENT bit is set in <flags>?
mal_device__send_frames_to_client
(
pDevice
,
framesToSend
,
pData
);
hr
=
((
IAudioCaptureClient
*
)
pDevice
->
wasapi
.
pCaptureClient
)
->
lpVtbl
->
ReleaseBuffer
((
IAudioCaptureClient
*
)
pDevice
->
wasapi
.
pCaptureClient
,
framesToSend
);
if
(
FAILED
(
hr
))
{
break
;
}
framesRemaining
-=
framesToSend
;
}
}
}
...
...
@@ -3818,7 +3851,7 @@ mal_thread_result MAL_THREADCALL mal_worker_thread(void* pData)
mal_assert
(
pDevice
!=
NULL
);
#ifdef MAL_WIN32
CoInitializeEx
(
NULL
,
COINIT_MULTITHREADED
);
HRESULT
hr
=
CoInitializeEx
(
NULL
,
COINIT_MULTITHREADED
);
#endif
// This is only used to prevent posting onStop() when the device is first initialized.
...
...
@@ -4348,6 +4381,7 @@ mal_uint32 mal_get_sample_size_in_bytes(mal_format format)
// - Add support for exclusive mode?
// - GetMixFormat() instead of IsFormatSupported().
// - Requires a large suite of conversion routines including channel shuffling, SRC and format conversion.
// - Look into event callbacks: AUDCLNT_STREAMFLAGS_EVENTCALLBACK
//
//
// ALSA
...
...
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