1 #ifndef SOUND_DEVICE_H
2 #define SOUND_DEVICE_H
3 
4 #define CHANNEL_FILENAME_MAX 32
5 
6 void sound_device_open(void);
7 void sound_device_close(void);
8 
9 void sound_device_init_channels(int num_channels, char filenames[][CHANNEL_FILENAME_MAX]);
10 int sound_device_is_channel_playing(int channel);
11 
12 void sound_device_set_music_volume(int volume_pct);
13 void sound_device_set_channel_volume(int channel, int volume_pct);
14 
15 int sound_device_play_music(const char *filename, int volume_pct);
16 void sound_device_play_file_on_channel(const char *filename, int channel, int volume_pct);
17 void sound_device_play_channel(int channel, int volume_pct);
18 void sound_device_play_channel_panned(int channel, int volume_pct, int left_pct, int right_pct);
19 void sound_device_stop_music(void);
20 void sound_device_stop_channel(int channel);
21 
22 /**
23  * Use a custom music player, for external music data (e.g. videos)
24  * @param bitdepth Bitdepth, either 8 or 16
25  * @param num_channels Number of channels, 1 = mono, 2 = stereo
26  * @param rate Frequency, usually 22050 or 44100
27  * @param data First chunk of music data
28  * @param len Length of data
29  */
30 void sound_device_use_custom_music_player(int bitdepth, int num_channels, int rate,
31                                           const unsigned char *data, int len);
32 
33 /**
34  * Writes custom music data
35  * @param data Music data
36  * @param len Length
37  */
38 void sound_device_write_custom_music_data(const unsigned char *data, int len);
39 
40 void sound_device_use_default_music_player(void);
41 
42 #endif // SOUND_DEVICE_H
43