Placeholder Image

字幕列表 影片播放

由 AI 自動生成
  • Hey what's up everybody, I'd like to welcome you to another audio programmer tutorial.

    大家好,歡迎收聽另一部音頻程序員教程。

  • And in this tutorial we're going to talk to you about the Juice audio processor class.

    在本教程中,我們將介紹 Juice 音頻處理器類。

  • The audio processor class is the way that you can write your plug-in code once but be able to turn your plug-in code into all the different formats that you're able to deploy for plugins such as VST3, AU, and AEX, and also be able to do those plug-ins on separate operating systems such as Windows and Mac OS.

    通過音頻處理器類,您只需編寫一次插件代碼,就能將插件代碼轉換成 VST3、AU 和 AEX 等不同格式的插件,並能在 Windows 和 Mac OS 等不同作業系統上運行這些插件。

  • So we have two objectives for this tutorial.

    是以,本教程有兩個目標。

  • The first objective is that we're going to dissect the Juice audio processor class.

    第一個目標是,我們將剖析 Juice 音頻處理器類。

  • I've been doing Juice tutorials since 2017 and I'm embarrassed to say that I never really took the time until recently to dig into the audio processor class and really truly look at what it does and what each function is doing.

    我從 2017 年起就開始做 Juice 教程,說來慚愧,直到最近我才真正花時間深入研究音頻處理器類,真真切切地瞭解它的作用和每個功能的作用。

  • So I'm going to do that with you today and show you some of the insights that I've gained along the way.

    所以,我今天要和大家一起做這件事,並向大家展示我一路走來的一些感悟。

  • The second objective is that I'm going to show you the Juice audio processor class alongside the CMake file that we did in the last tutorial and show you how those two things relate to each other and how the configuration of your CMake file relates to the code that is actually generated for the Juice audio processor class.

    第二個目標是,我將向你展示 Juice 音頻處理器類和 CMake 文件,並向你展示這兩個文件之間的關係,以及 CMake 文件的配置與 Juice 音頻處理器類實際生成的代碼之間的關係。

  • When one of my mentors showed me how these two files relate, it really helped me expand my mind map on how build systems and generated code actually relate to each other and helped me level up my skill set in a major way and I hope it levels up your skill set as well.

    當我的一位導師向我展示這兩個文件之間的關係時,它真的幫我擴展了我的思維導圖,讓我瞭解構建系統和生成代碼之間的關係,並幫助我在很大程度上提升了我的技能,我希望它也能提升你的技能。

  • If you're ready to take that next step into audio plug-in development, I invite you to check out our latest book, The Complete Beginner's Guide to Audio Plug-in Development.

    如果你已經準備好邁出音頻插件開發的下一步,我邀請你閱讀我們的最新著作《音頻插件開發完全入門指南》。

  • This has everything that you need to know to build your first audio plug-in, over 450 pages, and you can get it both on physical copy via Amazon and via ebook on our website theaudioprogrammer.com.

    這本書有製作第一個音頻插件所需的一切知識,共 450 多頁,你可以通過亞馬遜購買實體版,也可以通過我們的網站 theaudioprogrammer.com 購買電子書。

  • This video is also brought to you today by our sponsor, JetBrains.

    本視頻也由我們的贊助商 JetBrains 提供。

  • So I've been using their Sealion IDE for quite a while now and along with their great cross-platform experience of being able to switch back and forth between Windows and Mac and being able to find everything easily because the experience is largely the same.

    我使用他們的 Sealion IDE 已經有一段時間了,他們的跨平臺體驗非常好,可以在 Windows 和 Mac 之間來回切換,而且因為體驗基本相同,所以很容易找到所有東西。

  • I've also been enjoying their integrated CMake support.

    我也很喜歡他們集成的 CMake 支持。

  • It's been a lifesaver for me because I'm not an expert on build systems and being able to just double click on the CMake file and have it open up my project is a lifesaver.

    這對我來說是個救星,因為我不是構建系統方面的專家,能夠雙擊 CMake 文件並打開我的項目是我的救星。

  • It also has the ability to be able to debug CMake files, which is really awesome.

    它還能調試 CMake 文件,這真是太棒了。

  • I really love that feature.

    我真的很喜歡這個功能。

  • Be sure to check out JetBrains and Sealion on the link below.

    請務必通過下面的鏈接查看 JetBrains 和 Sealion。

  • And without further delay, let's get started.

    事不宜遲,讓我們開始吧。

  • Okay, so here we are in our project and one thing that you'll notice is that I'm in my CMake file rather than having the ProJuicer.

    好了,現在我們來到了項目中,你會注意到的一點是,我在 CMake 文件中,而不是在 ProJuicer 中。

  • And with that, I'm going to make a very small announcement, which is that moving forward, we're going to be doing our tutorials using CMake rather than the ProJuicer.

    接下來,我要宣佈一個小消息,那就是今後我們將使用 CMake 而不是 ProJuicer 來編寫教程。

  • Now, I think that the ProJuicer is great if you know barely anything about C++ and about Guice and you're just starting to get off the ground and write some code and write your first plugin.

    現在,如果你對 C++ 和 Guice 幾乎一無所知,而且剛剛開始編寫一些代碼和第一個插件,我認為 ProJuicer 是個不錯的選擇。

  • But I think once you start really getting serious about C++ development that you're probably going to want to start switching towards using a build system like CMake.

    但我認為,一旦你開始真正認真地進行 C++ 開發,你可能就會開始轉向使用 CMake 這樣的構建系統。

  • This is a challenging step and it's been challenging for me.

    這是具有挑戰性的一步,對我來說也是如此。

  • However, one thing that I will say is having been around a couple major music tech companies that all of them use something like CMake or another build system for generating their projects.

    不過,有一點我要說的是,在幾家大型音樂技術公司工作過的人都會使用 CMake 或其他構建系統來生成項目。

  • None of them use the ProJuicer.

    他們都沒有使用 ProJuicer。

  • Okay, so if you want to get into this and start doing this for a living, I would highly advise or recommend that you start learning build systems and learning at least the basics about them.

    好了,如果你想進入這個行業並以此為生,我會強烈建議你開始學習構建系統,並至少學習有關它們的基礎知識。

  • And that's what I'm trying to do as well.

    這也是我想做的。

  • So that's why we're working with CMake right now.

    這就是我們現在使用 CMake 的原因。

  • So I know that this transition from the ProJuicer to CMake will feel a little bit intimidating for some.

    所以我知道,從 ProJuicer 到 CMake 的過渡對某些人來說會有點嚇人。

  • But don't worry, we're going to take it slow and I'm going to try to show you every step of the way how everything is happening.

    不過別擔心,我們會慢慢來,我會盡力向你們展示每一步是如何進行的。

  • So first thing I would say is watch the last tutorial because that's how we actually created the CMake file that we're seeing here right now.

    所以我想說的第一件事就是觀看上一個教程,因為我們就是這樣創建了現在看到的 CMake 文件。

  • So the second thing I'm going to show you is something that I learned when I first started working with CMake that really helped me switch on the light in terms of what build systems do and what their intention is.

    第二件事是我剛開始使用 CMake 時學到的,它讓我明白了構建系統的作用和意圖。

  • So if we scroll down here a little bit, what I'm going to show you is that in this juice add plugin function that we have a couple configuration options.

    是以,如果我們向下滾動一點,我將向你展示的是,在這個果汁添加插件功能中,我們有幾個配置選項。

  • Okay, so the reason for this is let's just take the code and put it aside for a second.

    好吧,之所以這樣做,是因為我們先把代碼放在一邊。

  • And let's just say that we were just having a conversation about creating a plugin.

    這麼說吧,我們當時正在討論創建一個插件。

  • So one of the first questions that we would probably ask is, well, what kind of plugin do we want it to be?

    是以,我們可能會問的第一個問題是,我們希望它成為一個什麼樣的插件?

  • Do we want it to be an audio effect?

    我們希望它是一種音頻效果嗎?

  • Do we want it to be a synthesizer?

    我們希望它是一個合成器嗎?

  • Do we want it to be some type of midi effect?

    我們希望它是某種類型的 midi 效果嗎?

  • These are some of the first questions that we would ask ourselves, right?

    這些都是我們首先會問自己的問題,對嗎?

  • And so this is what I would call or what would technically be called global configuration.

    這就是我所說的或技術上所說的全局配置。

  • Okay, what do we want this project to be?

    好吧,我們希望這個項目成為什麼?

  • So you can see that here with the CMake file that these global configurations are here on the front, meaning on the CMake file itself, that we can change these to true or false.

    在 CMake 文件中,你可以看到這些全局配置都在前面,也就是 CMake 文件本身,我們可以將其改為 true 或 false。

  • So think of these as options or buttons that we could switch as developers.

    是以,可以把它們看作是我們作為開發人員可以切換的選項或按鈕。

  • Now, what happens is that these actually affect what happens on the code in the project that's actually generated.

    現在的情況是,這些代碼實際上會影響項目中實際生成的代碼。

  • So if we go to skipping ahead a little bit into some of the functions into the plugin processor.cpp, we have this function here that says accepts midi, right?

    是以,如果我們跳過插件處理器.cpp 中的一些函數,就會發現這裡有一個接受 midi 的函數,對嗎?

  • And we can see that this is currently set to return false, okay?

    我們可以看到目前的設置是返回 false,好嗎?

  • Because we see that this return true is kind of shaded and that it's currently returning false.

    因為我們看到這個返回值為 true 的地方有陰影,目前返回的是 false。

  • So it's saying that we do not want midi input.

    也就是說,我們不需要 midi 輸入。

  • That correlates directly with what we have here.

    這與我們這裡的情況直接相關。

  • This option needs midi input.

    該選項需要 midi 輸入。

  • Now, if I set this to true, and then if I regenerate the CMake file, rerun the CMake file, for people who are not using CLion, you would need to use the CMake command, which I believe is CMake-B, builds-G, and then whatever IDE that you're using.

    如果我將此設置為 "true",然後重新生成 CMake 文件,重新運行 CMake 文件,那麼對於不使用 CLion 的用戶來說,就需要使用 CMake 命令,我認為是 CMake-B、builds-G,然後是你正在使用的 IDE。

  • Okay, so now we come in here into access midi, and we see that that has now returned true.

    好的,現在我們進入 access midi,可以看到返回值為 true。

  • So we've just kind of hit a button or hit a switch there, and that has actually switched things.

    是以,我們只是按了一下按鈕或開關,實際上就改變了情況。

  • So this is a great way for us to be able to create a convenient interface for the developer to be able to change their configuration of their plugin or of their project in a way that before they actually even generate the project.

    是以,這是一個很好的方法,我們可以為開發人員創建一個方便的界面,讓他們在實際生成項目之前,就能更改其插件或項目的配置。

  • So that is what the intention of using CMake really is, okay?

    這就是使用 CMake 的真正目的,好嗎?

  • So if I take this and I turn this back to false, and then if I come here over back over here into this, and then I hit this refresh my CMake file, you'll see that this will change back to false.

    所以,如果我把這個調回 false,然後回到這裡,再點擊這個刷新 CMake 文件,你就會看到這個會變回 false。

  • Okay, and see how that switched?

    好吧,你看這是怎麼轉換的?

  • Okay, so that was something that was very simple, but also a very big revelation for me.

    好吧,這件事很簡單,但對我來說也是一個很大的啟示。

  • Now, I know what some of you are thinking.

    我知道你們有些人在想什麼。

  • Josh, why can't you just put this option directly in the header file or in the CPP file?

    喬希,為什麼不能把這個選項直接放在頭文件或 CPP 文件中?

  • Why can't you just have some sort of option or some sort of bull that you put in here?

    為什麼你就不能在這裡設置一些選項或公牛呢?

  • And the reason is going back to that architectural question of, okay, these are what we would call global configurations, configurations of the project just as a whole, okay?

    原因就在於我們又回到了架構問題上,好吧,這些就是我們所說的全局配置,也就是整個項目的配置,明白嗎?

  • And that from an architectural standpoint, it would make more sense to have these options within the CMake file, which is kind of the front interface for the entry point for the developer of what they want this project to be, rather than having it hidden in an individual header file or CPP file, okay?

    從架構的角度來看,將這些選項放在 CMake 文件中更有意義,因為 CMake 文件是開發人員瞭解項目的入口,而不是將其隱藏在單獨的頭文件或 CPP 文件中,好嗎?

  • So that's the reason that it's done that way and why developers choose to do it.

    是以,這就是這樣做的原因,也是開發人員選擇這樣做的原因。

  • So that, I hope, helps reveal some of the light or shed a little bit of light on why we use build systems like CMake and why we use these global configurations rather than putting them into the code themselves.

    是以,我希望這能幫助我們揭示或闡明為什麼要使用 CMake 這樣的構建系統,以及為什麼要使用這些全局配置而不是將它們放在代碼中。

  • So I hope that was helpful for you.

    希望這對你有所幫助。

  • Okay, moving along, here we are in our header file, which is the audio plugin audio processor, and this is inheriting from a juice audio processor.

    好了,現在我們來到頭文件,這是音頻插件的音頻處理器,繼承自 juice 音頻處理器。

  • Now, we have a few pure virtual functions that we've been implementing here, and we can tell that they're pure virtual functions because they have this override keyword, okay?

    現在,我們在這裡實現了幾個純虛擬函數,我們可以看出它們是純虛擬函數,因為它們有這個覆蓋關鍵字,好嗎?

  • That's how you know that it's pure virtual function.

    這樣你就知道這是純粹的虛擬函數。

  • If we go over to the juice documentation, the way that you know that it's a virtual function is if the function has this equals zero after the function name, okay?

    如果我們查看果汁文檔,知道這是一個虛擬函數的方法是,如果函數名後面有等號 0,好嗎?

  • So that's how you know that this is a function that if you're inheriting from an audio processor class, you need to provide implementations of each one of those functions, okay?

    所以,如果你繼承了音頻處理器類,你就需要提供每個函數的實現,明白嗎?

  • I know that that's a general C++ thing, but I want to try to make this digestible for people who are just getting started, okay?

    我知道這是 C++ 的一般特性,但我想讓剛入門的人也能理解,好嗎?

  • So be sure to check out pure virtual functions if you're not familiar with that concept.

    是以,如果您不熟悉純虛函數的概念,請務必查看純虛函數。

  • Okay, so what we're going to do is give you a whistle stop tour of what the juice audio processor is and what each function does.

    好了,接下來我們要做的就是給大家介紹一下果汁音頻處理器是什麼,以及每種功能的作用。

  • This is not going to be really comprehensive.

    這並不全面。

  • This is going to be very general, but hopefully this should give you some insight into some things that you may not have known about before.

    這篇文章很籠統,但希望能讓你瞭解一些以前可能不知道的事情。

  • I know that I've learned a lot in creating this tutorial, so hopefully it's helpful for you.

    我知道,在編寫本教程的過程中,我學到了很多東西,希望對你有所幫助。

  • Okay, so let's get started.

    好了,讓我們開始吧。

  • So the first thing that we have here is the constructor.

    首先是構造函數。

  • So this is what's called when the plugin is first created.

    是以,這是插件首次創建時的調用。

  • And what happens is that it creates this juice audio processor.

    然後,它就會創建一個果汁音頻處理器。

  • And then in here is this piece of code with some macros that look intimidating at first, but if you break it down, you can see that it's not very intimidating at all, okay?

    這裡有一段代碼,其中包含一些宏,乍一看很嚇人,但如果你把它分解一下,就會發現它一點也不嚇人,明白嗎?

  • So here we have these variables that we created with the CMakeLists.

    是以,我們有了這些用 CMakeLists 創建的變量。

  • Let me go back to CMakeLists here very quickly.

    讓我快速回到 CMakeLists。

  • So remember, we have these global configurations like needsMIDI input, needsMIDI output, and so on.

    請記住,我們有這些全局配置,如 needsMIDI 輸入、needsMIDI 輸出等。

  • So that's all these are here, okay?

    就這些了,好嗎?

  • So it's just using those configurations to see if it's a MIDI effect or if it's a synth.

    是以,它只是利用這些配置來確定是 MIDI 效果還是合成器。

  • And depending on what these choices are, then it's going to create some inputs and outputs and give those to our audio processor to create our audio output and input, right?

    根據這些選擇,它將創建一些輸入和輸出,並將這些輸入和輸出交給音頻處理器,以創建音頻輸出和輸入,對嗎?

  • So if it's not a MIDI effect, right?

    如果不是 MIDI 效果,對嗎?

  • So MIDI effect would take MIDI input and do something with it.

    是以,MIDI 效果可以接收 MIDI 輸入,並對其進行處理。

  • So if it's not a MIDI effect, and if it's not a synth, then it's saying that we want an audio input that would create stereo input, okay?

    是以,如果它不是 MIDI 效果器,也不是合成器,那麼它就是說,我們需要一個音頻輸入,以創建立體聲輸入,明白嗎?

  • And that if we wanted a stereo output, that that's what would happen.

    如果我們想要立體聲輸出,就必須這樣做。

  • So if it's a MIDI effect, obviously you would want it to have a MIDI output.

    是以,如果是 MIDI 效果器,顯然就需要有 MIDI 輸出。

  • But if it's not a MIDI effect, then you would want it to have an audio output.

    但如果它不是 MIDI 效果器,就需要有音頻輸出。

  • So that's what's happening there is just creating your inputs and outputs for your plugin.

    是以,這就是為插件創建輸入和輸出的過程。

  • And then of course, here in this function, this constructor function, you would have any type of initialization code that you would need to start up other classes, to start up other things that need to be initialized with some variables.

    當然,在這個函數,這個構造函數中,你還會有任何類型的初始化代碼,用來啟動其他類,啟動其他需要初始化變量的東西。

  • Next, we have our destructor.

    接下來是析構函數。

  • So this is typically what we would use that on destruction of this audio processor, which would typically be when somebody deletes your plugin, then this destructor would clear out any, you would use that to clear out any memory, any resources, any processes that need to be done before your plugin can be destroyed.

    是以,我們通常會在銷燬音頻處理器時使用這個析構函數,一般來說,當有人刪除你的插件時,這個析構函數就會清空所有內存、資源和插件銷燬前需要完成的進程。

  • Things like that would typically happen here.

    這樣的事情通常會發生在這裡。

  • These next ones, get name, accepts MIDI, produces MIDI, is MIDI effect.

    接下來的這些功能包括獲取名稱、接受 MIDI、產生 MIDI 和 MIDI 效果。

  • All of those are direct correlations to those global configurations that we created here in the CMake file.

    所有這些都與我們在 CMake 文件中創建的全局配置直接相關。

  • Needs MIDI input, needs MIDI output, and is MIDI effect and so on.

    需要 MIDI 輸入、MIDI 輸出、MIDI 效果等等。

  • Okay, so going down a little bit further, we have this get tail length seconds.

    好了,再往下一點,我們就能得到尾長秒數了。

  • So sometimes when you're using a plugin in a DAW, when you stop processing audio through the plugin, when you stop the DAW, then typically sometimes if it's like a reverb or it's the delay, maybe you want that delay or that reverb to continue ringing out until it's finished, until it reaches silence.

    是以,有時當你在 DAW 中使用插件時,當你停止通過插件處理音頻時,當你停止 DAW 時,通常有時如果是混響或延時,也許你希望延時或混響繼續響起,直到結束,直到達到靜音。

  • Sometimes you want the audio to stop right away when your plugin is stopped.

    有時,您希望在插件停止時立即停止音頻。

  • Okay, so if you want it to stop right away, then you would just leave that at 0.0 seconds.

    好吧,如果你想讓它立即停止,那就把它停留在 0.0 秒。

  • That means that even if it's a delay plugin or a reverb plugin, that when you hit stop, that the delay or the reverb stops.

    這意味著,即使是延時插件或混響插件,當你按下停止鍵時,延時或混響也會停止。

  • If you want it to continue playing after audio is done processing through the effect, after you've stopped the DAW, then you would change this to a different number.

    如果您想讓它在音頻通過效果器處理完畢、DAW 停止後繼續播放,則需要將其改為不同的數字。

  • These next few functions like get num programs, get current program, set current program, get current program name, change program name, all of these are referring to presets.

    接下來的幾個功能,如獲取編號程序、獲取當前程序、設置當前程序、獲取當前程序名稱、更改程序名稱,都是指預置。

  • So this is referring to a preset if it's loaded or if you want to get what the preset name is.

    是以,如果預設已加載,或者你想知道預設的名稱,這裡指的就是預設。

  • So typically your presets will be stored in some type of a vector with what you want each parameter to be set at, and that's how that would be stored.

    是以,通常情況下,您的預設會存儲在某種類型的矢量中,其中包含您希望設置的每個參數,這就是存儲方式。

  • And so all of these are just referring to loading them, getting them, changing the name of your plugin, of your preset rather, and so on.

    所有這些都是指加載它們、獲取它們、更改插件名稱、預設名稱等等。

  • Going down a little bit further, we have this function called prepare to play.

    再往下一點,我們有一個名為 "準備播放 "的函數。

  • So this is one of the more important functions that you have here in the audio processor.

    是以,這是音頻處理器中最重要的功能之一。

  • It's probably one of the top two or three most important functions.

    這可能是最重要的兩三個功能之一。

  • So anytime that you're processing a, you're doing some type of digital signal processing, so let's say that you have a reverb or you have a delay and you've created an algorithm or you're sourcing an algorithm from somewhere, typically you'll have some type of function that's called either prepare or reset or prepare to play.

    是以,無論何時,只要你在處理數字信號處理,比方說,你有一個混響或延遲,你創建了一個算法,或者你從某個地方獲取了一個算法,通常你會有某種類型的函數,被稱為準備、重置或準備播放。

  • And what this does is it allows you to take the sample rate and the buffer size of where the DA, of what the DAW is processing and pass it into these individual algorithms.

    這樣做的目的是,讓你可以將採樣率和數字音頻處理器處理的緩衝區大小,傳遞到這些單獨的算法中。

  • Okay, so for example, let's say that we have a one second delay algorithm, right?

    好吧,舉個例子,假設我們有一個一秒延遲算法,對嗎?

  • So your delay algorithm needs to know whether the sample rate is 44,100 samples per second or 48,000 samples per second, because that will determine whether that delay algorithm needs to process 44,100 samples or 48,000 samples to create that delay accurately.

    是以,你的延遲算法需要知道採樣率是每秒 44,100 個採樣點還是每秒 48,000 個採樣點,因為這將決定延遲算法需要處理 44,100 個採樣點還是 48,000 個採樣點才能準確創建延遲。

  • Okay, so that's why any DSP algorithm, typically you'll need some sort of prepare or reset or prepare to play algorithm that is implemented here in prepare to play.

    好了,這就是為什麼任何 DSP 算法,通常都需要某種準備、重置或準備播放算法,而準備播放算法就在這裡實現。

  • Now, another thing is to think about or to know about is when this function is actually called within the plugin.

    現在,另一件需要考慮或瞭解的事情是,何時在插件中實際調用這個函數。

  • So depending on the DAW, sometimes these are called at different times, but typically what'll happen is that when you create a plugin in your DAW, it will, I think most of them, all of them perhaps call prepare to play when the the plugin is getting ready to start processing audio again.

    是以,根據 DAW 的不同,有時會在不同的時間調用這些功能,但通常情況下,當你在 DAW 中創建一個插件時,我想大多數插件都會調用 "準備播放 "功能,也許所有插件都會在插件準備再次開始處理音頻時調用 "準備播放 "功能。

  • So for example, when the user hits the space bar to start playing audio through the plugin.

    例如,當用戶點擊空格鍵開始通過插件播放音頻時。

  • So let's say, and the reason for this is, let's say that the user has been playing audio through the plugin and the sample rate is 44,100 and they've been playing audio through the plugin and then they stop it.

    假設用戶一直通過插件播放音頻,採樣率為 44100,然後他們停止了播放。

  • Let's say for whatever reason, they decide to change the sample rate to 48,000 samples per second.

    比方說,不管出於什麼原因,他們決定將採樣率改為每秒 48,000 個採樣點。

  • Then what needs to happen is that that information needs to be passed into all of your DSP algorithms.

    然後,需要將這些資訊傳遞到所有 DSP 算法中。

  • So it knows that it needs to recompute those calculations.

    是以,它知道需要重新計算這些計算結果。

  • Okay, so that's why this prepare to play method is so important.

    好了,這就是為什麼這種 "準備遊戲 "的方法如此重要。

  • The next method release resources is actually one that I haven't used in my travels, but I imagine I should probably use it a little bit more.

    下一個發佈資源的方法其實是我在旅行中沒有用過的,但我想我應該多用一點。

  • So release resources is that sometimes you have a situation where maybe you, you aren't processing audio through your plugin, or you're not doing anything with the plugin, but you want to be able to, but let's say it's a memory hog and you want to be able to take that memory and free it up.

    是以,釋放資源是指有時你會遇到這樣的情況:也許你沒有通過插件處理音頻,或者你沒有用插件做任何事情,但你希望能夠這樣做,但比方說它佔用了內存,你希望能夠佔用內存並釋放它。

  • You can do that here and release resources.

    您可以在這裡發佈資源。

  • Once again, one that I haven't really used, but I imagine that it could be useful in certain situations.

    同樣,我也沒有真正用過,但我想它在某些情況下可能會很有用。

  • This Boolean function is buses layout supported is one that the DAW calls to make sure that when you're trying to put a plugin on a track, that the configuration of your DAW matches the configuration of your plugin.

    該布爾函數支持總線佈局,DAW 調用該函數是為了確保當你試圖在軌道上安裝插件時,DAW 的配置與插件的配置相匹配。

  • So if you're, let's say in Pro Tools and you're doing some sort of 5.1 or 7.1 speaker surround system processing, and then you try to load a stereo processing plugin, then what would happen is that this is buses layout supported would return false because it would say, Hey, I'm a stereo plugin.

    是以,如果你正在 Pro Tools 中進行某種 5.1 或 7.1 揚聲器環繞聲系統處理,然後嘗試加載一個立體聲處理插件,那麼將發生的情況是,這個受支持的總線佈局將返回 false,因為它會說,嘿,我是一個立體聲插件。

  • I can't, I can't work on this 5.1 or 7.1 system.

    我不能,我不能在這個 5.1 或 7.1 系統上工作。

  • Okay.

    好的

  • So that's what the purpose of this function is going down further to our next method.

    是以,這個函數的目的就是要進一步深入到我們的下一個方法。

  • This is probably the most important method in the audio processor class, which is called process block.

    這可能是音頻處理器類中最重要的方法,被稱為進程塊。

  • So process block is where your audio processing actually happens.

    是以,處理塊是實際進行音頻處理的地方。

  • So what it does is it gives you this buffer, which is your actual audio buffer.

    是以,它所做的就是為你提供這個緩衝區,也就是你的實際音頻緩衝區。

  • So think of this as almost like a, an empty boat that comes into your, or maybe it's a boat of audio that comes into your, into your plugin, think of your plugin as your dock.

    所以,把它想象成一艘空船,駛入你的插件,或者是一船音頻,把你的插件想象成你的碼頭。

  • And then let's say that you're doing an audio effect.

    比方說,你要做一個音頻效果。

  • Then what would happen is that audio comes into the plugin.

    這樣,音頻就會進入插件。

  • There's some sort of processing or some sort of change that happens.

    會發生某種處理或某種變化。

  • And then the boat leaves with your changed audio and comes out into the DAW.

    然後,小船帶著更改後的音頻離開,進入 DAW。

  • Okay.

    好的

  • So that's what the buffer is.

    這就是緩衝區的作用。

  • It's actually a, a vector, a stereo vector, typically that, uh, that holds the audio.

    它實際上是一個矢量,一個立體聲矢量,典型的音頻矢量。

  • You want to do some sort of changes to the audio, and then you want to process, you want to have those come out, uh, out of your plugin.

    你想對音頻做一些改動,然後進行處理,讓這些聲音從你的插件中出來。

  • Also, you have your mini messages or so if you have, uh, a mini keyboard that's hooked up, this is where your mini messages would be coming in.

    此外,你還有迷你資訊,如果你有迷你鍵盤,迷你資訊就會從這裡輸入。

  • And this is where you can define, okay, this is what I want the mini messages to do.

    在這裡你可以定義,好吧,這就是我想要迷你資訊做的事情。

  • When I press this key, I want it to play this sample at this particular speed and so on.

    當我按下這個鍵時,我希望它以這個特定的速度播放這個樣本,以此類推。

  • So that's what happens there.

    這就是那裡發生的事情。

  • Now I'll go into a little bit of detail of some of these things within the audio process block itself.

    下面我將詳細介紹音頻處理區塊本身的一些功能。

  • So this scoped node to normals is for, is a optimization.

    是以,這個法線範圍節點是為了進行優化。

  • So, uh, the normals is this thing that happens where, uh, when you're processing audio or when you're processing, let's say floating point numbers, let's say that the floating point numbers get very, very small.

    所以,法線是指在處理音頻或浮點數時,浮點數會變得非常非常小。

  • So I'm talking about a number like 0.0004.

    所以我說的是 0.0004 這樣的數字。

  • Um, what happens is that after a certain stage, uh, what happens is that processing those very small floating point numbers actually gets very expensive for the processor.

    嗯,到了一定階段後,處理器處理這些非常小的浮點數實際上會變得非常昂貴。

  • And you'll see the processor actually spike when this happens.

    當這種情況發生時,你會看到處理器的運行速度確實在飆升。

  • So node to normals allows the, uh, allows us to be able to zero out, uh, those very small numbers once they get past a certain point.

    是以,法線節點允許,呃,允許我們將那些非常小的數字歸零,呃,一旦它們超過某個點。

  • Um, so it's an optimization.

    嗯,所以這是一種優化。

  • Then we have these local variables that are just forgetting the number of input and output channels.

    然後,我們就有了這些局部變量,它們只是忘記了輸入和輸出通道的數量。

  • Um, below this, you have a very function that allows us to clear out any garbage audio that may be in our buffer when we're first starting to, um, to play audio, uh, out of our plugin.

    嗯,在這個下面,有一個非常重要的功能,可以讓我們在剛開始從插件播放音頻時,清除緩衝區中可能存在的任何垃圾音頻。

  • So it just clears that out and make sure that there's no garbage.

    是以,它只需將其清除,確保沒有垃圾。

  • Cause that could produce very loud artifacting.

    因為這會產生非常大的偽影。

  • Um, then below this is some, uh, some code code skeleton for, um, your actual audio processing.

    下面是一些用於實際音頻處理的代碼骨架。

  • When you want to implement your DSP algorithms and do other things, that's where that would typically happen.

    當你想執行 DSP 算法和做其他事情時,通常就會在這裡進行。

  • But I will show you how to do that, uh, in further and further tutorials.

    不過,我會在更多的教程中向你展示如何做到這一點。

  • One thing that I will tell you about with this process block is that a lot of people, including myself, when I first started getting into audio programming, I used to think of audio programming as something that happens sample by sample.

    我想告訴大家的是,在這個過程塊中,很多人,包括我自己,在剛開始接觸音頻編程時,都認為音頻編程是逐個採樣的事情。

  • Um, so most, I think all DAWs, uh, actually do block size processing, which means that they don't, they don't process audio sample by sample.

    嗯,所以大多數,我想所有的 DAW 都會進行塊大小處理,這意味著它們不會逐個樣本處理音頻。

  • They process it by buffer number of samples at a time.

    他們每次通過緩衝區樣本數來處理。

  • So if your buffer size is set to 128 samples, then it will process 128 samples at one time, then bring in the next 128 samples and so on.

    是以,如果您的緩衝區大小設置為 128 個採樣點,那麼它將一次處理 128 個採樣點,然後引入下一個 128 個採樣點,以此類推。

  • Okay.

    好的

  • If it's 512, then it would be 512 samples that it would process at a time.

    如果是 512,那麼它一次要處理 512 個樣本。

  • Okay.

    好的

  • So this is why, uh, you get where, um, if you're using a MIDI controller and the, it, let's say that the block size, the buffer size is larger.

    這就是為什麼,嗯,你會發現,嗯,如果你使用的是 MIDI 控制器,比方說,塊大小、緩衝區大小比較大。

  • Let's say it's like 512 samples per block.

    比方說,每個區塊有 512 個採樣點。

  • That's why when you, uh, when you press a key or when you do something on the MIDI controller, that the responsiveness is slow, because what happens is that when you're moving your MIDI controller, it has to wait until the next process block to actually receive that MIDI message and something with it, um, before so, so that, um, it'll actually process what you've done.

    這就是為什麼當你按下一個鍵或在 MIDI 控制器上做一些動作時,響應速度會很慢,因為當你移動 MIDI 控制器時,它必須等到下一個進程塊才能真正接收到 MIDI 資訊,然後才能處理你所做的事情。

  • So that's why what happens is that typically people that are using MIDI controller, they set their buffer sizes to be as small as possible, because even though that makes the, um, the, it makes the CPU, the, the, the computer need to work harder.

    這就是為什麼使用 MIDI 控制器的人通常會把緩衝區設置得越小越好,因為這樣會讓 CPU、計算機工作得更 費力。

  • Uh, what happens is that you can get tighter responsiveness if you're using a DJ controller, if you're using a MIDI controller.

    如果你使用的是 DJ 控制器或 MIDI 控制器,就能獲得更快的響應速度。

  • Um, so just to give you a little bit of an example of how that would typically happen, right?

    給你舉個例子,說明這種情況通常是怎樣發生的,對嗎?

  • So let's pull up a calculator and let's say that our sample, uh, our sample rate is 44,100 samples per second.

    是以,讓我們打開計算器,假設我們的採樣率為每秒 44 100 個採樣點。

  • Okay.

    好的

  • So what that means is that our plugin needs to be able, our plugin, our DAW, uh, our computer needs to be able to process 44,100 samples per second.

    是以,這意味著我們的插件、我們的插件、我們的 DAW、呃,我們的電腦需要能夠每秒處理 44100 個採樣點。

  • If it doesn't process that, then you'll typically get some type of, um, you'll get some type of unpleasant noise, like a, like a break, or, um, maybe the audio might even stop some type of stuttering effect.

    如果處理不了,通常就會出現一些令人不悅的噪音,比如斷斷續續的聲音,或者音頻可能會出現停頓。

  • So, uh, if your sample rate is set for 44,100, that means it needs to process that amount of samples within one second.

    是以,如果你的採樣率設置為 44100,這意味著它需要在一秒鐘內處理這麼多的採樣。

  • So if our process block, um, so let's say that our sample rate is 44,100.

    是以,如果我們的程序塊,嗯,假設採樣率為 44100。

  • Let's say that our buffer size, the one that we set in our DAW, let's say that it's 256, right?

    假設我們在 DAW 中設置的緩衝區大小是 256,對嗎?

  • So 44,100 is our sample rate.

    是以,44100 是我們的採樣率。

  • If we have 256 samples, um, as our block size, that means that this process block needs to call 172 times per second to be able to produce audio where you don't hear any breaks, where it sounds the way it's supposed to sound.

    如果我們的程序塊大小為 256 個採樣點,這意味著這個程序塊每秒需要調用 172 次,才能產生聽起來沒有任何斷點的音頻。

  • Okay.

    好的

  • Now let's take, so that was 256 samples.

    現在我們來看看,一共是 256 個樣本。

  • Now let's take same sample rate, 44,100.

    現在我們採用相同的採樣率,即 44 100。

  • Let's divide that by 64 samples.

    再除以 64 個樣本。

  • Okay.

    好的

  • So rather than, I think it was 117, it said it needs to call 689 times per second in order to produce that audio accurately.

    是以,我認為不是 117 次,而是每秒需要調用 689 次,才能準確生成音頻。

  • So that's why what happens is that when you're adjusting, let's say you're doing DJ controller that you set your block size, your buffer size to be as small as possible.

    這就是為什麼在調整時,比方說在做 DJ 控制器時,要將塊大小、緩衝區大小設置得越小越好。

  • Um, that what happens is that if you set your buffer size too small, then what you'll get is breaks within the audio.

    如果緩衝區設置得太小,就會出現音頻中斷的情況。

  • You'll get this artifacting and the audio will stutter and it won't play properly because the, because your computer needs to work harder to call that process block 689 times per second.

    你會聽到偽音,音頻會出現卡頓,無法正常播放,因為你的電腦需要更努力地每秒調用該進程塊 689 次。

  • And it may not have the power to be able to do that and run all the other things that it needs to run at the same time.

    而且,它可能沒有足夠的能力做到這一點,並同時運行它需要運行的所有其他東西。

  • So that should hopefully give you an insight into, um, just the basics of how the process block runs and, uh, and help give you some intuition on, uh, some of the things that, um, that, that are done there within the process block.

    希望這能讓你瞭解進程塊的基本運行方式,並幫助你直觀地瞭解進程塊中的一些功能。

  • But we'll talk about other things.

    但我們還是要談談其他事情。

  • There are a lot of rules about the process block things that you're not supposed to do in your code, uh, here in the process block.

    有很多關於進程塊的規則,你不應該在代碼中,呃,在進程塊中做這些事情。

  • So it's a highly optimized piece of code that's meant to run on time and make sure that audio is always producing the way that it was designed to going down a little bit further.

    是以,它是一段高度優化的代碼,旨在按時運行,並確保音頻始終以設計的方式產生。

  • We have these two functions has editor and create editor.

    我們有兩個功能:編輯器和創建編輯器。

  • So this is referring to the user interface, the graphics of your plugin.

    是以,這裡指的是用戶界面,即插件的圖形。

  • Okay.

    好的

  • So what you could do is you could set this has editor defaults.

    是以,你可以將其設置為編輯器默認設置。

  • And that just means that you don't supply the, the, the, the plugin with, um, with your own graphics.

    這就意味著,你不能為插件提供你自己的圖形。

  • Typically when that happens, what will happen is that your DAW that you instantiate your plugin went in will typically see that.

    通常情況下,當發生這種情況時,您將插件實例化的 DAW 通常會看到這種情況。

  • And it'll actually create a generic interface for you.

    實際上,它會為你創建一個通用界面。

  • It won't look nice.

    這樣看起來不美觀。

  • It'll just be some simple dials and selector boxes.

    它只是一些簡單的刻度盤和選擇框。

  • But, um, that's what will typically happen below that you have this create editor.

    但是,嗯,在你有這個創建編輯器之後,通常就會發生這種情況。

  • And what you can see here is that it returns a new audio plugin, audio processor, editor, editor.

    在這裡,你可以看到它返回了一個新的音頻插件、音頻處理器、編輯器、編輯器。

  • And what that is, uh, we'll talk about this in future tutorials is where you actually create the graphics for your plugin.

    在今後的教程中,我們將介紹如何為插件創建圖形。

  • So this is actually creating an instance of the audio processor editor where your graphics would show up.

    是以,這實際上是創建了一個音頻處理器編輯器實例,你的圖形將顯示在其中。

  • Okay.

    好的

  • So that's what happens there.

    這就是那裡發生的事情。

  • Then you have get state information and set state information.

    然後是獲取狀態資訊和設置狀態資訊。

  • So this is where you would actually be able to save and load presets.

    是以,你可以在這裡保存和加載預設。

  • Okay.

    好的

  • So, uh, we'll do this in a future tutorial as well.

    所以,呃,我們也會在以後的教程中這樣做。

  • And, uh, we'll show how that works where you can actually, so for example, when you're, when you plug in, let's say that it's, um, so this is actually not so much for, uh, for presets.

    例如,當你插入預設時,我們會演示如何操作。

  • This is more for if you're in a DAW, uh, let's say you have a synthesizer loaded and it's in a certain state, the filter is at a certain cutoff and so on that, um, when you close down your project, you want the state of that plugin, the configuration that that's in to be saved.

    如果你在 DAW 中,比方說你加載了一個合成器,它處於某種狀態,濾波器處於某種截止點等等,那麼當你關閉項目時,你希望保存該插件的狀態和配置。

  • So that would happen in this, uh, set state information that it would say, okay, the user has saved this synthesizer in this current state.

    是以,在設置狀態資訊時,它會說:"好的,用戶已將此合成器保存為當前狀態。

  • Now we're going to, um, we're going to save it to the project.

    現在,我們要把它保存到項目中。

  • And then of course, when you reload the project, then you want get state information where it reloads with the right settings.

    當然,當你重新加載項目時,你需要獲取狀態資訊,使項目以正確的設置重新加載。

  • So that's where that happens.

    這就是發生的原因。

  • Uh, then finally you have, uh, this function that is able to create an instance of the plugin itself called create plugin filter.

    最後,這個函數可以創建一個插件實例,名為創建插件過濾器。

  • If we go a little bit further into the code, uh, what we'll see is how, what, how that actually happens.

    如果我們再深入研究一下代碼,呃,我們就會看到這究竟是如何發生的。

  • So as I was saying before, this juice audio processor class is a way for us to be able to write our audio code once, but not need to write it individually for each plugin format that we're trying to do.

    是以,正如我之前所說的,這個果汁音頻處理器類讓我們能夠一次性編寫音頻代碼,而無需為我們嘗試的每種插件格式單獨編寫代碼。

  • So typically, if we want to be able to sell a plugin, we want to be able to sell the VST three version of it, the AU version of it, potentially the AAX version of it.

    是以,通常情況下,如果我們想銷售一個插件,我們希望能銷售它的 VST 3 版本、AU 版本,甚至可能是 AAX 版本。

  • And we want to be able to do those for windows and Mac.

    我們希望能為 Windows 和 Mac 提供這些功能。

  • Right.

  • So, um, before juice, you used to need to be able to do that separately for each one of the plugin, uh, API APIs.

    所以,嗯,在果汁之前,你需要為每一個插件,嗯,API 應用程序接口,分別執行該操作。

  • But what juice has done is that they've nicely encapsulated this in this audio processor class so that when you actually write this once that it'll actually deploy your code and actually wrap it within the, uh, within these different plugin formats, uh, just by hitting a button.

    但果汁所做的是,他們將其很好地封裝在音頻處理器類中,這樣當你實際編寫一次,它就會實際部署你的代碼,並將其封裝在這些不同的插件格式中,嗯,只需點擊一個按鈕即可。

  • So there's a lot that happens under the hood there that you don't really see on the surface.

    是以,在引擎蓋下會發生很多表面上看不到的事情。

  • So they've done a really nice job of that.

    是以,他們在這方面做得非常好。

  • I'll show you just a very general overview of how that happens.

    我將向你展示一個非常概括性的概述,告訴你這是如何發生的。

  • But, uh, and if you want to have a deeper look, then feel free to take a deeper look.

    但是,呃,如果你想深入瞭解,那就請隨意深入瞭解。

  • But, um, this is where my knowledge starts to get a little bit hazy here.

    但是,嗯,這就是我的知識開始變得有點模糊的地方。

  • Um, but going into the juice code itself, I'm going to go into the juice modules.

    嗯,但進入果汁代碼本身,我要進入果汁模塊。

  • So think of these modules as individual libraries that have been written, um, for, um, for juice.

    是以,可以把這些模塊看作是為果汁編寫的獨立庫。

  • Okay.

    好的

  • So juice is really like a collection of different libraries and they have this one that's called juice audio plugin client.

    是以,果汁就像是一個不同庫的集合,他們有一個叫做果汁音頻插件客戶端的庫。

  • Now, if you go in here, now you see these different ones for AAX, uh, a U right.

    現在,如果你進入這裡,就會看到 AAX 的不同選項,呃,右邊的 U。

  • And BST three.

    還有 BST 3。

  • So these are all individual, um, SDKs or API APIs that if you wanted to, if you, if, if you wanted to take, for example, the Apple audio unit API, you could write a plugin that you just do and you deploy as an audio unit as just for a U format, but typically people want different formats to be able to satisfy different customers.

    是以,這些都是單獨的 SDK 或 API 應用程序接口,如果你想,如果你想,如果你想,例如,蘋果的音頻單元 API,你可以編寫一個插件,你只需要做,你作為一個音頻單元部署,因為只是一個 U 格式,但通常情況下,人們需要不同的格式,以能夠滿足不同的客戶。

  • Right.

  • So here in this, uh, juice audio plugin client.

    是以,在這個果汁音頻插件客戶端中。

  • So this is kind of the insertion point into where this happens.

    是以,這就是發生這種情況的插入點。

  • And you have a whole bunch of configuration options here that I'm not going to go through in this tutorial, but then you have this, uh, create plugin filter.

    這裡有一大堆配置選項,在本教程中我就不一一介紹了。

  • So this is what actually happens when you create a version of your audio plugin.

    這就是創建音頻插件版本時的實際情況。

  • Then what happens is that it calls this function called create plugin filter of type.

    然後,它會調用名為創建插件過濾器類型的函數。

  • And then here you have different plugin wrappers for the, for all the different, um, plugin formats.

    然後這裡有不同的插件包裝器,用於所有不同的插件格式。

  • So if I go here into wrapper type, here is where you see wrapper type VST three wrapper type, audio unit, wrapper type, AAX standalone wrapper type, and so on.

    是以,如果我進入包裝器類型,就會看到 VST 三種包裝器類型、音頻單元、包裝器類型、AAX 獨立包裝器類型等。

  • So this is actually how juice takes your plugin and it wraps it into these different formats and is able to provide you with binaries of all these different types.

    這就是 juice 如何將你的插件封裝成這些不同的格式,併為你提供所有這些不同類型的二進制文件。

  • So really clever stuff.

    真是聰明的東西。

  • Uh, it starts to get a lot lower level from here.

    呃,從這裡開始會變得更低級。

  • Uh, so for example, if we go into the VST three, um, into that one, let's just take a look here.

    舉例來說,如果我們進入 VST 3,嗯,進入那一個,讓我們看看這裡。

  • This is where it starts to get outside of my, um, outside of my domain knowledge.

    這就超出了我的知識範圍。

  • And you can see here that there's a lot of, a lot of stuff that goes on here and, um, a lot of, um, code that's a little bit deeper than my, than my experience.

    你可以看到,這裡有很多很多的東西,嗯,很多很多的代碼,嗯,比我的經驗要深一點。

  • But if you want to take a deeper look there, feel free to have a look, but that's, that's how it happens.

    不過,如果你想深入瞭解,可以隨便看看,但事情就是這樣發生的。

  • That's how the magic happens.

    魔法就是這樣產生的。

  • Okay.

    好的

  • So there you have it.

    就是這樣。

  • That's a general overview of what happens with the juice audio processor.

    以上就是果汁音頻處理器的大致情況。

  • As I mentioned before, this is one of the core classes that you need to know about if you're doing audio processing with juice.

    正如我之前提到的,如果使用果汁進行音頻處理,這是需要了解的核心類之一。

  • Uh, I hope that was helpful for you.

    希望對你有所幫助。

  • If you, uh, found that helpful and, um, gain something from that, be sure to give it a like and subscribe, and I will see you next time.

    如果你覺得很有幫助,並且從中有所收穫,請務必點贊和訂閱,我們下次再見。

Hey what's up everybody, I'd like to welcome you to another audio programmer tutorial.

大家好,歡迎收聽另一部音頻程序員教程。

字幕與單字
由 AI 自動生成

單字即點即查 點擊單字可以查詢單字解釋