CS 686 PROJECT 2 Due Date: 7pm Thursday 13 Oct 2005 This project acquaints students with the handling of mouse-events in a graphics application, and with synchronization of some sound-effects as responses when a user presses or releases a mouse-button while the cursor is over various regions-of-interest on the display-screen. PROJECT STATEMENT Your job is to complete the design of a application named 'tunetool' which displays the 64-keys of a spinet piano and generates a musical tone for each key when that key is selected by the user with the mouse-button. Only one note should be played at a time, and its sound should persist as long as the user continues to hold down the mouse-button while the cursor remains above that key's screen-image. You may use the source-code which is distributed as 'pcspinet.cpp' as your starting-point for this project. Several of our past and future classroom-demo programs will offer further technical information and programming techniques that may be useful. For example, the '12throot.cpp' program will provide the pitch (frequency) of any keyboard tone, and the 'sinewave.cpp' program shows you how to play a tone of a specified frequency using the PC's soundcard. Our future demos will show you how to draw and move a mouse-cursor of your own design with Linux's 'libgpm' General Purpose Mouse function-library ('seemouse.cpp'), and how to incorporate 'signal-handling' and 'asynchronous notifications' into an animated graphics application ('animate2.cpp'). But a few issues will arise which you will need to resolve using just your own ingenuity! IDEAS FOR EXTRA CREDIT Can you adjust the sound of your keyboard's notes so that they sound more like a real piano's notes, rather than pure square-wave or sine-wave tones? Can you add, as an extra 'tunetool' feature, the display of a note's name on the screen (e.g., B, C#, etc.) while it is being played? Or show the note's placement on the musical staff? Can you add a feature that allows the user to supply a time-duration for each note and that writes each note and its time-duration into a file that can be 'played back' as a tune? WHAT TO SUBMIT Copy your program source-files (including your header-files) to your CS 686 '/submit' directory, along with your compiled 'executables'. This will enable the Instructor to perform testing of your program-code. Also turn in to the Instructor's mailbox (in HRN-208) a paper printout of each source-file you authored. This will enable the instructor to easily read your code and add handwritten comments that can be returned to you. Turn in printout of 'tunetool.cpp' (for basic project-requirements) NOTE: Please use our 'ljpages.cpp' utility to print your source files! _________________________________________________________________________ Allan B. Cruse University of San Francisco Fall 2005