summaryrefslogtreecommitdiff
path: root/config.c
blob: fbb79188cafa77519eba83c0dd1fc8e7ab255eaa (plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * seduthred.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: config.c,v 1.27 2012/11/28 06:29:24 wendel Exp $
 */

#include <string.h>

#include "config.h"
#include "common.h"

//***************************************************************************
// Global Configuration
//***************************************************************************

cSeduConfig cfg;

//***************************************************************************
// cConfigData
//***************************************************************************

cSeduConfig::cSeduConfig()
{
   // to be configured

   frequence = 25;
   threshold = 17;
   average = 10;
   adjRed = 57;
   adjGreen = 100;
   adjBlue = 70;
   gamma = 14;
   xDeep = 2;
   yDeep = 1;
   black = 0;
   detectCineBars = cbBoth;

   seduMode = smMiniDMX;
   strcpy(seduRGBOrder, "BGR");
   loglevel = 0;

   showMainmenu = yes;
   viewMode = vmAtmo;
   effectSpeed = 500;

   fixedR = 111;
   fixedG = 101;
   fixedB = 0;


   // calculated

   leds = 0;
   ledCount = 0;
   grabWidth = na;
   grabHeight = na;
}

cSeduConfig::~cSeduConfig()
{
   if (leds) delete leds;
}

//***************************************************************************
// Create Leds from config
//***************************************************************************

cSeduConfig::cLed* cSeduConfig::createLeds(cLedConfs* conf)
{
   int seq = 0;
   delete leds; 
   
   grabWidth = 0;
   grabHeight = 0;
   
   ledCount = conf->Count();
   leds = new cLed[ledCount];
   memset(leds, 0, ledCount*sizeof(cLed));
   
   for (cLedConf* l = conf->First(); l; l = conf->Next(l))
   {
      tell(1, "led%d (%d) %d/%d  %d/%d", seq, l->Pos(),
           l->X(), l->Y(), 
           l->ToX(), l->ToY());
      
      if (l->isValid())
      {
         // calc size of led matrix 
         
         if (grabWidth < l->X())
            grabWidth = l->X();
         if (grabWidth < l->ToX())
            grabWidth = l->ToX();
         if (grabHeight < l->Y())
            grabHeight = l->Y();
         if (grabHeight < l->ToY())
            grabHeight = l->ToY();
         
         leds[seq].lp  = (LedPosition)l->Pos();
         leds[seq].x   = l->X();
         leds[seq].y   = l->Y(); 
         leds[seq].toX = l->ToX();
         leds[seq].toY = l->ToY();
         
         seq++;
      }
   }

   ledCount = seq;
   grabWidth++;
   grabHeight++;

   return leds;
}