-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsound.h
74 lines (54 loc) · 2.02 KB
/
sound.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef SOUND_H
#define SOUND_H
#ifdef __ANDROID__
#include <SDL_mixer.h>
#else
#include <SDL2/SDL_mixer.h>
#endif
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#define MAX_SOUND_LIST_LENGTH 64
extern int sound_list_length;
extern Mix_Chunk **sound_list;
/**
* Loads a sound effect file from the specified file path and adds it to the sound list.
*
* @param file_path The file path of the sound effect to load.
* @return .
*/
extern int load_sound (const char *file_path);
/**
* Adds a sound effect to the sound list.
*
* @param sound A pointer to the sound effect to be added.
* @return .
*/
extern int add_to_sound_list (Mix_Chunk *sound);
/**
* Plays a sound effect from the sound list at the specified index.
*
* @param index The index of the sound effect in the sound list to play.
* @return Returns true if the sound effect was played successfully, false otherwise.
*/
extern bool play_sound (int index);
/**
* Plays a sound effect from the sound list at the specified index on a specific channel.
*
* @param index The index of the sound effect in the sound list to play.
* @param channel The channel to play the sound effect on.
* @return Returns true if the sound effect was played successfully, false otherwise.
*/
extern bool play_sound_in_channel (int index, int channel);
/**
* Removes a sound effect from the sound list at the specified index.
*
* @param index The index of the sound effect to remove.
* @return Returns true if the sound effect was successfully removed, false otherwise.
*/
extern bool rmv_from_sound_list (int index);
/**
* Removes all sound effects from the sound list and frees the memory.
*/
extern void rmv_all_from_sound_list(void);
#endif