summaryrefslogtreecommitdiffhomepage
path: root/src/raudio.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2020-05-01 17:31:44 +0200
committerraysan5 <[email protected]>2020-05-01 17:31:44 +0200
commit51c3bef4972047dc9927643fd1f1826970203f7d (patch)
tree361acf41e1a5edb81ff3f2a615884e2fbb08d690 /src/raudio.c
parent1c15dc72928c55fe01a1ed58c2a1d329eb80029d (diff)
downloadraylib-51c3bef4972047dc9927643fd1f1826970203f7d.tar.gz
raylib-51c3bef4972047dc9927643fd1f1826970203f7d.zip
Review exposed #defines and allow user re-defining
There are multiple #define values around raylib, usually not exposed for redefinition, just reviewed all of them to allow users redefining them on compile time if required. Also, multiple #define have been renamed and commented.
Diffstat (limited to 'src/raudio.c')
-rw-r--r--src/raudio.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/raudio.c b/src/raudio.c
index ce683c13..5224d516 100644
--- a/src/raudio.c
+++ b/src/raudio.c
@@ -223,11 +223,18 @@ typedef struct tagBITMAPINFOHEADER {
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------
-#define AUDIO_DEVICE_FORMAT ma_format_f32
-#define AUDIO_DEVICE_CHANNELS 2
-#define AUDIO_DEVICE_SAMPLE_RATE 44100
-
-#define MAX_AUDIO_BUFFER_POOL_CHANNELS 16
+#ifndef AUDIO_DEVICE_FORMAT
+ #define AUDIO_DEVICE_FORMAT ma_format_f32 // Device output format (float-32bit)
+#endif
+#ifndef AUDIO_DEVICE_CHANNELS
+ #define AUDIO_DEVICE_CHANNELS 2 // Device output channels: stereo
+#endif
+#ifndef AUDIO_DEVICE_SAMPLE_RATE
+ #define AUDIO_DEVICE_SAMPLE_RATE 44100 // Device output sample rate
+#endif
+#ifndef MAX_AUDIO_BUFFER_POOL_CHANNELS
+ #define MAX_AUDIO_BUFFER_POOL_CHANNELS 16 // Audio pool channels
+#endif
//----------------------------------------------------------------------------------
// Types and Structures Definition
@@ -391,14 +398,14 @@ void InitAudioDevice(void)
// NOTE: Using the default device. Format is floating point because it simplifies mixing.
ma_device_config config = ma_device_config_init(ma_device_type_playback);
config.playback.pDeviceID = NULL; // NULL for the default playback AUDIO.System.device.
- config.playback.format = AUDIO_DEVICE_FORMAT;
- config.playback.channels = AUDIO_DEVICE_CHANNELS;
- config.capture.pDeviceID = NULL; // NULL for the default capture AUDIO.System.device.
- config.capture.format = ma_format_s16;
- config.capture.channels = 1;
- config.sampleRate = AUDIO_DEVICE_SAMPLE_RATE;
- config.dataCallback = OnSendAudioDataToDevice;
- config.pUserData = NULL;
+ config.playback.format = AUDIO_DEVICE_FORMAT;
+ config.playback.channels = AUDIO_DEVICE_CHANNELS;
+ config.capture.pDeviceID = NULL; // NULL for the default capture AUDIO.System.device.
+ config.capture.format = ma_format_s16;
+ config.capture.channels = 1;
+ config.sampleRate = AUDIO_DEVICE_SAMPLE_RATE;
+ config.dataCallback = OnSendAudioDataToDevice;
+ config.pUserData = NULL;
result = ma_device_init(&AUDIO.System.context, &config, &AUDIO.System.device);
if (result != MA_SUCCESS)