I wrote the below program to set up and play the game breakout as an assignment for Stanford's CS106 programming class. I wrote it on my old mac running OSX 10.6.8, with the version of Eclipse JDK that works on that machine. When I tested it back on the mac, the program worked normally. But now I am using a Windows 8.1 computer with the corresponding version of eclipse, and when I test the program again, the sound effect I coded does not play. I get the following error message in console when the ball hits the paddle or brick, which previously caused the sound clip to play.
Exception in thread "Thread-4" java.lang.IllegalArgumentException: Requested value -120.0 smaller than allowable minimum value -80.0.
at javax.sound.sampled.FloatControl.setValue(Unknown Source)
at com.sun.media.sound.DirectAudioDevice$DirectDL$Gain.setValue(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I have no idea what the values it refers to could mean, or why my code would request a value below the min. I am using the mediatools class that is part of the ACM libraries we are required to use for the class to play the sound in question, found here: http://cs.stanford.edu/people/eroberts/jtf/rationale/UtilPackage.html#MediaTools.
I went ahead and tested all parts of the program and the missing sound effect is the only problem. Here is my complete code:
WHAT: Students coming to CS106X are expected to have substantial prior experience with programming constructs such as loops, functions or methods, arrays, console and file I/O, standard data types, and classes. In other words, students coming to CS106X are expected to know how to write code. In this course, we transform you from someone who knows how to write some code into someone who can wield the power of the computer in a more expansive, versatile, and fluent way. This course adds powerful new tools to your skillset: managing complexity through abstraction, using recursion to crack big, tough problems by breaking them into smaller solvable problems, and applying analytical tools to evaluate the efficiency of different software design choices.
Topics (schedule is very approxmiate):
- Week 1: (Very quick) transition to C++ (anticipating that most of the audience will have used Java and not C++), get started on the Basic ADTs (see weeks 2-3).
- Weeks 2-3: Basic ADTs: Vector, Grid, Stack, Queue, Map, Set, Lexicon.
- Week 4: Recursion, advanced recursion, backtracking recursion
- Week 5: Pointers and dynamic memory allocation (new/delete), classes in C++
- Weeks 6-8: Basic ADTs revisited: how do we implement them behind the scenes? Linked lists, trees, Binary Search Trees, tries, hashing.
- Week 9-10: Graphs, graph search algorithms (BFS, DFS, A*), minimum spanning tree algorithms; also inheritance and polymorphism in C++.