forked from ambilight-4-mediaportal/AtmoWin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAtmoColorChanger.cpp
More file actions
42 lines (34 loc) · 1.13 KB
/
Copy pathAtmoColorChanger.cpp
File metadata and controls
42 lines (34 loc) · 1.13 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
/*
* AtmoColorChanger.cpp: class for the fun effect: random color fading on all five channels
*
* See the README.txt file for copyright information and how to reach the author(s).
*
* $Id$
*/
#include "StdAfx.h"
#include "atmocolorchanger.h"
CAtmoColorChanger::CAtmoColorChanger(CAtmoConnection *atmoConnection, CAtmoConfig *atmoConfig) : CAtmoBasicEffect(atmoConnection,atmoConfig) {
}
CAtmoColorChanger::~CAtmoColorChanger(void)
{
}
DWORD CAtmoColorChanger::Execute(void)
{
pColorPacket RGB_aus;
AllocColorPacket(RGB_aus, this->m_AtmoConfig->getZoneCount());
while(!this->m_bTerminated) {
int rot = rand() % 255 + 1; // zufällige Farbe
int gruen = rand() % 255 + 1;
int blau = rand() % 255 + 1;
for (int i=0; i< RGB_aus->numColors ; i++) // 0..4
{
RGB_aus->zone[i].r = rot;
RGB_aus->zone[i].g = gruen;
RGB_aus->zone[i].b = blau;
}
// Fade to new Random color ... starting value will be the last Color ... used by this thread...
Interpolation(m_AtmoConfig->getColorChanger_iSteps(), m_AtmoConfig->getColorChanger_iDelay(), RGB_aus );
}
delete (char *)RGB_aus;
return 0;
}