1 /**
  2  * @class audioBlock
  3  * @description
  4  *   Audio asset object.
  5  *
  6  *   An audio waveform is defined in sandboxe as a stream of samples,
  7  *   where samples are 2 channels of
  8  *   information representing the amplitude of the
  9  *   waveform at that point. More specifically,
 10  *   samples are 16-bit signed integers.
 11  *  Though, it is important to note that AudioBlocks represent stereo
 12  *  waveforms, where per sample, there exist two datum values, one for each channel. 
 13  *  As such, data for the waveform is
 14  *   interleaved to qualify both channels, where the subsequent sample
 15  *  corresponds to the channel opposite of the current one.
 16  *
 17  *
 18  *
 19  */ 
 20 function audioBlock() {
 21 
 22     /**
 23      * Clears the current data store of the AudioBlock and
 24      * replaces it with the given data.
 25      *
 26      * @param {Array} data The audio samples that the AudioBlock will now consist of. Audio samples ere are pairs of implitudes interpreted as uin16 values.
 27      */
 28     this.define = function(arrayOfSamples){};
 29 
 30     /**
 31      * Retrieves the raw data of the waveform.
 32      * @returns {Array} An array of audio samples representing the wave form, where audio samples are pairs of uint16 values.
 33      */
 34     this.read = function(){};
 35 
 36 
 37     /**
 38      * Creates a new audioblock that is a snippet of this audioBlock.
 39      * @param {Number} start The sample that the subblock should start at
 40      * @param {Number} end The sample that the sublock should end at
 41      * @returns {audioBlock} The new audioBlock
 42      */
 43     this.getSubBlock = function(start, end){};
 44 
 45     /**
 46      * Adds the given audioBlock at the end of this audioBlock
 47      * @param {audioBlock} block The audioBlock to append to this block
 48      */
 49     this.appendBlock = function(block){};
 50 
 51     /**
 52      * Removes the portion of the audioBlock specified
 53      * @param {Number} start Where to start removing from in samples
 54      * @param {Number} end Where to end removing from in samples
 55      */
 56     this.removeBlock = function(start, end){};
 57 
 58     /**
 59      * Inserts the data of the given audioBlock at the sample given 
 60      * within this audioBlock.
 61      * @param {Number} position The position to insert the block
 62      * @param {audioBlock} block The audioBlock to insert 
 63      */
 64     this.insertBlock = function(position, block){};
 65 
 66     /**
 67      * Returns the exact time in seconds that corresponds to the given sample.
 68      * @param {Number} sample The sample to query.
 69      */
 70     this.getSecondsFromSample = function(sample){};
 71 
 72     /**
 73      * Returns the exact sample that corresponds to the given time in seconds.
 74      * @param {Number} seconds The seconds to query.
 75      */
 76     this.getSampleFromSeconds = function(seconds){};
 77 
 78 
 79 
 80 
 81     /**
 82      * The base volume of the sample that should be used during playback.
 83      * Default value: 1.0
 84      * @type {Number}
 85      */
 86     this.volume = 1.0;
 87 
 88     /**
 89      * The base panning that should be used during playback. Default value: .5
 90      * @type {Number}
 91      */
 92     this.panning = 0.5;
 93 
 94     /**
 95      * Number of samples within this entire waveform. Writing to this value has no effect.
 96      * @type {Number}
 97      */
 98     this.numSamples = 0;
 99 
100     /**
101      * Total number of bytes that this audioBlock consists of.
102      * @type {Number}
103      */
104     this.numBytes = 0   ;
105     
106      
107     return this;
108 }