1<?xml version="1.0" encoding="utf-8"?>
2<!-- Copyright (C) 2017 The Android Open Source Project
3
4     Licensed under the Apache License, Version 2.0 (the "License");
5     you may not use this file except in compliance with the License.
6     You may obtain a copy of the License at
7
8          http://www.apache.org/licenses/LICENSE-2.0
9
10     Unless required by applicable law or agreed to in writing, software
11     distributed under the License is distributed on an "AS IS" BASIS,
12     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13     See the License for the specific language governing permissions and
14     limitations under the License.
15-->
16<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
17           targetNamespace="http://schemas.android.com/audio/audio_effects_conf/v2_0"
18           xmlns:aec="http://schemas.android.com/audio/audio_effects_conf/v2_0"
19           elementFormDefault="qualified">
20
21  <!-- Simple types -->
22  <xs:simpleType name="versionType">
23    <xs:restriction base="xs:decimal">
24      <xs:enumeration value="2.0"/>
25    </xs:restriction>
26  </xs:simpleType>
27  <xs:simpleType name="uuidType">
28    <xs:restriction base="xs:string">
29      <xs:pattern value="[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}"/>
30    </xs:restriction>
31  </xs:simpleType>
32  <xs:simpleType name="streamInputType">
33    <xs:restriction base="xs:string">
34      <xs:enumeration value="mic"/>
35      <xs:enumeration value="voice_uplink"/>
36      <xs:enumeration value="voice_downlink"/>
37      <xs:enumeration value="voice_call"/>
38      <xs:enumeration value="camcorder"/>
39      <xs:enumeration value="voice_recognition"/>
40      <xs:enumeration value="voice_communication"/>
41      <xs:enumeration value="unprocessed"/>
42    </xs:restriction>
43  </xs:simpleType>
44  <xs:simpleType name="streamOutputType">
45    <xs:restriction base="xs:string">
46      <xs:enumeration value="voice_call"/>
47      <xs:enumeration value="system"/>
48      <xs:enumeration value="ring"/>
49      <xs:enumeration value="music"/>
50      <xs:enumeration value="alarm"/>
51      <xs:enumeration value="notification"/>
52      <xs:enumeration value="bluetooth_sco"/>
53      <xs:enumeration value="enforced_audible"/>
54      <xs:enumeration value="dtmf"/>
55      <xs:enumeration value="tts"/>
56    </xs:restriction>
57  </xs:simpleType>
58  <xs:simpleType name="relativePathType">
59    <xs:restriction base="xs:string">
60      <xs:pattern value="[^/].*"/>
61    </xs:restriction>
62  </xs:simpleType>
63
64  <!-- Complex types -->
65  <xs:complexType name="librariesType">
66    <xs:annotation>
67      <xs:documentation xml:lang="en">
68        List of effect libraries to load. Each library element must have "name" and
69        "path" attributes. The latter is giving the path of the library .so file
70        relative to the standard effect folders: /(vendor|odm|system)/lib(64)?/soundfx/
71
72        Example for a library in "/vendor/lib/soundfx/lib.so":
73        <library name="name" path="lib.so"/>
74
75      </xs:documentation>
76    </xs:annotation>
77    <xs:sequence>
78      <xs:element name="library" minOccurs="0" maxOccurs="unbounded">
79        <xs:complexType>
80          <xs:attribute name="name" type="xs:string" use="required"/>
81          <xs:attribute name="path" type="aec:relativePathType" use="required"/>
82        </xs:complexType>
83      </xs:element>
84    </xs:sequence>
85  </xs:complexType>
86  <xs:complexType name="effectImplType">
87    <xs:attribute name="library" type="xs:string" use="required"/>
88    <xs:attribute name="uuid" type="aec:uuidType" use="required"/>
89  </xs:complexType>
90  <xs:complexType name="effectType">
91    <xs:complexContent>
92      <xs:extension base="aec:effectImplType">
93        <xs:attribute name="name" type="xs:string" use="required"/>
94      </xs:extension>
95    </xs:complexContent>
96  </xs:complexType>
97  <xs:complexType name="effectProxyType">
98    <xs:complexContent>
99      <xs:extension base="aec:effectType">
100        <xs:sequence>
101          <xs:element name="libsw" type="aec:effectImplType"/>
102          <xs:element name="libhw" type="aec:effectImplType"/>
103        </xs:sequence>
104      </xs:extension>
105    </xs:complexContent>
106  </xs:complexType>
107  <xs:complexType name="effectsType">
108    <xs:annotation>
109      <xs:documentation xml:lang="en">
110        List of effects to load. Each effect element must contain "name",
111        "library", and "uuid" attrs. The value of the "library" attr must
112        correspond to the name of a "library" element. The name of the effect
113        element is indicative, only the value of the "uuid" element designates
114        the effect for the audio framework.  The uuid is the implementation
115        specific UUID as specified by the effect vendor. This is not the generic
116        effect type UUID.
117
118        For effect proxy implementations, SW and HW implemetations of the effect
119        can be specified.
120
121        Example:
122
123        <effect name="name" library="lib" uuid="uuuu"/>
124        <effectProxy name="proxied" library="proxy" uuid="xxxx">
125            <libsw library="sw_bundle" uuid="yyyy"/>
126            <libhw library="offload_bundle" uuid="zzzz"/>
127        </effectProxy>
128
129      </xs:documentation>
130    </xs:annotation>
131    <xs:choice maxOccurs="unbounded">
132      <xs:element name="effect" type="aec:effectType" minOccurs="0" maxOccurs="unbounded"/>
133      <xs:element name="effectProxy" type="aec:effectProxyType" minOccurs="0" maxOccurs="unbounded"/>
134    </xs:choice>
135  </xs:complexType>
136  <xs:complexType name="streamProcessingType">
137    <xs:sequence>
138      <xs:element name="apply" minOccurs="0" maxOccurs="unbounded">
139        <xs:complexType>
140          <xs:attribute name="effect" type="xs:string" use="required"/>
141        </xs:complexType>
142      </xs:element>
143    </xs:sequence>
144  </xs:complexType>
145  <xs:complexType name="streamPreprocessType">
146    <xs:annotation>
147      <xs:documentation xml:lang="en">
148        Audio preprocessing configuration. The processing configuration consists
149        of a list of elements each describing processing settings for a given
150        input stream. Valid input stream types are listed in "streamInputType".
151
152        Each stream element contains a list of "apply" elements. The value of the
153        "effect" attr must correspond to the name of an "effect" element.
154
155        Example:
156
157        <stream type="voice_communication">
158            <apply effect="effect1"/>
159            <apply effect="effect2"/>
160        </stream>
161
162      </xs:documentation>
163    </xs:annotation>
164    <xs:complexContent>
165      <xs:extension base="aec:streamProcessingType">
166        <xs:attribute name="type" type="aec:streamInputType" use="required"/>
167      </xs:extension>
168    </xs:complexContent>
169  </xs:complexType>
170  <xs:complexType name="streamPostprocessType">
171    <xs:annotation>
172      <xs:documentation xml:lang="en">
173        Audio postprocessing configuration. The processing configuration consists
174        of a list of elements each describing processing settings for a given
175        output stream. Valid output stream types are listed in "streamOutputType".
176
177        Each stream element contains a list of "apply" elements. The value of the
178        "effect" attr must correspond to the name of an "effect" element.
179
180        Example:
181
182        <stream type="music">
183            <apply effect="effect1"/>
184        </stream>
185
186      </xs:documentation>
187    </xs:annotation>
188    <xs:complexContent>
189      <xs:extension base="aec:streamProcessingType">
190        <xs:attribute name="type" type="aec:streamOutputType" use="required"/>
191      </xs:extension>
192    </xs:complexContent>
193  </xs:complexType>
194
195  <!-- Root element -->
196  <xs:element name="audio_effects_conf">
197    <xs:complexType>
198      <xs:sequence>
199        <xs:element name="libraries" type="aec:librariesType"/>
200        <xs:element name="effects" type="aec:effectsType"/>
201        <xs:element name="postprocess" minOccurs="0" maxOccurs="1">
202          <xs:complexType>
203            <xs:sequence>
204              <xs:element name="stream" type="aec:streamPostprocessType" minOccurs="0" maxOccurs="unbounded"/>
205            </xs:sequence>
206          </xs:complexType>
207        </xs:element>
208        <xs:element name="preprocess" minOccurs="0" maxOccurs="1">
209          <xs:complexType>
210            <xs:sequence>
211              <xs:element name="stream" type="aec:streamPreprocessType" minOccurs="0" maxOccurs="unbounded"/>
212            </xs:sequence>
213          </xs:complexType>
214        </xs:element>
215      </xs:sequence>
216      <xs:attribute name="version" type="aec:versionType" use="required"/>
217    </xs:complexType>
218
219    <!-- Keys and references -->
220    <xs:key name="libraryName">
221      <xs:selector xpath="aec:libraries/aec:library"/>
222      <xs:field xpath="@name"/>
223    </xs:key>
224    <xs:keyref name="libraryNameRef1" refer="aec:libraryName">
225      <xs:selector xpath="aec:effects/aec:effect"/>
226      <xs:field xpath="@library"/>
227    </xs:keyref>
228    <xs:keyref name="libraryNameRef2" refer="aec:libraryName">
229      <xs:selector xpath="aec:effects/aec:effect/aec:libsw"/>
230      <xs:field xpath="@library"/>
231    </xs:keyref>
232    <xs:keyref name="libraryNameRef3" refer="aec:libraryName">
233      <xs:selector xpath="aec:effects/aec:effect/aec:libhw"/>
234      <xs:field xpath="@library"/>
235    </xs:keyref>
236    <xs:key name="effectName">
237      <xs:selector xpath="aec:effects/aec:effect"/>
238      <xs:field xpath="@name"/>
239    </xs:key>
240    <xs:keyref name="effectNamePreRef" refer="aec:effectName">
241      <xs:selector xpath="aec:preprocess/aec:stream/aec:apply"/>
242      <xs:field xpath="@effect"/>
243    </xs:keyref>
244    <xs:keyref name="effectNamePostRef" refer="aec:effectName">
245      <xs:selector xpath="aec:postprocess/aec:stream/aec:apply"/>
246      <xs:field xpath="@effect"/>
247    </xs:keyref>
248  </xs:element>
249</xs:schema>
250