Skip to content

Commit 91e8d72

Browse files
committed
Merge pull request #146 from iceddev/0.4.3
0.4.3
2 parents eaedc0c + b428d88 commit 91e8d72

3 files changed

Lines changed: 22 additions & 21 deletions

File tree

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: node_js
22
node_js:
3-
- "0.8"
43
- "0.10"
54
notifications:
65
email:
@@ -14,4 +13,4 @@ before_install:
1413
- "npm install -g bower grunt-cli"
1514
- "bower install --production"
1615
- "mv deps/hammer/dist/hammer.js deps/hammer/hammer.js"
17-
- "mv deps/Box2d/index.js deps/Box2d.min.js"
16+
- "mv deps/Box2d/index.js deps/Box2d.min.js"

specs/sounds/WebAudioSpec.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ define([
2020
var sound;
2121
var filename = 'specs/fixtures/yipee.wav';
2222
var filename2 = 'specs/fixtures/yipee';
23-
var noteOn = jasmine.createSpy('noteOn');
23+
var start = jasmine.createSpy('start');
2424

2525
beforeEach(function(){
2626
sound = new WebAudio();
@@ -147,7 +147,7 @@ define([
147147

148148
beforeEach(function(){
149149
spyOn(sound, '_initAudio').andReturn({
150-
noteOn: noteOn
150+
start: start
151151
});
152152

153153
runs(function(){
@@ -183,11 +183,11 @@ define([
183183
});
184184
});
185185

186-
it('should call noteOn with startTime of 0', function(){
186+
it('should call start with startTime of 0', function(){
187187
runs(function(){
188188
sound.loop();
189-
expect(noteOn).toHaveBeenCalled();
190-
expect(noteOn).toHaveBeenCalledWith(0);
189+
expect(start).toHaveBeenCalled();
190+
expect(start).toHaveBeenCalledWith(0);
191191
});
192192
});
193193

@@ -197,7 +197,7 @@ define([
197197

198198
beforeEach(function(){
199199
spyOn(sound, '_initAudio').andReturn({
200-
noteOn: noteOn
200+
start: start
201201
});
202202

203203
runs(function(){
@@ -233,19 +233,19 @@ define([
233233
});
234234
});
235235

236-
it('should call noteOn with startTime of 0 if startTime not passed in', function(){
236+
it('should call start with startTime of 0 if startTime not passed in', function(){
237237
runs(function(){
238238
sound.play();
239-
expect(noteOn).toHaveBeenCalled();
240-
expect(noteOn).toHaveBeenCalledWith(0);
239+
expect(start).toHaveBeenCalled();
240+
expect(start).toHaveBeenCalledWith(0);
241241
});
242242
});
243243

244-
it('should call noteOn with startTime passed in', function(){
244+
it('should call start with startTime passed in', function(){
245245
runs(function(){
246246
sound.play(1, 100);
247-
expect(noteOn).toHaveBeenCalled();
248-
expect(noteOn).toHaveBeenCalledWith(100);
247+
expect(start).toHaveBeenCalled();
248+
expect(start).toHaveBeenCalledWith(100);
249249
});
250250
});
251251

@@ -266,6 +266,8 @@ define([
266266
it('should return a source', function(){
267267
runs(function(){
268268
expect(sound._initAudio()).toBeDefined();
269+
expect(sound._initAudio(1)).toBeDefined();
270+
expect(sound._initAudio(1, true)).toBeDefined();
269271
});
270272
});
271273

src/sounds/WebAudio.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ define([
3131
var source = audioContext.createBufferSource();
3232
source.buffer = audioContext.createBuffer(1, 1, 22050);
3333
source.connect(audioContext.destination);
34-
source.noteOn(0);
34+
source.start(0);
3535
});
3636
}
3737
}
@@ -104,7 +104,7 @@ define([
104104
}
105105

106106
var audio = this._initAudio(volume, true);
107-
audio.noteOn(0);
107+
audio.start(0);
108108
},
109109

110110
play: function(volume, startTime){
@@ -116,7 +116,7 @@ define([
116116
startTime = startTime || 0;
117117

118118
var audio = this._initAudio(volume, false);
119-
audio.noteOn(startTime);
119+
audio.start(startTime);
120120
},
121121

122122
_initAudio: function(volume, loop){
@@ -126,10 +126,10 @@ define([
126126
source.buffer = this.buffer;
127127
source.loop = loop;
128128
if(volume){
129-
var gainNode = this.audioContext.createGainNode();
130-
gainNode.gain.value = volume;
131-
source.connect(gainNode);
132-
gainNode.connect(this.audioContext.destination);
129+
var gain = this.audioContext.createGain();
130+
gain.gain.value = volume;
131+
source.connect(gain);
132+
gain.connect(this.audioContext.destination);
133133
} else {
134134
source.connect(this.audioContext.destination);
135135
}

0 commit comments

Comments
 (0)