Rather than using control logic to select the appropriate class name, both of the following examples use the fact that, based on your example, the value of $player.voice seems to match the latter half of your class names. Thus, you may simply use it to build the class name, no control logic required.
Example - Widget Arguments
Widget:
<<widget "voice">>
\<<= '@@.pcspeech_' + $player.voice + ';' + $args[0] + '@@'>>
\<</widget>>
Usage:
<<voice "Hello. My name is Inigo Montoya. You killed my father. Prepare to die.">>
Example - Container Macro
Macro: (goes in Story JavaScript or the equivalent)
/*
<<voice>>
*/
Macro.add('voice', {
skipArgs : true,
tags : null,
handler : function () {
if (this.payload[0].contents !== '') {
var sv = State.variables;
jQuery(document.createElement('span'))
.addClass('pcspeech_' + sv.player.voice)
.wiki(this.payload[0].contents)
.appendTo(this.output);
}
}
});
Usage:
<<voice>>Hello. My name is Inigo Montoya. You killed my father. Prepare to die.<</voice>>