<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.hydrogen-music.org/drumkit_pattern"
	xmlns:h2="http://www.hydrogen-music.org/drumkit_pattern"
	elementFormDefault="qualified">

<!-- BOOL -->
<xsd:simpleType name="bool">
	<xsd:restriction base="xsd:string">
		<xsd:enumeration value="true"/>
		<xsd:enumeration value="false"/>
	</xsd:restriction>
</xsd:simpleType>

<!-- PSFLOAT - positive small float [0.0; 1.0] -->
<xsd:simpleType name='psfloat'>
	<xsd:restriction base='xsd:float'>
		<xsd:minInclusive value='0.0'/>
		<xsd:maxInclusive value='1.0'/>
	</xsd:restriction>
</xsd:simpleType>

<!-- PSFLOAT - positive small float [0.0; 0.5] -->
<xsd:simpleType name='psfloat5'>
	<xsd:restriction base='xsd:float'>
		<xsd:minInclusive value='0.0'/>
		<xsd:maxInclusive value='0.5'/>
	</xsd:restriction>
</xsd:simpleType>

<!-- NOTE -->
<xsd:element name="note">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element name="position"	type="xsd:nonNegativeInteger"	default="0"/>
			<xsd:element name="leadlag"		type="xsd:float"		default="0.0"/>
			<xsd:element name="velocity"	type="h2:psfloat"		default="0.8"/>
			<xsd:element name="pan_L"		type="h2:psfloat5"		default="0.5"/>
			<xsd:element name="pan_R"		type="h2:psfloat5"		default="0.5"/>
			<xsd:element name="pitch"		type="xsd:float"		default="0.0"/>
			<xsd:element name="key"			type="xsd:string"		default="C0"/>
			<xsd:element name="length"		type="xsd:integer"		default="-1"/>
			<xsd:element name="instrument"	type="xsd:integer"/>
			<xsd:element name="note_off"	type="h2:bool"			default="false"/>
			<xsd:element name="probability"	type="xsd:float"		default="1.0"/>
		</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="pattern">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element name="name"		type="xsd:string"		default="unknown"/>
			<xsd:element name="info"		type="xsd:string"/>
			<xsd:element name="category"	type="xsd:string"		default="unknown"/>
			<xsd:element name="size"		type="xsd:nonNegativeInteger"/>
			<xsd:element name="noteList">
				<xsd:complexType>
					<xsd:sequence>
						<xsd:element ref="h2:note" minOccurs="0" maxOccurs="1000"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
</xsd:element>

<!-- DRUMKIT PATTERN -->
<xsd:element name="drumkit_pattern">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element name="drumkit_name"	type="xsd:string"/>
			<xsd:element name="author"			type="xsd:string"/>
			<xsd:element name="license"			type="xsd:string"/>
			<xsd:element ref="h2:pattern" minOccurs="1" maxOccurs="1"/>
		</xsd:sequence>
	</xsd:complexType>
</xsd:element>

</xsd:schema>
