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

    :copyright: Copyright (c) 2012-2014 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 faders import Fader

class Strip():

    def __init__(self, unit, num):
        self.num = 0
        self.mute = None
        self.solo = None
        self.select = None
        self.recenable = False
        self.pan = 0.5
        self.fader = Fader(unit, self)
        self.name = None

    def send_pan(self, delta):
        addr = '/strip/pan_stereo_position'
        pan = self.pan + delta * 0.02
        if pan < 0:
            pan = 0
        if pan > 1.0:
            pan = 1.0
        osc.send_message(addr, (self.num, pan))

    def recv_pan(self, pan):
        print('Pan: {} {}'.format(self.num, pan))
        self.pan = pan


def init_strips(unit):
    strips = []
    for strip_num in range(0, 9):
        strips.append(Strip(unit, strip_num))

    return strips