-
-
Save mdobson/9669ad5ba8aa05b5723e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//somewhere else in your class | |
function Voice() { | |
this.voice = { | |
Agnes: { | |
locale: 'en_US', | |
example: 'Isn\'t it nice to have a computer that will talk to you?' | |
} | |
//Will return an array that looks like [{value: 'Agnes'}] | |
this.voiceValues = Object.keys(voices).map(function(voice){ return {value: voice}}); | |
} | |
Voice.prototype.init = function(config) { | |
config | |
.map('say', this.say, [ | |
{ name: 'words', type: 'text'}, | |
{ name: 'voice', type: 'radio', value: this.voiceValues }, | |
{ name: 'rate', type: 'range', min: 90, max: 720, step: 1}) | |
} | |
Voice.prototype.say = function(words, voice, rate) { | |
voice = this.voices[voice]; | |
//Logic here. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment