aboutsummaryrefslogtreecommitdiffstats
path: root/lv2/ns/ext/contexts/contexts.ttl
blob: c56c649aeda89b999b5397742f456c0e495505a1 (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# LV2 Contexts Extension
#
# Allows for an LV2 plugin to have several independent contexts, each with its
# own run callback and associated ports.
#
# Copyright (C) 2007-2010 David Robillard
# 
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

@prefix ctx:  <http://lv2plug.in/ns/ext/contexts#> .
@prefix lv2:  <http://lv2plug.in/ns/lv2core#> .
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .

<http://lv2plug.in/ns/ext/contexts>
	a lv2:Specification , lv2:Feature ;
	doap:name "LV2 Contexts" ;
	doap:shortdesc "Support for plugins with several execution contexts." ;
	lv2:documentation """
<p>An extension for LV2 plugins which have several execution contexts.</p>

<p>Contexts allow plugins to run tasks and/or process input/output in
multiple threads.  Contexts can be used to add non-realtime functionality
to a plugin while still keeping the audio run() method realtime safe.</p>

<p>A context is an LV2 feature, so the usual LV2 feature mechanism is used
to determine whether a plugin has a given context, and whether or not it is
mandatory.</p>

<p>Unless otherwise stated, each context (defined by some URI) adds a new
threading class similar to the Audio class defined by LV2.  Each context has a
run callback and a connect_port callback both in the same class (i.e. can't be
called concurrently), but may be called concurrently with functions for other
contexts (excluding the Instantiation class).  Context properties such as
ctx:hardRTCapable apply to both functions.
The host MUST only call the correct connect_port function associated with the
context for that port, i.e. it is an error to use the main LV2 connect_port
function on a port with a context other than the main LV2 run function.</p>
""" .


##########################
## Context Base Classes ##
##########################

ctx:Context a rdfs:Class ;
	rdfs:label "LV2 Context" ;
	lv2:documentation """
<p>A potentially concurrent context (callback) on a plugin.</p>

<p>Ports are always associated with a context.  If a port has no explicit context
property, then its context is ctx:audioContext (the default LV2 run() context).</p>

<p>A plugin indicates support for a context by supporting an LV2 Feature with
that context's URI.  If a plugin optionally supports a context (e.g.
<code>&lt;plugin&gt; lv2:optionalFeature ctx:idleContext .</code>), then
all ports associated with that context MUST be lv2:connectionOptional.  Thus,
hosts that do not support contexts will connect such ports to NULL and the
plugin can run with only a standard LV2 run() context.</p>

<p>Any plugin that supports any context (optionally or mandatorily) MUST adhere
to the following additional threading rules for LV2_Descriptor.connect_port:</p>
<ul>
<li>connect_port MUST only be called for a given port from the context
associated with that port</li>
<li>connect_port MAY be called concurrently for ports with different
contexts (but MUST NOT be called concurrently for multiple ports in the
same context)</li>
</ul>
<p>Note this implies that any shared data access in connect_port may be
accessed concurrently.  The plugin is responsible for any synchronisation
or locking necessary to make this possible.</p>
""" .

ctx:audioContext a ctx:Context , lv2:Feature ;
	rdfs:comment """The context of LV2_Descriptor.run().""" .

ctx:messageContext a ctx:Context , lv2:Feature ;
	lv2:documentation """
<p>A non-realtime context for plugin control via message passing.  This context
has a run method which takes a bitset of flags for parameters specifying which
input and output ports are valid before and after the run method has executed,
respectively (see <code>LV2_Contexts_MessageContext</code>).</p>
""" .

ctx:idleContext a ctx:Context , lv2:Feature ;
	rdfs:comment """
A non-realtime idle context, periodically run by the host roughly every second.
This context never has any ports.
""" .

ctx:requestRunFeature a lv2:Feature ;
	lv2:documentation """
<p>A feature allowing the plugin to request the execution of a particular
context at an arbitrary time.  To support this feature, the host MUST pass an
LV2_Feature to <code>instantiate</code> with <code>data</code> pointing to a
LV2_Contexts_Request_Run_Feature.</p>

<p>The plugin MAY call <code>request_run</code> with the given
<code>data</code> from any non-realtime context to demand soon-as-possible execution
of the specified context.</p>
""" .

ctx:context a rdf:Property ;
	rdfs:domain lv2:Port ;
	rdfs:range  ctx:Context ;
	rdfs:label  "is used in context" ;
	rdfs:comment """
The context a particular port is associated with; the port will only be
connected/read/written by that context.

If no context is specified, the port is considered part of the default LV2
audio context.""" .