#pragma once #include #include #include #include namespace piik::capture { constexpr UINT32 kAudioSampleRate = 48'000; constexpr UINT16 kAudioChannels = 2; constexpr UINT16 kAudioBytesPerSample = 2; constexpr UINT32 kAudioFramesPerChunk = 960; constexpr DWORD kAudioBytesPerChunk = kAudioFramesPerChunk * kAudioChannels * kAudioBytesPerSample; constexpr UINT64 kAudioChunkDuration100ns = 200'000; using PCMWriter = std::function; using ReadyWriter = std::function; using StopProbe = std::function; bool ProcessAudioAvailable(bool exclude = false); bool SystemAudioAvailable(); HRESULT CaptureMicrophone(const std::wstring& device_id, HANDLE stop_event, const StopProbe& stop_probe, const ReadyWriter& ready_writer, const PCMWriter& writer); HRESULT CaptureProcessAudio(DWORD pid, UINT64 expected_creation_time, bool exclude, HANDLE stop_event, const StopProbe& stop_probe, const ReadyWriter& ready_writer, const PCMWriter& writer); HRESULT CaptureSystemAudio(HANDLE stop_event, const StopProbe& stop_probe, const ReadyWriter& ready_writer, const PCMWriter& writer); } // namespace piik::capture