~ubuntu-branches/ubuntu/oneiric/lmms/oneiric

« back to all changes in this revision

Viewing changes to plugins/ladspa_effect/calf/calf/plugininfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-12 13:32:32 UTC
  • mfrom: (1.1.9 upstream) (3.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20101112133232-vdld83iyji8srqti
Tags: 0.4.7-2ubuntu1
* Re-sync with Debian (LP: #606533):
  - Replace build-dep on libwine-dev with libwine-dev-unstable to build
    against the newer Wine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Calf DSP Library
2
 
 * Plugin introspection interface
3
 
 *
4
 
 * Copyright (C) 2008 Krzysztof Foltman
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU Lesser General Public
8
 
 * License as published by the Free Software Foundation; either
9
 
 * version 2 of the License, or (at your option) any later version.
10
 
 *
11
 
 * This program is distributed in the hope that it will be useful,
12
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 
 * Lesser General Public License for more details.
15
 
 *
16
 
 * You should have received a copy of the GNU Lesser General
17
 
 * Public License along with this program; if not, write to the
18
 
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
19
 
 * Boston, MA 02111-1307, USA.
20
 
 */
21
 
 
22
 
#ifndef __CALF_PLUGININFO_H
23
 
#define __CALF_PLUGININFO_H
24
 
 
25
 
#include <string>
26
 
 
27
 
namespace calf_plugins {
28
 
 
29
 
/// A sink to send information about an audio port
30
 
struct plain_port_info_iface
31
 
{
32
 
    /// Called if it's an input port
33
 
    virtual plain_port_info_iface& input() { return *this; }
34
 
    /// Called if it's an output port
35
 
    virtual plain_port_info_iface& output() { return *this; }
36
 
    virtual plain_port_info_iface& lv2_ttl(const std::string &text) { return *this; }
37
 
    virtual ~plain_port_info_iface() {}
38
 
};
39
 
 
40
 
/// A sink to send information about a control port (very incomplete, missing stuff: units, integer, boolean, toggled, notAutomatic, notGUI...)
41
 
struct control_port_info_iface
42
 
{
43
 
    /// Called if it's an input port
44
 
    virtual control_port_info_iface& input() { return *this; }
45
 
    /// Called if it's an output port
46
 
    virtual control_port_info_iface& output() { return *this; }
47
 
    /// Called to mark the port as using linear range [from, to]
48
 
    virtual control_port_info_iface& lin_range(double from, double to) { return *this; }
49
 
    /// Called to mark the port as using log range [from, to]
50
 
    virtual control_port_info_iface& log_range(double from, double to) { return *this; }
51
 
    virtual control_port_info_iface& toggle() { return *this; }
52
 
    virtual control_port_info_iface& trigger() { return *this; }
53
 
    virtual control_port_info_iface& integer() { return *this; }
54
 
    virtual control_port_info_iface& lv2_ttl(const std::string &text) { return *this; }
55
 
    virtual control_port_info_iface& polymorphic() { return lv2_ttl("a poly:PolymorphicPort ;"); }
56
 
    virtual control_port_info_iface& poly_audio() { return lv2_ttl("poly:supportsType lv2:AudioPort ;"); }
57
 
    virtual ~control_port_info_iface() {}
58
 
};
59
 
 
60
 
/// A sink to send information about a plugin
61
 
struct plugin_info_iface
62
 
{
63
 
    /// Set plugin names (ID, name and label)
64
 
    virtual void names(const std::string &name, const std::string &label, const std::string &category, const std::string &microname = std::string()) {}
65
 
    /// Add an audio port (returns a sink which accepts further description)
66
 
    virtual plain_port_info_iface &audio_port(const std::string &id, const std::string &name, const std::string &microname = std::string("N/A"))=0;
67
 
    /// Add an event port (returns a sink which accepts further description)
68
 
    virtual plain_port_info_iface &event_port(const std::string &id, const std::string &name, const std::string &microname = std::string("N/A"))=0;
69
 
    /// Add a control port (returns a sink which accepts further description)
70
 
    virtual control_port_info_iface &control_port(const std::string &id, const std::string &name, double def_value, const std::string &microname = "N/A")=0;
71
 
    /// Add arbitrary TTL clauses
72
 
    virtual void lv2_ttl(const std::string &text) {}
73
 
    /// Add small plugin GUI
74
 
    virtual void has_gui() { lv2_ttl("uiext:ui <http://calf.sourceforge.net/small_plugins/gui/gtk2-gui> ;"); }
75
 
    /// Called after plugin has reported all the information
76
 
    virtual void finalize() {}
77
 
    virtual ~plugin_info_iface() {}
78
 
};
79
 
 
80
 
struct plugin_port_type_grabber: public plugin_info_iface, public control_port_info_iface
81
 
{
82
 
    uint32_t &target;
83
 
    uint32_t index;
84
 
    
85
 
    plain_port_info_iface pp;
86
 
    control_port_info_iface cp;
87
 
    
88
 
    plugin_port_type_grabber(uint32_t &_target) : target(_target), index(0) { target = 0; }
89
 
        
90
 
    virtual plain_port_info_iface &audio_port(const std::string &id, const std::string &name, const std::string &microname = std::string("N/A")) { target |= (1 << index); index++; return pp; }
91
 
    virtual plain_port_info_iface &event_port(const std::string &id, const std::string &name, const std::string &microname = std::string("N/A")) { index++; return pp; }
92
 
    virtual control_port_info_iface &control_port(const std::string &id, const std::string &name, double def_value, const std::string &microname = "N/A") { index++; return cp; }
93
 
};
94
 
 
95
 
/// A sink to send information about plugins
96
 
struct plugin_list_info_iface
97
 
{
98
 
    /// Add an empty plugin object and return the sink to be filled with information
99
 
    virtual plugin_info_iface &plugin(const std::string &id) = 0;
100
 
    virtual ~plugin_list_info_iface() {}
101
 
};
102
 
 
103
 
};
104
 
 
105
 
#endif