-
Notifications
You must be signed in to change notification settings - Fork 8
/
soundfx.h
executable file
·33 lines (27 loc) · 985 Bytes
/
soundfx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef __SOUNDFX_H__
#define __SOUNDFX_H__
#include "vaisseau_data.h"
#include <allegro5/allegro.h>
#include <allegro5/allegro_audio.h>
struct loopedsfx {
ALLEGRO_SAMPLE *sfx;
ALLEGRO_SAMPLE_INSTANCE *instance;
bool playingFlag;
double freqStep;
double startFreq;
ALLEGRO_SAMPLE_ID sample_id;
};
struct soundfx {
struct loopedsfx thrust; // loop
struct loopedsfx shield; // loop
struct loopedsfx refuel; // loop with a freq twist ;)
ALLEGRO_SAMPLE *shoot; // one shot
ALLEGRO_SAMPLE *boom; // one shot
ALLEGRO_SAMPLE *rebound; // one shot
};
int init_soundfx_from_wavfile(struct soundfx *sfx, const char *thrustwav,
const char *shieldwav, const char *refuelwav, const char *shootwav,
const char *boomwav, const char *rebound);
void cleanup_soundfx(struct soundfx *sfx);
void play_soundfx_from_shipdata(struct soundfx *sfx, struct vaisseau_data *v);
#endif