Music 256b - Homework 2

Jennifer Hsu

DOWNLOAD

To download all of my files for this assignment, please click HERE. After downloading this folder, unzip it! The directory SSS-0 contains all of the files for my project. Once you open it up, you should be able to open the xcode project "SSS.xcodeproj", hit that giant play button and start my project (on an iPhone, iPodTouch, or the simulator). If any of the files are said to be missing, you can add them to the project as they should all be in the SSS folder already.

HOW TO USE MY PROJECT

Upon firing up SSS, hold your iPhone/iPodTouch hamburger style with the home button to the right (and of course, the screen still facing you). You should be presented with a clean, sleek dark wood background. Putting any two fingers on the screen will make a string between the two fingers. You can lightly pluck the string. Note that the differentiation between plucking and holding/pulling the string is done by timing. So if you touch the string for a little bit, that will pluck it. You can stretch the string for a higher sound, or bring your fingers closer together to bunch up the string for a lower sound. You can also hold and pull back the string. When you let go, a rainbow projectile will shoot out! Shoot more and you will see them collide. I have unnecessarily provided a background music track that fires up at the first pull and release of the sling shot. I felt that this paired nicely with the collision animation. So please enjoy that experience. Now, take notice of the almost invisible button on the bottom right. When you push this button and shake a little, the projectiles will all fly off the screen and you can start all over again.

A BIT ABOUT THE GUTS OF THE PROJECT

The heart of the project lies in the core folder. That's why it's named the core. The Entity class was made for the entities used in this project. It includes touch entities, projectile entities, and even collision entities. The files Entity.h and Entity.mm contain functions that render these entities. sounds.h and sounds.mm contain all the Stk objects that I use in this project. I use a few of the Stk instruments, so instead of having them all over my project, it was simpler to put them all in one file and just to have them output samples by one tick( ) function. renderer.h/renderer.m is really the powerhouse of the project. Here we have all the callback functions (audio, graphics, accelerometer, and touch), graphics functions, and the interaction between all of that. There are a chock full of functions in this file, and hopefully it is organized in a way that is simple to understand. I felt it was easier to keep all these functions and calls together since they share so many variables. The last important note, or one that I believe may be important is that I added a button in the .xib file that interacts with a function (buttonHit), which is written in the viewController file. This function modifies a variable that is declared as an extern in renderer.h.

DIFFICULTIES

Programming all the physics for this project was not easy. I actually implemented the physics of the moving things without using time and just kept track of the locations and velocities. This can be troublesome because things will collide in between frames (balls stick to each other and the walls). Luckily, I figured out some ways to get rid of these problems by checking velocities and distances and such. If I implement something similar to this project ever again, I will probably try to make it time-based and compare the differences. Another difficulty involved was keeping track of all the connections between everything and also figuring out where to put things. Once I memorized every part of the project though, this became easier. Something kind of small that I found troublesome was that, it's easy to start things, like animations or a sound, but it's tough to figure out how and where to stop it. For my project, the way to stop or turn off the things that I started or turned on seemed to keep changing. I'll have to see if I can come up with a better solution to this the next time I program with all of these things happening at the same time. As a final thought, that is a difficulty that also reflects in my attitude towards the project. It was easy to start, but hard to know when to stop and when to just turn the project in. Ahhhhhh