changeset 2683:15104a43089d

More cleanups for #180
author Nicholas Jillings <nicholas.jillings@mail.bcu.ac.uk>
date Wed, 01 Mar 2017 17:10:24 +0000
parents 0a72855de078
children f9cba2241c35
files js/WAVE.js js/loader.js
diffstat 2 files changed, 20 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/js/WAVE.js	Wed Mar 01 16:30:59 2017 +0000
+++ b/js/WAVE.js	Wed Mar 01 17:10:24 2017 +0000
@@ -1,6 +1,7 @@
 // Decode and perform WAVE file byte level manipulation
+/*globals console, Uint8Array, Float32Array, Float64Array */
 
-find_subarray = function (arr, subarr) {
+function find_subarray(arr, subarr) {
     var arr_length = arr.length;
     var subarr_length = subarr.length;
     var last_check_index = arr_length - subarr_length;
@@ -15,7 +16,7 @@
             return i;
         }
     return -1;
-};
+}
 
 function convertToInteger(arr) {
     var value = 0;
@@ -35,24 +36,24 @@
 
 function WAVE() {
     // The WAVE file object
-    this.status == 'WAVE_DECLARED'
+    this.status = 'WAVE_DECLARED';
 
     this.decoded_data = null;
 
     this.RIFF = String(); //ChunkID
-    this.size; //ChunkSize
-    this.FT_Header; //Format
-    this.fmt_marker; //Subchunk1ID
-    this.formatDataLength; //Subchunk1Size
-    this.type; //AudioFormat
-    this.num_channels; //NumChannels
-    this.sample_rate; //SampleRate
-    this.byte_rate; //ByteRate
-    this.block_align; //BlockAlign
-    this.bits_per_sample; //BitsPerSample
-    this.data_header; //Subchunk2ID
-    this.data_size; //Subchunk2Size
-    this.num_samples;
+    this.size = undefined; //ChunkSize
+    this.FT_Header = undefined; //Format
+    this.fmt_marker = undefined; //Subchunk1ID
+    this.formatDataLength = undefined; //Subchunk1Size
+    this.type = undefined; //AudioFormat
+    this.num_channels = undefined; //NumChannels
+    this.sample_rate = undefined; //SampleRate
+    this.byte_rate = undefined; //ByteRate
+    this.block_align = undefined; //BlockAlign
+    this.bits_per_sample = undefined; //BitsPerSample
+    this.data_header = undefined; //Subchunk2ID
+    this.data_size = undefined; //Subchunk2Size
+    this.num_samples = undefined;
 
     this.open = function (IOArrayBuffer) {
         var IOView8 = new Uint8Array(IOArrayBuffer);
--- a/js/loader.js	Wed Mar 01 16:30:59 2017 +0000
+++ b/js/loader.js	Wed Mar 01 17:10:24 2017 +0000
@@ -1,8 +1,8 @@
 // Script to load the relevant JS files if the system supports it
-
+/*globals window, document */
 window.onload = function () {
     // First check if the Web Audio API is supported
-    if (window.AudioContext == undefined && window.webkitAudioContext == undefined) {
+    if (window.AudioContext === undefined && window.webkitAudioContext === undefined) {
         // Display unsuported error message
         var body = document.getElementsByTagName("body")[0];
         body.innerHTML = "<h1>Sorry! Your browser is not supported :(</h1><p>Your browser does not support the HTML5 Web Audio API. Please use one of the following supported browsers instead.<p>";
@@ -26,4 +26,4 @@
             head.appendChild(script);
         }
     }
-}
+};