home *** CD-ROM | disk | FTP | other *** search
- /*
-
- ------------------------------------------------------------------
-
- Black Nebula
-
- File : Sound.c
- Programmer: Colin Adams
- Date: 13/5/91
- Last Modified : 29/5/91
-
- Description:
-
- Plays sound files. This file just calls routines in easysound.c
- which I did not write.
-
- ------------------------------------------------------------------
-
- */
-
- #include <exec/types.h>
- #include "easysound.h"
-
- char *samples[] =
- { "fire.snd", // 0
- "explosion.snd", // 1
- "missile1.snd", // 2
- };
-
- #define NUMBER_OF_SAMPLES (sizeof(samples)/sizeof(char *))
-
- CPTR sounds[NUMBER_OF_SAMPLES];
-
- void SoundSetUp(void)
- {
- int i;
- for(i=0; i<NUMBER_OF_SAMPLES; i++)
- {
- sounds[i] = PrepareSound(samples[i]);
- if(!sounds[i])
- printf("%d Error loading %s\n",i,samples[i]);
- }
- }
-
- void StartSound(int i)
- {
- UBYTE channel;
-
- switch(i)
- {
- case 0: channel = LEFT0; break;
- case 1: channel = RIGHT0; break;
- case 2: channel = RIGHT1; break;
- default:
- channel = LEFT1; break;
- }
- if(sounds[i])
- PlaySound(sounds[i], MAXVOLUME, channel, NORMALRATE, 1);
- }
-
- void EndSound(void)
- {
- register int i;
-
- StopSound(LEFT0);
- StopSound(RIGHT0);
- StopSound(RIGHT1);
- StopSound(LEFT1);
-
- for(i=0; i<NUMBER_OF_SAMPLES; i++)
- {
- RemoveSound(sounds[i]);
- sounds[i] = 0;
- }
- }
-