-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathengine.h
61 lines (52 loc) · 1.61 KB
/
engine.h
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
#pragma once
#include "audio/signalinfo.h"
namespace mixxx {
static constexpr audio::ChannelCount kEngineChannelOutputCount =
audio::ChannelCount::stereo();
static constexpr audio::ChannelCount kMaxEngineChannelInputCount =
audio::ChannelCount::stem();
// The following constant is always defined as it used for the waveform data
// struct, which must stay consistent, whether the STEM feature is enabled or
// not.
constexpr int kMaxSupportedStems = 4;
#ifdef __STEM__
enum class StemChannel {
First = 0x1,
Second = 0x2,
Third = 0x4,
Fourth = 0x8,
None = 0,
All = First | Second | Third | Fourth
};
Q_DECLARE_FLAGS(StemChannelSelection, StemChannel);
#endif
// Contains the information needed to process a buffer of audio
class EngineParameters final {
public:
SINT framesPerBuffer() const {
return m_framesPerBuffer;
}
SINT samplesPerBuffer() const {
return m_outputSignal.frames2samples(framesPerBuffer());
}
audio::ChannelCount channelCount() const {
return m_outputSignal.getChannelCount();
}
audio::SampleRate sampleRate() const {
return m_outputSignal.getSampleRate();
}
explicit EngineParameters(
audio::SampleRate sampleRate,
SINT framesPerBuffer)
: m_outputSignal(
kEngineChannelOutputCount,
sampleRate),
m_framesPerBuffer(framesPerBuffer) {
DEBUG_ASSERT(framesPerBuffer > 0);
DEBUG_ASSERT(sampleRate > 0);
}
private:
const audio::SignalInfo m_outputSignal;
const SINT m_framesPerBuffer;
};
}