-
Notifications
You must be signed in to change notification settings - Fork 2
/
effect.cpp
37 lines (27 loc) · 1008 Bytes
/
effect.cpp
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
#include "effect.h"
#include <cstring>
vrok::Effect::Effect() : BufferGraph::Point(), _input_bc(0, 0, 0), _first_run(true), _work(true) { }
void vrok::Effect::Run() {
auto buffers = PeakAllSources();
if (buffers) {
auto buffer = AcquireBuffer();
if (buffer) {
BufferConfig *c = buffers[0]->GetBufferConfig();
if (_first_run || (_input_bc != *c)) {
if (BufferConfigChange(c) == false) {
WARN(0, "BufferConfig failed");
return;
}
SetBufferConfig(c);
_first_run = false;
_input_bc = *c;
}
buffer->SetStreamId(buffers[0]->GetStreamId());
buffer->GetWatch() = buffers[0]->GetWatch();
_work = EffectRun(buffer, buffers, _sources.size());
buffer->SetBufferType(buffers[0]->GetBufferType());
PushBuffer(buffer);
}
ReleaseAllSources(buffers);
}
}