initial commit

This commit is contained in:
Lucas Cordiviola 2021-10-28 00:46:36 -03:00
commit 3274ae0d69
28 changed files with 4137 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# folders
build/Release32/.pd
build/Release64/.pd
vstsdk2.4
# binaries
*.dll

View File

@ -0,0 +1,166 @@
#N canvas 313 -10 860 681 12;
#X obj 26 400 r rvstplugname;
#X msg 25 423 \; gui-label label \$1;
#X obj 37 22 r rvstopengui;
#X obj 24 86 select 0 1;
#X obj 22 227 delay 10;
#X obj 32 486 loadbang;
#X msg 31 512 1;
#X msg 68 513 0;
#N canvas 0 50 746 518 audio_stuff 0;
#X obj 104 322 adc~;
#X obj 104 401 dac~;
#X msg 47 286 \$1 30;
#X obj 47 311 line~;
#X obj 143 371 *~;
#X obj 104 371 *~;
#X obj 48 47 r rvstparameter0;
#X obj 48 229 * 100;
#X obj 47 253 dbtorms;
#X msg 79 81 set \$1;
#X obj 80 189 s svstparameter0;
#X obj 79 107 s level-rcv;
#X obj 80 144 r level-snd;
#X text 192 107 update pd-slider when parameter is changed from host
;
#X text 230 168 update host when parameter is changed from pd-slider
;
#X text 19 12 audio stuff example;
#X obj 315 283 loadbang;
#X msg 315 312 \; pd dsp 1 \;;
#X obj 368 463 tabwrite~ scope;
#X obj 375 433 metro 120;
#X obj 366 403 loadbang;
#X obj 280 413 *~ 5;
#X obj 280 438 clip~ -1 1;
#X connect 0 0 5 0;
#X connect 0 1 4 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 3 0 5 1;
#X connect 4 0 1 1;
#X connect 4 0 21 0;
#X connect 5 0 1 0;
#X connect 5 0 21 0;
#X connect 6 0 7 0;
#X connect 6 0 9 0;
#X connect 7 0 8 0;
#X connect 8 0 2 0;
#X connect 9 0 11 0;
#X connect 12 0 10 0;
#X connect 12 0 7 0;
#X connect 16 0 17 0;
#X connect 19 0 18 0;
#X connect 20 0 19 0;
#X connect 21 0 22 0;
#X connect 22 0 18 0;
#X restore 518 403 pd audio_stuff;
#X text 67 50 <- the host signals when gui has to be visible;
#X msg 75 195 vis 1;
#X obj 62 147 t b b;
#X text 124 197 display gui window;
#X text 186 79 0 = hide \, 1 = show;
#N canvas 0 50 450 300 hidePdConsole 0;
#X obj 78 48 inlet;
#X obj 76 149 hcs/sys_gui;
#X msg 75 117 wm withdraw .pdwindow;
#X msg 248 114 wm iconify .pdwindow;
#X obj 79 79 select 1 0;
#X connect 0 0 4 0;
#X connect 2 0 1 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 4 1 3 0;
#X restore 29 544 pd hidePdConsole;
#X text 163 545 (needs hcs/sys_gui external);
#N canvas 0 0 320 154 \$0-gui 0;
#X obj 5 5 cnv 15 300 190 empty gui-label empty 10 12 0 14 -233017
-66577 0;
#X obj 13 53 vsl 60 128 0 1 0 0 level-snd level-rcv LEVEL 0 -9 0 10
-262144 -1 -1 0 1;
#N canvas 0 50 450 250 (subpatch) 0;
#X array scope 300 float 1;
#A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#X coords 0 1 299 -1 120 70 1 0 0;
#X restore 138 57 graph;
#X obj 136 163 bng 15 250 50 0 \$0-show_parent empty show_parent_window
17 7 0 10 -262144 -1 -1;
#X text 101 145 click here to see main patch;
#X restore 517 361 pd \$0-gui;
#X obj 21 298 s pd-\$0-gui;
#X obj 29 653 s pd-Pd_Gain(gui).pd;
#X msg 29 624 vis 0;
#X obj 28 601 loadbang;
#X obj 104 602 r \$0-show_parent;
#X msg 104 627 vis 1;
#X obj 40 57 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X obj 58 113 delay 10;
#X msg 21 254 vis 0;
#X msg 206 252 vis 0;
#X obj 208 229 loadbang;
#X text 67 255 hide gui window;
#X obj 597 127 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 618 126 enable embedding (experimental);
#X text 110 300 (<- rename with the name of your gui window);
#X text 603 361 <- the actual gui window;
#N canvas 0 50 645 376 embedding_gui_into_host(experimental) 0;
#X obj 86 151 inlet;
#X obj 135 153 inlet;
#X obj 86 205 spigot;
#X obj 83 321 s guiName;
#X text 157 216 <- send to host the title of your gui window;
#X obj 84 268 f \$0;
#X msg 83 295 symbol \$1-gui;
#X obj 84 243 delay 10;
#X obj 154 180 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 90 40 In order to embed a puredata (tcl) gui window into host
\, the patch has to process values received from host (rvstopengui)
\, and send to it the title of the window to be embedded., f 61;
#X text 230 244 this may crash the tcl gui and thus puredata....;
#X msg 501 327 map 0 \, map 1;
#X connect 0 0 2 0;
#X connect 1 0 2 1;
#X connect 1 0 8 0;
#X connect 2 0 7 0;
#X connect 5 0 6 0;
#X connect 6 0 3 0;
#X connect 7 0 5 0;
#X restore 436 165 pd embedding_gui_into_host(experimental), f 23
;
#X text 9 381 * Receiving plug & instance name from host;
#X text 14 349 *** OTHER TRICKS ***;
#X text 10 461 * Hiding pd-console window on startup;
#X text 13 573 * Hiding main patch (this one!) on startup;
#X text 545 13 PDVST;
#X connect 0 0 1 0;
#X connect 2 0 23 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 3 1 24 0;
#X connect 4 0 25 0;
#X connect 5 0 6 0;
#X connect 6 0 14 0;
#X connect 7 0 14 0;
#X connect 10 0 17 0;
#X connect 11 0 33 0;
#X connect 11 1 10 0;
#X connect 19 0 18 0;
#X connect 20 0 19 0;
#X connect 21 0 22 0;
#X connect 22 0 18 0;
#X connect 24 0 11 0;
#X connect 25 0 17 0;
#X connect 26 0 17 0;
#X connect 27 0 26 0;
#X connect 29 0 33 1;

View File

@ -0,0 +1,55 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, defaults to <host_exec_dir>/pdvst/pd/bin)
PDPATH =D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Gain(gui).pd
# Unique four character VST plugin ID
ID = pdgg
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = TRUE
# Dimensions of this custom GUI (in pixels)
GUIHEIGHT = 250
# Warning : with tcl/tk, don't try smaller values than 320
GUIWIDTH = 320
# Display Pd GUI or not
# (Hint : choose TRUE if you use some pd-window as custom gui)
DEBUG = TRUE
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full
# Set first parameter value for this program
PARAMETER0 = 1.0
# Define another program
PROGRAM = Att -6db
# Set first parameter value for this program
PARAMETER0 = 0.94
# Define another program
PROGRAM = Mute
# Set first parameter value for this program
PARAMETER0 = 0.

View File

@ -0,0 +1,35 @@
#N canvas 0 265 595 358 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
#X obj 77 162 dac~, f 6;
#X msg 142 52 \$1 30;
#X obj 142 87 line~;
#X obj 122 127 *~;
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 242 235 * 100;
#X obj 242 263 dbtorms;
#X obj 242 290 s gain;
#X obj 300 225 s svstparameter0;
#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X msg 277 42 set \$1;
#X text 355 117 range is 0..1;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 1;
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 10 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 13 0;
#X connect 14 0 10 0;
#X connect 15 0 14 0;

View File

@ -0,0 +1,49 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, will search in <host_exec_dir>\pdvst\pd\
# then in <vst_dir>\.pd\
PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Gain(nogui).pd
# Unique four character VST plugin ID
ID = pdgn
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
DEBUG = FALSE
# External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full Blast
# Set first parameter value for this program
PARAMETER0 = 1.0
#another program
PROGRAM = Muted
PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.94

View File

@ -0,0 +1,35 @@
#N canvas 0 265 595 358 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
#X obj 77 162 dac~, f 6;
#X msg 142 52 \$1 30;
#X obj 142 87 line~;
#X obj 122 127 *~;
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 242 235 * 100;
#X obj 242 263 dbtorms;
#X obj 242 290 s gain;
#X obj 300 225 s svstparameter0;
#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X msg 277 42 set \$1;
#X text 355 117 range is 0..1;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 1;
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 10 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 13 0;
#X connect 14 0 10 0;
#X connect 15 0 14 0;

View File

@ -0,0 +1,49 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, will search in <host_exec_dir>\pdvst\pd\
# then in <vst_dir>\.pd\
PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Gain.pd
# Unique four character VST plugin ID
ID = pdga
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
DEBUG = TRUE
# External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full Blast
# Set first parameter value for this program
PARAMETER0 = 1.0
#another program
PROGRAM = Muted
PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.94

View File

@ -0,0 +1,170 @@
#N canvas 0 0 346 350 12;
#X obj 5 5 cnv 15 300 210 empty gui-label empty 20 12 0 14 -233017
-66577 0;
#X floatatom 13 41 5 0 0 1 vstTimeInfo.ppqPos vstTimeInfo.ppqPos -
, f 5;
#X floatatom 13 61 5 0 0 1 vstTimeInfo.tempo vstTimeInfo.tempo -,
f 5;
#X floatatom 13 81 5 0 0 1 vstTimeInfo.timeSigNumerator vstTimeInfo.timeSigNumerator
-, f 5;
#X floatatom 13 101 5 0 0 1 vstTimeInfo.timeSigDenominator vstTimeInfo.timeSigDenominator
-, f 5;
#N canvas 325 81 624 438 beep(vstTimeInfo) 0;
#X obj 84 333 dac~;
#X obj 158 250 line~;
#X obj 86 305 *~;
#X obj 73 279 osc~ 4000;
#X obj 152 0 r vstTimeInfo.ppqPos;
#X obj 180 104 int;
#X obj 201 154 change;
#X obj 197 187 t b;
#X obj 176 70 * 4;
#X obj 56 49 int;
#X obj 55 127 change;
#X obj 51 160 t b;
#X obj 137 36 t f f;
#X msg 61 194 3600;
#X msg 111 194 4000;
#X msg 189 216 0.03 \, 0 100;
#X connect 1 0 2 1;
#X connect 2 0 0 0;
#X connect 2 0 0 1;
#X connect 3 0 2 0;
#X connect 4 0 12 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 15 0;
#X connect 7 0 14 0;
#X connect 8 0 5 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 13 0;
#X connect 12 0 9 0;
#X connect 12 1 8 0;
#X connect 13 0 3 0;
#X connect 14 0 3 0;
#X connect 15 0 1 0;
#X restore 12 143 pd beep(vstTimeInfo);
#X text 15 17 those are the vstTimeInfo receivers;
#X floatatom 13 121 5 0 0 1 vstTimeInfo.flags vstTimeInfo.flags -,
f 5;
#N canvas 0 50 450 300 midi_stuff 0;
#X obj 71 63 notein;
#X obj 71 114 noteout;
#X obj 32 90 + 7;
#X text 45 186 see midi_objects help file;
#X floatatom 212 113 3 0 0 0 - - -, f 3;
#X obj 167 61 notein;
#X obj 167 87 stripnote;
#X floatatom 167 112 3 0 0 0 - - -, f 3;
#X text 342 57 MIDI OUT;
#X text 167 37 MIDI IN;
#X floatatom 290 112 3 0 0 0 - - -, f 3;
#X floatatom 260 111 3 0 0 0 - - -, f 3;
#X obj 260 86 ctlin;
#N canvas 0 50 484 446 midi 0;
#X obj 96 65 inlet;
#X obj 96 262 noteout;
#X floatatom 96 92 0 0 0 0 - - -;
#X obj 338 113 loadbang;
#X obj 96 184 metro;
#X obj 96 236 makenote;
#X floatatom 189 166 0 0 0 0 - - -;
#X obj 96 210 f;
#X floatatom 145 166 0 0 0 0 - - -;
#X floatatom 233 166 0 0 0 0 - - -;
#X floatatom 276 166 0 0 0 0 - - -;
#X msg 338 148 500;
#X msg 370 148 60;
#X msg 399 148 64;
#X msg 427 148 250;
#X text 144 145 rate;
#X text 187 145 pitch;
#X text 232 145 vel;
#X text 268 146 length;
#X obj 230 257 ctlout 1;
#X floatatom 230 228 0 0 0 0 - - -;
#X connect 0 0 2 0;
#X connect 2 0 4 0;
#X connect 3 0 11 0;
#X connect 3 0 12 0;
#X connect 3 0 13 0;
#X connect 3 0 14 0;
#X connect 4 0 7 0;
#X connect 5 0 1 0;
#X connect 5 1 1 1;
#X connect 6 0 7 1;
#X connect 7 0 5 0;
#X connect 8 0 4 1;
#X connect 9 0 5 1;
#X connect 10 0 5 2;
#X connect 11 0 8 0;
#X connect 12 0 6 0;
#X connect 13 0 9 0;
#X connect 14 0 10 0;
#X connect 20 0 19 0;
#X restore 342 107 pd midi;
#X obj 342 81 tgl 20 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
;
#X obj 167 132 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 260 133 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X connect 0 0 2 0;
#X connect 0 0 1 0;
#X connect 0 1 1 1;
#X connect 0 2 1 2;
#X connect 2 0 1 0;
#X connect 5 0 6 0;
#X connect 5 1 6 1;
#X connect 6 0 7 0;
#X connect 6 1 4 0;
#X connect 7 0 15 0;
#X connect 11 0 16 0;
#X connect 12 0 11 0;
#X connect 12 1 10 0;
#X connect 14 0 13 0;
#X restore 11 166 pd midi_stuff;
#N canvas 0 50 675 489 audio_stuff 0;
#X obj 104 322 adc~;
#X obj 104 401 dac~;
#X msg 47 286 \$1 30;
#X obj 47 311 line~;
#X obj 143 371 *~;
#X obj 104 371 *~;
#X obj 48 47 r rvstparameter0;
#X obj 48 229 * 100;
#X obj 47 253 dbtorms;
#X msg 79 81 set \$1;
#X obj 80 189 s svstparameter0;
#X obj 79 107 s level-rcv;
#X obj 80 144 r level-snd;
#X text 192 107 update pd-slider when parameter is changed from host
;
#X text 230 168 update host when parameter is changed from pd-slider
;
#X text 19 12 audio stuff example;
#X obj 315 283 loadbang;
#X msg 315 312 \; pd dsp 1 \;;
#X obj 222 217 vsl 60 128 0 1 0 0 level-snd level-rcv LEVEL 0 -9 0
10 -262144 -1 -1 0 1;
#X connect 0 0 5 0;
#X connect 0 1 4 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 3 0 5 1;
#X connect 4 0 1 1;
#X connect 5 0 1 0;
#X connect 6 0 7 0;
#X connect 6 0 9 0;
#X connect 7 0 8 0;
#X connect 8 0 2 0;
#X connect 9 0 11 0;
#X connect 12 0 10 0;
#X connect 12 0 7 0;
#X connect 16 0 17 0;
#X restore 11 188 pd audio_stuff;
#X text 17 222 Whether you set pdvst as VST or VSTi \, it will always
receive midi-in and audio-in., f 39;
#X text 14 271 You can set an external midi device for midiin and midiout
(but not an external audio device), f 39;

View File

@ -0,0 +1,52 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, defaults to <host_exec_dir>/pdvst/pd/bin)
PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Midi.pd
# Unique four character VST plugin ID
ID = pdmd
# Whether this is a VSTi
SYNTH = TRUE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
# (Hint : choose TRUE if you use some pd-window as custom gui)
DEBUG = TRUE
# External libraries (comma delimited list, relative to pdvst/)
#(obsolete, use [declare] object inside pd-patch instead)
#LIB =
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full
# Set first parameter value for this program
PARAMETER0 = 1.0
# Define another program
PROGRAM = Att -6db
# Set first parameter value for this program
PARAMETER0 = 0.94
# Define another program
PROGRAM = Mute
# Set first parameter value for this program
PARAMETER0 = 0.

View File

@ -0,0 +1 @@
for use with 32 bits host

View File

@ -0,0 +1,166 @@
#N canvas 313 -10 860 681 12;
#X obj 26 400 r rvstplugname;
#X msg 25 423 \; gui-label label \$1;
#X obj 37 22 r rvstopengui;
#X obj 24 86 select 0 1;
#X obj 22 227 delay 10;
#X obj 32 486 loadbang;
#X msg 31 512 1;
#X msg 68 513 0;
#N canvas 0 50 746 518 audio_stuff 0;
#X obj 104 322 adc~;
#X obj 104 401 dac~;
#X msg 47 286 \$1 30;
#X obj 47 311 line~;
#X obj 143 371 *~;
#X obj 104 371 *~;
#X obj 48 47 r rvstparameter0;
#X obj 48 229 * 100;
#X obj 47 253 dbtorms;
#X msg 79 81 set \$1;
#X obj 80 189 s svstparameter0;
#X obj 79 107 s level-rcv;
#X obj 80 144 r level-snd;
#X text 192 107 update pd-slider when parameter is changed from host
;
#X text 230 168 update host when parameter is changed from pd-slider
;
#X text 19 12 audio stuff example;
#X obj 315 283 loadbang;
#X msg 315 312 \; pd dsp 1 \;;
#X obj 368 463 tabwrite~ scope;
#X obj 375 433 metro 120;
#X obj 366 403 loadbang;
#X obj 280 413 *~ 5;
#X obj 280 438 clip~ -1 1;
#X connect 0 0 5 0;
#X connect 0 1 4 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 3 0 5 1;
#X connect 4 0 1 1;
#X connect 4 0 21 0;
#X connect 5 0 1 0;
#X connect 5 0 21 0;
#X connect 6 0 7 0;
#X connect 6 0 9 0;
#X connect 7 0 8 0;
#X connect 8 0 2 0;
#X connect 9 0 11 0;
#X connect 12 0 10 0;
#X connect 12 0 7 0;
#X connect 16 0 17 0;
#X connect 19 0 18 0;
#X connect 20 0 19 0;
#X connect 21 0 22 0;
#X connect 22 0 18 0;
#X restore 518 403 pd audio_stuff;
#X text 67 50 <- the host signals when gui has to be visible;
#X msg 75 195 vis 1;
#X obj 62 147 t b b;
#X text 124 197 display gui window;
#X text 186 79 0 = hide \, 1 = show;
#N canvas 0 50 450 300 hidePdConsole 0;
#X obj 78 48 inlet;
#X obj 76 149 hcs/sys_gui;
#X msg 75 117 wm withdraw .pdwindow;
#X msg 248 114 wm iconify .pdwindow;
#X obj 79 79 select 1 0;
#X connect 0 0 4 0;
#X connect 2 0 1 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 4 1 3 0;
#X restore 29 544 pd hidePdConsole;
#X text 163 545 (needs hcs/sys_gui external);
#N canvas 0 0 320 154 \$0-gui 0;
#X obj 5 5 cnv 15 300 190 empty gui-label empty 10 12 0 14 -233017
-66577 0;
#X obj 13 53 vsl 60 128 0 1 0 0 level-snd level-rcv LEVEL 0 -9 0 10
-262144 -1 -1 0 1;
#N canvas 0 50 450 250 (subpatch) 0;
#X array scope 300 float 1;
#A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
#X coords 0 1 299 -1 120 70 1 0 0;
#X restore 138 57 graph;
#X obj 136 163 bng 15 250 50 0 \$0-show_parent empty show_parent_window
17 7 0 10 -262144 -1 -1;
#X text 101 145 click here to see main patch;
#X restore 517 361 pd \$0-gui;
#X obj 21 298 s pd-\$0-gui;
#X obj 29 653 s pd-Pd_Gain(gui).pd;
#X msg 29 624 vis 0;
#X obj 28 601 loadbang;
#X obj 104 602 r \$0-show_parent;
#X msg 104 627 vis 1;
#X obj 40 57 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0 1
;
#X obj 58 113 delay 10;
#X msg 21 254 vis 0;
#X msg 206 252 vis 0;
#X obj 208 229 loadbang;
#X text 67 255 hide gui window;
#X obj 597 127 tgl 15 1 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 618 126 enable embedding (experimental);
#X text 110 300 (<- rename with the name of your gui window);
#X text 603 361 <- the actual gui window;
#N canvas 0 50 645 376 embedding_gui_into_host(experimental) 0;
#X obj 86 151 inlet;
#X obj 135 153 inlet;
#X obj 86 205 spigot;
#X obj 83 321 s guiName;
#X text 157 216 <- send to host the title of your gui window;
#X obj 84 268 f \$0;
#X msg 83 295 symbol \$1-gui;
#X obj 84 243 delay 10;
#X obj 154 180 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 90 40 In order to embed a puredata (tcl) gui window into host
\, the patch has to process values received from host (rvstopengui)
\, and send to it the title of the window to be embedded., f 61;
#X text 230 244 this may crash the tcl gui and thus puredata....;
#X msg 501 327 map 0 \, map 1;
#X connect 0 0 2 0;
#X connect 1 0 2 1;
#X connect 1 0 8 0;
#X connect 2 0 7 0;
#X connect 5 0 6 0;
#X connect 6 0 3 0;
#X connect 7 0 5 0;
#X restore 436 165 pd embedding_gui_into_host(experimental), f 23
;
#X text 9 381 * Receiving plug & instance name from host;
#X text 14 349 *** OTHER TRICKS ***;
#X text 10 461 * Hiding pd-console window on startup;
#X text 13 573 * Hiding main patch (this one!) on startup;
#X text 545 13 PDVST;
#X connect 0 0 1 0;
#X connect 2 0 23 0;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 3 1 24 0;
#X connect 4 0 25 0;
#X connect 5 0 6 0;
#X connect 6 0 14 0;
#X connect 7 0 14 0;
#X connect 10 0 17 0;
#X connect 11 0 33 0;
#X connect 11 1 10 0;
#X connect 19 0 18 0;
#X connect 20 0 19 0;
#X connect 21 0 22 0;
#X connect 22 0 18 0;
#X connect 24 0 11 0;
#X connect 25 0 17 0;
#X connect 26 0 17 0;
#X connect 27 0 26 0;
#X connect 29 0 33 1;

View File

@ -0,0 +1,56 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, defaults to <host_exec_dir>/pdvst/pd/bin)
# then in <vst_dir>\.pd\
#PDPATH =D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Gain-gui.pd
# Unique four character VST plugin ID
ID = pdgg
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = TRUE
# Dimensions of this custom GUI (in pixels)
GUIHEIGHT = 250
# Warning : with tcl/tk, don't try smaller values than 320
GUIWIDTH = 320
# Display Pd GUI or not
# (Hint : choose TRUE if you use some pd-window as custom gui)
DEBUG = TRUE
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full
# Set first parameter value for this program
PARAMETER0 = 1.0
# Define another program
PROGRAM = Att -6db
# Set first parameter value for this program
PARAMETER0 = 0.94
# Define another program
PROGRAM = Mute
# Set first parameter value for this program
PARAMETER0 = 0.

View File

@ -0,0 +1,35 @@
#N canvas 0 265 595 358 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
#X obj 77 162 dac~, f 6;
#X msg 142 52 \$1 30;
#X obj 142 87 line~;
#X obj 122 127 *~;
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 242 235 * 100;
#X obj 242 263 dbtorms;
#X obj 242 290 s gain;
#X obj 300 225 s svstparameter0;
#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X msg 277 42 set \$1;
#X text 355 117 range is 0..1;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 1;
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 10 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 13 0;
#X connect 14 0 10 0;
#X connect 15 0 14 0;

View File

@ -0,0 +1,49 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, will search in <host_exec_dir>\pdvst\pd\
# then in <vst_dir>\.pd\
#PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Gain-nogui.pd
# Unique four character VST plugin ID
ID = pdgn
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
DEBUG = FALSE
# External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full Blast
# Set first parameter value for this program
PARAMETER0 = 1.0
#another program
PROGRAM = Muted
PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.94

View File

@ -0,0 +1,35 @@
#N canvas 0 265 595 358 12;
#X obj 78 87 adc~, f 6;
#X obj 73 241 loadbang;
#X msg 73 271 \; pd dsp 1 \;;
#X obj 77 162 dac~, f 6;
#X msg 142 52 \$1 30;
#X obj 142 87 line~;
#X obj 122 127 *~;
#X obj 78 127 *~;
#X obj 142 11 r gain;
#X obj 242 8 r rvstparameter0;
#X obj 242 235 * 100;
#X obj 242 263 dbtorms;
#X obj 242 290 s gain;
#X obj 300 225 s svstparameter0;
#X obj 277 75 vsl 50 128 0 1 0 0 empty empty empty 0 -9 0 10 -262144
-1 -1 0 1;
#X msg 277 42 set \$1;
#X text 355 117 range is 0..1;
#X connect 0 0 7 0;
#X connect 0 1 6 0;
#X connect 1 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 6 1;
#X connect 5 0 7 1;
#X connect 6 0 3 1;
#X connect 7 0 3 0;
#X connect 8 0 4 0;
#X connect 9 0 10 0;
#X connect 9 0 15 0;
#X connect 10 0 11 0;
#X connect 11 0 12 0;
#X connect 14 0 13 0;
#X connect 14 0 10 0;
#X connect 15 0 14 0;

View File

@ -0,0 +1,49 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, will search in <host_exec_dir>\pdvst\pd\
# then in <vst_dir>\.pd\
#PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Gain.pd
# Unique four character VST plugin ID
ID = pdga
# Whether this is a VSTi
SYNTH = FALSE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
DEBUG = TRUE
# External libraries (comma delimited list, relative to pdvst/)
# ***OBSOLETE, use [declare] inside patch instead***
#LIB =
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full Blast
# Set first parameter value for this program
PARAMETER0 = 1.0
#another program
PROGRAM = Muted
PARAMETER0 = 0.0
#another program
PROGRAM = -6dB
PARAMETER0 = 0.94

View File

@ -0,0 +1,170 @@
#N canvas 0 0 346 350 12;
#X obj 5 5 cnv 15 300 210 empty gui-label empty 20 12 0 14 -233017
-66577 0;
#X floatatom 13 41 5 0 0 1 vstTimeInfo.ppqPos vstTimeInfo.ppqPos -
, f 5;
#X floatatom 13 61 5 0 0 1 vstTimeInfo.tempo vstTimeInfo.tempo -,
f 5;
#X floatatom 13 81 5 0 0 1 vstTimeInfo.timeSigNumerator vstTimeInfo.timeSigNumerator
-, f 5;
#X floatatom 13 101 5 0 0 1 vstTimeInfo.timeSigDenominator vstTimeInfo.timeSigDenominator
-, f 5;
#N canvas 325 81 624 438 beep(vstTimeInfo) 0;
#X obj 84 333 dac~;
#X obj 158 250 line~;
#X obj 86 305 *~;
#X obj 73 279 osc~ 4000;
#X obj 152 0 r vstTimeInfo.ppqPos;
#X obj 180 104 int;
#X obj 201 154 change;
#X obj 197 187 t b;
#X obj 176 70 * 4;
#X obj 56 49 int;
#X obj 55 127 change;
#X obj 51 160 t b;
#X obj 137 36 t f f;
#X msg 61 194 3600;
#X msg 111 194 4000;
#X msg 189 216 0.03 \, 0 100;
#X connect 1 0 2 1;
#X connect 2 0 0 0;
#X connect 2 0 0 1;
#X connect 3 0 2 0;
#X connect 4 0 12 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 15 0;
#X connect 7 0 14 0;
#X connect 8 0 5 0;
#X connect 9 0 10 0;
#X connect 10 0 11 0;
#X connect 11 0 13 0;
#X connect 12 0 9 0;
#X connect 12 1 8 0;
#X connect 13 0 3 0;
#X connect 14 0 3 0;
#X connect 15 0 1 0;
#X restore 12 143 pd beep(vstTimeInfo);
#X text 15 17 those are the vstTimeInfo receivers;
#X floatatom 13 121 5 0 0 1 vstTimeInfo.flags vstTimeInfo.flags -,
f 5;
#N canvas 0 50 450 300 midi_stuff 0;
#X obj 71 63 notein;
#X obj 71 114 noteout;
#X obj 32 90 + 7;
#X text 45 186 see midi_objects help file;
#X floatatom 212 113 3 0 0 0 - - -, f 3;
#X obj 167 61 notein;
#X obj 167 87 stripnote;
#X floatatom 167 112 3 0 0 0 - - -, f 3;
#X text 342 57 MIDI OUT;
#X text 167 37 MIDI IN;
#X floatatom 290 112 3 0 0 0 - - -, f 3;
#X floatatom 260 111 3 0 0 0 - - -, f 3;
#X obj 260 86 ctlin;
#N canvas 0 50 484 446 midi 0;
#X obj 96 65 inlet;
#X obj 96 262 noteout;
#X floatatom 96 92 0 0 0 0 - - -;
#X obj 338 113 loadbang;
#X obj 96 184 metro;
#X obj 96 236 makenote;
#X floatatom 189 166 0 0 0 0 - - -;
#X obj 96 210 f;
#X floatatom 145 166 0 0 0 0 - - -;
#X floatatom 233 166 0 0 0 0 - - -;
#X floatatom 276 166 0 0 0 0 - - -;
#X msg 338 148 500;
#X msg 370 148 60;
#X msg 399 148 64;
#X msg 427 148 250;
#X text 144 145 rate;
#X text 187 145 pitch;
#X text 232 145 vel;
#X text 268 146 length;
#X obj 230 257 ctlout 1;
#X floatatom 230 228 0 0 0 0 - - -;
#X connect 0 0 2 0;
#X connect 2 0 4 0;
#X connect 3 0 11 0;
#X connect 3 0 12 0;
#X connect 3 0 13 0;
#X connect 3 0 14 0;
#X connect 4 0 7 0;
#X connect 5 0 1 0;
#X connect 5 1 1 1;
#X connect 6 0 7 1;
#X connect 7 0 5 0;
#X connect 8 0 4 1;
#X connect 9 0 5 1;
#X connect 10 0 5 2;
#X connect 11 0 8 0;
#X connect 12 0 6 0;
#X connect 13 0 9 0;
#X connect 14 0 10 0;
#X connect 20 0 19 0;
#X restore 342 107 pd midi;
#X obj 342 81 tgl 20 0 empty empty empty 20 8 0 8 -262144 -1 -1 0 1
;
#X obj 167 132 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 260 133 bng 20 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X connect 0 0 2 0;
#X connect 0 0 1 0;
#X connect 0 1 1 1;
#X connect 0 2 1 2;
#X connect 2 0 1 0;
#X connect 5 0 6 0;
#X connect 5 1 6 1;
#X connect 6 0 7 0;
#X connect 6 1 4 0;
#X connect 7 0 15 0;
#X connect 11 0 16 0;
#X connect 12 0 11 0;
#X connect 12 1 10 0;
#X connect 14 0 13 0;
#X restore 11 166 pd midi_stuff;
#N canvas 0 50 675 489 audio_stuff 0;
#X obj 104 322 adc~;
#X obj 104 401 dac~;
#X msg 47 286 \$1 30;
#X obj 47 311 line~;
#X obj 143 371 *~;
#X obj 104 371 *~;
#X obj 48 47 r rvstparameter0;
#X obj 48 229 * 100;
#X obj 47 253 dbtorms;
#X msg 79 81 set \$1;
#X obj 80 189 s svstparameter0;
#X obj 79 107 s level-rcv;
#X obj 80 144 r level-snd;
#X text 192 107 update pd-slider when parameter is changed from host
;
#X text 230 168 update host when parameter is changed from pd-slider
;
#X text 19 12 audio stuff example;
#X obj 315 283 loadbang;
#X msg 315 312 \; pd dsp 1 \;;
#X obj 222 217 vsl 60 128 0 1 0 0 level-snd level-rcv LEVEL 0 -9 0
10 -262144 -1 -1 0 1;
#X connect 0 0 5 0;
#X connect 0 1 4 0;
#X connect 2 0 3 0;
#X connect 3 0 4 1;
#X connect 3 0 5 1;
#X connect 4 0 1 1;
#X connect 5 0 1 0;
#X connect 6 0 7 0;
#X connect 6 0 9 0;
#X connect 7 0 8 0;
#X connect 8 0 2 0;
#X connect 9 0 11 0;
#X connect 12 0 10 0;
#X connect 12 0 7 0;
#X connect 16 0 17 0;
#X restore 11 188 pd audio_stuff;
#X text 17 222 Whether you set pdvst as VST or VSTi \, it will always
receive midi-in and audio-in., f 39;
#X text 14 271 You can set an external midi device for midiin and midiout
(but not an external audio device), f 39;

View File

@ -0,0 +1,53 @@
# Number of audio input and output channels
CHANNELS = 2
# installation directory of puredata (optional)
# If non specified, defaults to <host_exec_dir>/pdvst/pd/bin)
# then in <vst_dir>\.pd\
#PDPATH = D:\Programs\pd-0.48-1-test\
# Main Pd patch of the plugin
MAIN = Pd_Midi.pd
# Unique four character VST plugin ID
ID = pdmd
# Whether this is a VSTi
SYNTH = TRUE
# Whether there is a custom GUI (e.g. GrIPD)
CUSTOMGUI = FALSE
# Display Pd GUI or not
# (Hint : choose TRUE if you use some pd-window as custom gui)
DEBUG = TRUE
# External libraries (comma delimited list, relative to pdvst/)
#(obsolete, use [declare] object inside pd-patch instead)
#LIB =
# Number of VST parameters (up to 128)
PARAMETERS = 1
# Name of first VST parameter
# used when CUSTOMGUI is false or VST host doesn't support custom editors
NAMEPARAMETER0 = Level
# Define a program (up to 128)
PROGRAM = Full
# Set first parameter value for this program
PARAMETER0 = 1.0
# Define another program
PROGRAM = Att -6db
# Set first parameter value for this program
PARAMETER0 = 0.94
# Define another program
PROGRAM = Mute
# Set first parameter value for this program
PARAMETER0 = 0.

View File

@ -0,0 +1 @@
for use with 64 bits host

20
vst-scheduler/makefile Normal file
View File

@ -0,0 +1,20 @@
# Compile with MinGW.
# You can call this makefile with:
# make PDDIR=<path/to/pd>
# or you can specify it below:
PDDIR=
WINARCH := $(shell $(CC) -dumpmachine)
ifeq (i686% , $(WINARCH))
arch = 32
else
arch = 64
endif
ALL: vstschedlib.c
gcc -Wall -I$(PDDIR)src -I../vst-template vstschedlib.c -static-libgcc \
-shared -L$(PDDIR)bin -l:pd.dll -o vstschedlib.dll
strip vstschedlib.dll
cp vstschedlib.dll ../build/pd-scheduler$(arch)/vstschedlib.dll

730
vst-scheduler/vstschedlib.c Normal file
View File

@ -0,0 +1,730 @@
/* PdVst v0.0.2 - VST - Pd bridging plugin
** Copyright (C) 2004 Joseph A. Sarlo
**
** This program is free software; you can redistribute it and/orsig
** modify it under the terms of the GNU General Public License
** as published by the Free Software Foundation; either version 2
** of the License, or (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** jsarlo@ucsd.edu
*/
#define _WIN32_WINDOWS 0x410
#include <windows.h>
#include <io.h>
#include <stdio.h>
#include "m_pd.h"
#include "s_stuff.h"
#include "pdvstTransfer.h"
#define MAXARGS 1024
#define MAXSTRLEN 1024
#define TIMEUNITPERSEC (32.*441000.)
#define kVstTransportChanged 1
#define kVstTransportPlaying 2
#define kVstTransportRecording 8
#ifdef VSTMIDIOUTENABLE
EXTERN int midi_outhead;
int _midi_outtail=0; // _midi_outtail defined locally
typedef struct _midiqelem
{
double q_time;
int q_portno;
unsigned char q_onebyte;
unsigned char q_byte1;
unsigned char q_byte2;
unsigned char q_byte3;
} t_midiqelem;
#ifndef MIDIQSIZE
#define MIDIQSIZE 1024
#endif /*MIDIQSIZE */
EXTERN t_midiqelem midi_outqueue[MIDIQSIZE];
//EXTERN int msw_nmidiout;
int msw_nmidiout=0;
#endif // VSTMIDIOUTENABLE
typedef struct _vstParameterReceiver
{
t_object x_obj;
t_symbol *x_sym;
}t_vstParameterReceiver;
typedef struct _vstGuiNameReceiver
{
t_object x_obj;
}t_vstGuiNameReceiver;
t_vstGuiNameReceiver *vstGuiNameReceiver;
t_vstParameterReceiver *vstParameterReceivers[MAXPARAMETERS];
t_class *vstParameterReceiver_class;
t_class *vstGuiNameReceiver_class;
char *pdvstTransferMutexName,
*pdvstTransferFileMapName,
*vstProcEventName,
*pdProcEventName;
pdvstTransferData *pdvstData;
HANDLE vstHostProcess,
pdvstTransferMutex,
pdvstTransferFileMap,
vstProcEvent,
pdProcEvent;
pdvstTimeInfo timeInfo;
int tokenizeCommandLineString(char *clString, char **tokens)
{
int i, charCount = 0;
int tokCount= 0;
int quoteOpen = 0;
for (i = 0; i < (signed int)strlen(clString); i++)
{
if (clString[i] == '"')
{
quoteOpen = !quoteOpen;
}
else if (clString[i] == ' ' && !quoteOpen)
{
tokens[tokCount][charCount] = 0;
tokCount++;
charCount = 0;
}
else
{
tokens[tokCount][charCount] = clString[i];
charCount++;
}
}
tokens[tokCount][charCount] = 0;
tokCount++;
return tokCount;
}
void parseArgs(int argc, char **argv)
{
int vstHostProcessId;
while ((argc > 0) && (**argv == '-'))
{
if (strcmp(*argv, "-vsthostid") == 0)
{
vstHostProcessId = atoi(argv[1]);
vstHostProcess = OpenProcess(PROCESS_ALL_ACCESS,
FALSE,
vstHostProcessId);
if (vstHostProcess == NULL)
{
exit(1);
}
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-mutexname") == 0)
{
pdvstTransferMutexName = argv[1];
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-filemapname") == 0)
{
pdvstTransferFileMapName = argv[1];
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-vstproceventname") == 0)
{
vstProcEventName = argv[1];
argc -= 2;
argv += 2;
}
if (strcmp(*argv, "-pdproceventname") == 0)
{
pdProcEventName = argv[1];
argc -= 2;
argv += 2;
}
else
{
argc--;
argv++;
}
}
}
int setPdvstGuiState(int state)
{
t_symbol *tempSym;
tempSym = gensym("rvstopengui");
if (tempSym->s_thing)
{
pd_float(tempSym->s_thing, (float)state);
return 1;
}
else
return 0;
}
int setPdvstPlugName(char* instanceName)
{
t_symbol *tempSym;
tempSym = gensym("rvstplugname");
if (tempSym->s_thing)
{
pd_symbol(tempSym->s_thing, gensym(instanceName));
return 1;
}
else
return 0;
}
int setPdvstFloatParameter(int index, float value)
{
t_symbol *tempSym;
char string[1024];
sprintf(string, "rvstparameter%d", index);
tempSym = gensym(string);
if (tempSym->s_thing)
{
pd_float(tempSym->s_thing, value);
return 1;
}
else
{
return 0;
}
}
void sendPdVstFloatParameter(t_vstParameterReceiver *x, t_float floatValue)
{
int index;
index = atoi(x->x_sym->s_name + strlen("svstParameter"));
WaitForSingleObject(pdvstTransferMutex, INFINITE);
pdvstData->vstParameters[index].type = FLOAT_TYPE;
pdvstData->vstParameters[index].direction = PD_SEND;
pdvstData->vstParameters[index].updated = 1;
pdvstData->vstParameters[index].value.floatData = floatValue;
ReleaseMutex(pdvstTransferMutex);
}
void sendPdVstGuiName(t_vstGuiNameReceiver *x, t_symbol *symbolValue)
{
WaitForSingleObject(pdvstTransferMutex, INFINITE);
pdvstData->guiName.type = STRING_TYPE;
pdvstData->guiName.direction = PD_SEND;
pdvstData->guiName.updated = 1;
strcpy(pdvstData->guiName.value.stringData,symbolValue->s_name);
ReleaseMutex(pdvstTransferMutex);
}
void makePdvstParameterReceivers()
{
int i;
char string[1024];
for (i = 0; i < MAXPARAMETERS; i++)
{
vstParameterReceivers[i] = (t_vstParameterReceiver *)pd_new(vstParameterReceiver_class);
sprintf(string, "svstparameter%d", i);
vstParameterReceivers[i]->x_sym = gensym(string);
pd_bind(&vstParameterReceivers[i]->x_obj.ob_pd, gensym(string));
}
}
void makePdvstGuiNameReceiver()
{
vstGuiNameReceiver = (t_vstGuiNameReceiver *)pd_new(vstGuiNameReceiver_class);
pd_bind(&vstGuiNameReceiver->x_obj.ob_pd, gensym("guiName"));
}
void send_dacs(void)
{
int i, j, sampleCount, nChannels, blockSize;
t_sample *soundin, *soundout;
soundin = get_sys_soundin();
soundout = get_sys_soundout();
nChannels = pdvstData->nChannels;
blockSize = pdvstData->blockSize;
if (blockSize == *(get_sys_schedblocksize()))
{
sampleCount = 0;
for (i = 0; i < nChannels; i++)
{
for (j = 0; j < blockSize; j++)
{
soundin[sampleCount] = pdvstData->samples[i][j];
pdvstData->samples[i][j] = soundout[sampleCount];
soundout[sampleCount] = 0;
sampleCount++;
}
}
}
}
void scheduler_tick( void)
{
//l sys_addhist(0);
send_dacs();
//l sys_setmiditimediff(0, 1e-6 * *(get_sys_schedadvance()));
//l sys_addhist(1);
/// { JYG
//sched_tick(*(get_sys_time()) + *(get_sys_time_per_dsp_tick()));
sched_tick();
/// JYG }
//l sys_addhist(2);
sys_pollmidiqueue();
sys_pollgui();
//l sys_addhist(3);
}
/*
int HFClock()
{
LARGE_INTEGER freq, now;
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&now);
return (int)((now.QuadPart * 1000) / freq.QuadPart);
}
*/
int scheduler()
{
int i,
blockTime,
active = 1;
DWORD vstHostProcessStatus = 0;
vstParameterReceiver_class = class_new(gensym("vstParameterReceiver"),
0,
0,
sizeof(t_vstParameterReceiver),
0,
0);
class_addfloat(vstParameterReceiver_class, (t_method)sendPdVstFloatParameter);
makePdvstParameterReceivers();
vstGuiNameReceiver_class = class_new(gensym("vstGuiNameReceiver"),
0,
0,
sizeof(t_vstGuiNameReceiver),
0,
0);
class_addsymbol(vstGuiNameReceiver_class,(t_method)sendPdVstGuiName);
makePdvstGuiNameReceiver();
*(get_sys_time_per_dsp_tick()) = (TIMEUNITPERSEC) * \
((double)*(get_sys_schedblocksize())) / \
*(get_sys_dacsr());
//l sys_clearhist();
//if (*(get_sys_sleepgrain()) < 1000) // JYG
if (*(get_sys_sleepgrain()) < 100)
{
*(get_sys_sleepgrain()) = *(get_sys_schedadvance()) / 4;
}
if (*(get_sys_sleepgrain()) < 100)
{
*(get_sys_sleepgrain()) = 100;
}
else if (*(get_sys_sleepgrain()) > 5000)
{
*(get_sys_sleepgrain()) = 5000;
}
sys_initmidiqueue();
#ifdef VSTMIDIOUTENABLE
pdvstData->midiOutQueueSize=0;
#endif // VSTMIDIOUTENABLE
while (active)
{
WaitForSingleObject(pdvstTransferMutex, INFINITE);
active = pdvstData->active;
// check sample rate
if (pdvstData->sampleRate != (int)sys_getsr())
{
post("check samplerate");
sys_setchsr(pdvstData->nChannels,
pdvstData->nChannels,
pdvstData->sampleRate);
}
// check for vstParameter changed
if (pdvstData->guiState.direction == PD_RECEIVE && \
pdvstData->guiState.updated)
{
if(setPdvstGuiState((int)pdvstData->guiState.value.floatData))
pdvstData->guiState.updated=0;
}
// JYG { check for vstplug instance name
if (pdvstData->plugName.direction == PD_RECEIVE && \
pdvstData->plugName.updated)
{
if (setPdvstPlugName((char*)pdvstData->plugName.value.stringData))
pdvstData->plugName.updated=0;
}
if (pdvstData->hostTimeInfo.updated)
{
pdvstData->hostTimeInfo.updated=0;
t_symbol *tempSym;
if (timeInfo.flags!=pdvstData->hostTimeInfo.flags)
{
timeInfo.flags=pdvstData->hostTimeInfo.flags;
tempSym = gensym("vstTimeInfo.flags");
if (tempSym->s_thing)
{
pd_float(tempSym->s_thing, (float)timeInfo.flags);
}
else
{
timeInfo.flags=0;
pdvstData->hostTimeInfo.updated=1; // keep flag as updated
}
}
if ((timeInfo.flags&(kVstTransportChanged|kVstTransportPlaying|kVstTransportRecording))||(timeInfo.ppqPos!=(float)pdvstData->hostTimeInfo.ppqPos))
{
timeInfo.ppqPos=(float)pdvstData->hostTimeInfo.ppqPos;