annotate interfaces/blank.js @ 471:3a9b869ba7f8 Dev_main

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