atlastrafficmonitor/atlas-traffic-client — pull request #10 by BrianNewsom (2014-12-09 21:28:45+00:00)
Title: Songs

This PR creates a simple song API that allows us to change song using a simple call.

If you go into console.log you can simply use songAPI.changeSong(songVariableName) (right now the only choices are pentatonic and jingleBells) to change the song playing.

By default they rotate through, each playing a number of times allotted in the song object. On that front, I have change the song object a bit: @ianks I hope this is cool with you.

It now looks like

var pentatonic = {
name: 'Pentatonic Song',
notes: _.map(['G','A','B','D','E'], function(n) { return notesMap[n]; }),
iterator: new RandIterator(),
timesPlayed: 10
};

Essentially I added the iterator as a field so that we can address an iterator of a song generically, then added a timesPlayed field so that my API will know how many times to repeat a given song before it gets too monotonous (e.g. a randomly generated from scale object should play a lot)

Once again, the programming isn't amazing, I always want to do something in JS then just hack my way around it, but whatever. I'm open to suggestions of any kind!

Have a look and let me know what you think.

Thanks,
Brian