The C language is old.
It's about input and output and fairly basic,
even low-level programming concepts.
Libraries can extend the C language's capabilities,
but for some tasks, it just falls short.
To put it another way,
if I were given an assignment
to create a Theramin-like program,
I'd probably write it in Java, not C.
I wasn't provided that latitude for this assignment.
Many operating systems have routines or interfaces
for accessing the mouse and speaker.
Back in the 1980's, I programmed DOS and C
and easily used the mouse.
I could also access the speaker hardware directly.
In the spirit of this course, however,
I felt it was best to attempt a universal solution.
One that would run in a variety of environments.
My solution is Theremin.
A program that uses the
port audio library to render sound,
and the Ncurses library to read the mouse
and access the screen for interactive
full display output.
The resulting programming can run in a
Cygwin window on a PC.
Or in iTerm on the Mac
I've not been able to use the terminal program,
in OS10, to read the mouse,
although it might work on your system
As per the assignment,
you click the mouse and a tone is generated.
(buzzing tone)
Because of programming limitations,
the tone is start-stop.
I'll explain why in a later movie.
(different pitched buzzing tones)
Graphic feedback is provided by two color bars,
red and blue.
Left and right are loud and soft,
up and down, set the tone.
While this isn't a true Theramin,
and it doesn't follow the course's request
that the tone be generated on a mouse down event,
It does demonstrate a basic tonal volume output
via mouse input.
That's an accomplishment many people might assume
is impossible without writing
operating system specific code.