Mercurial > hg > webaudioevaluationtool
changeset 2418:3013cf945716
Merge branch 'Dev_main'
author | Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk> |
---|---|
date | Fri, 27 May 2016 12:16:42 +0100 |
parents | b7ed9d43ea87 (current diff) dd8894bca691 (diff) |
children | 4718cd881d3a 02d5d22d7018 |
files | js/specification.js |
diffstat | 5 files changed, 48 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/js/core.js Fri May 27 12:15:40 2016 +0100 +++ b/js/core.js Fri May 27 12:16:42 2016 +0100 @@ -1677,7 +1677,7 @@ } else { this.outputGain.gain.setValueAtTime(0.0,startTime); } - this.bufferNode.start(startTime); + this.bufferNode.start(startTime,this.specification.startTime || 0, this.specification.stopTime-this.specification.startTime || this.buffer.buffer.duration); this.bufferNode.playbackStartTime = audioEngineContext.timer.getTestTime(); } }; @@ -2488,7 +2488,7 @@ this.outsideReferenceHolder = document.createElement('button'); this.outsideReferenceHolder.className = 'outside-reference'; this.outsideReferenceHolder.setAttribute('track-id',index); - this.outsideReferenceHolder.textContent = "Play Reference"; + this.outsideReferenceHolder.textContent = this.parent.specification.label || "Reference"; this.outsideReferenceHolder.disabled = true; this.outsideReferenceHolder.onclick = function(event) @@ -2511,7 +2511,7 @@ progress = progress.split('.')[0]; this.outsideReferenceHolder.textContent = progress+'%'; } else { - this.outsideReferenceHolder.textContent = "Play Reference"; + this.outsideReferenceHolder.textContent = this.parent.specification.label || "Reference"; } }; this.startPlayback = function() @@ -2536,7 +2536,7 @@ }; this.getPresentedId = function() { - return 'Reference'; + return this.parent.specification.label || "Reference"; }; this.canMove = function() {
--- a/js/specification.js Fri May 27 12:15:40 2016 +0100 +++ b/js/specification.js Fri May 27 12:16:42 2016 +0100 @@ -625,6 +625,9 @@ this.marker = null; this.enforce = false; this.gain = 0.0; + this.label = null; + this.startTime = null; + this.stopTime = null; this.schema = specification.schema.getAllElementsByName('audioelement')[0];; this.parent = null; this.decode = function(parent,xml)
--- a/test_create/attributes.json Fri May 27 12:15:40 2016 +0100 +++ b/test_create/attributes.json Fri May 27 12:16:42 2016 +0100 @@ -13,7 +13,6 @@ "repeatCount": "Repeat Count", "loop": "Loop playback", "synchronous": "Synchronous playback", - "showElementComments": "Show Comment Boxes", "type": "Type", "min": "Minimum", "max": "Maximum",
--- a/test_create/test_core.js Fri May 27 12:15:40 2016 +0100 +++ b/test_create/test_core.js Fri May 27 12:16:42 2016 +0100 @@ -1332,7 +1332,7 @@ span.textContent = "NOTE FOR SAFARI! You cannot right click on the below link and save it as a file, Safari does not like that at all. Instead click on it to open the XML, the Press Cmd+S to open the save dialogue. Make sure you have 'save as Page Source' selected on the bottom of the window. Currently Safari has no plans to support the HTML 'download' attribute which causes this problem"; obj.content.appendChild(span); var link = document.createElement("div"); - link.appendChild(doc.firstElementChild); + link.appendChild(doc.firstChild); var file = [link.innerHTML]; var bb = new Blob(file,{type : 'application/xml'}); var dnlk = window.URL.createObjectURL(bb); @@ -1946,6 +1946,31 @@ this.deleteNode.root.textContent = "Delete Entry"; this.deleteNode.root.addEventListener("click",this.deleteNode,false); this.buttonDOM.appendChild(this.deleteNode.root); + + this.moveToPosition = function(new_index){ + new_index = Math.min(new_index,this.parent.children.length); + var curr_index = this.parent.children.findIndex(function(elem){ + if (elem == this) {return true;} else {return false;} + },this); + // Split at the current location to remove the node and shift all the children up + var tail = this.parent.children.splice(curr_index+1); + this.parent.children.pop(); + this.parent.children = this.parent.children.concat(tail); + + //Split at the new location and insert the node + tail = this.parent.children.splice(new_index); + this.parent.children.push(this); + this.parent.children = this.parent.children.concat(tail); + + // Re-build the specification + this.parent.specification.options = []; + this.parent.childrenDOM.innerHTML = ""; + for (var obj of this.parent.children) { + this.parent.specification.options.push(obj.specification); + this.parent.childrenDOM.appendChild(obj.rootDOM); + } + + } } this.addNode = { root: document.createElement("button"),
--- a/xml/test-schema.xsd Fri May 27 12:15:40 2016 +0100 +++ b/xml/test-schema.xsd Fri May 27 12:16:42 2016 +0100 @@ -81,7 +81,6 @@ <xs:attribute name="repeatCount" type="xs:nonNegativeInteger" default="0" /> <xs:attribute name="loop" type="xs:boolean" default="false" /> <xs:attribute name="synchronous" type="xs:boolean" default="false" /> - <xs:attribute name="showElementComments" type="xs:boolean" default="false" /> <xs:attribute name="loudness" type="xs:nonPositiveInteger" use="optional" /> <xs:attribute name="label" use="optional" default="default"> <xs:simpleType> @@ -161,6 +160,7 @@ <xs:attribute ref="id" use="required" /> <xs:attribute name="url" type="xs:anyURI" use="required" /> <xs:attribute name="gain" type="xs:decimal" default="0" /> + <xs:attribute name="label" type="xs:string" /> <xs:attribute ref="name" /> <xs:attribute name="type" default="normal"> <xs:simpleType> @@ -184,6 +184,20 @@ <xs:attribute ref="alwaysInclude" /> <xs:attribute ref="preSilence" /> <xs:attribute ref="postSilence" /> + <xs:attribute name="startTime" use="optional"> + <xs:simpleType> + <xs:restriction base="xs:decimal"> + <xs:minInclusive value="0" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="stopTime" use="optional"> + <xs:simpleType> + <xs:restriction base="xs:decimal"> + <xs:minInclusive value="0" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> </xs:complexType> </xs:element>