SoundTricks 3
by Todd Courtois & Bob Ebert
Copyright  1994-1995 by Apple Computer, Inc.  All rights reserved.


SoundTricks is intended to demonstrate a couple tricks with sound on the
Newton:

1. Modifying the samplingRate of a sound sample to shift speed and pitch.

2. Using StuffByte and ExtractByte on the actual sound samples to reverse a
sound.


All of the interesting code is stored in the mainView's 
viewSetupFormScript and the setupBackwardsSound script.

Note that I use buttonPressedScripts so that when you hold the button down you
get interesting playback side-effects.

Modifications for 2.0 include making the app into a protoFloatNGo for easy
movement around the screen.

Also, I made sure the Clone-ing was correct and efficient.

Greatest change is that I first look to see if sound slots are nil before
creating them.  This means you only need to create the sounds the first time
the app is opened.  During subsequent Open()s, the sound slots still contain
the data so opening is much faster.

Also removed some incorrect or misleading info about allowed samplingRates.


Modifications for version 3 include:

fixes to the backwards algorithm to speed them up (move loop invariants outside loops)

Deferring setting up backwards sound until it's needed.  (With a UI to indicate it.)


----
Modifications for version 4:

  I made SetupBackwardsSound be a native function, and declared variables
appropriately.  Before compiling native, it took ~570 ticks.  Native, it takes 11.
Better than 50x speedup is fairly decent...   -daf
