# HG changeset patch # User Nicholas Jillings # Date 1452681091 0 # Node ID 3924a4e1499b01d5a7fc1431ef48176408d95222 # Parent df4284a31f696365ad0a1712436d280e7c7c424e Better loudness calculation. Buffer ready not called until after loudness calculation to avoid NaNs on gain. nodes do not need to be present, no survey then no node. Added example boilerplate interface with all required functions and brief descriptions. diff -r df4284a31f69 -r 3924a4e1499b core.js --- a/core.js Wed Jan 13 09:34:46 2016 +0000 +++ b/core.js Wed Jan 13 10:31:31 2016 +0000 @@ -730,12 +730,14 @@ this.initialise(); } if (this.stateIndex == -1) { + this.stateIndex++; console.log('Starting test...'); if (this.preTestSurvey != null) { popup.initState(this.preTestSurvey,storage.globalPreTest); + } else { + this.advanceState(); } - this.stateIndex++; } else if (this.stateIndex == this.stateMap.length) { // All test pages complete, post test @@ -860,6 +862,17 @@ this.xmlRequest = new XMLHttpRequest(); this.xmlRequest.parent = this; this.users = []; + this.ready = function() + { + for (var i=0; i node. + // If there is no value node (such as outside reference), return null + // If there are multiple value nodes (such as multiple scale / 2D scales), return an array of nodes with each value node having an 'interfaceName' attribute + // Use storage.document.createElement('value'); to generate the XML node. + + }; +}; + +function resizeWindow(event) +{ + // Called on every window resize event, use this to scale your page properly +} + +function pageXMLSave(store, pageSpecification) +{ + // MANDATORY + // Saves a specific test page + // You can use this space to add any extra nodes to your XML saves + // Get the current information in store (remember to appendChild your data to it) + // pageSpecification is the current page node configuration + // To create new XML nodes, use storage.document.createElement(); +} \ No newline at end of file diff -r df4284a31f69 -r 3924a4e1499b interfaces/mushra.js --- a/interfaces/mushra.js Wed Jan 13 09:34:46 2016 +0000 +++ b/interfaces/mushra.js Wed Jan 13 10:31:31 2016 +0000 @@ -166,18 +166,18 @@ var node = interfaceContext.createCommentBox(audioObject); // Create a slider per track - audioObject.bindInterface(new sliderObject(audioObject,label)); + var sliderObj = new sliderObject(audioObject,label); if (typeof audioHolderObject.initialPosition === "number") { // Set the values - audioObject.interfaceDOM.slider.value = audioHolderObject.initalPosition; + sliderObj.slider.value = audioHolderObject.initalPosition; } else { // Distribute it randomnly - audioObject.interfaceDOM.slider.value = Math.random(); + sliderObj.slider.value = Math.random(); } - sliderBox.appendChild(audioObject.interfaceDOM.holder); - audioObject.metric.initialise(audioObject.interfaceDOM.slider.value); + sliderBox.appendChild(sliderObj.holder); + audioObject.bindInterface(sliderObj); label += 1; } diff -r df4284a31f69 -r 3924a4e1499b loudness.js --- a/loudness.js Wed Jan 13 09:34:46 2016 +0000 +++ b/loudness.js Wed Jan 13 10:31:31 2016 +0000 @@ -34,7 +34,7 @@ } if (offlineContext == undefined) { - offlineContext = new OfflineAudioContext(buffer.numberOfChannels, buffer.length, buffer.sampleRate); + offlineContext = new OfflineAudioContext(buffer.buffer.numberOfChannels, buffer.buffer.length, buffer.buffer.sampleRate); } // Create the required filters var KFilter = offlineContext.createBiquadFilter(); @@ -48,7 +48,7 @@ HPFilter.frequency.value = 60; // copy Data into the process buffer var processSource = offlineContext.createBufferSource(); - processSource.buffer = buffer; + processSource.buffer = buffer.buffer; processSource.connect(KFilter); KFilter.connect(HPFilter); @@ -100,7 +100,8 @@ } } var overallRelLoudness = calculateOverallLoudnessFromChannelBlocks(relgateEnergy); - buffer.lufs = overallRelLoudness; + buffer.buffer.lufs = overallRelLoudness; + buffer.ready(); } }; offlineContext.startRendering(); diff -r df4284a31f69 -r 3924a4e1499b test-schema.xsd --- a/test-schema.xsd Wed Jan 13 09:34:46 2016 +0000 +++ b/test-schema.xsd Wed Jan 13 10:31:31 2016 +0000 @@ -23,7 +23,7 @@ - + @@ -44,7 +44,7 @@ - +