annotate interfaces/blank.js @ 1342:397e96ee781a

Better loudness calculation. Buffer ready not called until after loudness calculation to avoid NaNs on gain. <survey> nodes do not need to be present, no survey then no node. Added example boilerplate interface with all required functions and brief descriptions.
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Wed, 13 Jan 2016 10:31:31 +0000
parents
children 159b87e5de67
rev   line source
nickjillings@1342 1 /**
nickjillings@1342 2 * WAET Blank Template
nickjillings@1342 3 * Use this to start building your custom interface
nickjillings@1342 4 */
nickjillings@1342 5
nickjillings@1342 6 // Once this is loaded and parsed, begin execution
nickjillings@1342 7 loadInterface();
nickjillings@1342 8
nickjillings@1342 9 function loadInterface() {
nickjillings@1342 10 // Use this to do any one-time page / element construction. For instance, placing any stationary text objects,
nickjillings@1342 11 // holding div's, or setting up any nodes which are present for the entire test sequence
nickjillings@1342 12 };
nickjillings@1342 13
nickjillings@1342 14 function loadTest(page)
nickjillings@1342 15 {
nickjillings@1342 16 // Called each time a new test page is to be build. The page specification node is the only item passed in
nickjillings@1342 17 }
nickjillings@1342 18
nickjillings@1342 19 function interfaceObject()
nickjillings@1342 20 {
nickjillings@1342 21 // An example node, you can make this however you want for each audioElement.
nickjillings@1342 22 // However, every audioObject (audioEngineContext.audioObject) MUST have an interface object with the following
nickjillings@1342 23 // You attach them by calling audioObject.bindInterface( )
nickjillings@1342 24 this.enable = function()
nickjillings@1342 25 {
nickjillings@1342 26 // This is used to tell the interface object that playback of this node is ready
nickjillings@1342 27 };
nickjillings@1342 28 this.updateLoading = function(progress)
nickjillings@1342 29 {
nickjillings@1342 30 // progress is a value from 0 to 100 indicating the current download state of media files
nickjillings@1342 31 };
nickjillings@1342 32 this.getValue = function()
nickjillings@1342 33 {
nickjillings@1342 34 // Return the current value of the object. If there is no value, return 0
nickjillings@1342 35 };
nickjillings@1342 36 this.getPresentedId = function()
nickjillings@1342 37 {
nickjillings@1342 38 // Return the presented ID of the object. For instance, the APE has sliders starting from 0. Whilst AB has alphabetical scale
nickjillings@1342 39 };
nickjillings@1342 40 this.canMove = function()
nickjillings@1342 41 {
nickjillings@1342 42 // Return either true or false if the interface object can be moved. AB / Reference cannot, whilst sliders can and therefore have a continuous scale.
nickjillings@1342 43 // These are checked primarily if the interface check option 'fragmentMoved' is enabled.
nickjillings@1342 44 };
nickjillings@1342 45 this.exportXMLDOM = function(audioObject) {
nickjillings@1342 46 // Called by the audioObject holding this element to export the interface <value> node.
nickjillings@1342 47 // If there is no value node (such as outside reference), return null
nickjillings@1342 48 // 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
nickjillings@1342 49 // Use storage.document.createElement('value'); to generate the XML node.
nickjillings@1342 50
nickjillings@1342 51 };
nickjillings@1342 52 };
nickjillings@1342 53
nickjillings@1342 54 function resizeWindow(event)
nickjillings@1342 55 {
nickjillings@1342 56 // Called on every window resize event, use this to scale your page properly
nickjillings@1342 57 }
nickjillings@1342 58
nickjillings@1342 59 function pageXMLSave(store, pageSpecification)
nickjillings@1342 60 {
nickjillings@1342 61 // MANDATORY
nickjillings@1342 62 // Saves a specific test page
nickjillings@1342 63 // You can use this space to add any extra nodes to your XML <audioHolder> saves
nickjillings@1342 64 // Get the current <page> information in store (remember to appendChild your data to it)
nickjillings@1342 65 // pageSpecification is the current page node configuration
nickjillings@1342 66 // To create new XML nodes, use storage.document.createElement();
nickjillings@1342 67 }