/*
 * Copyright (c) 2013 Csernik Flaviu Andrei
 *
 * See the file LICENSE.txt for copying permission.
 * 
 */

"use strict";

window.AudioContext = window.AudioContext || window.webkitAudioContext;

function PropertyNotInitialized(obj, propName) {
  this.property = propName;
  this.obj      = obj;
}

PropertyNotInitialized.prototype.toString = function () {
  return this.obj + " : " + this.property + " not initialized.";
};

function isInteger(n) {
   return typeof n === "number" && Math.floor(n) == n;
}

function checkNat(callerName, n) {

  if (isInteger) {
    if (value <= 0) {
      throw new RangeError("downsampleFactor must be positive." +
                           "given number is not: " + value);
    }
  } else {
    throw new TypeError("downsampleFactor accepts an integer but" +
                        "given type is " + typeof value);
  }

}

@@ -543,15 +543,18 @@
 ) %7B%0A
+  
 %0A  if (
+!
 isIn
@@ -566,32 +566,8 @@
 ) %7B%0A
-    if (value %3C= 0) %7B%0A  
     
@@ -580,12 +580,11 @@
 new 
-Rang
+Typ
 eErr
@@ -608,32 +608,34 @@
 tor 
-must be positive.
+accepts an integer but
 %22 +%0A
-   
     
@@ -665,49 +665,57 @@
 ven 
-number is not: %22 + value);%0A    %7D%0A  %7D else
+type is %22 + typeof value);%0A  %7D%0A%0A  if (value %3C= 0)
  %7B%0A 
@@ -719,35 +719,36 @@
 %7B%0A    throw new 
-Typ
+Rang
 eError(%22downsamp
@@ -760,34 +760,30 @@
 tor 
-accepts an integer but
+must be positive.
 %22 +%0A
+ 
     
@@ -809,34 +809,34 @@
  %22given 
-type is %22 + typeof
+number is not: %22 +
  value);

Simplify checkNat.