Welcome to mirror list, hosted at ThFree Co, Russian Federation.

AudioDevice.h « src - github.com/mpc-hc/sanear.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 43e85436ba7500b3e8c56c7a4e9b100f94f9d8b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once

#include "DspChunk.h"
#include "DspFormat.h"

namespace SaneAudioRenderer
{
    struct AudioDeviceBackend final
    {
        SharedString          id;
        SharedString          adapterName;
        SharedString          endpointName;
        UINT32                endpointFormFactor;

        IAudioClientPtr       audioClient;
        IAudioRenderClientPtr audioRenderClient;
        IAudioClockPtr        audioClock;

        SharedWaveFormat      mixFormat;

        SharedWaveFormat      waveFormat;
        DspFormat             dspFormat;
        uint32_t              bufferDuration;
        REFERENCE_TIME        latency;
        bool                  exclusive;
        bool                  bitstream;
        bool                  realtime;

        bool                  ignoredSystemChannelMixer;
    };

    class AudioDevice
    {
    public:

        virtual ~AudioDevice() = default;

        virtual void Push(DspChunk& chunk, CAMEvent* pFilledEvent) = 0;
        virtual REFERENCE_TIME Finish(CAMEvent* pFilledEvent) = 0;

        virtual int64_t GetPosition() = 0;
        virtual int64_t GetEnd() = 0;
        virtual int64_t GetSilence() = 0;

        virtual void Start() = 0;
        virtual void Stop() = 0;
        virtual void Reset() = 0;

        SharedString GetId()           const { return m_backend->id; }
        SharedString GetAdapterName()  const { return m_backend->adapterName; }
        SharedString GetEndpointName() const { return m_backend->endpointName; }

        IAudioClockPtr GetClock() { return m_backend->audioClock; }

        SharedWaveFormat GetMixFormat()      const { return m_backend->mixFormat; }

        SharedWaveFormat GetWaveFormat()     const { return m_backend->waveFormat; }
        DspFormat        GetDspFormat()      const { return m_backend->dspFormat; }
        uint32_t         GetBufferDuration() const { return m_backend->bufferDuration; }
        REFERENCE_TIME   GetStreamLatency()  const { return m_backend->latency; }

        bool IsExclusive() const { return m_backend->exclusive; }
        bool IsRealtime()  const { return m_backend->realtime; }

        bool IgnoredSystemChannelMixer() const { return m_backend->ignoredSystemChannelMixer; }

    protected:

        std::shared_ptr<AudioDeviceBackend> m_backend;
    };
}