summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour/controllable_descriptor.h
blob: 9f160227dc4ea8798a0f7adb72df621f6e76cc57 (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
/*
    Copyright (C) 2009 Paul Davis

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    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; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef __libardour_controllable_descriptor_h__
#define __libardour_controllable_descriptor_h__

#include <vector>
#include <string>
#include <stdint.h>

#include "ardour/libardour_visibility.h"

namespace ARDOUR {

class LIBARDOUR_API ControllableDescriptor {
public:
    enum TopLevelType {
	    PresentationOrderRoute,
	    PresentationOrderTrack,
	    PresentationOrderBus,
	    PresentationOrderVCA,
	    NamedRoute,
	    SelectionCount,
    };

    enum SubType {
	    Gain,
	    Trim,
	    Solo,
	    Mute,
	    Recenable,
	    PanDirection,
	    PanWidth,
	    PanElevation,
	    Balance,
	    SendGain,
	    PluginParameter
    };

    ControllableDescriptor ()
	    : _top_level_type (PresentationOrderRoute)
	    , _subtype (Gain)
	    , _banked (false)
	    , _bank_offset (0)
    {}

    int set (const std::string&);

    /* it is only valid to call top_level_name() if top_level_type() returns
       NamedRoute
    */

    TopLevelType top_level_type() const { return _top_level_type; }
    const std::string& top_level_name() const { return _top_level_name; }

    SubType subtype() const { return _subtype; }

    uint32_t presentation_order() const;
    uint32_t selection_id() const;
    uint32_t target (uint32_t n) const;
    bool banked() const { return _banked; }

    void set_bank_offset (uint32_t o) { _bank_offset = o; }

private:
    TopLevelType          _top_level_type;
    SubType               _subtype;
    std::string           _top_level_name;
    union {
	    uint32_t  _presentation_order;
	    uint32_t  _selection_id;
    };
    std::vector<uint32_t> _target;
    uint32_t              _banked;
    uint32_t              _bank_offset;
};

}

#endif /* __libardour_controllable_descriptor_h__ */