forked from PosixAlchemist/cli-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPortAudioSource.h
More file actions
59 lines (42 loc) · 1.14 KB
/
Copy pathPortAudioSource.h
File metadata and controls
59 lines (42 loc) · 1.14 KB
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
/*
* PortAudioSource.h
*
* Created on: May 1, 2020
* Author: noriah
*/
#ifndef _VIS_PORT_AUDIO_SOURCE_H
#define _VIS_PORT_AUDIO_SOURCE_H
#include <fstream>
#include <memory>
#ifdef _ENABLE_PORT
#include <portaudio.h>
#endif
#include "Domain/Settings.h"
#include "Source/AudioSource.h"
namespace vis
{
class PortAudioSource : public vis::AudioSource
{
public:
explicit PortAudioSource(
const std::shared_ptr<const vis::Settings> settings);
PortAudioSource(const PortAudioSource &other) = delete;
PortAudioSource(const PortAudioSource &&other) = delete;
PortAudioSource &operator=(const PortAudioSource &v) = delete;
PortAudioSource &operator=(PortAudioSource &&v) = delete;
#ifdef _ENABLE_PORT
~PortAudioSource() override;
#else
~PortAudioSource() override = default;
#endif
bool read(pcm_stereo_sample *buffer, uint32_t buffer_size) override;
private:
#ifdef _ENABLE_PORT
const std::shared_ptr<const Settings> m_settings;
PaStream *m_portaudio_stream;
PaStreamParameters m_portaudio_params;
#endif
bool open_portaudio_source(uint32_t max_buffer_size);
};
} // namespace vis
#endif