blob: 56011b6efd1021bd3ffe01e6b6271179948ef5c8 (
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
|
#pragma once
#define ALSA_PCM_NEW_HW_PARAMS_API
#include <audiotypes.h>
#include <alsa/asoundlib.h>
#include "audiooutputengine.h"
class AlsaOutputEngine
: public AudioOutputEngine
{
public:
AlsaOutputEngine();
~AlsaOutputEngine();
bool init(const Channels& chan) override;
void setParm(const std::string& parm, const std::string& value) override;
bool start() override;
void stop() override;
void pre(size_t nsamples) override;
void run(int ch, sample_t* samples, size_t nsamples) override;
void post(size_t nsamples) override;
size_t getSamplerate() const override;
bool isFreewheeling() const override;
private:
snd_pcm_t* handle;
snd_pcm_hw_params_t* params;
std::vector<sample_t> data;
size_t num_channels;
std::string dev;
unsigned int srate;
snd_pcm_uframes_t frames;
};
|