Skip to content

Commit f06c099

Browse files
author
Raphael Serota
committed
tests for createfilter
1 parent f8f7a17 commit f06c099

File tree

9 files changed

+34637
-29
lines changed

9 files changed

+34637
-29
lines changed

build/wad.js

Lines changed: 17287 additions & 8 deletions
Large diffs are not rendered by default.

build/wad.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/wad.min.js

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Tuna from 'tunajs';
22
import Polywad from './polywad';
33
import { pitches } from './pitches';
4+
import _ from 'lodash';
45

56

67
let audioContext = window.AudioContext || window.webkitAudioContext;
@@ -111,16 +112,15 @@ let constructEnv = function(arg){
111112
release : arg.env ? valueOrDefault(arg.env.release, 0) : 0 // time in seconds from sustain volume to zero volume
112113
};
113114
};
114-
/////////////////////////////////////////
115115

116116

117117
/** Set up the default filter and filter envelope. **/
118-
let constructFilter = function(that, arg){
118+
let constructFilter = function(arg){
119119

120-
if ( !arg.filter ) { arg.filter = null; }
120+
if ( !arg.filter ) { return null; }
121121

122-
else if ( isArray(arg.filter) ) {
123-
that.filter = arg.filter.map(function(filterArg){
122+
else if ( _.isArray(arg.filter) ) {
123+
return arg.filter.map(function(filterArg){
124124
return {
125125
type : filterArg.type || 'lowpass',
126126
frequency : filterArg.frequency || 600,
@@ -130,15 +130,14 @@ let constructFilter = function(that, arg){
130130
});
131131
}
132132
else {
133-
that.filter = [{
133+
return [{
134134
type : arg.filter.type || 'lowpass',
135135
frequency : arg.filter.frequency || 600,
136136
q : arg.filter.q || 1,
137137
env : arg.filter.env ||null,
138138
}];
139139
}
140140
};
141-
//////////////////////////////////////////////////////
142141

143142

144143
/** If the Wad uses an audio file as the source, request it from the server.

src/wad.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ let Wad = function(arg){
5050
this.env = constructEnv(arg);
5151
this.defaultEnv = constructEnv(arg);
5252
this.userSetHold = !!(arg.env && arg.env.hold); //_
53-
constructFilter(this, arg);
53+
//constructFilter(this, arg);
54+
this.filter = constructFilter(arg);
5455
constructVibrato(this, arg);
5556
constructTremolo(this, arg);
5657
constructReverb(this, arg);

0 commit comments

Comments
 (0)