All language subtitles for Learn-Modern-C-by-Building-an-Audio-Plugin-w-JUCE-Framework-Full-Course_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:03,359 --> 00:00:07,278 we are gonna build this plug-in from 2 00:00:07,278 --> 00:00:11,439 and the juice framework in this free 3 00:00:09,279 --> 00:00:13,439 course check the description for links 4 00:00:11,439 --> 00:00:14,798 to the repository and to download the 5 00:00:14,798 --> 00:00:18,320 okay what is this thing this is the 6 00:00:18,320 --> 00:00:21,519 other plugin which is my new course for 7 00:00:21,519 --> 00:00:25,118 plus four musicians which is where you 8 00:00:25,118 --> 00:00:29,278 which is also where you can learn modern 9 00:00:27,118 --> 00:00:31,118 c plus and the juice framework from 10 00:00:29,278 --> 00:00:32,558 scratch taught from the context of 11 00:00:32,558 --> 00:00:35,839 in a mentored environment you're not 12 00:00:34,399 --> 00:00:37,679 following videos you're not watching 13 00:00:35,840 --> 00:00:38,239 someone else code and you're not copying 14 00:00:38,238 --> 00:00:41,359 you're coding it yourself and i'm 15 00:00:41,359 --> 00:00:44,799 all right enough about those let's learn 16 00:00:43,359 --> 00:00:48,238 about what we are going to build 17 00:00:44,799 --> 00:00:50,479 today this is a 3-band equalizer with a 18 00:00:50,479 --> 00:00:54,558 it has a low-cut band it has a high cut 19 00:00:52,558 --> 00:00:55,359 band and has a parametric band in the 20 00:00:55,359 --> 00:00:59,519 the low-cut band lets you cut out all of 21 00:00:59,520 --> 00:01:03,280 you can also control the steepness of 22 00:01:03,359 --> 00:01:06,478 the high cut band lets you remove all 23 00:01:06,478 --> 00:01:09,679 and you can also control how steep that 24 00:01:09,680 --> 00:01:13,118 the parametric band lets you add notches 25 00:01:13,118 --> 00:01:17,599 and we can also control how wide or how 26 00:01:16,079 --> 00:01:19,359 narrow those boosts are and we can 27 00:01:19,359 --> 00:01:23,599 everybody's familiar with this type of 28 00:01:23,599 --> 00:01:26,959 above that there are bypass buttons 29 00:01:25,118 --> 00:01:28,478 which allow you to disable individual 30 00:01:26,959 --> 00:01:29,919 bands which is always helpful when 31 00:01:29,920 --> 00:01:34,000 and above that is the response curve 32 00:01:31,680 --> 00:01:36,320 which gives us a visual representation 33 00:01:34,000 --> 00:01:37,040 of what the filters are doing then 34 00:01:37,040 --> 00:01:40,960 is the spectrum analyzer and this shows 35 00:01:40,959 --> 00:01:44,879 and these always use a bunch of cpu so 36 00:01:42,640 --> 00:01:46,560 there's a bypass button for that as well 37 00:01:44,879 --> 00:01:47,920 we're going to learn all the dsp that's 38 00:01:47,920 --> 00:01:50,799 that makes this thing work we're going 39 00:01:49,200 --> 00:01:52,478 to learn how to draw everything how to 40 00:01:50,799 --> 00:01:53,920 draw the sliders the bypass buttons how 41 00:01:52,478 --> 00:01:55,280 to draw the response curve and make it 42 00:01:55,280 --> 00:01:59,439 whenever we adjust the sliders and how 43 00:01:59,438 --> 00:02:02,798 okay that's the feature set for this 44 00:02:00,959 --> 00:02:05,039 plugin and for this free course 45 00:02:02,799 --> 00:02:06,799 my name is chuck i go by the name matcat 46 00:02:06,799 --> 00:02:10,319 once again check the description for 47 00:02:10,318 --> 00:02:13,839 and to download the final build of this 48 00:02:13,840 --> 00:02:17,520 and write some audio software using 49 00:02:15,680 --> 00:02:18,159 modern c plus plus and the juice 50 00:02:31,519 --> 00:02:36,000 all right the first thing we need to do 51 00:02:33,360 --> 00:02:37,680 is get set up with the juice framework 52 00:02:36,000 --> 00:02:39,439 now if you've never done any audio 53 00:02:39,439 --> 00:02:43,439 the only things you need are two tools 54 00:02:41,280 --> 00:02:44,479 the juice framework and then an ide to 55 00:02:44,479 --> 00:02:48,318 that could be xcode or it could be 56 00:02:46,318 --> 00:02:50,399 visual studio it depends on what 57 00:02:48,318 --> 00:02:52,079 operating system you're running i'm on 58 00:02:50,400 --> 00:02:53,200 mac so i'm going to be using xcode for 59 00:02:53,199 --> 00:02:56,238 if you've never set yourself up with an 60 00:02:56,239 --> 00:02:59,920 i have two videos linked in the 61 00:02:58,080 --> 00:03:00,480 description they take you through the 62 00:03:00,479 --> 00:03:04,000 of setting up your computer with an ide 63 00:03:04,000 --> 00:03:07,759 framework setting up producer setting up 64 00:03:07,759 --> 00:03:11,919 making your first project and then um 65 00:03:11,919 --> 00:03:17,199 and um yeah it basically gets you 66 00:03:17,199 --> 00:03:20,399 with the workflow that goes in with 67 00:03:20,400 --> 00:03:24,080 in the context of writing audio software 68 00:03:22,560 --> 00:03:26,239 okay so the first thing we're going to 69 00:03:24,080 --> 00:03:27,200 do is go get the juice framework so 70 00:03:27,199 --> 00:03:30,839 right now i'm going to open up safari 71 00:03:30,840 --> 00:03:34,400 just um this is like just a blank os 72 00:03:34,400 --> 00:03:38,080 and i'm gonna install um i'm gonna grab 73 00:03:38,080 --> 00:03:42,719 framework just gonna search for it it is 74 00:03:42,719 --> 00:03:46,400 so i'm gonna go grab it here now what 75 00:03:44,560 --> 00:03:49,120 i'm going to do is i'm going to clone 76 00:03:46,400 --> 00:03:51,680 the repository and the reason is because 77 00:03:49,120 --> 00:03:53,759 um this is an active repository they 78 00:03:51,680 --> 00:03:55,599 make a lot of changes to it okay 79 00:03:53,759 --> 00:03:56,798 so especially on the develop branch we 80 00:03:55,598 --> 00:03:58,158 want to make sure that we have all of 81 00:03:56,799 --> 00:03:59,360 these changes because stuff's getting 82 00:03:59,360 --> 00:04:02,959 features are being added that sort of 83 00:04:02,959 --> 00:04:07,120 the repository cloned i'm able to pull 84 00:04:07,120 --> 00:04:10,158 this is different from if i had just 85 00:04:10,158 --> 00:04:14,079 so that's why i'm going to do that okay 86 00:04:14,080 --> 00:04:18,000 if you don't have terminal open just you 87 00:04:15,519 --> 00:04:18,959 know terminal open it like that or open 88 00:04:18,959 --> 00:04:23,439 prompt shell okay then i'm going to uh 89 00:04:23,439 --> 00:04:27,360 um my users folder right here and i'm 90 00:04:25,600 --> 00:04:28,160 just going to clone the repository right 91 00:04:32,319 --> 00:04:35,599 just like that that's going to make the 92 00:04:33,839 --> 00:04:37,359 juice folder and it's going to download 93 00:04:37,360 --> 00:04:41,439 into this folder and it's in it's going 94 00:04:39,360 --> 00:04:43,040 to include all of the commit changes as 95 00:04:41,439 --> 00:04:44,240 well so let's just wait for this to 96 00:04:44,240 --> 00:04:47,280 all right there it goes there's the 97 00:04:47,279 --> 00:04:51,359 what we want to do is switch to the 98 00:04:48,959 --> 00:04:51,758 develop branch because as i had shown it 99 00:04:51,759 --> 00:04:58,240 um more it contains more recent changes 100 00:04:56,319 --> 00:04:59,360 than the other branch you can see that 101 00:04:59,360 --> 00:05:03,520 19 commits ahead of the master branch so 102 00:05:03,519 --> 00:05:08,000 type in terminal uh first we need to go 103 00:05:08,000 --> 00:05:14,720 so let's do that right now cd juice 104 00:05:11,918 --> 00:05:15,439 dot slash juice and now we need to do 105 00:05:18,478 --> 00:05:25,279 all right switch to a new branch develop 106 00:05:21,839 --> 00:05:27,279 okay cool now i prefer to use a git gui 107 00:05:25,279 --> 00:05:29,359 so i'm going to be using fork from now 108 00:05:29,360 --> 00:05:33,199 simple eq that we will be building so 109 00:05:31,680 --> 00:05:34,800 i'm going to open that now so we can see 110 00:05:33,199 --> 00:05:35,759 what this repository looks like in that 111 00:05:35,759 --> 00:05:39,840 so i'm going to open up fork fork is 112 00:05:39,839 --> 00:05:44,399 okay so here is the repository i had 113 00:05:44,399 --> 00:05:49,198 um and you can see here's all the 114 00:05:49,199 --> 00:05:52,079 and all the basically all the work that 115 00:05:50,959 --> 00:05:53,680 they've been doing on it and you can see 116 00:05:53,680 --> 00:05:59,199 the develop branch okay our next job is 117 00:06:02,240 --> 00:06:07,360 producer to make a project pro juicer is 118 00:06:07,360 --> 00:06:10,960 inside producer now inside here you're 119 00:06:10,959 --> 00:06:14,959 and in there is a project file for each 120 00:06:14,959 --> 00:06:19,279 linux you got mac and you got windows so 121 00:06:17,600 --> 00:06:19,680 if you're on windows open the solution 122 00:06:19,680 --> 00:06:23,360 depending on which version of visual 123 00:06:21,439 --> 00:06:25,038 studio you're running if you're on mac 124 00:06:23,360 --> 00:06:26,720 you're going to open up the xcode file 125 00:06:25,038 --> 00:06:29,038 if you're on linux there's a make file 126 00:06:26,720 --> 00:06:29,919 and you linux users know what to do with 127 00:06:29,918 --> 00:06:34,560 so i'm not going to talk about that okay 128 00:06:34,560 --> 00:06:38,399 the solution file that's going to open 129 00:06:36,160 --> 00:06:40,960 up xcode and now all i need to do is 130 00:06:40,959 --> 00:06:44,159 okay so we just need to wait for this to 131 00:06:44,160 --> 00:06:48,800 apologies if i start speaking fast 132 00:06:47,279 --> 00:06:50,478 i like doing this stuff a lot and when i 133 00:06:48,800 --> 00:06:51,840 get excited i start to speak really fast 134 00:06:51,839 --> 00:06:55,839 speak too fast i'm probably gonna take a 135 00:06:53,918 --> 00:06:58,079 step back and repeat what i say 136 00:06:55,839 --> 00:07:00,959 slower so just apologies in advance if i 137 00:06:58,079 --> 00:07:02,399 start speaking really really fast 138 00:07:00,959 --> 00:07:04,478 all right so let's wait for this to 139 00:07:04,478 --> 00:07:08,560 now it's going to run it and then we 140 00:07:08,560 --> 00:07:12,240 uh this stuff all right so let's get 141 00:07:12,240 --> 00:07:16,400 okay we are presented with the new 142 00:07:16,399 --> 00:07:19,679 before we do that we want to go to 143 00:07:18,000 --> 00:07:20,879 producer and we want to configure our 144 00:07:20,879 --> 00:07:23,918 and these need to point to the juice 145 00:07:23,918 --> 00:07:28,079 and the modules folder now the juice 146 00:07:25,839 --> 00:07:30,318 folder by default if you clone the 147 00:07:28,079 --> 00:07:31,598 repository to your users folder 148 00:07:31,598 --> 00:07:34,959 automatically it's going to go right to 149 00:07:33,199 --> 00:07:37,280 your users folder and the juice thing 150 00:07:34,959 --> 00:07:39,120 however if you decide to put it 151 00:07:37,279 --> 00:07:40,879 somewhere else you need to customize 152 00:07:39,120 --> 00:07:41,840 these modules so click on this button 153 00:07:41,839 --> 00:07:45,758 and then navigate to wherever your juice 154 00:07:45,759 --> 00:07:50,240 for setting the path to juice then do 155 00:07:48,560 --> 00:07:52,319 the same thing for the modules 156 00:07:50,240 --> 00:07:54,160 click click that button navigate to your 157 00:07:52,319 --> 00:07:56,160 juice folder and then navigate to the 158 00:07:54,160 --> 00:07:57,680 modules button to the modules folder 159 00:07:57,680 --> 00:08:01,439 okay and then if you rescan it'll tell 160 00:07:59,519 --> 00:08:04,159 you if there's any issues or not 161 00:08:01,439 --> 00:08:05,759 once that is done now you can go to the 162 00:08:05,759 --> 00:08:09,120 basic and we're going to create a 163 00:08:09,120 --> 00:08:13,680 simple eq and then we can do create 164 00:08:12,079 --> 00:08:15,120 project and it's going to ask me where 165 00:08:15,120 --> 00:08:20,319 create project i want to save it to this 166 00:08:20,319 --> 00:08:23,598 and there it goes it's going to save it 167 00:08:21,759 --> 00:08:25,520 it's going to make it and now if i 168 00:08:25,519 --> 00:08:31,839 here is my project so i'm going to make 169 00:08:29,519 --> 00:08:32,718 a git repository next before i actually 170 00:08:32,719 --> 00:08:36,640 around at the code because it's always 171 00:08:34,799 --> 00:08:38,000 important to set yourself up with the 172 00:08:38,000 --> 00:08:41,278 in case you have to backtrack and undo 173 00:08:41,278 --> 00:08:45,120 so i'm going to do that next all right 174 00:08:45,120 --> 00:08:49,759 of keeping everything neutral i will not 175 00:08:47,278 --> 00:08:51,519 be creating the repository in fork 176 00:08:49,759 --> 00:08:53,519 but i will be doing it in terminal 177 00:08:51,519 --> 00:08:54,879 because everybody's computer has a shell 178 00:08:54,879 --> 00:09:00,399 so what i need to do is first navigate 179 00:08:57,440 --> 00:09:01,920 to the folder that my repository is in 180 00:09:00,399 --> 00:09:04,000 so i'm going to do that cd i'm just 181 00:09:01,919 --> 00:09:05,278 going to drag this folder in here 182 00:09:04,000 --> 00:09:08,000 now i'm inside that folder and now i'm 183 00:09:08,000 --> 00:09:12,879 like that okay now uh i'm not seeing it 184 00:09:12,879 --> 00:09:17,759 um hidden files and now here is my git 185 00:09:17,759 --> 00:09:24,159 so what i need to do next is create 186 00:09:21,120 --> 00:09:25,200 a i need to do an initial commit and 187 00:09:25,200 --> 00:09:28,240 now i do not want to include everything 188 00:09:28,240 --> 00:09:32,000 and i do not want to include uh 189 00:09:30,320 --> 00:09:32,560 everything that's in this juice library 190 00:09:32,559 --> 00:09:36,399 because a juice library code folder 191 00:09:36,399 --> 00:09:40,639 this producer file it recreates these 192 00:09:38,879 --> 00:09:40,958 folders the only thing we want to keep 193 00:09:40,958 --> 00:09:45,679 the juicer file and the source file so 194 00:09:43,278 --> 00:09:48,080 i'm going to add a git init file 195 00:09:45,679 --> 00:09:49,679 first or a git ignore file sorry so i 196 00:09:53,200 --> 00:09:58,240 nor like that that creates a document 197 00:09:56,480 --> 00:10:01,120 which i can open with a text editor 198 00:09:58,240 --> 00:10:01,919 and specify that i want to exclude this 199 00:10:01,919 --> 00:10:06,559 and this juice library code so let me go 200 00:10:04,159 --> 00:10:08,480 do that i'm going to open this with uh 201 00:10:06,559 --> 00:10:09,759 i'm going to open it with text edit 202 00:10:09,759 --> 00:10:13,120 and i want to write star star slash 203 00:10:17,120 --> 00:10:20,879 library code okay that's the name of 204 00:10:20,879 --> 00:10:23,919 and then uh because this is os x i'm 205 00:10:23,919 --> 00:10:28,159 star star slash dot d s underscore store 206 00:10:28,159 --> 00:10:31,679 we're not seeing any of those files 207 00:10:31,679 --> 00:10:34,879 sometimes we will that's um basically 208 00:10:34,879 --> 00:10:38,958 the if i can figure how this folder 209 00:10:36,879 --> 00:10:39,759 looks um it's gonna get stored as a ds 210 00:10:39,759 --> 00:10:44,319 and those are super annoying to include 211 00:10:42,799 --> 00:10:46,078 um in your repository so it's very good 212 00:10:49,278 --> 00:10:55,039 git um let's see git commit dash 213 00:10:52,639 --> 00:10:56,559 m this is my initial commit let's do a 214 00:10:56,559 --> 00:11:00,958 let's see what we got get status we can 215 00:10:59,360 --> 00:11:01,600 see that there are no tracked files so 216 00:11:01,600 --> 00:11:05,600 our files git add and you'll notice that 217 00:11:05,600 --> 00:11:09,040 the untracked files does not include 218 00:11:07,519 --> 00:11:09,440 anything in the builds folder and the 219 00:11:09,440 --> 00:11:13,360 library code folder and that's because 220 00:11:11,519 --> 00:11:14,480 of the git ignore file it's doing its 221 00:11:14,480 --> 00:11:17,920 let me just move this out of here so you 222 00:11:17,919 --> 00:11:21,838 so if i do that again um let's see let's 223 00:11:21,839 --> 00:11:26,320 get status we can see we've got these 224 00:11:26,320 --> 00:11:30,800 but it's also not tracking these guys so 225 00:11:30,799 --> 00:11:33,838 there's a builds folder and there's a 226 00:11:33,839 --> 00:11:37,760 as i said before we don't want those 227 00:11:35,679 --> 00:11:39,838 included so i'm going to put that back 228 00:11:37,759 --> 00:11:42,078 and then we'll do git status one more 229 00:11:39,839 --> 00:11:43,920 time okay so we've got our git ignore 230 00:11:42,078 --> 00:11:45,679 the juicer file and then the four source 231 00:11:43,919 --> 00:11:46,078 code files all right now that we have 232 00:11:46,078 --> 00:11:49,599 ready to be committed let's make a 233 00:11:54,000 --> 00:11:58,000 whoops i forgot the closing quote all 234 00:11:58,000 --> 00:12:01,839 that's fine good enough okay now i can 235 00:12:01,839 --> 00:12:08,839 in fork i can do file open repository 236 00:12:05,919 --> 00:12:10,000 so now i can actually see what's going 237 00:12:10,000 --> 00:12:14,559 and here's right here's my initial 238 00:12:14,559 --> 00:12:19,518 okay so if we want we can go make a 239 00:12:16,799 --> 00:12:20,479 repository on github and push the code 240 00:12:20,480 --> 00:12:24,720 um or you know just keep it local but 241 00:12:23,120 --> 00:12:25,679 either way now we can keep track of 242 00:12:25,679 --> 00:12:32,319 okay so i'm going to give you a quick 243 00:12:29,360 --> 00:12:33,919 overview of where everything happens in 244 00:12:33,919 --> 00:12:37,599 before we actually start work on this 245 00:12:37,600 --> 00:12:42,879 so this is going to be a brief overview 246 00:12:39,519 --> 00:12:45,360 of how these plugins work and um 247 00:12:42,879 --> 00:12:46,240 what where we will primarily be spending 248 00:12:46,240 --> 00:12:49,759 doing edits in the code so we have four 249 00:12:48,559 --> 00:12:53,799 source files right here we've got 250 00:12:49,759 --> 00:12:56,879 plug-in processor.cpp pluginprocessor.h 251 00:12:53,799 --> 00:12:59,039 plugineditor.cpp and plugineditor.h 252 00:12:56,879 --> 00:13:00,958 in uh let me pull up the assistant 253 00:13:00,958 --> 00:13:04,719 so that we can see what's going on on 254 00:13:04,720 --> 00:13:10,639 plugin processor.h um in a juice plugin 255 00:13:08,720 --> 00:13:11,519 you've got two main functions that are 256 00:13:11,519 --> 00:13:15,039 there's your prepare to play function 257 00:13:13,360 --> 00:13:15,759 and then there is your process block 258 00:13:15,759 --> 00:13:21,360 prepare to play gets called by the host 259 00:13:17,919 --> 00:13:23,199 when it's about to start playback 260 00:13:21,360 --> 00:13:24,959 and then process block is actually what 261 00:13:24,958 --> 00:13:30,719 you hit the play button in the transport 262 00:13:26,958 --> 00:13:32,958 control when you hit that play button 263 00:13:30,720 --> 00:13:34,800 the host just starts sending buffers at 264 00:13:32,958 --> 00:13:36,719 a regular rate into your plug-in and 265 00:13:36,720 --> 00:13:40,560 give it back any finished audio that is 266 00:13:40,559 --> 00:13:44,399 you cannot interrupt that chain of 267 00:13:44,399 --> 00:13:47,839 if you add latency or whatever it can 268 00:13:46,000 --> 00:13:48,480 cause clicks and pops in your speakers 269 00:13:48,480 --> 00:13:53,278 that has the potential to damage 270 00:13:50,000 --> 00:13:55,120 speakers as well as explode eardrums 271 00:13:53,278 --> 00:13:57,519 just imagine this scenario that you're 272 00:13:55,120 --> 00:13:58,000 at a club and the sound system is super 273 00:13:58,000 --> 00:14:01,679 and your plug-in causes a pop or a 274 00:14:01,679 --> 00:14:06,638 the sound you know the sound engineer or 275 00:14:04,958 --> 00:14:08,078 the dj or whatever has their thing 276 00:14:08,078 --> 00:14:12,479 there's this huge pop and everybody's 277 00:14:12,480 --> 00:14:16,959 like that so that's why um that's the 278 00:14:15,198 --> 00:14:17,759 big thing about audio processing is you 279 00:14:17,759 --> 00:14:21,360 um interrupt this process block and 280 00:14:19,919 --> 00:14:22,639 anything that goes on inside it you have 281 00:14:22,639 --> 00:14:26,799 um you got to figure out how to get all 282 00:14:24,958 --> 00:14:27,679 the all the work that you need done by 283 00:14:27,679 --> 00:14:33,120 done within a fixed amount of time okay 284 00:14:30,958 --> 00:14:34,399 so those are the two big functions we're 285 00:14:33,120 --> 00:14:35,759 going to be spending most of our time 286 00:14:35,759 --> 00:14:40,639 and then process block now um let's take 287 00:14:38,799 --> 00:14:41,759 a look at what happens over there so in 288 00:14:41,759 --> 00:14:45,278 use this as the place to do any 289 00:14:43,278 --> 00:14:46,000 pre-playback initialization that you 290 00:14:46,000 --> 00:14:50,240 and then in process block this is where 291 00:14:47,759 --> 00:14:51,919 you get your actual block of audio data 292 00:14:50,240 --> 00:14:53,919 um and if you're using a midi controller 293 00:14:51,919 --> 00:14:57,278 these are where the midi messages are 294 00:14:53,919 --> 00:14:58,719 but basically um this is where we do all 295 00:14:58,720 --> 00:15:02,399 typing all a bunch of code here and we 296 00:15:02,399 --> 00:15:06,799 doesn't happen in like more time than we 297 00:15:06,799 --> 00:15:09,919 okay let's go take a look at plugin 298 00:15:09,919 --> 00:15:14,159 is where we set up all of our visual 299 00:15:11,759 --> 00:15:15,519 elements and um there's some basic stuff 300 00:15:15,519 --> 00:15:19,039 you got your paint function your resized 301 00:15:19,039 --> 00:15:22,078 uh painting you know it's what we're 302 00:15:22,078 --> 00:15:26,319 showing a hello world if i run this real 303 00:15:26,320 --> 00:15:29,680 so before i get into showing how to run 304 00:15:29,679 --> 00:15:32,879 yeah right now we're just going to see a 305 00:15:30,799 --> 00:15:34,000 hello world displayed at the center of 306 00:15:34,000 --> 00:15:37,919 um and then if we have any child 307 00:15:37,919 --> 00:15:42,078 sub components or anything like that 308 00:15:40,320 --> 00:15:43,120 we'll lay them out here in the resized 309 00:15:43,120 --> 00:15:47,278 okay so that's a basic overview we're 310 00:15:45,919 --> 00:15:49,198 going to be basically making child 311 00:15:47,278 --> 00:15:50,078 components to represent the knobs and 312 00:15:50,078 --> 00:15:54,638 and the spectrum analyzer and the 313 00:15:54,639 --> 00:15:57,680 and then we're going to be you know 314 00:15:57,679 --> 00:16:01,359 some you know audio parameters that 315 00:16:01,360 --> 00:16:06,879 okay so let's run this for the first 316 00:16:04,000 --> 00:16:08,480 time what we need to do is go to 317 00:16:06,879 --> 00:16:11,198 our particular scheme we have a few 318 00:16:08,480 --> 00:16:13,199 targets we've got a vst3 format 319 00:16:11,198 --> 00:16:15,599 we have an audio unit format if we are 320 00:16:13,198 --> 00:16:16,240 on os x and then we have the standalone 321 00:16:16,240 --> 00:16:19,440 okay so i'm going to put this on 322 00:16:19,440 --> 00:16:22,880 in visual studio you'll do something 323 00:16:22,879 --> 00:16:26,480 target to run to be the standalone 324 00:16:26,480 --> 00:16:30,720 all we need to do is just run it build 325 00:16:29,278 --> 00:16:32,399 and run it's going to compile these four 326 00:16:30,720 --> 00:16:35,278 files it's going to compile any module 327 00:16:35,759 --> 00:16:39,199 all right here's our standard plug-in 328 00:16:37,519 --> 00:16:40,799 it's not doing anything it's just 329 00:16:39,198 --> 00:16:42,240 displaying hello world but it is 330 00:16:42,240 --> 00:16:47,360 so yeah that's it there's our basic 331 00:16:45,039 --> 00:16:51,838 plugin we're going to turn this into 332 00:16:47,360 --> 00:16:51,839 the thing i showed at the very beginning 333 00:16:53,278 --> 00:16:56,399 i wanted to add a quick note right 334 00:16:54,879 --> 00:16:57,360 before we get started writing actual 335 00:16:57,360 --> 00:17:01,278 what you need to do is go to producer 336 00:16:59,759 --> 00:17:01,759 click on this gear right now for the 337 00:17:01,759 --> 00:17:05,360 click on this gear scroll down and you 338 00:17:05,359 --> 00:17:10,639 language type to be c plus plus 339 00:17:08,480 --> 00:17:12,078 17 okay a lot of the stuff we're going 340 00:17:12,078 --> 00:17:16,959 plus plus 17. okay once you've done that 341 00:17:14,160 --> 00:17:19,759 just click save and open in ide 342 00:17:16,959 --> 00:17:20,720 all right let's start coding navigate to 343 00:17:20,720 --> 00:17:25,519 to the plugin processor.h file because 344 00:17:23,199 --> 00:17:28,160 we need to declare some variables 345 00:17:25,519 --> 00:17:30,960 audio plugins depend on parameters to 346 00:17:28,160 --> 00:17:33,200 control the various parts of the dsp 347 00:17:30,960 --> 00:17:34,960 juice uses an object called the audio 348 00:17:34,960 --> 00:17:39,759 to coordinate syncing these parameters 349 00:17:37,919 --> 00:17:41,440 with the knobs on the gui and the 350 00:17:41,440 --> 00:17:45,440 so we need one of these in our audio 351 00:17:43,119 --> 00:17:46,079 processor and it needs to be public so 352 00:17:46,079 --> 00:17:50,480 can attach all of its knobs and sliders 353 00:17:48,480 --> 00:17:51,279 and buttons and combo boxes and stuff to 354 00:17:51,279 --> 00:17:56,160 all right so let's declare one of those 355 00:17:54,480 --> 00:17:58,319 all right we need to give it a name i'm 356 00:17:58,319 --> 00:18:01,839 and then we need to make sure that we 357 00:18:01,839 --> 00:18:05,279 not parameter not parentheses when we 358 00:18:05,279 --> 00:18:08,720 all right uh the audio processor to 359 00:18:06,880 --> 00:18:11,200 connect to is going to be this 360 00:18:08,720 --> 00:18:12,079 audio processor we are not going to use 361 00:18:12,079 --> 00:18:16,000 an undo manager uh we're going to just 362 00:18:16,000 --> 00:18:22,240 parameters and then we need to provide 363 00:18:20,720 --> 00:18:24,960 a function here to give us a parameter 364 00:18:22,240 --> 00:18:27,038 layout so the ap vts expects us to 365 00:18:24,960 --> 00:18:29,038 provide the list of all parameters 366 00:18:27,038 --> 00:18:30,319 when it is created so we need a function 367 00:18:29,038 --> 00:18:33,200 that will provide that for us 368 00:18:30,319 --> 00:18:34,079 in the form of an ap vts parameter 369 00:18:38,079 --> 00:18:43,038 all right and we can just call it and 370 00:18:40,880 --> 00:18:44,799 actually let's make it static 371 00:18:43,038 --> 00:18:46,960 since it doesn't use any member 372 00:18:44,798 --> 00:18:51,679 variables and i have an extra colon 373 00:18:46,960 --> 00:18:53,759 okay let's declare this guy right here 374 00:18:51,679 --> 00:18:55,440 now for this project we will keep the 375 00:18:55,440 --> 00:18:58,640 we are only going to have three 376 00:18:58,640 --> 00:19:03,840 low cut high cut and peak for the low 377 00:19:02,079 --> 00:19:06,079 cut and high cut bands we will be able 378 00:19:03,839 --> 00:19:06,558 to control the frequency cutoff as well 379 00:19:06,558 --> 00:19:11,279 slope of the cut off for the peak or 380 00:19:09,599 --> 00:19:13,279 parametric band we will be able to 381 00:19:13,279 --> 00:19:17,440 the gain and the quality meaning how 382 00:19:17,440 --> 00:19:22,000 the peak is all right so we will start 383 00:19:19,679 --> 00:19:23,038 with the low cut and high cut frequency 384 00:19:23,038 --> 00:19:27,038 and juice has an audio processor 385 00:19:27,038 --> 00:19:30,240 and let me pull up the documentation for 386 00:19:30,240 --> 00:19:34,400 all right so juice has an audio 387 00:19:34,400 --> 00:19:38,320 this class is a generic interface 388 00:19:36,319 --> 00:19:40,159 towards all the different audio 389 00:19:38,319 --> 00:19:41,519 parameter formats that different plug-in 390 00:19:41,519 --> 00:19:46,960 for example audio unit on os x 391 00:19:44,720 --> 00:19:48,640 is used by apps like logic or final cut 392 00:19:48,640 --> 00:19:55,759 vst 3 on windows and osx is used 393 00:19:52,798 --> 00:19:56,319 in apps like cubase or ableton live 394 00:19:56,319 --> 00:20:02,000 or bit wig and then there's aax 395 00:19:59,759 --> 00:20:03,919 for pro tools okay now the audio 396 00:20:02,000 --> 00:20:05,359 processor parameter class has several 397 00:20:05,359 --> 00:20:09,599 that represent things like sliders and 398 00:20:09,599 --> 00:20:14,319 and for our needs the audio parameter 399 00:20:12,558 --> 00:20:16,000 flow type is used to represent 400 00:20:14,319 --> 00:20:17,519 parameters that should be represented on 401 00:20:17,519 --> 00:20:20,960 of some kind so we want our frequency 402 00:20:20,960 --> 00:20:24,640 over a wide range so we are going to use 403 00:20:27,679 --> 00:20:33,038 our let's declare one of these 404 00:20:31,519 --> 00:20:34,400 and i hope the font is big enough for 405 00:20:33,038 --> 00:20:36,640 you to be able to see what's going on 406 00:20:34,400 --> 00:20:39,919 we're going to return our layout 407 00:20:36,640 --> 00:20:43,038 and now we can now we can add 408 00:20:39,919 --> 00:20:46,080 um an audio parameter float to this so 409 00:20:46,079 --> 00:20:49,599 add and these things want unique 410 00:20:47,759 --> 00:20:50,960 pointers so we'll use uh make unique for 411 00:20:50,960 --> 00:20:59,679 make unique and we want a juice 412 00:20:54,079 --> 00:21:01,519 audio parameter float we want that guy 413 00:20:59,679 --> 00:21:03,280 all right the name of this is going to 414 00:21:03,279 --> 00:21:06,319 freak the parameter name will also be 415 00:21:06,319 --> 00:21:11,038 cut freak um the normalizable range is 416 00:21:11,038 --> 00:21:16,079 now the human ear has a range of roughly 417 00:21:14,079 --> 00:21:17,599 you can pick up sounds from 20 hertz to 418 00:21:17,599 --> 00:21:21,839 so that will define the range for our 419 00:21:19,440 --> 00:21:25,279 parameter let's uh create one of these 420 00:21:21,839 --> 00:21:26,240 oops normalizable range here's the 421 00:21:26,240 --> 00:21:29,679 that takes parameters this is the one 422 00:21:29,679 --> 00:21:32,720 uh we're going to make it use type float 423 00:21:32,720 --> 00:21:37,679 range start is going to be 20 and the 424 00:21:37,679 --> 00:21:41,440 000. now the interval value we're going 425 00:21:41,440 --> 00:21:45,759 interval value of 1 and what that means 426 00:21:43,599 --> 00:21:47,759 is that our slider will change the 427 00:21:47,759 --> 00:21:51,599 one we could use bigger steps if we 428 00:21:50,000 --> 00:21:52,159 wanted to for example we could drag the 429 00:21:52,159 --> 00:21:55,760 um if this was set to 10 then our slider 430 00:21:55,759 --> 00:21:59,679 go from like 20 to 30 to 40 to 50 every 431 00:21:59,679 --> 00:22:05,200 but as we get in the upper uh range 432 00:22:03,038 --> 00:22:06,480 of frequencies that could be helpful 433 00:22:06,480 --> 00:22:10,720 the audible effects of like 20 hertz 434 00:22:08,960 --> 00:22:12,000 versus 25 hertz like they sound like 435 00:22:12,000 --> 00:22:17,599 whereas 2000 to 2050 does not really 436 00:22:15,919 --> 00:22:20,240 sound like different notes on the piano 437 00:22:17,599 --> 00:22:21,599 so we're going to keep this at a step 438 00:22:21,599 --> 00:22:26,639 okay the skew factor now the skew 439 00:22:24,079 --> 00:22:28,798 parameter lets us change how the slider 440 00:22:26,640 --> 00:22:31,200 responds what that means is that we can 441 00:22:28,798 --> 00:22:32,558 skew the slider such that the majority 442 00:22:32,558 --> 00:22:35,918 are covering the lower part of this 443 00:22:35,919 --> 00:22:39,120 for example i'm reading my notes over 444 00:22:39,119 --> 00:22:43,119 for example i could set this skew value 445 00:22:43,119 --> 00:22:46,798 of the sliders range covers the values 446 00:22:46,798 --> 00:22:51,279 1000 hertz leaving the last 25 percent 447 00:22:51,279 --> 00:22:55,519 to cover the remaining frequencies one 448 00:22:55,519 --> 00:23:00,000 twenty thousand hertz or i could skew it 449 00:22:58,319 --> 00:23:02,158 differently so that the slider's bottom 450 00:23:02,159 --> 00:23:05,600 twenty hertz to one thousand hertz and 451 00:23:03,919 --> 00:23:07,038 the remaining ninety percent of the 452 00:23:07,038 --> 00:23:10,558 one thousand and one hertz to twenty 453 00:23:10,558 --> 00:23:13,839 and since i don't wanna be doing any 454 00:23:12,240 --> 00:23:17,599 skewing right now i'm gonna leave this 455 00:23:13,839 --> 00:23:20,558 set to one all right and then 456 00:23:17,599 --> 00:23:22,000 the last thing is that um the default 457 00:23:20,558 --> 00:23:24,079 value for this parameter now this 458 00:23:22,000 --> 00:23:25,839 is the low cut parameter so we will give 459 00:23:25,839 --> 00:23:30,959 20 hertz because that's the bottom of 460 00:23:29,200 --> 00:23:32,880 the hearing range and we don't want to 461 00:23:30,960 --> 00:23:35,679 hear this parameter do anything 462 00:23:32,880 --> 00:23:37,840 unless we actually move it all right so 463 00:23:35,679 --> 00:23:39,038 that takes care of the low-cut parameter 464 00:23:39,038 --> 00:23:45,440 plug-in processor and just show the 465 00:23:42,798 --> 00:23:47,359 plug-in plug-in thing so you can see the 466 00:23:45,440 --> 00:23:48,640 full name of this guy right here 467 00:23:47,359 --> 00:23:50,879 all right we've got our name we've got 468 00:23:48,640 --> 00:23:52,559 our parameter name and we've got our 469 00:23:52,558 --> 00:23:56,720 and this is our default value we are 470 00:23:55,119 --> 00:23:57,599 going to do the same thing with the high 471 00:23:57,599 --> 00:24:01,519 the only difference will be that we will 472 00:24:01,519 --> 00:24:05,599 000 hertz because it's at the top of the 473 00:24:04,079 --> 00:24:07,038 human hearing range and we don't want to 474 00:24:05,599 --> 00:24:09,119 hear this parameter do anything 475 00:24:07,038 --> 00:24:11,200 unless we decide to change the value so 476 00:24:11,200 --> 00:24:18,640 i'm going to change the name to high cut 477 00:24:15,038 --> 00:24:21,759 high cut and then this needs to be 20 478 00:24:18,640 --> 00:24:22,240 000. now let's do the same thing for the 479 00:24:22,240 --> 00:24:27,759 frequency we will use the same range of 480 00:24:27,759 --> 00:24:31,839 um the same step size of one and the 481 00:24:29,759 --> 00:24:33,278 same skew value of one the only 482 00:24:31,839 --> 00:24:36,879 difference is we will set the center 483 00:24:33,278 --> 00:24:40,240 frequency to a default of 750 hertz 484 00:24:36,880 --> 00:24:42,400 and let's change the name to peak 485 00:24:40,240 --> 00:24:44,159 for the peak gain we will be expressing 486 00:24:44,159 --> 00:24:47,679 and a good range of values to use here 487 00:24:47,679 --> 00:24:52,720 positive 24. a step size of 0.5 means 488 00:24:52,720 --> 00:24:56,640 back and forth it will represent a 489 00:24:56,640 --> 00:25:00,559 and we want this slider to behave in a 490 00:24:58,480 --> 00:25:01,440 linear fashion so we will use a skew of 491 00:25:01,440 --> 00:25:05,360 and we don't want this to by default add 492 00:25:05,359 --> 00:25:10,719 or cut so we're going to use a default 493 00:25:07,119 --> 00:25:12,558 value of zero so i'm going to copy this 494 00:25:10,720 --> 00:25:14,079 we're going to change the name to peak 495 00:25:14,079 --> 00:25:20,960 range is going to be negative 24.f 496 00:25:17,200 --> 00:25:24,080 with a max of 24.f uh our step size 497 00:25:30,240 --> 00:25:36,079 next the peak band's quality control 498 00:25:33,679 --> 00:25:37,679 the quality controls how tight or how 499 00:25:37,679 --> 00:25:40,880 this is kind of an abstract number and 500 00:25:40,880 --> 00:25:45,600 you can have a pretty narrow q which is 501 00:25:43,440 --> 00:25:47,919 reflected by having a high q value 502 00:25:45,599 --> 00:25:49,759 or you can have a very wide q which is 503 00:25:47,919 --> 00:25:52,799 reflected by having a very low 504 00:25:49,759 --> 00:25:53,679 q value so let's give ourselves a low 505 00:25:56,880 --> 00:26:00,720 though i'm going to copy this let's copy 506 00:26:00,720 --> 00:26:04,640 change this to quality change that's 507 00:26:04,640 --> 00:26:10,640 so we will um yeah so we're going to 508 00:26:07,839 --> 00:26:12,240 give it a low value of 0.1 and a high 509 00:26:12,240 --> 00:26:17,759 10. i'm going to use a step size of 0.05 510 00:26:15,839 --> 00:26:22,158 which means when we drag the slider 511 00:26:22,159 --> 00:26:26,159 these can be pretty granular sizes which 512 00:26:24,240 --> 00:26:26,720 means we can have a lot of control which 513 00:26:26,720 --> 00:26:30,880 and always we want a linear response so 514 00:26:30,880 --> 00:26:34,880 to one and on top of it we want to use a 515 00:26:38,079 --> 00:26:41,278 f all right for the low cut and high cut 516 00:26:41,278 --> 00:26:45,679 i want to have the ability to change the 517 00:26:45,679 --> 00:26:49,200 so i will give myself some four 518 00:26:49,200 --> 00:26:52,480 okay our cut filters are normally 519 00:26:52,480 --> 00:26:56,159 uh decibels per octaves or their 520 00:26:56,159 --> 00:26:59,278 normally expressed in decibels per 521 00:26:59,278 --> 00:27:03,599 the way the math behind the filter 522 00:27:01,599 --> 00:27:06,240 equations works ends up expressing these 523 00:27:03,599 --> 00:27:07,839 choices in multiples of 6 or 12. 524 00:27:06,240 --> 00:27:09,599 so that means we can have choices like 525 00:27:09,599 --> 00:27:14,798 24 36 so for this project we're going to 526 00:27:18,398 --> 00:27:22,158 so because we are using specific choices 527 00:27:20,159 --> 00:27:23,440 and not a range of values like with 528 00:27:23,440 --> 00:27:26,558 this means we get to use the audio 529 00:27:26,558 --> 00:27:30,079 object so i'll show you what that's like 530 00:27:30,079 --> 00:27:34,240 audio parameter choice so that's this 531 00:27:34,240 --> 00:27:38,880 this thing uh it needs a string array 532 00:27:38,880 --> 00:27:43,840 and because both the low cut and high 533 00:27:42,000 --> 00:27:45,759 cut will use the same set of choices 534 00:27:43,839 --> 00:27:47,599 i only need to create this string array 535 00:27:45,759 --> 00:27:50,398 once so we're going to do that 536 00:27:47,599 --> 00:27:50,959 first let me get rid of this line let me 537 00:27:50,960 --> 00:27:57,840 up okay so let's make our string array 538 00:27:54,640 --> 00:27:59,840 and now we're gonna do four choices and 539 00:27:57,839 --> 00:28:01,519 now we're going to construct uh 540 00:28:01,519 --> 00:28:06,879 per oct or 24 and we can do that like 541 00:28:07,679 --> 00:28:11,120 all right that should make a lot of 542 00:28:11,119 --> 00:28:15,359 so we've got i'm sorry i's first value 543 00:28:13,599 --> 00:28:16,398 is zero so we've got 12 plus zero then 544 00:28:16,398 --> 00:28:20,719 12 plus 24 12 plus 36 that gives us 12 545 00:28:20,720 --> 00:28:27,360 36 48 and then we're just sticking uh db 546 00:28:24,319 --> 00:28:28,720 per octave on the end of that string all 547 00:28:27,359 --> 00:28:30,000 right now we just need to create the 548 00:28:30,000 --> 00:28:34,480 and give it the string array of choices 549 00:28:32,159 --> 00:28:36,799 and use the default value of 0 550 00:28:34,480 --> 00:28:37,599 meaning the filter will have a default 551 00:28:37,599 --> 00:28:41,759 12 db per octave let's create that now 552 00:28:45,038 --> 00:28:51,038 choice is going to be our string array 553 00:28:47,919 --> 00:28:52,399 and our default index will be zero 554 00:28:51,038 --> 00:28:56,558 all right and we just need to duplicate 555 00:28:52,398 --> 00:28:58,879 this line for the high cut as well 556 00:28:56,558 --> 00:29:01,119 all right now we have got our parameters 557 00:28:58,880 --> 00:29:02,799 set up in our parameter layout so we 558 00:29:01,119 --> 00:29:04,879 can just return it and pass it to the 559 00:29:02,798 --> 00:29:08,720 audio processor tree value state 560 00:29:04,880 --> 00:29:11,919 constructor which we have already done 561 00:29:08,720 --> 00:29:14,798 we already did that right here all right 562 00:29:11,919 --> 00:29:17,360 now if we run the app as it is right now 563 00:29:14,798 --> 00:29:18,798 we are not going to see anything other 564 00:29:18,798 --> 00:29:23,278 and that's because we haven't added 565 00:29:23,278 --> 00:29:29,919 if i go up to the create editor function 566 00:29:29,919 --> 00:29:33,600 audio processor editor to see what our 567 00:29:33,599 --> 00:29:36,480 so let's do that we're going to comment 568 00:29:34,798 --> 00:29:37,119 that line out we're going to write 569 00:29:41,359 --> 00:29:44,639 audio processor editor and it's going to 570 00:29:44,640 --> 00:29:48,399 uh this okay so if we run it and take a 571 00:29:48,398 --> 00:29:51,759 first of all make sure you are in 572 00:29:51,759 --> 00:29:58,558 if we run it we are going to see 573 00:29:54,960 --> 00:30:00,319 some good stuff okay if we look at our 574 00:29:58,558 --> 00:30:00,960 combo boxes we can see that our slope 575 00:30:00,960 --> 00:30:04,640 show up this way there's our 12 24 36 576 00:30:04,640 --> 00:30:09,759 peak control default value of one we can 577 00:30:06,720 --> 00:30:13,038 see it goes you know zero point one 578 00:30:09,759 --> 00:30:16,000 one five two five all the way up to ten 579 00:30:13,038 --> 00:30:17,519 and then for our gain we've got twenty 580 00:30:17,519 --> 00:30:22,398 we can see that it's stepping by um half 581 00:30:22,398 --> 00:30:27,278 okay so next we will work on the signal 582 00:30:27,278 --> 00:30:32,000 that's the next step to make all these 583 00:30:28,720 --> 00:30:32,000 parameters actually do something 584 00:30:34,079 --> 00:30:37,439 all right we've got some parameters set 585 00:30:35,679 --> 00:30:38,798 up now this would be a good time to make 586 00:30:38,798 --> 00:30:41,918 you know commit what we've done so that 587 00:30:41,919 --> 00:30:45,919 what we do in the next step gets messed 588 00:30:43,599 --> 00:30:49,599 up we can always revert back to here and 589 00:30:45,919 --> 00:30:52,320 try again so added parameters 590 00:30:49,599 --> 00:30:54,079 we can see what we did we created the 591 00:30:54,079 --> 00:31:01,199 created the parameter layout then we 592 00:30:57,599 --> 00:31:03,199 added our parameters and created the 593 00:31:01,200 --> 00:31:04,319 made it give us the generic audio 594 00:31:04,319 --> 00:31:07,759 whenever we go to look at stuff and then 595 00:31:11,038 --> 00:31:17,038 and did an export for in my case os x in 596 00:31:17,038 --> 00:31:21,919 perhaps it's osx or windows um anyway 597 00:31:20,079 --> 00:31:23,599 we'll add those things stage those and 598 00:31:23,599 --> 00:31:28,079 all right so the next thing we're gonna 599 00:31:28,079 --> 00:31:33,038 now before we do that before we actually 600 00:31:30,960 --> 00:31:34,000 start writing dsp code we need to add 601 00:31:34,000 --> 00:31:38,880 module so go to producer click on the 602 00:31:38,880 --> 00:31:42,559 then click the plus button and you're 603 00:31:42,558 --> 00:31:49,759 global juice global juice paths 604 00:31:46,480 --> 00:31:50,880 and go to juice dsp all right once that 605 00:31:53,919 --> 00:31:57,519 and now we have access to all of the uh 606 00:32:00,640 --> 00:32:04,799 i'm going to switch back to the single 607 00:32:02,240 --> 00:32:07,839 view for right now so let me hide this 608 00:32:04,798 --> 00:32:10,079 and then go back to pluginprocessor.h 609 00:32:07,839 --> 00:32:11,359 back to my script if you have never 610 00:32:11,359 --> 00:32:15,278 software before or used any type of 611 00:32:13,519 --> 00:32:17,038 audio software then you might not be 612 00:32:15,278 --> 00:32:18,079 familiar with the concept of audio 613 00:32:21,278 --> 00:32:25,038 so stereo means there's two channels 614 00:32:25,038 --> 00:32:30,000 now each of the signal processing 615 00:32:30,000 --> 00:32:35,679 is set up to process mono audio 616 00:32:33,519 --> 00:32:36,880 unless it's declared as stereo in the 617 00:32:36,880 --> 00:32:40,000 so what that means is that it's only 618 00:32:38,398 --> 00:32:40,639 going to process a single channel of 619 00:32:40,640 --> 00:32:44,799 and since this plugin is going to be 620 00:32:44,798 --> 00:32:48,720 we need to duplicate all of the stuff we 621 00:32:48,720 --> 00:32:54,839 and the dsp namespace uses a lot 622 00:32:52,319 --> 00:32:57,439 of template meta programming and nested 623 00:32:54,839 --> 00:32:59,359 namespaces so let's help ourselves out 624 00:32:57,440 --> 00:33:01,600 let's create some type aliases to 625 00:32:59,359 --> 00:33:03,519 eliminate a lot of those namespace and 626 00:33:03,519 --> 00:33:07,440 first thing we're going to create is a 627 00:33:05,839 --> 00:33:09,359 filter alias we're going to be 628 00:33:07,440 --> 00:33:11,840 processing floats and not doubles in 629 00:33:12,960 --> 00:33:16,798 that's our first alias now i said before 630 00:33:16,798 --> 00:33:20,720 set the slope of our cut filters to be 631 00:33:20,720 --> 00:33:27,200 each of the filter types on in the iir 632 00:33:24,000 --> 00:33:28,960 filter class has a response of 12 db per 633 00:33:27,200 --> 00:33:30,720 octave when it is configured as a low 634 00:33:30,720 --> 00:33:37,038 so if we want to have a chain with a 635 00:33:33,839 --> 00:33:38,959 response of 48 decibels per octave 636 00:33:37,038 --> 00:33:40,398 we are going to need four of those 637 00:33:40,398 --> 00:33:46,239 central concept of the dsp namespace in 638 00:33:43,278 --> 00:33:48,640 the juice framework is to define a chain 639 00:33:46,240 --> 00:33:50,000 and then pass in a processing context 640 00:33:50,000 --> 00:33:54,480 pass in a processing context which will 641 00:33:52,159 --> 00:33:56,000 run through each element of the chain 642 00:33:56,000 --> 00:34:01,278 so we can put four of these filters 643 00:33:59,038 --> 00:34:03,519 in a processor chain which will allow us 644 00:34:03,519 --> 00:34:07,839 and have it process all of the audio 645 00:34:05,679 --> 00:34:13,119 automatically so let's do that 646 00:34:07,839 --> 00:34:15,759 using cut filter equals so third chain 647 00:34:13,119 --> 00:34:16,879 and then this is where we do one filter 648 00:34:20,079 --> 00:34:24,159 i mentioned earlier if you configure the 649 00:34:22,159 --> 00:34:27,679 filter as low pass or high pass 650 00:34:24,159 --> 00:34:30,240 it will have a 12 db per octave slope 651 00:34:27,679 --> 00:34:31,838 we can also configure that filter to 652 00:34:31,838 --> 00:34:36,878 shelf or notch or band pass or all pass 653 00:34:36,878 --> 00:34:40,159 this means we can use one of these 654 00:34:40,159 --> 00:34:44,159 parametric filter so now that we have 655 00:34:42,719 --> 00:34:45,598 the peak filter and the cut filters 656 00:34:45,599 --> 00:34:49,039 we can define a chain to represent the 657 00:34:49,039 --> 00:34:56,719 mono signal path so we'll do that using 658 00:34:56,719 --> 00:35:03,679 processor chain and we will do a 659 00:35:00,079 --> 00:35:06,480 cut filter then a normal filter and then 660 00:35:06,719 --> 00:35:10,078 now we need two instances of this mono 661 00:35:13,440 --> 00:35:17,920 to have access to the filter instances 662 00:35:15,679 --> 00:35:20,399 in order to adjust their cutoff 663 00:35:17,920 --> 00:35:21,920 gain quality or slope so let's declare 664 00:35:21,920 --> 00:35:29,358 mono chain we got the left channel 665 00:35:29,358 --> 00:35:33,598 now before we can use our um our filter 666 00:35:33,599 --> 00:35:39,920 so let's go over to our prepare to play 667 00:35:36,639 --> 00:35:41,118 and do that we must prepare our filters 668 00:35:41,119 --> 00:35:44,559 and we do this by passing a process spec 669 00:35:44,559 --> 00:35:47,599 to the chains which will then pass it to 670 00:35:47,599 --> 00:35:50,800 in the chain so let's declare one of 671 00:35:50,800 --> 00:35:54,640 and it needs to know the maximum number 672 00:35:54,639 --> 00:35:59,598 process at one time it needs to know the 673 00:35:59,599 --> 00:36:03,920 mono chains can only handle one channel 674 00:36:03,920 --> 00:36:08,720 and it needs to know the sample rate now 675 00:36:06,960 --> 00:36:09,280 we can pass it to each chain and they 676 00:36:09,280 --> 00:36:13,920 prepared and ready for processing 677 00:36:12,559 --> 00:36:16,078 and let's just make sure everything's 678 00:36:16,079 --> 00:36:21,359 build succeeded okay step number three 679 00:36:19,358 --> 00:36:23,119 this requires us to jump down to our 680 00:36:23,119 --> 00:36:28,240 now the processor chain requires a 681 00:36:25,838 --> 00:36:31,199 processing context to be passed 682 00:36:28,239 --> 00:36:32,799 to it in order to run the audio through 683 00:36:32,800 --> 00:36:36,480 in order to make a processing context we 684 00:36:36,480 --> 00:36:40,639 audio block instance now the process 685 00:36:40,639 --> 00:36:44,559 is called by the host and it is given a 686 00:36:44,559 --> 00:36:49,599 any number of channels so we need to 687 00:36:47,039 --> 00:36:50,239 extract the left channel and the right 688 00:36:50,239 --> 00:36:54,719 from this buffer and the left and right 689 00:36:54,719 --> 00:36:59,199 channels 0 and 1 respectively so the 690 00:36:57,519 --> 00:37:00,320 first thing we have to do is create an 691 00:37:00,320 --> 00:37:03,838 which wraps this buffer so let's do that 692 00:37:02,639 --> 00:37:04,559 first we're going to get rid of this 693 00:37:04,559 --> 00:37:10,719 right here and this is a block and it is 694 00:37:10,719 --> 00:37:14,879 now we can use the helper function in 695 00:37:12,719 --> 00:37:17,838 the audio block class to extract 696 00:37:14,880 --> 00:37:19,440 individual channels from the buffer 697 00:37:17,838 --> 00:37:20,799 which will then be wrapped inside more 698 00:37:20,800 --> 00:37:27,119 auto left block equals block dot 699 00:37:24,719 --> 00:37:28,239 get single channel block we want channel 700 00:37:28,239 --> 00:37:33,598 do the same thing for the right channel 701 00:37:33,599 --> 00:37:39,119 representing each individual channel we 702 00:37:36,000 --> 00:37:40,320 can create processing contexts that wrap 703 00:37:43,440 --> 00:37:47,519 process context replacing it's a float 704 00:37:50,559 --> 00:37:53,838 it's going to be initialized with the 705 00:37:56,880 --> 00:38:01,280 so we have our block representing an 706 00:37:58,719 --> 00:38:04,639 individual channel we have a context 707 00:38:01,280 --> 00:38:06,079 that kind of provides a wrapper around 708 00:38:06,079 --> 00:38:09,519 chain can use now we can pass these 709 00:38:09,519 --> 00:38:14,880 to our mono filter chains left chain dot 710 00:38:14,880 --> 00:38:22,240 and we want the left context and then 711 00:38:27,039 --> 00:38:30,559 it will work but we will not hear our 712 00:38:28,639 --> 00:38:32,400 filters do anything because we have not 713 00:38:32,400 --> 00:38:36,320 so this is going to be a good time to 714 00:38:34,320 --> 00:38:37,119 set up the audio plugin host so we can 715 00:38:37,119 --> 00:38:40,240 actual audio through our plugin and show 716 00:38:40,239 --> 00:38:44,639 are not doing anything but until then we 717 00:38:43,280 --> 00:38:47,839 can actually just run this and you'll 718 00:38:44,639 --> 00:38:47,838 see that it's not going to do anything 719 00:38:48,159 --> 00:38:51,039 cool so we can drag all this stuff 720 00:38:49,838 --> 00:38:54,239 there's no audio running through it so 721 00:38:51,039 --> 00:38:54,239 we're not going to hear it do anything 722 00:38:57,679 --> 00:39:00,879 okay let's get set up with audio plugin 723 00:39:00,880 --> 00:39:04,800 this is uh this comes with juice 724 00:39:04,800 --> 00:39:09,200 folder and then go to extras and now go 725 00:39:09,199 --> 00:39:13,358 and now open the you can open the juicer 726 00:39:13,358 --> 00:39:17,358 i'll do that now i've got this here it's 727 00:39:15,920 --> 00:39:18,639 just like the other thing where we have 728 00:39:17,358 --> 00:39:19,440 all our source and our modules and 729 00:39:19,440 --> 00:39:23,920 so all we're going to do is just save 730 00:39:23,920 --> 00:39:27,680 wait for this to open and now we just 731 00:39:27,679 --> 00:39:34,480 to build it all right build succeeded 732 00:39:31,358 --> 00:39:37,598 so we are done with um this project now 733 00:39:34,480 --> 00:39:38,559 that was very easy okay what we have to 734 00:39:38,559 --> 00:39:44,320 is run it outside of our project 735 00:39:42,000 --> 00:39:46,000 so go to the builds folder go to your 736 00:39:44,320 --> 00:39:47,920 particular operating system i'm going to 737 00:39:47,920 --> 00:39:54,480 go to build debug and now run it 738 00:39:52,880 --> 00:39:56,000 all right it's going to want access to 739 00:39:56,000 --> 00:40:00,079 what we have to do now is scan our 740 00:40:00,079 --> 00:40:02,880 i haven't built it yet i've only built 741 00:40:01,599 --> 00:40:03,838 the standalone version so i'm going to 742 00:40:03,838 --> 00:40:08,719 to all and i'm going to build it now 743 00:40:07,679 --> 00:40:11,358 and what it's going to do is it's going 744 00:40:08,719 --> 00:40:12,799 to create a vst3 it's going to create an 745 00:40:12,800 --> 00:40:16,160 and it's going to copy them to the 746 00:40:14,159 --> 00:40:19,519 relevant locations on the computer 747 00:40:16,159 --> 00:40:21,838 now i can go back to audio plug and host 748 00:40:19,519 --> 00:40:24,719 and now i can go to the options menu and 749 00:40:21,838 --> 00:40:26,639 edit the list of available plugins 750 00:40:24,719 --> 00:40:28,000 and now under these options button here 751 00:40:26,639 --> 00:40:28,879 this is where you're going to scan for 752 00:40:28,880 --> 00:40:34,880 if you're on mac audio unit and vst3 so 753 00:40:34,880 --> 00:40:39,119 it's going to find our simple eq because 754 00:40:39,119 --> 00:40:43,358 for audio unit do the same thing my case 755 00:40:43,358 --> 00:40:47,679 so it's going to find all of that okay 756 00:40:46,079 --> 00:40:49,519 so now that we have all of our audio 757 00:40:47,679 --> 00:40:52,239 units that are built into the computer 758 00:40:49,519 --> 00:40:52,800 and our vst3 close this available 759 00:40:52,800 --> 00:40:57,920 list window now we can right click 760 00:40:55,838 --> 00:40:59,358 right here go to the uh your company 761 00:40:57,920 --> 00:41:02,960 unless you put something else in 762 00:40:59,358 --> 00:41:05,358 and pick um vst3 for right now 763 00:41:02,960 --> 00:41:07,519 here's our plugin so those good times 764 00:41:05,358 --> 00:41:09,759 now we want to run some audio through it 765 00:41:07,519 --> 00:41:11,119 so what we want to do is right click 766 00:41:11,119 --> 00:41:14,318 x you're going to go to the apple menu 767 00:41:14,318 --> 00:41:22,000 audio file player now this little plugin 768 00:41:17,440 --> 00:41:23,440 lets us load files and play them 769 00:41:22,000 --> 00:41:25,199 yeah we can load sound files and then 770 00:41:23,440 --> 00:41:28,639 play them so we're gonna wire this 771 00:41:25,199 --> 00:41:32,318 up connected to our audio output 772 00:41:32,318 --> 00:41:35,920 hear audio running through our plugin so 773 00:41:35,920 --> 00:41:40,880 like this and drag that to our audio 774 00:41:40,880 --> 00:41:44,000 and um the other thing to do is you need 775 00:41:42,400 --> 00:41:46,639 to make sure that under your um 776 00:41:44,000 --> 00:41:48,079 options go to your audio device settings 777 00:41:46,639 --> 00:41:51,358 and this is where you're going to 778 00:41:48,079 --> 00:41:53,599 configure your audio on what you have 779 00:41:51,358 --> 00:41:55,759 now i'm going to set this up with an 780 00:41:55,760 --> 00:42:00,000 feel free to set it up with your own i'm 781 00:41:58,000 --> 00:42:02,318 just pulling something that i got from 782 00:42:00,000 --> 00:42:04,559 youtube's free audio library so that way 783 00:42:02,318 --> 00:42:06,880 this video doesn't cause any sort of 784 00:42:04,559 --> 00:42:08,400 copyright issues or anything set it up 785 00:42:08,400 --> 00:42:12,079 and then um i'm also gonna configure it 786 00:42:12,079 --> 00:42:16,400 through um so that the audio that i play 787 00:42:16,400 --> 00:42:20,880 instead of just going out of the audio 788 00:42:18,000 --> 00:42:24,000 output all right so standby for that 789 00:42:20,880 --> 00:42:24,559 okay i've got my au audio file player 790 00:42:24,559 --> 00:42:29,119 with a file that is not going to trigger 791 00:42:29,119 --> 00:42:33,760 youtube i've got it wired up to this 792 00:42:31,519 --> 00:42:35,759 simple eq that we've been working on 793 00:42:33,760 --> 00:42:37,040 and it's connected to the audio output 794 00:42:37,039 --> 00:42:39,358 i'm going to hear it through the 795 00:42:37,920 --> 00:42:45,838 speakers and you guys are going to hear 796 00:42:39,358 --> 00:42:45,838 through this video so check it out 797 00:42:49,599 --> 00:42:54,079 all right cool so uh obviously this 798 00:42:52,559 --> 00:42:59,279 stuff is not gonna do anything if i 799 00:42:59,280 --> 00:43:03,119 all right so that's the next thing we 800 00:43:00,960 --> 00:43:05,920 are going to work on we need to 801 00:43:03,119 --> 00:43:07,599 set this as what opens by default when 802 00:43:05,920 --> 00:43:10,480 we run our application so we will 803 00:43:07,599 --> 00:43:11,519 do that next a good thing to do once you 804 00:43:11,519 --> 00:43:15,119 save the setting save the filter graph 805 00:43:13,519 --> 00:43:20,480 setting i'm going to save it with 806 00:43:15,119 --> 00:43:22,880 my project that's a good place to put it 807 00:43:20,480 --> 00:43:25,280 programming put it right here and just 808 00:43:25,280 --> 00:43:29,359 okay so now i can save that now i can 809 00:43:27,199 --> 00:43:32,559 quit this and now i can configure 810 00:43:29,358 --> 00:43:35,358 the audio um configure my project to run 811 00:43:32,559 --> 00:43:36,639 audio plug and host when ever i run the 812 00:43:35,358 --> 00:43:37,838 project so i'm going to do that with a 813 00:43:37,838 --> 00:43:43,358 go here for os x you're going to go here 814 00:43:41,199 --> 00:43:44,879 you're going to go to edits the scheme 815 00:43:43,358 --> 00:43:47,279 and you're going to configure the 816 00:43:50,400 --> 00:43:55,358 and then just search for audio plugin 817 00:43:55,358 --> 00:44:00,960 and there it is choose close 818 00:43:58,800 --> 00:44:02,800 and now if we run it it's going to run 819 00:44:02,800 --> 00:44:09,280 and it should load our saved file 820 00:44:06,159 --> 00:44:11,358 there it is okay so now we can um 821 00:44:09,280 --> 00:44:12,720 now what we can do is actually debug our 822 00:44:11,358 --> 00:44:14,719 stuff so if we add a break point right 823 00:44:14,719 --> 00:44:18,719 um it's gonna pause execution right on 824 00:44:18,719 --> 00:44:23,919 so now we can actually debug our code 825 00:44:20,480 --> 00:44:25,920 and whatnot while it's running in there 826 00:44:23,920 --> 00:44:28,639 okay so we are done with audio plug and 827 00:44:30,159 --> 00:44:34,960 okay we are going to connect some 828 00:44:34,960 --> 00:44:38,800 filters but before we do that let's make 829 00:44:36,800 --> 00:44:40,318 a commit and just you know jot down what 830 00:44:40,318 --> 00:44:43,679 so we went through this and we 831 00:44:43,679 --> 00:44:47,440 and we got our chains up and running 832 00:44:50,719 --> 00:44:53,838 right so here's where we created our 833 00:44:53,838 --> 00:44:58,078 here is where we initialized our chains 834 00:44:58,079 --> 00:45:01,519 started running audio through our chains 835 00:45:01,519 --> 00:45:05,199 this is where we did this is where we 836 00:45:05,199 --> 00:45:11,519 filter graph and then here is where we 837 00:45:12,559 --> 00:45:18,880 okay with that out of the way now we can 838 00:45:16,400 --> 00:45:20,480 start configuring our filter chain so go 839 00:45:20,480 --> 00:45:27,440 h and we're going to go up to the top 840 00:45:24,159 --> 00:45:30,078 now let's start by extracting our 841 00:45:27,440 --> 00:45:31,519 parameters from the audio processor 842 00:45:31,519 --> 00:45:35,039 and a data structure representing all of 843 00:45:35,039 --> 00:45:39,759 will keep our code nice and readable so 844 00:45:39,760 --> 00:45:43,200 and now next let's write a helper 845 00:45:41,679 --> 00:45:45,519 function that will give us all of these 846 00:45:43,199 --> 00:45:49,598 parameter values in our little data 847 00:45:45,519 --> 00:45:51,039 struct all right let's go to our cpp 848 00:45:51,039 --> 00:45:53,759 now i'm going to implement this near 849 00:45:52,239 --> 00:45:55,679 where i created the parameter layout so 850 00:45:55,679 --> 00:46:00,960 so i'm going to put that right above 851 00:45:58,838 --> 00:46:04,078 this we'll just add this here 852 00:46:04,960 --> 00:46:08,480 okay now there are two ways to get 853 00:46:08,480 --> 00:46:14,880 from the ap vts the first way is to call 854 00:46:12,239 --> 00:46:15,358 get parameter and then get value like 855 00:46:19,199 --> 00:46:26,799 some parameter name like low cut freak 856 00:46:23,039 --> 00:46:27,599 and then get value but the problem with 857 00:46:27,599 --> 00:46:32,240 is that we are given a normalized value 858 00:46:30,639 --> 00:46:34,559 all of the functions that produce 859 00:46:32,239 --> 00:46:38,318 coefficients for our filter expect 860 00:46:34,559 --> 00:46:40,239 real-world values not normalized values 861 00:46:38,318 --> 00:46:42,318 so we're not going to use this one what 862 00:46:40,239 --> 00:46:47,519 we can use is a different function 863 00:46:42,318 --> 00:46:50,639 we can use apvts.getraw parameter value 864 00:46:47,519 --> 00:46:51,838 now this function returns the parameter 865 00:46:51,838 --> 00:46:57,039 care about units based on the ranges 866 00:46:55,358 --> 00:46:58,400 that we set up when we defined the 867 00:46:58,400 --> 00:47:02,480 so for instance for the low cut 868 00:46:59,920 --> 00:47:04,079 frequency it's going to return a unit 869 00:47:02,480 --> 00:47:05,519 that's within this range instead of a 870 00:47:04,079 --> 00:47:07,119 normalized value between these two 871 00:47:07,119 --> 00:47:10,400 so let's initialize all of our data 872 00:47:10,400 --> 00:47:14,480 all of the properties in our data 873 00:47:14,480 --> 00:47:19,280 these raw parameter values are atomic 874 00:47:17,679 --> 00:47:21,358 which is handy when we are interacting 875 00:47:21,358 --> 00:47:24,480 i'm not going to talk about any of the 876 00:47:22,719 --> 00:47:25,759 thread safety issues that come along 877 00:47:25,760 --> 00:47:29,119 in this particular course but you can 878 00:47:29,119 --> 00:47:33,519 in my course which teaches how to build 879 00:47:33,519 --> 00:47:37,679 and in several talks on youtube from the 880 00:47:37,679 --> 00:47:42,960 so let's go through these and start 881 00:47:49,838 --> 00:47:54,159 okay there's all the parameters getting 882 00:47:52,480 --> 00:47:57,679 them all low cut free high cut freak 883 00:47:57,760 --> 00:48:01,920 making sure we're using all the names 884 00:48:02,079 --> 00:48:06,240 let's go up to our prepare to play 885 00:48:06,239 --> 00:48:09,279 all right we're going to do this after 886 00:48:07,280 --> 00:48:11,200 we've prepared our chain now that we 887 00:48:11,199 --> 00:48:15,679 start producing coefficients using the 888 00:48:13,519 --> 00:48:18,719 statter static helper functions 889 00:48:15,679 --> 00:48:19,118 that are part of the iir coefficients 890 00:48:19,119 --> 00:48:22,720 so we can do this auto chain 891 00:48:23,119 --> 00:48:31,440 now we can do auto peak efficience 892 00:48:35,519 --> 00:48:38,880 and our center frequency which is going 893 00:48:43,119 --> 00:48:51,599 dot peak freak chain settings 894 00:48:51,599 --> 00:48:56,720 for the gain parameter this particular 895 00:48:54,400 --> 00:48:59,920 parameter expects a value in gain units 896 00:48:56,719 --> 00:49:02,558 not decibels so we must convert our 897 00:48:59,920 --> 00:49:04,559 decibel value to gain thankfully there 898 00:49:02,559 --> 00:49:05,519 is a handy helper function to do just 899 00:49:05,519 --> 00:49:12,239 so that's juice decibels class and then 900 00:49:08,559 --> 00:49:14,880 this function and we feed it 901 00:49:12,239 --> 00:49:16,000 change settings dot peak gain in 902 00:49:16,000 --> 00:49:19,440 all right let's put all that stuff on 903 00:49:17,280 --> 00:49:21,359 its own line so it's easy to look at 904 00:49:19,440 --> 00:49:23,440 now that we have our coefficients for 905 00:49:21,358 --> 00:49:25,358 the peak filter we can set our filters 906 00:49:25,358 --> 00:49:29,119 now you can access links in the 907 00:49:29,119 --> 00:49:32,160 a get function like this left chain dot 908 00:49:32,159 --> 00:49:35,358 and it's templated this function wants 909 00:49:35,358 --> 00:49:38,639 index to a particular element in the 910 00:49:38,639 --> 00:49:42,078 via its template argument so let's help 911 00:49:42,079 --> 00:49:47,839 and define an enum that represents each 912 00:49:45,519 --> 00:49:49,119 link's position in the chain and use it 913 00:49:47,838 --> 00:49:49,759 here all right so we're just going to 914 00:49:49,760 --> 00:49:53,440 the way it is let's go back to our 915 00:49:53,440 --> 00:49:57,039 we'll go down here to where our chain is 916 00:49:57,039 --> 00:50:04,079 and enum here enum chain positions 917 00:50:01,039 --> 00:50:07,039 and we're going to have low cut peak 918 00:50:04,079 --> 00:50:08,880 and high cut and this goes along with 919 00:50:07,039 --> 00:50:10,800 what we have here we have a low cut 920 00:50:08,880 --> 00:50:11,920 the peak band and then the cut area 921 00:50:10,800 --> 00:50:13,359 right here we could change this to 922 00:50:13,358 --> 00:50:17,199 okay now that we have that let's go back 923 00:50:14,960 --> 00:50:18,318 to our cpp file go back to prepare to 924 00:50:18,318 --> 00:50:22,800 all right let's use it to access our 925 00:50:21,440 --> 00:50:24,559 peak filter link and assign some 926 00:50:24,559 --> 00:50:30,559 so we're going to go chain positions 927 00:50:28,480 --> 00:50:32,639 peak like that all right that's how we 928 00:50:30,559 --> 00:50:35,040 get that particular filter link 929 00:50:32,639 --> 00:50:36,239 all right now the coefficients object 930 00:50:36,239 --> 00:50:42,159 is basically a reference counted wrapper 931 00:50:39,280 --> 00:50:42,800 around an array that is allocated on the 932 00:50:42,800 --> 00:50:47,359 now we want to copy its values over so 933 00:50:47,358 --> 00:50:51,759 and don't ask me why the juice people 934 00:50:49,358 --> 00:50:52,960 decided to design their coefficients 935 00:50:52,960 --> 00:50:56,000 allocating on the heap in an audio 936 00:50:56,000 --> 00:50:58,960 but we're going to ignore that design 937 00:50:57,519 --> 00:50:59,679 flaw for right now and just keep moving 938 00:50:59,679 --> 00:51:03,358 alright so we are going to access the 939 00:51:03,358 --> 00:51:06,880 and we're going to assign it across peak 940 00:51:06,880 --> 00:51:10,240 and now we just need to de-reference 941 00:51:08,480 --> 00:51:12,000 them and then we'll do the same thing 942 00:51:12,000 --> 00:51:15,599 okay at this point our peak filter has 943 00:51:15,599 --> 00:51:19,920 audible changes to the audio running 944 00:51:17,599 --> 00:51:22,559 through it if the gain parameter is not 945 00:51:19,920 --> 00:51:23,680 zero however any changes we make to 946 00:51:23,679 --> 00:51:29,679 will not cause audible changes because 947 00:51:26,960 --> 00:51:31,280 we are not updating the filter with new 948 00:51:31,280 --> 00:51:34,559 whenever the slider changes so let's do 949 00:51:34,559 --> 00:51:40,079 in our process block so let's go on to 950 00:51:37,119 --> 00:51:42,640 our processing process block 951 00:51:40,079 --> 00:51:43,440 and we need to do this before we run 952 00:51:43,440 --> 00:51:47,200 always update your parameters before you 953 00:51:47,199 --> 00:51:51,118 okay so let's just copy the code we 954 00:51:51,119 --> 00:51:54,720 right where we created our coefficients 955 00:51:53,119 --> 00:51:56,318 we can refactor this later let's just 956 00:51:56,318 --> 00:52:00,318 go to process block put this right after 957 00:52:00,318 --> 00:52:04,558 clear stuff happens after that put it 958 00:52:04,559 --> 00:52:08,240 okay again we can refactor this later 959 00:52:08,239 --> 00:52:12,318 the only thing you need to change is 960 00:52:09,920 --> 00:52:12,720 this guy let's fix this so we can just 961 00:52:12,719 --> 00:52:18,000 get sample rate and now if we run it and 962 00:52:16,318 --> 00:52:19,920 adjust the gain q and frequency 963 00:52:18,000 --> 00:52:21,920 sliders we will hear some audible 964 00:52:21,920 --> 00:52:25,760 okay i have run it and let's see what it 965 00:52:24,079 --> 00:52:27,039 gets see what it gets us okay we're just 966 00:52:25,760 --> 00:52:32,450 going to mess around with the peak 967 00:52:47,920 --> 00:52:54,400 okay all right it did something 968 00:52:51,920 --> 00:52:55,599 cool so you might notice that the filter 969 00:52:55,599 --> 00:52:59,119 wonky that's because our ears hear 970 00:52:59,119 --> 00:53:02,720 sorry that's because of how our ears 971 00:53:02,719 --> 00:53:06,239 frequencies work if the sound goes up 972 00:53:06,239 --> 00:53:10,000 the frequency doubles so this is an 973 00:53:08,559 --> 00:53:12,640 instance of where we want to change the 974 00:53:10,000 --> 00:53:13,838 skew parameter of our frequency slider 975 00:53:12,639 --> 00:53:16,799 let's play around with some different 976 00:53:13,838 --> 00:53:18,880 values until we find something we like 977 00:53:16,800 --> 00:53:20,000 so we go down to where our parameters 978 00:53:20,000 --> 00:53:23,280 um let's see which parameter was the 979 00:53:23,280 --> 00:53:27,280 i think it was that's step size yeah 980 00:53:26,079 --> 00:53:30,800 that's step size so it's the last 981 00:53:27,280 --> 00:53:32,960 parameter so i'm gonna just try 0.5 982 00:53:30,800 --> 00:53:34,880 for the um let's see i'm messing with 983 00:53:32,960 --> 00:53:35,760 the peak frequency so we'll do that one 984 00:53:35,760 --> 00:53:40,960 go like that let's rerun this stop 985 00:53:38,880 --> 00:53:42,559 i'm going to change it to 0.5 basically 986 00:53:40,960 --> 00:53:44,079 what it's going to do is adjust how the 987 00:54:02,719 --> 00:54:06,399 all right now this is going to be more 988 00:54:06,400 --> 00:54:11,440 messing with um actual like an actual 989 00:54:11,440 --> 00:54:14,960 that you're designing versus these um 990 00:54:14,960 --> 00:54:18,559 so either way i'm gonna keep messing 991 00:54:16,800 --> 00:54:19,680 with this and we'll see what value i end 992 00:54:19,679 --> 00:54:24,960 so something you might notice here is 993 00:54:21,199 --> 00:54:26,558 like um the range is 20 to 20 000. 994 00:54:24,960 --> 00:54:29,358 um if the slider's in the middle you 995 00:54:26,559 --> 00:54:30,319 would think that a value of 0.5 would 996 00:54:30,318 --> 00:54:35,519 10 000 hertz but we don't actually see 997 00:54:32,318 --> 00:54:36,880 that until we're way over here 998 00:54:35,519 --> 00:54:39,440 this is what i was saying before about 999 00:54:39,440 --> 00:54:43,920 based on this skew that i have right 1000 00:54:43,920 --> 00:54:50,400 the um from 20 hertz to 10 000 hertz is 1001 00:54:48,318 --> 00:54:52,159 spread out across this range and then 10 1002 00:54:52,159 --> 00:54:55,598 fits here in this little range right 1003 00:54:55,599 --> 00:54:58,640 what the skew parameter lets us deal 1004 00:54:58,639 --> 00:55:02,558 okay so something that i'm noticing when 1005 00:55:02,559 --> 00:55:08,160 really far down like 0.15 or whatever 1006 00:55:05,599 --> 00:55:09,680 is i hit the bottom of the range here 1007 00:55:08,159 --> 00:55:11,358 and it doesn't go up to the next 1008 00:55:11,358 --> 00:55:16,639 until right there so that's a big chunk 1009 00:55:16,639 --> 00:55:22,639 usable based on this skew valid 1010 00:55:20,239 --> 00:55:24,399 sku value of 0.15 so i'm going to put 1011 00:55:22,639 --> 00:55:24,960 this back to 0.25 and i'm going to use 1012 00:55:24,960 --> 00:55:30,400 every other frequency parameter okay 1013 00:55:28,159 --> 00:55:31,440 so with that said we you know added a 1014 00:55:31,440 --> 00:55:34,720 let's go ahead and make a commit this is 1015 00:55:37,760 --> 00:55:45,040 all right sorry we connected the peak 1016 00:55:45,039 --> 00:55:50,798 all right let's go ahead and commit that 1017 00:55:46,239 --> 00:55:50,798 stuff all right on to the next step 1018 00:55:53,440 --> 00:55:57,200 okay we are going to get the low cut 1019 00:55:57,199 --> 00:56:02,719 low cut parameters now if you remember 1020 00:56:00,639 --> 00:56:04,078 if we jump back over here the cut 1021 00:56:04,079 --> 00:56:10,400 their own processor chain instance 1022 00:56:10,400 --> 00:56:13,920 filters within it as i said before each 1023 00:56:13,920 --> 00:56:18,480 filters has a 12 db per octave response 1024 00:56:18,480 --> 00:56:22,240 low pass or high pass filter we are 1025 00:56:20,798 --> 00:56:24,480 going to use a helper function from the 1026 00:56:22,239 --> 00:56:25,439 juice framework that allows us to define 1027 00:56:25,440 --> 00:56:30,079 filters with custom orders and we've 1028 00:56:30,079 --> 00:56:33,280 in terms of decibels per octave but the 1029 00:56:33,280 --> 00:56:39,200 cut filters is also known as its order 1030 00:56:36,318 --> 00:56:41,119 okay also a low cut filter is also 1031 00:56:41,119 --> 00:56:45,200 likewise a high cut filter is also 1032 00:56:45,199 --> 00:56:50,318 filter so let's go take a look at the 1033 00:56:48,318 --> 00:56:51,679 helper function we're going to use let's 1034 00:56:51,679 --> 00:56:55,279 plugin processor go to the end of 1035 00:56:53,519 --> 00:56:57,199 prepare to play and we're going to 1036 00:56:55,280 --> 00:57:00,240 we're just going to call it so we can 1037 00:57:00,239 --> 00:57:03,358 all right just give us some default 1038 00:57:03,358 --> 00:57:06,719 iir high pass high order butterworth 1039 00:57:06,719 --> 00:57:09,838 okay so just jump to the definition of 1040 00:57:09,838 --> 00:57:12,078 that's going to take us to the 1041 00:57:10,639 --> 00:57:14,159 declaration but we want the actual 1042 00:57:14,159 --> 00:57:17,679 okay if we take a quick look at the 1043 00:57:17,679 --> 00:57:21,279 for example this little loop right here 1044 00:57:20,159 --> 00:57:23,358 we'll do this loop because we're going 1045 00:57:26,480 --> 00:57:30,639 if we look at the implementation you 1046 00:57:30,639 --> 00:57:38,239 iir filter coefficient object for every 1047 00:57:34,960 --> 00:57:40,400 two orders so if the order is two 1048 00:57:38,239 --> 00:57:42,078 we are only going to get one of these 1049 00:57:42,079 --> 00:57:45,839 uh this gives us a 12 db per octave cut 1050 00:57:45,838 --> 00:57:49,838 four if our order is four we are going 1051 00:57:47,599 --> 00:57:51,760 to get two sets of coefficients if our 1052 00:57:49,838 --> 00:57:52,400 order is six we will get three et cetera 1053 00:57:52,400 --> 00:57:56,160 so what we need to do is produce the 1054 00:57:54,159 --> 00:57:58,318 required number of coefficient 1055 00:57:56,159 --> 00:57:59,279 objects that are needed based on what 1056 00:57:59,280 --> 00:58:05,280 parameter is set to now remember the 1057 00:58:03,199 --> 00:58:06,318 this parameter had four choices it was 1058 00:58:06,318 --> 00:58:10,719 24 36 48 let me jump over to plugin 1059 00:58:09,119 --> 00:58:13,680 processor and go down to where 1060 00:58:10,719 --> 00:58:14,399 we created our parameters i was down 1061 00:58:17,599 --> 00:58:20,798 all right so the first choice is at 1062 00:58:20,798 --> 00:58:26,480 if our choice is 12 db per octave 1063 00:58:24,079 --> 00:58:28,318 which is index zero we want to get back 1064 00:58:28,318 --> 00:58:32,318 and to do that that means we need to 1065 00:58:32,318 --> 00:58:40,400 an order of two okay if our choice is 24 1066 00:58:37,119 --> 00:58:42,480 like if we're doing i equals one 1067 00:58:40,400 --> 00:58:43,440 we need to supply an order of four in 1068 00:58:43,440 --> 00:58:50,240 two coefficients back okay ergo 1069 00:58:50,239 --> 00:58:53,679 as in i'm talking about this parameter 1070 00:58:57,599 --> 00:59:02,880 6 and 8 okay so we need to add 1 to our 1071 00:59:02,880 --> 00:59:08,798 and then multiply that by two 1072 00:59:06,159 --> 00:59:10,159 to get the order to use when calling 1073 00:59:10,159 --> 00:59:13,759 okay once we have done that we can get 1074 00:59:11,599 --> 00:59:14,720 our array of coefficients from this 1075 00:59:14,719 --> 00:59:18,558 okay i'm going to say that one more time 1076 00:59:16,318 --> 00:59:22,480 our possible orders are 2 4 6 1077 00:59:18,559 --> 00:59:22,720 8. so remember our slope choices are 0 1 1078 00:59:22,719 --> 00:59:29,039 3 so what we have to do is add 1 1079 00:59:26,000 --> 00:59:29,679 to our slope choice and multiply that 1080 00:59:29,679 --> 00:59:33,279 2 in order to get the correct order to 1081 00:59:33,280 --> 00:59:37,200 to this function okay let's do that now 1082 00:59:37,199 --> 00:59:40,399 go back up to the prepare to play 1083 00:59:40,400 --> 00:59:43,760 and we're going to just get rid of this 1084 00:59:43,760 --> 00:59:49,359 auto cut coefficients equals and now 1085 00:59:49,358 --> 00:59:52,960 all right our frequency is going to be 1086 00:59:52,960 --> 00:59:56,480 low cut frequency sample rate sample 1087 00:59:56,480 --> 01:00:00,159 and our order is going to be remember 1088 01:00:00,159 --> 01:00:06,480 chain settings our slope for the low cut 1089 01:00:03,838 --> 01:00:07,759 we're going to add 1 to it we're going 1090 01:00:11,599 --> 01:00:16,079 all right let's put these all in their 1091 01:00:13,280 --> 01:00:18,160 their own line so it's easy to look at 1092 01:00:16,079 --> 01:00:19,280 okay chain settings remember this is a 1093 01:00:19,280 --> 01:00:23,040 zero one two and three so we're gonna 1094 01:00:21,280 --> 01:00:24,079 add one to that that's gonna give us one 1095 01:00:23,039 --> 01:00:25,519 two three four and then we're gonna 1096 01:00:24,079 --> 01:00:27,039 double it which is gonna give us two 1097 01:00:30,079 --> 01:00:33,200 let's start by initializing the left 1098 01:00:33,199 --> 01:00:36,960 all right so let's get the low cut 1099 01:00:36,960 --> 01:00:44,639 so we'll just do auto left low cut 1100 01:00:40,719 --> 01:00:47,519 we're gonna get it chain position whoops 1101 01:00:44,639 --> 01:00:48,159 all right now first we are going to 1102 01:00:51,519 --> 01:00:55,759 all right remember there are four 1103 01:00:52,719 --> 01:00:59,039 positions so we need to bypass all four 1104 01:00:55,760 --> 01:00:59,839 right now it would be ideal to be able 1105 01:00:59,838 --> 01:01:04,078 based on the slope setting so to make 1106 01:01:02,400 --> 01:01:06,880 the code more readable let's define 1107 01:01:04,079 --> 01:01:07,280 another enum that represents our slope 1108 01:01:07,280 --> 01:01:11,680 since enums decay to integers which is 1109 01:01:09,838 --> 01:01:12,880 what our choice parameter is expressed 1110 01:01:12,880 --> 01:01:16,880 let's go to the top of our plugin 1111 01:01:16,880 --> 01:01:20,880 we're going to define an enum up here so 1112 01:01:20,880 --> 01:01:24,960 slope amount in the enums member names 1113 01:01:24,960 --> 01:01:29,440 use numbers to begin identifiers in c 1114 01:01:27,838 --> 01:01:30,639 plus i'm going to put slope before that 1115 01:01:40,798 --> 01:01:46,798 all right now let's um let's adjust what 1116 01:01:43,679 --> 01:01:48,480 the filter chain slopes are specified as 1117 01:01:46,798 --> 01:01:50,159 let's change this guy right here so 1118 01:01:48,480 --> 01:01:51,920 instead of it being low cut slope 1119 01:01:50,159 --> 01:01:54,879 expressed with an integer let's express 1120 01:01:54,880 --> 01:01:58,480 all right we'll do the same thing for 1121 01:01:56,000 --> 01:01:59,119 the high cut okay now if we try to 1122 01:02:02,159 --> 01:02:06,078 let's fix this error next all right what 1123 01:02:06,079 --> 01:02:10,160 change the data type right here to uh 1124 01:02:08,559 --> 01:02:13,119 we're just going to cast this to that 1125 01:02:13,119 --> 01:02:18,240 do the same thing for this line and try 1126 01:02:21,440 --> 01:02:25,358 now we have our enum which gives us you 1127 01:02:23,920 --> 01:02:25,680 know specific types that we can switch 1128 01:02:25,679 --> 01:02:28,798 let's go back to our prepare to play 1129 01:02:28,798 --> 01:02:34,239 oops all right that's down here now we 1130 01:02:34,239 --> 01:02:42,719 switch and we want to do uh chain 1131 01:02:43,119 --> 01:02:47,760 i'm too lazy to type the switch types so 1132 01:02:45,199 --> 01:02:51,759 i'm going to let the autocomplete do it 1133 01:02:47,760 --> 01:02:51,760 all right add missing switch cases yes 1134 01:02:52,079 --> 01:02:56,559 okay now we just need to fill them in if 1135 01:02:56,559 --> 01:03:02,079 meaning a 12 db per octave slope 1136 01:02:59,920 --> 01:03:03,200 the helper function will return an array 1137 01:03:03,199 --> 01:03:08,078 coefficient object only so we will 1138 01:03:05,920 --> 01:03:10,000 assign those coefficients to the 1139 01:03:08,079 --> 01:03:11,359 first filter in the cut filter chain and 1140 01:03:11,358 --> 01:03:15,038 bypassing that filter chain so we will 1141 01:03:15,039 --> 01:03:21,440 um let's see left low cut dot get 1142 01:03:18,880 --> 01:03:22,720 first filter in that chain we want the 1143 01:03:21,440 --> 01:03:23,119 coefficients and we're going to assign 1144 01:03:23,119 --> 01:03:29,680 our cut coefficients the first element 1145 01:03:26,639 --> 01:03:30,000 now remember we have to dereference and 1146 01:03:33,519 --> 01:03:38,400 this particular chain all right 1147 01:03:36,719 --> 01:03:40,159 now for the next choice we will do the 1148 01:03:38,400 --> 01:03:40,720 same thing that we did when the slope 1149 01:03:40,719 --> 01:03:44,000 however the helper function will return 1150 01:03:44,000 --> 01:03:47,519 coefficient objects so we will find we 1151 01:03:47,519 --> 01:03:52,318 to the first two links in the filter 1152 01:03:52,318 --> 01:03:56,239 all right i'm just going to copy this 1153 01:03:56,239 --> 01:04:00,318 and change these to one all right we're 1154 01:03:59,119 --> 01:04:02,559 going to repeat for the third 1155 01:04:00,318 --> 01:04:06,000 and fourth option when the slope is 36 1156 01:04:06,000 --> 01:04:09,358 all right now that's obviously not you 1157 01:04:07,920 --> 01:04:10,798 know optimized there's a lot of 1158 01:04:09,358 --> 01:04:12,400 repetition in the code going on we'll 1159 01:04:12,400 --> 01:04:16,079 okay all we have to do now is repeat 1160 01:04:16,079 --> 01:04:19,680 and our slider and combo box for the low 1161 01:04:19,679 --> 01:04:27,358 will configure the filter properly 1162 01:04:23,599 --> 01:04:30,798 so we are going to get the right chain 1163 01:04:27,358 --> 01:04:32,798 and let's just copy all of this 1164 01:04:30,798 --> 01:04:35,440 and replace all of the left low cut with 1165 01:04:37,679 --> 01:04:41,358 okay all right as i said there is a lot 1166 01:04:41,358 --> 01:04:44,960 and it could do with some refactoring 1167 01:04:42,880 --> 01:04:47,039 but let's not do that just yet okay 1168 01:04:44,960 --> 01:04:48,798 first let's copy this chunk of code to 1169 01:04:47,039 --> 01:04:50,079 our process block just like we did with 1170 01:04:50,079 --> 01:04:53,680 and we should be able to run it and test 1171 01:04:51,679 --> 01:04:56,480 the sliders in the combo box and hear 1172 01:04:53,679 --> 01:04:58,399 it adjusting the low cut filter all 1173 01:04:58,400 --> 01:05:05,039 grab cut coefficients like that 1174 01:05:02,480 --> 01:05:07,760 jump to process block we're going to put 1175 01:05:05,039 --> 01:05:10,400 this after our peak coefficient stuff 1176 01:05:07,760 --> 01:05:10,960 right like that okay the only difference 1177 01:05:10,960 --> 01:05:14,000 sample rate we need to call get sample 1178 01:05:17,199 --> 01:05:20,960 okay we should be able to adjust the low 1179 01:05:19,039 --> 01:05:24,319 cut frequency as well as the low cut 1180 01:05:20,960 --> 01:05:24,318 slope and here it make a difference 1181 01:05:28,079 --> 01:05:31,280 all right let's adjust the slope 1182 01:05:34,639 --> 01:05:39,679 i'm going to put it around 2500 put it 1183 01:05:39,679 --> 01:05:42,798 we can definitely hear there's more 1184 01:05:42,798 --> 01:05:47,759 a more gentle slope versus a steeper 1185 01:05:50,880 --> 01:05:55,200 okay let's uh make a commit since we did 1186 01:05:55,199 --> 01:05:58,639 we added the uh let's see we connected 1187 01:05:58,639 --> 01:06:05,759 low cut parameters to the filter 1188 01:06:02,960 --> 01:06:07,599 we made our enum we adjusted our chain 1189 01:06:07,599 --> 01:06:12,640 and we added our coefficients and we got 1190 01:06:12,639 --> 01:06:16,879 um working with the filter and then we 1191 01:06:14,719 --> 01:06:17,439 also updated how we pulled them from the 1192 01:06:17,440 --> 01:06:23,838 from the process block or from the apvts 1193 01:06:21,440 --> 01:06:25,280 all right cool on to the next thing we 1194 01:06:29,679 --> 01:06:32,960 okay let's start the refactor with 1195 01:06:31,358 --> 01:06:33,920 cleaning up the stuff that configures 1196 01:06:33,920 --> 01:06:38,559 let's just do a uh a function here at 1197 01:06:38,559 --> 01:06:41,599 all right we're going to update the peak 1198 01:06:39,760 --> 01:06:43,839 filter with the change settings 1199 01:06:41,599 --> 01:06:44,960 i'm going to implement this beneath 1200 01:06:50,639 --> 01:06:56,078 implementation from the process block 1201 01:06:52,639 --> 01:06:57,759 paste it here replace it in the process 1202 01:06:56,079 --> 01:06:59,440 block and then do the same thing in 1203 01:06:59,440 --> 01:07:03,358 i'm just gonna copy this stuff paste it 1204 01:07:03,358 --> 01:07:09,679 and now i'm gonna call this i'm gonna do 1205 01:07:06,480 --> 01:07:11,679 the same thing in prepare to play 1206 01:07:09,679 --> 01:07:13,679 very easy now let's add a helper 1207 01:07:11,679 --> 01:07:15,440 function since we will be updating lots 1208 01:07:13,679 --> 01:07:16,159 of coefficients like we are updating 1209 01:07:16,159 --> 01:07:22,558 here we're updating them here here 1210 01:07:19,440 --> 01:07:23,440 here here okay so let's go back to our 1211 01:07:23,440 --> 01:07:29,358 and let's do that here now i'm not sure 1212 01:07:26,400 --> 01:07:32,480 of the exact type that the dsp iir 1213 01:07:29,358 --> 01:07:34,159 filter class uses for its coefficients 1214 01:07:32,480 --> 01:07:36,079 if we take a look over here it uses this 1215 01:07:34,159 --> 01:07:37,279 thing which is an alias to whatever this 1216 01:07:37,280 --> 01:07:41,760 but we can make an alias to that alias 1217 01:07:41,760 --> 01:07:45,920 and now it's very easy to declare this 1218 01:07:44,559 --> 01:07:46,798 helper function that will update those 1219 01:07:46,798 --> 01:07:50,719 now it doesn't use any member variables 1220 01:07:48,639 --> 01:07:52,719 so it could be a free function or it 1221 01:07:50,719 --> 01:07:54,239 could be a static member variable 1222 01:07:52,719 --> 01:07:56,078 a static member function so i'm going to 1223 01:07:56,079 --> 01:07:58,798 particular instance because i'm already 1224 01:07:57,760 --> 01:08:01,440 right here i don't want to have to 1225 01:07:58,798 --> 01:08:02,960 scroll up to make a free function 1226 01:08:01,440 --> 01:08:06,000 all right and let's go implement that 1227 01:08:02,960 --> 01:08:10,000 below where we implemented our 1228 01:08:06,000 --> 01:08:12,239 update peak code okay remember they're 1229 01:08:10,000 --> 01:08:13,599 um reference counted objects allocated 1230 01:08:12,239 --> 01:08:16,158 on the heap so we need to de-reference 1231 01:08:13,599 --> 01:08:19,279 them to get the underlying object 1232 01:08:19,279 --> 01:08:25,359 the old ones are going to be this thing 1233 01:08:24,000 --> 01:08:27,600 the replacements are going to be this 1234 01:08:27,600 --> 01:08:32,159 we'll do the same thing for the right 1235 01:08:32,158 --> 01:08:36,238 okay let's run this and then move the 1236 01:08:34,798 --> 01:08:38,479 sliders make sure it works and if it's 1237 01:08:36,238 --> 01:08:42,399 cool then we'll delete this old code 1238 01:08:38,479 --> 01:08:43,838 and then do the low cut filter next 1239 01:08:42,399 --> 01:08:46,559 okay so we're just going to mess with 1240 01:08:51,520 --> 01:08:56,159 all right it's making changes make it 1241 01:08:56,158 --> 01:08:59,439 give it a little sleepy heat 1242 01:09:03,198 --> 01:09:07,759 cool all right let's clean this up and 1243 01:09:07,759 --> 01:09:11,759 let's build just to make sure that what 1244 01:09:11,759 --> 01:09:17,520 all right let's make a commit all right 1245 01:09:15,520 --> 01:09:19,040 here we go commit that stage all this 1246 01:09:19,039 --> 01:09:24,079 boom okay we can refactor how the low 1247 01:09:21,359 --> 01:09:26,159 cut filter gets configured next and then 1248 01:09:24,079 --> 01:09:27,600 we can use that same code to configure 1249 01:09:27,600 --> 01:09:30,640 let's refactor how the low cut filter is 1250 01:09:30,640 --> 01:09:33,679 so we'll be able to use this later for 1251 01:09:33,679 --> 01:09:36,880 now i'm not sure what type names to use 1252 01:09:36,880 --> 01:09:40,239 so i'm going to use a templated function 1253 01:09:38,319 --> 01:09:43,359 so let's go to our header file 1254 01:09:40,238 --> 01:09:46,798 and put this down here template type 1255 01:09:46,798 --> 01:09:51,759 void update cut filter now a trick one 1256 01:09:50,000 --> 01:09:53,600 refactoring something like this is to 1257 01:09:51,759 --> 01:09:55,039 use the same names you were using in the 1258 01:09:55,039 --> 01:09:59,198 so i'm going to use uh if we go take a 1259 01:09:59,198 --> 01:10:02,238 i'm going to use the same names here 1260 01:10:00,479 --> 01:10:06,000 where i've got cut coefficients 1261 01:10:02,238 --> 01:10:07,439 and then left low cut and then 1262 01:10:06,000 --> 01:10:09,439 low cut slope i'm going to use those 1263 01:10:09,439 --> 01:10:13,359 okay so we're going to do a chain type 1264 01:10:13,359 --> 01:10:18,639 left low cut i'm going to use a 1265 01:10:18,640 --> 01:10:25,119 cut coefficients and then i've got my 1266 01:10:21,679 --> 01:10:27,920 chain settings const chain settings 1267 01:10:25,119 --> 01:10:28,719 chain settings all right so let's copy 1268 01:10:28,719 --> 01:10:32,560 from process block first and call it in 1269 01:10:32,560 --> 01:10:36,080 and then comment and comment out the old 1270 01:10:34,079 --> 01:10:37,359 stuff and we will fix any errors along 1271 01:10:37,359 --> 01:10:42,000 plug-in processor we're going to grab 1272 01:10:42,000 --> 01:10:48,719 and then all of this code right here 1273 01:10:45,439 --> 01:10:51,759 and now let's comment it out and 1274 01:10:48,719 --> 01:10:53,119 call our function all right we want to 1275 01:10:53,119 --> 01:10:59,279 uh left low cut let me call this 1276 01:10:57,439 --> 01:11:00,479 after this point so i still need this 1277 01:11:00,479 --> 01:11:05,039 all right so let's see and i still need 1278 01:11:05,039 --> 01:11:08,399 okay cut filter we're going to call it 1279 01:11:06,479 --> 01:11:09,678 with left low cut we're going to call it 1280 01:11:09,679 --> 01:11:14,480 and our chain settings let's uh give 1281 01:11:12,560 --> 01:11:17,520 that a quick build just to make sure 1282 01:11:14,479 --> 01:11:18,639 that that works as expected all right we 1283 01:11:18,640 --> 01:11:23,119 errors going on here oh yes okay so 1284 01:11:22,000 --> 01:11:23,920 we're not passing this and we're not 1285 01:11:23,920 --> 01:11:27,279 so comment that out and that should be 1286 01:11:27,279 --> 01:11:31,519 so we need to add some template keywords 1287 01:11:31,520 --> 01:11:36,159 and that also needs to go here 1288 01:11:35,119 --> 01:11:38,479 in front of these since these are 1289 01:11:36,158 --> 01:11:41,119 template functions we have to express 1290 01:11:38,479 --> 01:11:41,759 we have to explicitly declare that they 1291 01:11:41,760 --> 01:11:45,360 templated like this it's one of the more 1292 01:11:45,359 --> 01:11:50,880 uh c plus plus rules all right 1293 01:11:48,560 --> 01:11:52,960 okay cool build succeeded all right the 1294 01:11:50,880 --> 01:11:54,960 left cut filter is configured so we can 1295 01:11:54,960 --> 01:11:58,560 with our helper function now so we just 1296 01:11:58,560 --> 01:12:02,480 comment out all of this code call our 1297 01:12:02,479 --> 01:12:06,959 and use the right low cut we'll do a 1298 01:12:06,960 --> 01:12:11,119 build succeeded all right cool now we 1299 01:12:11,119 --> 01:12:14,479 chain settings object we're only using 1300 01:12:14,479 --> 01:12:18,319 so let's go back and change our switch 1301 01:12:16,640 --> 01:12:19,119 statement okay we're going to get rid of 1302 01:12:19,119 --> 01:12:21,920 and we're going to change our parameter 1303 01:12:20,238 --> 01:12:23,678 so we're going to get rid of this we're 1304 01:12:27,039 --> 01:12:31,359 slope and now we can change this line to 1305 01:12:31,359 --> 01:12:35,599 low cut slope let's build it we should 1306 01:12:35,600 --> 01:12:38,719 because we need to change what we're 1307 01:12:36,960 --> 01:12:39,600 calling it with this is where we need to 1308 01:12:39,600 --> 01:12:44,719 low cut slope and then on the next one 1309 01:12:42,719 --> 01:12:47,520 as well all right and if we build it we 1310 01:12:47,520 --> 01:12:51,199 okay cool no errors so let's revise 1311 01:12:51,198 --> 01:12:55,759 let's go up here to prepare to play and 1312 01:12:53,679 --> 01:12:57,679 we need our coefficients our left 1313 01:12:55,760 --> 01:12:59,199 low cut as well as our right low cut so 1314 01:13:03,119 --> 01:13:06,640 and now let's call uh we'll get rid of 1315 01:13:06,640 --> 01:13:09,840 and now we can call our code we can call 1316 01:13:09,840 --> 01:13:14,480 function we'll start with the left low 1317 01:13:14,479 --> 01:13:19,039 update cut filter with the left low cut 1318 01:13:19,039 --> 01:13:24,158 and our cut coefficients and our left 1319 01:13:22,158 --> 01:13:25,359 low cut uh this is where we need our 1320 01:13:25,359 --> 01:13:30,479 dot um low cut slope and then do the 1321 01:13:28,640 --> 01:13:31,199 same thing for the high cut or for the 1322 01:13:31,198 --> 01:13:37,039 low cut our slider and combo box 1323 01:13:34,560 --> 01:13:37,600 for the low cut filter should configure 1324 01:13:37,600 --> 01:13:41,520 uh dsp filter properly all right let's 1325 01:13:41,520 --> 01:13:44,640 and if it's cool we will delete all this 1326 01:13:44,640 --> 01:13:47,679 do commit okay let's run it and see what 1327 01:13:47,679 --> 01:13:51,730 okay so we are going to mess with the 1328 01:14:06,640 --> 01:14:12,239 all right i am very happy with that 1329 01:14:08,560 --> 01:14:12,239 let's clean this up and make a commit 1330 01:14:13,119 --> 01:14:17,519 all right let's clean up our header file 1331 01:14:17,679 --> 01:14:25,760 okay let's build it just to make sure 1332 01:14:22,079 --> 01:14:28,960 all right looking good updated 1333 01:14:28,960 --> 01:14:35,039 configuration load code filter 1334 01:14:32,158 --> 01:14:37,039 configuration all right this is where we 1335 01:14:37,039 --> 01:14:40,238 this is where we deleted our helper our 1336 01:14:40,238 --> 01:14:45,039 and now call the updated stuff 1337 01:14:47,600 --> 01:14:51,920 now this is obviously very verbose so 1338 01:14:51,920 --> 01:14:57,359 we're going to use a special trick just 1339 01:14:57,359 --> 01:15:00,399 if we reverse the switch order we can 1340 01:15:00,399 --> 01:15:06,000 case path uh we can leverage case 1341 01:15:03,439 --> 01:15:07,519 pass-through to eliminate a ton of code 1342 01:15:07,520 --> 01:15:11,600 so i'm going to do that first all right 1343 01:15:09,840 --> 01:15:15,600 we're just going to put the cases in the 1344 01:15:16,800 --> 01:15:21,600 okay the way this works is like if it's 1345 01:15:21,600 --> 01:15:25,199 if it's if our slope is 48 we wanted to 1346 01:15:25,198 --> 01:15:28,799 and then we also wanted to do all of 1347 01:15:28,800 --> 01:15:32,960 instead of making it break out of the 1348 01:15:30,719 --> 01:15:35,279 switch we can just do okay if it's 48 1349 01:15:32,960 --> 01:15:36,960 do this do that one here and then and 1350 01:15:35,279 --> 01:15:39,039 then do also do the one that is required 1351 01:15:39,039 --> 01:15:42,158 we can also write a templated helper 1352 01:15:40,640 --> 01:15:43,440 function to eliminate even more 1353 01:15:43,439 --> 01:15:48,399 because we're doing this thing and yeah 1354 01:15:46,560 --> 01:15:50,000 all right so let's write that next right 1355 01:15:50,000 --> 01:15:54,000 all right so we're going to do template 1356 01:15:52,319 --> 01:15:56,079 we'll add these parameters next uh 1357 01:15:54,000 --> 01:15:57,679 void update so we're gonna need our 1358 01:15:57,679 --> 01:16:02,960 we're gonna need the coefficients 1359 01:16:01,119 --> 01:16:06,399 and then um so we're gonna need our 1360 01:16:02,960 --> 01:16:08,640 chain type and our coefficients 1361 01:16:06,399 --> 01:16:09,920 and then if you notice all of these make 1362 01:16:09,920 --> 01:16:14,560 get or set bypass and use as a parameter 1363 01:16:15,119 --> 01:16:19,679 so we are going to make this be the 1364 01:16:19,679 --> 01:16:23,119 if you didn't notice when we called this 1365 01:16:21,679 --> 01:16:24,800 function we didn't have to provide any 1366 01:16:24,800 --> 01:16:29,279 so the compiler deduced what to put here 1367 01:16:29,279 --> 01:16:34,000 leave these as the later template 1368 01:16:31,279 --> 01:16:36,639 arguments the compiler can deduce them 1369 01:16:34,000 --> 01:16:37,520 for us and we only need to provide uh 1370 01:16:37,520 --> 01:16:44,159 that index so we're gonna do that int 1371 01:16:40,560 --> 01:16:46,400 index okay now we can just do that 1372 01:16:44,158 --> 01:16:49,439 update coefficients function 1373 01:16:46,399 --> 01:16:50,799 update coefficients and our old one is 1374 01:16:50,800 --> 01:16:56,400 dot this thing right here template get 1375 01:16:57,520 --> 01:17:03,120 replacement type is going to be the 1376 01:16:59,920 --> 01:17:04,399 coefficients uh cut coefficients is that 1377 01:17:03,119 --> 01:17:05,519 the name i'm using there i'm going to 1378 01:17:08,719 --> 01:17:13,279 and the index that we use if you notice 1379 01:17:11,520 --> 01:17:14,800 it's always when it's get zero 1380 01:17:13,279 --> 01:17:17,679 we always use the zero with cut 1381 01:17:14,800 --> 01:17:20,640 coefficient index when it's one we use 1382 01:17:17,679 --> 01:17:21,840 the index one okay so whatever we put 1383 01:17:21,840 --> 01:17:25,360 our index is the same thing we're going 1384 01:17:25,359 --> 01:17:29,119 index all right how convenient is that 1385 01:17:29,119 --> 01:17:33,840 we need to set the bypass state to false 1386 01:17:33,840 --> 01:17:42,079 chain dot template set bypassed 1387 01:17:42,079 --> 01:17:47,679 cool all right now we just need to call 1388 01:17:47,679 --> 01:17:50,880 all right so remember if we're doing the 1389 01:17:50,880 --> 01:17:54,560 degree slope we want to call this 1390 01:17:56,319 --> 01:17:59,439 all right and this is being replaced by 1391 01:18:02,960 --> 01:18:06,079 this is where we want index three and 1392 01:18:06,079 --> 01:18:10,880 is left low cut and our coefficient type 1393 01:18:10,880 --> 01:18:15,039 coefficient all right let me spell that 1394 01:18:15,039 --> 01:18:19,920 all right that gets rid of these lines 1395 01:18:18,158 --> 01:18:22,960 all right we do the same thing three two 1396 01:18:31,520 --> 01:18:34,880 let's test that out make sure that works 1397 01:18:33,119 --> 01:18:38,238 if it does then we can clean this 1398 01:18:34,880 --> 01:18:41,710 up all right so we're gonna run it we're 1399 01:18:38,238 --> 01:18:45,439 gonna adjust this and adjust this 1400 01:18:45,439 --> 01:18:49,519 all right that's filtering put this on 1401 01:18:53,920 --> 01:18:57,600 and we'll change the slope and we hear 1402 01:19:07,119 --> 01:19:11,279 let's make a commit of that after we 1403 01:19:15,198 --> 01:19:18,960 all right cool is there anything in here 1404 01:19:18,960 --> 01:19:22,399 i don't think there is prepare to play 1405 01:19:30,079 --> 01:19:35,198 update cut filter code very cool 1406 01:19:33,198 --> 01:19:37,839 got some more advanced c plus plus stuff 1407 01:19:38,399 --> 01:19:42,158 all right now we can uh connect the high 1408 01:19:42,158 --> 01:19:47,238 to the um to the filters all right so 1409 01:19:47,238 --> 01:19:53,198 processor.cpp and go up to the um 1410 01:19:50,399 --> 01:19:55,439 go to the prepare to play function first 1411 01:19:58,880 --> 01:20:02,079 go back to my notes here uh we need to 1412 01:20:02,079 --> 01:20:07,519 coefficients before we dig into high cut 1413 01:20:05,679 --> 01:20:09,520 filter configuration so let's change 1414 01:20:14,158 --> 01:20:17,759 all right now that we've done that now 1415 01:20:16,319 --> 01:20:20,079 we can configure the high cut chain 1416 01:20:17,760 --> 01:20:21,119 we're going to follow the same pattern 1417 01:20:20,079 --> 01:20:22,479 uh we're going to call the helper 1418 01:20:21,119 --> 01:20:25,760 function to get coefficients and then 1419 01:20:22,479 --> 01:20:29,119 we're going to call the helper function 1420 01:20:25,760 --> 01:20:30,800 to update the filters with those 1421 01:20:30,800 --> 01:20:34,719 so we're going to do auto high cut 1422 01:20:38,560 --> 01:20:42,800 okay we want the design low pass high 1423 01:20:42,800 --> 01:20:46,079 all right same thing it's going to be 1424 01:20:46,079 --> 01:20:50,238 dot the high cut frequency same sample 1425 01:20:50,238 --> 01:20:53,279 and then our order is going to be this 1426 01:20:57,359 --> 01:21:03,599 but it's going to be the high cut slope 1427 01:21:01,119 --> 01:21:05,359 okay now we can get our left chain in 1428 01:21:14,079 --> 01:21:21,439 okay and now we can just call this uh 1429 01:21:17,439 --> 01:21:25,039 call this guy call it with left high cut 1430 01:21:25,039 --> 01:21:31,279 and then do it again for the right side 1431 01:21:29,600 --> 01:21:34,000 and then we need to use our high cut 1432 01:21:34,960 --> 01:21:40,319 and then we will do the same thing uh we 1433 01:21:37,520 --> 01:21:42,719 can obviously refactor this later 1434 01:21:40,319 --> 01:21:45,198 we can do the same thing in our process 1435 01:21:45,279 --> 01:21:48,479 process block let's just put this at the 1436 01:21:48,479 --> 01:21:53,839 filter code here and then oh we need our 1437 01:21:53,840 --> 01:21:57,119 and now uh now this is in place we can 1438 01:22:00,399 --> 01:22:04,879 all right so we're going to be testing 1439 01:22:01,520 --> 01:22:08,840 the high cut frequency and the high cut 1440 01:22:10,719 --> 01:22:14,158 all right so i'm going to set this 1441 01:22:14,158 --> 01:22:25,839 now if i change the slope i should hear 1442 01:22:15,679 --> 01:22:25,840 less and less high frequency 1443 01:22:31,198 --> 01:22:34,399 let's do a um don't repeat yourself 1444 01:22:34,399 --> 01:22:39,119 and um that'll wrap it up for the dsp 1445 01:22:39,119 --> 01:22:42,479 that was easier than probably you 1446 01:22:42,479 --> 01:22:48,238 so the first thing we are going to do is 1447 01:22:44,399 --> 01:22:50,000 go to our plugin processor dot h 1448 01:22:48,238 --> 01:22:53,119 down here let's make a function that's 1449 01:22:53,119 --> 01:22:56,639 now we need a pair of functions one for 1450 01:22:54,800 --> 01:22:57,520 the low cut and one for the high cut and 1451 01:22:57,520 --> 01:23:02,719 these will be called by the uh by this 1452 01:23:06,719 --> 01:23:12,560 all right takes care of those let's go 1453 01:23:09,840 --> 01:23:14,960 over to our plugin processor dot cpp 1454 01:23:12,560 --> 01:23:15,840 i'm going to jump to after the updates 1455 01:23:15,840 --> 01:23:20,639 function update coefficients function 1456 01:23:18,719 --> 01:23:22,639 i'm going to copy the relevant code 1457 01:23:20,639 --> 01:23:23,840 from processblock to the implementation 1458 01:23:26,960 --> 01:23:31,198 let me grab that from processblock 1459 01:23:35,520 --> 01:23:38,800 paste that here make sure we're getting 1460 01:23:37,039 --> 01:23:41,198 the coefficients and then updating both 1461 01:23:42,719 --> 01:23:46,840 we're going to do the same thing for the 1462 01:23:48,960 --> 01:23:53,760 let's go grab that code from the process 1463 01:23:53,760 --> 01:24:00,079 i cut coefficients update cut filter 1464 01:23:57,520 --> 01:24:02,159 all right now we need to implement our 1465 01:24:02,158 --> 01:24:05,359 so i'm going to do that below this 1466 01:24:05,520 --> 01:24:09,199 now i just need to get the chain 1467 01:24:09,198 --> 01:24:14,000 change settings equals get chain 1468 01:24:14,158 --> 01:24:18,719 now i can call update low cut filters 1469 01:24:29,279 --> 01:24:33,679 now we just need to replace all of that 1470 01:24:33,679 --> 01:24:37,199 with a call to that update filters 1471 01:24:37,198 --> 01:24:39,678 all right we don't need our chain 1472 01:24:38,238 --> 01:24:41,919 settings anymore we don't need any of 1473 01:24:42,319 --> 01:24:49,599 update filters okay let's do the 1474 01:24:45,840 --> 01:24:51,520 same thing in uh prepare to play 1475 01:24:49,600 --> 01:24:54,079 all right we lose all of this code which 1476 01:24:54,479 --> 01:25:00,559 all right let's run it just to make sure 1477 01:24:59,039 --> 01:25:02,719 all right we're going to adjust all the 1478 01:25:20,960 --> 01:25:27,840 is the high cut working get rid of some 1479 01:25:34,319 --> 01:25:41,840 okay high cuts working let's mess with 1480 01:25:54,319 --> 01:25:58,079 cool all right that works let's clean 1481 01:25:58,079 --> 01:26:04,800 delete that code go to our process block 1482 01:26:01,600 --> 01:26:05,760 delete all this code all right let's see 1483 01:26:04,800 --> 01:26:07,679 if there's anything else that's 1484 01:26:07,679 --> 01:26:14,480 not just those guys just those guys okay 1485 01:26:26,000 --> 01:26:29,198 so that wraps it up for the dsp side of 1486 01:26:29,198 --> 01:26:34,079 okay so that's awesome all right 1487 01:26:32,238 --> 01:26:35,839 the next stuff we get to work on is the 1488 01:26:34,079 --> 01:26:36,399 gui side of things we get to design a 1489 01:26:36,399 --> 01:26:40,479 interface and knobs and get the response 1490 01:26:40,479 --> 01:26:43,519 fft analysis showing up in the 1491 01:26:49,119 --> 01:26:52,880 okay before we start on the gui let's 1492 01:26:52,880 --> 01:26:56,480 saving and loading of our plugins 1493 01:26:56,479 --> 01:27:01,000 it's very easy to do because the plug-in 1494 01:27:04,079 --> 01:27:07,600 let me show you what that looks like all 1495 01:27:06,399 --> 01:27:09,359 right so right down here there's a 1496 01:27:09,359 --> 01:27:13,679 okay this is where all of the um 1497 01:27:11,840 --> 01:27:14,319 basically the generic values are stored 1498 01:27:14,319 --> 01:27:18,238 okay so let's go back to our plugin 1499 01:27:18,238 --> 01:27:21,678 and we're going to go to the what's the 1500 01:27:21,679 --> 01:27:26,000 get state information the state member 1501 01:27:26,000 --> 01:27:29,600 it's an instance of a juice value tree 1502 01:27:29,600 --> 01:27:33,120 to memory very easily so we can use a 1503 01:27:33,119 --> 01:27:36,960 to handle the busy work needed to write 1504 01:27:36,960 --> 01:27:41,279 state to the memory block that this 1505 01:27:39,520 --> 01:27:42,960 function has been given by the host 1506 01:27:41,279 --> 01:27:44,639 talking about this memory block right 1507 01:27:42,960 --> 01:27:46,079 here alright so we can just make a 1508 01:27:46,079 --> 01:27:49,920 take one that uh writes to a memory 1509 01:27:49,920 --> 01:27:53,359 yes we want to append to the existing 1510 01:27:53,359 --> 01:27:56,719 let's call it mls for memory output 1511 01:27:56,719 --> 01:28:02,960 now we just write it a p v t s dot 1512 01:28:02,960 --> 01:28:07,439 that's it how simple is that likewise we 1513 01:28:07,439 --> 01:28:11,519 we can restore our plug-in state from 1514 01:28:09,600 --> 01:28:12,320 memory using a value tree helper 1515 01:28:12,319 --> 01:28:16,000 the only thing we need to check for is 1516 01:28:13,760 --> 01:28:16,639 if the tree uh that was pulled from 1517 01:28:16,639 --> 01:28:20,480 is valid before we copy it to our 1518 01:28:20,479 --> 01:28:24,718 so let's use that function all right we 1519 01:28:24,719 --> 01:28:28,319 we're gonna pass it data we're gonna 1520 01:28:28,319 --> 01:28:33,679 okay once we know the tree is valid 1521 01:28:31,439 --> 01:28:36,000 then we can replace our plug-in state 1522 01:28:33,679 --> 01:28:36,719 and also update our filters with these 1523 01:28:36,719 --> 01:28:44,560 parameter values so apbts.replacestate 1524 01:28:40,960 --> 01:28:47,359 with the new one and then update filters 1525 01:28:44,560 --> 01:28:49,120 how simple is that so now if we run this 1526 01:28:49,119 --> 01:28:52,479 we should be able to tweak the 1527 01:28:52,479 --> 01:28:56,559 it will be restored oh this i changed 1528 01:28:55,198 --> 01:28:57,519 the folder name so i need to reload 1529 01:28:57,520 --> 01:29:01,040 okay so for example i'm going to change 1530 01:29:01,039 --> 01:29:05,039 to whatever that number is okay save it 1531 01:29:05,039 --> 01:29:10,519 we're going to reopen and it's no longer 1532 01:29:10,520 --> 01:29:15,360 4573 cool all right we can double click 1533 01:29:13,600 --> 01:29:18,880 to reset it back to the default value 1534 01:29:15,359 --> 01:29:22,079 our parameters are saved between loads 1535 01:29:18,880 --> 01:29:24,960 cool okay let's get back to using 1536 01:29:22,079 --> 01:29:25,519 our editor instead of the generic one so 1537 01:29:25,520 --> 01:29:28,960 uncomment this line or we're gonna 1538 01:29:27,279 --> 01:29:29,679 comment this line out and uncomment this 1539 01:29:29,679 --> 01:29:33,600 all right so now we are gonna be shown 1540 01:29:33,600 --> 01:29:37,280 um it just says hello world okay so 1541 01:29:36,079 --> 01:29:38,000 we're back to this all right so we're 1542 01:29:38,000 --> 01:29:42,158 knobs and sliders and all that kind of 1543 01:29:39,600 --> 01:29:42,880 stuff okay so the first thing that i 1544 01:29:47,119 --> 01:29:50,319 first thing i want to do is give 1545 01:29:48,719 --> 01:29:51,198 ourselves some more room so we're going 1546 01:29:51,198 --> 01:29:56,399 600 by 400. all right we're also going 1547 01:29:56,399 --> 01:30:00,960 plugin instead of the host for right now 1548 01:29:58,560 --> 01:30:03,440 okay if we run this we're going to see 1549 01:30:00,960 --> 01:30:04,639 a bigger window cool all right 1550 01:30:04,639 --> 01:30:09,520 now let's go to plugineditor.h now i 1551 01:30:07,600 --> 01:30:11,760 don't want to have to type this base 1552 01:30:09,520 --> 01:30:12,880 class initialization for every slider 1553 01:30:11,760 --> 01:30:14,400 that i'm going to make because they're 1554 01:30:12,880 --> 01:30:16,079 all going to be rotary sliders and 1555 01:30:14,399 --> 01:30:17,679 they're not going to have a text box so 1556 01:30:16,079 --> 01:30:18,000 i'm going to create a class that does 1557 01:30:18,000 --> 01:30:21,920 automatically in the constructor and 1558 01:30:19,920 --> 01:30:22,639 just use that for every slider in the 1559 01:30:22,639 --> 01:30:26,159 i'm going to put that right here 1560 01:30:28,399 --> 01:30:31,759 we're inheriting from slider and then 1561 01:30:30,319 --> 01:30:34,319 we're going to set it so that it's using 1562 01:30:31,760 --> 01:30:38,960 the rotary horizontal vertical drag 1563 01:30:34,319 --> 01:30:41,359 style and then a no text box position 1564 01:30:38,960 --> 01:30:42,158 now we need to add some sliders so let's 1565 01:30:42,158 --> 01:30:45,679 right here okay we're going to deal with 1566 01:30:45,679 --> 01:30:49,199 for right now we're just going to show 1567 01:30:47,119 --> 01:30:50,399 the frequency and gain and quality 1568 01:30:53,439 --> 01:31:00,879 and we want our peak freak slider 1569 01:31:00,880 --> 01:31:08,239 we want our peak quality slider 1570 01:31:04,639 --> 01:31:13,039 we want our low cut freak slider 1571 01:31:08,238 --> 01:31:14,319 we want our high cut freak slider 1572 01:31:13,039 --> 01:31:16,238 now when i have a bunch of components 1573 01:31:14,319 --> 01:31:17,519 that are going to be have that are going 1574 01:31:16,238 --> 01:31:20,879 to have the same thing done to them all 1575 01:31:20,960 --> 01:31:24,319 i like to add a function that's going to 1576 01:31:22,639 --> 01:31:26,079 give me all of them in a vector 1577 01:31:24,319 --> 01:31:30,880 so that way i can just iterate through 1578 01:31:26,079 --> 01:31:32,000 them easily so i'm going to do that next 1579 01:31:30,880 --> 01:31:34,159 all right now it's very easy to 1580 01:31:32,000 --> 01:31:37,760 implement let's go to plug-in editor 1581 01:31:34,158 --> 01:31:37,759 we'll put this after resized 1582 01:31:38,158 --> 01:31:44,559 and all we have to do is just return a 1583 01:31:39,600 --> 01:31:46,480 vector with um all of our components in 1584 01:31:44,560 --> 01:31:47,679 that's super easy to use we just need to 1585 01:31:47,679 --> 01:31:50,960 we call set size so we're gonna do that 1586 01:31:55,439 --> 01:31:59,839 and then we can do add and make visible 1587 01:32:00,479 --> 01:32:04,319 all right the next thing we need to do 1588 01:32:04,319 --> 01:32:08,238 now juice live constant is a very useful 1589 01:32:08,238 --> 01:32:11,839 we're going to put these right here yeah 1590 01:32:10,399 --> 01:32:12,960 when it's time to dial in specific 1591 01:32:12,960 --> 01:32:17,920 juice live constant because it basically 1592 01:32:15,279 --> 01:32:19,599 lets me adjust positions of things 1593 01:32:17,920 --> 01:32:21,440 while the editor is visible which is 1594 01:32:19,600 --> 01:32:23,199 very handy but for right now what i'm 1595 01:32:21,439 --> 01:32:23,919 going to do is reserve the top third of 1596 01:32:23,920 --> 01:32:27,119 third of the display for showing the 1597 01:32:27,119 --> 01:32:31,039 of the filter chain and then the bottom 1598 01:32:31,039 --> 01:32:33,920 it's going to be dedicated to the 1599 01:32:32,238 --> 01:32:34,559 placement of all the sliders so i'm 1600 01:32:38,158 --> 01:32:42,960 all right so the way this works is i've 1601 01:32:40,158 --> 01:32:45,039 got my bounding box for the component 1602 01:32:42,960 --> 01:32:46,800 i'm dedicating an area for the top 1603 01:32:45,039 --> 01:32:47,840 basically like i'm chopping off a 1604 01:32:47,840 --> 01:32:52,800 chopping off uh 33 of the height 1605 01:32:51,439 --> 01:32:54,479 that's going to get stored in this 1606 01:32:52,800 --> 01:32:55,360 response area now i'm going to put the 1607 01:32:55,359 --> 01:33:02,880 on the left so i'm chopping out 33 1608 01:32:59,520 --> 01:33:04,080 of the bounding box in its current form 1609 01:33:02,880 --> 01:33:05,679 that's going to go to the left and then 1610 01:33:05,679 --> 01:33:10,560 so if you remember i've got basically 1611 01:33:07,439 --> 01:33:12,799 100 this is taking up 33 percent 1612 01:33:10,560 --> 01:33:14,800 and so this is rep this bounds right now 1613 01:33:14,800 --> 01:33:18,880 so i want to take half of that which 1614 01:33:18,880 --> 01:33:23,279 that's going to be the right third of 1615 01:33:20,479 --> 01:33:25,198 the display now i just set my um 1616 01:33:23,279 --> 01:33:26,639 my low cut frequency slider and my high 1617 01:33:26,639 --> 01:33:30,079 to be in the left side and right side 1618 01:33:30,079 --> 01:33:34,079 for my peak slider i'm going to set that 1619 01:33:32,079 --> 01:33:36,399 at the top of that center column it's 1620 01:33:36,399 --> 01:33:39,519 same thing's going to happen here this 1621 01:33:43,039 --> 01:33:46,399 of two-thirds of what it used to be so 1622 01:33:46,399 --> 01:33:50,399 half of that to give us one-third for 1623 01:33:48,479 --> 01:33:51,359 the peak gain and then one third for the 1624 01:33:51,359 --> 01:33:55,039 okay so if we run this we're going to 1625 01:33:55,039 --> 01:33:58,479 or sliders or whatever we want to call 1626 01:33:58,479 --> 01:34:03,599 so here's our big old low cut slider 1627 01:34:01,600 --> 01:34:07,520 here's our high cut slider and then 1628 01:34:03,600 --> 01:34:08,880 here is our um peak frequency here's our 1629 01:34:07,520 --> 01:34:10,800 peak gain and then here's our peak 1630 01:34:08,880 --> 01:34:14,480 quality and you can see these guys are 1631 01:34:14,479 --> 01:34:21,359 of the um of their allotted space 1632 01:34:19,520 --> 01:34:23,600 all right next we're going to add these 1633 01:34:23,600 --> 01:34:27,360 all right let's go back to our header 1634 01:34:27,359 --> 01:34:30,479 over here they're just going to be 1635 01:34:29,279 --> 01:34:33,039 they're going to use the same custom 1636 01:34:30,479 --> 01:34:36,079 rotary thing these are going to be low 1637 01:34:39,439 --> 01:34:47,439 cut slope slider and we got to add them 1638 01:34:47,439 --> 01:34:52,000 and then we need to position them so 1639 01:34:50,238 --> 01:34:54,158 let's put them after our low cut 1640 01:34:54,158 --> 01:34:58,158 we are going to make this uh let's see 1641 01:34:56,880 --> 01:34:58,960 this is going to be low cut area we're 1642 01:34:58,960 --> 01:35:05,198 we're gonna cut we're gonna divide the 1643 01:35:00,800 --> 01:35:06,880 low cut uh side of things in half 1644 01:35:05,198 --> 01:35:08,238 and then we'll do the same thing uh 1645 01:35:06,880 --> 01:35:08,719 let's see this is where we're gonna do 1646 01:35:08,719 --> 01:35:17,118 cut slope slider not set bounds 1647 01:35:13,359 --> 01:35:18,719 low cut area and then for the high cut 1648 01:35:17,118 --> 01:35:21,279 we're gonna do the same thing we're 1649 01:35:21,279 --> 01:35:24,319 make sure it's that guy and now we can 1650 01:35:24,319 --> 01:35:30,880 high cut slope slider dot set bounds 1651 01:35:31,118 --> 01:35:35,599 all right so we are removing we're 1652 01:35:34,000 --> 01:35:37,039 basically removing from the top of this 1653 01:35:37,039 --> 01:35:42,639 um a a rectangle that is half 1654 01:35:40,319 --> 01:35:43,359 of its original size and giving that to 1655 01:35:43,359 --> 01:35:46,559 and then using what that leftover piece 1656 01:35:46,560 --> 01:35:50,560 to the low cut slope slider right 1657 01:35:49,600 --> 01:35:51,840 check it out we're going to run it 1658 01:35:50,560 --> 01:35:56,320 you'll see those two sliders have the 1659 01:35:51,840 --> 01:35:58,880 same size on either side all right 1660 01:35:56,319 --> 01:36:00,960 yeah these guys have the same size these 1661 01:36:00,960 --> 01:36:06,880 all right cool so though those are the 1662 01:36:04,399 --> 01:36:08,000 uh sliders they have now been positioned 1663 01:36:08,000 --> 01:36:11,279 okay the next thing we need to do is um 1664 01:36:11,279 --> 01:36:16,559 to our um to our parameters so let's 1665 01:36:25,760 --> 01:36:29,760 all right let us connect the parameters 1666 01:36:29,760 --> 01:36:38,000 let's go down to um our plugin editor.h 1667 01:36:33,920 --> 01:36:41,359 okay uh below where all of our sliders 1668 01:36:41,359 --> 01:36:45,118 attachment class which makes it very 1669 01:36:43,279 --> 01:36:46,000 easy to connect sliders to the audio 1670 01:36:46,000 --> 01:36:50,639 however the name is very long so let's 1671 01:36:48,800 --> 01:36:51,600 use a type name alias to help out with 1672 01:36:55,118 --> 01:36:59,359 and using ap vts equals that super long 1673 01:36:59,359 --> 01:37:04,479 and now we can create an attachment 1674 01:37:04,719 --> 01:37:08,000 right now we just need to declare one 1675 01:37:06,399 --> 01:37:10,479 attachment for every one of these 1676 01:37:12,319 --> 01:37:15,439 all right the next step is to initialize 1677 01:37:15,439 --> 01:37:18,839 properly so we go up to our constructor 1678 01:37:17,118 --> 01:37:21,118 and we have to initialize all of them 1679 01:37:21,118 --> 01:37:24,639 write um they take three parameters so 1680 01:37:24,639 --> 01:37:30,719 um peak freak slider attachment 1681 01:37:29,039 --> 01:37:32,399 all right it needs the audio processor 1682 01:37:30,719 --> 01:37:33,439 value tree state to use we're gonna use 1683 01:37:33,439 --> 01:37:40,479 processor abvts the parameter id 1684 01:37:37,520 --> 01:37:42,000 peak freak and if we're not quite sure 1685 01:37:40,479 --> 01:37:44,879 about that we can go back over here 1686 01:37:42,000 --> 01:37:45,760 and double check so we got low cut free 1687 01:37:45,760 --> 01:37:49,520 peak freak peak gain peak quality low 1688 01:37:49,520 --> 01:37:52,800 so the good thing about this project is 1689 01:37:50,800 --> 01:37:55,600 there are not a lot of parameters 1690 01:37:52,800 --> 01:37:56,079 um which means we can kind of get away 1691 01:37:56,079 --> 01:38:00,000 typing them like this um if our project 1692 01:38:00,000 --> 01:38:03,359 parameters in it we would want to 1693 01:38:03,359 --> 01:38:07,118 they are named um and use some kind of 1694 01:38:07,118 --> 01:38:13,759 with std map or something so that way 1695 01:38:10,719 --> 01:38:14,719 um it's impossible to spell them wrong 1696 01:38:14,719 --> 01:38:18,319 that sort of thing we can yeah just use 1697 01:38:16,639 --> 01:38:19,440 the lookup table and some kind of enum 1698 01:38:19,439 --> 01:38:24,000 index into the uh parameters okay 1699 01:38:22,719 --> 01:38:25,840 so let's connect this to the proper 1700 01:38:25,840 --> 01:38:29,119 slider all right that's one so we need 1701 01:38:29,118 --> 01:38:33,279 for all of these guys here okay that was 1702 01:38:31,920 --> 01:38:35,279 this one we need to do it for all of 1703 01:38:35,279 --> 01:38:39,840 okay once we get to this point 1704 01:38:38,319 --> 01:38:41,840 uh all we have to do is just test it and 1705 01:38:39,840 --> 01:38:43,360 see that our sliders work as expected 1706 01:38:41,840 --> 01:38:44,639 and their value is preserved when 1707 01:38:44,639 --> 01:38:47,760 or closing and reopening the app so 1708 01:38:47,760 --> 01:38:51,520 right now i'm just gonna do the 1709 01:38:51,520 --> 01:38:58,400 okay uh we're just gonna adjust this guy 1710 01:38:54,880 --> 01:39:00,159 i'm gonna close it and reopen it 1711 01:38:58,399 --> 01:39:03,519 cool that's at the same spot let's do it 1712 01:39:00,158 --> 01:39:06,879 in um uh audio plug and host 1713 01:39:03,520 --> 01:39:06,880 all right let's run some audio through 1714 01:39:13,279 --> 01:39:27,840 reopening the gui where it needs to be 1715 01:39:29,359 --> 01:39:33,198 save and click that and reopen it just 1716 01:39:36,399 --> 01:39:40,000 all right that was at 12 o'clock and now 1717 01:39:40,000 --> 01:39:44,000 db all right so that is working as 1718 01:39:44,000 --> 01:39:47,600 cool so we have successfully connected 1719 01:39:47,600 --> 01:39:51,360 uh default sliders to their parameters 1720 01:39:51,359 --> 01:39:55,439 save and load whenever we open and close 1721 01:39:55,439 --> 01:40:02,479 let's make a commit of that connected 1722 01:40:02,479 --> 01:40:05,759 all right that's where we added the 1723 01:40:03,439 --> 01:40:07,279 attachments here's where we resave 1724 01:40:07,279 --> 01:40:12,079 here is where we initialized all those 1725 01:40:14,719 --> 01:40:19,520 our next goal is to display the response 1726 01:40:19,520 --> 01:40:24,159 so to do that we need to give the editor 1727 01:40:21,520 --> 01:40:26,480 its own instance of the mono chain 1728 01:40:24,158 --> 01:40:28,479 and to do that we need to make all of 1729 01:40:26,479 --> 01:40:30,879 the stuff that makes the mono chain 1730 01:40:28,479 --> 01:40:31,919 public so we will move all of those type 1731 01:40:31,920 --> 01:40:36,560 out of the audio processor and also make 1732 01:40:34,079 --> 01:40:39,118 the chain positions enum public 1733 01:40:36,560 --> 01:40:40,480 so head on over to public to a plugin 1734 01:40:40,479 --> 01:40:44,158 we're gonna grab all this stuff we're 1735 01:40:44,158 --> 01:40:48,079 put it uh below your chain settings and 1736 01:40:48,079 --> 01:40:54,719 edom chain positions copy this guy 1737 01:40:52,079 --> 01:40:56,319 and put that here oh now we're gonna 1738 01:40:54,719 --> 01:40:58,239 have some duplicate definitions so let's 1739 01:41:06,319 --> 01:41:09,920 and we need to give ourselves an 1740 01:41:07,760 --> 01:41:10,239 instance of this we can put that right 1741 01:41:13,359 --> 01:41:16,559 all right let's just give her a little 1742 01:41:16,560 --> 01:41:19,920 make sure it's cool all right cool build 1743 01:41:19,920 --> 01:41:23,520 let's make a little commit of that gave 1744 01:41:23,520 --> 01:41:30,239 its own mono chain stage stage 1745 01:41:28,399 --> 01:41:32,000 now we're going to start drawing the uh 1746 01:41:35,520 --> 01:41:39,280 we're gonna go to the paint function and 1747 01:41:37,920 --> 01:41:40,158 that's this guy right here now the first 1748 01:41:40,158 --> 01:41:46,479 is fill it with black so get rid of this 1749 01:41:44,800 --> 01:41:48,000 actually i'm gonna we're gonna use the 1750 01:41:51,039 --> 01:41:54,079 so now we don't have to type juice colon 1751 01:41:57,118 --> 01:42:00,639 black all right we're gonna fill it with 1752 01:42:00,639 --> 01:42:04,480 um black background all right let's get 1753 01:42:04,479 --> 01:42:07,839 first we need the area that we will draw 1754 01:42:07,840 --> 01:42:13,920 auto bounds equals get local bounds 1755 01:42:11,118 --> 01:42:16,000 and our response area was this thing so 1756 01:42:16,000 --> 01:42:19,679 and then our width is something that we 1757 01:42:19,679 --> 01:42:25,279 equals response area dot get width 1758 01:42:23,198 --> 01:42:26,319 next we will need the individual chain 1759 01:42:26,319 --> 01:42:30,719 and then we will call the function get 1760 01:42:30,719 --> 01:42:34,079 for each filter in the chain so let's 1761 01:42:39,279 --> 01:42:43,039 so to use that function we are going to 1762 01:42:41,198 --> 01:42:43,759 need the sample rate we can get that 1763 01:42:43,760 --> 01:42:48,800 audio processor to use that get 1764 01:42:46,479 --> 01:42:49,919 magnitude for frequency function 1765 01:42:48,800 --> 01:42:52,320 so this is where we can do audio 1766 01:42:52,319 --> 01:42:55,519 and we are going to need a place to 1767 01:42:55,520 --> 01:42:59,440 which are returned from that function as 1768 01:42:59,439 --> 01:43:04,079 now we are computing one magnitude per 1769 01:43:02,000 --> 01:43:05,679 pixel so let's pre-allocate the space 1770 01:43:05,679 --> 01:43:09,840 now we just need to iterate through each 1771 01:43:07,520 --> 01:43:11,199 pixel and compute the magnitude at that 1772 01:43:11,198 --> 01:43:17,359 now magnitude is expressed as gain 1773 01:43:14,479 --> 01:43:19,359 units and gain units are multiplicative 1774 01:43:17,359 --> 01:43:20,639 unlike decibels which are additive so we 1775 01:43:20,639 --> 01:43:25,600 of 1. now we just need to call the 1776 01:43:23,600 --> 01:43:26,560 magnitude function for a particular 1777 01:43:26,560 --> 01:43:29,760 mapped from pixel space to frequency 1778 01:43:29,760 --> 01:43:33,039 and we will use a special helper 1779 01:43:33,039 --> 01:43:38,399 called map to log base 10. we're mapping 1780 01:43:36,479 --> 01:43:40,718 the normalized pixel number to its 1781 01:43:38,399 --> 01:43:43,359 frequency within the human hearing range 1782 01:43:40,719 --> 01:43:45,198 that looks like this our value our 1783 01:43:45,198 --> 01:43:48,479 oops let me be consistent with how i'm 1784 01:43:48,479 --> 01:43:52,959 and our minimum range is 20 and our max 1785 01:43:52,960 --> 01:43:58,719 000. all right now we just need to call 1786 01:43:56,000 --> 01:44:00,079 the magnitude function with this 1787 01:44:00,079 --> 01:44:03,279 uh what's it called get magnitude for 1788 01:44:03,279 --> 01:44:06,800 and multiply the results with our 1789 01:44:06,800 --> 01:44:09,840 okay so we just need to check if a band 1790 01:44:09,840 --> 01:44:13,119 because if the band is bypassed we're 1791 01:44:11,359 --> 01:44:17,519 not going to do that multiplication 1792 01:44:13,118 --> 01:44:19,439 so if mono chain dot is bypassed 1793 01:44:17,520 --> 01:44:21,119 all right if it's bypassed ignore it all 1794 01:44:19,439 --> 01:44:22,399 right if it's not bypassed then we're 1795 01:44:22,399 --> 01:44:26,879 times equals and here's where we do the 1796 01:44:26,880 --> 01:44:29,679 coefficients and this is where we're 1797 01:44:28,238 --> 01:44:30,959 going to call that get magnitude for 1798 01:44:30,960 --> 01:44:34,960 all right our frequency is this thing 1799 01:44:34,960 --> 01:44:39,600 and our sample rate is this thing we 1800 01:44:37,520 --> 01:44:41,280 just need to do the same thing for every 1801 01:44:39,600 --> 01:44:42,079 other filter in the low and high cut 1802 01:44:42,079 --> 01:44:46,479 all right so i'm going to do that now 1803 01:44:45,039 --> 01:44:50,079 and the thing to remember is that the 1804 01:44:46,479 --> 01:44:53,198 low cut if you remember how it's defined 1805 01:44:50,079 --> 01:44:55,198 it is defined as a its own processor 1806 01:44:53,198 --> 01:44:57,599 chain so we need to get each individual 1807 01:44:55,198 --> 01:44:59,839 element of it versus getting it from the 1808 01:44:59,840 --> 01:45:03,039 all right so i've got that for the low 1809 01:45:01,279 --> 01:45:05,279 cut so i'm just going to do that for all 1810 01:45:03,039 --> 01:45:06,639 four of the filters in the low cut 1811 01:45:05,279 --> 01:45:08,880 and then do the same thing for the high 1812 01:45:10,158 --> 01:45:13,519 all right now we just need to convert 1813 01:45:11,520 --> 01:45:15,679 this magnitude into decibels and store 1814 01:45:15,679 --> 01:45:18,800 now that we've got our magnitudes we can 1815 01:45:18,800 --> 01:45:23,199 uh vector of magnitudes into a path 1816 01:45:21,920 --> 01:45:26,079 and we can build this path from the 1817 01:45:23,198 --> 01:45:27,759 vector of decibels and then draw it okay 1818 01:45:26,079 --> 01:45:28,960 so let's do the first thing let's build 1819 01:45:28,960 --> 01:45:33,279 now we need to map our decibel value to 1820 01:45:33,279 --> 01:45:37,118 and a helper lambda will do the job we 1821 01:45:35,359 --> 01:45:38,639 could also use a free function but 1822 01:45:37,118 --> 01:45:41,679 i'm right here so i'm just going to do 1823 01:45:38,639 --> 01:45:43,440 it right here let me define some 1824 01:45:41,679 --> 01:45:45,840 maximum and minimum positions in the 1825 01:45:46,079 --> 01:45:50,238 i'm going to use jmap to map from my 1826 01:45:48,158 --> 01:45:53,759 source input which is a range of 1827 01:45:53,760 --> 01:45:56,960 and my output is where it's going to map 1828 01:45:56,960 --> 01:46:00,639 now i came up with this negative 24 and 1829 01:46:00,639 --> 01:46:07,760 the peak control can go from plus 24 to 1830 01:46:05,039 --> 01:46:10,079 negative 24. so i want my response curve 1831 01:46:07,760 --> 01:46:12,159 the window for it to have a range of 1832 01:46:12,158 --> 01:46:15,679 so that's where these figures come from 1833 01:46:15,679 --> 01:46:22,480 so let's see output min output max 1834 01:46:19,600 --> 01:46:23,760 all right now we can start a new subpass 1835 01:46:23,760 --> 01:46:28,480 with the first magnitude start new sub 1836 01:46:27,118 --> 01:46:32,000 path we're going to start it at 1837 01:46:28,479 --> 01:46:32,559 our response area dot get x this is the 1838 01:46:32,560 --> 01:46:36,639 edge of the component and the first 1839 01:46:40,079 --> 01:46:43,359 so we're going to run the first value in 1840 01:46:43,359 --> 01:46:46,799 through this map function and we're 1841 01:46:46,800 --> 01:46:50,239 to screen coordinates now we just need 1842 01:46:50,238 --> 01:46:54,879 line twos for every other every other 1843 01:46:54,880 --> 01:46:59,039 all right response curve line two and we 1844 01:46:59,039 --> 01:47:08,158 response curve uh response area 1845 01:47:04,399 --> 01:47:11,279 get x plus i and then we want to do 1846 01:47:11,279 --> 01:47:16,559 now let's give ourselves a nice 1847 01:47:13,039 --> 01:47:19,118 background border and then draw the path 1848 01:47:16,560 --> 01:47:21,920 g.draw rounded rectangle we're going to 1849 01:47:21,920 --> 01:47:25,840 it wants a float rectangle corner size 1850 01:47:24,399 --> 01:47:28,638 let's use a corner size of four 1851 01:47:25,840 --> 01:47:29,279 and a line thickness of one now we can 1852 01:47:29,279 --> 01:47:33,679 let's use a white color all right g dot 1853 01:47:33,679 --> 01:47:37,840 and now we can draw our path i'm gonna 1854 01:47:37,840 --> 01:47:42,719 stroke type of two this is gonna draw a 1855 01:47:40,880 --> 01:47:43,679 rounded rectangle with a line thickness 1856 01:47:43,679 --> 01:47:47,760 one pixel wide this is gonna draw with a 1857 01:47:45,439 --> 01:47:49,439 line thickness of two pixels wide 1858 01:47:47,760 --> 01:47:51,199 all right let's run this and let's see 1859 01:47:51,198 --> 01:47:56,319 let's open our gui all right cool we 1860 01:47:53,760 --> 01:47:58,239 have a nice flat line inside a rounded 1861 01:47:56,319 --> 01:48:00,639 rectangle right at the middle 1862 01:47:58,238 --> 01:48:04,559 okay now why aren't we seeing anything 1863 01:48:04,560 --> 01:48:08,239 this is because these sliders only 1864 01:48:06,238 --> 01:48:09,039 update the filter chain in the audio 1865 01:48:09,039 --> 01:48:12,399 we also need to make them update the 1866 01:48:10,560 --> 01:48:13,840 filter chain in the editor because it's 1867 01:48:13,840 --> 01:48:18,319 so let's do that next okay we need to do 1868 01:48:16,399 --> 01:48:19,679 that whenever the parameters change 1869 01:48:18,319 --> 01:48:22,399 all right oops i'm going to leave that 1870 01:48:22,399 --> 01:48:27,118 this opens automatically we get to see 1871 01:48:27,118 --> 01:48:31,439 all right so we are going to set up the 1872 01:48:31,439 --> 01:48:35,439 to follow the parameters next okay make 1873 01:48:35,439 --> 01:48:41,839 plugin editor dot h now the easiest way 1874 01:48:39,520 --> 01:48:43,679 to respond to parameter changes is to 1875 01:48:43,679 --> 01:48:49,039 all of them so let's do that 1876 01:48:46,880 --> 01:48:52,480 we're going to inherit from audio 1877 01:48:59,439 --> 01:49:02,719 now it says here important note this 1878 01:49:01,198 --> 01:49:04,479 will be called synchronously whenever a 1879 01:49:02,719 --> 01:49:06,319 parameter changes and many audio 1880 01:49:04,479 --> 01:49:07,839 processors will change their parameters 1881 01:49:07,840 --> 01:49:11,360 this means that this this means that not 1882 01:49:11,359 --> 01:49:14,880 handler code need to be completely 1883 01:49:13,118 --> 01:49:18,399 thread safe it's got to be very 1884 01:49:18,399 --> 01:49:21,759 okay what this means is that callbacks 1885 01:49:21,760 --> 01:49:26,239 on the audio thread most likely and this 1886 01:49:24,000 --> 01:49:28,319 means we cannot do any gui stuff 1887 01:49:26,238 --> 01:49:29,919 in any of these callbacks like update 1888 01:49:28,319 --> 01:49:33,279 the editor's filter chain here 1889 01:49:29,920 --> 01:49:36,319 and trigger a repaint but what we can do 1890 01:49:33,279 --> 01:49:36,880 is set an atomic flag that the timer can 1891 01:49:36,880 --> 01:49:39,920 and update based on that flag so that's 1892 01:49:39,920 --> 01:49:43,920 so first things first let's copy these 1893 01:49:41,599 --> 01:49:44,719 callbacks all right let's go back to our 1894 01:49:44,719 --> 01:49:48,239 all right we'll put them right here 1895 01:49:46,560 --> 01:49:49,440 they're no longer virtual because we are 1896 01:49:49,439 --> 01:49:52,559 let's mark this as override all right 1897 01:49:52,560 --> 01:49:56,159 add um let's add our timer we're going 1898 01:49:54,960 --> 01:49:57,520 to inherit from that so that way we can 1899 01:49:56,158 --> 01:49:58,559 do the atomic flag thing i'm talking 1900 01:49:58,560 --> 01:50:02,560 juice timer now we need to include the 1901 01:50:02,560 --> 01:50:06,320 callback we go to timer we can see the 1902 01:50:06,319 --> 01:50:10,719 virtual void and it's pure virtual so we 1903 01:50:10,719 --> 01:50:14,560 let's see all right so in this timer 1904 01:50:12,479 --> 01:50:15,039 callback we are going to query an atomic 1905 01:50:15,039 --> 01:50:18,639 to decide if the chain needs updating 1906 01:50:18,639 --> 01:50:22,319 needs to be repainted so let's add that 1907 01:50:22,319 --> 01:50:25,759 right here below our processor 1908 01:50:25,760 --> 01:50:30,239 changed it's a good name for it give it 1909 01:50:30,238 --> 01:50:34,718 all right now we don't care about um if 1910 01:50:34,719 --> 01:50:38,719 so we can just give that an empty 1911 01:50:36,719 --> 01:50:39,760 implementation the callback parameter 1912 01:50:39,760 --> 01:50:43,280 is this one right here all right now 1913 01:50:43,279 --> 01:50:48,880 callbacks all right below our um 1914 01:50:46,960 --> 01:50:50,840 we're going to do this below our resized 1915 01:50:50,840 --> 01:50:54,880 editor.cpp so first things first let's 1916 01:50:54,880 --> 01:50:58,159 let's set up that parameter value 1917 01:50:58,158 --> 01:51:02,399 parameter value changed and the only 1918 01:51:06,880 --> 01:51:11,760 next we are going to just check if it's 1919 01:51:11,760 --> 01:51:17,440 in the timer callback if parameters 1920 01:51:15,039 --> 01:51:18,960 changed dot and then here is where we 1921 01:51:18,960 --> 01:51:22,158 true and if it is we want to set it back 1922 01:51:22,158 --> 01:51:25,759 um we don't want to you know just like 1923 01:51:24,399 --> 01:51:26,960 always be doing this because if we don't 1924 01:51:25,760 --> 01:51:28,800 make any changes to the parameter we 1925 01:51:26,960 --> 01:51:30,880 don't need to refresh the curve 1926 01:51:28,800 --> 01:51:31,840 okay we're going to call that guy we 1927 01:51:31,840 --> 01:51:38,079 if it is if our parameters changed is 1928 01:51:35,039 --> 01:51:41,519 true then we want it to be set to 1929 01:51:38,079 --> 01:51:45,359 false okay now if the parameters changed 1930 01:51:41,520 --> 01:51:48,400 we need to update the mono chain 1931 01:51:45,359 --> 01:51:49,519 from the ap vts we need to signal a 1932 01:51:49,520 --> 01:51:53,760 and yeah we need to signal a repaint so 1933 01:51:53,760 --> 01:51:57,840 unfortunately all the stuff that updates 1934 01:51:55,760 --> 01:52:00,320 the mono chain from the ap vts 1935 01:51:57,840 --> 01:52:01,840 is private in the audio processor so we 1936 01:52:01,840 --> 01:52:08,480 first before we can do this and then 1937 01:52:04,880 --> 01:52:10,199 do this all right so let's do that next 1938 01:52:11,920 --> 01:52:15,039 now all of these uh where are those 1939 01:52:15,039 --> 01:52:18,479 okay yes all right all of these update 1940 01:52:18,479 --> 01:52:22,718 need to be made into free functions so 1941 01:52:22,719 --> 01:52:25,760 those member variables need to become 1942 01:52:25,760 --> 01:52:29,599 so we're going to start with the 1943 01:52:26,719 --> 01:52:32,399 function that updates the peak filter 1944 01:52:29,599 --> 01:52:33,840 all right so what we will actually do is 1945 01:52:32,399 --> 01:52:35,839 um we're going to start by turning the 1946 01:52:35,840 --> 01:52:39,840 into a free function and then that way 1947 01:52:39,840 --> 01:52:44,960 peak guy can uh be turned into producing 1948 01:52:44,960 --> 01:52:48,319 we can change it to produce a peak 1949 01:52:48,319 --> 01:52:51,759 so let's grab these guys we're going to 1950 01:52:50,399 --> 01:52:55,118 copy these we're going to move these 1951 01:52:51,760 --> 01:52:56,880 up to the top here and put it below your 1952 01:52:56,880 --> 01:53:01,039 and we can get rid of that static 1953 01:52:58,158 --> 01:53:04,319 keyword and now we can make a 1954 01:53:01,039 --> 01:53:07,279 uh function that returns coefficients 1955 01:53:04,319 --> 01:53:10,000 and it makes a peak filter from chain 1956 01:53:10,000 --> 01:53:13,679 all right let's go over to our plugin 1957 01:53:13,679 --> 01:53:18,239 we're going to go to our update peak 1958 01:53:18,238 --> 01:53:21,118 all right and this is where we're going 1959 01:53:19,279 --> 01:53:21,519 to implement that free function because 1960 01:53:21,520 --> 01:53:24,840 just convenient to put it right there 1961 01:53:24,840 --> 01:53:29,199 coefficients make peak filter 1962 01:53:27,840 --> 01:53:32,719 and this is where we want our chain 1963 01:53:29,198 --> 01:53:35,039 settings and our sample rate 1964 01:53:32,719 --> 01:53:36,639 okay so all we need to do is just return 1965 01:53:36,639 --> 01:53:39,840 and instead of doing get sample rate we 1966 01:53:39,840 --> 01:53:43,039 sample rate like that okay now we need 1967 01:53:43,039 --> 01:53:46,719 use that helper function here oh and 1968 01:53:46,719 --> 01:53:51,039 we need to change this as well we can 1969 01:53:51,039 --> 01:53:54,479 all right so we just need to call this 1970 01:53:54,479 --> 01:54:02,319 here all right let's comment this out 1971 01:53:57,760 --> 01:54:06,400 and call it auto peak coefficient 1972 01:54:02,319 --> 01:54:08,960 equals make peak filter chain settings 1973 01:54:06,399 --> 01:54:10,879 get sample rate and let's do a quick 1974 01:54:08,960 --> 01:54:14,079 test to make sure that everything 1975 01:54:14,079 --> 01:54:17,840 all right we're going to make sure the 1976 01:54:20,639 --> 01:54:23,840 let me open up the high pass 1977 01:54:25,039 --> 01:54:28,719 i hear some sleeping let's do a boost 1978 01:54:35,118 --> 01:54:39,920 all right cool all right next we will 1979 01:54:39,920 --> 01:54:43,920 uh this function let's clean this up uh 1980 01:54:43,920 --> 01:54:47,520 since this is kind of getting into you 1981 01:54:47,520 --> 01:54:50,960 that sort of thing let's get rid of that 1982 01:54:50,960 --> 01:54:54,239 we will say refactored how peak uh 1983 01:54:54,238 --> 01:54:58,479 peak coefficient generation all right 1984 01:54:58,479 --> 01:55:02,839 okay we migrated this stuff up to there 1985 01:55:00,000 --> 01:55:05,279 and made this uh make peak filter helper 1986 01:55:05,279 --> 01:55:10,399 yes uh then we implemented that stuff 1987 01:55:10,399 --> 01:55:14,879 then here we implemented from uh 1988 01:55:12,960 --> 01:55:15,118 parameter listener and timer and added 1989 01:55:15,118 --> 01:55:22,960 necessary callbacks and the atomic flag 1990 01:55:20,000 --> 01:55:24,079 and then here is where we uh displayed 1991 01:55:24,079 --> 01:55:29,359 response curve oh that i forgot to 1992 01:55:26,399 --> 01:55:30,399 commit that stuff so let's do that first 1993 01:55:29,359 --> 01:55:32,880 all right because we want that step 1994 01:55:30,399 --> 01:55:35,839 separated let's see here is where we 1995 01:55:35,840 --> 01:55:38,960 let's add it let's do that first 1996 01:55:38,960 --> 01:55:43,279 response curve that's going to be this 1997 01:55:43,279 --> 01:55:47,519 that's all that is that's all that is we 1998 01:55:46,319 --> 01:55:48,719 definitely want to separate that stuff 1999 01:55:47,520 --> 01:55:49,599 because that was a big chunk of code 2000 01:55:49,599 --> 01:55:56,239 okay so i was saying this is where we um 2001 01:55:56,238 --> 01:55:59,439 yeah what did we do we refactored how 2002 01:55:59,439 --> 01:56:04,158 uh how peak coefficients how peak 2003 01:56:01,760 --> 01:56:07,840 coefficients are generated refactored 2004 01:56:04,158 --> 01:56:09,198 how peak coefficients are generated 2005 01:56:07,840 --> 01:56:11,279 all right and this is where we also did 2006 01:56:09,198 --> 01:56:12,079 that part as well and then here is where 2007 01:56:12,079 --> 01:56:18,880 set up for uh responding to parameter 2008 01:56:15,920 --> 01:56:20,239 changes in the editor okay this is where 2009 01:56:18,880 --> 01:56:21,520 we inherited from those things this is 2010 01:56:20,238 --> 01:56:23,678 where we implemented the callback and 2011 01:56:21,520 --> 01:56:26,480 the atomic flag that we will be checking 2012 01:56:23,679 --> 01:56:27,359 and here is where we um updated that 2013 01:56:30,880 --> 01:56:34,159 all right make your way over to the 2014 01:56:34,158 --> 01:56:41,198 dot cpp um specifically the constructor 2015 01:56:38,079 --> 01:56:43,439 yes how can i can i help you okay 2016 01:56:41,198 --> 01:56:45,279 now that we can update any peak filter 2017 01:56:43,439 --> 01:56:46,879 link with the chain settings we need to 2018 01:56:46,880 --> 01:56:51,039 the parameters actually change so let's 2019 01:56:49,198 --> 01:56:52,879 grab all the parameters from the audio 2020 01:56:51,039 --> 01:56:55,039 processor and add our cells as a 2021 01:56:55,039 --> 01:56:59,760 all right and now let's just loop 2022 01:56:56,158 --> 01:57:03,839 through them uh this function returns 2023 01:56:59,760 --> 01:57:06,079 an array of pointers now if we register 2024 01:57:03,840 --> 01:57:07,039 as a listener we need to deregister as a 2025 01:57:07,039 --> 01:57:14,079 we'll do this same chunk of code here 2026 01:57:14,079 --> 01:57:17,599 this okay so let's go to our timer 2027 01:57:17,599 --> 01:57:20,639 now that we are listening to our 2028 01:57:20,639 --> 01:57:25,359 if the parameter changed we need to 2029 01:57:23,279 --> 01:57:26,880 update the mono chain so let's do that 2030 01:57:25,359 --> 01:57:28,799 let's grab the chain settings let's make 2031 01:57:26,880 --> 01:57:30,319 new coefficients and then let's update 2032 01:57:33,520 --> 01:57:37,679 chain settings let's make our 2033 01:57:37,679 --> 01:57:42,079 for the peak band all right our chain 2034 01:57:42,079 --> 01:57:45,760 and our sample rate and now we can 2035 01:57:45,760 --> 01:57:49,920 chain's coefficients our old ones are 2036 01:57:53,359 --> 01:57:56,799 and then our replacements are going to 2037 01:57:56,800 --> 01:58:03,599 all right and now we just repaint 2038 01:58:00,079 --> 01:58:05,679 oh i forgot to call uh coefficients 2039 01:58:03,599 --> 01:58:07,760 that's what we needed there we go 2040 01:58:05,679 --> 01:58:10,800 all right let's give that a test see if 2041 01:58:10,960 --> 01:58:14,480 all right so if i adjust this are we 2042 01:58:20,238 --> 01:58:23,678 all right soon enough okay we'll get 2043 01:58:23,679 --> 01:58:27,359 we can add a debug statement ram's 2044 01:58:27,359 --> 01:58:32,719 and we should see something down here if 2045 01:58:32,719 --> 01:58:39,198 and we are not okay that is because 2046 01:58:37,359 --> 01:58:40,399 that is because we did not start our 2047 01:58:40,399 --> 01:58:44,638 okay so we need to go up to our 2048 01:58:42,399 --> 01:58:46,839 constructor and start our timer 2049 01:58:44,639 --> 01:58:49,359 all right let's do a 60 hertz refresh 2050 01:58:46,840 --> 01:58:49,920 rate i knew there was something i was 2051 01:58:49,920 --> 01:58:56,239 okay let's try this now this should work 2052 01:58:53,520 --> 01:58:58,080 perfectly all right so i'm just going to 2053 01:59:02,960 --> 01:59:07,679 all right so now we need to get the cut 2054 01:59:04,800 --> 01:59:10,480 filters uh the cut filter functions 2055 01:59:07,679 --> 01:59:13,039 usable by the editor so head on over to 2056 01:59:13,039 --> 01:59:17,359 and we need to jump down to all of these 2057 01:59:17,359 --> 01:59:20,960 okay we need to make all of these public 2058 01:59:20,960 --> 01:59:25,520 grab the grab these template functions 2059 01:59:24,238 --> 01:59:28,238 all right and we're just going to cut 2060 01:59:28,238 --> 01:59:32,638 we can put them after our uh make peak 2061 01:59:32,639 --> 01:59:36,159 uh let's do a little build just to make 2062 01:59:34,479 --> 01:59:37,039 sure that um we don't have to change 2063 01:59:37,039 --> 01:59:39,760 all right those so those could have been 2064 01:59:38,158 --> 01:59:41,598 public from they could have been free 2065 01:59:41,599 --> 01:59:44,880 so now we just need to add two helper 2066 01:59:44,880 --> 01:59:48,239 for producing the coefficients all right 2067 01:59:48,238 --> 01:59:51,519 we're going to basically do the same 2068 01:59:49,599 --> 01:59:52,319 thing we did this with this make peak 2069 01:59:52,319 --> 01:59:55,439 and we're going to be able to call them 2070 01:59:55,439 --> 01:59:59,519 so we can put them right here if we want 2071 01:59:57,840 --> 02:00:01,119 to implement these functions in header 2072 02:00:01,118 --> 02:00:05,598 in two places such as the uh plugin 2073 02:00:09,599 --> 02:00:13,840 and plugineditor.h if we want to do that 2074 02:00:12,079 --> 02:00:15,679 we need to use the inline keyword 2075 02:00:13,840 --> 02:00:17,119 otherwise the compiler will produce a 2076 02:00:15,679 --> 02:00:18,880 definition for this function 2077 02:00:17,118 --> 02:00:21,439 everywhere that this header file is 2078 02:00:18,880 --> 02:00:21,840 included and the linker will not know 2079 02:00:21,840 --> 02:00:25,360 compiled cpp file to use for the 2080 02:00:25,359 --> 02:00:29,679 so that's why we're going to write 2081 02:00:26,719 --> 02:00:30,719 inline auto i'm not sure what type to 2082 02:00:30,719 --> 02:00:33,840 what's being returned make low cut 2083 02:00:33,840 --> 02:00:38,480 we need our chain settings again we need 2084 02:00:38,479 --> 02:00:42,799 and then we're going to use our filter 2085 02:00:42,800 --> 02:00:46,719 i can just go copy this from the plug-in 2086 02:00:46,719 --> 02:00:49,840 that's uh this thing right here let's 2087 02:00:49,840 --> 02:00:55,199 low cut so i need this thing and here's 2088 02:00:55,198 --> 02:00:58,799 all right let's just do a quick build on 2089 02:00:56,800 --> 02:00:59,440 that make sure that we're not getting an 2090 02:00:59,439 --> 02:01:02,719 cool all right let's do the same thing 2091 02:01:02,719 --> 02:01:06,480 go back to plug-in processor i'm going 2092 02:01:06,479 --> 02:01:09,839 update high cut filter is going to copy 2093 02:01:09,840 --> 02:01:13,679 oops this is what we want that goes here 2094 02:01:13,679 --> 02:01:20,399 this is just our parameter sample rate 2095 02:01:16,960 --> 02:01:23,039 all right and we need a return like that 2096 02:01:20,399 --> 02:01:25,198 format that properly and do a little 2097 02:01:23,039 --> 02:01:28,158 build make sure we don't have an error 2098 02:01:25,198 --> 02:01:28,960 okay cool now we just need to update our 2099 02:01:28,960 --> 02:01:32,880 head on over to the update low cut 2100 02:01:32,880 --> 02:01:40,239 and let's change this to make low 2101 02:01:40,238 --> 02:01:47,439 chain settings get sample rate 2102 02:01:44,800 --> 02:01:50,480 same thing for the high cut we're just 2103 02:01:47,439 --> 02:01:51,118 going to do make high cut get sample 2104 02:01:51,118 --> 02:01:55,359 all right let's do a quick test before 2105 02:01:55,359 --> 02:01:59,118 all right this should still work 2106 02:01:59,520 --> 02:02:03,599 okay rolling off all the bottom as 2107 02:02:03,599 --> 02:02:08,319 for this one rolling off all the top end 2108 02:02:08,639 --> 02:02:12,239 perfect let's make a commit of that 2109 02:02:12,238 --> 02:02:15,759 because it's good to good to have it 2110 02:02:14,158 --> 02:02:16,719 okay this is where we connected our 2111 02:02:16,719 --> 02:02:20,639 got the display updating all right 2112 02:02:20,639 --> 02:02:28,400 uh let's see this is refactored how 2113 02:02:25,039 --> 02:02:29,279 cut filters are created that's what 2114 02:02:29,279 --> 02:02:33,039 get rid of that code same thing happened 2115 02:02:33,039 --> 02:02:39,679 and now this is where we um updated 2116 02:02:37,118 --> 02:02:40,559 let's see this is where the um gui 2117 02:02:43,840 --> 02:02:49,599 cool all right we've tested our editor 2118 02:02:46,960 --> 02:02:51,118 now let's update the response curve all 2119 02:02:49,599 --> 02:02:52,319 right so go to your plugin editor dot 2120 02:02:55,920 --> 02:02:59,520 and we're going to do uh the same 2121 02:02:57,599 --> 02:03:02,800 coefficient update that we did here 2122 02:03:02,800 --> 02:03:06,400 equals make low cut filter chain 2123 02:03:06,399 --> 02:03:10,000 sample rate um let's cache that sample 2124 02:03:10,000 --> 02:03:13,198 i'm feeling a little lazy i'm just going 2125 02:03:11,439 --> 02:03:13,598 to copy that this can all be refactored 2126 02:03:13,599 --> 02:03:18,000 so we don't dry so we don't repeat 2127 02:03:16,238 --> 02:03:18,559 ourselves we always want to not repeat 2128 02:03:18,560 --> 02:03:22,159 dry don't repeat yourself okay here we 2129 02:03:26,479 --> 02:03:31,359 make high cut filter chain settings 2130 02:03:29,840 --> 02:03:33,599 copy that thing right there all right 2131 02:03:31,359 --> 02:03:36,079 now we can update our cut filter 2132 02:03:33,599 --> 02:03:37,599 our chain is going to be the mono chain 2133 02:03:37,599 --> 02:03:42,000 low cut coefficients are going to be the 2134 02:03:42,000 --> 02:03:48,479 and our slope is going to be the chain 2135 02:03:48,479 --> 02:03:52,158 and then our update our cut filter we 2136 02:03:52,158 --> 02:03:58,319 high cut mono chain.get we want the high 2137 02:03:56,000 --> 02:04:00,158 cut position we want the high cut 2138 02:04:00,158 --> 02:04:04,799 and with the high cut slope okay let's 2139 02:04:04,800 --> 02:04:09,840 all right so i'm going to adjust this 2140 02:04:07,760 --> 02:04:12,400 okay we are drawing outside of our 2141 02:04:12,399 --> 02:04:17,598 we are drawing though that's cool so the 2142 02:04:15,679 --> 02:04:18,719 response area should be its own 2143 02:04:18,719 --> 02:04:22,399 components cannot draw outside of their 2144 02:04:20,479 --> 02:04:23,198 balance unless you set a flag that 2145 02:04:23,198 --> 02:04:27,039 we will do that next but this is a good 2146 02:04:25,118 --> 02:04:29,598 sign that our display is responding to 2147 02:04:27,039 --> 02:04:32,238 controls and that what we are hearing 2148 02:04:29,599 --> 02:04:33,520 sounds like what we are seeing or the 2149 02:04:32,238 --> 02:04:34,319 other said the other way what we are 2150 02:04:34,319 --> 02:04:39,840 sounds like what we are hearing okay 2151 02:04:48,479 --> 02:04:55,919 cool all right let's commit that 2152 02:05:04,399 --> 02:05:07,839 migrating this code from the editor to a 2153 02:05:07,840 --> 02:05:13,599 is relatively easy we need to inherit 2154 02:05:10,639 --> 02:05:16,239 from the things the editor is inheriting 2155 02:05:13,599 --> 02:05:16,880 and yeah we're really not writing any 2156 02:05:16,880 --> 02:05:20,560 really we're just refactoring what we 2157 02:05:20,560 --> 02:05:24,159 header file first of all let's go up 2158 02:05:24,158 --> 02:05:29,679 basically inherit from all this stuff so 2159 02:05:26,960 --> 02:05:33,920 let's do that first let's do struct 2160 02:05:29,679 --> 02:05:34,560 uh response curve let me spell it right 2161 02:05:34,560 --> 02:05:38,560 component and then we need to inherit 2162 02:05:38,560 --> 02:05:41,599 okay we're gonna need the same uh 2163 02:05:40,238 --> 02:05:43,678 basically the same constructor 2164 02:05:43,679 --> 02:05:50,399 and we're gonna need to migrate over all 2165 02:05:45,439 --> 02:05:51,359 of those callbacks let's just copy these 2166 02:05:50,399 --> 02:05:54,078 all right we're not going to need this 2167 02:05:51,359 --> 02:05:56,319 comment let's go to our cpp file 2168 02:05:54,078 --> 02:05:57,599 now our callback migration we're going 2169 02:05:56,319 --> 02:05:58,639 to need our parameter changed in our 2170 02:05:58,639 --> 02:06:05,279 so i'm just going to copy these two guys 2171 02:06:01,679 --> 02:06:08,239 directly move them up to the top 2172 02:06:05,279 --> 02:06:09,840 put them up here and just change this to 2173 02:06:09,840 --> 02:06:14,319 curve component same for that we get a 2174 02:06:14,319 --> 02:06:17,679 it's fine we'll fix those in just a 2175 02:06:15,760 --> 02:06:18,239 second and we need to migrate over the 2176 02:06:18,238 --> 02:06:22,000 that registered as a listener so let's 2177 02:06:22,000 --> 02:06:26,238 here let's give ourselves uh let's see 2178 02:06:26,238 --> 02:06:30,799 initialize we need to provide ourselves 2179 02:06:30,800 --> 02:06:36,239 same the same thing okay now we can 2180 02:06:36,238 --> 02:06:41,039 audio processor all right now 2181 02:06:39,439 --> 02:06:43,118 we need to migrate over the code that 2182 02:06:43,118 --> 02:06:46,880 okay so let's do that next where was 2183 02:06:46,880 --> 02:06:52,800 that was all of this stuff right here 2184 02:06:50,158 --> 02:06:54,078 it's name for the timer we need that too 2185 02:06:54,078 --> 02:07:00,479 we need the destructor we need that code 2186 02:06:57,599 --> 02:07:02,400 all right so let's copy this okay we're 2187 02:07:00,479 --> 02:07:06,559 going to need a paint function 2188 02:07:02,399 --> 02:07:08,399 so let's declare one of those void paint 2189 02:07:06,560 --> 02:07:11,039 we can just migrate over the entire 2190 02:07:08,399 --> 02:07:14,319 paint function from the plugin editor 2191 02:07:11,039 --> 02:07:15,439 so we can literally just rename this 2192 02:07:14,319 --> 02:07:18,158 i'm not going to do that though i'm 2193 02:07:15,439 --> 02:07:19,919 going to copy it and do the proper thing 2194 02:07:18,158 --> 02:07:22,158 but literally we can just literally copy 2195 02:07:19,920 --> 02:07:23,840 this whole thing and put it down here 2196 02:07:22,158 --> 02:07:25,759 we'll fix all those variables in just a 2197 02:07:25,760 --> 02:07:29,679 all those error messages number eight we 2198 02:07:27,599 --> 02:07:30,960 need to migrate over the parameter 2199 02:07:30,960 --> 02:07:36,239 value so let's grab this from here 2200 02:07:34,319 --> 02:07:38,479 that should go here we also need to 2201 02:07:38,479 --> 02:07:42,479 now once we've done these things we need 2202 02:07:42,479 --> 02:07:45,839 give ourselves an instance so let's do 2203 02:07:45,840 --> 02:07:49,119 i'm just going to put that here response 2204 02:07:49,118 --> 02:07:52,719 component and then we can also get rid 2205 02:07:52,719 --> 02:07:58,319 we can also get rid of our atomic in our 2206 02:07:55,520 --> 02:08:00,400 plugin editor.cpp we need to go down to 2207 02:08:00,399 --> 02:08:05,279 as one of our components all right now 2208 02:08:08,639 --> 02:08:12,319 editor constructor pretty sure it's 2209 02:08:10,880 --> 02:08:13,679 going to tell me that it needs to be 2210 02:08:13,679 --> 02:08:17,599 the other response curve component audio 2211 02:08:17,599 --> 02:08:25,199 yes this needs to be initialized before 2212 02:08:25,359 --> 02:08:29,198 for all the attachments finally we need 2213 02:08:27,439 --> 02:08:31,439 to give it some bounds so let's go to 2214 02:08:29,198 --> 02:08:33,598 our plug-in editor resized function 2215 02:08:31,439 --> 02:08:35,279 and now we can actually use our response 2216 02:08:35,279 --> 02:08:38,880 cool all right so let's go to our plugin 2217 02:08:38,880 --> 02:08:42,960 all right this is not going to inherit 2218 02:08:40,560 --> 02:08:43,520 from uh parameter listener or timer 2219 02:08:43,520 --> 02:08:49,119 so we don't need any of these callbacks 2220 02:08:46,639 --> 02:08:50,319 um we don't need this atomic we don't 2221 02:08:50,319 --> 02:08:54,000 uh the chain so that means we can get 2222 02:08:54,000 --> 02:08:58,439 uh get rid of those functions as well 2223 02:08:56,399 --> 02:09:00,000 all right so let's go to our plugin 2224 02:09:00,000 --> 02:09:04,000 uh we are no longer listening for those 2225 02:09:04,000 --> 02:09:07,760 so those go away same for the destructor 2226 02:09:07,760 --> 02:09:11,440 and then we're not doing any of this so 2227 02:09:11,439 --> 02:09:14,638 filling it entirely with black so we can 2228 02:09:14,639 --> 02:09:18,880 all of this stuff and then we don't need 2229 02:09:23,039 --> 02:09:26,880 all right and i believe that's most of 2230 02:09:25,359 --> 02:09:28,960 the errors let's build it and see what 2231 02:09:28,960 --> 02:09:32,000 that may have been it all right yep okay 2232 02:09:32,000 --> 02:09:36,800 so let's run and test it all right so 2233 02:09:34,800 --> 02:09:38,079 this is tiny for some reason that's way 2234 02:09:38,078 --> 02:09:42,158 let's go to our resized function uh 2235 02:09:42,158 --> 02:09:49,759 bounds dot get height oh you know why 2236 02:09:45,439 --> 02:09:52,960 it's because um our response area here 2237 02:09:49,760 --> 02:09:53,760 in this um our response area should not 2238 02:09:53,760 --> 02:09:57,280 33 of the actual component it should 2239 02:09:55,760 --> 02:09:57,920 just be the get local bounce so i'm just 2240 02:09:57,920 --> 02:10:03,520 do that and then get rid of this line 2241 02:10:01,439 --> 02:10:06,078 all right now if we run it we should be 2242 02:10:07,039 --> 02:10:11,198 okay cool so let's check if we are 2243 02:10:09,439 --> 02:10:15,039 drawing outside of our bounds anymore 2244 02:10:11,198 --> 02:10:17,919 and no we are not so that's fantastic 2245 02:10:15,039 --> 02:10:19,840 i told you that would be easy okay let's 2246 02:10:19,840 --> 02:10:27,679 oh created response curve component 2247 02:10:24,560 --> 02:10:29,119 that's a fairly uh fairly aggressive 2248 02:10:27,679 --> 02:10:31,039 amount of code surgery here's our 2249 02:10:29,118 --> 02:10:32,719 response curve component with all the 2250 02:10:32,719 --> 02:10:40,560 here's where we gutted the editor 2251 02:10:37,359 --> 02:10:43,839 same for right here all right we've come 2252 02:10:40,560 --> 02:10:43,840 a long way we've done a lot of stuff 2253 02:10:46,000 --> 02:10:50,399 okay we are going to customize the 2254 02:10:50,399 --> 02:10:54,719 for this slider class i want it to show 2255 02:10:52,399 --> 02:10:56,879 the following okay i want to see the min 2256 02:10:54,719 --> 02:10:58,960 and max range at either end of the 2257 02:10:56,880 --> 02:11:01,359 slider and i want to see the parameters 2258 02:10:58,960 --> 02:11:02,560 value in the center of the slider 2259 02:11:01,359 --> 02:11:04,799 i want the slider to have some 2260 02:11:02,560 --> 02:11:05,920 customized visuals outside of those 2261 02:11:05,920 --> 02:11:10,078 so i'm going to change this slider class 2262 02:11:08,158 --> 02:11:10,960 let me go to my editor first i'm going 2263 02:11:10,960 --> 02:11:15,599 slider class right here to have a custom 2264 02:11:13,760 --> 02:11:17,920 look and feel that will do those things 2265 02:11:15,599 --> 02:11:18,719 so a bit of planning before we actually 2266 02:11:18,719 --> 02:11:23,279 and the juice look and feel system works 2267 02:11:26,399 --> 02:11:30,078 here we go all right look and feel 2268 02:11:28,078 --> 02:11:32,639 methods for these slider clasps 2269 02:11:30,078 --> 02:11:33,439 now the look and feel system works as 2270 02:11:33,439 --> 02:11:37,598 okay inside the component paint function 2271 02:11:35,599 --> 02:11:38,880 let me go to slider or paint 2272 02:11:37,599 --> 02:11:41,039 all right here's what happens in the 2273 02:11:41,039 --> 02:11:43,599 when you're painting your components now 2274 02:11:42,560 --> 02:11:44,800 things are a little bit different with 2275 02:11:44,800 --> 02:11:48,960 the general practice works like this in 2276 02:11:47,118 --> 02:11:51,920 your components paint function 2277 02:11:48,960 --> 02:11:52,480 you're going to call get look and feel 2278 02:11:52,479 --> 02:11:56,718 inside of that you're going to call 2279 02:11:55,679 --> 02:11:59,520 one of the look and feel member 2280 02:11:56,719 --> 02:12:00,239 functions sorry in the look and feel 2281 02:12:00,238 --> 02:12:04,000 there are several member functions for 2282 02:12:02,719 --> 02:12:06,800 drawing different things and it's the 2283 02:12:04,000 --> 02:12:08,479 way it's organized is kind of strange 2284 02:12:06,800 --> 02:12:10,400 basically like we're in the slider class 2285 02:12:08,479 --> 02:12:12,399 the slider has look and feel methods 2286 02:12:10,399 --> 02:12:15,598 there's a look and feel bass class which 2287 02:12:15,599 --> 02:12:18,560 narratives from all these things i can 2288 02:12:17,359 --> 02:12:20,319 pull it up in the docs and you'll see 2289 02:12:18,560 --> 02:12:21,280 what i'm talking about if we go over 2290 02:12:21,279 --> 02:12:24,399 okay so you can see the look and feel 2291 02:12:22,719 --> 02:12:25,920 class inherits from all of these 2292 02:12:24,399 --> 02:12:27,759 different base classes you know button 2293 02:12:27,760 --> 02:12:31,199 text editor has their own tree view 2294 02:12:34,479 --> 02:12:37,678 so what happens is the components they 2295 02:12:37,679 --> 02:12:40,960 instance and then they call one of these 2296 02:12:40,960 --> 02:12:44,800 so let me go to the slider.cpp and show 2297 02:12:44,800 --> 02:12:49,119 in the sliders case it uses a pimple to 2298 02:12:47,679 --> 02:12:50,000 deal with the implementation so i'm 2299 02:12:50,000 --> 02:12:53,279 that so we can see what's going on okay 2300 02:12:53,279 --> 02:12:58,719 as shown here it's using a look and feel 2301 02:12:58,719 --> 02:13:02,319 one of those look and feel member 2302 02:13:02,319 --> 02:13:06,158 i'll go back to this so we can see what 2303 02:13:03,920 --> 02:13:07,359 i'm talking about uh slider look and 2304 02:13:07,359 --> 02:13:10,639 okay here we go draw a linear slider the 2305 02:13:10,639 --> 02:13:13,920 if it's like a slider that's got 2306 02:13:12,158 --> 02:13:15,598 multiple thumbs and stuff on it if it's 2307 02:13:15,599 --> 02:13:19,279 where to draw the text box what kind of 2308 02:13:19,279 --> 02:13:23,439 display that sort of thing okay so it's 2309 02:13:23,439 --> 02:13:27,118 member functions and then inside this 2310 02:13:25,279 --> 02:13:29,118 member function is where all that stuff 2311 02:13:29,118 --> 02:13:33,759 okay so for example the vertical slider 2312 02:13:32,238 --> 02:13:36,399 is going to call get look and feel in 2313 02:13:33,760 --> 02:13:37,760 the paint function if i go back here 2314 02:13:36,399 --> 02:13:39,439 all right here's the get look and feel 2315 02:13:37,760 --> 02:13:41,360 it's going to pass it to the pimples 2316 02:13:41,359 --> 02:13:45,519 all right and then that's going to call 2317 02:13:45,520 --> 02:13:49,760 okay on that returned object okay now 2318 02:13:48,078 --> 02:13:50,799 the idea is that anything you want to 2319 02:13:50,800 --> 02:13:56,079 slider part of the component is drawn 2320 02:13:53,439 --> 02:13:58,238 with that look and feel member function 2321 02:13:56,078 --> 02:14:00,078 everything that is drawn outside of it 2322 02:13:58,238 --> 02:14:01,359 is drawn in the component's paint 2323 02:14:01,359 --> 02:14:04,399 okay regardless of that i don't want to 2324 02:14:04,399 --> 02:14:08,719 details as i said everything that is 2325 02:14:08,719 --> 02:14:14,719 the slider area is going to be drawn 2326 02:14:11,760 --> 02:14:16,159 in um it's going to be drawn in the 2327 02:14:14,719 --> 02:14:18,239 paint function everything that's part of 2328 02:14:16,158 --> 02:14:20,238 the slider is going to be drawn in the 2329 02:14:18,238 --> 02:14:21,439 get look and feel draw rotary slider 2330 02:14:21,439 --> 02:14:24,960 now i want the parameter value to be 2331 02:14:23,118 --> 02:14:28,238 displayed in the center of the slider 2332 02:14:24,960 --> 02:14:29,840 so for this reason i am going to display 2333 02:14:28,238 --> 02:14:31,759 that in the look and feel member 2334 02:14:29,840 --> 02:14:33,599 function since i consider it to be part 2335 02:14:33,599 --> 02:14:38,078 okay i'm going to draw the min and max 2336 02:14:35,520 --> 02:14:39,679 parameters in the paint function 2337 02:14:38,078 --> 02:14:41,679 and call that look and feel member 2338 02:14:39,679 --> 02:14:43,359 function from the paint function 2339 02:14:41,679 --> 02:14:45,118 okay i know i need a bit of room for the 2340 02:14:43,359 --> 02:14:46,559 text labels showing the range to be 2341 02:14:46,560 --> 02:14:50,480 so that means the actual area that the 2342 02:14:48,479 --> 02:14:51,439 slider will be drawn in needs to be 2343 02:14:51,439 --> 02:14:56,559 than the component itself i'm also going 2344 02:14:54,719 --> 02:14:57,439 to want to use a uniform text height for 2345 02:14:57,439 --> 02:15:00,879 displayed here so i'm going to need a 2346 02:14:59,039 --> 02:15:01,679 function that's going to give me that as 2347 02:15:01,679 --> 02:15:05,118 okay now the reason for this is because 2348 02:15:03,359 --> 02:15:06,399 my paint function and the look and feel 2349 02:15:06,399 --> 02:15:10,559 will need to call this get text type 2350 02:15:08,960 --> 02:15:11,359 function since i'm going to be drawing 2351 02:15:11,359 --> 02:15:15,279 in both places and i want it to just 2352 02:15:15,279 --> 02:15:19,920 okay i also want to customize the suffix 2353 02:15:17,679 --> 02:15:23,440 that is displayed for each parameter 2354 02:15:19,920 --> 02:15:26,560 so this way i will see things like 2.85 2355 02:15:23,439 --> 02:15:28,078 kilohertz or 12 db per octave 2356 02:15:26,560 --> 02:15:29,760 all right we will figure out what to do 2357 02:15:28,078 --> 02:15:30,559 for the quality parameter when we get to 2358 02:15:30,560 --> 02:15:34,639 since that doesn't have any units at all 2359 02:15:32,800 --> 02:15:37,039 okay and then finally i'm going to need 2360 02:15:34,639 --> 02:15:39,118 i'm going to need a parameter so that 2361 02:15:37,039 --> 02:15:40,560 way i can get its value so let's go back 2362 02:15:40,560 --> 02:15:43,840 all right so we're going to just this 2363 02:15:42,319 --> 02:15:45,759 class is going to have a lot of surgery 2364 02:15:45,760 --> 02:15:50,079 first let's rename this class and we're 2365 02:15:50,078 --> 02:15:55,920 rotary slider with labels okay 2366 02:15:53,599 --> 02:15:57,920 so the next thing we need is we need to 2367 02:15:55,920 --> 02:15:59,118 give ourselves a parameter and a suffix 2368 02:15:59,118 --> 02:16:05,519 so juice ranged audio parameter 2369 02:16:03,118 --> 02:16:07,598 we're gonna do pointer to it the only 2370 02:16:05,520 --> 02:16:11,599 the reason i'm using this thing 2371 02:16:07,599 --> 02:16:15,760 is because this this is the base class 2372 02:16:11,599 --> 02:16:17,279 for all of these um all of these guys 2373 02:16:15,760 --> 02:16:19,440 even though and it derives from audio 2374 02:16:17,279 --> 02:16:21,359 processor parameter and it contains a 2375 02:16:19,439 --> 02:16:23,198 whole bunch of member functions that 2376 02:16:21,359 --> 02:16:24,479 let me pull information out of this if i 2377 02:16:24,479 --> 02:16:28,879 there's like let's see they're like i'm 2378 02:16:27,520 --> 02:16:32,159 going to need these convert to 2379 02:16:28,880 --> 02:16:33,120 zero to one and convert from zero to one 2380 02:16:32,159 --> 02:16:34,478 that sort of thing and then there's a 2381 02:16:33,120 --> 02:16:36,079 whole bunch of like you know get value 2382 02:16:36,079 --> 02:16:40,318 that it comes from the base class okay 2383 02:16:38,558 --> 02:16:42,718 getting a little sidetracked some 2384 02:16:40,318 --> 02:16:44,558 let's not get too lost in the minutia 2385 02:16:42,718 --> 02:16:46,000 about that and just focus on following 2386 02:16:44,558 --> 02:16:47,438 the code that is going to be written 2387 02:16:46,000 --> 02:16:49,679 all right so there's my parameter i'm 2388 02:16:47,439 --> 02:16:51,359 going to give myself a suffix 2389 02:16:49,679 --> 02:16:53,040 all right now i'm going to update this 2390 02:16:53,040 --> 02:16:56,880 to initialize these two member variables 2391 02:17:04,079 --> 02:17:09,039 look and feel class okay we need an 2392 02:17:06,799 --> 02:17:12,879 actual look and feel class that we can 2393 02:17:09,040 --> 02:17:15,280 provide our um draw rotary slider 2394 02:17:12,879 --> 02:17:16,398 function all right if we jump back over 2395 02:17:16,398 --> 02:17:21,279 um jump back over to this thing this is 2396 02:17:21,280 --> 02:17:25,200 go to that slider class here's the look 2397 02:17:25,200 --> 02:17:30,240 so we want to implement a rotary slider 2398 02:17:28,638 --> 02:17:33,039 function okay so that's what we need to 2399 02:17:30,239 --> 02:17:35,599 provide here let's make a look and feel 2400 02:17:33,040 --> 02:17:36,880 all right these inherit from uh there's 2401 02:17:35,599 --> 02:17:38,799 a few different versions we're going to 2402 02:17:36,879 --> 02:17:42,159 inherit from the most recent one 2403 02:17:38,799 --> 02:17:44,959 look and feel the version four and 2404 02:17:42,159 --> 02:17:47,039 then this is where we are going to 2405 02:17:47,040 --> 02:17:54,399 so let's go to the slider class and 2406 02:17:50,398 --> 02:17:56,318 look for that look and feel methods 2407 02:17:54,398 --> 02:17:58,799 and we're gonna draw that uh rotary 2408 02:17:56,318 --> 02:18:02,079 slider so just copy this guy 2409 02:17:58,799 --> 02:18:03,518 declare it here override it and give 2410 02:18:02,079 --> 02:18:04,799 ourselves a default implementation for 2411 02:18:04,799 --> 02:18:09,358 and then make this um we gotta have that 2412 02:18:09,359 --> 02:18:12,559 cool all right we have our look and feel 2413 02:18:12,558 --> 02:18:17,039 or our look and feel class we need to 2414 02:18:17,040 --> 02:18:21,840 and then we can set that as our look and 2415 02:18:26,239 --> 02:18:30,959 all right now if we are setting a look 2416 02:18:28,478 --> 02:18:35,279 and feel we have to remember to 2417 02:18:35,280 --> 02:18:38,639 now as i said we're going to need a 2418 02:18:36,879 --> 02:18:39,920 paint function because we're going to 2419 02:18:42,959 --> 02:18:46,159 i had said we're going to need the 2420 02:18:44,718 --> 02:18:47,598 slider bounds which is going to be 2421 02:18:47,599 --> 02:18:50,398 what we're actually going to it's going 2422 02:18:49,280 --> 02:18:52,559 to be slightly smaller than the 2423 02:18:50,398 --> 02:18:55,039 component bounds itself so we need 2424 02:18:52,558 --> 02:18:56,398 some function that can provide that 2425 02:18:56,398 --> 02:19:00,478 rectangle we're going to need that text 2426 02:19:00,478 --> 02:19:05,519 so um that's just going to be an integer 2427 02:19:04,079 --> 02:19:07,840 and then we're going gonna need to get 2428 02:19:07,840 --> 02:19:11,280 okay that's what that's what's gonna 2429 02:19:14,558 --> 02:19:19,039 um you know decibels if we're doing the 2430 02:19:25,519 --> 02:19:30,559 did all of these change if we go down to 2431 02:19:27,519 --> 02:19:32,239 our plugin editor.h go way down here 2432 02:19:30,558 --> 02:19:34,000 all of these rotary slider with labels 2433 02:19:34,000 --> 02:19:38,638 all right now we need to initialize all 2434 02:19:35,760 --> 02:19:41,679 of these guys so go to plugineditor.cpp 2435 02:19:41,679 --> 02:19:44,879 and all these are declared before the 2436 02:19:43,599 --> 02:19:47,439 response curve so they need to be 2437 02:19:44,879 --> 02:19:49,039 initialized before the response curve 2438 02:19:47,439 --> 02:19:51,359 okay now if you remember this thing 2439 02:19:51,359 --> 02:19:55,680 this thing needs uh what's it called it 2440 02:19:55,680 --> 02:19:59,760 and then it also needs the suffix that's 2441 02:19:58,159 --> 02:20:01,600 going to get displayed at the end 2442 02:19:59,760 --> 02:20:03,760 so let's do the first one so that's 2443 02:20:03,760 --> 02:20:12,079 so the wants a parameter so let's 2444 02:20:07,520 --> 02:20:13,600 use our ap vts to get a parameter 2445 02:20:12,079 --> 02:20:15,200 and we already know the name this is the 2446 02:20:13,600 --> 02:20:16,880 peak frequency slider so it's going to 2447 02:20:16,879 --> 02:20:20,559 and the suffix is going to be hertz 2448 02:20:20,559 --> 02:20:24,559 okay that's one slider we got to do the 2449 02:20:24,559 --> 02:20:27,600 oh this one's a reference not a pointer 2450 02:20:27,600 --> 02:20:32,399 dereference that okay let's do the rest 2451 02:20:34,719 --> 02:20:42,079 and then we need our our units all right 2452 02:20:37,840 --> 02:20:45,600 this is decibels quality has no units 2453 02:20:52,559 --> 02:20:57,359 okay if we build it we should not have 2454 02:20:57,359 --> 02:21:01,840 oh we have an error what's the problem 2455 02:21:01,840 --> 02:21:06,318 why did that give us an undefined symbol 2456 02:21:04,239 --> 02:21:09,039 oh we're missing a pain function 2457 02:21:06,318 --> 02:21:10,318 that's why okay let's go to our plugin 2458 02:21:17,200 --> 02:21:20,720 so just we'll just leave it empty for 2459 02:21:20,719 --> 02:21:24,959 all right awesome build succeeded okay 2460 02:21:24,959 --> 02:21:28,318 we're not going to our sliders are going 2461 02:21:26,398 --> 02:21:29,358 to be blank because their look and feel 2462 02:21:32,639 --> 02:21:36,398 our pain function is empty okay so 2463 02:21:35,040 --> 02:21:37,040 that's why we don't see any sliders 2464 02:21:37,040 --> 02:21:40,000 but that's okay because we implemented 2465 02:21:38,398 --> 02:21:40,959 the skeleton so we can start drawing 2466 02:21:40,959 --> 02:21:44,719 all right let's make a commit of that 2467 02:21:48,398 --> 02:21:52,318 visuals all right here's our where we 2468 02:21:52,318 --> 02:21:55,680 here's where we did all this code 2469 02:21:53,600 --> 02:21:56,720 surgery it doesn't look like we wrote 2470 02:21:56,719 --> 02:22:01,599 it's a lot you know it's a fairly big 2471 02:22:01,600 --> 02:22:08,079 first thing we are going to do is make 2472 02:22:04,639 --> 02:22:09,358 this just a declaration and we will also 2473 02:22:09,359 --> 02:22:13,600 draw rotary slider all right now let's 2474 02:22:13,600 --> 02:22:17,040 which we need to implement now so let's 2475 02:22:17,040 --> 02:22:22,880 let's use one of these to add a space 2476 02:22:20,478 --> 02:22:24,079 visual delineation so let's implement 2477 02:22:30,398 --> 02:22:34,639 we're going to use that namespace trick 2478 02:22:32,478 --> 02:22:35,679 okay we will begin by setting up the 2479 02:22:35,680 --> 02:22:42,239 visually have a range of seven o'clock 2480 02:22:39,600 --> 02:22:43,120 to five o'clock okay seven o'clock so 2481 02:22:43,120 --> 02:22:48,000 we're gonna go seven all the way to five 2482 02:22:46,398 --> 02:22:49,599 this is probably backwards for you with 2483 02:22:49,600 --> 02:22:53,280 i'm looking at it if i had a clock in 2484 02:22:53,280 --> 02:22:56,560 seven o'clock and then this would be 2485 02:22:56,559 --> 02:23:02,079 okay seven o'clock will be where the 2486 02:22:59,120 --> 02:23:03,680 slider draws the value of zero 2487 02:23:02,079 --> 02:23:05,359 five o'clock will be where it draws the 2488 02:23:05,359 --> 02:23:09,600 start by setting up some angles that 2489 02:23:07,840 --> 02:23:12,478 represent seven o'clock and five o'clock 2490 02:23:09,600 --> 02:23:14,640 and remember that twelve o'clock is zero 2491 02:23:12,478 --> 02:23:20,000 degrees and we have to use radians here 2492 02:23:14,639 --> 02:23:20,000 which is annoying auto start ang 2493 02:23:20,079 --> 02:23:25,840 equals degrees to radians thank 2494 02:23:23,120 --> 02:23:27,359 thankfully that function exists okay we 2495 02:23:30,959 --> 02:23:34,879 all right so this is 12 this is gonna be 2496 02:23:34,879 --> 02:23:40,318 and then we're gonna go halfway uh so 2497 02:23:38,318 --> 02:23:42,239 it's more like 7 30 not seven 2498 02:23:40,318 --> 02:23:43,359 but either way you know like this this 2499 02:23:43,359 --> 02:23:49,040 this is six o'clock so 7 30 is 2500 02:23:46,398 --> 02:23:49,439 45 degrees away okay that's the start 2501 02:23:49,439 --> 02:23:53,680 our end angle is going to be going this 2502 02:23:51,760 --> 02:23:54,960 way and because we need it to be bigger 2503 02:23:54,959 --> 02:23:58,639 one circle around which is two pi and 2504 02:24:06,398 --> 02:24:13,199 uh this same value but going 2505 02:24:10,079 --> 02:24:14,079 the other way and then added a um added 2506 02:24:17,120 --> 02:24:21,040 draw rotary slider function wants a 2507 02:24:21,040 --> 02:24:24,479 passed to it so we will use the sliders 2508 02:24:24,478 --> 02:24:27,760 and then even though we haven't 2509 02:24:25,439 --> 02:24:29,280 implemented this let's prepare for this 2510 02:24:27,760 --> 02:24:31,280 and just assume we'll be drawing the 2511 02:24:29,280 --> 02:24:34,640 rotary part of the slider inside the 2512 02:24:31,280 --> 02:24:37,359 slider bounce so auto slider bounds 2513 02:24:34,639 --> 02:24:38,079 equals get slider bounce okay let's 2514 02:24:38,079 --> 02:24:44,318 now all right let's put that right here 2515 02:24:42,000 --> 02:24:46,000 i remember this is const oh let's just 2516 02:24:44,318 --> 02:24:46,959 make it return local bounds for right 2517 02:24:46,959 --> 02:24:51,599 adjust this later so we have some basic 2518 02:24:49,840 --> 02:24:52,559 information we can call the look and 2519 02:24:55,760 --> 02:25:00,239 and now draw rotary slider and now we 2520 02:24:58,719 --> 02:25:01,119 just start filling this in okay first 2521 02:25:01,120 --> 02:25:06,000 for the graphic context x is going to be 2522 02:25:09,600 --> 02:25:16,960 same for the width same for the height 2523 02:25:12,639 --> 02:25:18,959 our slider position proportional 2524 02:25:16,959 --> 02:25:20,799 if you don't forget that we said we 2525 02:25:18,959 --> 02:25:21,438 needed a normalized value here so we're 2526 02:25:21,439 --> 02:25:24,880 map the slider's value we're going to 2527 02:25:24,879 --> 02:25:29,119 slider's value from the start of the 2528 02:25:29,120 --> 02:25:32,960 to the end of the range and we need to 2529 02:25:32,959 --> 02:25:39,519 to 1 all right and then our start angle 2530 02:25:36,639 --> 02:25:41,199 we already have that and our end angle 2531 02:25:44,398 --> 02:25:47,760 that's an annoying function to look at 2532 02:25:46,478 --> 02:25:49,358 and fill in all the blanks if you don't 2533 02:25:49,359 --> 02:25:52,800 all right the important thing is this 2534 02:25:50,959 --> 02:25:53,759 one this line right here this is where 2535 02:25:53,760 --> 02:25:59,680 our sliders this is where we turn our 2536 02:25:56,239 --> 02:26:01,680 sliders value into a normalized value 2537 02:25:59,680 --> 02:26:03,680 so now that we've done this we can 2538 02:26:01,680 --> 02:26:06,479 implement the draw rotary slider 2539 02:26:03,680 --> 02:26:09,760 function let's do that up here void 2540 02:26:06,478 --> 02:26:11,438 look and feel draw rotary come on 2541 02:26:11,439 --> 02:26:15,120 all right let's put that all on its own 2542 02:26:15,120 --> 02:26:20,720 all right we'll do the same using j uh 2543 02:26:17,600 --> 02:26:21,439 namespace juice trick here's what we're 2544 02:26:21,439 --> 02:26:25,200 in this draw rotary slider class we're 2545 02:26:25,200 --> 02:26:27,920 and it's going to act as the slider 2546 02:26:26,478 --> 02:26:29,279 background we're going to draw a border 2547 02:26:29,280 --> 02:26:33,359 and we're going to convert the sliders 2548 02:26:33,359 --> 02:26:38,159 angle in radians and that's going to be 2549 02:26:36,239 --> 02:26:39,760 between the rotary start angle and the 2550 02:26:39,760 --> 02:26:43,439 we're going to create a small vertical 2551 02:26:41,200 --> 02:26:44,560 rectangle and then we're going to rotate 2552 02:26:44,559 --> 02:26:49,600 in radians and then draw it okay so 2553 02:26:49,600 --> 02:26:52,640 before we do anything else we need a 2554 02:26:56,318 --> 02:27:01,519 height okay so let's first create some 2555 02:26:59,120 --> 02:27:04,240 circles that represent the rotariness 2556 02:27:01,520 --> 02:27:05,359 of the slider now for these colors i 2557 02:27:08,559 --> 02:27:12,398 and it lets me you know just pick some 2558 02:27:12,398 --> 02:27:16,079 you know maybe i like this yellow color 2559 02:27:13,920 --> 02:27:18,239 maybe i like this greenish color 2560 02:27:16,079 --> 02:27:19,600 or this color right here that's what i 2561 02:27:18,239 --> 02:27:21,840 use to pick my colors so i'm just going 2562 02:27:21,840 --> 02:27:26,000 and use them here so g dot set color 2563 02:27:26,719 --> 02:27:30,159 i don't know what that looks like right 2564 02:27:30,159 --> 02:27:33,760 first sketched this project out i liked 2565 02:27:33,760 --> 02:27:38,000 after i found it somewhere okay so g dot 2566 02:27:38,000 --> 02:27:41,040 and this is where we want fill the 2567 02:27:41,040 --> 02:27:43,760 let's do the same thing again with a 2568 02:27:42,398 --> 02:27:45,119 different color and we're going to draw 2569 02:27:43,760 --> 02:27:45,840 the ellipse which is going to give us 2570 02:27:45,840 --> 02:27:50,079 we said we were going to create let's 2571 02:27:48,559 --> 02:27:51,680 take a look at that we'll just see some 2572 02:27:51,680 --> 02:27:56,880 cool circles let's make a narrow 2573 02:27:55,040 --> 02:27:58,000 rectangle that goes from the center of 2574 02:27:58,000 --> 02:28:02,398 up to the 12 o'clock position now if we 2575 02:28:02,398 --> 02:28:06,318 something that's going to be drawn we 2576 02:28:06,318 --> 02:28:09,680 inside of a path so let's create a path 2577 02:28:09,680 --> 02:28:13,600 and i like using the rectangle member 2578 02:28:13,600 --> 02:28:18,318 rectangles as opposed to using the 2579 02:28:18,318 --> 02:28:21,519 that takes an x y width and height 2580 02:28:21,520 --> 02:28:25,840 easier to visualize mentally where 2581 02:28:25,840 --> 02:28:32,960 okay so i'm gonna do that rectangle 2582 02:28:32,959 --> 02:28:36,318 left and the right are gonna be a couple 2583 02:28:36,318 --> 02:28:39,519 of the center so we can do r dot set 2584 02:28:43,760 --> 02:28:48,239 and then two pixels off of that we can 2585 02:28:48,239 --> 02:28:52,478 center dot get x two pixels to the right 2586 02:28:52,478 --> 02:28:55,840 and then we'll just make the top be the 2587 02:28:55,840 --> 02:29:00,639 top will be the top and the bottom will 2588 02:28:57,280 --> 02:29:03,760 be the center okay so r dot set top 2589 02:29:00,639 --> 02:29:08,398 this is going to be bounds dot get y 2590 02:29:03,760 --> 02:29:12,000 and then r dot set bottom is going to be 2591 02:29:08,398 --> 02:29:15,199 center dot get y now let's add it to our 2592 02:29:15,200 --> 02:29:18,720 now we get ready to rotate so the first 2593 02:29:18,719 --> 02:29:23,199 is that this thing is less than this 2594 02:29:21,600 --> 02:29:25,120 thing otherwise we'll get some weird 2595 02:29:23,200 --> 02:29:26,399 explosions so let's just add a quick j 2596 02:29:26,398 --> 02:29:30,000 rotary start angle it's less than rotary 2597 02:29:30,000 --> 02:29:35,359 angle this is what i was saying of how 2598 02:29:35,359 --> 02:29:41,359 a full cycle to it because otherwise we 2599 02:29:38,478 --> 02:29:44,398 would have 180 minus 45 as our start 2600 02:29:41,359 --> 02:29:45,040 or 180 plus 45 which is like 225 or 2601 02:29:45,040 --> 02:29:49,280 and then this one would give us like um 2602 02:29:49,280 --> 02:29:53,120 less than this it becomes a problem when 2603 02:29:53,120 --> 02:29:56,960 so now we need to map our slider's 2604 02:29:56,959 --> 02:30:04,959 angle right so we've got autoslider 2605 02:30:04,959 --> 02:30:08,559 are we are mapping from our slider 2606 02:30:11,680 --> 02:30:17,120 and we're going to map it from i'm sorry 2607 02:30:17,120 --> 02:30:20,240 that's one dot f our target major in is 2608 02:30:20,239 --> 02:30:23,680 our target range min is going to be the 2609 02:30:23,680 --> 02:30:28,559 rotary start angle and our end range is 2610 02:30:28,559 --> 02:30:34,079 end angle okay so we are mapping 2611 02:30:31,680 --> 02:30:35,120 our normalized slider value to be 2612 02:30:35,120 --> 02:30:39,120 these two rotary positions which we 2613 02:30:39,120 --> 02:30:42,160 we can rotate the narrow rectangle to 2614 02:30:42,159 --> 02:30:48,239 radian angle using an afine transform 2615 02:30:45,359 --> 02:30:49,439 and we have to do it around the center 2616 02:30:49,439 --> 02:30:53,359 all right so p dot apply transform 2617 02:30:53,359 --> 02:30:57,520 a fine transform we're going to rotate 2618 02:30:57,520 --> 02:31:01,520 we want the one that allows us to rotate 2619 02:30:59,439 --> 02:31:04,880 it around a particular location 2620 02:31:01,520 --> 02:31:06,319 we've got our angle in radians and our 2621 02:31:06,318 --> 02:31:13,680 center dot get x center dot get y 2622 02:31:10,879 --> 02:31:15,839 now we just need to draw it let's build 2623 02:31:15,840 --> 02:31:19,439 just remember you know they're not we're 2624 02:31:17,840 --> 02:31:22,079 not we're just drawing them within their 2625 02:31:22,318 --> 02:31:27,199 okay but it is doing it and the when the 2626 02:31:27,200 --> 02:31:30,640 the notch is straight up and down so 2627 02:31:30,639 --> 02:31:35,279 cool all right so as i said let's see 2628 02:31:33,520 --> 02:31:36,000 this is where it's at the five o'clock 2629 02:31:36,000 --> 02:31:39,600 here's where it's at the seven o'clock 2630 02:31:39,600 --> 02:31:43,040 awesome okay so they look a little wonky 2631 02:31:43,040 --> 02:31:48,479 that next but they are working 2632 02:31:46,159 --> 02:31:49,200 okay we've implemented a customized look 2633 02:31:49,200 --> 02:31:52,560 the next thing i would like to do is add 2634 02:31:52,559 --> 02:31:57,279 showing the parameters value next 2635 02:31:55,600 --> 02:31:59,359 okay we'll figure out that bounding 2636 02:31:59,359 --> 02:32:06,720 let's make a commit of that added basic 2637 02:32:03,280 --> 02:32:08,159 slider visuals here's where we 2638 02:32:08,159 --> 02:32:12,318 implementations into declarations 2639 02:32:10,318 --> 02:32:13,680 then here's where we implemented our 2640 02:32:13,680 --> 02:32:16,800 paint function which calls the rotary 2641 02:32:16,799 --> 02:32:20,159 and then here in the rotary sliders 2642 02:32:20,159 --> 02:32:26,478 the things okay okay let's start by 2643 02:32:24,639 --> 02:32:27,439 drawing the slider bounds and start 2644 02:32:27,439 --> 02:32:30,479 slider bounds function until it gives us 2645 02:32:30,478 --> 02:32:35,199 usable size okay so let's go to where 2646 02:32:33,439 --> 02:32:38,479 we're getting our slider bounds 2647 02:32:38,478 --> 02:32:41,840 draw the slider bounds as well as our 2648 02:32:41,840 --> 02:32:48,318 g dot set color red and we'll draw our 2649 02:32:45,920 --> 02:32:51,520 local bounds and then we'll use a 2650 02:32:48,318 --> 02:32:53,519 different color for the slider bounds 2651 02:32:51,520 --> 02:32:55,680 now uh before we start tweaking this 2652 02:32:53,520 --> 02:32:58,000 let's just shrink this a little bit 2653 02:32:55,680 --> 02:32:59,359 okay we're gonna want a square so our 2654 02:32:59,359 --> 02:33:04,960 circles so let's do auto size equals 2655 02:33:02,639 --> 02:33:07,358 um and we'll find the minimum dimension 2656 02:33:04,959 --> 02:33:08,639 of whatever bounding box is returned to 2657 02:33:08,639 --> 02:33:13,279 all right so we've got our bounds dot 2658 02:33:10,398 --> 02:33:14,959 get width balance don't get height 2659 02:33:13,280 --> 02:33:17,120 oh we need to get rid of this line 2660 02:33:14,959 --> 02:33:20,559 that's right okay so auto bounds 2661 02:33:17,120 --> 02:33:22,079 equals get local bounce so now 2662 02:33:20,559 --> 02:33:23,600 we know we're going to display some text 2663 02:33:23,600 --> 02:33:28,000 so let's shrink our bounding box by that 2664 02:33:28,000 --> 02:33:33,439 let's shrink our size our square size by 2665 02:33:33,439 --> 02:33:40,239 minus equals get text height do it 2666 02:33:36,639 --> 02:33:40,719 times two all right now we just need to 2667 02:33:40,719 --> 02:33:43,920 towards the top of our component we need 2668 02:33:43,920 --> 02:33:47,600 slider bounds towards the top so let's 2669 02:33:47,600 --> 02:33:52,239 our size but the top of it is it's so 2670 02:33:50,719 --> 02:33:53,039 that it's positioned at the top of our 2671 02:33:56,398 --> 02:34:01,439 r dot set size give it a size of 2672 02:33:59,760 --> 02:34:03,040 give it a width and height of size so 2673 02:34:03,040 --> 02:34:06,640 and then we need to set um i don't know 2674 02:34:06,639 --> 02:34:10,478 x and y to give it for the actual 2675 02:34:08,398 --> 02:34:13,760 position because that's based on the 2676 02:34:10,478 --> 02:34:14,959 upper left corner but i can specify 2677 02:34:13,760 --> 02:34:16,000 where the center is and that's not going 2678 02:34:16,000 --> 02:34:21,200 so i'm going to do that r dot set center 2679 02:34:19,120 --> 02:34:22,160 i know i want that to be bounds dot get 2680 02:34:22,159 --> 02:34:24,799 so that's going to put it in the center 2681 02:34:23,680 --> 02:34:28,318 it's going to put the center of this 2682 02:34:24,799 --> 02:34:31,679 rectangle in the center of my component 2683 02:34:28,318 --> 02:34:32,719 and then i can set the y position 2684 02:34:32,719 --> 02:34:37,920 set y zero or just below the top i'm not 2685 02:34:36,559 --> 02:34:39,439 going to do zero i'm going to do two so 2686 02:34:37,920 --> 02:34:40,478 it's two pixels below the top of the 2687 02:34:40,478 --> 02:34:44,879 and the sent the center of our rectangle 2688 02:34:43,680 --> 02:34:45,840 is going to be in the center of our 2689 02:34:45,840 --> 02:34:49,680 now let's just return it let's build and 2690 02:34:49,680 --> 02:34:52,880 boom circles at the top slightly below 2691 02:34:52,879 --> 02:34:56,398 and they're in a square bounding box 2692 02:34:56,398 --> 02:35:00,639 all right let's make a commit of that 2693 02:35:04,000 --> 02:35:10,719 circles oh let's get rid of this 2694 02:35:07,520 --> 02:35:12,399 um this line right there let's amend 2695 02:35:12,398 --> 02:35:15,920 oh wait no i don't want to amend it 2696 02:35:15,920 --> 02:35:20,799 there we go okay let's display the 2697 02:35:20,799 --> 02:35:24,239 next we will keep the circles for right 2698 02:35:24,239 --> 02:35:27,680 look and feel we're gonna keep these 2699 02:35:27,680 --> 02:35:31,680 uh but for now we need uh the text 2700 02:35:30,159 --> 02:35:32,959 height from our slider as well as the 2701 02:35:32,959 --> 02:35:37,279 so we already had some stubs for these 2702 02:35:37,280 --> 02:35:42,319 when we decided we were to do 2703 02:35:40,318 --> 02:35:43,760 get text height and then get display 2704 02:35:42,318 --> 02:35:45,119 string right because we wanted to be 2705 02:35:43,760 --> 02:35:47,040 able to figure out you know what do we 2706 02:35:47,040 --> 02:35:50,080 so in order for us to call that we need 2707 02:35:50,079 --> 02:35:54,079 get a rotary slider with labels out of 2708 02:35:54,079 --> 02:35:57,680 so to do that we are going to have to 2709 02:35:57,680 --> 02:36:01,840 okay so after we get our um after we 2710 02:36:01,840 --> 02:36:06,840 we'll do a cast all right if we can cast 2711 02:36:05,359 --> 02:36:08,559 it then we know we can call those 2712 02:36:06,840 --> 02:36:09,680 functions all right so this is where we 2713 02:36:09,680 --> 02:36:14,239 do this put that there we're going to 2714 02:36:12,799 --> 02:36:15,920 need our same path and our same 2715 02:36:15,920 --> 02:36:19,200 all right and then actually since our 2716 02:36:17,520 --> 02:36:20,880 text is going to be in the center we 2717 02:36:19,200 --> 02:36:22,079 need to adjust the bottom of our narrow 2718 02:36:22,079 --> 02:36:26,079 not cover it up so it's going to be 2719 02:36:29,680 --> 02:36:33,040 yeah the bottom it's no longer going to 2720 02:36:31,200 --> 02:36:34,000 be the center it's going to be the 2721 02:36:34,000 --> 02:36:37,280 uh sorry it's not gonna going to be the 2722 02:36:37,280 --> 02:36:41,760 bounding box oh yes sorry it's going to 2723 02:36:39,680 --> 02:36:43,359 be um it's going to be where our center 2724 02:36:41,760 --> 02:36:44,719 is and then we're going to subtract the 2725 02:36:44,719 --> 02:36:48,879 which will put us back towards the top 2726 02:36:48,879 --> 02:36:51,920 get height is the bottom okay so we're 2727 02:36:51,920 --> 02:36:55,600 and we're going to go uh up by 2728 02:36:55,600 --> 02:36:58,640 some text height amount okay so we'll 2729 02:37:08,879 --> 02:37:12,959 we'll have to see how it looks okay all 2730 02:37:11,439 --> 02:37:15,120 right so this is where i'm gonna change 2731 02:37:12,959 --> 02:37:16,959 this from being a regular rectangle 2732 02:37:15,120 --> 02:37:18,640 i'm gonna add a rounded rectangle p dot 2733 02:37:18,639 --> 02:37:23,760 you know let's dial it up a little bit 2734 02:37:20,879 --> 02:37:25,119 our let's do a corner size of two 2735 02:37:23,760 --> 02:37:27,600 all right now this is where we do all of 2736 02:37:27,600 --> 02:37:32,640 so now let's make a now let's make a 2737 02:37:30,719 --> 02:37:34,318 little rectangle that's a little bit 2738 02:37:34,318 --> 02:37:38,478 and a little bit taller than our text is 2739 02:37:38,478 --> 02:37:41,599 have a nice we know how roughly how much 2740 02:37:41,600 --> 02:37:45,680 we're going to need to display so let's 2741 02:37:43,120 --> 02:37:47,520 make a bounding box that fits around it 2742 02:37:45,680 --> 02:37:49,040 and then we're going to put that right 2743 02:37:49,040 --> 02:37:52,240 slider okay so let's first get let's 2744 02:37:52,239 --> 02:37:56,559 set our font accordingly and we're going 2745 02:37:55,040 --> 02:37:58,160 to just use that text height as the font 2746 02:37:56,559 --> 02:38:00,398 it's going to keep displaying whatever 2747 02:37:58,159 --> 02:38:01,840 default font is currently being used 2748 02:38:01,840 --> 02:38:05,680 get text height all right this is going 2749 02:38:05,680 --> 02:38:08,720 this is going to use the default font at 2750 02:38:08,719 --> 02:38:13,559 all right now let's get our text and 2751 02:38:11,120 --> 02:38:16,240 then let's get our string width 2752 02:38:16,239 --> 02:38:22,478 equals g dot get current font 2753 02:38:22,478 --> 02:38:26,000 okay that tells us how wide we are all 2754 02:38:26,000 --> 02:38:32,719 same rectangle so r dot set size 2755 02:38:30,079 --> 02:38:33,760 we're going to go str width a little bit 2756 02:38:33,760 --> 02:38:42,398 and then the font height our swl 2757 02:38:38,398 --> 02:38:44,879 get text height oops get text height 2758 02:38:42,398 --> 02:38:46,478 a little bit taller than that okay so 2759 02:38:46,478 --> 02:38:51,438 rectangle r is now has this bound it's 2760 02:38:49,760 --> 02:38:52,800 it's gonna basically be a little bit 2761 02:38:52,799 --> 02:38:57,679 the bounding box for our text okay we 2762 02:38:55,760 --> 02:39:00,398 need to just set the center of it to be 2763 02:38:57,680 --> 02:39:04,880 the center of our bounds right here 2764 02:39:04,879 --> 02:39:08,159 that's this guy right here or if we 2765 02:39:06,959 --> 02:39:10,239 don't trust that we can always write 2766 02:39:10,239 --> 02:39:14,239 all right and then let's just make a 2767 02:39:11,920 --> 02:39:18,318 black background for right now 2768 02:39:18,318 --> 02:39:23,119 and then uh we're gonna fill it in uh g 2769 02:39:26,398 --> 02:39:29,519 let's use white text and just paint our 2770 02:39:29,520 --> 02:39:36,880 so g dot set color colors white 2771 02:39:36,879 --> 02:39:42,478 our text inside of r and r is a float 2772 02:39:42,478 --> 02:39:46,559 get it to um an int to let's see what do 2773 02:39:46,559 --> 02:39:51,039 good enough and then we want it centered 2774 02:39:54,879 --> 02:39:59,039 now it's not going to build because we 2775 02:39:57,280 --> 02:40:00,079 haven't implemented yet display string 2776 02:40:00,079 --> 02:40:07,280 okay so we need to implement that next 2777 02:40:04,318 --> 02:40:09,119 all right let's put this near where um 2778 02:40:09,120 --> 02:40:12,880 build our slider bounds all right so 2779 02:40:12,879 --> 02:40:19,759 rotary slider get display string 2780 02:40:16,879 --> 02:40:20,000 this was const if you remember and we 2781 02:40:23,279 --> 02:40:26,319 string and we're just going to return 2782 02:40:26,318 --> 02:40:31,278 let's build and test we should see a 2783 02:40:29,359 --> 02:40:32,720 rectangle in all black with white text 2784 02:40:31,279 --> 02:40:36,720 in the center of every slider 2785 02:40:32,719 --> 02:40:39,840 showing some numeric value okay cool 2786 02:40:40,318 --> 02:40:44,559 it's working as expected all right this 2787 02:40:44,559 --> 02:40:48,079 three these are the indexes in that 2788 02:40:48,079 --> 02:40:52,318 of choices we created at the very 2789 02:40:52,318 --> 02:40:59,680 alright and here's our here's our gain 2790 02:40:56,719 --> 02:41:02,079 for our slider okay cool so we are not 2791 02:40:59,680 --> 02:41:04,159 seeing suffixes but we are seeing our 2792 02:41:02,079 --> 02:41:05,760 values okay the only thing we're not 2793 02:41:04,159 --> 02:41:08,959 seeing is the proper slope okay we 2794 02:41:08,959 --> 02:41:13,759 we will deal with that next let's make a 2795 02:41:17,840 --> 02:41:23,680 cool okay we are trying to represent 2796 02:41:21,040 --> 02:41:24,640 two parameter types a float param and a 2797 02:41:24,639 --> 02:41:27,680 and the choice param has a list that we 2798 02:41:27,680 --> 02:41:34,479 directly if our parameter is a choice 2799 02:41:31,840 --> 02:41:36,159 then let's just use that choice param so 2800 02:41:36,159 --> 02:41:44,719 and we can do if auto choice param 2801 02:41:39,920 --> 02:41:48,318 equals dynamic cast um let's see 2802 02:41:48,318 --> 02:41:53,039 if we can convert our ranged audio 2803 02:41:50,478 --> 02:41:56,799 parameter to an audio parameter choice 2804 02:41:53,040 --> 02:41:59,200 then just return that choice param get 2805 02:41:56,799 --> 02:42:01,039 uh what's it called get current choice 2806 02:42:02,398 --> 02:42:06,719 parameters we need to amend our suffix 2807 02:42:06,719 --> 02:42:11,119 also i want to truncate the hertz value 2808 02:42:08,799 --> 02:42:12,159 if the frequency is over 1000 so that it 2809 02:42:12,159 --> 02:42:16,079 instead so first we need a string object 2810 02:42:16,079 --> 02:42:20,559 and if we and then we need to specify if 2811 02:42:17,920 --> 02:42:23,760 we're going to add uh the k or not 2812 02:42:20,559 --> 02:42:25,199 so let's assume we are not going to okay 2813 02:42:23,760 --> 02:42:27,359 now i don't like to make guesses about 2814 02:42:25,200 --> 02:42:28,479 what type of derived class my parameter 2815 02:42:28,478 --> 02:42:32,239 so i'm going to use a cast here to check 2816 02:42:30,318 --> 02:42:33,039 if it's actually an audio parameter 2817 02:42:33,040 --> 02:42:36,160 now i know i haven't added any other 2818 02:42:36,159 --> 02:42:40,719 types in this project but just in case 2819 02:42:38,478 --> 02:42:42,639 i'm going to add a little j assert 2820 02:42:40,719 --> 02:42:44,079 in case one happens to sneak in later in 2821 02:42:50,959 --> 02:42:54,318 if you recall the values that our 2822 02:42:54,318 --> 02:42:58,799 you know that the hertz parameter is the 2823 02:42:56,239 --> 02:43:01,199 only one that can possibly get over 2824 02:42:58,799 --> 02:43:02,079 1000 so that means we can just check if 2825 02:43:02,079 --> 02:43:06,719 over that and then divide by a thousand 2826 02:43:06,719 --> 02:43:09,840 once we have that then we can say yes 2827 02:43:09,840 --> 02:43:14,159 k to the suffix and we can convey that 2828 02:43:12,159 --> 02:43:17,119 with that boolean flag we used earlier 2829 02:43:14,159 --> 02:43:18,159 so if value uh first we need to get our 2830 02:43:18,159 --> 02:43:25,279 float value equals getvalue if 2831 02:43:22,079 --> 02:43:26,719 our value is greater than um if our 2832 02:43:30,079 --> 02:43:35,120 then um this is when we want to display 2833 02:43:32,478 --> 02:43:38,959 it as kilohertz so we will say 2834 02:43:38,959 --> 02:43:43,839 divided by a thousand so if it's 2835 02:43:42,000 --> 02:43:45,279 um if the value is one thousand hertz 2836 02:43:49,520 --> 02:43:54,479 true okay now the string class 2837 02:43:52,559 --> 02:43:56,079 in juice has a constructor which lets 2838 02:43:56,079 --> 02:43:59,120 a floating point number into a string 2839 02:43:57,680 --> 02:44:01,120 and one of the parameters is how many 2840 02:44:01,120 --> 02:44:04,399 now if i'm displaying a value as 2841 02:44:04,398 --> 02:44:07,439 two decimal places we already know that 2842 02:44:07,439 --> 02:44:11,520 one thousand and one divided by a 2843 02:44:09,279 --> 02:44:14,239 thousand is going to give us 2844 02:44:11,520 --> 02:44:15,680 let's see one thousand one thousand one 2845 02:44:15,680 --> 02:44:19,359 will give us one point zero zero i don't 2846 02:44:18,000 --> 02:44:21,359 want to see that okay i just want to see 2847 02:44:21,359 --> 02:44:26,000 so according to this constructor let me 2848 02:44:26,000 --> 02:44:31,520 this one right here float value okay 2849 02:44:29,439 --> 02:44:33,120 it says number of decimal places if this 2850 02:44:33,120 --> 02:44:37,120 the number will be formatted using that 2851 02:44:37,120 --> 02:44:41,120 adding trailing zeros if required if the 2852 02:44:41,120 --> 02:44:44,240 the number will be formatted using the c 2853 02:44:44,239 --> 02:44:48,959 standard library default format which 2854 02:44:46,478 --> 02:44:49,519 uses scientific notation for large and 2855 02:44:49,520 --> 02:44:55,200 numbers according to the documentation 2856 02:44:52,959 --> 02:44:56,959 if you go back over here according to 2857 02:44:55,200 --> 02:44:58,880 the documentation for this constructor 2858 02:44:56,959 --> 02:45:00,000 if a 0 is provided for the number of 2859 02:45:00,000 --> 02:45:05,200 the number will be formatted uh using 2860 02:45:02,959 --> 02:45:06,719 the stl with however many decimal places 2861 02:45:05,200 --> 02:45:07,520 are needed so this will work out when we 2862 02:45:07,520 --> 02:45:13,279 decibels or quality versus the hertz 2863 02:45:10,879 --> 02:45:15,119 okay so we're going to do str equals 2864 02:45:15,120 --> 02:45:20,399 um where is that one it's down here 2865 02:45:20,398 --> 02:45:25,519 this one float okay our float val 2866 02:45:23,760 --> 02:45:27,760 for our number of decimal places if we 2867 02:45:27,760 --> 02:45:31,120 we want to see two decimal places 2868 02:45:31,120 --> 02:45:38,240 stl formatting is will be just fine 2869 02:45:34,799 --> 02:45:40,159 so add add k for adding the k give me 2870 02:45:40,159 --> 02:45:45,279 give me however many are actually needed 2871 02:45:42,239 --> 02:45:48,639 to display the parameters value 2872 02:45:45,279 --> 02:45:50,960 all right now the final thing is that we 2873 02:45:48,639 --> 02:45:53,680 had said that the quality property 2874 02:45:50,959 --> 02:45:55,679 does not have any units which means we 2875 02:45:53,680 --> 02:45:56,000 did not supply a suffix if you go back 2876 02:45:56,000 --> 02:45:59,040 here you'll see what i'm talking about 2877 02:45:59,040 --> 02:46:04,000 hertz and decibels have a suffix but 2878 02:46:00,879 --> 02:46:07,278 quality does not have a suffix 2879 02:46:07,279 --> 02:46:10,880 let's add a space after the number and 2880 02:46:14,159 --> 02:46:21,200 we can do str um add the space 2881 02:46:18,318 --> 02:46:23,119 and then um if we are doing a hertz 2882 02:46:21,200 --> 02:46:24,240 value which is over one kilohertz let's 2883 02:46:27,600 --> 02:46:35,600 add that little k like that now we just 2884 02:46:30,879 --> 02:46:38,639 add the suffix and then we're done 2885 02:46:38,639 --> 02:46:46,398 let's run that and check it out 2886 02:46:42,478 --> 02:46:48,239 boom 121hz and let's raise that to be 2887 02:46:53,359 --> 02:46:57,200 awesome okay and then these guys 2888 02:46:58,318 --> 02:47:04,159 cool all right i'm not too mad about 2889 02:47:02,159 --> 02:47:07,279 when it's showing a negative and 2890 02:47:07,279 --> 02:47:11,359 it's not showing it the rectangle is 2891 02:47:09,279 --> 02:47:13,040 changing size it's you know 2892 02:47:11,359 --> 02:47:14,559 that's just like a minor detail that we 2893 02:47:13,040 --> 02:47:15,359 don't need to fix and now this is 2894 02:47:15,359 --> 02:47:21,120 the correct slope values so that's cool 2895 02:47:19,439 --> 02:47:23,359 all right let's ditch those bounding 2896 02:47:21,120 --> 02:47:24,880 boxes that we're showing the rectangles 2897 02:47:23,359 --> 02:47:27,200 it's these guys right here i'm gonna 2898 02:47:24,879 --> 02:47:28,719 leave them in as comments though 2899 02:47:27,200 --> 02:47:30,240 um because you know if we ever need to 2900 02:47:30,239 --> 02:47:34,959 good to just you know it makes it easy 2901 02:47:32,478 --> 02:47:36,398 to uncomment them and display them later 2902 02:47:34,959 --> 02:47:38,639 let's take a look one more time and see 2903 02:47:36,398 --> 02:47:40,239 what we've got all right that's nice and 2904 02:47:40,239 --> 02:47:46,239 cool let's make a commit of that 2905 02:47:43,439 --> 02:47:48,559 alright so implemented implemented 2906 02:47:46,239 --> 02:47:51,760 displaying the parameter value 2907 02:47:52,239 --> 02:47:57,760 cool let's add the labels next that will 2908 02:47:55,600 --> 02:47:59,600 show the minimum and maximum values that 2909 02:47:59,600 --> 02:48:02,880 i would like the minimum value to be 2910 02:48:01,279 --> 02:48:05,680 drawn right outside of that 2911 02:48:02,879 --> 02:48:06,799 seven o'clock position on the slider and 2912 02:48:06,799 --> 02:48:11,039 to be drawn outside of the five o'clock 2913 02:48:08,959 --> 02:48:12,879 position here is how i have decided to 2914 02:48:12,879 --> 02:48:16,239 okay we're going to have a simple data 2915 02:48:14,398 --> 02:48:17,119 structure which will hold a normalized 2916 02:48:17,120 --> 02:48:20,880 and the string that should be positioned 2917 02:48:20,879 --> 02:48:26,478 okay so we'll put that let's see let me 2918 02:48:26,478 --> 02:48:30,959 all right we're going to put that right 2919 02:48:30,959 --> 02:48:34,959 label position give it that normalized 2920 02:48:34,959 --> 02:48:38,000 and then the string that's going to get 2921 02:48:38,000 --> 02:48:40,639 all right now that we have this 2922 02:48:38,879 --> 02:48:42,398 structure we can just give ourselves an 2923 02:48:42,398 --> 02:48:46,000 and then all we have to do is add some 2924 02:48:43,920 --> 02:48:48,159 values to that array and then draw them 2925 02:48:46,000 --> 02:48:50,079 in our paint function all right let's 2926 02:48:50,079 --> 02:48:54,639 paint function okay we're going to draw 2927 02:48:54,639 --> 02:48:58,159 so let's see what we need to do is 2928 02:48:56,559 --> 02:49:01,278 create a bounding box that can 2929 02:48:58,159 --> 02:49:03,119 encompass our text and then put the 2930 02:49:01,279 --> 02:49:05,760 center of that bounding box at whatever 2931 02:49:03,120 --> 02:49:08,399 normalized position we decided 2932 02:49:05,760 --> 02:49:09,840 we have decided on around our sliders 2933 02:49:09,840 --> 02:49:13,200 once we have that bounding box we can 2934 02:49:11,520 --> 02:49:17,040 just use the graphics function 2935 02:49:13,200 --> 02:49:20,240 draw fitted text like we did right here 2936 02:49:17,040 --> 02:49:22,240 we can do the same thing to we can do 2937 02:49:20,239 --> 02:49:23,199 that to draw our label inside the 2938 02:49:23,200 --> 02:49:27,279 so first things first let's get the 2939 02:49:27,279 --> 02:49:34,000 our slider bounce auto center 2940 02:49:30,639 --> 02:49:35,920 equals slider bounds dot to float 2941 02:49:34,000 --> 02:49:37,520 dot get center okay we want this in 2942 02:49:35,920 --> 02:49:38,799 floating point numbers and then let's 2943 02:49:38,799 --> 02:49:46,079 auto radius equals slider bounds 2944 02:49:42,559 --> 02:49:47,439 dot get width and then give me half of 2945 02:49:47,439 --> 02:49:51,920 okay now let's set up the text color and 2946 02:49:51,920 --> 02:49:56,239 i'm going to use the same text color uh 2947 02:49:55,040 --> 02:49:57,840 no i'm gonna use a different text color 2948 02:49:56,239 --> 02:49:58,719 i'm gonna use like a greenish looking 2949 02:49:58,719 --> 02:50:02,318 again i figured this out using that 2950 02:50:02,318 --> 02:50:06,239 color meter app this thing right here i 2951 02:50:04,318 --> 02:50:09,119 found a nice green that i liked 2952 02:50:06,239 --> 02:50:10,000 and just jotted down the rgb values 2953 02:50:10,000 --> 02:50:16,920 g dot set color i've got a value of zero 2954 02:50:16,920 --> 02:50:22,318 172 right here for that and then 2955 02:50:19,920 --> 02:50:23,439 one for the blue and then we need to set 2956 02:50:23,439 --> 02:50:27,279 okay we're going to use the default font 2957 02:50:27,279 --> 02:50:31,200 we need to iterate through our labels so 2958 02:50:39,279 --> 02:50:44,880 equals zero i is less than num choices 2959 02:50:42,639 --> 02:50:47,119 plus i all right now let's convert that 2960 02:50:44,879 --> 02:50:50,799 normalized position into a radian 2961 02:50:50,799 --> 02:50:55,039 labels okay and we want to make sure 2962 02:50:53,439 --> 02:50:57,120 that it's between zero and one just in 2963 02:50:57,120 --> 02:51:01,120 all right now let's j-map it like we j 2964 02:51:01,120 --> 02:51:04,880 this thing right here actually we can 2965 02:51:04,879 --> 02:51:08,959 auto angle equals this thing and this is 2966 02:51:08,959 --> 02:51:13,438 position and our start ang is going to 2967 02:51:13,439 --> 02:51:16,840 um what we set up here same for the 2968 02:51:16,840 --> 02:51:23,279 end okay now we can use one of the 2969 02:51:20,318 --> 02:51:24,398 point class member functions uh 2970 02:51:27,439 --> 02:51:30,880 i'll show you the member function get 2971 02:51:29,040 --> 02:51:32,800 point on circumference we can use this 2972 02:51:32,799 --> 02:51:36,239 to find the center point we will use for 2973 02:51:36,239 --> 02:51:40,639 this particular radian angle we have our 2974 02:51:40,639 --> 02:51:47,358 so center dot get point on circumference 2975 02:51:50,719 --> 02:51:54,478 yeah we want it to be a little bit 2976 02:51:54,478 --> 02:51:59,920 rectangle so we'll do like half 2977 02:51:57,520 --> 02:52:01,439 the um text height maybe a little bit of 2978 02:52:01,439 --> 02:52:05,279 and then our angle is gonna be like that 2979 02:52:03,120 --> 02:52:07,600 so if you're wondering where this 2980 02:52:05,279 --> 02:52:08,800 number came from let me turn this back 2981 02:52:08,799 --> 02:52:14,000 draw this okay so i'm talking about 2982 02:52:12,000 --> 02:52:15,760 here's our center of um that bounding 2983 02:52:15,760 --> 02:52:19,760 if if i go if i go radius away from this 2984 02:52:19,760 --> 02:52:23,120 angle i'm gonna end up like right at 2985 02:52:21,680 --> 02:52:24,479 this point right here so that's why i'm 2986 02:52:24,478 --> 02:52:28,239 because text height is this amount so i 2987 02:52:28,239 --> 02:52:31,359 away that's going to kind of put me near 2988 02:52:31,359 --> 02:52:34,318 it's going to be different you know it's 2989 02:52:32,398 --> 02:52:35,199 not going to be it's going to be like 2990 02:52:35,200 --> 02:52:39,840 vertical distance away from this angle 2991 02:52:38,318 --> 02:52:41,519 that's why that's going to do that 2992 02:52:39,840 --> 02:52:42,478 that's what this line of code does it's 2993 02:52:42,478 --> 02:52:45,760 auto c equals that okay we have our 2994 02:52:45,760 --> 02:52:49,840 now we can get the width of our string 2995 02:52:47,120 --> 02:52:52,160 from the currently used font like we did 2996 02:52:49,840 --> 02:52:53,359 up here i'm going to do that same same 2997 02:52:53,359 --> 02:52:57,120 and then we're going to make a rectangle 2998 02:52:57,120 --> 02:53:00,640 width as well as our text height to 2999 02:52:59,120 --> 02:53:05,279 define its bounce so let's do 3000 02:53:00,639 --> 02:53:07,039 rectangle float r um we need our label 3001 02:53:05,279 --> 02:53:08,399 uh do we need that yet yes we need our 3002 02:53:07,040 --> 02:53:12,160 label because we need to do r 3003 02:53:08,398 --> 02:53:15,680 dot set size so auto str equals 3004 02:53:12,159 --> 02:53:17,279 labels label okay and then we can do r 3005 02:53:17,279 --> 02:53:20,720 now we will use the size using that get 3006 02:53:19,200 --> 02:53:21,840 string width helper function like we 3007 02:53:21,840 --> 02:53:25,040 uh this is going to be g dot get current 3008 02:53:25,040 --> 02:53:28,640 string width str and then our height is 3009 02:53:28,639 --> 02:53:32,639 text height now we can just set our 3010 02:53:32,639 --> 02:53:36,239 and then um maybe shift it down a little 3011 02:53:36,239 --> 02:53:40,639 just in case so it doesn't collide r dot 3012 02:53:40,639 --> 02:53:44,239 okay we'll get the current y as it is r 3013 02:53:44,239 --> 02:53:48,159 and we'll just add a little bit um you 3014 02:53:46,559 --> 02:53:49,278 know just shift it down just a little 3015 02:53:49,279 --> 02:53:52,560 okay and then now we can just draw our 3016 02:53:51,040 --> 02:53:53,920 fitted text and hopefully this will be 3017 02:53:57,840 --> 02:54:01,600 our text is going to be our string area 3018 02:54:01,600 --> 02:54:05,359 r is a float rectangle type so we want 3019 02:54:05,359 --> 02:54:08,559 get the nearest end we need to convert 3020 02:54:08,559 --> 02:54:13,920 we'll do the same centered and 3021 02:54:11,680 --> 02:54:16,318 one line try to fit all the text on one 3022 02:54:16,318 --> 02:54:20,719 we are drawing where we've got the 3023 02:54:20,719 --> 02:54:24,079 right here we're going to go at some 3024 02:54:24,079 --> 02:54:28,719 like this and then this would put us 3025 02:54:27,359 --> 02:54:30,239 right on the edge of the circle and we 3026 02:54:28,719 --> 02:54:31,679 don't want our rectangle to be centered 3027 02:54:30,239 --> 02:54:32,318 on the edge of that circle we want it to 3028 02:54:32,318 --> 02:54:35,760 a little bit further out and then down a 3029 02:54:34,639 --> 02:54:37,039 little bit so that way it doesn't 3030 02:54:37,040 --> 02:54:40,800 okay so this uh this gets it right on 3031 02:54:40,799 --> 02:54:44,799 this gets it a little bit past the 3032 02:54:44,799 --> 02:54:48,879 shifts it down from the circle all right 3033 02:54:48,879 --> 02:54:53,519 okay why is this not displaying anything 3034 02:54:51,680 --> 02:54:55,520 oh because we didn't initialize it 3035 02:54:53,520 --> 02:54:58,640 duh we need to actually provide some 3036 02:54:55,520 --> 02:55:01,680 labels first so let's do that next 3037 02:54:58,639 --> 02:55:03,439 36 step number 36 so we need to go to 3038 02:55:03,439 --> 02:55:09,359 let's go to our constructor in our um 3039 02:55:06,719 --> 02:55:10,398 where is this this is in our plug-in 3040 02:55:10,398 --> 02:55:15,199 plug-in editor okay so we will do this 3041 02:55:12,639 --> 02:55:18,318 before we make our components visible 3042 02:55:15,200 --> 02:55:20,159 let's add um our min and max ranges so 3043 02:55:18,318 --> 02:55:23,278 we'll start with the peak freq 3044 02:55:20,159 --> 02:55:24,639 peak freak slider okay and this is where 3045 02:55:24,639 --> 02:55:28,000 we'll just add one of these label 3046 02:55:28,000 --> 02:55:35,120 at position zero i want to display 20 3047 02:55:31,920 --> 02:55:36,159 hertz and then at position 1.0 we will 3048 02:55:39,760 --> 02:55:45,040 and then we'll do khc like that let's 3049 02:55:42,239 --> 02:55:48,398 see if that looks like anything 3050 02:55:45,040 --> 02:55:51,279 okay cool 20 hertz 20 kilohertz nice 3051 02:55:48,398 --> 02:55:51,680 all right let's make a commit of that 3052 02:55:55,680 --> 02:55:58,880 all right let's do the rest of them we 3053 02:55:58,879 --> 02:56:04,959 um let's see negative 24 db and plus 24. 3054 02:56:02,159 --> 02:56:06,318 okay cool so my gain slider uh whoops i 3055 02:56:06,318 --> 02:56:10,079 okay so my gain slider is going to show 3056 02:56:10,079 --> 02:56:15,760 my quality will show 0.1 and 10.0 3057 02:56:13,920 --> 02:56:18,079 and then low cut and high cut are going 3058 02:56:15,760 --> 02:56:20,639 to show 20 hertz and 20 kilohertz 3059 02:56:18,079 --> 02:56:21,120 and then the um slope sliders are going 3060 02:56:21,120 --> 02:56:26,640 12 and 48 and i don't think there i 3061 02:56:24,000 --> 02:56:29,040 don't see a need to make it display the 3062 02:56:26,639 --> 02:56:31,199 decibels per octave thing um anyway 3063 02:56:31,200 --> 02:56:35,120 okay oh let's get rid of these bounding 3064 02:56:32,639 --> 02:56:36,239 boxes where was that that's up here 3065 02:56:36,239 --> 02:56:41,840 that's right here they're handy to have 3066 02:56:39,279 --> 02:56:44,159 um handy to be able to just pop them in 3067 02:56:41,840 --> 02:56:46,398 there to help debug your visuals 3068 02:56:44,159 --> 02:56:48,000 okay cool that's looking pretty clean 3069 02:56:48,000 --> 02:56:51,760 all right let's adjust these positions a 3070 02:56:51,760 --> 02:56:55,359 adjust these positions a little bit i'm 3071 02:56:53,439 --> 02:56:56,479 going to make the display a little bit 3072 02:56:56,478 --> 02:57:01,199 and then and i'm going to do that 3073 02:57:01,200 --> 02:57:04,319 okay it's a little it's a little bit 3074 02:57:04,318 --> 02:57:07,680 so i'm going to make this just a little 3075 02:57:07,680 --> 02:57:11,040 and then we're going to use juice live 3076 02:57:11,040 --> 02:57:16,479 change the height of the response 3077 02:57:14,079 --> 02:57:17,200 area okay so get a little look at how 3078 02:57:17,200 --> 02:57:22,159 so we'll do float h ratio height ratio 3079 02:57:20,639 --> 02:57:24,159 i'm going to use juice live constant 3080 02:57:24,159 --> 02:57:30,239 we're currently using 33 okay 3081 02:57:27,279 --> 02:57:31,120 so now we can do this here and we're 3082 02:57:31,120 --> 02:57:35,520 our height ratio to figure out what size 3083 02:57:35,520 --> 02:57:42,239 okay cool so now we are looking at 3084 02:57:47,760 --> 02:57:55,680 all right okay i'm doing that because 3085 02:57:53,120 --> 02:57:56,399 when this goes like that it covers up 3086 02:57:56,398 --> 02:58:00,559 so if i shrink this a little bit does 3087 02:58:00,559 --> 02:58:03,680 all right that seems okay i need the 3088 02:58:03,680 --> 02:58:07,200 text to not overlap but it's doing it 3089 02:58:07,200 --> 02:58:10,560 perhaps i need to shrink this length so 3090 02:58:10,559 --> 02:58:14,318 or maybe it's not a thing either way 25 3091 02:58:13,120 --> 02:58:15,279 percent looks good the knobs are a 3092 02:58:15,279 --> 02:58:18,000 i mean if we wanted to we could just 3093 02:58:16,478 --> 02:58:19,199 make this like really big but that just 3094 02:58:18,000 --> 02:58:20,719 looks kind of weird and we don't even 3095 02:58:20,719 --> 02:58:24,318 so that's the big problem is i want to 3096 02:58:22,159 --> 02:58:26,159 see more of the slider's thumb 3097 02:58:24,318 --> 02:58:27,920 than i'm currently seeing right now 3098 02:58:27,920 --> 02:58:31,359 if that's like that i want to make this 3099 02:58:31,359 --> 02:58:35,920 i want to see more of the thumb okay so 3100 02:58:35,920 --> 02:58:39,439 makes it's pretty easy to see where the 3101 02:58:39,439 --> 02:58:43,200 so we'll stick with that we'll do 25 for 3102 02:58:43,200 --> 02:58:49,920 okay so we'll change this to 25.f 3103 02:58:46,398 --> 02:58:51,199 divided by 100.f and we'll just comment 3104 02:58:49,920 --> 02:58:52,879 out because it's always you know it's 3105 02:58:51,200 --> 02:58:54,399 always useful to be able to uncomment 3106 02:58:52,879 --> 02:58:55,599 that and use it to dial in those other 3107 02:58:55,600 --> 02:58:58,880 okay now i think if we take a look at 3108 02:58:58,879 --> 02:59:02,079 there's one other graphic change i want 3109 02:59:02,079 --> 02:59:05,359 now i don't like this gap right here so 3110 02:59:04,159 --> 02:59:06,879 i want to put a little bit of room 3111 02:59:05,359 --> 02:59:08,479 between where the sliders are 3112 02:59:06,879 --> 02:59:10,639 and where this component where this 3113 02:59:08,478 --> 02:59:13,278 response curve component ends 3114 02:59:10,639 --> 02:59:14,000 so we can do that by just removing a 3115 02:59:14,000 --> 02:59:18,239 this bounce before we do all of this 3116 02:59:18,239 --> 02:59:21,439 that's pretty easy bounce dot remove 3117 02:59:21,439 --> 02:59:27,359 i'm gonna just remove five pixels 3118 02:59:24,478 --> 02:59:27,760 let's see what that looks like okay 3119 02:59:27,760 --> 02:59:30,960 yeah that's clean i'm happy with that 3120 02:59:30,959 --> 02:59:36,799 so let's open this up now i'm gonna 3121 02:59:36,959 --> 02:59:40,559 i'm just gonna customize this a little 3122 02:59:40,559 --> 02:59:44,879 close this okay so these parameters are 3123 02:59:44,879 --> 02:59:50,318 drawn on here right away okay so that's 3124 02:59:50,318 --> 02:59:53,920 so let's uh let's open this back up 3125 02:59:53,920 --> 02:59:58,639 let's see if we can solve that okay so 3126 02:59:58,639 --> 03:00:04,959 let's go look at our um timer callback 3127 03:00:01,760 --> 03:00:06,719 code response curve command okay the 3128 03:00:10,000 --> 03:00:14,079 determines that this parameter is true 3129 03:00:12,079 --> 03:00:16,639 and this parameter is only set to true 3130 03:00:14,079 --> 03:00:19,359 whenever the parameter values change so 3131 03:00:19,359 --> 03:00:22,800 have the parameters changed from the 3132 03:00:22,799 --> 03:00:26,478 since they were initially loaded no they 3133 03:00:26,478 --> 03:00:30,159 okay so there's a couple ways we can do 3134 03:00:33,520 --> 03:00:37,680 to do this would be to say you know what 3135 03:00:37,680 --> 03:00:41,520 has changed the first time the gui loads 3136 03:00:41,520 --> 03:00:45,920 kind of hacky okay what we need to do is 3137 03:00:45,920 --> 03:00:49,359 that stuff gets set in the first place 3138 03:00:49,359 --> 03:00:55,200 make an update chain function 3139 03:00:52,719 --> 03:00:56,239 and now we can just call this in our 3140 03:00:56,239 --> 03:00:59,680 and from our constructor all right so 3141 03:00:58,318 --> 03:01:01,278 this is going to update the chain during 3142 03:00:59,680 --> 03:01:03,600 construction which means the chain will 3143 03:01:01,279 --> 03:01:06,079 give us the proper magnitude values 3144 03:01:03,600 --> 03:01:08,239 when we paint it for the very first time 3145 03:01:06,079 --> 03:01:10,318 so let's do that let's add a uh 3146 03:01:08,239 --> 03:01:11,439 let's put that right here okay we're 3147 03:01:10,318 --> 03:01:12,719 just going to move that code out of 3148 03:01:12,719 --> 03:01:19,278 void response curve component update 3149 03:01:16,079 --> 03:01:21,200 chain we can just grab all this stuff 3150 03:01:19,279 --> 03:01:22,960 we're not going to repaint though okay 3151 03:01:21,200 --> 03:01:25,600 now we're just going to call it 3152 03:01:22,959 --> 03:01:27,519 update chain and then we can call it in 3153 03:01:27,520 --> 03:01:34,960 let's call it before we do our timer 3154 03:01:31,840 --> 03:01:36,719 all right let's run it and we should see 3155 03:01:34,959 --> 03:01:39,839 uh the chain get updated automatically 3156 03:01:36,719 --> 03:01:41,920 whenever we close and reopen the gui 3157 03:01:39,840 --> 03:01:43,760 okay so that's showing up is correct i'm 3158 03:01:41,920 --> 03:01:45,600 going to change this param to that 3159 03:01:43,760 --> 03:01:46,880 okay that's on 90b so notice there's a 3160 03:01:45,600 --> 03:01:47,760 bump right there i'm going to close this 3161 03:01:47,760 --> 03:01:54,719 reopen it and that bump is there cool 3162 03:01:51,040 --> 03:01:55,439 bug solved all right let's make a commit 3163 03:01:55,439 --> 03:02:02,159 what do we have going on here uh fixed 3164 03:02:09,200 --> 03:02:12,800 we have our um this is where we started 3165 03:02:12,799 --> 03:02:16,000 star values and then this is where we 3166 03:02:16,000 --> 03:02:22,879 those labels here's where we dialed in 3167 03:02:19,439 --> 03:02:24,318 the um the final position for all the 3168 03:02:22,879 --> 03:02:26,398 components and then here's where we 3169 03:02:24,318 --> 03:02:27,840 fixed the response curve issue by 3170 03:02:26,398 --> 03:02:29,439 refactoring what happens in timer 3171 03:02:27,840 --> 03:02:32,478 callback into its own function 3172 03:02:29,439 --> 03:02:35,680 that we can call from our constructor 3173 03:02:32,478 --> 03:02:38,879 okay cool that wraps up the 3174 03:02:35,680 --> 03:02:41,760 response curve and customizing the knob 3175 03:02:38,879 --> 03:02:42,799 visuals okay the next thing to do is to 3176 03:02:42,799 --> 03:02:47,039 behind the response curve and then after 3177 03:02:47,040 --> 03:02:51,359 spectrum analyzer and then after we do 3178 03:02:49,439 --> 03:02:53,520 that we can add the bypass buttons 3179 03:02:51,359 --> 03:02:55,040 okay so we got three big things to do 3180 03:02:53,520 --> 03:02:55,680 before we are done with this component 3181 03:02:55,680 --> 03:03:02,398 almost done with this project so 3182 03:02:59,200 --> 03:03:05,680 awesome it's progressing very quickly 3183 03:03:07,520 --> 03:03:12,159 okay let's give this response curve a 3184 03:03:12,159 --> 03:03:16,239 that's going to show the frequency plot 3185 03:03:13,920 --> 03:03:18,000 and since we don't need to recreate this 3186 03:03:16,239 --> 03:03:18,639 every time the curve is updated we are 3187 03:03:18,639 --> 03:03:24,799 pre-render it into an image so let's 3188 03:03:21,520 --> 03:03:28,319 head over to our plugin editor.h 3189 03:03:24,799 --> 03:03:30,719 and we will do that right here 3190 03:03:28,318 --> 03:03:32,398 now we need a place to make this 3191 03:03:32,398 --> 03:03:36,000 and the resized function is a good place 3192 03:03:36,000 --> 03:03:39,920 it is called whenever the component 3193 03:03:37,760 --> 03:03:42,559 bounds change and it is called before 3194 03:03:39,920 --> 03:03:45,760 the first time that paint is called 3195 03:03:42,559 --> 03:03:48,000 so let's declare that guy here all right 3196 03:03:48,000 --> 03:03:52,318 let's put this after our paint function 3197 03:03:50,799 --> 03:03:53,519 the first thing we will do in this 3198 03:03:53,520 --> 03:03:57,840 is make a new background image based on 3199 03:03:57,840 --> 03:04:01,840 component okay so first let's declare 3200 03:04:01,840 --> 03:04:07,279 uh response curve component resized 3201 03:04:05,600 --> 03:04:08,960 so okay we're going to create a new 3202 03:04:07,279 --> 03:04:10,159 background image then we will create a 3203 03:04:10,159 --> 03:04:13,680 which we'll draw into this background 3204 03:04:11,760 --> 03:04:14,880 image and then from there we can just do 3205 03:04:14,879 --> 03:04:18,239 except we are drawing into this 3206 03:04:18,239 --> 03:04:23,199 directly using the graphics context that 3207 03:04:23,200 --> 03:04:27,840 we'll start with that okay we're going 3208 03:04:27,840 --> 03:04:32,159 an rgb pixel format the width and the 3209 03:04:30,719 --> 03:04:33,920 height for the dimensions and then we 3210 03:04:33,920 --> 03:04:37,760 all right now we just need the graphics 3211 03:04:37,760 --> 03:04:42,880 now i want to draw frequency lines 3212 03:04:41,040 --> 03:04:44,319 so i'm going to create an array that i 3213 03:04:42,879 --> 03:04:46,159 can loop through and convert these 3214 03:04:44,318 --> 03:04:46,959 frequencies to window space and then 3215 03:04:46,959 --> 03:04:51,199 vertical lines and these values that i'm 3216 03:04:49,760 --> 03:04:52,800 using for the frequencies are the 3217 03:04:51,200 --> 03:04:54,960 standard values people use when 3218 03:04:52,799 --> 03:04:55,840 producing these types of plots 3219 03:04:54,959 --> 03:04:57,519 yeah i mean you can come up with 3220 03:04:55,840 --> 03:04:58,559 whatever you want but these are the 3221 03:04:58,559 --> 03:05:02,398 um values that people use and they're in 3222 03:05:02,398 --> 03:05:09,199 uh are they um they um they scale up 3223 03:05:05,760 --> 03:05:10,478 by a factor of 10 each time so let's do 3224 03:05:10,478 --> 03:05:19,039 so i'm going to do 20 30 40 50 3225 03:05:13,840 --> 03:05:23,040 100. i'm gonna multiply that uh by 3226 03:05:23,040 --> 03:05:26,399 since that's the top of the human 3227 03:05:26,398 --> 03:05:30,639 all right now i'm going to uh set my 3228 03:05:29,200 --> 03:05:32,640 color to white i'm going to loop through 3229 03:05:32,639 --> 03:05:37,278 map them from i'm going to map them from 3230 03:05:37,279 --> 03:05:47,760 space to a normalized position and then 3231 03:05:39,520 --> 03:05:50,319 i'm going to draw a vertical line 3232 03:05:47,760 --> 03:05:52,559 all right let's take a look at that uh 3233 03:05:56,079 --> 03:05:59,279 we need to display it in pain but before 3234 03:05:59,279 --> 03:06:02,720 show some gain lines as well so i'm 3235 03:06:02,719 --> 03:06:06,398 i'm going to create an array i'm going 3236 03:06:04,639 --> 03:06:07,840 to loop through it and i'm going to draw 3237 03:06:06,398 --> 03:06:08,719 i'm going to convert each value in the 3238 03:06:08,719 --> 03:06:11,920 a window position and then draw it as a 3239 03:06:15,840 --> 03:06:20,960 i'm going to do i'm going to do lines 3240 03:06:25,120 --> 03:06:30,560 okay so remember i'm using 24 3241 03:06:28,398 --> 03:06:31,840 and negative 24 as my range because 3242 03:06:31,840 --> 03:06:36,960 slider can um our gain slider can 3243 03:06:34,879 --> 03:06:38,639 those are the ranges of that gain slider 3244 03:06:36,959 --> 03:06:39,599 and then it's important to remember that 3245 03:06:39,600 --> 03:06:43,680 of the window at the bottom we want this 3246 03:06:41,760 --> 03:06:45,200 negative 24 to be mapped to the bottom 3247 03:06:45,200 --> 03:06:49,600 and then we want the positive 24 to be 3248 03:06:47,359 --> 03:06:51,359 mapped to the top of our component 3249 03:06:49,600 --> 03:06:52,800 and then we're just drawing a horizontal 3250 03:06:52,799 --> 03:07:00,000 to the right side all right now we just 3251 03:06:56,318 --> 03:07:00,000 need to go to our paint function 3252 03:07:04,318 --> 03:07:08,159 g dot draw image image to draw as 3253 03:07:08,159 --> 03:07:12,000 it wants a float rectangle so get local 3254 03:07:12,000 --> 03:07:19,359 to float all right let's take a look 3255 03:07:16,478 --> 03:07:20,639 all right cool it looks like something 3256 03:07:20,639 --> 03:07:25,119 um so for this graphic stuff we're going 3257 03:07:22,879 --> 03:07:27,920 to switch to the standalone plugin 3258 03:07:25,120 --> 03:07:29,600 so that way um we don't need to deal 3259 03:07:27,920 --> 03:07:30,398 with audio plug and host at the moment 3260 03:07:30,398 --> 03:07:34,639 looking at graphics changes let's look 3261 03:07:34,639 --> 03:07:38,239 okay so the first problem is that 3262 03:07:36,639 --> 03:07:40,478 there's a lot of collision happening 3263 03:07:38,239 --> 03:07:41,680 like our plus 24 line and our negative 3264 03:07:41,680 --> 03:07:45,359 uh we don't even see them so we need to 3265 03:07:43,680 --> 03:07:46,079 shrink the bounding box that we are 3266 03:07:46,079 --> 03:07:49,920 to compute these values within which 3267 03:07:48,159 --> 03:07:50,478 means we also need to adjust how our 3268 03:07:50,478 --> 03:07:54,079 is going to get produced so let's go to 3269 03:07:57,120 --> 03:08:01,520 and then below this let's add a function 3270 03:07:59,520 --> 03:08:03,439 that will give us the area we will draw 3271 03:08:01,520 --> 03:08:06,720 our background grid in and also our 3272 03:08:06,719 --> 03:08:10,318 i'm going to call mine get render area 3273 03:08:13,600 --> 03:08:18,559 now go to our plugin editor.cpp and 3274 03:08:16,639 --> 03:08:19,439 let's go to the bot um go to the bottom 3275 03:08:24,478 --> 03:08:28,959 all right so let's use some juice live 3276 03:08:28,959 --> 03:08:33,278 bounding box of this all we know is that 3277 03:08:31,520 --> 03:08:34,239 we are going to reduce our local 3278 03:08:34,239 --> 03:08:37,600 not by how much so this will be a good 3279 03:08:41,200 --> 03:08:45,520 we're going to use the reduce function 3280 03:08:48,879 --> 03:08:52,959 start with five i'm going to reduce both 3281 03:08:52,959 --> 03:08:57,679 and the y and it's important to make 3282 03:08:55,680 --> 03:08:58,880 sure you put juice live constant on its 3283 03:09:02,559 --> 03:09:08,079 okay for right now we're going to stop 3284 03:09:08,079 --> 03:09:14,840 as well as the horizontal lines 3285 03:09:11,200 --> 03:09:16,079 and we're just going to draw the render 3286 03:09:16,079 --> 03:09:21,439 okay so let's run this and let's dial in 3287 03:09:21,680 --> 03:09:25,760 let's move this out of the way okay so 3288 03:09:25,760 --> 03:09:31,120 we shrink it we shrink the width 3289 03:09:29,439 --> 03:09:33,520 and then if we do this one we shrink the 3290 03:09:31,120 --> 03:09:35,439 height okay so let's figure out what 3291 03:09:35,439 --> 03:09:38,800 i know i'm going to want to have some 3292 03:09:38,799 --> 03:09:43,358 and on this side showing like the actual 3293 03:09:43,359 --> 03:09:47,760 like you know 0 db plus 24 and minus 24 3294 03:09:46,719 --> 03:09:49,039 and then whatever i'm going to come up 3295 03:09:47,760 --> 03:09:50,398 with here and then we need our 3296 03:09:50,398 --> 03:09:54,159 uh to get displayed either above or 3297 03:09:54,159 --> 03:09:59,840 somewhere so let's dial this in 3298 03:10:02,719 --> 03:10:07,278 all right and i like shrinking it by 10 3299 03:10:05,040 --> 03:10:09,200 i think this is a good width and then 3300 03:10:07,279 --> 03:10:11,439 height wise i don't think i need that 3301 03:10:11,520 --> 03:10:17,200 i'm going to go with 8. so 10 3302 03:10:14,559 --> 03:10:17,680 for the width reduction and then 8 for 3303 03:10:22,639 --> 03:10:29,119 so let me just make that change here 10 3304 03:10:31,920 --> 03:10:36,799 put this on its own line for right now 3305 03:10:35,120 --> 03:10:38,800 okay i'm happy with that so let's make 3306 03:10:38,799 --> 03:10:44,879 this rectangle now all right let's go to 3307 03:10:44,879 --> 03:10:48,398 now all we have to do is change this 3308 03:10:48,398 --> 03:10:55,358 response area is going to be get 3309 03:10:51,520 --> 03:10:55,680 render area auto response area equals 3310 03:10:55,680 --> 03:11:01,920 render area talk about easy i am glad we 3311 03:11:00,159 --> 03:11:03,520 planned ahead on that by using this 3312 03:11:01,920 --> 03:11:06,398 response area to represent what we are 3313 03:11:06,398 --> 03:11:09,760 okay cool so this is being drawn inside 3314 03:11:09,760 --> 03:11:13,120 we're getting a little bit of the path 3315 03:11:11,359 --> 03:11:16,479 being drawn outside of it because 3316 03:11:16,478 --> 03:11:19,840 is smaller than our component and this 3317 03:11:19,840 --> 03:11:22,880 you know the entire component so we'll 3318 03:11:21,200 --> 03:11:26,000 figure that out in a little bit but 3319 03:11:22,879 --> 03:11:27,759 this is cool all right we're making 3320 03:11:27,760 --> 03:11:31,520 now i'm going to change this from being 3321 03:11:31,520 --> 03:11:35,279 being reduced mainly on the top and the 3322 03:11:33,840 --> 03:11:37,680 sides we want to leave room for the 3323 03:11:37,680 --> 03:11:43,040 and the db levels on the sides but for 3324 03:11:41,359 --> 03:11:44,399 the bottom i don't really care about 3325 03:11:44,398 --> 03:11:48,639 uh we're going to get rid of that we're 3326 03:11:46,318 --> 03:11:51,199 going to do bounce dot remove from top 3327 03:11:48,639 --> 03:11:52,639 we're going to give us a gap of 12 at 3328 03:11:52,639 --> 03:11:56,478 from the bottom we're just going to do a 3329 03:11:53,760 --> 03:11:58,000 little gap maybe something like that and 3330 03:11:58,000 --> 03:12:06,238 um my i think we need more than 10 3331 03:12:01,840 --> 03:12:10,478 so we'll do 20 pounds.remove from left 3332 03:12:06,238 --> 03:12:16,159 20 and then bounce.remove from right 3333 03:12:10,478 --> 03:12:18,159 20. all right let's take a look at that 3334 03:12:16,159 --> 03:12:19,359 okay cool so we've got two pixels of 3335 03:12:19,359 --> 03:12:22,559 we got our 20 here this is plenty of 3336 03:12:22,559 --> 03:12:26,318 and then same for on the top we can put 3337 03:12:26,318 --> 03:12:32,799 um yeah like use a font that's not very 3338 03:12:32,799 --> 03:12:37,358 okay so let's go um let's separate the 3339 03:12:35,520 --> 03:12:37,920 render area from the actual analysis 3340 03:12:37,920 --> 03:12:42,960 so let's add another function here 3341 03:12:41,120 --> 03:12:44,880 and it's going to be called get analysis 3342 03:12:42,959 --> 03:12:48,478 area and that's actually going to be 3343 03:12:44,879 --> 03:12:51,920 what we draw the response curve within 3344 03:12:51,920 --> 03:12:55,760 when we see our you'll have to just 3345 03:12:53,760 --> 03:12:58,159 imagine the grid lines for right now 3346 03:12:55,760 --> 03:13:00,559 but just imagine that like we're not 3347 03:12:58,159 --> 03:13:02,879 going to have the plus 24 be underneath 3348 03:13:00,559 --> 03:13:04,879 this like right at this orange line it's 3349 03:13:02,879 --> 03:13:06,959 going to be slightly less than it 3350 03:13:04,879 --> 03:13:08,719 and same for the bottom our negative 24 3351 03:13:06,959 --> 03:13:10,159 is not going to be on this orange line 3352 03:13:08,719 --> 03:13:11,760 it's going to be slightly above it 3353 03:13:10,159 --> 03:13:13,439 so that's what i mean when i say our 3354 03:13:11,760 --> 03:13:13,760 analysis area is going to be a little 3355 03:13:18,238 --> 03:13:23,840 all right so let's implement this back 3356 03:13:20,159 --> 03:13:24,959 to our cpp file put this right here 3357 03:13:23,840 --> 03:13:27,120 all right we're going to start with our 3358 03:13:27,120 --> 03:13:30,640 and then we're going to trim some off 3359 03:13:28,719 --> 03:13:32,719 the top and trim off the bottom 3360 03:13:30,639 --> 03:13:34,238 so that way we can see the um the top 3361 03:13:34,238 --> 03:13:39,520 um grid as i had explained as i had 3362 03:13:37,600 --> 03:13:42,880 explained a moment ago balance dot 3363 03:13:39,520 --> 03:13:43,439 remove from top a gap of four should be 3364 03:13:43,439 --> 03:13:47,920 bounce down remove from bottom same size 3365 03:13:47,920 --> 03:13:51,920 all right now let's use this instead of 3366 03:13:55,120 --> 03:14:00,720 response area uh not get local bounds 3367 03:13:58,238 --> 03:14:03,760 or not get render area let's use get 3368 03:14:03,760 --> 03:14:08,559 all right so let's take a look at that 3369 03:14:06,799 --> 03:14:11,119 okay all right so we're still we're 3370 03:14:08,559 --> 03:14:13,600 seeing our orange rectangle in the wrong 3371 03:14:11,120 --> 03:14:15,680 uh wrong spot so let's take care of that 3372 03:14:15,680 --> 03:14:20,318 um that's at the bottom that's this guy 3373 03:14:19,200 --> 03:14:22,840 right here so instead of using the 3374 03:14:20,318 --> 03:14:25,840 response area we want to use the render 3375 03:14:38,318 --> 03:14:45,519 and let's draw our analysis area 3376 03:14:42,719 --> 03:14:46,000 right yes let's display our analysis 3377 03:14:46,000 --> 03:14:50,159 so we have an idea of where this 3378 03:14:50,799 --> 03:14:54,238 all right cool so yes um it's slightly 3379 03:14:54,238 --> 03:15:00,639 slightly set inside our um orange 3380 03:15:00,639 --> 03:15:06,879 okay so let's see let's go up to our 3381 03:15:06,879 --> 03:15:10,719 we want to be drawing inside of this 3382 03:15:08,478 --> 03:15:11,840 analysis area instead of the local bound 3383 03:15:11,840 --> 03:15:15,840 some information about this analysis 3384 03:15:14,079 --> 03:15:17,039 area let's do this right here we'll go 3385 03:15:17,040 --> 03:15:21,200 area equals get analysis area and now 3386 03:15:24,639 --> 03:15:28,318 okay because we need the left and the 3387 03:15:25,920 --> 03:15:29,439 right for our horizontal lines we need 3388 03:15:29,439 --> 03:15:33,279 the top and the bottom for our vertical 3389 03:15:33,279 --> 03:15:36,800 um and then we also need the width for 3390 03:15:36,799 --> 03:15:41,840 uh is it this thing um well either way 3391 03:15:40,398 --> 03:15:48,799 all right let's just start caching them 3392 03:15:48,799 --> 03:15:52,318 since the frequency labels as well as 3393 03:15:50,799 --> 03:15:55,920 the vertical lines we'll need this 3394 03:15:52,318 --> 03:15:59,278 x position let's just um cache this 3395 03:16:01,040 --> 03:16:05,120 all right so we're going to use the same 3396 03:16:02,398 --> 03:16:08,159 mapping code where we convert our 3397 03:16:05,120 --> 03:16:08,800 frequency value to a a normalized 3398 03:16:08,799 --> 03:16:15,519 and then just compute that to a 3399 03:16:11,920 --> 03:16:18,398 a window x position um based off of this 3400 03:16:18,398 --> 03:16:23,680 all right now we can actually draw our 3401 03:16:20,719 --> 03:16:25,519 vertical lines let's get rid of this 3402 03:16:23,680 --> 03:16:28,318 i'm going to use uh i'm not going to use 3403 03:16:25,520 --> 03:16:29,520 white i'm going to use dim gray for this 3404 03:16:28,318 --> 03:16:32,079 so instead of looping through our 3405 03:16:32,159 --> 03:16:38,719 let's loop through our x positions 3406 03:16:35,600 --> 03:16:42,640 and we don't need this line anymore 3407 03:16:38,719 --> 03:16:42,639 instead we need uh this right here 3408 03:16:42,879 --> 03:16:48,159 we're going to draw x and from the top 3409 03:16:48,719 --> 03:16:56,478 all right now let's go to our gain and 3410 03:16:56,478 --> 03:17:00,079 instead of using our get height and zero 3411 03:17:03,600 --> 03:17:09,359 uh i want to make the zero db line 3412 03:17:06,879 --> 03:17:11,039 um have the same color as our min and 3413 03:17:09,359 --> 03:17:12,159 max slider labels and everything else is 3414 03:17:11,040 --> 03:17:13,840 going to be grace that will be 3415 03:17:12,159 --> 03:17:15,680 it'll you know we'll be able to visually 3416 03:17:15,680 --> 03:17:22,159 so we will do g dot set color 3417 03:17:19,200 --> 03:17:23,840 if it's zero then we're gonna use that 3418 03:17:22,159 --> 03:17:26,238 one color otherwise we're gonna use um a 3419 03:17:26,238 --> 03:17:31,600 it could you know dark gray is cool all 3420 03:17:28,318 --> 03:17:34,639 right let's go find that green color 3421 03:17:35,040 --> 03:17:39,359 where is that order slider paint uh this 3422 03:17:39,359 --> 03:17:42,399 and this should probably be standardized 3423 03:17:42,398 --> 03:17:46,238 static color at some point you know 3424 03:17:44,559 --> 03:17:49,519 define it at the top of the header file 3425 03:17:46,238 --> 03:17:50,879 but for right now this is good enough 3426 03:17:49,520 --> 03:17:53,359 all right so we're going to use that 3427 03:17:53,359 --> 03:17:59,120 all right and we don't need this border 3428 03:17:54,799 --> 03:17:59,119 anymore so let's run it and take a look 3429 03:17:59,359 --> 03:18:06,640 oh i forgot to uh draw the line so g dot 3430 03:18:10,879 --> 03:18:15,759 so we should see a green line in the 3431 03:18:20,159 --> 03:18:24,879 okay so the next thing to do is to draw 3432 03:18:24,879 --> 03:18:28,398 let's make a little commit of what we've 3433 03:18:28,398 --> 03:18:32,238 right we basically roughed out the grid 3434 03:18:40,559 --> 03:18:48,238 so uh let's see we actually um we added 3435 03:18:44,000 --> 03:18:52,719 grid lines we also um pre-rendered 3436 03:18:52,879 --> 03:18:58,959 cool okay so frequency labels let's draw 3437 03:18:58,959 --> 03:19:02,959 get rid of that line we'll do a clean up 3438 03:19:00,879 --> 03:19:04,719 at the end okay so i want to draw these 3439 03:19:04,719 --> 03:19:09,760 so that way they pop out a little bit so 3440 03:19:09,920 --> 03:19:14,238 we want to use a font height of 10. if 3441 03:19:14,238 --> 03:19:18,318 um our render area we gave ourselves a 3442 03:19:18,318 --> 03:19:22,000 12 between the top of our component and 3443 03:19:22,000 --> 03:19:25,200 is so i'm going to draw inside that 3444 03:19:25,200 --> 03:19:29,439 gap so that's why i'm going to use a 3445 03:19:29,439 --> 03:19:32,800 if i need to tweak that i can tweak it 3446 03:19:32,799 --> 03:19:36,719 what we will do is loop through our 3447 03:19:34,318 --> 03:19:38,639 frequencies and x's and draw the text 3448 03:19:36,719 --> 03:19:41,119 above the grid at those particular 3449 03:19:44,879 --> 03:19:49,358 now i'm gonna use the same trick um that 3450 03:19:49,359 --> 03:19:53,359 uh labels uh for the min and the max 3451 03:19:56,559 --> 03:20:01,840 use that same trick right here 3452 03:20:02,398 --> 03:20:06,238 all right then we can just assemble our 3453 03:20:10,959 --> 03:20:14,559 all right and we're gonna do the same 3454 03:20:12,639 --> 03:20:18,159 trick that we used with the string width 3455 03:20:14,559 --> 03:20:18,159 and building a rectangle around it 3456 03:20:20,799 --> 03:20:24,799 very simple stuff we've got a rectangle 3457 03:20:22,959 --> 03:20:26,799 we're going to give it a particular size 3458 03:20:24,799 --> 03:20:28,799 i know where i want the center x but not 3459 03:20:28,799 --> 03:20:32,719 and that's okay because i can set the y 3460 03:20:32,719 --> 03:20:37,119 the x position all right all we need to 3461 03:20:41,120 --> 03:20:46,399 all right let's run it and take a look 3462 03:20:44,159 --> 03:20:48,879 all right cool uh we got some collision 3463 03:20:48,879 --> 03:20:56,318 that's okay though figure that out next 3464 03:20:53,120 --> 03:20:59,279 all right so it looks like the 40 3465 03:20:56,318 --> 03:21:01,119 and the 30 and the 40 are getting pretty 3466 03:21:01,120 --> 03:21:06,560 collide a lot 3k and 4k collide a lot so 3467 03:21:06,559 --> 03:21:10,478 and let's try that again ah much 3468 03:21:10,478 --> 03:21:14,398 these are much easier to see now that 3469 03:21:12,238 --> 03:21:16,639 they're not colliding on each other 3470 03:21:14,398 --> 03:21:19,840 cool all right so let's add a commit for 3471 03:21:26,318 --> 03:21:30,478 all right let's do the gain labels next 3472 03:21:30,879 --> 03:21:35,679 all right let's go to where we are 3473 03:21:32,000 --> 03:21:35,680 looping through our gain labels 3474 03:21:37,520 --> 03:21:42,319 that right here so we're actually going 3475 03:21:42,318 --> 03:21:45,359 all right we're going to loop through 3476 03:21:43,279 --> 03:21:48,399 our gain labels the exact same way we're 3477 03:21:49,520 --> 03:21:53,200 all right now we need to make a string 3478 03:21:51,200 --> 03:21:54,960 with the gain value if it's greater than 3479 03:21:54,959 --> 03:21:58,719 if it's and if it's not it's going to be 3480 03:21:57,040 --> 03:22:00,720 a negative number so let's do the same 3481 03:22:04,398 --> 03:22:10,318 is greater than zero uh add the plus 3482 03:22:10,879 --> 03:22:14,639 and then just feed in that gain value 3483 03:22:14,959 --> 03:22:18,719 all right let's get the width like we 3484 03:22:16,398 --> 03:22:20,478 did before and then we're going to build 3485 03:22:20,478 --> 03:22:26,000 just like we did before same thing here 3486 03:22:26,238 --> 03:22:30,559 okay now we're going to draw these on 3487 03:22:28,398 --> 03:22:32,559 the right side of the screen so our x 3488 03:22:32,559 --> 03:22:39,920 is going to be the width get width 3489 03:22:36,559 --> 03:22:42,000 minus our text width and then our height 3490 03:22:42,000 --> 03:22:45,840 uh let's see we're going to i'm not sure 3491 03:22:44,159 --> 03:22:47,520 where i want the y position to be but i 3492 03:22:45,840 --> 03:22:48,159 do know that i want the center of this 3493 03:22:48,159 --> 03:22:51,520 to be lined up with this so i'm going to 3494 03:22:54,799 --> 03:22:58,238 thing i know i wanted to use the current 3495 03:22:58,238 --> 03:23:05,840 and i know i want um this to be y 3496 03:23:02,639 --> 03:23:06,398 okay so like i said i know where i want 3497 03:23:06,398 --> 03:23:09,760 left edge of this to be i don't know 3498 03:23:09,760 --> 03:23:13,200 y position to be but i do know that i 3499 03:23:13,200 --> 03:23:17,840 the center of this text to be at this y 3500 03:23:16,159 --> 03:23:19,200 position which is the same position we 3501 03:23:19,200 --> 03:23:23,279 lines so i can do that same trick where 3502 03:23:23,279 --> 03:23:27,680 i know the x um the rectangle has the 3503 03:23:27,680 --> 03:23:32,479 get the center x of the rectangle and 3504 03:23:32,478 --> 03:23:39,278 i can set the center with this y value 3505 03:23:36,478 --> 03:23:41,278 okay now let's just set our color i want 3506 03:23:41,279 --> 03:23:45,120 trick i used here where i set it to 3507 03:23:45,120 --> 03:23:50,079 should be green the only difference is 3508 03:23:50,079 --> 03:23:53,760 i'm going to draw the text as light gray 3509 03:23:53,760 --> 03:23:59,200 the other color i used for this 3510 03:23:56,840 --> 03:23:59,920 text all right so this is going to give 3511 03:23:59,920 --> 03:24:07,600 a greenish text color for the 0db 3512 03:24:10,879 --> 03:24:16,639 it's this thing right here all right 3513 03:24:16,639 --> 03:24:21,039 all right cool we got plus 24 plus 12 0 3514 03:24:21,040 --> 03:24:26,160 uh minus 24 minus 12. awesome 3515 03:24:24,719 --> 03:24:28,639 all right let's make a little note about 3516 03:24:37,040 --> 03:24:41,520 okay let's add another scale let me pull 3517 03:24:41,520 --> 03:24:45,120 since we are going to be doing an 3518 03:24:42,799 --> 03:24:45,679 analyzer let's add another scale on this 3519 03:24:45,680 --> 03:24:49,520 for that okay now our gain range for the 3520 03:24:49,520 --> 03:24:54,238 uh 48 you know we could do from plus 24 3521 03:24:51,920 --> 03:24:55,279 to -24 so let's do the same for the 3522 03:24:55,279 --> 03:25:00,000 we'll do 0 to negative 48. so this is 3523 03:24:58,318 --> 03:25:04,238 easy all we have to do is subtract 3524 03:25:04,238 --> 03:25:08,238 just do that right here we can go 3525 03:25:08,238 --> 03:25:12,318 clear out our string um let's fill it in 3526 03:25:12,318 --> 03:25:15,199 since we we're not going to have any 3527 03:25:13,840 --> 03:25:16,238 values over zero we don't need to worry 3528 03:25:16,238 --> 03:25:22,719 so we can just do g db minus 3529 03:25:22,719 --> 03:25:27,119 uh let's just adjust the text bounding 3530 03:25:27,120 --> 03:25:30,720 so we know our x position is going to be 3531 03:25:30,719 --> 03:25:35,358 not on the actual left but like one 3532 03:25:32,478 --> 03:25:38,238 pixel off from it so r dot set x 3533 03:25:35,359 --> 03:25:39,200 one uh we need to recompute our string 3534 03:25:39,200 --> 03:25:42,479 then we need to set our size accordingly 3535 03:25:42,478 --> 03:25:45,599 um we can set our color to just always 3536 03:25:49,200 --> 03:25:56,079 then let's just draw our fitted text 3537 03:25:52,799 --> 03:25:57,599 inside this rectangle all right so 3538 03:25:56,079 --> 03:25:59,039 that's good times all we are changing is 3539 03:25:59,040 --> 03:26:04,080 and then the actual size of it all right 3540 03:26:04,079 --> 03:26:08,000 all right cool we got our 0 minus 12 3541 03:26:11,120 --> 03:26:15,600 all right so that takes care of that 3542 03:26:19,120 --> 03:26:24,640 and then um yeah do that clean up 3543 03:26:23,279 --> 03:26:26,880 let's take a quick look through all this 3544 03:26:27,439 --> 03:26:32,880 here we go get rid of that line get rid 3545 03:26:32,879 --> 03:26:36,478 okay that takes care of those guys so 3546 03:26:36,478 --> 03:26:40,478 is the fft analyzer and then the bypass 3547 03:26:43,920 --> 03:26:46,960 what we added here this is a code 3548 03:26:46,959 --> 03:26:51,039 and then we also added analyzer decibel 3549 03:26:54,639 --> 03:27:02,398 marks cleaned up code awesome 3550 03:27:06,478 --> 03:27:10,559 all right let's head on over to 3551 03:27:10,559 --> 03:27:14,000 okay go up to the top now our analyzer 3552 03:27:14,000 --> 03:27:18,559 display two fft curves one for each 3553 03:27:18,559 --> 03:27:21,680 that's because the fft algorithm 3554 03:27:24,959 --> 03:27:29,679 uh we are going to express that 3555 03:27:29,680 --> 03:27:36,960 all right this is uh effectively 3556 03:27:36,959 --> 03:27:41,358 okay now the fft operates the fft 3557 03:27:41,359 --> 03:27:47,040 fixed number of samples the host is 3558 03:27:44,398 --> 03:27:49,199 passing in buffers which can have a 3559 03:27:47,040 --> 03:27:51,279 variety of different sizes so we need a 3560 03:27:49,200 --> 03:27:55,040 way to collect them into blocks 3561 03:27:51,279 --> 03:27:57,840 of fixed sizes that's what this class 3562 03:27:58,478 --> 03:28:01,278 that's what this class right here does 3563 03:27:59,840 --> 03:28:04,318 i'll zoom out a little bit i'm not going 3564 03:28:07,920 --> 03:28:11,120 right if you want to know how this class 3565 03:28:11,120 --> 03:28:15,200 you can check it out in my uh pfm 3566 03:28:15,200 --> 03:28:18,640 explain how to make every little part of 3567 03:28:17,040 --> 03:28:20,960 this and how to get it all to work 3568 03:28:24,478 --> 03:28:29,760 next while our single sample fifo is 3569 03:28:27,760 --> 03:28:31,840 collecting individual samples 3570 03:28:29,760 --> 03:28:33,920 from the buffers into blocks we need a 3571 03:28:31,840 --> 03:28:35,600 fifo that the gui thread can use to 3572 03:28:35,600 --> 03:28:39,600 that this single channel sample fifo has 3573 03:28:39,600 --> 03:28:46,079 that's what this class does that's what 3574 03:28:46,478 --> 03:28:49,278 all right if you want to know how to 3575 03:28:47,359 --> 03:28:49,840 make this or how to write it you can 3576 03:28:49,840 --> 03:28:54,478 how this gets put together in my course 3577 03:28:51,760 --> 03:28:55,920 pfm c-plus plus for musicians 3578 03:28:54,478 --> 03:28:57,199 all right you can check those guys out 3579 03:28:55,920 --> 03:28:59,200 links in the description and all that 3580 03:28:59,200 --> 03:29:04,000 let's go to the next part all right we 3581 03:29:02,079 --> 03:29:07,039 need some instances of these things so 3582 03:29:04,000 --> 03:29:08,799 let's go to our class down here 3583 03:29:07,040 --> 03:29:10,880 now we're going to need one instance of 3584 03:29:10,879 --> 03:29:15,599 audio channel remember we are working on 3585 03:29:15,600 --> 03:29:19,359 because it is a templated class i'm 3586 03:29:17,200 --> 03:29:20,640 going to create a type alias to the type 3587 03:29:20,639 --> 03:29:25,039 into it so we don't have to type so much 3588 03:29:23,520 --> 03:29:26,238 okay these also need to be public 3589 03:29:25,040 --> 03:29:28,640 because the gui is going to need to 3590 03:29:26,238 --> 03:29:30,398 access them okay we are going to need 3591 03:29:28,639 --> 03:29:30,959 pointers to this class in the gui side 3592 03:29:30,959 --> 03:29:34,719 and this alias will make it easier to 3593 03:29:34,719 --> 03:29:41,679 instances to declare pointer instances 3594 03:29:38,478 --> 03:29:44,478 of that single channel sample fifo so 3595 03:29:45,200 --> 03:29:49,840 and then let's declare our instances 3596 03:29:53,359 --> 03:29:57,680 all right the single channel fifos need 3597 03:29:55,840 --> 03:29:59,040 to be prepared so let's go do that in 3598 03:29:59,040 --> 03:30:03,359 prepare to play a lot of pete words 3599 03:30:03,359 --> 03:30:06,559 prepare to play go to the bottom of it 3600 03:30:05,120 --> 03:30:09,120 after our filters this is where we're 3601 03:30:12,719 --> 03:30:17,119 samples per block same thing for the 3602 03:30:17,120 --> 03:30:22,960 okay now we just need to push buffers 3603 03:30:20,159 --> 03:30:24,879 into it so go to the process block 3604 03:30:22,959 --> 03:30:27,199 and at the very end after our processing 3605 03:30:28,238 --> 03:30:35,840 we're going to update it with our buffer 3606 03:30:31,840 --> 03:30:39,040 same for the right side okay let's go to 3607 03:30:39,040 --> 03:30:43,200 and we're going to go to our uh response 3608 03:30:43,200 --> 03:30:48,399 the bottom of it we are going to convert 3609 03:30:45,680 --> 03:30:50,639 some audio samples into fft data 3610 03:30:48,398 --> 03:30:52,398 this is not going to be simple okay we 3611 03:30:52,398 --> 03:30:56,079 um this system let's see i have this 3612 03:30:56,079 --> 03:31:00,238 on this grid i'll let me make it bigger 3613 03:30:59,040 --> 03:31:01,520 because it's important to know what's 3614 03:31:01,520 --> 03:31:05,120 okay we are basically going to build 3615 03:31:05,120 --> 03:31:09,760 so here's what happens the audio buffers 3616 03:31:09,760 --> 03:31:15,040 single channel sample fifo right here 3617 03:31:13,040 --> 03:31:17,279 okay the single channel uh single 3618 03:31:15,040 --> 03:31:20,479 channel sample fifo spits out 3619 03:31:20,478 --> 03:31:25,599 then these fixed size blocks go into an 3620 03:31:25,600 --> 03:31:29,279 right and this thing spits out fft data 3621 03:31:29,279 --> 03:31:35,760 the fft data blocks go into a path 3622 03:31:32,959 --> 03:31:37,358 producer right here and then the path 3623 03:31:37,359 --> 03:31:41,279 path instances and finally the gui 3624 03:31:41,279 --> 03:31:47,600 and renders the paths okay so 3625 03:31:44,959 --> 03:31:49,438 buffers of random size are fed into the 3626 03:31:47,600 --> 03:31:50,640 single channel sample fifo right here 3627 03:31:50,639 --> 03:31:54,559 size blocks then those go into an fft 3628 03:31:54,559 --> 03:31:58,000 the fft data generator spits out fft 3629 03:31:58,000 --> 03:32:01,439 then those get run through a path 3630 03:31:59,840 --> 03:32:04,238 producer which produces juice 3631 03:32:01,439 --> 03:32:05,760 paths and those get rendered and 3632 03:32:05,760 --> 03:32:11,200 okay that's what we're gonna build okay 3633 03:32:08,879 --> 03:32:13,839 so let's give ourselves a pointer to one 3634 03:32:11,200 --> 03:32:17,120 of the audio processors single channel 3635 03:32:17,120 --> 03:32:21,520 channel sample fifo uh it's that block 3636 03:32:24,719 --> 03:32:29,199 block type this is gonna and we're doing 3637 03:32:29,200 --> 03:32:34,319 left channel fifo we're just gonna do 3638 03:32:34,318 --> 03:32:42,000 let's go to our cpp file let's go to our 3639 03:32:38,318 --> 03:32:42,000 uh response curve constructor 3640 03:32:42,959 --> 03:32:48,639 and we need to initialize this guy let's 3641 03:32:48,639 --> 03:32:54,719 um this is where we're going to do left 3642 03:32:50,159 --> 03:32:57,760 channel fifo and we want to pass it the 3643 03:32:54,719 --> 03:33:00,719 audio processor dot what's the name of 3644 03:32:57,760 --> 03:33:07,200 that thing the left channel fifo 3645 03:33:00,719 --> 03:33:07,199 okay let's go to our timer callback 3646 03:33:07,840 --> 03:33:10,799 now this is where we are going to 3647 03:33:09,120 --> 03:33:11,520 coordinate all of those pieces of the 3648 03:33:11,520 --> 03:33:16,840 let me pull this back up we are going to 3649 03:33:20,079 --> 03:33:24,238 with this with this and with this okay 3650 03:33:22,799 --> 03:33:26,079 we're gonna coordinate all those little 3651 03:33:26,079 --> 03:33:29,279 first thing we're gonna do is the single 3652 03:33:29,279 --> 03:33:32,960 uh sample fifo so here's the logic we 3653 03:33:32,959 --> 03:33:37,599 while there are buffers to pull if we 3654 03:33:35,600 --> 03:33:39,120 can pull a buffer we're going to send it 3655 03:33:39,120 --> 03:33:43,920 data generator so the first thing we 3656 03:33:40,959 --> 03:33:46,959 need is a temp buffer to pull into 3657 03:33:43,920 --> 03:33:49,439 okay we're going to do this um before 3658 03:33:46,959 --> 03:33:53,119 all of this uh parameters change stuff 3659 03:33:49,439 --> 03:33:53,120 okay let's make our temporary buffer 3660 03:33:53,600 --> 03:33:56,800 all right uh just before we do that 3661 03:33:55,520 --> 03:33:58,720 actually let me go through and just 3662 03:33:58,719 --> 03:34:03,278 um for our fifo guy single channel 3663 03:34:01,439 --> 03:34:04,079 sample fifo all we need care about is 3664 03:34:04,079 --> 03:34:10,398 uh how do we feed it buffers how do we 3665 03:34:10,398 --> 03:34:14,879 buffers from it okay this is how we know 3666 03:34:13,600 --> 03:34:16,559 how many we have and this is how we 3667 03:34:14,879 --> 03:34:19,358 actually get a buffer from it 3668 03:34:16,559 --> 03:34:20,799 okay very simple to use same thing for 3669 03:34:20,799 --> 03:34:24,879 we just push stuff into it and pull 3670 03:34:24,879 --> 03:34:28,000 and make sure that we've prepared it 3671 03:34:28,000 --> 03:34:34,559 pre-allocated space we need okay 3672 03:34:31,600 --> 03:34:36,000 all right so we need to um go through 3673 03:34:36,000 --> 03:34:40,559 you know while there are buffers to pull 3674 03:34:38,238 --> 03:34:41,760 from the single channel sample fifo 3675 03:34:40,559 --> 03:34:44,079 if we can pull it then we're going to 3676 03:34:41,760 --> 03:34:45,600 send it to the fft data generator 3677 03:34:44,079 --> 03:34:49,279 all right so let's add our while loop 3678 03:34:49,279 --> 03:34:52,800 get num buffers available if that's 3679 03:34:52,799 --> 03:34:56,159 there are more than zero buffers 3680 03:34:59,840 --> 03:35:03,600 give me that audio buffer temp incoming 3681 03:35:03,600 --> 03:35:08,840 if we can pull one of these then we are 3682 03:35:05,840 --> 03:35:10,318 going to send it to the fft data 3683 03:35:10,318 --> 03:35:13,840 all right now it is very important that 3684 03:35:11,920 --> 03:35:16,318 we maintain the order of the blocks 3685 03:35:13,840 --> 03:35:18,398 coming in from the audio thread 3686 03:35:16,318 --> 03:35:20,318 so before we send audio samples to the 3687 03:35:18,398 --> 03:35:21,439 fft data generator which we have not 3688 03:35:21,439 --> 03:35:24,800 we have to make sure that they stay in 3689 03:35:22,959 --> 03:35:26,398 the same order okay we also need to make 3690 03:35:24,799 --> 03:35:27,519 sure that the blocks being sent to the 3691 03:35:27,520 --> 03:35:32,238 uh data generator is the right size so 3692 03:35:30,000 --> 03:35:34,478 let's create a mono buffer first for 3693 03:35:37,279 --> 03:35:42,560 all right let's go over to our header 3694 03:35:42,559 --> 03:35:46,398 so this is what we are this is what the 3695 03:35:44,879 --> 03:35:48,079 buffer we are going to create now is 3696 03:35:48,079 --> 03:35:51,120 blocks of audio from right to left 3697 03:35:51,120 --> 03:35:56,640 so um let me see let me just draw a 3698 03:35:54,799 --> 03:35:58,799 quick graph of what i'm talking about 3699 03:35:59,040 --> 03:36:02,640 okay so what i was saying about how the 3700 03:36:01,040 --> 03:36:04,319 buffers need to be ferried from the 3701 03:36:04,318 --> 03:36:07,519 so this is an example of like of 3702 03:36:07,520 --> 03:36:12,238 equals zero and then all the way to the 3703 03:36:09,359 --> 03:36:14,159 end of it okay so what happens is 3704 03:36:12,238 --> 03:36:15,439 the buffers are passed to us from the 3705 03:36:15,439 --> 03:36:20,079 that's what these a b and c blocks are 3706 03:36:17,840 --> 03:36:20,639 so what happens is we're given a and 3707 03:36:20,639 --> 03:36:27,439 we need to basically when we consume 3708 03:36:24,318 --> 03:36:28,799 things with our fft and our um 3709 03:36:27,439 --> 03:36:30,318 single channel sample fifo we're 3710 03:36:28,799 --> 03:36:31,438 basically taking one of these blocks and 3711 03:36:30,318 --> 03:36:33,680 then running it through that 3712 03:36:31,439 --> 03:36:35,760 chain that i showed before and then the 3713 03:36:33,680 --> 03:36:39,040 whole thing needs to shift over 3714 03:36:35,760 --> 03:36:40,000 uh this direction okay so the a block 3715 03:36:40,000 --> 03:36:43,600 right it was just consumed by the gui 3716 03:36:43,600 --> 03:36:48,079 block b and c they get shifted over like 3717 03:36:46,159 --> 03:36:49,920 this so you can see the continuity 3718 03:36:48,079 --> 03:36:51,520 of this point right here to this point 3719 03:36:49,920 --> 03:36:52,559 right there same for that point right 3720 03:36:52,559 --> 03:36:55,840 here's the new data from the host it's 3721 03:36:55,840 --> 03:36:58,880 added to the waveform right here so it's 3722 03:36:58,879 --> 03:37:02,559 and that gets now we consume this part 3723 03:37:00,959 --> 03:37:04,318 right here okay then the same thing 3724 03:37:02,559 --> 03:37:05,359 happens this little chunk of audio gets 3725 03:37:05,359 --> 03:37:09,120 stuff and produce is turned into a path 3726 03:37:09,120 --> 03:37:12,560 consumed and then the whole thing gets 3727 03:37:10,478 --> 03:37:15,760 shifted over again so that's why 3728 03:37:12,559 --> 03:37:18,478 you can see that this piece gets shifted 3729 03:37:15,760 --> 03:37:19,920 to block number two then it gets shifted 3730 03:37:18,478 --> 03:37:21,599 to block number one and then it gets 3731 03:37:19,920 --> 03:37:23,439 consumed okay so that's what i meant 3732 03:37:23,439 --> 03:37:27,200 uh the blocks um to the end of it and 3733 03:37:27,200 --> 03:37:32,399 uh towards the front of the vector 3734 03:37:30,559 --> 03:37:33,840 okay so we're going to implement that 3735 03:37:33,840 --> 03:37:39,200 so uh we are going to need a uh 3736 03:37:37,520 --> 03:37:40,479 we're going to need a monobuffer because 3737 03:37:39,200 --> 03:37:41,680 remember these are mono channels of 3738 03:37:41,680 --> 03:37:44,800 um newest blocks are going to get stuck 3739 03:37:43,279 --> 03:37:45,920 at the end and the oldest blocks are 3740 03:37:44,799 --> 03:37:47,278 going to go at the front so that way 3741 03:37:45,920 --> 03:37:51,040 everything gets kind of you know 3742 03:37:47,279 --> 03:37:53,359 shifted over this way okay step 3743 03:37:51,040 --> 03:37:55,120 14. all right let's go back to our cpp 3744 03:37:53,359 --> 03:37:56,000 file now that we have declared a mono 3745 03:37:56,000 --> 03:37:59,279 all right first we are going to shift 3746 03:37:57,520 --> 03:38:02,000 everything in the mono buffer 3747 03:37:59,279 --> 03:38:04,479 forward by however many samples there 3748 03:38:02,000 --> 03:38:08,639 are in that temporary incoming buffer 3749 03:38:04,478 --> 03:38:08,639 okay so let's get our size first 3750 03:38:10,079 --> 03:38:13,840 all right now let's do the copy 3751 03:38:22,079 --> 03:38:27,520 everything from this point which is 3752 03:38:25,520 --> 03:38:29,760 size samples across let me pull this 3753 03:38:29,760 --> 03:38:34,398 okay so let's pretend that this is our 3754 03:38:32,559 --> 03:38:36,000 monobuffer right here it contains this 3755 03:38:36,000 --> 03:38:40,719 okay our new chunk of data um is going 3756 03:38:39,199 --> 03:38:41,439 to get appended here so what we need to 3757 03:38:41,439 --> 03:38:45,120 basically copy all these samples 3758 03:38:45,120 --> 03:38:50,640 shift them over by however much this is 3759 03:38:49,120 --> 03:38:52,319 this direction so that's what we do here 3760 03:38:52,318 --> 03:38:56,799 we're going to copy everything to the 3761 03:38:53,760 --> 03:38:58,800 zero with uh index right there 3762 03:38:56,799 --> 03:39:00,879 and then we're gonna start reading from 3763 03:39:00,879 --> 03:39:04,559 okay that's what this thing does that's 3764 03:39:04,559 --> 03:39:08,318 that's our index um right there and then 3765 03:39:08,318 --> 03:39:13,198 uh this many samples so if our buffer is 3766 03:39:11,359 --> 03:39:15,199 holding this long and we are going to 3767 03:39:15,199 --> 03:39:18,399 this many samples from it that's how 3768 03:39:16,959 --> 03:39:20,799 much we have to shift over so 3769 03:39:18,398 --> 03:39:22,159 we need to keep this much okay i didn't 3770 03:39:22,159 --> 03:39:25,359 you can see from the code here what's 3771 03:39:23,359 --> 03:39:26,318 happening so once we have done that now 3772 03:39:26,318 --> 03:39:31,198 our temp buffer uh copy all the samples 3773 03:39:28,799 --> 03:39:34,000 from that to the end of our mono buffer 3774 03:39:31,199 --> 03:39:35,279 so our size we're going to copy that 3775 03:39:35,279 --> 03:39:39,840 put this on its own line our source is 3776 03:39:37,920 --> 03:39:42,879 going to be the temp incoming buffer 3777 03:39:39,840 --> 03:39:45,920 um it's going to be the zeroth channel 3778 03:39:42,879 --> 03:39:46,719 zero with index and we're going to copy 3779 03:39:46,719 --> 03:39:51,198 to our monobuffer get right pointer 3780 03:39:49,680 --> 03:39:52,238 copying it to the zeros channel and our 3781 03:39:52,238 --> 03:39:57,198 is going to be this position okay if 3782 03:39:55,359 --> 03:40:00,559 this doesn't make much sense to you 3783 03:39:57,199 --> 03:40:01,279 i suggest that you get out a a line 3784 03:40:01,279 --> 03:40:07,920 uh draw a number line and then 3785 03:40:04,478 --> 03:40:09,599 you know just like manually draw a block 3786 03:40:07,920 --> 03:40:11,279 of data moving from one part 3787 03:40:09,600 --> 03:40:13,279 to earlier in the chain to earlier in 3788 03:40:11,279 --> 03:40:16,720 the chain and data being added after it 3789 03:40:13,279 --> 03:40:18,960 and use varying sizes so you can see how 3790 03:40:16,719 --> 03:40:20,719 what we how far we have it have to move 3791 03:40:20,719 --> 03:40:23,840 uh sorry how far we have to move it 3792 03:40:23,840 --> 03:40:28,079 is dependent upon what size of our block 3793 03:40:28,079 --> 03:40:32,238 is okay so that takes care of those 3794 03:40:32,238 --> 03:40:36,879 we're shifting over the data and then 3795 03:40:34,159 --> 03:40:40,478 we're copying this to the end 3796 03:40:36,879 --> 03:40:43,278 and the good thing um about this is that 3797 03:40:40,478 --> 03:40:43,920 um the monobuffer never actually changes 3798 03:40:43,920 --> 03:40:47,680 so the next thing to do is to write the 3799 03:40:47,680 --> 03:40:50,720 however if you remember what i said 3800 03:40:50,719 --> 03:40:54,799 requires a specific number of samples in 3801 03:40:52,959 --> 03:40:56,238 order to do its processing so we must 3802 03:40:56,238 --> 03:40:59,680 have that same size and this is good 3803 03:40:58,318 --> 03:41:01,198 because we don't know how big to make 3804 03:41:01,199 --> 03:41:04,399 for us to be able to copy into it and to 3805 03:41:04,398 --> 03:41:08,000 like at this point based on our current 3806 03:41:06,559 --> 03:41:09,439 code this is not going to work it's 3807 03:41:08,000 --> 03:41:10,959 going to explode because the monobuffer 3808 03:41:09,439 --> 03:41:11,920 doesn't have any channels and it doesn't 3809 03:41:11,920 --> 03:41:15,840 so we're going to try to do like a 3810 03:41:13,840 --> 03:41:17,760 negative we're going to copy like 3811 03:41:15,840 --> 03:41:19,040 negative samples and it's just going to 3812 03:41:19,040 --> 03:41:22,960 so once the fft data generator is built 3813 03:41:22,959 --> 03:41:26,959 what size to use for the monobuffer so 3814 03:41:26,959 --> 03:41:30,159 once we are done with those two things 3815 03:41:28,398 --> 03:41:32,799 then we can start sending buffers 3816 03:41:30,159 --> 03:41:35,039 from uh the we can start sending mono 3817 03:41:35,040 --> 03:41:39,760 generator okay so let's make this next 3818 03:41:38,079 --> 03:41:42,159 all right this is going to go up here 3819 03:41:39,760 --> 03:41:45,600 all right this is the fft data 3820 03:41:42,159 --> 03:41:46,398 generator all right let's take a quick 3821 03:41:46,398 --> 03:41:50,159 it's got a lot of good stuff in it it's 3822 03:41:50,159 --> 03:41:53,680 complicated piece of uh software 3823 03:41:53,680 --> 03:41:57,600 now if you want to know how to build it 3824 03:41:55,520 --> 03:41:58,319 yourself i go through the entire process 3825 03:41:58,318 --> 03:42:02,879 in the pfm project 11 course all we need 3826 03:42:02,879 --> 03:42:05,920 for our purposes is how do we feed it 3827 03:42:05,920 --> 03:42:10,000 how do we get fft data out of it and 3828 03:42:08,398 --> 03:42:12,639 then how do we configure it 3829 03:42:10,000 --> 03:42:14,159 okay so let's do the configuration first 3830 03:42:12,639 --> 03:42:15,358 uh configuration depends on this stuff 3831 03:42:15,359 --> 03:42:22,720 here's how we feed audio into it 3832 03:42:19,760 --> 03:42:23,520 and then here's how we get our fft data 3833 03:42:23,520 --> 03:42:27,359 see how much ffdata fft data we have 3834 03:42:27,359 --> 03:42:31,600 that's the basic interface all right 3835 03:42:29,359 --> 03:42:34,159 let's give ourselves an instance of this 3836 03:42:31,600 --> 03:42:36,159 after our monobuffer all right now the 3837 03:42:36,159 --> 03:42:40,159 operates on vectors of floats not audio 3838 03:42:40,159 --> 03:42:45,600 okay let's go to our constructor 3839 03:42:43,680 --> 03:42:47,680 so we can initialize this thing okay go 3840 03:42:45,600 --> 03:42:49,040 to our response curve constructor 3841 03:42:47,680 --> 03:42:51,040 okay we're going to do this before we 3842 03:42:49,040 --> 03:42:52,520 start updating our chain all right let's 3843 03:42:52,520 --> 03:42:55,920 2048 that'll give us some really nice 3844 03:42:55,920 --> 03:42:59,920 in the uh uh that'll give us average 3845 03:42:59,920 --> 03:43:04,719 um in the uh lower end of the spectrum 3846 03:43:03,520 --> 03:43:07,120 okay we're basically going to be 3847 03:43:04,719 --> 03:43:11,039 splitting the audio spectrum up into 3848 03:43:11,040 --> 03:43:15,359 basically whatever value we pick from 3849 03:43:15,359 --> 03:43:19,920 4096 8192 basically what we are doing is 3850 03:43:19,920 --> 03:43:23,719 spectrum from 20 hertz to 20 000 hertz 3851 03:43:23,719 --> 03:43:28,318 2048 equally sized frequency bins now 3852 03:43:28,318 --> 03:43:32,879 store the magnitude level for a 3853 03:43:30,959 --> 03:43:34,079 particular range of frequencies 3854 03:43:32,879 --> 03:43:35,920 i'm not going to get into the math 3855 03:43:34,079 --> 03:43:37,039 behind this but here's the simple 3856 03:43:37,040 --> 03:43:42,000 okay if we have 2048 bins and a sample 3857 03:43:42,000 --> 03:43:48,799 48 000 then each bin represents roughly 3858 03:43:45,520 --> 03:43:51,120 23 hertz in our spectrum okay so that's 3859 03:43:48,799 --> 03:43:52,559 very simple math if our sample rate is 3860 03:43:52,559 --> 03:43:59,278 and then we have 2048 bins each bin 3861 03:43:56,318 --> 03:44:00,318 roughly accounts for 23 hertz so that 3862 03:44:00,318 --> 03:44:03,760 we're going to let this means we're 3863 03:44:02,000 --> 03:44:04,639 gonna get a lot of resolution at the 3864 03:44:04,639 --> 03:44:07,680 and not a lot of resolution at the 3865 03:44:07,680 --> 03:44:12,159 just take a look um at our plot so you 3866 03:44:10,559 --> 03:44:13,920 can see what i'm talking about okay you 3867 03:44:13,920 --> 03:44:17,040 whoops yeah this is what i meant about 3868 03:44:17,040 --> 03:44:20,560 let me comment out that code this stuff 3869 03:44:19,199 --> 03:44:22,079 right here let's comment this out so 3870 03:44:20,559 --> 03:44:22,478 this is what i meant how like if each 3871 03:44:22,478 --> 03:44:27,679 represents 23 hertz between 20 and 50 3872 03:44:26,159 --> 03:44:28,879 between this part of the display and 3873 03:44:33,279 --> 03:44:36,319 that's how big one bin is way down here 3874 03:44:36,318 --> 03:44:41,680 but way up here we've got 2 000 to 5 3875 03:44:39,359 --> 03:44:44,479 000. how many bins are there 3876 03:44:41,680 --> 03:44:45,680 let's find out so 5 thousand minus two 3877 03:44:45,680 --> 03:44:50,880 okay divided by oops divided by 23. 3878 03:44:49,120 --> 03:44:52,319 there's a hundred and thirty bins that 3879 03:44:52,318 --> 03:44:55,359 so we're going to get a lot of 3880 03:44:55,359 --> 03:44:59,120 uh way up here but not a lot of 3881 03:44:59,120 --> 03:45:02,560 okay this is the big problem with fft 3882 03:45:02,559 --> 03:45:08,879 it's just that's just how it works okay 3883 03:45:06,159 --> 03:45:09,760 so the lowest five percent of this fee 3884 03:45:09,760 --> 03:45:12,880 frequency spectrum is going to represent 3885 03:45:11,359 --> 03:45:14,318 50 percent of the display and the 3886 03:45:14,318 --> 03:45:20,398 is going to represent the other 3887 03:45:18,318 --> 03:45:21,519 um yeah and it's going to represent the 3888 03:45:21,520 --> 03:45:25,600 uh 50 what is that referring to i am 3889 03:45:25,600 --> 03:45:31,040 where we've got one kilohertz is 50 of 3890 03:45:28,639 --> 03:45:31,519 the display from zero to one kilohertz 3891 03:45:31,520 --> 03:45:36,238 range is 20 kilohertz so that means this 3892 03:45:36,238 --> 03:45:40,398 from right here to right here we cover 3893 03:45:38,000 --> 03:45:42,000 five percent of our frequency range 3894 03:45:40,398 --> 03:45:44,079 and then this part the other half of the 3895 03:45:42,000 --> 03:45:44,639 display is covering the remaining 95 3896 03:45:44,639 --> 03:45:48,318 okay so all this is saying that you know 3897 03:45:48,318 --> 03:45:51,680 our we're going to get a ton of 3898 03:45:51,680 --> 03:45:55,520 not a lot of resolution here the only 3899 03:45:55,520 --> 03:45:59,199 improve that is to increase the fft 3900 03:45:59,199 --> 03:46:05,760 when you do that the fft ends up 3901 03:46:02,559 --> 03:46:07,359 needing more and more cpu so there's a 3902 03:46:11,680 --> 03:46:18,639 versus 8192 in terms of these 3903 03:46:15,199 --> 03:46:21,920 the order that the fft is configured in 3904 03:46:18,639 --> 03:46:22,719 okay um that was kind of confusing but 3905 03:46:22,719 --> 03:46:26,879 when you make the order higher you get 3906 03:46:24,879 --> 03:46:27,759 more resolution in the lower end at the 3907 03:46:27,760 --> 03:46:32,159 more cpu okay so we're gonna put it at 3908 03:46:32,159 --> 03:46:36,238 uh frequency bins for right now just so 3909 03:46:36,238 --> 03:46:41,840 we don't have major performance impacts 3910 03:46:39,520 --> 03:46:43,199 when we actually use this thing let's 3911 03:46:43,199 --> 03:46:47,120 let's go back to our constructor and now 3912 03:46:47,120 --> 03:46:51,279 left channel fifo left channel fft data 3913 03:46:51,279 --> 03:46:54,960 change order and we're going to use fft 3914 03:46:54,959 --> 03:47:01,519 order and 2048. all right now that our 3915 03:46:58,478 --> 03:47:03,760 fft data generator has been configured 3916 03:47:01,520 --> 03:47:04,640 we can initialize the monobuffer with 3917 03:47:04,639 --> 03:47:08,238 size so we can do monobuffer dot set 3918 03:47:08,238 --> 03:47:12,000 we are processing one channel and our 3919 03:47:12,000 --> 03:47:18,879 is whatever size this thing needs 3920 03:47:15,279 --> 03:47:20,720 left get fft size we can uncomment these 3921 03:47:18,879 --> 03:47:22,478 guys these guys are uncommented 3922 03:47:20,719 --> 03:47:25,039 all right now that we have this and the 3923 03:47:22,478 --> 03:47:27,278 monobuffer is set up and the fft data 3924 03:47:25,040 --> 03:47:28,479 generator is ready to receive buffers we 3925 03:47:28,478 --> 03:47:31,760 mono buffers to the generator so we can 3926 03:47:31,760 --> 03:47:36,000 left channel fft data generator dot 3927 03:47:36,000 --> 03:47:39,520 some fft data we're going to pass it the 3928 03:47:39,520 --> 03:47:46,720 and we want to use negative infinity 3929 03:47:44,079 --> 03:47:48,559 we want to use our negative 48 as where 3930 03:47:46,719 --> 03:47:49,599 negative infinity is or we can change 3931 03:47:49,600 --> 03:47:53,359 okay so let's check this out i'll just 3932 03:47:52,000 --> 03:47:55,040 put negative 48 because i want the 3933 03:47:55,040 --> 03:47:58,239 bottom of my spectrum analyzer that grid 3934 03:47:58,238 --> 03:48:02,559 um i had set the scale to negative 48 so 3935 03:48:01,040 --> 03:48:05,600 i'm going to use that right now for 3936 03:48:02,559 --> 03:48:07,519 the concept of negative infinity okay so 3937 03:48:05,600 --> 03:48:09,359 let's build it and see what happens 3938 03:48:07,520 --> 03:48:11,520 all right build failed why are we 3939 03:48:11,520 --> 03:48:15,920 expect to call aha this is because our 3940 03:48:14,000 --> 03:48:16,639 fifo class needs a second prepare 3941 03:48:16,639 --> 03:48:20,000 handle when the type is vector not audio 3942 03:48:20,000 --> 03:48:24,318 that's over here in our plug-in 3943 03:48:21,520 --> 03:48:26,720 processor all right it wants this 3944 03:48:24,318 --> 03:48:28,879 we are currently using this let's see 3945 03:48:26,719 --> 03:48:31,920 what's going on prepares declared here 3946 03:48:28,879 --> 03:48:33,358 we are instantiating it um where is this 3947 03:48:33,359 --> 03:48:37,040 it's being called right here where we've 3948 03:48:40,559 --> 03:48:45,039 where was this declared this was being 3949 03:48:45,040 --> 03:48:49,199 okay so that means this fifo has a block 3950 03:48:49,199 --> 03:48:55,920 of std vector okay and so obviously 3951 03:48:52,879 --> 03:48:57,278 std vector does not have a set size 3952 03:48:57,279 --> 03:49:00,399 create a new prepare function all right 3953 03:49:00,398 --> 03:49:05,198 all right let's use some static asserts 3954 03:49:05,199 --> 03:49:08,560 to remind us which prepare function to 3955 03:49:08,559 --> 03:49:15,600 assert our expression is going to be std 3956 03:49:11,920 --> 03:49:19,680 is same there it is all right 3957 03:49:19,680 --> 03:49:23,680 um we want to only use this prepare 3958 03:49:30,478 --> 03:49:36,639 okay it's helpful helping ourselves 3959 03:49:34,639 --> 03:49:38,318 so check it out if we build it now 3960 03:49:38,318 --> 03:49:41,760 so that's fantastic failed to meet 3961 03:49:41,760 --> 03:49:45,279 and then we can see the message it 3962 03:49:45,279 --> 03:49:48,720 okay that's good times and it says right 3963 03:49:48,719 --> 03:49:53,278 instantiation of member std uh fifo std 3964 03:49:53,279 --> 03:49:56,399 okay so we can you know help ourselves 3965 03:49:56,398 --> 03:50:00,238 let's write the other uh prepare 3966 03:50:00,238 --> 03:50:03,279 and this is gonna be size t num elements 3967 03:50:03,279 --> 03:50:07,520 vector uses size t internally we'll do 3968 03:50:07,520 --> 03:50:11,359 static assert we'll change the message a 3969 03:50:11,359 --> 03:50:18,640 instead of this we will use std 3970 03:50:14,559 --> 03:50:20,799 vector and this should be num elements 3971 03:50:18,639 --> 03:50:22,318 num elements should only be used when 3972 03:50:22,318 --> 03:50:26,398 std vector float all right let's uh loop 3973 03:50:26,398 --> 03:50:33,039 here we're gonna go for auto buffer 3974 03:50:33,040 --> 03:50:37,120 dot clear clear at first then buffer dot 3975 03:50:37,120 --> 03:50:42,640 num elements and fill it with zeros 3976 03:50:40,398 --> 03:50:44,398 all right now let's build it all right 3977 03:50:44,398 --> 03:50:50,000 let's head on over to plugineditor.cpp 3978 03:50:47,520 --> 03:50:51,439 now the fft data generator let's go down 3979 03:50:51,439 --> 03:50:56,800 okay the fft data generator is producing 3980 03:50:56,799 --> 03:50:59,840 so now we need to turn those blocks into 3981 03:50:59,840 --> 03:51:04,159 instance okay so let's write a path 3982 03:51:04,159 --> 03:51:07,439 all right let's go up to our header file 3983 03:51:07,439 --> 03:51:12,000 fft data generator before the look and 3984 03:51:12,000 --> 03:51:15,840 now this class is going to take in this 3985 03:51:15,840 --> 03:51:20,159 a bounding box info about the fft size 3986 03:51:18,639 --> 03:51:21,519 and the bin width and it's going to spit 3987 03:51:21,520 --> 03:51:26,319 now this is the this is a simplified 3988 03:51:23,680 --> 03:51:28,000 version of the path producer in 3989 03:51:26,318 --> 03:51:30,959 project 11 so if you want to learn how 3990 03:51:30,959 --> 03:51:33,438 check out the course you're going to 3991 03:51:32,478 --> 03:51:34,079 learn to make all this stuff from 3992 03:51:34,079 --> 03:51:37,600 by yourself i'm going to give you the 3993 03:51:35,520 --> 03:51:39,920 instructions and then review your code 3994 03:51:37,600 --> 03:51:40,880 which is pretty cool all right let's do 3995 03:51:40,879 --> 03:51:44,000 all right i'm just going to paste it 3996 03:51:42,159 --> 03:51:46,799 right here okay we can check this out in 3997 03:51:47,120 --> 03:51:51,040 okay all we need to know is how to feed 3998 03:51:51,040 --> 03:51:54,880 our data via the generatepath function 3999 03:51:54,879 --> 03:51:58,238 paths out of it that's what this does 4000 03:51:58,238 --> 03:52:01,279 okay so we've got our number available 4001 03:52:01,279 --> 03:52:05,680 uh our function that gives us any paths 4002 03:52:05,680 --> 03:52:09,199 and then here's how it actually converts 4003 03:52:07,600 --> 03:52:10,640 that into data so again if you want to 4004 03:52:09,199 --> 03:52:11,279 learn how to actually write this from 4005 03:52:11,279 --> 03:52:15,120 and learn how it actually works this is 4006 03:52:12,799 --> 03:52:18,398 a simplified version of the big one 4007 03:52:15,120 --> 03:52:19,760 in the full course okay all right 4008 03:52:18,398 --> 03:52:21,439 obviously we are going to need an 4009 03:52:19,760 --> 03:52:22,478 instance so let's give ourselves one of 4010 03:52:22,478 --> 03:52:29,438 that goes down here analyzer 4011 03:52:25,600 --> 03:52:32,238 path generator we want to feed it 4012 03:52:29,439 --> 03:52:32,800 juice paths or we want it to produce 4013 03:52:36,799 --> 03:52:40,000 now we can go back to our timer callback 4014 03:52:40,000 --> 03:52:46,238 familiar logic while there are fft 4015 03:52:43,520 --> 03:52:47,840 data buffers to pull if we can pull a 4016 03:52:47,840 --> 03:52:53,120 let's generate a path okay so i'll just 4017 03:52:51,439 --> 03:52:57,199 make a little comment myself 4018 03:52:53,120 --> 03:53:01,439 if there are fft data buffers 4019 03:52:57,199 --> 03:53:05,359 to pull if we can pull a buffer 4020 03:53:01,439 --> 03:53:07,520 generate a path all right very simple 4021 03:53:05,359 --> 03:53:09,840 okay now the path producer will produce 4022 03:53:07,520 --> 03:53:10,479 a path inside of whatever bounding box 4023 03:53:10,478 --> 03:53:13,760 okay let's just take a look at this 4024 03:53:11,520 --> 03:53:14,319 interface real quick all right so we've 4025 03:53:14,318 --> 03:53:18,000 it wants some rendered data it's going 4026 03:53:16,238 --> 03:53:19,920 to want a bounding box and it wants to 4027 03:53:19,920 --> 03:53:23,120 the bin width and where negative 4028 03:53:23,120 --> 03:53:26,239 or what value is being considered 4029 03:53:26,238 --> 03:53:33,680 okay so let's provide those things 4030 03:53:30,159 --> 03:53:37,600 so our bounding box is going to be our 4031 03:53:33,680 --> 03:53:40,479 fft bounds get analysis area 4032 03:53:37,600 --> 03:53:42,000 and it wants it to be to float all right 4033 03:53:40,478 --> 03:53:44,238 and it needs to know the fft 4034 03:53:42,000 --> 03:53:45,120 size and the bin width and frequencies 4035 03:53:45,120 --> 03:53:48,880 the fft size as we showed in the 4036 03:53:48,879 --> 03:53:52,639 we can just get it right from the 4037 03:53:50,398 --> 03:53:52,959 constructor like that or right from that 4038 03:53:52,959 --> 03:53:58,478 fft generator class auto fft 4039 03:53:56,318 --> 03:54:00,639 size oh these should be const because 4040 03:54:00,639 --> 03:54:04,079 okay and then we need to know our bin 4041 03:54:04,079 --> 03:54:09,439 and that's going to be as we showed up 4042 03:54:06,238 --> 03:54:14,719 here our sample rate divided by our 4043 03:54:09,439 --> 03:54:14,720 fft size let me just copy this down here 4044 03:54:18,398 --> 03:54:25,439 so const auto bin width equals 4045 03:54:22,238 --> 03:54:28,318 audio processor i'll get the sample rate 4046 03:54:25,439 --> 03:54:29,600 divide that by our fft size convert it 4047 03:54:32,879 --> 03:54:36,398 now we can implement our logic here 4048 03:54:36,398 --> 03:54:44,478 left channel f50 data generator 4049 03:54:40,318 --> 03:54:47,039 um while it has fft blocks whoops 4050 03:54:44,478 --> 03:54:47,920 right if it has more than zero blocks 4051 03:54:47,920 --> 03:54:52,719 let's try to get one okay we need a 4052 03:54:57,680 --> 03:55:01,760 put past that here all right if we're 4053 03:55:01,760 --> 03:55:08,800 then we can pass our vector of 4054 03:55:08,799 --> 03:55:12,398 to our path producer sorry okay one more 4055 03:55:12,398 --> 03:55:15,519 so we're going to check if we have more 4056 03:55:18,799 --> 03:55:23,920 um if we if there are more than zero fft 4057 03:55:21,439 --> 03:55:25,760 blocks available let's try to pull one 4058 03:55:23,920 --> 03:55:27,920 and if we are able to pull one this 4059 03:55:25,760 --> 03:55:28,559 vector now contains our fft data which 4060 03:55:28,559 --> 03:55:34,238 feed to our paths producer okay 4061 03:55:31,680 --> 03:55:36,639 so let's pass that along fft data we 4062 03:55:34,238 --> 03:55:39,520 know our bounds that's that fft bounds 4063 03:55:36,639 --> 03:55:40,799 we know our fft size we know our bin 4064 03:55:40,799 --> 03:55:44,318 and we'll use that negative 48 again for 4065 03:55:44,318 --> 03:55:50,559 concept of negative infinity all right 4066 03:55:47,439 --> 03:55:53,120 that should build without errors 4067 03:55:50,559 --> 03:55:53,760 all right good times i'll let you see 4068 03:55:53,760 --> 03:55:57,359 fft this path generator one more time so 4069 03:55:57,359 --> 03:56:00,880 try to copy the code real quickly scroll 4070 03:55:59,600 --> 03:56:02,960 down a little bit you can just pause the 4071 03:56:00,879 --> 03:56:05,920 video if you need to to see it 4072 03:56:02,959 --> 03:56:06,318 good times same for this one right here 4073 03:56:06,318 --> 03:56:09,439 there's the path there's the data 4074 03:56:09,439 --> 03:56:14,880 okay all right so this builds currently 4075 03:56:12,959 --> 03:56:16,159 um we are almost there we just need to 4076 03:56:16,159 --> 03:56:21,279 and then draw them all right go to your 4077 03:56:21,279 --> 03:56:26,640 okay go down to after where we added our 4078 03:56:26,639 --> 03:56:31,920 all right we have at this point we are 4079 03:56:29,120 --> 03:56:34,000 producing paths in our path generator 4080 03:56:31,920 --> 03:56:35,279 now we just need a path to draw and to 4081 03:56:35,279 --> 03:56:37,920 because remember we're pulling it from 4082 03:56:36,478 --> 03:56:38,959 the timer callback we need to get it 4083 03:56:38,959 --> 03:56:42,719 so it needs to be a member variable 4084 03:56:46,318 --> 03:56:51,039 that's makes sense why we have that 4085 03:56:49,359 --> 03:56:52,399 all right let's go to our plugin editor 4086 03:56:52,398 --> 03:56:58,959 so at this point a path producer has 4087 03:56:55,920 --> 03:57:02,000 potentially created a path for us 4088 03:56:58,959 --> 03:57:04,799 so we need to try to pull them 4089 03:57:02,000 --> 03:57:05,520 now what happens if we are producing 4090 03:57:05,520 --> 03:57:10,880 faster than we can consume them we just 4091 03:57:08,639 --> 03:57:12,238 want the most recent one so our logic is 4092 03:57:12,238 --> 03:57:21,359 while there are paths that can be pulled 4093 03:57:16,559 --> 03:57:23,920 pull as many as we can because we only 4094 03:57:21,359 --> 03:57:26,000 we're only going to display the most 4095 03:57:29,120 --> 03:57:35,840 path producer get num paths available 4096 03:57:35,840 --> 03:57:43,439 get path and we can use our left channel 4097 03:57:43,439 --> 03:57:47,439 that has successfully pulled that path 4098 03:57:47,439 --> 03:57:50,720 previously we were only repainting 4099 03:57:50,719 --> 03:57:54,959 parameters were changed but because 4100 03:57:52,238 --> 03:57:57,920 we're pulling paths all the time 4101 03:57:54,959 --> 03:57:59,438 we need to repaint all the time so this 4102 03:57:59,439 --> 03:58:04,479 this goes here repaint like that 4103 03:58:02,799 --> 03:58:06,159 all right now we just need to paint the 4104 03:58:06,159 --> 03:58:10,000 let's go here all right let's go to our 4105 03:58:10,000 --> 03:58:15,359 let's go to our paint function and let's 4106 03:58:15,359 --> 03:58:19,680 where are we going to draw this let's 4107 03:58:16,879 --> 03:58:21,278 draw this before we draw our 4108 03:58:19,680 --> 03:58:23,040 uh where is this let's draw this before 4109 03:58:21,279 --> 03:58:24,159 we draw our rendered area so it's behind 4110 03:58:24,159 --> 03:58:27,199 okay let's do let's i'm going to use a 4111 03:58:27,199 --> 03:58:30,960 all right and we can just do g stroke 4112 03:58:30,959 --> 03:58:35,919 left channel fft data fft path and then 4113 03:58:34,159 --> 03:58:37,039 i'm just going to use a path stroke type 4114 03:58:37,040 --> 03:58:42,800 with a thickness of one and let's run it 4115 03:58:40,799 --> 03:58:44,639 we should see something oh my fault what 4116 03:58:42,799 --> 03:58:48,318 is going on here i spelled that wrong i 4117 03:58:44,639 --> 03:58:50,639 did spell that wrong okay let's run this 4118 03:58:48,318 --> 03:58:51,840 um not as the standalone but as the 4119 03:58:51,840 --> 03:58:56,318 has the plugin in the audio plugin host 4120 03:58:54,238 --> 03:58:59,520 okay we should see something 4121 03:58:56,318 --> 03:59:00,719 once we actually press play okay 4122 03:58:59,520 --> 03:59:02,079 all right we have a blue line what 4123 03:59:00,719 --> 03:59:03,920 happens if we actually run audio through 4124 03:59:03,920 --> 03:59:09,040 all right it's doing something 4125 03:59:09,040 --> 03:59:13,199 okay cool that is an fft that is a 4126 03:59:13,199 --> 03:59:16,399 okay now it's in the wrong place but it 4127 03:59:16,398 --> 03:59:20,639 which is awesome so we can fix that 4128 03:59:20,639 --> 03:59:24,398 let's make a commit of that because that 4129 03:59:31,600 --> 03:59:35,920 okay of course in the description i will 4130 03:59:39,040 --> 03:59:42,560 the links in the description the links 4131 03:59:42,559 --> 03:59:46,398 will um there will be a link to this 4132 03:59:44,799 --> 03:59:47,599 repository so you can check out the code 4133 03:59:51,040 --> 03:59:55,040 and then you can get the code for the 4134 03:59:52,879 --> 03:59:56,559 single channel sample fifo the fft data 4135 03:59:55,040 --> 03:59:58,080 generator and the analyzer path 4136 03:59:58,079 --> 04:00:02,559 okay all right now there's a small bug 4137 04:00:02,559 --> 04:00:07,039 with the way this stuff is getting 4138 04:00:03,840 --> 04:00:10,159 mapped we are currently mapping from 4139 04:00:07,040 --> 04:00:12,560 um we're mapping our bin frequency from 4140 04:00:10,159 --> 04:00:13,920 1 to 20 hertz but our frequency range is 4141 04:00:13,920 --> 04:00:18,478 20 to 20 hertz so that's the first bug 4142 04:00:18,478 --> 04:00:23,599 okay if we run this and check it out it 4143 04:00:21,279 --> 04:00:25,359 should look a little bit different 4144 04:00:23,600 --> 04:00:27,840 or the x positions should look a little 4145 04:00:31,920 --> 04:00:35,520 okay now it's hard to tell but basically 4146 04:00:33,680 --> 04:00:38,318 we weren't seeing a lot of left 4147 04:00:35,520 --> 04:00:39,760 stuff on the left side okay so that's a 4148 04:00:39,760 --> 04:00:44,639 all right let's close that let's save 4149 04:00:42,478 --> 04:00:46,478 this so our parameters are saved 4150 04:00:44,639 --> 04:00:49,119 and we if we want we can use a different 4151 04:00:46,478 --> 04:00:51,039 color to make the paths more 4152 04:00:49,120 --> 04:00:52,479 visible it's you know that blue color is 4153 04:00:52,478 --> 04:00:56,959 okay let's start making this show up in 4154 04:00:56,959 --> 04:01:01,759 okay let's go to our paint function okay 4155 04:00:59,760 --> 04:01:02,159 now when the path generator creates a 4156 04:01:02,159 --> 04:01:06,478 it does not take into account the origin 4157 04:01:04,398 --> 04:01:09,119 of the rectangle that defines 4158 04:01:06,478 --> 04:01:10,318 the bounding box so we need to translate 4159 04:01:10,318 --> 04:01:16,398 to the analysis bounding boxes origin 4160 04:01:13,680 --> 04:01:16,880 okay right now this path is drawn at 4161 04:01:16,879 --> 04:01:23,039 comma 0 and we need it to be drawn at um 4162 04:01:20,799 --> 04:01:24,799 our response areas x and y that needs to 4163 04:01:23,040 --> 04:01:26,800 be the left side of the path okay 4164 04:01:24,799 --> 04:01:28,159 so we need to do a translate first so 4165 04:01:31,439 --> 04:01:36,559 apply transform so we're going to do a 4166 04:01:34,559 --> 04:01:39,439 normal a fine transform and we're going 4167 04:01:39,439 --> 04:01:46,000 so we want to do response area dot get x 4168 04:01:46,000 --> 04:01:52,159 okay what does that do if we run it 4169 04:01:49,600 --> 04:01:53,120 that should be all we need to do okay 4170 04:01:53,120 --> 04:01:57,520 right the right on the negative 48 so 4171 04:01:57,520 --> 04:02:01,279 cool so it's now drawing in the right 4172 04:01:59,760 --> 04:02:02,800 spot i'm gonna use a different 4173 04:02:01,279 --> 04:02:04,720 use like sky blue or something for this 4174 04:02:04,719 --> 04:02:08,719 so we can see it a little bit better oh 4175 04:02:07,279 --> 04:02:09,359 what happened here oh there's a bug for 4176 04:02:09,359 --> 04:02:12,720 that's right it's gonna do that for a 4177 04:02:12,719 --> 04:02:17,599 um we'll figure it out the fft data is 4178 04:02:17,600 --> 04:02:22,399 nands i'll just comment that out for 4179 04:02:22,398 --> 04:02:26,000 okay let's press play all right that's 4180 04:02:26,000 --> 04:02:30,478 that's all i'm trying to show 4181 04:02:30,478 --> 04:02:35,119 okay cool all right we'll figure that 4182 04:02:35,120 --> 04:02:38,960 all right let's make a commit showing um 4183 04:02:37,120 --> 04:02:40,640 that we fixed the positioning 4184 04:02:38,959 --> 04:02:43,358 because sometimes those types of bugs 4185 04:02:43,359 --> 04:02:50,800 to diagnose and then solve okay so 4186 04:02:50,799 --> 04:02:57,920 stage that stage that stage that 4187 04:02:53,840 --> 04:02:59,760 okay next we need to verify the accuracy 4188 04:02:59,760 --> 04:03:04,639 now to do this we are going to go to our 4189 04:03:04,639 --> 04:03:09,519 we are going to well we're going to 4190 04:03:07,359 --> 04:03:12,318 switch to the standalone version 4191 04:03:09,520 --> 04:03:13,840 and then we are going to we're going to 4192 04:03:12,318 --> 04:03:15,840 use an oscillator to do this 4193 04:03:13,840 --> 04:03:17,600 and we need to initialize it prepare it 4194 04:03:15,840 --> 04:03:19,840 and then use it in the process block 4195 04:03:17,600 --> 04:03:20,640 so we're going to feed it a test signal 4196 04:03:20,639 --> 04:03:24,398 right down to the bottom after our 4197 04:03:28,639 --> 04:03:32,159 like that okay that is now declared 4198 04:03:32,159 --> 04:03:35,279 make this produce a sine wave at a 4199 04:03:33,680 --> 04:03:37,439 particular frequency and we want it to 4200 04:03:37,439 --> 04:03:40,479 we want it to line up on our grid where 4201 04:03:40,478 --> 04:03:44,959 okay so let's go to our um where do we 4202 04:03:44,959 --> 04:03:49,119 we go we need to prepare it so let's go 4203 04:03:46,799 --> 04:03:51,759 to our prepare to play function 4204 04:03:49,120 --> 04:03:53,600 let's do this at the end uh the 4205 04:03:53,600 --> 04:03:57,359 that returns a value when you feed it a 4206 04:03:57,359 --> 04:04:00,960 okay so std sine wrapped in a lambda 4207 04:04:00,959 --> 04:04:04,639 oscillator dot initialize here it wants 4208 04:04:04,639 --> 04:04:08,159 uh lambda that takes in a number and 4209 04:04:08,159 --> 04:04:12,478 so let's do that here's our number that 4210 04:04:12,478 --> 04:04:15,519 and then here's what it's going to 4211 04:04:15,520 --> 04:04:20,319 okay now we need to prepare it and we 4212 04:04:18,238 --> 04:04:21,600 can use the same spec for our chain as 4213 04:04:21,600 --> 04:04:25,359 the number of channels okay previously 4214 04:04:25,359 --> 04:04:29,600 um we were saying our spec only had one 4215 04:04:28,000 --> 04:04:33,199 channel we just need to change that 4216 04:04:29,600 --> 04:04:36,720 spec.num channels equals get total 4217 04:04:36,719 --> 04:04:42,238 and then we can prepare it ask.prepair 4218 04:04:39,920 --> 04:04:43,520 the spec then let's give it a frequency 4219 04:04:43,520 --> 04:04:48,560 because that's one of our points in the 4220 04:04:45,520 --> 04:04:49,520 grid ask.set frequency we'll be changing 4221 04:04:49,520 --> 04:04:54,000 for a while just to verify the accuracy 4222 04:04:57,279 --> 04:05:03,040 and let's see what comes next 4223 04:05:00,398 --> 04:05:04,719 all right let's go to our prepare our 4224 04:05:03,040 --> 04:05:07,120 process block because we want to 4225 04:05:04,719 --> 04:05:09,198 use our oscillator to fill the buffer 4226 04:05:07,120 --> 04:05:11,600 okay so we're going to do this before 4227 04:05:09,199 --> 04:05:12,720 we um we're going to do this after our 4228 04:05:12,719 --> 04:05:17,119 are configured but before we actually 4229 04:05:17,120 --> 04:05:21,439 the filters we don't want to hear any of 4230 04:05:19,920 --> 04:05:24,478 the audio that's currently coming in 4231 04:05:24,478 --> 04:05:27,920 and then we need to make a stereo 4232 04:05:26,318 --> 04:05:29,198 context and then give it to our 4233 04:05:29,199 --> 04:05:35,600 that's all we have to do so let's see 4234 04:05:32,318 --> 04:05:38,879 this block is already stereo 4235 04:05:42,318 --> 04:05:47,760 okay buffer's clear we need let's make 4236 04:05:43,920 --> 04:05:50,960 our stereo context for this block 4237 04:05:47,760 --> 04:05:52,520 stereo context from the block and then 4238 04:05:55,600 --> 04:06:00,479 context all right that's it okay and we 4239 04:06:00,478 --> 04:06:05,679 so apologies in advance for the annoying 4240 04:06:02,719 --> 04:06:05,679 sine waves we're going to hear 4241 04:06:08,318 --> 04:06:14,159 okay so our frequency was 200 so let's 4242 04:06:14,159 --> 04:06:18,799 5k and see what it looks like so i'm 4243 04:06:18,799 --> 04:06:25,679 a thousand we should see a little blip 4244 04:06:25,680 --> 04:06:29,760 all right that's good for me thousand 4245 04:06:33,279 --> 04:06:39,439 yep right at 5k yikes that's painful 4246 04:06:36,478 --> 04:06:41,278 let's make this 50. this will be the 4247 04:06:41,279 --> 04:06:47,279 all right i'm not seeing anything at 50 4248 04:06:47,279 --> 04:06:51,920 all right there's our 100 okay so 50 was 4249 04:06:50,318 --> 04:06:52,559 pretty low for some reason it's pretty 4250 04:06:52,559 --> 04:06:56,079 it you know it's showing a peak at 100 4251 04:06:59,760 --> 04:07:03,520 that's good times um if we want to do 4252 04:07:01,760 --> 04:07:05,040 more resolution in the lower end we 4253 04:07:05,040 --> 04:07:08,319 of the fft generator but this is good 4254 04:07:06,879 --> 04:07:09,599 enough for this project you know like 4255 04:07:08,318 --> 04:07:11,278 we're just trying to get our feet wet 4256 04:07:09,600 --> 04:07:13,439 and understand how some of these 4257 04:07:11,279 --> 04:07:14,319 uh things get put together in audio 4258 04:07:14,318 --> 04:07:18,799 so the next thing to do is to add a 4259 04:07:17,040 --> 04:07:19,680 second set of generators that can 4260 04:07:19,680 --> 04:07:24,479 for the right audio channel all right 4261 04:07:24,478 --> 04:07:27,599 let's get rid of that process block 4262 04:07:27,600 --> 04:07:30,880 this stuff right here let's just comment 4263 04:07:28,959 --> 04:07:32,799 that out in case you know we're gonna 4264 04:07:30,879 --> 04:07:33,839 leave the code in in case we ever need 4265 04:07:36,879 --> 04:07:40,238 that's you know we're going to turn that 4266 04:07:40,238 --> 04:07:43,520 who wants to listen to those sine waves 4267 04:07:43,520 --> 04:07:48,960 okay let's grab everything we used in 4268 04:07:46,238 --> 04:07:52,000 the single channel version of the fft 4269 04:07:48,959 --> 04:07:52,959 and put it into its own class this is 4270 04:07:52,959 --> 04:07:57,599 single channel fifo buffer the 4271 04:07:57,600 --> 04:08:00,800 analyzer path generator and the path 4272 04:08:00,799 --> 04:08:04,318 so let's make a new class we're just 4273 04:08:02,238 --> 04:08:07,520 going to migrate these things over there 4274 04:08:04,318 --> 04:08:09,600 first okay so i'm just going to 4275 04:08:07,520 --> 04:08:12,479 cut these we're going to go up here 4276 04:08:09,600 --> 04:08:12,479 we're going to put it right here 4277 04:08:13,120 --> 04:08:16,560 put them right there all right so we 4278 04:08:16,559 --> 04:08:20,639 okay this is going to produce a ton of 4279 04:08:18,478 --> 04:08:24,000 errors if we try to build it right now 4280 04:08:26,559 --> 04:08:34,079 now we just need to give our response 4281 04:08:30,000 --> 04:08:34,079 curve a path producer for both channels 4282 04:08:34,398 --> 04:08:40,398 okay next we need to add a process 4283 04:08:38,799 --> 04:08:41,358 function that's going to basically do 4284 04:08:44,478 --> 04:08:48,318 let's jump to that so we can kind of get 4285 04:08:46,719 --> 04:08:50,000 a feel of what i'm talking about 4286 04:08:48,318 --> 04:08:52,079 um this process function is going to do 4287 04:08:52,079 --> 04:08:55,760 this stuff and it's going to do this 4288 04:08:59,279 --> 04:09:02,800 um actually let's take a look at this so 4289 04:09:02,799 --> 04:09:06,879 um the only things we actually need from 4290 04:09:06,879 --> 04:09:11,679 uh this temp buffer uh fft bounds and 4291 04:09:11,680 --> 04:09:16,158 and bin width um yeah okay so we just 4292 04:09:16,158 --> 04:09:20,879 and even then like this this fft size 4293 04:09:18,879 --> 04:09:23,278 comes from this member variable 4294 04:09:20,879 --> 04:09:24,398 um fft bounds that's just a rectangle we 4295 04:09:24,398 --> 04:09:31,039 and then um we need the sample rate 4296 04:09:28,398 --> 04:09:32,639 okay so let's do that let's go back here 4297 04:09:32,639 --> 04:09:40,559 let's make these guys private private 4298 04:09:36,799 --> 04:09:44,079 void process let's give it our rectangle 4299 04:09:44,079 --> 04:09:52,799 now we need a way to retrieve the path 4300 04:09:52,799 --> 04:09:56,639 all right now we need to do what the 4301 04:09:53,920 --> 04:09:58,238 response curve constructor did to 4302 04:10:01,439 --> 04:10:06,720 the monobuffer so let's add a 4303 04:10:06,719 --> 04:10:11,119 all right let's go out of constructor 4304 04:10:08,238 --> 04:10:14,478 let's do it in class for right now 4305 04:10:17,520 --> 04:10:26,000 s c s f and let's initialize that 4306 04:10:26,000 --> 04:10:31,840 scsf okay now let's just migrate over 4307 04:10:29,680 --> 04:10:34,800 that code from the constructor 4308 04:10:31,840 --> 04:10:36,238 over here where was that that's this 4309 04:10:36,238 --> 04:10:42,398 grab these two lines cut them 4310 04:10:39,359 --> 04:10:43,520 paste them here all right now we just 4311 04:10:43,520 --> 04:10:49,040 our um path producers from our 4312 04:10:47,120 --> 04:10:51,520 response curve so let's get rid of this 4313 04:10:51,520 --> 04:10:56,158 left path producer and this is where we 4314 04:10:56,158 --> 04:11:02,238 left channel fifo address of that 4315 04:10:59,760 --> 04:11:02,800 or not the address it wants a reference 4316 04:11:02,799 --> 04:11:06,158 right channel path producer this one's 4317 04:11:06,158 --> 04:11:09,920 right channel fifo all right let's 4318 04:11:09,920 --> 04:11:16,639 um path producer process function 4319 04:11:13,199 --> 04:11:19,439 let's put that right above our um 4320 04:11:16,639 --> 04:11:20,959 right above this actually let's just put 4321 04:11:19,439 --> 04:11:21,520 it right above this timer callback 4322 04:11:21,520 --> 04:11:26,000 it'll make copying the code easier so 4323 04:11:29,920 --> 04:11:36,158 okay so we need our temp buffer these 4324 04:11:33,040 --> 04:11:38,640 guys just go like that copy and paste it 4325 04:11:36,158 --> 04:11:39,439 do the same thing with the fft bounds 4326 04:11:39,439 --> 04:11:46,158 through the path producer loops 4327 04:11:43,520 --> 04:11:47,920 and now instead of doing auto fft equals 4328 04:11:46,158 --> 04:11:48,799 get analysis area this is a function 4329 04:11:48,799 --> 04:11:53,438 so let's get rid of that and then our 4330 04:11:53,439 --> 04:12:01,040 using the sample rate very convenient 4331 04:11:58,639 --> 04:12:01,680 all right so we took all of that code 4332 04:12:01,680 --> 04:12:05,120 and now we are going to call our process 4333 04:12:08,719 --> 04:12:15,519 equals get analysis area dot to float 4334 04:12:12,478 --> 04:12:18,559 and then auto sample rate equals 4335 04:12:15,520 --> 04:12:22,000 audio processor dot get sample rate 4336 04:12:18,559 --> 04:12:25,840 and then we can do left path producer 4337 04:12:25,840 --> 04:12:32,799 sample rate and then right path 4338 04:12:32,799 --> 04:12:37,599 sample rate now we just need to grab the 4339 04:12:37,600 --> 04:12:42,238 in our paint function and draw them so 4340 04:12:39,840 --> 04:12:44,799 let's go up to our paint function 4341 04:12:42,238 --> 04:12:46,318 go to where those paths are drawn it's 4342 04:12:46,318 --> 04:12:53,840 uh we will do auto left path fft 4343 04:12:49,760 --> 04:12:57,359 sorry left channel fft path fft path 4344 04:12:53,840 --> 04:12:59,840 equals leftpathproducer.getpath 4345 04:12:57,359 --> 04:13:01,199 okay that takes care of that and then we 4346 04:13:01,199 --> 04:13:04,560 uh let's see we're doing sky blue for 4347 04:13:02,959 --> 04:13:06,158 that that's cool and now we can do the 4348 04:13:04,559 --> 04:13:09,680 same thing with the right path 4349 04:13:09,680 --> 04:13:17,359 path equals right channel uh 4350 04:13:12,799 --> 04:13:20,639 get path and do the same transform 4351 04:13:17,359 --> 04:13:23,680 and then draw it the same way 4352 04:13:20,639 --> 04:13:26,238 i'm going to do yellow for this guy 4353 04:13:23,680 --> 04:13:27,840 i'll do a light yellow all right let's 4354 04:13:27,840 --> 04:13:31,040 we should be able to see two analyzer 4355 04:13:31,040 --> 04:13:34,080 ah actually this is the standalone 4356 04:13:34,079 --> 04:13:40,318 let me quit this and then run 4357 04:13:37,359 --> 04:13:41,920 the vst version and now we can run some 4358 04:13:41,920 --> 04:13:48,960 and it should be good to go okay let's 4359 04:13:45,199 --> 04:13:48,960 press play we should hear some audio 4360 04:13:52,719 --> 04:13:55,760 all right cool all right cool so i'm i'm 4361 04:13:55,760 --> 04:14:01,120 seeing that so the solution well i'm 4362 04:13:59,120 --> 04:14:04,079 seeing a yellow i'm seeing a yellow path 4363 04:14:01,120 --> 04:14:05,760 um i guess our file is our file is this 4364 04:14:04,079 --> 04:14:07,840 file that uses file that i'm using is 4365 04:14:37,680 --> 04:14:41,680 interesting interesting we're not seeing 4366 04:14:40,079 --> 04:14:44,158 we're not writing our right channel for 4367 04:14:47,760 --> 04:14:51,840 all right let's see if we can figure 4368 04:14:48,719 --> 04:14:51,840 let's see if we can figure that out 4369 04:14:54,238 --> 04:14:58,000 i found the error so the problem was i 4370 04:14:58,000 --> 04:15:01,439 twice that's all it was pretty dumb 4371 04:15:01,439 --> 04:15:04,559 that's what i get for copying and 4372 04:15:02,559 --> 04:15:06,238 pasting and not being thorough the way i 4373 04:15:04,559 --> 04:15:08,719 went about actually trying to debug it 4374 04:15:06,238 --> 04:15:10,879 was going over to my plug-in processor 4375 04:15:08,719 --> 04:15:11,840 and then in my process block function 4376 04:15:11,840 --> 04:15:16,478 going back to using my test oscillator 4377 04:15:14,959 --> 04:15:19,198 and i'm clearing the buffer and i'm 4378 04:15:16,478 --> 04:15:21,358 writing the oscillators samples to only 4379 04:15:19,199 --> 04:15:22,399 one channel particularly the left 4380 04:15:22,398 --> 04:15:27,039 and then from there i was just checking 4381 04:15:25,279 --> 04:15:30,399 to see like hey is this actually getting 4382 04:15:27,040 --> 04:15:31,600 proper audio so it turns out it was 4383 04:15:30,398 --> 04:15:33,519 and then after looking at all the other 4384 04:15:31,600 --> 04:15:34,000 code that was copied over it literally 4385 04:15:37,040 --> 04:15:43,840 twice okay so let me go turn off the 4386 04:15:40,559 --> 04:15:47,039 turn off this code right here and then 4387 04:15:43,840 --> 04:15:48,478 let's run this in the vst and we should 4388 04:15:47,040 --> 04:15:50,720 let's run this in audio plug and host 4389 04:15:50,719 --> 04:15:54,079 both the left and right channel 4390 04:15:54,799 --> 04:15:58,158 all right let's try this again let's try 4391 04:15:58,158 --> 04:16:01,840 all right right definitely have a blue 4392 04:16:00,079 --> 04:16:03,600 and yellow line that is fantastic that 4393 04:16:03,600 --> 04:16:06,880 and if we roll out of the roll off 4394 04:16:05,199 --> 04:16:08,239 behind all the behind all the high-end 4395 04:16:08,238 --> 04:16:11,600 same for real for falling off we get to 4396 04:16:11,600 --> 04:16:15,199 frequency our frequency responder 4397 04:16:19,920 --> 04:16:22,670 that get dipped out as well all right 4398 04:16:25,199 --> 04:16:29,439 okay so okay so that's the analyzer you 4399 04:16:27,920 --> 04:16:31,120 can check that out we can check that off 4400 04:16:29,439 --> 04:16:34,880 make a commit of that commit of that 4401 04:16:34,879 --> 04:16:41,119 from spectrum analyzer analyzer 4402 04:16:38,238 --> 04:16:42,158 okay let's just stage all this stuff and 4403 04:16:42,158 --> 04:16:46,719 okay so the next thing that i want to 4404 04:16:43,840 --> 04:16:48,238 add is some bypass buttons for each band 4405 04:16:46,719 --> 04:16:49,840 and then a bypass button for the 4406 04:16:49,840 --> 04:16:57,840 analyzers always use a ton of cpu 4407 04:16:57,920 --> 04:17:01,279 all right time for the bypass buttons 4408 04:17:01,279 --> 04:17:07,359 three bands and thus we need three 4409 04:17:04,318 --> 04:17:10,000 boolean parameters to enable bypassing 4410 04:17:07,359 --> 04:17:12,318 each individual band and i also want to 4411 04:17:10,000 --> 04:17:13,439 be able to turn the analyzer on and off 4412 04:17:12,318 --> 04:17:14,478 so we're going to need a boolean 4413 04:17:14,478 --> 04:17:18,639 so head on over to your plug-in 4414 04:17:16,639 --> 04:17:20,398 processor and go down to where your 4415 04:17:18,639 --> 04:17:21,039 parameters are created and we're going 4416 04:17:21,040 --> 04:17:28,560 some booleans for this okay layout.add 4417 04:17:28,559 --> 04:17:37,039 and we want juice audio parameter bool 4418 04:17:40,158 --> 04:17:45,520 and a default value of false meaning 4419 04:17:45,520 --> 04:17:48,720 all right we're going to do two more of 4420 04:17:48,719 --> 04:17:51,760 for the parametric band peak band 4421 04:17:50,398 --> 04:17:52,000 whatever you want to call it and the 4422 04:17:52,000 --> 04:18:00,799 cut okay and then one more for the 4423 04:18:00,799 --> 04:18:05,519 and this one's going to be true meaning 4424 04:18:02,158 --> 04:18:07,279 the analyzer is enabled by default 4425 04:18:05,520 --> 04:18:09,199 okay let's go over to our plugin 4426 04:18:09,199 --> 04:18:13,439 way up near where our chain settings are 4427 04:18:13,439 --> 04:18:17,199 we need to supply the bypass states at 4428 04:18:17,199 --> 04:18:20,800 three boolean flags to represent that 4429 04:18:25,600 --> 04:18:34,479 peak bypassed false and then high 4430 04:18:34,478 --> 04:18:38,719 let's go back to our plug-in 4431 04:18:36,199 --> 04:18:41,199 processor.cpp let's go to where our 4432 04:18:38,719 --> 04:18:42,559 um where we get our parameters get chain 4433 04:18:42,559 --> 04:18:45,600 this is where we need to grab these guys 4434 04:18:43,840 --> 04:18:48,000 now these are boolean parameters 4435 04:18:45,600 --> 04:18:48,960 but the parameters are stored as floats 4436 04:18:48,959 --> 04:18:52,478 if the great if the value is greater 4437 04:18:52,478 --> 04:18:57,039 that means it's true so we can do 4438 04:18:57,040 --> 04:19:06,000 bypass equals then get the parameter 4439 04:19:01,279 --> 04:19:09,040 low cut bypassed it's atomic 4440 04:19:09,040 --> 04:19:15,279 then it is bypassed and do the same 4441 04:19:12,158 --> 04:19:18,318 thing for the other two parameters 4442 04:19:15,279 --> 04:19:21,840 okay all right let's go to our update 4443 04:19:18,318 --> 04:19:23,600 low cut filter function now all we have 4444 04:19:21,840 --> 04:19:24,478 to do here before we update the cut 4445 04:19:24,478 --> 04:19:32,959 is set that bypass state so left chain 4446 04:19:28,079 --> 04:19:36,478 dot set bypassed and then chain position 4447 04:19:32,959 --> 04:19:38,959 low cut and then chain settings 4448 04:19:36,478 --> 04:19:40,719 low cut bypassed all right do that for 4449 04:19:44,879 --> 04:19:50,559 right chain do the exact same thing for 4450 04:19:50,559 --> 04:19:56,959 all right we want the high cut position 4451 04:19:56,959 --> 04:20:00,959 and then finally do it for the peak 4452 04:20:00,959 --> 04:20:08,478 well let's just copy this copy this line 4453 04:20:04,719 --> 04:20:10,398 left chain to set bypass peak 4454 04:20:08,478 --> 04:20:11,920 all right that takes care of the dsp our 4455 04:20:10,398 --> 04:20:12,639 chains get updated with the bypass 4456 04:20:12,639 --> 04:20:17,920 now we just need to add some buttons to 4457 04:20:14,478 --> 04:20:21,599 the gui so let's go do that next 4458 04:20:17,920 --> 04:20:23,359 head on over to the plugin editor dot h 4459 04:20:21,600 --> 04:20:25,520 and we're going to go down to our editor 4460 04:20:25,520 --> 04:20:28,800 um we're gonna add some toggle buttons 4461 04:20:27,439 --> 04:20:30,238 okay i'm gonna use toggle button for 4462 04:20:28,799 --> 04:20:31,438 right now because we can customize those 4463 04:20:31,439 --> 04:20:35,840 we can customize those visuals later and 4464 04:20:34,079 --> 04:20:38,000 this is just gonna do the job for right 4465 04:20:38,000 --> 04:20:41,920 all right i did all four low cut peak 4466 04:20:40,238 --> 04:20:43,920 high cut and then the analyzer enabled 4467 04:20:43,920 --> 04:20:48,318 now let's go to our plugin editor dot 4468 04:20:45,840 --> 04:20:49,199 cpp we're going to go down to our get 4469 04:20:49,199 --> 04:20:55,680 we're going to add those four buttons 4470 04:20:53,120 --> 04:20:57,600 all right now we need to position them 4471 04:20:55,680 --> 04:20:59,199 so for this let's go to our resized 4472 04:20:59,199 --> 04:21:05,120 now i want to give them a height of 25 i 4473 04:21:02,079 --> 04:21:07,680 want them to sit above each of these 4474 04:21:05,120 --> 04:21:08,720 stack of knobs that we got the stack of 4475 04:21:08,719 --> 04:21:12,719 so we've got our low cut area our high 4476 04:21:10,478 --> 04:21:14,318 cut area so at the top of those is where 4477 04:21:12,719 --> 04:21:17,119 i'm going to put this okay so let's 4478 04:21:14,318 --> 04:21:18,639 do the left side first the low cut low 4479 04:21:18,639 --> 04:21:26,559 set bounds and we're going to do 4480 04:21:22,158 --> 04:21:29,520 a low cut area remove from top 4481 04:21:26,559 --> 04:21:31,119 25 all right we'll do the same thing for 4482 04:21:31,120 --> 04:21:37,600 i cut bypass button set bounds 4483 04:21:34,318 --> 04:21:41,519 high cut area remove from top 4484 04:21:37,600 --> 04:21:45,040 25 and then our peak bypass button 4485 04:21:41,520 --> 04:21:48,840 peak bypass button let's set bounds 4486 04:21:45,040 --> 04:21:53,600 equals uh bounds dot remove from top 4487 04:21:48,840 --> 04:21:56,079 25. cool we are going to do the um 4488 04:21:53,600 --> 04:21:57,359 uh we're going to do the analyzer button 4489 04:21:57,359 --> 04:22:00,800 but we have these three let's take a 4490 04:22:00,799 --> 04:22:05,039 standalone version for right now should 4491 04:22:03,120 --> 04:22:07,600 see three buttons right in the middle 4492 04:22:05,040 --> 04:22:08,960 um right in centered among the three 4493 04:22:08,959 --> 04:22:13,438 of sliders and there we go here's our 4494 04:22:13,439 --> 04:22:18,720 all right cool let's connect them to 4495 04:22:18,719 --> 04:22:22,639 all right go back to plugineditor.h and 4496 04:22:26,398 --> 04:22:33,599 button attachment equals ap vts 4497 04:22:30,559 --> 04:22:35,119 button attachment and now we can declare 4498 04:22:35,120 --> 04:22:41,439 i'm just gonna copy these guys 4499 04:22:38,639 --> 04:22:42,719 and then put attachment at the end if i 4500 04:22:41,439 --> 04:22:44,318 put them all in the same line it'll make 4501 04:22:44,318 --> 04:22:48,879 before i line them all up and i can do 4502 04:22:48,879 --> 04:22:53,198 cool all right so those are the 4503 04:22:52,000 --> 04:22:53,920 attachments we're going to use them the 4504 04:22:53,920 --> 04:22:57,199 we did with these sliders we just just 4505 04:22:55,680 --> 04:22:58,639 need to connect them to the actual 4506 04:22:58,639 --> 04:23:03,119 we go do that in our constructor plug-in 4507 04:23:03,120 --> 04:23:07,760 constructor at the end of this list 4508 04:23:06,478 --> 04:23:09,840 this is where we need to add the 4509 04:23:17,040 --> 04:23:21,279 it's this thing low cut bypass button 4510 04:23:24,318 --> 04:23:27,920 all right and we need to do this for the 4511 04:23:25,920 --> 04:23:29,680 other four buttons even though we're not 4512 04:23:33,279 --> 04:23:38,079 let's give that a quick build make sure 4513 04:23:38,079 --> 04:23:42,079 and let's run it to make sure that we 4514 04:23:39,439 --> 04:23:44,639 typed our param names correctly 4515 04:23:42,079 --> 04:23:45,600 but those should be connected now all 4516 04:23:45,600 --> 04:23:51,359 let's run it all right let's run it with 4517 04:23:49,600 --> 04:23:52,640 audio plug and host so we can run audio 4518 04:23:51,359 --> 04:23:54,238 through it and see if we hear it do 4519 04:23:54,238 --> 04:24:00,158 okay so i'm gonna set this up kind of 4520 04:23:56,000 --> 04:24:00,158 high run some audio and then bypass 4521 04:24:01,760 --> 04:24:05,600 all right so the bypass control 4522 04:24:03,600 --> 04:24:10,238 definitely works but the response curve 4523 04:24:10,238 --> 04:24:15,198 okay let's take care of that next all 4524 04:24:13,120 --> 04:24:16,239 right let's head on up to our update 4525 04:24:16,238 --> 04:24:22,879 for the uh response curve component 4526 04:24:20,559 --> 04:24:24,719 now we've got our chain settings right 4527 04:24:22,879 --> 04:24:25,599 here so we're going to do the same thing 4528 04:24:25,600 --> 04:24:30,158 process block we're going to update the 4529 04:24:34,000 --> 04:24:38,719 set bypassed and then each of the 4530 04:24:42,959 --> 04:24:46,079 low cut bypassed all right do that for 4531 04:24:50,959 --> 04:24:54,559 all right once we've got these bypass 4532 04:24:54,559 --> 04:25:00,398 um let's go to our paint function 4533 04:24:57,520 --> 04:25:03,520 because once we have these bypass states 4534 04:25:00,398 --> 04:25:06,158 you know if the chain is not bypassed um 4535 04:25:03,520 --> 04:25:07,199 we need to add the magnitude however for 4536 04:25:07,199 --> 04:25:11,279 high cut bands even though we bypass the 4537 04:25:11,279 --> 04:25:15,199 this right here does not check if that 4538 04:25:15,199 --> 04:25:19,040 greater chain is bypassed so we need to 4539 04:25:19,040 --> 04:25:24,399 we need to do if mono chain dot is 4540 04:25:28,959 --> 04:25:32,158 processor chain is not bypassed then we 4541 04:25:32,158 --> 04:25:37,760 individual bands are bypassed we can do 4542 04:25:35,279 --> 04:25:40,960 the same thing for the high cut 4543 04:25:37,760 --> 04:25:42,478 all right let's test it out oh got this 4544 04:25:40,959 --> 04:25:45,198 jscert that's happening we'll take care 4545 04:25:42,478 --> 04:25:47,519 of that in just a little bit 4546 04:25:45,199 --> 04:25:48,399 for some reason the render data is full 4547 04:25:48,398 --> 04:25:51,760 invalid values let's show me my plug-in 4548 04:25:56,079 --> 04:26:00,879 all right look at that it does it for 4549 04:26:04,000 --> 04:26:14,729 cool let's do it for this guy 4550 04:26:15,279 --> 04:26:19,120 all right awesome that is working as 4551 04:26:19,120 --> 04:26:23,600 all right let's uh make a commit that we 4552 04:26:34,559 --> 04:26:40,079 good times all right we can dial in the 4553 04:26:40,079 --> 04:26:46,559 okay for this we want to use the 4554 04:26:43,359 --> 04:26:48,399 toggle button um look and feel function 4555 04:26:46,559 --> 04:26:50,639 draw toggle button let me pull up the 4556 04:26:50,639 --> 04:26:54,000 so look and feel methods version 4. 4557 04:26:54,000 --> 04:27:00,238 slider we want to look for toggle button 4558 04:26:57,840 --> 04:27:01,120 where is that where are those look and 4559 04:27:01,120 --> 04:27:05,120 member functions you know it's part of 4560 04:27:05,120 --> 04:27:09,600 the look and feel class okay so we've 4561 04:27:07,199 --> 04:27:11,120 got uh draw button text draw a toggle 4562 04:27:11,120 --> 04:27:15,279 drawable button all that kind of stuff 4563 04:27:13,120 --> 04:27:16,640 okay so we want to implement draw toggle 4564 04:27:16,639 --> 04:27:20,639 so let's go up to our plugin editor.h 4565 04:27:18,959 --> 04:27:24,079 let's go to where our look and feel 4566 04:27:20,639 --> 04:27:27,039 is declared and we're going to add 4567 04:27:24,079 --> 04:27:28,719 this draw toggle button function i'm 4568 04:27:33,040 --> 04:27:38,960 give me some names for these guys 4569 04:27:36,318 --> 04:27:40,158 let's put them on there online and then 4570 04:27:40,158 --> 04:27:47,680 juice namespace before them 4571 04:27:44,079 --> 04:27:49,680 okay all right and after these 4572 04:27:47,680 --> 04:27:51,279 look nice it would be wise to make the 4573 04:27:49,680 --> 04:27:52,880 toggle buttons actually disable the 4574 04:27:51,279 --> 04:27:53,520 sliders for whatever band they are 4575 04:27:53,520 --> 04:27:58,238 to so that's going to be one of the 4576 04:27:55,199 --> 04:27:59,920 things we're going to work on as well 4577 04:27:58,238 --> 04:28:03,920 all right we just need to give our 4578 04:27:59,920 --> 04:28:05,359 editor a look and feel instance 4579 04:28:03,920 --> 04:28:07,600 all right and we need to assign it to 4580 04:28:07,600 --> 04:28:12,318 we'll do that in our constructor 4581 04:28:10,799 --> 04:28:13,920 go down here let's do it after we add 4582 04:28:13,920 --> 04:28:20,478 uh make our guys visible peak bypass 4583 04:28:23,760 --> 04:28:28,639 and then we need to set these to null 4584 04:28:31,920 --> 04:28:38,478 our look and feel implementations 4585 04:28:35,199 --> 04:28:40,239 plug plugin editor.cpp go to where that 4586 04:28:38,478 --> 04:28:42,719 look and feel implementation is it's way 4587 04:28:42,719 --> 04:28:47,519 all right let's clean up this space now 4588 04:28:45,680 --> 04:28:50,318 right here what i would like to 4589 04:28:47,520 --> 04:28:51,439 do what i would like to create for these 4590 04:28:51,439 --> 04:28:55,600 power button type of graphic and this 4591 04:28:53,680 --> 04:28:59,040 can be accomplished by using the path 4592 04:28:55,600 --> 04:29:00,720 function add centered arc now this 4593 04:28:59,040 --> 04:29:02,479 function will let us create an arc which 4594 04:29:02,478 --> 04:29:06,158 and then we just need to add a vertical 4595 04:29:03,920 --> 04:29:07,920 bar that goes from the top to the center 4596 04:29:06,158 --> 04:29:08,799 and that's it okay it's super easy just 4597 04:29:08,799 --> 04:29:12,719 wide stroke type when it's time to fill 4598 04:29:10,799 --> 04:29:13,358 the path and it will look like a power 4599 04:29:13,359 --> 04:29:19,120 so let's do that all right using 4600 04:29:19,120 --> 04:29:22,479 because i didn't turn it on in processor 4601 04:29:22,478 --> 04:29:26,158 that setting is um here by the way if 4602 04:29:26,158 --> 04:29:32,719 then you can do add using namespace 4603 04:29:28,158 --> 04:29:35,840 juice to the juiceheader.h it's disabled 4604 04:29:36,079 --> 04:29:39,760 the thought is that it's you're less 4605 04:29:38,158 --> 04:29:41,600 likely to get collisions with other 4606 04:29:41,600 --> 04:29:46,079 such as the point class which is a 4607 04:29:46,079 --> 04:29:49,120 it's a it's one of the classes that 4608 04:29:52,238 --> 04:29:55,760 turning this off it makes it less likely 4609 04:29:54,398 --> 04:29:56,959 that you're going to get those types of 4610 04:29:56,959 --> 04:30:00,318 with your class names okay all right 4611 04:30:00,318 --> 04:30:05,198 let's see path power button okay 4612 04:30:03,600 --> 04:30:06,720 first thing first is we're going to 4613 04:30:06,719 --> 04:30:10,398 this rectangle is going to have equal 4614 04:30:08,478 --> 04:30:11,760 length sides and in the center of that 4615 04:30:11,760 --> 04:30:17,199 um yeah this rectangle is going to be 4616 04:30:15,279 --> 04:30:20,800 um center in our component's bounding 4617 04:30:20,959 --> 04:30:24,959 uh where's our toggle button we're going 4618 04:30:24,959 --> 04:30:28,238 j min thing that we were talking about 4619 04:30:28,238 --> 04:30:35,520 up for the um we did that somewhere 4620 04:30:32,238 --> 04:30:37,760 somewhere we did a j min so that way our 4621 04:30:35,520 --> 04:30:41,120 um one of these rectangles was a square 4622 04:30:37,760 --> 04:30:42,318 inside of a non-square bounding box that 4623 04:30:41,120 --> 04:30:42,880 right here this is where we did it in 4624 04:30:42,879 --> 04:30:46,799 get slider bounce okay we're doing that 4625 04:30:46,799 --> 04:30:50,318 all right so instead of it being exactly 4626 04:30:50,318 --> 04:30:54,079 exactly a square in the center of it 4627 04:30:51,920 --> 04:30:54,398 we're gonna shrink it a little bit maybe 4628 04:30:54,398 --> 04:30:58,559 six or so we'll use juice live constant 4629 04:30:58,559 --> 04:31:02,799 maybe maybe we'll do four uh no i'm 4630 04:31:02,799 --> 04:31:07,119 um if i want to adjust it i can come 4631 04:31:05,359 --> 04:31:08,720 back with juice live constant and tweak 4632 04:31:08,719 --> 04:31:13,358 all right then auto r equals um bounds 4633 04:31:13,359 --> 04:31:16,640 size keeping the center so i'm creating 4634 04:31:20,158 --> 04:31:24,719 is the center of our toggle buttons uh 4635 04:31:24,719 --> 04:31:29,039 all right now let's specify some angles 4636 04:31:27,040 --> 04:31:33,040 to make the gap at the top of the arc 4637 04:31:29,040 --> 04:31:34,960 okay i am um yeah we're gonna 4638 04:31:33,040 --> 04:31:36,640 yeah we're gonna specify some angles to 4639 04:31:34,959 --> 04:31:38,000 make the gap at the top of the arc 4640 04:31:36,639 --> 04:31:39,920 and then we're going to shrink this 4641 04:31:39,920 --> 04:31:43,359 um we're going to shrink the square just 4642 04:31:43,359 --> 04:31:46,559 more we'll play around with it and we'll 4643 04:31:46,559 --> 04:31:50,559 live constant and you know get it to 4644 04:31:48,639 --> 04:31:53,599 look the way we want it to look 4645 04:31:53,600 --> 04:31:57,120 f because it's radians because i don't 4646 04:31:55,680 --> 04:31:59,040 know how i mean it's degrees because i 4647 04:31:57,120 --> 04:32:02,000 don't know how to think in radians 4648 04:31:59,040 --> 04:32:03,439 um we'll shrink this size a little bit 4649 04:32:02,000 --> 04:32:05,359 maybe just a little bit more we can use 4650 04:32:05,359 --> 04:32:12,640 now let's make our arc power button dot 4651 04:32:08,959 --> 04:32:14,000 add centered arc okay so we're going to 4652 04:32:14,000 --> 04:32:22,000 r our radius is going to be half 4653 04:32:18,238 --> 04:32:25,840 of the size of our box that we have 4654 04:32:22,000 --> 04:32:29,600 size times 0.5 that's radius for both 4655 04:32:25,840 --> 04:32:33,359 axes all right we're not rotating this 4656 04:32:29,600 --> 04:32:35,040 ellipse at all so that means that 12 4657 04:32:33,359 --> 04:32:36,640 o'clock is still gonna be right here 4658 04:32:35,040 --> 04:32:38,640 as opposed to if we had rotated it then 4659 04:32:36,639 --> 04:32:41,119 it would be like negative 30 goes to 4660 04:32:38,639 --> 04:32:44,318 here and plus 30 goes that way 4661 04:32:41,120 --> 04:32:47,279 okay so we are going to do zero 4662 04:32:44,318 --> 04:32:49,039 for that and then our from radians uh 4663 04:32:47,279 --> 04:32:51,120 let's see if this is 12 o'clock 4664 04:32:49,040 --> 04:32:52,479 right here at the top i want to go 4665 04:32:52,478 --> 04:32:56,079 oh no i want to go 30 this way and then 4666 04:32:56,079 --> 04:33:05,919 uh 360 minus 30 for the second one 4667 04:33:01,279 --> 04:33:07,760 so here we go let's see radians 4668 04:33:05,919 --> 04:33:08,958 uh sorry degrees to radians and we've 4669 04:33:08,958 --> 04:33:13,359 all right our angle and then the same 4670 04:33:13,359 --> 04:33:20,958 uh 360 degrees minus our angle 4671 04:33:17,278 --> 04:33:23,438 so if we want we can open this up 4672 04:33:20,958 --> 04:33:24,638 and there's no you know we're using 4673 04:33:23,438 --> 04:33:27,919 these variables so that way we can 4674 04:33:24,638 --> 04:33:31,599 adjust the way these visuals look 4675 04:33:27,919 --> 04:33:34,560 and then yeah this says there's 4676 04:33:31,599 --> 04:33:37,038 there's an extra let's see power button 4677 04:33:37,039 --> 04:33:40,719 there's an extra parameter that's not 4678 04:33:40,719 --> 04:33:44,159 uh start as new sub path so this this is 4679 04:33:44,159 --> 04:33:50,000 this should be true all right now let's 4680 04:33:50,000 --> 04:33:58,479 okay power button start new sub path 4681 04:33:55,118 --> 04:33:59,840 and this sub path is going to be 4682 04:33:58,479 --> 04:34:03,599 it's going to be at the center of our 4683 04:33:59,840 --> 04:34:06,479 rectangle but then at the top 4684 04:34:03,599 --> 04:34:06,798 and then we can do a simple power button 4685 04:34:11,840 --> 04:34:17,278 we're going center of our box at the top 4686 04:34:15,278 --> 04:34:18,878 y equals zero and then we just go 4687 04:34:17,278 --> 04:34:20,159 straight down to the center 4688 04:34:18,879 --> 04:34:22,159 all right let's just create a path 4689 04:34:22,159 --> 04:34:28,400 um norm you know normally when you 4690 04:34:25,359 --> 04:34:29,760 draw a path you can do uh juice you can 4691 04:34:33,039 --> 04:34:36,400 stroke path like that and then provide a 4692 04:34:34,958 --> 04:34:37,759 stroke type that way but i want to 4693 04:34:37,759 --> 04:34:41,118 custom stuff so it will help me if i use 4694 04:34:41,118 --> 04:34:48,000 um path stroke type constructor 4695 04:34:45,039 --> 04:34:49,199 this one right here so i can um use that 4696 04:34:49,199 --> 04:34:54,000 okay so i'm going to use a stroke 4697 04:34:54,000 --> 04:34:58,080 and then for the joint style if i use a 4698 04:34:56,080 --> 04:34:58,561 curved joint style it'll give me rounded 4699 04:34:58,561 --> 04:35:02,080 at the gap and then around that 4700 04:34:59,919 --> 04:35:05,839 rectangle so i'm going to use that 4701 04:35:05,840 --> 04:35:12,400 all right now this just needs a name pst 4702 04:35:09,118 --> 04:35:16,000 and now i can use that here pst and then 4703 04:35:12,400 --> 04:35:16,000 the path is going to be the power button 4704 04:35:16,240 --> 04:35:19,840 and then what is wrong with this why is 4705 04:35:19,840 --> 04:35:22,958 oh is that because that needs to be to 4706 04:35:22,958 --> 04:35:28,560 this should be a float rectangle um now 4707 04:35:31,680 --> 04:35:35,199 if the button is on we're going to use 4708 04:35:33,359 --> 04:35:36,319 one color and otherwise we're going to 4709 04:35:36,319 --> 04:35:40,159 so what that means when the button is on 4710 04:35:40,159 --> 04:35:45,438 bypassed okay so that's so if it's 4711 04:35:43,039 --> 04:35:46,958 bypassed let's use a gray color 4712 04:35:45,438 --> 04:35:48,399 and then if it's not let's use that 4713 04:35:46,958 --> 04:35:50,159 green color that we've been using in 4714 04:35:48,400 --> 04:35:53,279 other places because it looks cool 4715 04:35:50,159 --> 04:35:54,240 all right so let's see auto color equals 4716 04:35:54,240 --> 04:35:58,639 toggle state oh sorry toggle button i 4717 04:35:58,638 --> 04:36:03,359 get the toggle state if it is on meaning 4718 04:36:01,759 --> 04:36:06,798 the band is bypassed we're going to use 4719 04:36:06,798 --> 04:36:13,199 otherwise let's go find that green color 4720 04:36:10,561 --> 04:36:15,439 i think that's this i should really 4721 04:36:15,438 --> 04:36:20,159 you know it's a tutorial i'm not trying 4722 04:36:20,159 --> 04:36:24,479 but i'm trying to show good practices 4723 04:36:24,479 --> 04:36:29,118 color all right so we're going to draw 4724 04:36:32,240 --> 04:36:36,639 draw a circle around the whole thing 4725 04:36:39,759 --> 04:36:46,079 we can do r with a line sigma thickness 4726 04:36:46,080 --> 04:36:49,600 all right that should look good all 4727 04:36:49,599 --> 04:36:54,798 try that out hey look at that 4728 04:36:53,278 --> 04:36:56,798 okay cool so these are currently not 4729 04:36:54,798 --> 04:36:57,680 bypassed so i'm going to adjust this and 4730 04:36:57,680 --> 04:37:01,920 so that's cool that works as expected if 4731 04:37:00,080 --> 04:37:04,561 it's green it means it's active 4732 04:37:01,919 --> 04:37:05,038 if it's gray it means it's not i'm happy 4733 04:37:05,039 --> 04:37:08,240 that makes sense well that's kind of 4734 04:37:08,240 --> 04:37:11,279 as long as we're clicking inside the 4735 04:37:11,278 --> 04:37:15,118 uh it's gonna toggle it so something 4736 04:37:13,199 --> 04:37:16,479 that we could do that i'm not going to 4737 04:37:16,479 --> 04:37:19,840 is to set up the hit test region so that 4738 04:37:19,840 --> 04:37:23,438 inside this area it says yes you clicked 4739 04:37:23,438 --> 04:37:28,000 um if otherwise if you click out of that 4740 04:37:28,000 --> 04:37:33,118 so for reference um i'm gonna just add a 4741 04:37:40,879 --> 04:37:44,080 just so we can see the bounding box i'm 4742 04:37:44,080 --> 04:37:49,840 bounce so this way you can see what i 4743 04:37:47,039 --> 04:37:52,319 mean about if you click outside of it 4744 04:37:49,840 --> 04:37:53,520 okay so if we click anywhere in here we 4745 04:37:53,520 --> 04:37:58,080 inside that toggle button okay but we 4746 04:37:58,080 --> 04:38:01,359 it's not something i'm going to do in 4747 04:38:01,359 --> 04:38:04,400 go through and say you know what it's 4748 04:38:04,400 --> 04:38:08,080 this there's a special hit test function 4749 04:38:08,080 --> 04:38:10,879 and say if we click inside here that 4750 04:38:09,919 --> 04:38:13,198 means we actually clicked on the 4751 04:38:10,879 --> 04:38:14,479 component if we clicked here we did not 4752 04:38:13,199 --> 04:38:16,000 and that's how we can make it only 4753 04:38:14,479 --> 04:38:16,638 respond that way but i'm not going to do 4754 04:38:16,638 --> 04:38:20,159 it's a little bit beyond the scope of 4755 04:38:20,159 --> 04:38:24,479 so i'm just going to get rid of that 4756 04:38:24,479 --> 04:38:32,479 a commit for that so customized 4757 04:38:28,080 --> 04:38:33,840 um customized the uh graphics 4758 04:38:32,479 --> 04:38:35,278 all right before i do that actually i 4759 04:38:33,840 --> 04:38:36,840 wanted to show the juice live constant 4760 04:38:36,840 --> 04:38:43,920 juice juice live constant this was six 4761 04:38:40,719 --> 04:38:45,840 same for this one this was also six and 4762 04:38:43,919 --> 04:38:49,438 we can mess with this angle too 4763 04:38:45,840 --> 04:38:50,958 um all right so this will be interesting 4764 04:38:49,438 --> 04:38:53,438 we can see what that looks like let's 4765 04:38:50,958 --> 04:38:56,000 change these numbers move these sliders 4766 04:38:53,438 --> 04:38:58,000 we'll get to see what it looks like 4767 04:38:56,000 --> 04:38:59,599 all right let's move this out of the way 4768 04:38:58,000 --> 04:39:01,118 so we're changing the first one this is 4769 04:38:59,599 --> 04:39:02,159 going to make these guys get smaller or 4770 04:39:02,159 --> 04:39:06,079 and obviously once we get past a certain 4771 04:39:03,840 --> 04:39:07,199 point they start being drawn outside 4772 04:39:07,199 --> 04:39:12,798 now here's where we can adjust the angle 4773 04:39:10,240 --> 04:39:14,159 so that's kind of neat all right so i 4774 04:39:14,159 --> 04:39:19,919 40 or 40 looks kind of cool maybe a 4775 04:39:17,278 --> 04:39:22,638 little bit closer like 25 is good and 4776 04:39:23,039 --> 04:39:27,600 this shrinks that guy a little bit more 4777 04:39:26,000 --> 04:39:28,638 so it's like this one changes the whole 4778 04:39:28,638 --> 04:39:32,000 and then this one changes that inner arc 4779 04:39:32,000 --> 04:39:35,039 so i'm going to leave those where i had 4780 04:39:33,438 --> 04:39:37,198 them because i liked that positioning 4781 04:39:35,039 --> 04:39:39,280 but you can do that same thing to 4782 04:39:37,199 --> 04:39:40,797 adjust the placement of those guys all 4783 04:39:39,279 --> 04:39:45,199 right i'll put this back to um 4784 04:39:40,797 --> 04:39:48,159 put this back to 30 put this back to six 4785 04:39:45,200 --> 04:39:48,958 and put this guy back to six as well 4786 04:39:48,957 --> 04:39:55,599 let's make that commit all right now 4787 04:39:53,119 --> 04:39:56,159 what i want to do is reuse that toggle 4788 04:39:56,159 --> 04:39:59,840 functionality for the analyzer button as 4789 04:39:59,840 --> 04:40:03,439 what i want to do is reuse this toggle 4790 04:40:03,439 --> 04:40:07,759 i want to reuse this draw toggle button 4791 04:40:05,360 --> 04:40:08,159 functionality for the analyzer button as 4792 04:40:08,159 --> 04:40:11,360 but what i want to do is switch based 4793 04:40:11,360 --> 04:40:15,119 button type in that draw toggle button 4794 04:40:13,279 --> 04:40:17,199 function so i'm going to create two 4795 04:40:17,200 --> 04:40:21,680 in my editor i'm going to do this right 4796 04:40:21,680 --> 04:40:24,718 i'm going to create two classes that 4797 04:40:24,718 --> 04:40:28,080 and that's going to allow me to cast 4798 04:40:28,080 --> 04:40:33,120 um it's going to allow me to cast that 4799 04:40:33,520 --> 04:40:37,279 let me see let me go up here it's going 4800 04:40:37,279 --> 04:40:40,479 argument to determine if it's one of 4801 04:40:40,479 --> 04:40:45,520 and then i can switch accordingly um 4802 04:40:43,599 --> 04:40:48,000 in the actual implementation of that 4803 04:40:45,520 --> 04:40:48,957 function uh just follow the code you'll 4804 04:40:48,000 --> 04:40:50,637 see what i'm talking about i'm not 4805 04:40:48,957 --> 04:40:53,840 explaining it very well here we go 4806 04:40:54,080 --> 04:41:02,878 juice okay very simple struct 4807 04:41:02,878 --> 04:41:07,200 so that's step one all right step number 4808 04:41:07,200 --> 04:41:14,718 is to make the bypass buttons uh 4809 04:41:10,637 --> 04:41:18,878 we'll make the bypass buttons become 4810 04:41:18,878 --> 04:41:22,718 and then the analyzer button needs to be 4811 04:41:26,240 --> 04:41:30,560 all right now let's go up to our draw 4812 04:41:30,560 --> 04:41:33,920 implementation this guy right here all i 4813 04:41:33,919 --> 04:41:37,839 cast and everything should work as it 4814 04:41:36,000 --> 04:41:38,400 did before okay so i'm just going to 4815 04:41:38,400 --> 04:41:43,120 power button path i'm going to cast um 4816 04:41:41,520 --> 04:41:44,957 i'm going to make a check and if like i 4817 04:41:44,957 --> 04:41:50,717 object to a power button type then i'm 4818 04:41:54,718 --> 04:41:58,319 okay so if we run it i'm going to put 4819 04:41:58,319 --> 04:42:01,360 on the standalone version because it 4820 04:42:01,360 --> 04:42:05,440 um we should be able to run it and now 4821 04:42:03,360 --> 04:42:06,000 we can add code that draws the analyzer 4822 04:42:06,000 --> 04:42:10,957 after this is verified all right 4823 04:42:09,279 --> 04:42:13,199 sure enough we still have our analyzer 4824 04:42:10,957 --> 04:42:17,599 buttons our our bypass buttons 4825 04:42:17,599 --> 04:42:22,637 so let's add our analyzer code um where 4826 04:42:22,637 --> 04:42:26,000 okay we're going to add our analyzer 4827 04:42:26,000 --> 04:42:29,040 now i think it would be cool to see a 4828 04:42:29,040 --> 04:42:32,400 drawn inside of this button to kind of 4829 04:42:30,718 --> 04:42:33,280 you know reflect the fact that it is an 4830 04:42:33,279 --> 04:42:35,919 so i'm going to use the same color 4831 04:42:34,560 --> 04:42:36,400 settings that i used for the power 4832 04:42:36,400 --> 04:42:39,840 green if something is active and gray if 4833 04:42:39,840 --> 04:42:43,520 in this instance the toggle button will 4834 04:42:43,520 --> 04:42:46,718 that it did with the power button which 4835 04:42:46,718 --> 04:42:50,240 this thing i have to flip it around so 4836 04:42:50,240 --> 04:42:56,240 uh if else or an else if right here to 4837 04:42:53,119 --> 04:42:59,759 make sure i have an analyzer button 4838 04:42:56,240 --> 04:43:02,718 go faster if you're walking copy this 4839 04:43:03,360 --> 04:43:06,797 and we need to flip that that's all 4840 04:43:06,797 --> 04:43:12,479 as i said if the toggle button is on 4841 04:43:10,319 --> 04:43:14,878 then that means we want to use this 4842 04:43:12,479 --> 04:43:16,718 green color otherwise if it's off let's 4843 04:43:16,718 --> 04:43:23,280 all right g dot set color color 4844 04:43:21,200 --> 04:43:25,200 okay next i'm going to start by drawing 4845 04:43:25,200 --> 04:43:30,560 auto bounds now i'm going to shrink it a 4846 04:43:30,560 --> 04:43:35,200 and then i'm going to randomly generate 4847 04:43:32,479 --> 04:43:37,439 a path inside of that smaller rectangle 4848 04:43:35,200 --> 04:43:39,040 i don't want it to look too crazy so i i 4849 04:43:39,040 --> 04:43:43,520 every other pixel so let's start with 4850 04:43:43,520 --> 04:43:51,520 random path we'll use a random object 4851 04:43:47,840 --> 04:43:54,637 and then now we can um start 4852 04:43:54,637 --> 04:43:59,479 we will start it at our inset and our y 4853 04:44:05,680 --> 04:44:12,240 height times some random float value 4854 04:44:10,479 --> 04:44:14,399 right so our y value is going to be the 4855 04:44:12,240 --> 04:44:16,638 top our height is the bottom 4856 04:44:14,400 --> 04:44:17,600 so we're going to go remember this is 0 4857 04:44:17,599 --> 04:44:22,319 so we're going to go 0 down to height 4858 04:44:20,240 --> 04:44:24,400 multiply height by some value between 0 4859 04:44:22,319 --> 04:44:27,439 and 1 to give us a random height 4860 04:44:24,400 --> 04:44:28,400 between the top and the bottom all right 4861 04:44:28,400 --> 04:44:35,600 to perform a line to like this for 4862 04:44:40,560 --> 04:44:50,080 x is less than inset rect.get 4863 04:44:44,319 --> 04:44:50,079 right plus uh x plus equals two 4864 04:44:50,479 --> 04:44:56,159 then we just basically do this 4865 04:44:53,840 --> 04:44:58,000 our x position is going to be let's see 4866 04:45:01,439 --> 04:45:06,239 get out of here trixie let me just type 4867 04:45:06,240 --> 04:45:13,360 random path line two our x is gonna be 4868 04:45:10,240 --> 04:45:16,878 x and then our y position is gonna be 4869 04:45:13,360 --> 04:45:18,240 this obviously we should pre-cache some 4870 04:45:18,240 --> 04:45:21,360 because calling get y and get height 4871 04:45:21,360 --> 04:45:25,200 you know it's not ideal but whatever we 4872 04:45:25,200 --> 04:45:30,400 always refactor that type of stuff later 4873 04:45:27,040 --> 04:45:32,958 okay now let's just draw the path 4874 04:45:30,400 --> 04:45:34,159 let's use a thickness of one all right 4875 04:45:34,159 --> 04:45:38,079 let's get our analyzer button on the 4876 04:45:36,159 --> 04:45:39,040 screen and using this look and feel so 4877 04:45:46,080 --> 04:45:50,480 let's provide that look and feel 4878 04:45:50,479 --> 04:45:54,399 set look and feel all right and don't 4879 04:45:54,400 --> 04:45:58,718 disable it all right now i'm going to 4880 04:46:01,919 --> 04:46:10,717 the gui on the left so let's see 4881 04:46:06,479 --> 04:46:14,239 i'm gonna go like this i'm gonna go um 4882 04:46:10,718 --> 04:46:15,840 auto analyzer enabled area equals bounds 4883 04:46:15,840 --> 04:46:19,040 give me the top 25 pixels just a whole 4884 04:46:19,040 --> 04:46:22,718 25 pixels wide 25 pixels tall from the 4885 04:46:22,718 --> 04:46:26,878 okay now i'm going to do uh analyzer 4886 04:46:26,878 --> 04:46:32,958 area dot give me a width of 10 4887 04:46:33,119 --> 04:46:38,000 give me an x of five so it's not uh 4888 04:46:38,000 --> 04:46:41,840 and then um give me just remove a little 4889 04:46:40,319 --> 04:46:43,439 bit from the top of this analyzer 4890 04:46:41,840 --> 04:46:45,119 enabled area so there's a gap between 4891 04:46:43,439 --> 04:46:47,520 the top of the gui and the top of this 4892 04:46:47,520 --> 04:46:52,797 all right now i'm just going to set 4893 04:46:50,718 --> 04:46:54,560 that to be my analyzer enabled buttons 4894 04:46:54,560 --> 04:46:58,479 and let me give myself a little bit of a 4895 04:46:56,637 --> 04:47:00,399 gap between the analyzer button and the 4896 04:46:58,479 --> 04:47:01,119 analyzer itself and let's see what it 4897 04:47:04,479 --> 04:47:07,599 okay so we should expect to see a 4898 04:47:07,599 --> 04:47:12,957 just like that all right okay this is 4899 04:47:10,797 --> 04:47:16,079 neat so whenever we mouse over it 4900 04:47:12,957 --> 04:47:19,279 it repaints and it produces a new 4901 04:47:16,080 --> 04:47:21,040 path so let's make the path be a member 4902 04:47:19,279 --> 04:47:22,239 variable of the class that is computed 4903 04:47:22,240 --> 04:47:25,840 whenever the instance is resized so we 4904 04:47:25,840 --> 04:47:30,000 random path creation process works which 4905 04:47:28,000 --> 04:47:32,159 is cool so we're just going to use that 4906 04:47:30,000 --> 04:47:34,000 to make this path all right let's do 4907 04:47:34,000 --> 04:47:41,360 all right let's add a commit for this 4908 04:47:44,797 --> 04:47:49,840 it repaints all right let's head on over 4909 04:47:49,840 --> 04:47:54,957 declaration for that class there was 4910 04:47:54,957 --> 04:47:58,159 all right so let's set this up with a 4911 04:47:58,159 --> 04:48:02,240 this is where we will compute the random 4912 04:48:02,240 --> 04:48:08,400 will draw so let's see void resized 4913 04:48:06,159 --> 04:48:09,599 override all right we're going to need 4914 04:48:09,599 --> 04:48:14,159 we're going to need that bounding box 4915 04:48:10,797 --> 04:48:16,637 auto bounds equals get local bounce 4916 04:48:14,159 --> 04:48:18,240 we're still going to need to shrink it 4917 04:48:16,637 --> 04:48:20,559 and then instead of creating a new 4918 04:48:20,560 --> 04:48:24,560 we're just going to clear the existing 4919 04:48:22,000 --> 04:48:27,680 one let's add that as a member variable 4920 04:48:27,680 --> 04:48:33,200 all right so random path dot clear 4921 04:48:31,599 --> 04:48:34,717 it's gonna clear it and then let's go 4922 04:48:34,718 --> 04:48:38,240 other code that drew that thing that's 4923 04:48:38,240 --> 04:48:42,159 that look and feel stuff where is that 4924 04:48:42,159 --> 04:48:46,319 all right let's just copy this comment 4925 04:48:46,319 --> 04:48:49,680 plug an editor paste that right here 4926 04:48:49,680 --> 04:48:53,680 here's our juice random except it needs 4927 04:48:53,680 --> 04:48:57,360 all right there's our random path start 4928 04:48:57,360 --> 04:49:03,840 same line two code that we had before 4929 04:49:00,957 --> 04:49:04,877 all right let's go back to our plugin 4930 04:49:04,878 --> 04:49:08,319 okay so the stuff we need to discard is 4931 04:49:11,439 --> 04:49:14,877 get rid of that and now for this we need 4932 04:49:17,919 --> 04:49:22,797 oh boy random path like that 4933 04:49:21,119 --> 04:49:24,797 okay so we're just going to draw that 4934 04:49:22,797 --> 04:49:27,520 path member variable directly 4935 04:49:24,797 --> 04:49:28,797 all right let's run it and see what we 4936 04:49:28,797 --> 04:49:33,039 all right cool so it's only changing 4937 04:49:33,040 --> 04:49:36,080 it only changed once when we use the 4938 04:49:36,080 --> 04:49:39,520 this guy i'm going to run it in audio 4939 04:49:39,520 --> 04:49:42,878 and see what happens when we open and 4940 04:49:42,878 --> 04:49:46,637 so there's like an m right on this right 4941 04:49:46,637 --> 04:49:50,957 let's see what happens when we close 4942 04:49:47,680 --> 04:49:53,520 this gui all right that's kind of neat 4943 04:49:50,957 --> 04:49:55,439 so every time we open and close the gui 4944 04:49:53,520 --> 04:49:56,560 uh we get a new path which is you know 4945 04:49:56,560 --> 04:50:00,638 okay so the next thing to do is to make 4946 04:50:00,637 --> 04:50:05,279 um actually disable elements in the gui 4947 04:50:04,000 --> 04:50:07,279 all right when we click on this we want 4948 04:50:05,279 --> 04:50:08,159 these sliders to stop working when we 4949 04:50:08,159 --> 04:50:12,000 we don't want to see the fft happen in 4950 04:50:10,240 --> 04:50:15,280 the background okay we will do those 4951 04:50:15,279 --> 04:50:19,919 all right let's get rid of this code and 4952 04:50:23,279 --> 04:50:30,637 button analyzer button path is 4953 04:50:27,040 --> 04:50:32,638 created only once all right now if we 4954 04:50:32,637 --> 04:50:36,637 making it only appear once every time 4955 04:50:39,759 --> 04:50:44,797 this path um it could become not an 4956 04:50:42,957 --> 04:50:46,079 audio parameter but it could be stored 4957 04:50:46,080 --> 04:50:51,440 value tree state state value tree it 4958 04:50:49,279 --> 04:50:53,039 could be stored as like just binary data 4959 04:50:51,439 --> 04:50:56,559 and then that way whenever the plugin is 4960 04:50:53,040 --> 04:50:59,840 first created you get a customized path 4961 04:50:56,560 --> 04:51:01,360 and whenever you load that in it just it 4962 04:51:01,360 --> 04:51:05,040 so that's you know that's a way to make 4963 04:51:05,040 --> 04:51:08,958 it's random the very first time you open 4964 04:51:07,040 --> 04:51:09,680 the gui but that's the only time once 4965 04:51:09,680 --> 04:51:13,119 um you have to create a new instance of 4966 04:51:11,360 --> 04:51:13,760 the class or a new instance of the 4967 04:51:13,759 --> 04:51:18,079 in order to get a new path there but you 4968 04:51:18,080 --> 04:51:22,000 all right um let's see what are we going 4969 04:51:20,080 --> 04:51:24,000 to do we are going to make our buttons 4970 04:51:22,000 --> 04:51:27,680 actually enable or disable gui 4971 04:51:27,680 --> 04:51:32,718 head on over to the audio processor 4972 04:51:32,718 --> 04:51:36,637 and we're going to go down to after our 4973 04:51:36,637 --> 04:51:40,957 now we are going to use the on click 4974 04:51:38,957 --> 04:51:41,680 lambdas to change the enablement of the 4975 04:51:41,680 --> 04:51:45,760 so the reason i'm doing this here is 4976 04:51:46,000 --> 04:51:49,919 this is where all of these components 4977 04:51:49,919 --> 04:51:54,797 right i'm going to make this button 4978 04:51:54,797 --> 04:51:58,637 this button is gonna control this slider 4979 04:51:58,637 --> 04:52:01,840 this button is gonna control these three 4980 04:52:01,840 --> 04:52:06,957 this button is going to control uh 4981 04:52:05,119 --> 04:52:09,759 the high cut buttons this guy and this 4982 04:52:06,957 --> 04:52:11,359 guy and then this thing is gonna 4983 04:52:09,759 --> 04:52:13,599 send a message to this thing to stop 4984 04:52:13,599 --> 04:52:16,637 okay so that's why we're doing this here 4985 04:52:16,637 --> 04:52:19,919 inside um maybe we make some macro 4986 04:52:19,919 --> 04:52:24,000 that owns the um the sliders and stuff 4987 04:52:22,560 --> 04:52:27,200 i'm doing it here because this is where 4988 04:52:24,000 --> 04:52:28,718 the the most common place this 4989 04:52:27,200 --> 04:52:30,159 this is the place where all the 4990 04:52:28,718 --> 04:52:31,680 components can see all the other 4991 04:52:31,680 --> 04:52:34,957 so it makes just the communication 4992 04:52:34,957 --> 04:52:39,439 now as with all asynchronous callbacks 4993 04:52:37,840 --> 04:52:40,797 we need to use a safe pointer to make 4994 04:52:40,797 --> 04:52:44,399 in this case the editor is still in 4995 04:52:42,797 --> 04:52:46,957 existence when we try to use this 4996 04:52:46,957 --> 04:52:50,399 all right so let's get started with that 4997 04:52:50,400 --> 04:52:57,680 pointer equals juice component 4998 04:52:54,000 --> 04:52:59,360 safe pointer simple eq audio processor 4999 04:52:59,360 --> 04:53:03,279 this all right now we can start 5000 04:53:01,680 --> 04:53:04,400 declaring these guys so we'll do we'll 5001 04:53:04,400 --> 04:53:09,360 peak bypass button and this is where it 5002 04:53:09,360 --> 04:53:13,440 lambda with no arguments and here's 5003 04:53:12,240 --> 04:53:14,240 where we're going to do the good stuff 5004 04:53:14,240 --> 04:53:17,280 first we have to check if our safe 5005 04:53:20,400 --> 04:53:24,000 all right if it does once we know it 5006 04:53:22,080 --> 04:53:25,840 exists we can get the bypass state 5007 04:53:24,000 --> 04:53:28,637 and set our slider's enablement 5008 04:53:28,637 --> 04:53:34,239 equals comp peak bypass button to get 5009 04:53:34,240 --> 04:53:40,000 easy all right now remember if the band 5010 04:53:37,919 --> 04:53:43,279 is bypassed that means the sliders 5011 04:53:40,000 --> 04:53:47,119 should not be enabled or said in reverse 5012 04:53:43,279 --> 04:53:50,637 if the band is not bypassed the sliders 5013 04:53:50,637 --> 04:53:56,718 um peak frequency slider set enabled 5014 04:53:54,957 --> 04:53:58,399 it should be enabled if we are not 5015 04:53:58,400 --> 04:54:02,319 okay let's do it again for the other 5016 04:54:02,319 --> 04:54:08,560 this is the peak gain and the peak 5017 04:54:06,319 --> 04:54:10,637 quality all right let's test it before 5018 04:54:10,637 --> 04:54:14,718 buttons work all right we did the peak 5019 04:54:14,718 --> 04:54:21,280 i'm not seeing it do anything hmm 5020 04:54:18,718 --> 04:54:24,159 let's go up to our look and feel all 5021 04:54:21,279 --> 04:54:26,239 right so here's our draw rotary slider 5022 04:54:24,159 --> 04:54:28,797 what are we not doing uh we are not 5023 04:54:26,240 --> 04:54:30,718 setting our colors differently 5024 04:54:28,797 --> 04:54:33,599 if we are enabled or disabled so let's 5025 04:54:33,599 --> 04:54:41,359 all right we can do that right here auto 5026 04:54:36,797 --> 04:54:43,599 enabled equals uh slider dot is enabled 5027 04:54:41,360 --> 04:54:45,920 now we can set these colors accordingly 5028 04:54:45,919 --> 04:54:51,119 use this cool color otherwise use um 5029 04:54:51,119 --> 04:54:54,797 that's for the background circle same 5030 04:54:54,797 --> 04:55:00,239 enabled if it's enabled use 5031 04:54:58,000 --> 04:55:01,119 that um i guess there's an orangey color 5032 04:55:01,119 --> 04:55:05,439 um so we will do colors a different type 5033 04:55:05,439 --> 04:55:09,279 all right do we have any other colors 5034 04:55:09,279 --> 04:55:13,840 looking for set color that's for the 5035 04:55:13,840 --> 04:55:17,439 all right let's try that out one more 5036 04:55:21,360 --> 04:55:25,040 okay so i would like the parameter text 5037 04:55:25,040 --> 04:55:28,319 also fade out but we can do that after 5038 04:55:26,637 --> 04:55:30,319 we get these other lambdas set 5039 04:55:28,319 --> 04:55:31,840 up so we're going to follow the same 5040 04:55:31,840 --> 04:55:36,878 let's go back down to our constructor 5041 04:55:34,957 --> 04:55:38,399 we're going to follow the same pattern 5042 04:55:36,878 --> 04:55:39,760 we're going to capture a safe pointer 5043 04:55:38,400 --> 04:55:41,440 we're going to check if the component is 5044 04:55:39,759 --> 04:55:43,119 valid and then if it is we will get the 5045 04:55:41,439 --> 04:55:44,239 bypass state and then change the 5046 04:55:44,240 --> 04:55:48,560 of the sliders accordingly so let's do 5047 04:55:48,560 --> 04:55:54,718 next look at bypass button.on click 5048 04:55:53,200 --> 04:55:56,637 all right first make sure the component 5049 04:55:56,637 --> 04:56:02,319 bypass state all right this is the low 5050 04:56:02,319 --> 04:56:08,797 and then set the um set the low cut 5051 04:56:08,797 --> 04:56:12,000 remember it should be enabled if our 5052 04:56:15,360 --> 04:56:20,958 and then same thing for the high cut 5053 04:56:18,878 --> 04:56:22,958 all right let's give that a test and see 5054 04:56:20,957 --> 04:56:24,239 what's going on see if it's working as 5055 04:56:24,240 --> 04:56:28,718 this is high cut high cut high cut low 5056 04:56:32,159 --> 04:56:38,797 awesome cool let's add a commit for 5057 04:56:36,000 --> 04:56:41,040 that oh i forgot to make i forgot to 5058 04:56:41,040 --> 04:56:48,560 all right those let me say um let's see 5059 04:56:48,560 --> 04:56:52,798 slider enablements that's what happened 5060 04:56:52,797 --> 04:56:56,239 um yeah that's all part of that same 5061 04:56:56,240 --> 04:56:59,600 all right our next step is to make the 5062 04:56:59,599 --> 04:57:04,159 toggle the um fft analysis the spectrum 5063 04:57:04,159 --> 04:57:11,279 see if that make that do something 5064 04:57:08,400 --> 04:57:11,760 all right so let's go right here we're 5065 04:57:11,759 --> 04:57:17,279 analyzer enabled button on click 5066 04:57:16,000 --> 04:57:19,040 i'm going to capture the same safe 5067 04:57:23,919 --> 04:57:29,599 all right now we need our enabled state 5068 04:57:27,840 --> 04:57:30,878 all right and now let's call a function 5069 04:57:30,878 --> 04:57:35,760 um we'll add it in just a second comp 5070 04:57:39,840 --> 04:57:45,680 uh enable okay let's that's a good name 5071 04:57:43,040 --> 04:57:49,040 for what this function needs to do 5072 04:57:45,680 --> 04:57:53,200 all right let's head on over to our 5073 04:57:53,200 --> 04:57:57,520 and provide that function so we stop 5074 04:57:57,520 --> 04:58:01,600 okay that's um where is that here's our 5075 04:58:07,919 --> 04:58:12,957 and now um let's see what do we need to 5076 04:58:12,957 --> 04:58:17,840 that it can check so let's put that down 5077 04:58:22,637 --> 04:58:27,039 we'll set that to true by default and 5078 04:58:25,040 --> 04:58:28,560 then uh we'll just do an implementation 5079 04:58:28,560 --> 04:58:35,760 should show fft analysis equals 5080 04:58:35,759 --> 04:58:40,479 all right let's head on over to our 5081 04:58:43,840 --> 04:58:48,560 paint function and uh that's the wrong 5082 04:58:47,119 --> 04:58:50,239 paint function response curve paint 5083 04:58:50,240 --> 04:58:56,638 and if our analyzer is enabled 5084 04:58:53,360 --> 04:58:59,920 grab those paths and draw them if 5085 04:58:59,919 --> 04:59:05,519 do this here's where the paths are drawn 5086 04:59:03,119 --> 04:59:07,439 put that right in there all right let's 5087 04:59:07,439 --> 04:59:11,520 oh before we test it out um we should 5088 04:59:11,520 --> 04:59:15,200 uh if we are where's our timer callback 5089 04:59:15,200 --> 04:59:21,119 all right if our analysis is turned off 5090 04:59:21,119 --> 04:59:24,637 all right if we should show the analysis 5091 04:59:24,637 --> 04:59:30,479 um yeah the fft guys should the 5092 04:59:28,080 --> 04:59:32,080 path producers should um produce the 5093 04:59:32,080 --> 04:59:36,638 all right now we can go test it 5094 04:59:35,200 --> 04:59:40,290 all right let's run some audio through 5095 04:59:36,637 --> 04:59:45,139 our plug-in and check out that button 5096 04:59:46,479 --> 04:59:58,079 all right cool that is working 5097 04:59:53,119 --> 05:00:01,520 awesome so analyzer enablement button 5098 04:59:58,080 --> 05:00:05,120 talk is implemented implemented 5099 05:00:05,119 --> 05:00:14,079 i redid that there and did it here 5100 05:00:10,159 --> 05:00:15,360 cool all right the last tweak that i 5101 05:00:15,360 --> 05:00:18,560 um let's head on up to the top we're 5102 05:00:17,439 --> 05:00:21,599 going to head up to our drop rotary 5103 05:00:18,560 --> 05:00:25,840 slider i had said i wanted that text 5104 05:00:25,840 --> 05:00:32,159 all right so let's do that right now um 5105 05:00:29,279 --> 05:00:32,797 yeah okay so right here if we're enabled 5106 05:00:32,797 --> 05:00:38,079 use the black background otherwise use a 5107 05:00:38,080 --> 05:00:42,000 and then if we are enabled use white 5108 05:00:45,840 --> 05:00:52,878 all right let's see what that looks like 5109 05:00:49,200 --> 05:00:54,637 hey awesome all right i'm very happy 5110 05:00:54,637 --> 05:00:58,878 okay cool all right let's make a commit 5111 05:01:06,637 --> 05:01:10,399 all right that is the end of the 5112 05:01:08,400 --> 05:01:12,000 tutorial i am going to dial in the 5113 05:01:12,000 --> 05:01:16,159 but there you have it that is how to 5114 05:01:16,159 --> 05:01:19,680 thanks for sticking with me to the end 5115 05:01:18,319 --> 05:01:20,957 um well we learned how to make this 5116 05:01:20,957 --> 05:01:26,319 3-band equalizer with fft analyzer 5117 05:01:24,560 --> 05:01:28,560 if you liked what you experienced here 5118 05:01:26,319 --> 05:01:30,718 you can check out my course project 11 5119 05:01:28,560 --> 05:01:33,360 where you will learn to build the 5120 05:01:33,360 --> 05:01:36,878 plugin from scratch i also have a course 5121 05:01:36,878 --> 05:01:40,479 plus from scratch in the context of 5122 05:01:38,400 --> 05:01:41,600 writing audio software the focus there 5123 05:01:41,599 --> 05:01:45,840 and not on video tutorials programming 5124 05:01:43,759 --> 05:01:47,039 is learned by doing not by watching 5125 05:01:45,840 --> 05:01:48,878 so for that you're going to work your 5126 05:01:48,878 --> 05:01:53,040 10 projects i'm going to review your 5127 05:01:51,279 --> 05:01:55,759 code every step of the way via pull 5128 05:01:53,040 --> 05:01:57,120 requests on github and bitbucket 5129 05:01:55,759 --> 05:01:59,840 because that's what we use in the real 5130 05:01:57,119 --> 05:02:00,239 world um nine of them are pure c-plus 5131 05:02:00,240 --> 05:02:03,680 projects that will teach you the 5132 05:02:01,439 --> 05:02:06,159 language fundamentals uh the tenth 5133 05:02:03,680 --> 05:02:07,200 project is a multi-meter audio plug-in 5134 05:02:07,200 --> 05:02:10,560 just like we used here it features level 5135 05:02:10,560 --> 05:02:13,600 histograms go neometers correlation 5136 05:02:13,599 --> 05:02:16,637 buttons and combo boxes threshold 5137 05:02:16,637 --> 05:02:20,797 saving and loading the plug-and-stay and 5138 05:02:20,797 --> 05:02:24,399 basically what you experienced here but 5139 05:02:22,240 --> 05:02:25,920 with way more visual stuff being built 5140 05:02:24,400 --> 05:02:27,520 and you aren't watching me build it 5141 05:02:27,520 --> 05:02:30,637 building it on your own i take on the 5142 05:02:30,637 --> 05:02:34,000 i set up a jira board with all of the 5143 05:02:32,637 --> 05:02:34,797 instructions because that's how 5144 05:02:34,797 --> 05:02:39,039 manage projects in the real world i 5145 05:02:36,878 --> 05:02:41,200 assign you issues from that board you 5146 05:02:39,040 --> 05:02:42,718 tackle them i review your work 5147 05:02:41,200 --> 05:02:44,560 and either help you when you get stuck 5148 05:02:42,718 --> 05:02:45,280 or i approve it and assign you something 5149 05:02:45,279 --> 05:02:49,439 uh in the end you'll have built the 5150 05:02:46,878 --> 05:02:52,479 whole plug-in from scratch without me 5151 05:02:49,439 --> 05:02:54,399 writing a single line of code for you 5152 05:02:52,479 --> 05:02:55,840 you're going to do it all yourself i'm 5153 05:02:55,840 --> 05:02:59,680 so it's a pretty cool experience i've 5154 05:02:57,200 --> 05:03:01,760 had a lot of people uh go through it 5155 05:02:59,680 --> 05:03:03,040 i've had a few people actually manage to 5156 05:03:03,040 --> 05:03:07,440 pretty big audio company so check out 5157 05:03:05,919 --> 05:03:09,839 the link in the description or by 5158 05:03:10,200 --> 05:03:14,000 www.programmingformusicians.com 5159 05:03:11,599 --> 05:03:15,919 thank you again for tuning in i am chuck 5160 05:03:14,000 --> 05:03:17,200 i also go by the name matcat music on 5161 05:03:17,200 --> 05:03:23,840 good luck on your coding journeys and i 5162 05:03:19,040 --> 05:03:23,840 will see you in the next project 379350

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.