Skip to content

Commit

Permalink
Changing oscillator.type to use string instead of integer - fixes #25.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cody Lundquist committed Jul 22, 2014
1 parent 781af90 commit c9e932c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/instrument-packs/oscillators.js
Expand Up @@ -16,14 +16,9 @@ module.exports = OscillatorInstrumentPack;
* @constructor
*/
function OscillatorInstrumentPack(name, audioContext) {
var types = {
sine: 0,
square: 1,
sawtooth: 2,
triangle: 3
};
var types = ['sine', 'square', 'sawtooth', 'triangle'];

if (typeof types[name] === 'undefined') {
if (types.indexOf(name) === -1) {
throw new Error(name + ' is not a valid Oscillator type');
}

Expand All @@ -34,7 +29,7 @@ function OscillatorInstrumentPack(name, audioContext) {
// Connect note to volume
o.connect(destination);
// Set pitch type
o.type = types[name];
o.type = name;
// Set frequency
o.frequency.value = frequency;

Expand Down
1 change: 0 additions & 1 deletion test/conductor-test.js
@@ -1,4 +1,3 @@
var Conductor = require('../src/conductor');
describe('Conductor Class', function() {
var Conductor = require('../src/conductor');

Expand Down

0 comments on commit c9e932c

Please sign in to comment.