Debian Codegraph @

common/include/digi_mixer.h

raw
1 /*
2 * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
3 * It is copyright by its individual contributors, as recorded in the
4 * project's Git history. See COPYING.txt at the top level for license
5 * terms and a link to the Git history.
6 */
7 #pragma once
8
9 #ifdef DXX_BUILD_DESCENT
10 #include "maths.h"
11 #include <SDL.h>
12 #include "digi_audio.h"
13
14 #ifndef DXX_FEATURE_EXTERNAL_RESAMPLER_SDL_NATIVE
15 #define DXX_FEATURE_EXTERNAL_RESAMPLER_SDL_NATIVE 1
16 #endif
17
18 #ifndef DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SDL1
19 #define DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SDL1 (SDL_MAJOR_VERSION == 2)
20 #endif
21
22 #ifndef DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SOUNDBLASTER16
23 #define DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SOUNDBLASTER16 1
24 #endif
25
26 #if !(DXX_FEATURE_EXTERNAL_RESAMPLER_SDL_NATIVE || \
27 DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SDL1 || \
28 DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SOUNDBLASTER16 \
29 )
30 #error "Rebirth with SDL_mixer must enable at least one resampler. Disable SDL_mixer or enable a resampler."
31 #endif
32
33 namespace dcx {
34
35 enum class sound_pan : int;
36 struct sound_object;
37
38 enum class digi_mixer_method : uint8_t
39 {
40 #if DXX_FEATURE_EXTERNAL_RESAMPLER_SDL_NATIVE
41 /* Delegate resampling to SDL. */
42 sdl_native,
43 #endif
44 #if DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SDL1
45 /* Use an internal resampler designed to produce the same results as SDL1's
46 * native resampler. Use this when you use SDL2 for other processing, but
47 * prefer the results of the SDL1 sound resampler.
48 */
49 emulate_sdl1,
50 #endif
51 #if DXX_FEATURE_INTERNAL_RESAMPLER_EMULATE_SOUNDBLASTER16
52 /* Use an internal resampler that attempts to mimic the SoundBlaster16
53 * behavior.
54 *
55 * Note that some users have reported distortion of concurrent effects with
56 * this resampler.
57 */
58 emulate_soundblaster16,
59 #endif
60 };
61
62 void digi_mixer_close();
63 void digi_mixer_set_channel_volume(sound_channel, int);
64 void digi_mixer_set_channel_pan(sound_channel, sound_pan);
65 void digi_mixer_stop_sound(sound_channel);
66 void digi_mixer_end_sound(sound_channel);
67 void digi_mixer_set_digi_volume(int);
68 int digi_mixer_is_channel_playing(sound_channel);
69 void digi_mixer_stop_all_channels();
70 int digi_mixer_init();
71 }
72 namespace dsx {
73 sound_channel digi_mixer_start_sound(sound_effect, fix, sound_pan, int, int, int, sound_object *);
74 }
75 #endif