changeset 2218:30bffc455b4d

Included crossFade in <setup> node schema. Specification now converts restricted data classes into their correct type.
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Wed, 13 Apr 2016 14:21:04 +0100
parents cb27ece65a5c
children d87b8419df28
files core.js specification.js test-schema.xsd
diffstat 3 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/core.js	Tue Apr 12 11:48:40 2016 +0100
+++ b/core.js	Wed Apr 13 14:21:04 2016 +0100
@@ -1278,13 +1278,13 @@
 			this.timer.startTest();
 			if (id == undefined) {
 				id = -1;
-				console.log('FATAL - Passed id was undefined - AudioEngineContext.play(id)');
+				console.error('FATAL - Passed id was undefined - AudioEngineContext.play(id)');
 				return;
 			} else {
 				interfaceContext.playhead.setTimePerPixel(this.audioObjects[id]);
 			}
 			if (this.loopPlayback) {
-                var setTime = audioContext.currentTime;
+                var setTime = audioContext.currentTime+specification.crossFade;
 				for (var i=0; i<this.audioObjects.length; i++)
 				{
 					this.audioObjects[i].play(setTime);
@@ -1295,7 +1295,7 @@
 					}
 				}
 			} else {
-                var setTime = audioContext.currentTime+0.1;
+                var setTime = audioContext.currentTime+specification.crossFade;
 				for (var i=0; i<this.audioObjects.length; i++)
 				{
 					if (i != id) {
--- a/specification.js	Tue Apr 12 11:48:40 2016 +0100
+++ b/specification.js	Wed Apr 13 14:21:04 2016 +0100
@@ -27,7 +27,19 @@
 		}
 		var dataType = schema.getAttribute('type');
 		if (typeof dataType == "string") { dataType = dataType.substr(3);}
-		else {dataType = "string";}
+		else {
+            var rest = schema.getAllElementsByTagName("xs:restriction").concat(schema.getAllElementsByTagName("xs:enumeration"));
+            if (rest.length > 0) {
+                dataType = rest[0].getAttribute("base");
+                if (typeof dataType == "string") {
+                    dataType = dataType.substr(3);
+                } else {
+                    dataType = "string";
+                }
+            } else {
+                dataType = "string";
+            }
+        }
 		if (attribute == null)
 		{
 			return attribute;
--- a/test-schema.xsd	Tue Apr 12 11:48:40 2016 +0100
+++ b/test-schema.xsd	Wed Apr 13 14:21:04 2016 +0100
@@ -52,6 +52,13 @@
                 <xs:attribute name="loudness" type="xs:nonPositiveInteger" use="optional" />
                 <xs:attribute name="sampleRate" type="xs:positiveInteger" use="optional" />
                 <xs:attribute name="calibration" type="xs:boolean" default="false" />
+                <xs:attribute name="crossFade" default="0.0">
+                    <xs:simpleType>
+                        <xs:restriction base="xs:decimal">
+                            <xs:minInclusive value="0.0" />
+                        </xs:restriction>
+                    </xs:simpleType>
+                </xs:attribute>
                 <xs:attribute ref="preSilence" />
                 <xs:attribute ref="postSilence" />
             </xs:complexType>