#pragma once

#include "IAudioInterface.h"

#include <memory>

class AudioDevice;

class WasapiInterface : public IAudioInterface
{
public:
    WasapiInterface();

    ~WasapiInterface();

    static std::unique_ptr<WasapiInterface> Create();

    void play(AudioDevice* device, AudioSample* sample, unsigned duration) override;
private:
    void openDevice(AudioDevice* device) override;

    void setAccessType(AudioDevice* device);

    void setSampleFormat(AudioDevice* device);

    void setSampleRate(AudioDevice* device);

    void setPeriod(AudioDevice* device);

    void setBufferSize(AudioDevice* device);

    void setChannelNumber(AudioDevice* device);
};

using WasapiInterfacePtr = std::unique_ptr<WasapiInterface>;
