summaryrefslogtreecommitdiffstats
path: root/src/soundio/sounddevicenotfound.h
blob: 7ff817d48057b16a43fb5c05a30996c091130668 (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
#pragma once

#include <QString>

#include "soundio/sounddevice.h"


class SoundManager;
class EngineNetworkStream;

// This is a fake device, constructed from SoundMamagerConfig data.
// It is used for error reporting only when there is no real data from the
// sound API

class SoundDeviceNotFound : public SoundDevice {
  public:
    SoundDeviceNotFound(const QString& name)
            : SoundDevice(UserSettingsPointer(), nullptr) {
        m_deviceId.name = name;
        m_strDisplayName = name;
    }

    SoundDeviceError open(bool isClkRefDevice, int syncBuffers) override {
        Q_UNUSED(isClkRefDevice);
        Q_UNUSED(syncBuffers);
        return SOUNDDEVICE_ERROR_ERR;
    };
    bool isOpen() const  override { return false; };
    SoundDeviceError close() override {
        return SOUNDDEVICE_ERROR_ERR;
    };
    void readProcess() override { };
    void writeProcess() override { };
    QString getError() const override{ return QObject::tr("Device not found"); };

    unsigned int getDefaultSampleRate() const override {
        return 44100;
    }
};