annotate interfaces/blank.js @ 546:df2d916fd9cf Dev_main

Interfaces report error if audio cannot be loaded/decoded/played
author Nicholas Jillings <n.g.r.jillings@se14.qmul.ac.uk>
date Mon, 22 Feb 2016 15:48:28 +0000
parents 159b87e5de67
children
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@489 32 this.startPlayback = function()
n@489 33 {
n@489 34 // Called when playback has begun
n@489 35 };
n@489 36 this.stopPlayback = function()
n@489 37 {
n@489 38 // Called when playback has stopped. This gets called even if playback never started!
n@489 39 };
n@471 40 this.getValue = function()
n@471 41 {
n@471 42 // Return the current value of the object. If there is no value, return 0
n@471 43 };
n@471 44 this.getPresentedId = function()
n@471 45 {
n@471 46 // Return the presented ID of the object. For instance, the APE has sliders starting from 0. Whilst AB has alphabetical scale
n@471 47 };
n@471 48 this.canMove = function()
n@471 49 {
n@471 50 // 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 51 // These are checked primarily if the interface check option 'fragmentMoved' is enabled.
n@471 52 };
n@471 53 this.exportXMLDOM = function(audioObject) {
n@471 54 // Called by the audioObject holding this element to export the interface <value> node.
n@471 55 // If there is no value node (such as outside reference), return null
n@471 56 // 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 57 // Use storage.document.createElement('value'); to generate the XML node.
n@471 58
n@471 59 };
n@546 60 this.error = function() {
n@546 61 // If there is an error with the audioObject, this will be called to indicate a failure
n@546 62 }
n@471 63 };
n@471 64
n@471 65 function resizeWindow(event)
n@471 66 {
n@471 67 // Called on every window resize event, use this to scale your page properly
n@471 68 }
n@471 69
n@471 70 function pageXMLSave(store, pageSpecification)
n@471 71 {
n@471 72 // MANDATORY
n@471 73 // Saves a specific test page
n@471 74 // You can use this space to add any extra nodes to your XML <audioHolder> saves
n@471 75 // Get the current <page> information in store (remember to appendChild your data to it)
n@471 76 // pageSpecification is the current page node configuration
n@471 77 // To create new XML nodes, use storage.document.createElement();
n@471 78 }