comparison core.js @ 387:5995d8fe96eb Dev_main

APE Multi-interface can be named. Audio Element <file> node fixed.
author Nicholas Jillings <nicholas.jillings@eecs.qmul.ac.uk>
date Tue, 08 Dec 2015 15:04:59 +0000
parents 38439b21d369
children 629b96c14ee1
comparison
equal deleted inserted replaced
386:4cfd32ff1334 387:5995d8fe96eb
1068 this.exportXMLDOM = function() { 1068 this.exportXMLDOM = function() {
1069 var root = document.createElement('audioElement'); 1069 var root = document.createElement('audioElement');
1070 root.id = this.specification.id; 1070 root.id = this.specification.id;
1071 root.setAttribute('url',this.url); 1071 root.setAttribute('url',this.url);
1072 var file = document.createElement('file'); 1072 var file = document.createElement('file');
1073 file.setAttribute('sampleRate',this.buffer.sampleRate); 1073 file.setAttribute('sampleRate',this.buffer.buffer.sampleRate);
1074 file.setAttribute('channels',this.buffer.numberOfChannels); 1074 file.setAttribute('channels',this.buffer.buffer.numberOfChannels);
1075 file.setAttribute('sampleCount',this.buffer.length); 1075 file.setAttribute('sampleCount',this.buffer.buffer.length);
1076 file.setAttribute('duration',this.buffer.duration); 1076 file.setAttribute('duration',this.buffer.buffer.duration);
1077 root.appendChild(file); 1077 root.appendChild(file);
1078 if (this.specification.type != 'outsidereference') { 1078 if (this.specification.type != 'outsidereference') {
1079 var interfaceXML = this.interfaceDOM.exportXMLDOM(this); 1079 var interfaceXML = this.interfaceDOM.exportXMLDOM(this);
1080 if (interfaceXML.length == undefined) { 1080 if (interfaceXML.length == undefined) {
1081 root.appendChild(); 1081 root.appendChild();
1508 } else { 1508 } else {
1509 commonInterfaceNode = undefined; 1509 commonInterfaceNode = undefined;
1510 } 1510 }
1511 1511
1512 this.commonInterface = new function() { 1512 this.commonInterface = new function() {
1513 this.name = undefined;
1514 this.OptionNode = function(child) { 1513 this.OptionNode = function(child) {
1515 this.type = child.nodeName; 1514 this.type = child.nodeName;
1516 if (this.type == 'option') 1515 if (this.type == 'option')
1517 { 1516 {
1518 this.name = child.getAttribute('name'); 1517 this.name = child.getAttribute('name');
1542 else {this.enforce = false;} 1541 else {this.enforce = false;}
1543 } 1542 }
1544 }; 1543 };
1545 this.options = []; 1544 this.options = [];
1546 if (commonInterfaceNode != undefined) { 1545 if (commonInterfaceNode != undefined) {
1547 var name = commonInterfaceNode.getAttribute("name");
1548 if (name != undefined) {
1549 this.name = name;
1550 }
1551 var child = commonInterfaceNode.firstElementChild; 1546 var child = commonInterfaceNode.firstElementChild;
1552 while (child != undefined) { 1547 while (child != undefined) {
1553 this.options.push(new this.OptionNode(child)); 1548 this.options.push(new this.OptionNode(child));
1554 child = child.nextElementSibling; 1549 child = child.nextElementSibling;
1555 } 1550 }
1926 1921
1927 this.interfaceNode = function() { 1922 this.interfaceNode = function() {
1928 this.title = undefined; 1923 this.title = undefined;
1929 this.options = []; 1924 this.options = [];
1930 this.scale = []; 1925 this.scale = [];
1926 this.name = undefined;
1931 this.decode = function(DOM) 1927 this.decode = function(DOM)
1932 { 1928 {
1933 var title = DOM.getElementsByTagName('title'); 1929 var title = DOM.getElementsByTagName('title');
1934 if (title.length == 0) {this.title = null;} 1930 if (title.length == 0) {this.title = null;}
1935 else {this.title = title[0].textContent;} 1931 else {this.title = title[0].textContent;}
1932 var name = DOM.getAttribute("name");
1933 if (name != undefined) {this.name = name;}
1936 this.options = parent.commonInterface.options; 1934 this.options = parent.commonInterface.options;
1937 var scale = DOM.getElementsByTagName('scale'); 1935 var scale = DOM.getElementsByTagName('scale');
1938 this.scale = []; 1936 this.scale = [];
1939 for (var i=0; i<scale.length; i++) { 1937 for (var i=0; i<scale.length; i++) {
1940 var arr = [null, null]; 1938 var arr = [null, null];