Temporary picts

Shari gogypsy at bellsouth.net
Wed Mar 20 13:34:01 EST 2002


>Of course, another option is just to combine all the sounds using a
>sound editing program and save the result as a single sound file. Then
>you have the illusion of multiple sounds but you only have to play one.

I use the same sounds in several pieces of code, but not in the same 
order/format.  I do this with virtually every program I create.  I 
use sounds a lot and it's not uncommon for a program to have 50 
sounds or more.  Blackjack and Poker have about 200 sounds each. 
Used at different times and in different combinations.

Commonly I'll have several global variables, each with a set of sounds.

-- HYPERCARD CODE --

global winSound,loseSound,streetSounds,airSounds
put "did good,you won,happy" into winSound
put "bad job,you lost,awww" into loseSound
put "scream1,scream2,kids,dogs,horns" into streetSounds
put "airplane,bomb" into airSounds

One script might just play one specific sounds.

play "awww"
doSomething

Another script might combine sounds.

set the soundChannel to 1
(not having my soundChannel scripts in front of me, I'd hate to post 
from memory and have it be wrong)
# play item 1 and 2 of airSounds in a repeat loop

set the soundChannel to 2
# repeat however many times, play any item of streetSounds

doSomething

Another script will play a set of sounds in order, some chosen from 
winSound, some chose from loseSound, etc.

put "you won,awww,bomb,dogs,did good" into soundByte
repeat with x = 1 to the number of sounds of soundByte
    play (item x of soundByte)
end repeat

I like to randomize it, so the player doesn't get the exact same 
thing every time.

-- 
--Shareware Games for the Mac--
http://www.gypsyware.com



More information about the metacard mailing list