-
Notifications
You must be signed in to change notification settings - Fork 1
/
dithered.cpp
62 lines (47 loc) · 1.23 KB
/
dithered.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
55
56
57
58
59
60
61
62
//
// main.c
// udpListen
//
// Created by Timothy Kukulski on 10/30/12.
// Copyright (c) 2012 Adobe. All rights reserved.
//
#include "tclled.h"
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include "UDPSender.h"
#include <stdlib.h>
#include <signal.h>
#include "TCLZoned.hxx"
#include <vector>
#include <list>
#include <string>
#include <algorithm>
#include <iostream>
#include "Options.hxx"
void prepPixels(unsigned int *raw, const tcl_buffer &tcl);
void initTclBuf(const tcl_buffer &tcl);
void interruptHandler(int param);
using namespace std;
int main(int argc, const char * argv[])
{
Options opts(argc, argv);
TCLZoned tcl(opts.buffersize.x, opts.buffersize.y, opts.leds);
tcl.addZones(opts.zones);
UDPListener udp(opts.port);
udp.setNonblocking();
opts.dump();
uint32_t *udpBuf = tcl.getBuffer()->getBuffer();
size_t bufSize = tcl.getBuffer()->getBufferSize();
tcl.testPattern();
tcl.send();
while(1) {
size_t amount = udp.listen(udpBuf,bufSize);
if(amount == bufSize) {
tcl.send();
} else {
cout << "bad buffer size:" << amount << " expected: " << bufSize << endl;
}
}
return 0;
}