{"id":437,"date":"2014-07-22T00:10:03","date_gmt":"2014-07-21T15:10:03","guid":{"rendered":"https:\/\/www.utsbox.com\/?page_id=437"},"modified":"2014-08-31T20:00:24","modified_gmt":"2014-08-31T11:00:24","slug":"%e3%82%bd%e3%83%bc%e3%82%b9%e3%82%b3%e3%83%bc%e3%83%89%e5%85%a8%e4%bd%93-%e3%83%91%e3%83%a9%e3%83%a1%e3%83%bc%e3%82%bf%e3%83%bc%e3%81%ae%e3%81%82%e3%82%8b%e3%82%a8%e3%83%95%e3%82%a7%e3%82%af","status":"publish","type":"page","link":"https:\/\/www.utsbox.com\/?page_id=437","title":{"rendered":"\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u5168\u4f53 \u2013 \u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u3042\u308b\u30a8\u30d5\u30a7\u30af\u30bf\u30fc\u3092\u4f5c\u6210\u3059\u308b"},"content":{"rendered":"<p><a href=\"https:\/\/www.utsbox.com\/?page_id=397\" title=\"\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u3042\u308b\u30a8\u30d5\u30a7\u30af\u30bf\u30fc\u3092\u4f5c\u6210\u3059\u308b\">\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u3042\u308b\u30a8\u30d5\u30a7\u30af\u30bf\u30fc\u3092\u4f5c\u6210\u3059\u308b<\/a>\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u5168\u4f53\u3067\u3059\u3002<\/p>\n<h1>MyMiniTremolo2VST.cpp<\/h1>\n<p>VST\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30e1\u30a4\u30f3\u3068\u306a\u308b\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb<br \/>\n[crayon]<br \/>\n\/\/ ============================================================================================<br \/>\n\/\/ \u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u30d5\u30a1\u30a4\u30eb<br \/>\n\/\/ ============================================================================================<br \/>\n#include &#8220;audioeffectx.h&#8221;<br \/>\n#include <math.h><\/p>\n<p>\/\/ ============================================================================================<br \/>\n\/\/ \u8a2d\u8a08\u60c5\u5831\u306e\u8a18\u5165<br \/>\n\/\/ ============================================================================================<br \/>\n#define MY_VST_PRESET_NUM    1 \/\/\u30d7\u30ea\u30bb\u30c3\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u6570<br \/>\n#define MY_VST_PARAMETER_NUM 2 \/\/\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u6570<\/p>\n<p>#define MY_VST_INPUT_NUM   2 \/\/\u5165\u529b\u6570\u3002\u30e2\u30ce\u30e9\u30eb\u5165\u529b=1\u3001\u30b9\u30c6\u30ec\u30aa\u5165\u529b=2<br \/>\n#define MY_VST_OUTPUT_NUM  2 \/\/\u51fa\u529b\u6570\u3002\u30e2\u30ce\u30e9\u30eb\u51fa\u529b=1\u3001\u30b9\u30c6\u30ec\u30aa\u51fa\u529b=2<\/p>\n<p>#define MY_VST_UNIQUE_ID  &#8216;SMPL&#8217; \/\/\u30e6\u30cb\u30fc\u30afID<br \/>\n\/\/\u516c\u958b\u3059\u308b\u5834\u5408\u306f\u4ee5\u4e0bURL\u3067\u767a\u884c\u3055\u308c\u305f\u30e6\u30cb\u30fc\u30afID\u3092\u5165\u529b\u3059\u308b\u3002<br \/>\n\/\/https:\/\/ygrabit.steinberg.de\/~ygrabit\/public_html\/index.html<\/p>\n<p>\/\/ ============================================================================================<br \/>\n\/\/ VST\u306e\u57fa\u672c\u3068\u306a\u308b\u30af\u30e9\u30b9<br \/>\n\/\/ ============================================================================================<br \/>\nclass MyMiniTremolo2VST : public AudioEffectX<br \/>\n{<br \/>\nprivate:<br \/>\n\tfloat theta;        \/\/ sin\u95a2\u6570\u306e\u89d2\u5ea6 \u03b8\u3002\u521d\u671f\u5024\u306f0<br \/>\n\tfloat tremolospeed; \/\/ 0\u3092\u30c8\u30ec\u30e2\u30ed\u306e\u30b9\u30d4\u30fc\u30c9\u3068\u3059\u308b\u3002\u89d2\u901f\u5ea6\u03c9\u3068\u540c\u3058\u3002<br \/>\n\tfloat tremolodepth; \/\/ 1\u3092\u30c8\u30ec\u30e2\u30ed\u306e\u52b9\u304d\u5177\u5408\u3068\u3059\u308b\u30020\uff5e1\u306e\u9593\u3002<br \/>\npublic:<br \/>\n\tMyMiniTremolo2VST(audioMasterCallback audioMaster);<\/p>\n<p>\t\/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u95a2\u3059\u308b\u30e1\u30f3\u30d0\u30fc\u95a2\u6570<br \/>\n\tvirtual void  setParameter(VstInt32 index, float value);<br \/>\n\tvirtual float getParameter(VstInt32 index);<br \/>\n\tvirtual void  getParameterName(VstInt32 index, char* text);<br \/>\n\tvirtual void  getParameterLabel(VstInt32 index, char* label);<br \/>\n\tvirtual void  getParameterDisplay(VstInt32 index, char* text);<\/p>\n<p>\t\/\/ \u97f3\u58f0\u4fe1\u53f7\u3092\u51e6\u7406\u3059\u308b\u30e1\u30f3\u30d0\u30fc\u95a2\u6570<br \/>\n\tvirtual void processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames);<br \/>\n};<\/p>\n<p>\/\/ ============================================================================================<br \/>\n\/\/ \u3053\u306eVST\u306e\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u95a2\u6570<br \/>\n\/\/ ============================================================================================<br \/>\nAudioEffect* createEffectInstance(audioMasterCallback audioMaster)<br \/>\n{<br \/>\n\t\/\/new\u3067\u3053\u306eVST\u3092\u751f\u6210\u3057\u305f\u30dd\u30a4\u30f3\u30bf\u3092\u8fd4\u3059<br \/>\n\treturn new MyMiniTremolo2VST(audioMaster);<br \/>\n}<\/p>\n<p>\/\/ ============================================================================================<br \/>\n\/\/ \u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf(VST\u306e\u521d\u671f\u5316)<br \/>\n\/\/ ============================================================================================<br \/>\nMyMiniTremolo2VST::MyMiniTremolo2VST(audioMasterCallback audioMaster)<br \/>\n: AudioEffectX(audioMaster, MY_VST_PRESET_NUM, MY_VST_PARAMETER_NUM)<br \/>\n{<br \/>\n\t\/\/VST\u306e\u521d\u671f\u5316\u3092\u884c\u3046\u3002<\/p>\n<p>\t\/\/\u4ee5\u4e0b\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u3066\u5165\u529b\u6570\u3001\u51fa\u529b\u6570\u7b49\u306e\u60c5\u5831\u3092\u8a2d\u5b9a\u3059\u308b\u3002<br \/>\n\t\/\/\u5fc5\u305a\u547c\u3073\u51fa\u3055\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3002<br \/>\n\tsetNumInputs(MY_VST_INPUT_NUM);    \/\/\u5165\u529b\u6570\u306e\u8a2d\u5b9a<br \/>\n\tsetNumOutputs(MY_VST_OUTPUT_NUM);  \/\/\u51fa\u529b\u6570\u306e\u8a2d\u5b9a<br \/>\n\tsetUniqueID(MY_VST_UNIQUE_ID);     \/\/\u30e6\u30cb\u30fc\u30afID\u306e\u8a2d\u5b9a<\/p>\n<p>\t\/\/\u3053\u306eVST\u304cSynth\u304b\u3069\u3046\u304b\u306e\u30d5\u30e9\u30b0\u3092\u8a2d\u5b9a\u3002Synth\u306e\u5834\u5408\u2026true\u3001Effector\u306e\u5834\u5408\u2026false<br \/>\n\tisSynth(false);<\/p>\n<p>\t\/\/\u3053\u306eVST\u304c\u97f3\u58f0\u51e6\u7406\u53ef\u80fd\u304b\u3069\u3046\u304b\u306e\u30d5\u30e9\u30b0\u3092\u8a2d\u5b9a\u3002\u97f3\u58f0\u51e6\u7406\u3092\u884c\u308f\u306a\u3044VST\u306f\u306a\u3044\u306e\u3067\u5fc5\u305a\u3053\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u3002<br \/>\n\tcanProcessReplacing();  <\/p>\n<p>\t\/\/\u4e0a\u8a18\u306e\u95a2\u6570\u3092\u547c\u3073\u51fa\u3057\u305f\u5f8c\u306b\u521d\u671f\u5316\u3092\u884c\u3046<br \/>\n\ttheta = 0.0f;<\/p>\n<p>\tfloat Hz = 4.0f; \/\/ \u30c8\u30ec\u30e2\u30ed\u306e\u5468\u671f<br \/>\n\ttremolospeed = (2.0f * 3.14159265f * Hz) \/ 44100.0f ; \/\/\u30c8\u30ec\u30e2\u30ed\u306e\u5468\u671f\u3092\u89d2\u901f\u5ea6\u306b\u5909\u63db<br \/>\n\ttremolodepth = 0.5f; \/\/\u30c8\u30ec\u30e2\u30ed\u306e\u632f\u5e45 0.5<br \/>\n}<\/p>\n<p>\/\/ ============================================================================================<br \/>\n\/\/ \u97f3\u58f0\u4fe1\u53f7\u3092\u51e6\u7406\u3059\u308b\u30e1\u30f3\u30d0\u30fc\u95a2\u6570<br \/>\n\/\/ ============================================================================================<br \/>\nvoid MyMiniTremolo2VST::processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames)<br \/>\n{<br \/>\n\tint L = 0;<br \/>\n\tint R = 1;<\/p>\n<p>\tfor (int i = 0; i < sampleFrames; i++)\n\t{\n\t\t\/\/\u3053\u3053\u3067\u97f3\u58f0\u51e6\u7406\u3092\u884c\u3046\u3002\n\n\t\t\/\/ theta(\u03b8)\u306btremolospeed(=\u89d2\u901f\u5ea6)\u3092\u52a0\u3048\u3001\u66f4\u65b0\u3059\u308b\n\t\t\/\/ 2\u03c0(360\u00b0)\u3092\u8d85\u3048\u305f\u5834\u5408\u306f\u30012\u03c0\u5206\u623b\u3059\u3002\n\t\ttheta += tremolospeed;\n\t\tif (theta > 2 * 3.14159265f)<br \/>\n\t\t{<br \/>\n\t\t\ttheta -= 2 * 3.14159265f;<br \/>\n\t\t}<\/p>\n<p>\t\t\/\/ sin\u95a2\u6570\u306e\u7d50\u679c\u30920\uff5e1\u306e\u9593\u306b\u3059\u308b<br \/>\n\t\tfloat a = (sin(theta) * 0.5f) + 0.5f;<\/p>\n<p>\t\t\/\/ tremolodepth\u3068\u5148\u307b\u3069\u306e\u7d50\u679c\u304b\u3089\u639b\u3051\u5408\u308f\u305b\u308b\u5024\u3092\u8a08\u7b97\u3059\u308b<br \/>\n\t\tfloat b = (1.0f &#8211; tremolodepth) + (a * tremolodepth);<\/p>\n<p>\t\t\/\/\u5165\u529b\u4fe1\u53f7\u3068\u639b\u3051\u5408\u308f\u305b\u3001\u51fa\u529b\u30d0\u30c3\u30d5\u30a1\u3078\u66f8\u304d\u8fbc\u3080\u3002<br \/>\n\t\toutputs[L][i] = b * inputs[L][i];<br \/>\n\t\toutputs[R][i] = b * inputs[R][i];<br \/>\n\t}<br \/>\n}<\/p>\n<p>\/\/ ============================================================================================<br \/>\n\/\/ \u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u8a2d\u5b9a\u3001\u8868\u793a\u3092\u884c\u3046\u30e1\u30f3\u30d0\u30fc\u95a2\u6570<br \/>\n\/\/ ============================================================================================<br \/>\nvoid  MyMiniTremolo2VST::setParameter(VstInt32 index, float value)<br \/>\n{<br \/>\n\tfloat Hz = 0.0f;<\/p>\n<p>\t\/\/index\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306b\u5024\u3092\u8a2d\u5b9a\u3059\u308b\u3002value\u306f0.0f\uff5e1.0f\u3067\u4e0e\u3048\u3089\u308c\u308b\u3002<br \/>\n\tswitch (index)<br \/>\n\t{<br \/>\n\tcase 0: \/\/ index\u304c0\u306e\u5834\u5408\u3001tremolospeed\u306e\u5024\u3092\u8a2d\u5b9a<br \/>\n\t\tHz = 0.5f + ( 29.5f * value ); \/\/ value\u306e\u5024\u30920.5Hz\uff5e30Hz\u306b\u3059\u308b<br \/>\n\t\ttremolospeed = (2.0f * 3.14159265f * Hz) \/ 44100.0f; \/\/\u30c8\u30ec\u30e2\u30ed\u306e\u5468\u671f\u3092\u89d2\u901f\u5ea6\u306b\u5909\u63db<br \/>\n\t\tbreak;<br \/>\n\tcase 1: \/\/ index\u304c1\u306e\u5834\u5408\u3001tremolodepth\u306e\u5024\u3092\u8a2d\u5b9a<br \/>\n\t\ttremolodepth = value;<br \/>\n\t\tbreak;<br \/>\n\t}<br \/>\n}<\/p>\n<p>float MyMiniTremolo2VST::getParameter(VstInt32 index)<br \/>\n{<br \/>\n\tfloat Hz = 0.0f;<\/p>\n<p>\t\/\/index\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5024\u30920.0f\uff5e1.0f\u306e\u7bc4\u56f2\u3067\u8fd4\u3059\u3002<br \/>\n\tfloat value = 0.0f;<br \/>\n\tswitch (index)<br \/>\n\t{<br \/>\n\tcase 0: \/\/ index\u304c0\u306e\u5834\u5408\u3001tremolospeed\u306e\u5024\u30920\uff5e1\u306e\u7bc4\u56f2\u306b\u3057\u3066\u8fd4\u3059<br \/>\n\t\tHz = (tremolospeed * 44100.0f) \/ (2.0f * 3.14159265f); \/\/ \u30c8\u30ec\u30e2\u30ed\u306e\u89d2\u901f\u5ea6\u3092\u5468\u671f\u306b\u5909\u63db<br \/>\n\t\tvalue = (Hz &#8211; 0.5f) \/ 29.5f; \/\/ Hz\u30920.0f\uff5e1.0f\u306b\u3059\u308b<br \/>\n\t\tbreak;<br \/>\n\tcase 1: \/\/  index\u304c1\u306e\u5834\u5408\u3001tremolodepth\u306e\u5024\u30920\uff5e1\u306e\u7bc4\u56f2\u306b\u3057\u3066\u8fd4\u3059<br \/>\n\t\tvalue = tremolodepth;<br \/>\n\t\tbreak;<br \/>\n\t}<br \/>\n\treturn value;<br \/>\n}<\/p>\n<p>void  MyMiniTremolo2VST::getParameterName(VstInt32 index, char* text)<br \/>\n{<br \/>\n\t\/\/index\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u540d\u524d\u3092text\u306b\u683c\u7d0d\u3059\u308b<br \/>\n\tswitch (index)<br \/>\n\t{<br \/>\n\tcase 0: \/\/ index\u304c0\u306e\u5834\u5408\u3001tremolospeed\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u540d\u3092\u8fd4\u3059<br \/>\n\t\tvst_strncpy(text, &#8220;Speed&#8221;, kVstMaxParamStrLen);<br \/>\n\t\tbreak;<br \/>\n\tcase 1: \/\/ index\u304c1\u306e\u5834\u5408\u3001tremolodepth\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u540d\u3092\u8fd4\u3059<br \/>\n\t\tvst_strncpy(text, &#8220;Depth&#8221;, kVstMaxParamStrLen);<br \/>\n\t\tbreak;<br \/>\n\t}<br \/>\n}<\/p>\n<p>void  MyMiniTremolo2VST::getParameterLabel(VstInt32 index, char* label)<br \/>\n{<br \/>\n\t\/\/index\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u5358\u4f4d\u3092label\u306b\u683c\u7d0d\u3059\u308b<br \/>\n\tswitch (index)<br \/>\n\t{<br \/>\n\tcase 0: \/\/ index\u304c0\u306e\u5834\u5408\u3001tremolospeed\u306e\u5358\u4f4d\u540d\u3092\u8fd4\u3059<br \/>\n\t\tvst_strncpy(label, &#8220;Hz&#8221;, kVstMaxParamStrLen);<br \/>\n\t\tbreak;<br \/>\n\tcase 1: \/\/ index\u304c1\u306e\u5834\u5408\u3001tremolodepth\u306e\u5358\u4f4d\u540d\u3092\u8fd4\u3059<br \/>\n\t\tvst_strncpy(label, &#8220;&#8221;, kVstMaxParamStrLen);<br \/>\n\t\tbreak;<br \/>\n\t}<br \/>\n}<\/p>\n<p>void  MyMiniTremolo2VST::getParameterDisplay(VstInt32 index, char* text)<br \/>\n{<br \/>\n\tfloat Hz = 0.0f;<br \/>\n\t\/\/index\u3067\u6307\u5b9a\u3055\u308c\u305f\u30d1\u30e9\u30e1\u30fc\u30bf\u306e\u8868\u793a\u5185\u5bb9\u3092text\u306b\u683c\u7d0d\u3059\u308b<br \/>\n\tswitch (index)<br \/>\n\t{<br \/>\n\tcase 0: \/\/ index\u304c0\u306e\u5834\u5408\u3001tremolospeed\u306e\u8868\u793a\u5024\u3092\u8fd4\u3059<br \/>\n\t\tHz = (tremolospeed * 44100.0f) \/ (2.0f * 3.14159265f); \/\/ \u30c8\u30ec\u30e2\u30ed\u306e\u89d2\u901f\u5ea6\u3092\u5468\u671f\u306b\u5909\u63db<br \/>\n\t\tfloat2string(Hz, text, kVstMaxParamStrLen);<br \/>\n\t\tbreak;<br \/>\n\tcase 1: \/\/ index\u304c1\u306e\u5834\u5408\u3001tremolodepth\u306e\u8868\u793a\u5024\u3092\u8fd4\u3059<br \/>\n\t\tfloat2string(tremolodepth, text, kVstMaxParamStrLen);<br \/>\n\t\tbreak;<br \/>\n\t}<br \/>\n}<br \/>\n[\/crayon]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30d1\u30e9\u30e1\u30fc\u30bf\u30fc\u306e\u3042\u308b\u30a8\u30d5\u30a7\u30af\u30bf\u30fc\u3092\u4f5c\u6210\u3059\u308b\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u5168\u4f53\u3067\u3059\u3002 MyMiniTremolo2VST.cpp VST\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30e1\u30a4\u30f3\u3068\u306a\u308b\u30bd\u30fc\u30b9\u30d5\u30a1\u30a4\u30eb [crayon] \/\/ ==================== [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":397,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"class_list":["post-437","page","type-page","status-publish","hentry"],"aioseo_notices":[],"jetpack_shortlink":"https:\/\/wp.me\/P5fXUX-73","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/pages\/437","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.utsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=437"}],"version-history":[{"count":2,"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/pages\/437\/revisions"}],"predecessor-version":[{"id":498,"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/pages\/437\/revisions\/498"}],"up":[{"embeddable":true,"href":"https:\/\/www.utsbox.com\/index.php?rest_route=\/wp\/v2\/pages\/397"}],"wp:attachment":[{"href":"https:\/\/www.utsbox.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=437"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}