Sunshine master
Self-hosted game stream host for Moonlight.
platf::audio::mic_wasapi_t Class Reference

WASAPI microphone capture stream and endpoint notification state. More...

Inheritance diagram for platf::audio::mic_wasapi_t:
[legend]
Collaboration diagram for platf::audio::mic_wasapi_t:
[legend]

Public Member Functions

int init (std::uint32_t sample_rate, std::uint32_t frame_size, std::uint32_t channels_out, bool continuous)
 Initialize WASAPI capture for the selected audio endpoint.
 
capture_e sample (std::vector< float > &sample_out) override
 Deliver a captured audio sample to Sunshine's audio pipeline.
 
- Public Member Functions inherited from platf::mic_t

Public Attributes

audio_capture_t audio_capture
 WASAPI capture client used to read sample packets.
 
audio_client_t audio_client
 WASAPI audio client configured for shared-mode capture.
 
handle_t audio_event
 Event signaled by WASAPI when captured audio is available.
 
int channels
 Number of channels in the capture format.
 
bool continuous_audio
 Whether audio packets continue during silence.
 
std::optional< std::function< void()> > default_endpt_changed_cb
 Callback invoked when the default endpoint changes.
 
REFERENCE_TIME default_latency_ms
 WASAPI default device period used as capture latency.
 
device_t device
 WASAPI endpoint device selected for capture.
 
device_enum_t device_enum
 Device enum.
 
audio_notification_t endpt_notification
 Endpoint notification callback registered with Windows.
 
HANDLE mmcss_task_handle = nullptr
 MMCSS task handle for the audio capture thread.
 
util::buffer_t< float > sample_buf
 Floating-point sample buffer filled from WASAPI packets.
 
float * sample_buf_pos
 Current write position in sample_buf.
 

Detailed Description

WASAPI microphone capture stream and endpoint notification state.

Member Function Documentation

◆ init()

int platf::audio::mic_wasapi_t::init ( std::uint32_t sample_rate,
std::uint32_t frame_size,
std::uint32_t channels_out,
bool continuous )
inline

Initialize WASAPI capture for the selected audio endpoint.

Parameters
sample_rateAudio sample rate in hertz.
frame_sizeNumber of samples captured per audio frame.
channels_outChannels out.
continuousWhether silent audio should continue to be emitted.
Returns
0 on success; nonzero or negative platform status on failure.

◆ sample()

capture_e platf::audio::mic_wasapi_t::sample ( std::vector< float > & sample_out)
inlineoverridevirtual

Deliver a captured audio sample to Sunshine's audio pipeline.

Parameters
sample_outSample out.
Returns
Capture status reported to the streaming pipeline.

Implements platf::mic_t.


The documentation for this class was generated from the following file: