{"id":1227,"date":"2013-09-03T17:19:20","date_gmt":"2013-09-03T08:19:20","guid":{"rendered":"http:\/\/morookamitsuo.com\/wp\/?p=1227"},"modified":"2015-03-19T23:40:23","modified_gmt":"2015-03-19T14:40:23","slug":"ofxtruetypefontuc-of-systemspeak-kyoko-test","status":"publish","type":"post","link":"https:\/\/morookamitsuo.com\/wp\/?p=1227","title":{"rendered":"ofxTrueTypeFontUC + oF systemSpeak &#8220;Kyoko&#8221; test"},"content":{"rendered":"<p>openFrameworks\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u82f1\u8a9e\u3067\u767a\u97f3\u3067\u304d\u3066\u3044\u305f\u306e\u3067\u65e5\u672c\u8a9e\u3067\u3082\u767a\u97f3\u3067\u304d\u306a\u3044\u306e\u304b\u306a\u301c\u3068\u601d\u3063\u305f\u3089\u666e\u901a\u306b\u51fa\u6765\u307e\u3057\u305f\u3002<br \/>\n<center><iframe loading=\"lazy\" class=\"vine-embed\" src=\"https:\/\/vine.co\/v\/h50Kd5m5qZM\/embed\/simple\" width=\"600\" height=\"600\" frameborder=\"0\"><\/iframe><script async src=\"\/\/platform.vine.co\/static\/scripts\/embed.js\" charset=\"utf-8\"><\/script><\/center><\/p>\n<p>testApp.h<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#pragma once\r\n#include &quot;ofMain.h&quot;\r\n#include &quot;ofxTrueTypeFontUC.h&quot;  \/\/ https:\/\/github.com\/hironishihara\/ofxTrueTypeFontUC\r\n\r\n\/\/ ---------------------------------------------\r\nclass testApp : public ofBaseApp, public ofThread {\r\n\t\r\npublic:\r\n    \r\n    void setup();\r\n    void draw();\r\n    void exit();\r\n    void threadedFunction();\r\n    \r\n    ofxTrueTypeFontUC font;\r\n    vector &lt;string&gt; words;\r\n    int step;\r\n    \r\n    string voice;\r\n};\r\n<\/pre>\n<p>testApp.cpp<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n#include &quot;testApp.h&quot;\r\n\r\n\/\/--------------------------------------------------------------\r\nvoid testApp::setup() {\r\n\r\n    font.loadFont(&quot;\u30d2\u30e9\u30ae\u30ce\u660e\u671d ProN W3.otf&quot;, 34);  \/\/\u65e5\u672c\u8a9e\u5bfe\u5fdc\u30d5\u30a9\u30f3\u30c8\u3092 .\/bin\/data\u4e0b\u306b\r\n    voice = &quot;Kyoko&quot;;                           \/\/http:\/\/veadardiary.blog29.fc2.com\/blog-entry-3854.html\u53c2\u7167\r\n\r\n    \/\/ load the lyrics from a text file and split them\r\n    \/\/ up in to a vector of strings\r\n    string lyrics = ofBufferFromFile(&quot;lyrics.txt&quot;).getText();  \/\/\u9069\u5f53\u306a\u6587\u7ae0\u3092\u3002\u533a\u5207\u308a\u305f\u3044\u3068\u3053\u308d\u306b\u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3092\u5165\u308c\u308b\r\n    step = 0;\r\n    words = ofSplitString(lyrics, &quot; &quot;);\r\n\r\n    \/\/ we are running the systems commands\r\n    \/\/ in a sperate thread so that it does\r\n    \/\/ not block the drawing\r\n    startThread();\r\n}\r\n\r\n\/\/--------------------------------------------------------------\r\nvoid testApp::threadedFunction() {\r\n\r\n    while (isThreadRunning()) {\r\n        \/\/ call the system command say\r\n        #ifdef TARGET_OSX\r\n            string cmd = &quot;say -v &quot;+voice+&quot; &quot;+words&#x5B;step]+&quot; &quot;;   \/\/ create the command\r\n            system(cmd.c_str());\r\n        #endif\r\n        #ifdef TARGET_WIN32\r\n            string cmd = &quot;data\\\\SayStatic.exe &quot;+words&#x5B;step];   \/\/ create the command\r\n            cout &lt;&lt; cmd &lt;&lt; endl;\r\n            system(cmd.c_str());\r\n        #endif\r\n\r\n        \/\/ step to the next word\r\n        step ++;\r\n        step %= words.size();\r\n\r\n        \/\/ slowdown boy\r\n        ofSleepMillis(10);\r\n    }\r\n}\r\n\/\/--------------------------------------------------------------\r\nvoid testApp::draw() {\r\n    \/\/ center the word on the screen\r\n    float x = (ofGetWidth() - font.stringWidth(words&#x5B;step])) \/ 2;\r\n    float y = ofGetHeight() \/ 2;\r\n\r\n    \/\/ draw the word\r\n    ofSetColor(0);\r\n    font.drawString(words&#x5B;step], x, y);    \r\n}\r\n\r\n\/\/--------------------------------------------------------------\r\nvoid testApp::exit() {\r\n    \/\/ stop the thread on exit\r\n    waitForThread(true);\r\n}\r\n<\/pre>\n<p>\u5143\u306f\u2193\u306e\u6b4c\u8a5e\u3067\u3057\u305f\u3002<\/p>\n<p>Benny Benassi &#8211; Satisfaction<br \/>\n<center><iframe loading=\"lazy\" width=\"640\" height=\"480\" src=\"\/\/www.youtube.com\/embed\/9wmzxxN0m3k\" frameborder=\"0\" allowfullscreen><\/iframe><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"<p>openFrameworks\u306e\u30b5\u30f3\u30d7\u30eb\u3067\u82f1\u8a9e\u3067\u767a\u97f3\u3067\u304d\u3066\u3044\u305f\u306e\u3067\u65e5\u672c\u8a9e\u3067\u3082\u767a\u97f3\u3067\u304d\u306a\u3044\u306e\u304b\u306a\u301c\u3068\u601d\u3063\u305f\u3089\u666e\u901a\u306b\u51fa\u6765\u307e\u3057\u305f\u3002 testApp.h #pragma once #include &quot;ofMain.h&#038;q [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[91,90,96,9],"class_list":["post-1227","post","type-post","status-publish","format-standard","hentry","category-usual","tag-kyoko","tag-ofxtruetypefontuc","tag-of","tag-openframeworks"],"_links":{"self":[{"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1227"}],"version-history":[{"count":5,"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1227\/revisions"}],"predecessor-version":[{"id":1243,"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1227\/revisions\/1243"}],"wp:attachment":[{"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/morookamitsuo.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}