-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtest1.cpp
54 lines (39 loc) · 935 Bytes
/
test1.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "test1.h"
Test1::Test1() {
a.RegisterSink(&b);
b.RegisterSource(&a);
a.Preallocate();
b.Preallocate();
}
Test1::~Test1() { }
void NodeA::Run()
{
int j = 0;
while (true) {
auto b = (AcquireBuffer());
auto xx = GetBufferConfig();
// DBG(::this_thread::get_id()<<" w"<<b);
/*
for (int x=0;x<xx.frames*xx.channels;x++)
{
b->GetData()[x]=-999999999990;
}*/
b->GetData()[1] = j;
j++;
PushBuffer(b);
}
}
void NodeB::Run() {
int j = 0;
while (true) {
auto bb = PeakAllSources();
// DBG(::this_thread::get_id()<<" "<<bb[0]->GetData()[1]);
if (bb[0]->GetData()[1] != j) {
std::cout << "fail" << endl;
while (1) {
}
}
j = bb[0]->GetData()[1] + 1;
ReleaseAllSources(bb);
}
}