summaryrefslogtreecommitdiff
path: root/src/globeLayer.h
blob: 781750a602c5be003c72e7a570af5de6b13c0eb5 (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
#ifndef GLOBELAYER_H
#define GLOBELAYER_H

#include "ofMain.h"

class globeLayer
{
    public:
        globeLayer();
        globeLayer(map<string,string> * _settings);

        virtual void update();
        virtual void draw();
        void setActive(bool _active);
        //void setMixAmt(float _mixAmt);

        int note,mix; //midi note to play and controller to mix

        virtual void CC(int _controller,int _value); //control change is sent to all channels

        //colour changing and setting functions
    protected:
        float x,y; //pos on screen
        float w,h; //size on screen
        bool active;
        float mixAmount;

        map<string,string>settings; //copy of settings key (is neecesary?)
        //char* CCs;                  //registers interest for midi CC messages

    private:

};


class globePlayer: public globeLayer
{
    public:
        globePlayer();
        globePlayer(map<string,string> * _settings);
        ~globePlayer();

        void update();
        void draw();

        void CC(int _controller,int _value); //have to override virtual function

    private:
        bool isPlaying;
        string fileName;
        ofVideoPlayer player;
};

class globeGrabber: public globeLayer
{
    public:
        globeGrabber();
        globeGrabber(map<string,string> * _settings);
        ~globeGrabber();

        void update();
        void draw();

        void CC(int _controller,int _value); //add some colour settings

    protected:
        void calcGammaMap();

    private:
        bool isPlaying;

        ofVideoGrabber grabber;

        int camWidth,camHeight;

        unsigned char* gammamap;
        unsigned char gsGammaMap(unsigned char *pixel);

        unsigned char* line1;
        unsigned char* line2;
        bool            deInterlace;
        ofTexture	    outTexture;

        unsigned char*  outBuffer;

        bool field2; //flag that there is a 2nd field waiting to be processed
        bool use2fields;
        int frameTime,grabTime; //keep track of field timing

        int whitePCtl,blackPCtl,gammaCtl,redCtl,blueCtl,greenCtl,devCtl;
        float whitePt,blackPt,gamma;

        float red,green,blue;

	int lineOffset;
        bool flip;
        int flipCtl;

};

#endif // GLOBELAYER_H