Learn how the code uses the ncurses library to build a full-screen, text-mode application. See how the program loops and waits for a mouse click; based on the click's location, a specific sound wave is generated; and text-mode graphics provide feedback based on the mouse click, which sets volume and frequency.
- [Narrator] The ncurses library…has been around a long time.…It allows you to program full screen and real time…keyboard interaction in the Unix terminal environment…which includes the Cygwin shell for Windows.…Many full screen terminal programs…including the popular vi editor…are written by using ncurses.…In the spirit of text-only C,…I chose ncurses as my Theremin program's interface.…You can obtain the ncurses library from invisibleisland.net.…The main function in my Theremin C code…initializes the ncurses screen,…color output, and other settings.…
The screen size is calculated…as are increments for the frequency,…so this code works no matter how large…the terminal window is.…An endless while loop monitors input.…When the enter key is pressed, the loop breaks.…Otherwise, the mouse location is read.…The tone function generates a sine wave for port audio.…The frequency is calculated based on…the mouse's vertical position or mort.y.…The horizontal position, mort.x,…sets the volume, or more correctly, the amplitude.…
Skill Level Intermediate
1. Summarize the Weather
2. Geolocation with C
3. Eight Queens with C
4. Build a Musical Instrument with C
5. Face Recognition with C
6. Web Dashboards with C
Next steps1m 2s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.