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 about the Juice Audio Processor Editor class.

    このチュートリアルでは、Juice Audio Processor Editorクラスについて説明します。

  • This is the base class that is used by Juice for any visual elements that you would like to use for your user interface.

    これはJuiceがユーザーインターフェイスに使用するビジュアル要素のために使用する基本クラスです。

  • That is, what people see when they open up your plugin.

    つまり、人々があなたのプラグインを開いたときに目にするものです。

  • The main objectives for this tutorial are to introduce you to the Audio Processor Editor class and the concept of components within Juice.

    このチュートリアルの主な目的は、Audio Processor EditorクラスとJuice内のコンポーネントの概念を紹介することです。

  • To introduce you to the concept of parent and child components.

    親コンポーネントと子コンポーネントの概念を紹介する。

  • I'll also show you how to create new source files within the CMake system to create child components.

    また、CMakeシステム内で新しいソースファイルを作成して子コンポーネントを作成する方法も紹介する。

  • And finally, we'll dig a little bit deeper into what happens when you load a plugin and how the editor is actually created in the plugin loading process.

    そして最後に、プラグインをロードするときに何が起こるのか、プラグインのロードプロセスでエディタが実際にどのように作成されるのかについて、もう少し掘り下げてみましょう。

  • As always, I'll also briefly discuss some of the core C++ concepts along the way for those who are just getting started.

    いつものように、これから始める人のために、C++のコアとなる概念についても簡単に説明する。

  • If you're ready to take that deeper dive into audio plugin development, I invite you to check out our books.

    オーディオ・プラグインの開発をより深く掘り下げる準備ができたら、ぜひ私たちの本をチェックしてみてください。

  • The Complete Beginner's Guide to Audio Plugin Development and Creating Synthesizer Plugins with C++ and Juice.

    C++とJuiceを使ったオーディオ・プラグイン開発とシンセサイザー・プラグイン作成の完全初心者ガイド。

  • These are great resources to get started.

    これらは、始めるための素晴らしいリソースだ。

  • All in all, there's about 900 pages on how to start creating your own plugins.

    全部で、独自のプラグインを作り始める方法について約900ページある。

  • I invite you to check them out on theaudioprogrammer.com forward slash books.

    ぜひ、theaudioprogrammer.comのフォワード・スラッシュ・ブックでチェックしてほしい。

  • Link is in the description below.

    リンクは以下の説明にある。

  • This video is also brought to you in part by our sponsor JetBrains.

    このビデオは、スポンサーのJetBrainsのご協力によりお送りしたものです。

  • If you're looking for ways to streamline your development process, I invite you to check out their amazing C-Line IDE.

    開発プロセスを効率化する方法を探しているなら、ぜひ彼らの素晴らしいC-Line IDEをチェックしてほしい。

  • Their tools have helped me to exponentially speed up my workflow and I'm proud to be a supporter.

    彼らのツールは、私のワークフローを飛躍的にスピードアップしてくれた。

  • Be sure to check out more on the link in the description below.

    詳しくは下の説明のリンクで確認してほしい。

  • And with that being said, let's get started.

    ということで、さっそく始めよう。

  • OK, so right now we're in a blank Juice plugin template project.

    さて、今はJuiceプラグイン・テンプレート・プロジェクトの空白の状態です。

  • If you're not sure how to get to this point, be sure to check out our tutorial called CMake vs.

    ここまでの道のりがわからない場合は、CMake vs. CMakeというチュートリアルをぜひご覧ください。

  • ProJuice or FaceOff, which shows you how to start creating a project that will help you get up and running.

    ProJuiceやFaceOffでは、立ち上げに役立つプロジェクトの作り方を紹介している。

  • And as I was saying before, we're going to use CMake for tutorials from here on out.

    先ほども言ったように、ここからはチュートリアルにCMakeを使うことにする。

  • It's the industry standard.

    業界標準だ。

  • And I think that even though it's more difficult to get started, it will definitely help you in the long run.

    そして、始めるのは難しくても、長い目で見れば必ず役に立つと思う。

  • So where we are now is in the Audio Plugin Audio Processor Editor class.

    というわけで、今いる場所はAudio Plugin Audio Processor Editorクラスです。

  • So as we can see, we have four files that are over here on the left hand side.

    見ての通り、左側に4つのファイルがある。

  • Plugin Editor.cppnh and Plugin Processor.cppnh.

    Plugin Editor.cppnhとPlugin Processor.cppnh。

  • Plugin Processor is what we went through last tutorial where we talked about the Audio Processor class.

    Plugin Processorは、前回のチュートリアルでAudio Processorクラスについて説明したものです。

  • And that is where the actual audio processing happens for your plugins.

    そして、そこでプラグインの実際のオーディオ処理が行われる。

  • So not the part that you see, but the actual audio processing.

    つまり、目に見える部分ではなく、実際のオーディオ処理なんだ。

  • The Audio Processor Editor class is what you actually see when you load your plugin.

    Audio Processor Editorクラスは、プラグインをロードしたときに実際に表示されるものです。

  • So if I just go ahead and I compile this here, we can see that this plugin is loaded.

    ここでコンパイルしてみると、プラグインがロードされていることがわかる。

  • We're in standalone mode right now.

    今はスタンドアローンモードだ。

  • And that what we actually see, this is the Audio Processor Editor.

    これがオーディオ・プロセッサー・エディターです。

  • Now, if we dive a little bit deeper into this class, we can see that it inherits from this class called the Audio Processor Editor class.

    さて、このクラスをもう少し掘り下げてみると、Audio Processor Editorクラスというクラスを継承していることがわかります。

  • So what I'm going to do is I'm going to jump into this class now.

    だから、これからこのクラスに飛び込むんだ。

  • And what we'll see is that the Audio Processor Editor class is a juice class.

    そして、オーディオ・プロセッサー・エディター・クラスがジュース・クラスであることがわかるだろう。

  • And this in turn inherits from the component class.

    これはコンポーネント・クラスを継承している。

  • So the component class is essentially any visual element that you have within juice.

    つまり、コンポーネント・クラスとは、基本的にjuice内にあるあらゆるビジュアル・エレメントのことです。

  • So when you load up some type of visual class in juice or you're creating some type of visual element, it will inherit from this component class.

    つまり、juiceで何らかのビジュアル・クラスを読み込んだり、何らかのビジュアル・エレメントを作成したりする場合は、このコンポーネント・クラスを継承することになります。

  • And what I'll do here is I'll actually show you the juice documentation because sometimes it's nice to see it this way as well, which is that we have this Audio Processor Editor class.

    このオーディオ・プロセッサー・エディター・クラスがある。

  • And then this is what's called an inheritance diagram, which shows you where in the hierarchy these classes inherit from.

    そして、これは継承図と呼ばれるもので、クラスがどの階層から継承されているかを示している。

  • So it says here that the juice Audio Processor Editor class inherits from the juice component class.

    つまり、juice Audio Processor Editorクラスはjuiceコンポーネントクラスを継承しているということです。

  • So anything that you can do with a component class, you can do with an Audio Processor Editor class because Audio Processor Editor inherits from component.

    つまり、コンポーネント・クラスでできることはすべて、オーディオ・プロセッサ・エディター・クラスでもできるのです。なぜなら、オーディオ・プロセッサ・エディターはコンポーネントを継承しているからです。

  • OK, so now let's just jump back into the source code here.

    よし、ではここでソースコードに戻ってみよう。

  • Here we have four functions that are in this class.

    このクラスには4つの関数がある。

  • And this is pretty typical for what you would see within any type of component or visual element class.

    これは、コンポーネントやビジュアル・エレメントのクラスで見られる典型的なものです。

  • You would have a constructor and a destructor that are called when the window is created or destroyed.

    コンストラクタとデストラクタがあり、ウィンドウの作成時と破棄時に呼び出される。

  • And you have this paint function, which is more for things that you would do within that component itself.

    そして、このペイント機能は、そのコンポーネント自体の中で行うものだ。

  • So if you wanted to write some text, for example, we have the window currently saying hello world.

    例えば、現在ウィンドウにはhello worldと表示されている。

  • If we wanted to change the color of the background, if we wanted to change the size of the text, we would do that within paint.

    背景の色を変えたければ、文字の大きさを変えたければ、ペイントの中でそれを行う。

  • And then we have this resized function, which is where we would actually lay out any type of other components that we want to sit inside of this Audio Processor Editor.

    そしてこのリサイズ機能で、オーディオ・プロセッサー・エディター内に配置したい他のコンポーネントをレイアウトします。

  • So I'm going to describe that in a little bit more detail here by going to the CPP file, which is the actual implementation of these function calls.

    そこで、これらの関数コールの実際の実装であるCPPファイルを見て、もう少し詳しく説明しよう。

  • So as I said before, first thing that we have is the constructor.

    前にも言ったように、まずコンストラクターがある。

  • And I won't go really into what these are because I don't think that they're relevant so much for getting started.

    そして、これらが何であるかについては、私はあまり関係ないと思うので触れないことにする。

  • But what we see down here is we have this set size, which at the moment is 400 by 300 pixels.

    しかし、ここにあるのは設定されたサイズであり、現時点では400×300ピクセルである。

  • Right.

    そうだね。

  • So if we just go ahead and build that now, we see that this is 400 by 300 pixels.

    では、今すぐ構築してみると、これは400×300ピクセルであることがわかる。

  • And if I wanted to change this, let's say I wanted to change it to a 600 pixel height and then we just rebuild this here, then we will see that now the plugin has got taller.

    そして、これを変更したい場合、例えば高さを600ピクセルに変更したい場合、ここを再構築すれば、プラグインの高さが高くなったことがわかるだろう。

  • Right.

    そうだね。

  • So as I was saying before, for people who are just getting started, the constructor is what's being called when the window is first created.

    だから、さっき言ったように、これから始めようとする人にとって、コンストラクターはウィンドウが最初に作られるときに呼び出されるものだ。

  • And then the destructor is what happens when the when the window is destroyed.

    そしてデストラクターは、ウィンドウが破壊されたときに起こるものだ。

  • Now, one thing that I will say that was a common mistake that I used to think about when I was first getting started and one that I see very often for other people who are getting started is that when when we're in a DAW, let's say we're in Ableton Live or in Reaper, that it's very easy to think that if we close out the plugin, that the plugin window is actually being minimized.

    私がDAWを始めたばかりのころによく考えていたことで、これからDAWを始めようとする人たちにもよく見られる間違いなのですが、例えばAbleton LiveやReaperを使っているときに、プラグインを閉じるとプラグイン・ウィンドウが最小化されると考えがちです。

  • That's how I used to think of it in my mind, because when you pull up the window again, all of the parameters and dials and sliders are all in the same place where you left them.

    再びウインドウを立ち上げると、すべてのパラメーターやダイヤル、スライダーが元の位置にある。

  • Or at least they're supposed to be if the person made the plugin properly.

    少なくとも、プラグインをきちんと作った人ならそうなるはずだ。

  • So because of that, I used to think that this window was actually being minimized.

    そのため、以前はこのウィンドウが実際に最小化されていると思っていた。

  • But one thing one key thing to think about is that the window is actually being destroyed.

    しかし、ひとつ重要なことは、ウィンドウが実際に破壊されているということだ。

  • So it actually does not exist anymore.

    だから、実際にはもう存在しない。

  • You'll learn a little bit more about this as we get a little bit further in the plugin development.

    これについては、プラグイン開発のもう少し先に進むにつれて、少しずつ学んでいくことになるだろう。

  • But one great example of where this mistake is made is when it comes to sliders that are holding some type of value.

    しかし、このような間違いを犯す良い例が、何らかの価値を保持しているスライダーの場合である。

  • So when it's holding that value, it's very important that the value of the slider that is sitting within this plugin window is able to relay what the value of the slider is over to the plugin processor.

    だから、この値を保持するとき、このプラグイン・ウィンドウの中にあるスライダーの値が、プラグイン・プロセッサーに伝わることがとても重要なのです。

  • Because if it doesn't, and you're relying on that value to be there, and the plugin window is destroyed, then it doesn't exist anymore.

    なぜなら、もしそうでなく、その値がそこにあることに依存していたとして、プラグイン・ウィンドウが破壊されたら、その値はもう存在しないからだ。

  • And you're going to be trying to look for a value that does not exist.

    そして、存在しない値を探そうとしている。

  • So once again, that gets a little bit, that's jumping ahead a little bit.

    だから、もう一度言うけど、ちょっと話が飛ぶよ。

  • But it's just something to keep in mind that as you're going through this journey, that when you're creating this window, that when you close it out, it's not minimized.

    ただ、この旅を通して、このウィンドウを作成するときに、それを閉じるときに最小化されないように留意してほしい。

  • It actually does not exist anymore.

    実際にはもう存在しない。

  • Okay.

    オーケー。

  • So jumping down a little bit further, we have this function that's called paint.

    もう少し下に飛ぶと、paintという関数がある。

  • So paint, I would think of as what you actually want to happen within this visual component itself.

    だからペイントは、このビジュアル・コンポーネントの中で実際に起こってほしいことだと考えている。

  • So as we can see, we have this g.fillall, which is filling the background of the component with this green color.

    見ての通り、g.fillallはコンポーネントの背景を緑色で塗りつぶしている。

  • Now, what I could do is I could actually change this color.

    さて、私ができることは、実際にこの色を変えることだ。

  • Let's just go ahead and change it to black.

    そのまま黒に変えよう。

  • And what I can do is, oh, I need to get rid of this bracket.

    そして私にできることは、このブラケットを取り外すことだ。

  • And what I could do is I could recompile this.

    そして私ができることは、これを再コンパイルすることだ。

  • And then what we should see is now the plugin window is black, right?

    そうすると、プラグインのウィンドウが黒くなりますよね?

  • And if I wanted to change this text to red, and I wanted to make it a little bit bigger, I would just do that here.

    このテキストを赤にして、もう少し大きくしたい場合は、ここでそうすればいい。

  • So the size of this text is being set by this g.setfont.

    つまり、このテキストのサイズはこのg.setfontによって設定されている。

  • So if I wanted to change this from 15 to 30, and then if I wanted to change the color from white to red, this is where all of that would happen.

    つまり、これを15から30に変更し、色を白から赤に変更したい場合、ここですべてが行われることになる。

  • So paint, once again, is the place where the things that are actually happening within this component itself are being changed.

    だからペイントは、もう一度言うが、このコンポーネントの中で実際に起こっていることそのものを変える場所なのだ。

  • Now coming down to the resize function, we see that there's nothing that's happening inside of this at the moment.

    さて、リサイズ機能のところまで来てみると、今のところこの内部では何も起こっていないことがわかる。

  • And this brings us to another principle of these component classes, which is that components can hold other components.

    これは、コンポーネントが他のコンポーネントを保持できる、というコンポーネント・クラスのもうひとつの原則につながる。

  • So when I say component, think a window, like a visual window.

    だから、コンポーネントと言うときは、視覚的な窓のようなものを思い浮かべてほしい。

  • And these components can have other components inside of them.

    そして、これらのコンポーネントは、その内部に他のコンポーネントを持つことができる。

  • And the way that you would lay those out is typically in this resized function.

    そして、それらをレイアウトする方法は、通常、このリサイズ機能の中にある。

  • Okay, so what we're going to do now is we're going to create our own component class.

    さて、ではこれから独自のコンポーネント・クラスを作成しよう。

  • And we're going to include it as a child within this plugin editor class that we have here.

    このプラグイン・エディター・クラスの子クラスとして、このプラグインを組み込みます。

  • Okay, so if that sounds like a daunting task, don't worry, I'm going to take you step by step.

    さて、それが大変な作業に聞こえるかもしれないが、心配はいらない。

  • And I feel confident that if you follow along, that you're going to come out successfully on the other side.

    そして、もしあなたがついてきてくれるなら、反対側で成功すると確信している。

  • So let's go ahead and get started.

    では、さっそく始めよう。

  • First thing that we're going to need to do if we want to create a component class is we're going to need to create some source files.

    コンポーネント・クラスを作成する場合、最初に必要なことは、いくつかのソース・ファイルを作成することだ。

  • So the way that we're going to do that is we're going to go over here to our source folder over here in our Explorer.

    そこで、エクスプローラーでソース・フォルダーに移動します。

  • We're going to right click and create a new C++ class.

    右クリックして新しいC++クラスを作成する。

  • So this is how you would do it in SceneLion.

    これがSceneLionでのやり方だ。

  • If you were working in Xcode or Visual Studio, it essentially be a similar type of command.

    XcodeやVisual Studioで作業していた場合、基本的には同じようなタイプのコマンドになる。

  • So now I'm going to go ahead and create this.

    では、これからこれを作成します。

  • And I will just call this, let's just call it square.

    これを正方形と呼ぶことにしよう。

  • And I will create a .cpp and .header file for this new class that we're calling square.

    そして、squareと呼ぶこの新しいクラスの.cppと.headerファイルを作成する。

  • And I'm going to hit OK.

    そしてOKを押す。

  • And now we've created those new source files.

    これで新しいソース・ファイルができた。

  • I'm just going to hit add.

    私はただ追加を押すだけだ。

  • And now we have some new source files.

    そして今、新しいソースファイルがいくつかある。

  • And what I'm going to do is I'm just going to get rid of everything just so it's blank.

    そして、これからすることは、すべてを取り除いて真っ白にすることだ。

  • And we'll start from complete scratch.

    そして、完全にゼロから始める。

  • The next thing that we need to do is we need to now include this within our CMake file.

    次に必要なのは、CMakeファイルにこれをインクルードすることだ。

  • So the reason that we need to do this is if we look at our current CMake file, we can see here that the source files that we've included so far are plug-in editor.cppnh and plug-in processor.cppnh.

    現在のCMakeファイルを見ると、プラグイン・エディターとプラグイン・プロセッサーが含まれていることがわかる。

  • And so it doesn't know at the moment that square.cppnh are supposed to be part of our build system, part of the files that we want to use and include in our project.

    そのため、square.cppnhがビルド・システムの一部であり、プロジェクトで使用したりインクルードしたりするファイルの一部であることを、現時点では知らない。

  • So just to show you here, if I go into the source folder and just open it up in the finder, here we are in our project.

    ソース・フォルダーに入ってファインダーで開くと、プロジェクトがここにある。

  • You see cmakelist.txt here.

    cmakelist.txtはこちら。

  • And there's the source folder.

    そしてこれがソース・フォルダーだ。

  • I'm just going to double-click in there.

    そこでダブルクリックするだけだ。

  • And there we see our class, all of our source files, in fact, square.cppnh and all of our other ones.

    そして、クラスとすべてのソース・ファイル、実際、square.cppnhと他のすべてのソース・ファイルを見ることができる。

  • Now, what we need to do is we need to include this in our CMake file.

    さて、ここで必要なのは、CMakeファイルにこれをインクルードすることだ。

  • Now, the reason that you need to say source slash dot plug-in editor and slash square dot h and cpp is because the declaration that you're making inside the CMake file needs to be relative to where the cmakelist.txt resides.

    ここで、sourceスラッシュドットプラグインエディタとスラッシュスクエアドットhとcppと言う必要があるのは、CMakeファイル内で行っている宣言がcmakelist.txtのある場所からの相対的なものである必要があるからです。

  • So here we are in our project.

    というわけで、私たちのプロジェクトはここまで来た。

  • We see that we have this cmakelist.txt, and then we have this source folder.

    cmakelist.txtがあり、sourceフォルダがある。

  • So we need to say relative to the cmakelist.txt file, we're going into source and into these files.

    つまり、cmakelist.txtファイルからの相対パスで、ソースとこれらのファイルに移動する必要がある。

  • If we had another folder that we just, let's say we called it code, for instance, and we put these files in here, then in our cmakelist.txt, it would need to say source slash code slash whatever your source file is.

    例えば、codeと呼ぶ別のフォルダがあって、ここにこれらのファイルを置くとすると、cmakelist.txtには、ソース・スラッシュ・コード・スラッシュ(ソース・ファイルが何であれ)と書く必要がある。

  • So that's the reason why the convention is being named this way.

    だから、このような大会名になっているのだ。

  • Okay, so now we're going to put our square class files in here.

    それでは、正方形のクラス・ファイルをここに置くことにしよう。

  • So we've got square.cpp, source, square.h.

    square.cpp、source、square.hがある。

  • And now those are included.

    そして今、それらは含まれている。

  • Now, if you're in Visual Studio or in Xcode, what you're going to need to do to update your CMake build is you're going to need to invoke CMake, which is that normal command that you normally do, which is cmake-bbuilds-gxcode or whatever your command is, right?

    さて、Visual StudioやXcodeを使用している場合、CMakeビルドを更新するために必要なことは、CMakeを起動することです。CMakeは、通常行うコマンドで、cmake-bbuilds-gxcodeでも何でも構いません。

  • If you're here in SceneLine, it actually has CMake integrated into the IDE, and I can just hit this little reload CMake project, and it'll actually run CMake here inside the IDE.

    SceneLineのIDEにはCMakeが統合されていて、CMakeプロジェクトのリロードを実行すると、IDE内でCMakeが実行されます。

  • So that's one of the things I really love about CMake here in SceneLine.

    これがSceneLineのCMakeが本当に好きなところなんだ。

  • So there we go.

    そうだ。

  • So that's run, and now we're all good to go.

    これでもう大丈夫だ。

  • So now we have this square.h source file, and we're going to build this from scratch.

    これでsquare.hソース・ファイルができたので、これをゼロからビルドしていこう。

  • So the first thing that we're going to do is we're going to declare pragma once.

    そこでまず最初に、プラグマを一度宣言する。

  • The reason that we do this is because what we need to do is we're going to need to include some other source files to be able to give this class that we're creating some functionality.

    なぜこんなことをするかというと、これから作成するクラスに機能を持たせるために、他のソース・ファイルをインクルードする必要があるからだ。

  • So right now this source file knows nothing about Guice.

    だから今、このソースファイルはガイスについて何も知らない。

  • It knows nothing about anything except for basic C++, and what we're going to need to do is include a graphics library from Guice in order to be able to inherit the component class, which allows us to create the window, okay?

    基本的なC++以外は何も知らない。これから必要なのは、ウィンドウを作成するコンポーネント・クラスを継承するために、Guiceのグラフィック・ライブラリをインクルードすることだ。

  • If we had another class that was using another include that was using the graphics library, and we included it, what pragma once does is it creates us from having name collisions where you're including source files more than one time.

    グラフィックス・ライブラリを使う別のクラスをインクルードし、それをインクルードした場合、プラグマ・ワンスは、ソース・ファイルを複数回インクルードすることによる名前の衝突を防いでくれる。

  • So it says, okay, he's already included the Guice graphics library, so we don't need to include that again.

    つまり、ギース・グラフィック・ライブラリはすでに含まれているから、もう入れる必要はない、ということだ。

  • So that's what pragma once is for.

    そのためのプラグマ・ワンスなのだ。

  • So the first thing that we'll do is we'll just create this basic class.

    まず最初に、この基本クラスを作成します。

  • The way we do this is called class.

    この方法をクラスと呼ぶ。

  • I'm just going to call this square, and now I've created my class, okay?

    この四角を四角と呼ぶことにして、これでクラスができた。

  • Now square does not have any functionality right now, so it doesn't know anything about being a Guice component, doesn't know anything about Guice, doesn't know anything about anything except for basic C++.

    今のsquareは何の機能も持っていないので、Guiceコンポーネントであることも、Guiceのことも、基本的なC++以外のことも何も知らない。

  • In order for us to be able to give square the functionality that it needs, we need to be able to inherit from the Guice component class, okay?

    squareに必要な機能を持たせるためには、Guiceコンポーネント・クラスを継承する必要があるんだ。

  • So the way that we do that is that if we look to our Guice documentation, you'll see that we want to inherit this component class to give it the functionality where it can draw a window within our project.

    Guiceのドキュメントを見ると、このコンポーネント・クラスを継承して、プロジェクト内でウィンドウを描画する機能を持たせることができる。

  • Now, Guice is a collection of libraries.

    さて、ガイスは図書館の集合体である。

  • So you have DSP libraries, you have graphics libraries, you have all of these different libraries that you can use.

    DSPライブラリもあれば、グラフィック・ライブラリもある。

  • The way that you can find out what library that you need to include is here in the Guice documentation.

    どのライブラリをインクルードする必要があるかは、Guiceのドキュメントで確認できる。

  • If you look below this Guice component class reference, it'll normally have the name of the library that you need to include right here, which in this case is Guice underscore GUI underscore basics.

    このGuiceコンポーネント・クラス・リファレンスの下を見ると、通常はここにインクルードする必要があるライブラリの名前が書かれています。

  • So the way that you would do this is here we go below the pragma once.

    つまり、プラグマの下に一度だけ入るのだ。

  • And what I will do is I'll do a hashtag include.

    そして、ハッシュタグをつける。

  • And I'm actually going to get rid of the quotes because one thing that I learned is that for library includes, you actually use angle brackets rather than quotes for those.

    というのも、ライブラリーのインクルードには、引用符ではなく角括弧を使うということを学んだからだ。

  • So now what I can do is I can use Guice GUI basics.

    だから今できることは、Guice GUIの基本を使うことだ。

  • And so that leads us to the folder that it's in.

    それで、そのフォルダの中に入っている。

  • And then Guice GUI basics dot H.

    そしてGuice GUIの基本ドットH。

  • OK, so now what we can do is we can we can now invoke anything that's within this Guice GUI basics library.

    よし、これでGuice GUIベーシック・ライブラリの中にあるものなら何でも呼び出せるようになった。

  • OK, there's another way that you can that you can do this.

    よし、もうひとつ方法がある。

  • That's where you can say include Guice header dot H and that will give you access to all of the Guice library code.

    そこでinclude Guice header dot Hと言えば、Guiceライブラリーのコードすべてにアクセスできるようになる。

  • But I would say that this is the more correct and more optimized way to do this.

    しかし、私はこの方法がより正しく、より最適化された方法であると言いたい。

  • OK, so now what we can do is we can inherit Guice component.

    よし、では次にできることは、Guiceコンポーネントを継承することだ。

  • So the way that we do this is we just put a little colon here and we need to declare it as public or private first.

    つまり、コロンで区切って、最初にpublicかprivateかを宣言するのだ。

  • So we want this to be a public class.

    だから、これはパブリック・クラスにしたい。

  • And then we got Guice colon colon component.

    そしてガイスがコロンコロンになった。

  • OK, so now we've inherited the Guice component class.

    さて、これでGuiceコンポーネント・クラスを継承したことになる。

  • So now what we can do is we can call upon in this class anything that that a Guice component is able to do.

    つまり、グアイス・コンポーネントができることはすべて、このクラスで呼び出せるということだ。

  • OK, so a lot of the next functionality that we're going to need is going to be very similar to what we've done with the plugin editor.

    次に必要な機能の多くは、プラグイン・エディターで行ったこととよく似ている。

  • OK, so here in the plugin editor we have four functions which are the constructor, the destructor, paint and resized.

    プラグイン・エディターには、コンストラクター、デストラクター、ペイント、リサイズの4つの関数がある。

  • To keep things super simple, I'm going to just do paint and resize.

    超シンプルにするために、ペイントとリサイズをするだけだ。

  • And what I'll do is I'll just literally copy here from this audio processor editor.

    このオーディオ・プロセッサー・エディターから、文字通りここにコピーします。

  • And I'm just going to paste it in square.h.

    これをsquare.hに貼り付ける。

  • The reason that I'm not worrying about including the constructor or the destructor is because we don't need to do anything with that in this tutorial.

    コンストラクタやデストラクタを含めないのは、このチュートリアルでは何もする必要がないからだ。

  • So I'm not going to complicate it for you.

    だから、私はあなたのためにそれを複雑にするつもりはない。

  • So now what I'm going to do is I'm going to go here into this class square.

    では、このクラスの正方形の中に入ってみよう。

  • And these need to be public functions that we can publicly access.

    そして、これらは公にアクセスできるパブリックな機能である必要がある。

  • And I'm just going to go ahead and paste those in like so.

    そして、それをこのように貼り付けていくんだ。

  • OK, because we want very similar functionality to what we have with our with our plugin editor class, which is also a Guice component.

    よし、プラグイン・エディター・クラスとよく似た機能が欲しいわけだ。

  • So we're going to want to just to review going back to plugineditor.cpp.

    plugineditor.cppに戻って復習しておこう。

  • In this in this situation, we're going to want to just give our component some color.

    この状況では、コンポーネントに色をつけたい。

  • So fill the the rectangle with a color and maybe do some writing.

    だから、長方形を色で塗りつぶして、何か書こう。

  • And that's it.

    それで終わりだ。

  • In fact, we probably don't need resized for to put in this square class, but I'll just do it just for just just to show you how to do it.

    実際には、この正方形のクラスに入れるためにリサイズする必要はないだろうが、やり方を紹介するためにやっておこう。

  • So the next thing that we need to do is we need.

    そこで次に必要なことは、私たちが必要としていることだ。

  • So now we've declared these functions.

    これで、これらの関数を宣言したことになる。

  • What we need to do is we need to provide implementations for these functions.

    必要なのは、これらの機能の実装を提供することだ。

  • So the way that we do this is go over to square.cpp.

    そこで、square.cppにアクセスする。

  • Make sure that you have hashtag include square.h there or else it won't know what you're talking about.

    ハッシュタグにsquare.hが含まれていることを確認してください。

  • And what I'm going to do is I'm just going to paste.

    これからすることは、ただ貼り付けるだけだ。

  • I'm just going to paste these in there.

    これを貼り付けるよ。

  • And just to go back to square.h for for a second, just to reiterate, we are doing the override keyword for for paint and for resize because those are functions that are created from Guice component.

    ちょっとsquare.hに戻りますが、もう一度言いますが、paintとresizeはGuiceコンポーネントから作成された関数なので、オーバーライドキーワードを使っています。

  • So we have if we look at paint.

    ペンキを見ればわかる。

  • We can see that that's a virtual function.

    これが仮想関数であることがわかる。

  • So the reason that we wanted that we want to include this is because we want to be able to to paint our component a certain color.

    つまり、コンポーネントを特定の色に塗ることができるようにしたいからだ。

  • And in order to do that, we need to include the paint functionality, which is happening through this function.

    そのためには、ペイント機能を組み込む必要がある。

  • So that's the reason why this is happening.

    だからこうなっているんだ。

  • So now to implement these functions, I'm going to just put some angle brackets here.

    では、これらの関数を実装するために、ここに角括弧を付けよう。

  • Curly brackets, as they call them.

    カーリーブラケットと呼ばれるものだ。

  • Now, there's one more thing that we need to do, and this is just something I'm once again reiterating for people who are just getting started, which is that.

    さて、もうひとつ必要なことがある。これは、これから始めようとしている人たちのためにもう一度言っておくことだが、それはこうだ。

  • If you have a lot of paint functions, if you have a lot of components, then then when your code is compiling, it doesn't know which paint you're referring to when when you're trying to call this particular paint.

    たくさんのペイント関数があり、たくさんのコンポーネントがある場合、コードがコンパイルされるときに、この特定のペイントを呼び出そうとしているときに、どのペイントを参照しているのかわからなくなってしまう。

  • OK, because we don't have what's called a qualified class name in front of it.

    修飾クラス名と呼ばれるものが前にないからだ。

  • So because we want to call the paint function that's specific to square, what we want to do is we want to do this.

    そこで、正方形に特化したペイント関数を呼び出したいので、こうしたい。

  • Which is we're saying that we want to call these the paint function, but the paint function that is specific to the class square.

    つまり、ペイント関数を呼び出したいと言っているのだが、これは正方形クラスに固有のペイント関数である。

  • OK, so that's once again, just kind of basics of C++, but but stuff that stuff that is essential to know.

    さて、これでもう一度、C++の基本的なことを説明した。

  • And so I did that for resized as well.

    それでリサイズもそうした。

  • Now from here, now we have a component class.

    さて、ここからはコンポーネント・クラスだ。

  • OK, now we just need to give it a little bit of functionality.

    よし、あとはちょっとした機能を持たせるだけだ。

  • And the way that we'll do this, once again, I'll just go over here to the plugin editor that CPP.

    もう一度、CPPのプラグイン・エディターを見てみよう。

  • And, you know, if you don't if you don't have these these calls memorized, you know, all you need to do is just copy it from something that works and just pop it in there and change a few things.

    そして、もしこれらのコールを暗記していないのなら、必要なのは、うまくいっているものからコピーして、それをそこに入れ、少し変えるだけだ。

  • OK, so that's a great way to get started.

    よし、それなら始められる。

  • So first thing that we see is that we are getting an error here on this G.

    まず最初に、このGでエラーが発生していることがわかる。

  • It doesn't know what G is, and that's because it just says juice graphics ampersand and it doesn't have a doesn't have a variable name there.

    Gが何なのかわからない。それは、juice graphics ampersandと書いてあるだけで、変数名がないからだ。

  • So I just need to pop that G in there for it to know what what the graphics object is or just to be able to refer to that.

    だから、グラフィック・オブジェクトが何であるか、あるいはそれを参照できるようにするために、そこにGを入れる必要がある。

  • Now, what I'm going to do is I can just change a few things around.

    さて、これからやることは、少し変更するだけだ。

  • OK, so if I'm going to change the background color, I can change it here.

    背景色を変えるなら、ここで変えられる。

  • Let's just change it to orange.

    オレンジ色に変えよう

  • And then we'll set the color of the of the font to white.

    そして、フォントの色を白に設定する。

  • I'm just going to make it a little bit smaller.

    ただ、もう少し小さくするつもりだ。

  • And then.

    そして

  • I will just.

    私はただそうする。

  • Say here the audio programmer.

    ここでオーディオ・プログラマーと言う。

  • So there we go.

    そうだ。

  • So I've just changed a couple of things around, repurpose some code that I found in a component class that already works.

    だから、すでに機能しているコンポーネント・クラスで見つけたコードを再利用して、いくつか変更しただけだ。

  • And so now we have a component class that we've just created.

    そして今、コンポーネント・クラスを作成した。

  • So congratulations, you have your very first component class.

    おめでとうございます。

  • So now if we build, we just want to make sure that this code is working OK so far.

    では、ビルドするとして、このコードが今のところ問題なく動作していることを確認したい。

  • And we can see that we don't see anything else.

    そして、他には何も見えないことがわかる。

  • We don't see this window that we've just created.

    せっかく作ったウィンドウが見えない。

  • The reason that we don't see it is because we haven't actually included it as a child to this to to our main window.

    このウィンドウが見えないのは、メイン・ウィンドウの子ウィンドウにしていないからだ。

  • So the way that we need to do this is we need to go back and we need to go into our plug in our plug in editor class.

    そこで、プラグイン・エディター・クラスに戻り、プラグインを作成する必要がある。

  • And now what we need to do is we need to include square dot H.

    そして次に必要なのは、四角いドットHを入れることだ。

  • OK, because that's that's the component that we've just created.

    よし、これが今作ったコンポーネントだ。

  • So here I'm going to do a include.

    だから、ここではインクルードをするつもりだ。

  • Square dot H.

    正方形のドットH。

  • So now I have said that I want to bring in this code from square H and be able to do something with it.

    だから今、私はスクエアHからこのコードを持ってきて、何かできるようにしたいと言った。

  • And now what I want to do.

    そして今、私がしたいこと。

  • Is I want to create a square object.

    正方形のオブジェクトを作りたい。

  • I want to create a square component.

    正方形のコンポーネントを作りたい。

  • I'm just going to call this square.

    私はこれを正方形と呼ぶことにする。

  • And now I've created an object within our editor.

    そして、エディター内にオブジェクトを作成した。

  • And now what I'm going to do is go to the CPP file.

    これからCPPファイルを開きます。

  • I'm going to go up here to the constructor and they have this special function that is specific to the component class called add and make visible.

    このコンストラクタには、addとmake visibleというコンポーネント・クラス特有の関数がある。

  • Now what this does, if we go back to our documentation.

    さて、これで何ができるかというと、ドキュメントに戻ってみよう。

  • And if I can get to it quickly.

    そして、もし私がすぐにそれを手に入れることができれば。

  • So it says adds a child component to this one and makes the child visible if it isn't already.

    つまり、このコンポーネントに子コンポーネントを追加し、まだ子コンポーネントが表示されていなければ、その子コンポーネントを表示させるということだ。

  • OK, so so that's what that's doing.

    なるほど、そういうことなのか。

  • So remember that concept earlier that I was explaining about parent and child components.

    先ほど説明した親と子のコンポーネントの概念を思い出してほしい。

  • What we're doing is we're making square a child component of audio plug in audio processor editor.

    私たちがやっているのは、squareをオーディオ・プロセッサ・エディタのオーディオ・プラグインの子コンポーネントにすることです。

  • So we're saying we want we want square to be a window that's inside this other window that we've that was already created for us.

    つまり、正方形が、すでに作成されている別のウィンドウの内側にあるウィンドウにしたい、ということだ。

  • Our main plug in window.

    メインのプラグインウィンドウ。

  • The last thing that we need to do is we need to actually put it on the screen and say where we want it to be on the screen.

    最後に必要なのは、実際にスクリーンに映し出し、スクリーンのどこに映し出したいかを言うことだ。

  • And we do that in this resized function.

    そして、このリサイズ機能でそれを行う。

  • And the way that we do that is we would say square.

    その方法は、正方形と言うんだ。

  • And then there are many different ways to do this.

    そして、これにはさまざまな方法がある。

  • Many, many different ways to do this.

    いろいろなやり方がある。

  • The easiest is using this set bounds function here.

    一番簡単なのは、このセット・バウンズ関数を使うことだ。

  • And so if we go back to the documentation again.

    それで、もう一度ドキュメントに戻ってみよう。

  • If we go to set bounds.

    境界線を設定しに行くなら

  • We'll see we'll see that there are a lot of different ways that you can that you can actually set bounds.

    境界線を設定するには、さまざまな方法があることがわかるだろう。

  • The way that we're going to use in this instance is just using an X a Y giving it a width and giving it a height in pixels.

    この例で使う方法は、XとYを使って幅と高さをピクセル単位で指定するだけだ。

  • So we're just saying where we where we want to set it on the X axis.

    つまり、X軸のどこに設定したいかを言っているだけだ。

  • Set it where we want to set it on the Y axis and how wide and how tall we want it to be.

    Y軸のどこに設定するか、幅と高さを設定する。

  • Just a note that component classes are rectangles and that the X and Y position will be relative to the top left of the rectangle.

    コンポーネント・クラスは矩形であり、XとYの位置は矩形の左上からの相対値であることに注意してほしい。

  • OK.

    OKだ。

  • So not to the center but to the top left.

    だから中央ではなく、左上だ。

  • So just a little thing to keep in mind there.

    だから、ちょっと覚えておいてほしいことがある。

  • So we're going to give it an X position.

    だから、Xのポジションを与える。

  • Just make it 100. 100.

    100にすればいい。100.

  • And then I'll give it a width.

    そして、幅を持たせる。

  • Let's say that it's 200 by 200.

    200×200としよう。

  • And now we're going to go ahead and build it.

    そして、これからそれを作っていく。

  • And if everything works properly we should see a square within another square.

    すべてがうまくいけば、正方形の中に正方形が見えるはずだ。

  • There we go.

    これでよし。

  • So now we have created a child component that's within this larger component here.

    これで、この大きなコンポーネントの中に子コンポーネントができたことになる。

  • And as you can see it says the audio programmer inside of it.

    ご覧のように、オーディオ・プログラマーと書かれています。

  • The background is orange.

    背景はオレンジ色。

  • Now if I wanted to change the width and the height of this I could do this very easily just by just by doing this and just refreshing again.

    もしこの幅と高さを変更したい場合は、こうしてもう一度リフレッシュするだけで、とても簡単にできる。

  • And here we go.

    そして、これだ。

  • And now it's smaller.

    そして今は小さくなった。

  • So that's essentially how you start how you get started with the juice component class and including that in the juice audio processor editor.

    これが、juiceコンポーネントクラスを使って、それをjuiceオーディオ・プロセッサ・エディタに組み込む方法です。

  • Now the final thing that I'll show you is diving a little bit deeper into how the plug-in actually gets created.

    さて、最後にご紹介するのは、プラグインが実際にどのように作成されるかをもう少し掘り下げてみることです。

  • So for people who want to really understand how does this process actually get started.

    だから、このプロセスが実際にどのように始まるのかを本当に理解したい人のために。

  • What we can do is we can go back to our plug-in processor dot CPP.

    プラグイン・プロセッサーのドットCPPに戻ろう。

  • And there's actually a function in here called create editor.

    実はこの中に、create editorという機能がある。

  • And what you're going to see is that this is that it creates a new audio plug-in audio processor editor which is what the name of this class is.

    そして、これから見ていただくのは、このクラスが新しいオーディオ・プラグイン・オーディオ・プロセッサー・エディターを作成するということです。

  • Right.

    そうだね。

  • So that's that's where that's where this actually gets created.

    だから、これが実際に作られる場所なんだ。

  • So if you look at the juice plug-in process in terms of how that actually what actually starts creating where where things start and what things get created and in what order.

    だから、ジュースのプラグイン・プロセスを、どこで何が始まり、どのようなものがどのような順序で作られるのか、という観点から見てみるといい。

  • You'll see here that the audio processor gets created first and then it creates a new audio processor editor.

    オーディオプロセッサーが最初に作成され、次に新しいオーディオプロセッサーエディターが作成されることがわかります。

  • And that's and that's what that's what you see here.

    それがここにあるものだ。

  • So if you didn't want it to have a plug-in window you could just you could just return it false.

    プラグイン・ウィンドウを表示させたくない場合は、falseを返せばいい。

  • But that just shows you that it's the audio processor that starts.

    でもそれは、オーディオプロセッサーがスタートすることを示しているんだ。

  • So it's the background audio processing that starts first and then it creates the visual aspect and does the connection points of that.

    つまり、バックグラウンドのオーディオ処理が最初に始まり、それからビジュアル面を作り、その接続点を行う。

  • So I hope that this was educational for you and that that you found it helpful.

    だから、これがあなたにとって勉強になり、役に立ったことを願っている。

  • One thing that I should mention is that this is one of a number of ways that user interfaces can now be created using juice.

    ひとつ言っておかなければならないのは、これはjuiceを使ってユーザー・インターフェースを作ることができるようになったいくつかの方法のひとつだということだ。

  • I think that this is the easiest way to get started.

    これが一番簡単な方法だと思う。

  • But once you get a little bit more advanced there are actually ways that you can create user interfaces using JavaScript as well.

    しかし、もう少し上級になれば、JavaScriptを使ってユーザー・インターフェースを作成する方法もある。

  • But that's a little bit more complex to set up and get running.

    しかし、セットアップと実行はもう少し複雑だ。

  • But we'll go through that a little bit later.

    でも、それは後で少し説明しよう。

  • So I hope you enjoy this.

    だから、楽しんでほしい。

  • If you liked it, please give it a like and subscribe to our channel and I will see you next time.

    もし気に入っていただけたら、「いいね!」とチャンネル登録をお願いします。

  • Happy coding.

    ハッピーなコーディングだ。

Hey, what's up everybody?

やあ、みんな元気かい?

字幕と単語
AI 自動生成字幕

ワンタップで英和辞典検索 単語をクリックすると、意味が表示されます

A2 初級 日本語

JUCEチュートリアル03 - Componentクラスを使ってグラフィックスを始めよう! (JUCE Tutorial 03 - Get Started with Graphics using the Component class!)

  • 5 0
    zack に公開 2025 年 03 月 21 日
動画の中の単語