summaryrefslogtreecommitdiff
path: root/tascam_fw_console/strip.py
blob: b879c9379801394b14a4b64f8f89e1c22f54247c (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
#!/usr/bin/env python3
"""
    Open Sound Control send/recieve daemon for Tascam Firewire control surface
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    :copyright: Copyright (c) 2018 Scott Bahling
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License version 2 as
        published by the Free Software Foundation.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.

        You should have received a copy of the GNU General Public License
        along with this program (see the file COPYING); if not, write to the
        Free Software Foundation, Inc.,
        51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
    :license: GPL-2.0, see COPYING for details
"""

from tascam_fw_console.fader import Fader
from tascam_fw_console.encoder import Encoder


class Strip():

    def __init__(self, console, num):
        self.console = console
        self.num = num
        self.mute_button = None
        self._mute = False
        self.solo_button = None
        self._solo = False
        self.select_button = None
        self._select = False
        self._rec = False
        self.encoder = Encoder('Strip {}'.format(self.num),
                               '/strip/encoder',
                               self.num,
                               )
        self.fader = Fader(self)
        self.name = None

    @property
    def mute_led(self):
        return self.console.unit.strips[self.num].mute_led

    @property
    def solo_led(self):
        return self.console.unit.strips[self.num].solo_led

    @property
    def sel_led(self):
        return self.console.unit.strips[self.num].sel_led

    @property
    def rec_led(self):
        return self.console.unit.strips[self.num].rec_led

    @property
    def mute(self):
        return self._mute

    @mute.setter
    def mute(self, state):
        state = bool(state)
        self._mute = state
        if state:
            self.mute_led.turn_on()
        else:
            self.mute_led.turn_off()

    @property
    def solo(self):
        return self._solo

    @solo.setter
    def solo(self, state):
        state = bool(state)
        self._solo = state
        if state:
            self.solo_led.turn_on()
        else:
            self.solo_led.turn_off()

    @property
    def select(self):
        return self._select

    @select.setter
    def select(self, state):
        state = bool(state)
        self._select = state
        if state:
            self.sel_led.turn_on()
        else:
            self.sel_led.turn_off()

    @property
    def rec(self):
        return self._rec

    @rec.setter
    def rec(self, state):
        state = bool(state)
        self._rec = state
        if state:
            self.rec_led.turn_on()
        else:
            self.rec_led.turn_off()