From 7abefa095418b37eb2211c2a4257ee6af1de4007 Mon Sep 17 00:00:00 2001 From: ocogeclub Date: Wed, 24 Mar 2021 22:11:48 +0900 Subject: [PATCH] added aquestalk speech block --- index.html | 7 +++++++ index.js | 6 +++--- scripts/ugj_blocks.js | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 9c23e3c..8234928 100644 --- a/index.html +++ b/index.html @@ -748,6 +748,13 @@ データ + + + + こんにちは + + + m001 diff --git a/index.js b/index.js index c296129..85f314a 100644 --- a/index.js +++ b/index.js @@ -12,8 +12,8 @@ function createWindow() { win = new BrowserWindow({ /** Icon */ icon: "./icon.png", - width: 800, - height: 600, + width: 660, + height: 760, webPreferences: { nodeIntegration: true, contextIsolation: false, @@ -76,7 +76,7 @@ app.on('ready', () => { label: 'Mascot', click: (item, focusedWindow) => { if (focusedWindow) - focusedWindow.webContents.executeJavaScript('ugj_selectMascot()'); + focusedWindow.webContents.executeJavaScript('ugj_selectMascot()'); }, accelerator: "CommandOrControl+M" }, diff --git a/scripts/ugj_blocks.js b/scripts/ugj_blocks.js index 08cf0d7..5290890 100644 --- a/scripts/ugj_blocks.js +++ b/scripts/ugj_blocks.js @@ -1967,6 +1967,27 @@ Blockly.JavaScript['ugj_child_gesture'] = function (block) { return [code, Blockly.JavaScript.ORDER_NONE]; }; +// AquesTalk Pi +Blockly.Blocks['aquestalk_pi'] = { + init: function () { + this.appendValueInput("talk") + .setCheck("String") + .appendField("ゆっくりで"); + this.appendDummyInput() + .appendField("とおしゃべりする"); + this.setInputsInline(true); + this.setOutput(true, "shcmd"); + this.setStyle('special_blocks') + this.setTooltip("日本語音声合成プログラム「AquesTalk Pi」を使用してしゃべります。"); + this.setHelpUrl(""); + } +}; +Blockly.JavaScript['aquestalk_pi'] = function (block) { + var value_talk = Blockly.JavaScript.valueToCode(block, 'talk', Blockly.JavaScript.ORDER_ATOMIC); + var code = `'./bin/aquestalkpi/AquesTalkPi ' + ${value_talk} + ' | aplay', { shell: true }`; + return [code, Blockly.JavaScript.ORDER_NONE]; +}; + // open jtalk Blockly.Blocks['ugj_child_openjtalk'] = { init: function () {