/**
 * Copyright 2022-2025 Theai, Inc. dba Inworld AI
 */
#pragma once

#include "Audio/InworldAudioCapture.h"

struct FInworldAudioCapture_Microphone : public FInworldAudioCapture
{
public:
	FInworldAudioCapture_Microphone(TWeakObjectPtr<UObject> InOwner, TFunction<void(FInworldAudioCaptureData)> InCallback)
		: FInworldAudioCapture(InOwner, InCallback)
	{
	}
	virtual ~FInworldAudioCapture_Microphone()
	{
		StopCapture();
	}

	virtual void StartCapture() override;
	virtual void StopCapture() override;

	virtual void SetCaptureDeviceById(const FString& DeviceId) override;

private:
	void OnAudioCapture(const float* AudioData, int32 NumFrames, int32 NumChannels, int32 SampleRate);

	Audio::FAudioCapture AudioCapture;
	Audio::FAudioCaptureDeviceParams AudioCaptureDeviceParams;
};
