Skip to content

Commit

Permalink
added a soundboard preset.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinhunt committed Nov 22, 2019
1 parent 1736442 commit 9836178
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion db/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function xmldb_filter_poodll_install() {
'nativeaudio', 'youtubeplayer', 'youtube','onceplayer', 'twiceaudioplayer','interactivetranscriptaudio','interactivetranscriptvideo',
'tabs', 'tabitem', 'accordian', 'accordianitem',
'Button-Maker','countdown','dice','flipclock','icontoggle','lightbox2','poodllcalc','popover','popuprecorder','speechcards','tapwordtohear',
'textblockreader','tta');
'textblockreader','tta','soundboard');
$templateindex = 0;
foreach ($presets as $preset) {
if (in_array($preset['key'], $forinstall)) {
Expand Down
1 change: 1 addition & 0 deletions presets/soundboard.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"Sound Board","key":"soundboard","version":"1.0.0","instructions":"Add an html list (bullets) of phrases to be read, between the tags. They will become buttons that speak when tapped.","showatto":"1","showplayers":"0","requirecss":"","requirejs":"","shim":"","defaults":"language=\"English(US)|English(GB)|English(AU)|English(In)|English(Welsh)|Danish|Dutch|French(FR)|French(CA)|German|Icelandic|Italian|Japanese|Korean|Norwegian|Polish|Portugese(BR)|Portugese(PT)|Romanian|Russian|Spanish(ES)|Spanish(US)|Swedish|Turkish|Welsh\",\nspeaker=\"Male|Female\"","amd":"1","body":"<div id=\"@@AUTOID@@_container\" class=\"container\"></div>\n<audio id=\"@@AUTOID@@_player\"></audio>\n<div id=\"@@AUTOID@@\" class=\"fp_soundboard hide\">\n","bodyend":"</div>","script":"//remove any HTML editor artifacts\n$('#' + @@AUTOID@@ + ' p').remove();\n$('#' + @@AUTOID@@ + ' span').remove();\n\n//fetch the controls we inserted in \"body\"\nvar theplayer = $('#' + @@AUTOID@@ + '_player');\nvar theulcontainer = $('#' + @@AUTOID@@); \nvar theitemscontainer = $('#' + @@AUTOID@@ + '_container'); \n\ntheitemscontainer.on('click','.fp_soundboard_player_trigger', function(e){\n theplayer.attr('src',$(this).attr('data-src'));\n theplayer[0].play();\n});\n\n\n//determine voice\nvar mf=@@speaker@@\nswitch(@@language@@){\ncase \"English(US)\": voice = mf=='Male'?'Joey':'Kendra';break;\ncase \"English(GB)\": voice = mf=='Male'?'Brian':'Amy';break;\ncase \"English(AU)\": voice = mf=='Male'?'Russell':'Nicole';break;\ncase \"English(IN)\": voice = mf=='Male'?'Aditi':'Raveena';break;\ncase \"English(WELSH)\": voice = mf=='Male'? 'Geraint':'Geraint';break;\ncase \"Danish\": voice = mf=='Male'?'Mads':'Naja';break;\ncase \"Dutch\": voice = mf=='Male'?'Ruben':'Lotte';break;\ncase \"French(FR)\": voice = mf=='Male'?'Mathieu':'Celine';break;\ncase \"French(CA)\": voice = mf=='Male'?'Chantal':'Chantal';break;\ncase \"German\": voice = mf=='Male'?'Hans':'Marlene';break;\ncase \"Icelandic\": voice = mf=='Male'?'Karl':'Dora';break;\ncase \"Italian\": voice = mf=='Male'?'Carla':'Giorgio';break;\ncase \"Japanese\": voice = mf=='Male'?'Takumi':'Mizuki';break;\ncase \"Korean\": voice = mf=='Male'?'Seoyan':'Seoyan';break;\ncase \"Norwegian\": voice = mf=='Male'?'Liv':'Liv';break;\ncase \"Polish\": voice = mf=='Male'?'Jacek':'Ewa';break;\ncase \"Portugese(BR)\": voice = mf=='Male'?'Ricardo':'Vitoria';break;\ncase \"Portugese(PT)\": voice = mf=='Male'?'Cristiano':'Ines';break;\ncase \"Romanian\": voice = mf=='Male'?'Carmen':'Carmen';break;\ncase \"Russian\": voice = mf=='Male'?'Maxim':'Tatyana';break;\ncase \"Spanish(ES)\": voice = mf=='Male'?'Enrique':'Conchita';break;\ncase \"Spanish(US)\": voice = mf=='Male'?'Miguel':'Penelope';break;\ncase \"Swedish\": voice = mf=='Male'?'Astrid':'Astrid';break;\ncase \"Turkish\": voice = mf=='Male'?'Filiz':'Filiz';break;\ncase \"Welsh\": voice = mf=='Male'?'Gwyneth':'Gwyneth';break;\ndefault: voice = mf=='Male'?'Brian':'Amy';\n}\n\n\n\n//Build audio url components\nvar poodllfilelib = M.cfg.wwwroot + '/filter/poodll/poodllfilelib.php?datatype=speaktext&paramone=';\nvar format = 'text';\n\n//build template for one dictation item\nvar template ='<div class=\"fp_soundboard_row\">';\ntemplate += '<div id=\"fp_soundboard_player_@ID@\" class=\"fp_soundboard_player\">';\ntemplate += '<a class=\"fp_soundboard_player_trigger btn btn-secondary\" data-src=\"@AUDIO@\">@TEXT@</a>';\ntemplate += '</div></div>';\n\n\nvar container = \n\n$('#' + @@AUTOID@@ + \" li\" ).each(function(index) {\n var usetext = $(this).text();\n var datastring= 'text' + '|' + voice + '|' + usetext;\n var src = poodllfilelib+encodeURIComponent(datastring);\n var usetemplate = template.replace('@AUDIO@',src); \n usetemplate = usetemplate.replace('@TEXT@',usetext); \n usetemplate = usetemplate.replace(/@ID@/g, index);\n theitemscontainer.append(usetemplate);\n \n //add events\n var theaudio= $('#fp_soundboard_player_' + index + ' audio');\n\n });//end of each loop","style":"","dataset":"","datasetvars":"","alternate":"","alternateend":""}

0 comments on commit 9836178

Please sign in to comment.