Oh, whats up, guys?
So we will be going through this terminal to see what's inside the code.
So we all just start off with VIM and Volume Unit Meter and this code
is written in C. So as we in mentioned in earlier videos,
before we go into that,
we want to stress that this is a 96Boards example code.
And you guys need to know that this wasn't written by us,
this was written by 96Boards themselves,
and this is provided on their Github.
Yeah.
So here we we want to start off with some standard library codes and
C and C++ code that might have been written by other people or
by C and C++ Standard Library people,
and we want to stress that these libraries may have some complicated stuff in them.
So if you guys want to learn about more,
you guys should use your favorite search engine to search about them.
It'll should pop up once you like just search full name of the file.
So the next line we want to go are alsa,
and alsa is a sound library and this is commonly used to process out.
So if you guys want to learn about this more as well,
just search it yourselves.
And then we have the buffer size.
And buffer size is essentially taking in input and setting a size to it so
you don't want to take in too much too big of
a size because it will make the signal very slow,
so we want to set this buffer size.
And then we have static int running and
this is basically saying that oh this program is running.
This is important for a loop because we want the loop to
always be running while the program is running.
We will go over this in the near future.
A very new feature, so
the next two functions that we want to talk about is sig_hadler and get_rms.
So sig_handler just handles if you did
Control C to exit the program it starts running to 0.
So as see down later on,
you'll see a while loop that depends on running,
and if it's not one anymore,
it will stop the while loop and then exit out of the program.
The next part is get_rms.
What this stands for is just root mean squared.
It's just a wrapper method, not method,
a function to calculate the root mean square given the input.
So here we have print_progress and this is
basically what you see on the terminal once you're on it, this the bar.
And what it uses is printf and printf is
the C's way of printing to standard out or printing to the terminal,
as you can maybe see once you're on the program,
and that's basically what it does.
Go onto the main method.
Yes, so this first part is just a bunch of
variable declarations just set up so we can do stuff in the future.
The next part is just the printf the introduction,
printf Unit Volume Meter's introduction to the program when you first run
it and also handling if there's any arguments.
So I'll move onto later parts of the code.
So here we have a lot of the handling of the arguments and the error handling.
This is more complex C code where a lot of experience
C programmers will use error handling and then
print stuff out to the terminal to tell you guys that you guys did something wrong.
We scroll down and then we see a little bit more of the error handling.
This is basically taking input and setting
the parameters so and as the right size or frames or whatever you guys need.
And this is important because you don't want it to be too big or whatever
formatting is necessary for future parts of the code.
So this is some more error handling.
It just tries to configure the driver,
and then if it doesn't work, tells you what's wrong.
And the next part is
the signal if you want to do the control C to exit out of the program.
So this is the part where it actually takes in
the signal and processes it and then prints out the progress on the terminal.
This is all the part that
takes in all the functions that they created and actually calls them.
And the last part is just closing everything
and giving that final return statement to the OS to tell it's done.
We'll be talking about future projects after this so stay tuned.