CSCI 1300
Introduction to Computer Science
Homework 8 and 9: Animated Music Player

Due Date

Part One (Homework 8) of this assignment must be submitted by 9pm on Friday, November 11. Late work is accepted until 10am on the following Monday with a 10-point late penalty. Also, twice during the semester you may submit a very late homework by the following Wednesday with a 13-point late penalty. Part Two (Homework 9) must be submitted by 9pm on Friday, November 18. Late work is accepted until 10am on the following Monday with a 10-point late penalty. Also, twice during the semester you may submit a very late homework by the following Wednesday with a 13-point late penalty.

Working Alone

You may talk with other students and instructors about the assignments, and you may help each other in any way to create your initial photos for use in this assignment. But you may not look at or copy code written by others. The penalty for violating this code is an F for the entire semester.

Submission Note

For Part 2 (Homework 9), do not submit your .wav file. Submit only your program! Otherwise, the TA cannot grade your work!

Programming Style

For full credit, your work must show good judgement in deciding which parts of your program to make into separate functions with parameters. A large main program or individual large functions will not receive full credit. Also, all your work must follow the ten essential style items from www.cs.colorado.edu/~main/style.html.

Preliminary Work

Before you begin this assignment, you'll need two files. The first one is www.portmain.com/intro/hw/player/player.cxx. The second needed file is any stereo .wav file. You can create such a .wav file yourself from any music file that you have (I did the creation using the web site http://media.io). Or (for the purposes of this program only) you may use the .wav file that Michael has put in the directory www.portmain.com/intro/hw/player/. This fine song is from my favorite western swing band, Asleep at the Wheel.

The Assignment: Part 1 (Homework 8)

Compile and run the player.cxx program. Note that your compilation must include the winmm library, this way: bgi++ -Wall -g player.cxx -lwinmm -o player That's a lower-case letter L before the winmm in the compile command.

For Part 1 (Homework 8), there are two functions called compute_averages and reverse_array that you must implement in the player.cxx file.

The Assignment: Part 2 (Homework 9)

While the .wav file is playing, your program can get information about the current volume. Look at the documentation of the sound data type (at the top of player.cxx) to figure out how to do this at any given time. Part 2 (Homework 9) of your assignment is to draw some animation that depends on the volume_forward function.

Note: The volume_forward function can return a value between 0.0 and 1.0, but in practice, it does not vary all that much. Actual values are typically between 0.5 and 0.7 for the test song that I'm using.

We're not giving you much guideance on Homework 9 because we want this to be an open-ended task with no absolute right or wrong answer. The TAs will assign at least 80/100 points for any program that meets the requirement of being an animation that depends on the volume_forward function at any given time. The additional 20 points will come from the TAs judgement of how much thought and effort went into your work.