Commit f1bf58d0 authored by David Reid's avatar David Reid

"MAL_" to "MA_".

parent b93faa46
...@@ -95,7 +95,7 @@ int main(int argc, char** argv) ...@@ -95,7 +95,7 @@ int main(int argc, char** argv)
mal_decoder decoder; mal_decoder decoder;
mal_result result = mal_decoder_init_file(argv[1], NULL, &decoder); mal_result result = mal_decoder_init_file(argv[1], NULL, &decoder);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -2; return -2;
} }
...@@ -107,13 +107,13 @@ int main(int argc, char** argv) ...@@ -107,13 +107,13 @@ int main(int argc, char** argv)
config.pUserData = &decoder; config.pUserData = &decoder;
mal_device device; mal_device device;
if (mal_device_init(NULL, &config, &device) != MAL_SUCCESS) { if (mal_device_init(NULL, &config, &device) != MA_SUCCESS) {
printf("Failed to open playback device.\n"); printf("Failed to open playback device.\n");
mal_decoder_uninit(&decoder); mal_decoder_uninit(&decoder);
return -3; return -3;
} }
if (mal_device_start(&device) != MAL_SUCCESS) { if (mal_device_start(&device) != MA_SUCCESS) {
printf("Failed to start playback device.\n"); printf("Failed to start playback device.\n");
mal_device_uninit(&device); mal_device_uninit(&device);
mal_decoder_uninit(&decoder); mal_decoder_uninit(&decoder);
...@@ -165,7 +165,7 @@ is an example for loading a decoder from a file: ...@@ -165,7 +165,7 @@ is an example for loading a decoder from a file:
``` ```
mal_decoder decoder; mal_decoder decoder;
mal_result result = mal_decoder_init_file("MySong.mp3", NULL, &decoder); mal_result result = mal_decoder_init_file("MySong.mp3", NULL, &decoder);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return false; // An error occurred. return false; // An error occurred.
} }
...@@ -195,7 +195,7 @@ You can also seek to a specific frame like so: ...@@ -195,7 +195,7 @@ You can also seek to a specific frame like so:
``` ```
mal_result result = mal_decoder_seek_to_pcm_frame(pDecoder, targetFrame); mal_result result = mal_decoder_seek_to_pcm_frame(pDecoder, targetFrame);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return false; // An error occurred. return false; // An error occurred.
} }
``` ```
......
...@@ -55,7 +55,7 @@ int main(int argc, char** argv) ...@@ -55,7 +55,7 @@ int main(int argc, char** argv)
// During initialization, PulseAudio can try to automatically start the PulseAudio daemon. This does not // During initialization, PulseAudio can try to automatically start the PulseAudio daemon. This does not
// suit miniaudio's trial and error backend initialization architecture so it's disabled by default, but you // suit miniaudio's trial and error backend initialization architecture so it's disabled by default, but you
// can enable it like so: // can enable it like so:
contextConfig.pulse.tryAutoSpawn = MAL_TRUE; contextConfig.pulse.tryAutoSpawn = MA_TRUE;
// ALSA // ALSA
...@@ -65,7 +65,7 @@ int main(int argc, char** argv) ...@@ -65,7 +65,7 @@ int main(int argc, char** argv)
// combat this, miniaudio will include only unique card/device pairs by default. The problem with this is that // combat this, miniaudio will include only unique card/device pairs by default. The problem with this is that
// you lose a bit of flexibility and control. Setting alsa.useVerboseDeviceEnumeration makes it so the ALSA // you lose a bit of flexibility and control. Setting alsa.useVerboseDeviceEnumeration makes it so the ALSA
// backend includes all devices (and there's a lot of them!). // backend includes all devices (and there's a lot of them!).
contextConfig.alsa.useVerboseDeviceEnumeration = MAL_TRUE; contextConfig.alsa.useVerboseDeviceEnumeration = MA_TRUE;
// JACK // JACK
...@@ -75,7 +75,7 @@ int main(int argc, char** argv) ...@@ -75,7 +75,7 @@ int main(int argc, char** argv)
contextConfig.jack.pClientName = "My Application"; contextConfig.jack.pClientName = "My Application";
// Also like PulseAudio, you can have JACK try to automatically start using the following: // Also like PulseAudio, you can have JACK try to automatically start using the following:
contextConfig.jack.tryStartServer = MAL_TRUE; contextConfig.jack.tryStartServer = MA_TRUE;
...@@ -100,7 +100,7 @@ int main(int argc, char** argv) ...@@ -100,7 +100,7 @@ int main(int argc, char** argv)
}; };
mal_context context; mal_context context;
if (mal_context_init(backends, sizeof(backends)/sizeof(backends[0]), &contextConfig, &context) != MAL_SUCCESS) { if (mal_context_init(backends, sizeof(backends)/sizeof(backends[0]), &contextConfig, &context) != MA_SUCCESS) {
printf("Failed to initialize context."); printf("Failed to initialize context.");
return -2; return -2;
} }
...@@ -112,7 +112,7 @@ int main(int argc, char** argv) ...@@ -112,7 +112,7 @@ int main(int argc, char** argv)
mal_device_info* pCaptureDeviceInfos; mal_device_info* pCaptureDeviceInfos;
mal_uint32 captureDeviceCount; mal_uint32 captureDeviceCount;
mal_result result = mal_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); mal_result result = mal_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to retrieve device information.\n"); printf("Failed to retrieve device information.\n");
return -3; return -3;
} }
...@@ -154,21 +154,21 @@ int main(int argc, char** argv) ...@@ -154,21 +154,21 @@ int main(int argc, char** argv)
// miniaudio allows applications to control the mapping of channels. The config below swaps the left and right // miniaudio allows applications to control the mapping of channels. The config below swaps the left and right
// channels. Normally in an interleaved audio stream, the left channel comes first, but we can change that // channels. Normally in an interleaved audio stream, the left channel comes first, but we can change that
// like the following: // like the following:
deviceConfig.playback.channelMap[0] = MAL_CHANNEL_FRONT_RIGHT; deviceConfig.playback.channelMap[0] = MA_CHANNEL_FRONT_RIGHT;
deviceConfig.playback.channelMap[1] = MAL_CHANNEL_FRONT_LEFT; deviceConfig.playback.channelMap[1] = MA_CHANNEL_FRONT_LEFT;
// The ALSA backend has two ways of delivering data to and from a device: memory mapping and read/write. By // The ALSA backend has two ways of delivering data to and from a device: memory mapping and read/write. By
// default memory mapping will be used over read/write because it avoids a single point of data movement // default memory mapping will be used over read/write because it avoids a single point of data movement
// internally and is thus, theoretically, more efficient. In testing, however, this has been less stable than // internally and is thus, theoretically, more efficient. In testing, however, this has been less stable than
// read/write mode so an option exists to disable it if need be. This is mainly for debugging, but is left // read/write mode so an option exists to disable it if need be. This is mainly for debugging, but is left
// here in case it might be useful for others. If you find a bug specific to mmap mode, please report it! // here in case it might be useful for others. If you find a bug specific to mmap mode, please report it!
deviceConfig.alsa.noMMap = MAL_TRUE; deviceConfig.alsa.noMMap = MA_TRUE;
// This is not used in this example, but miniaudio allows you to directly control the device ID that's used // This is not used in this example, but miniaudio allows you to directly control the device ID that's used
// for device selection by mal_device_init(). Below is an example for ALSA. In this example it forces // for device selection by mal_device_init(). Below is an example for ALSA. In this example it forces
// mal_device_init() to try opening the "hw:0,0" device. This is useful for debugging in case you have // mal_device_init() to try opening the "hw:0,0" device. This is useful for debugging in case you have
// audio glitches or whatnot with specific devices. // audio glitches or whatnot with specific devices.
#ifdef MAL_SUPPORT_ALSA #ifdef MA_SUPPORT_ALSA
mal_device_id customDeviceID; mal_device_id customDeviceID;
if (context.backend == mal_backend_alsa) { if (context.backend == mal_backend_alsa) {
strcpy(customDeviceID.alsa, "hw:0,0"); strcpy(customDeviceID.alsa, "hw:0,0");
...@@ -182,13 +182,13 @@ int main(int argc, char** argv) ...@@ -182,13 +182,13 @@ int main(int argc, char** argv)
#endif #endif
mal_device playbackDevice; mal_device playbackDevice;
if (mal_device_init(&context, &deviceConfig, &playbackDevice) != MAL_SUCCESS) { if (mal_device_init(&context, &deviceConfig, &playbackDevice) != MA_SUCCESS) {
printf("Failed to initialize playback device.\n"); printf("Failed to initialize playback device.\n");
mal_context_uninit(&context); mal_context_uninit(&context);
return -7; return -7;
} }
if (mal_device_start(&playbackDevice) != MAL_SUCCESS) { if (mal_device_start(&playbackDevice) != MA_SUCCESS) {
printf("Failed to start playback device.\n"); printf("Failed to start playback device.\n");
mal_device_uninit(&playbackDevice); mal_device_uninit(&playbackDevice);
mal_context_uninit(&context); mal_context_uninit(&context);
......
...@@ -50,13 +50,13 @@ int main(int argc, char** argv) ...@@ -50,13 +50,13 @@ int main(int argc, char** argv)
mal_device device; mal_device device;
result = mal_device_init(NULL, &config, &device); result = mal_device_init(NULL, &config, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize capture device.\n"); printf("Failed to initialize capture device.\n");
return -2; return -2;
} }
result = mal_device_start(&device); result = mal_device_start(&device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
mal_device_uninit(&device); mal_device_uninit(&device);
printf("Failed to start device.\n"); printf("Failed to start device.\n");
return -3; return -3;
......
...@@ -9,7 +9,7 @@ int main(int argc, char** argv) ...@@ -9,7 +9,7 @@ int main(int argc, char** argv)
(void)argv; (void)argv;
mal_context context; mal_context context;
if (mal_context_init(NULL, 0, NULL, &context) != MAL_SUCCESS) { if (mal_context_init(NULL, 0, NULL, &context) != MA_SUCCESS) {
printf("Failed to initialize context.\n"); printf("Failed to initialize context.\n");
return -2; return -2;
} }
...@@ -19,7 +19,7 @@ int main(int argc, char** argv) ...@@ -19,7 +19,7 @@ int main(int argc, char** argv)
mal_device_info* pCaptureDeviceInfos; mal_device_info* pCaptureDeviceInfos;
mal_uint32 captureDeviceCount; mal_uint32 captureDeviceCount;
mal_result result = mal_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); mal_result result = mal_context_get_devices(&context, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to retrieve device information.\n"); printf("Failed to retrieve device information.\n");
return -3; return -3;
} }
......
...@@ -31,7 +31,7 @@ int main(int argc, char** argv) ...@@ -31,7 +31,7 @@ int main(int argc, char** argv)
mal_decoder decoder; mal_decoder decoder;
mal_result result = mal_decoder_init_file(argv[1], NULL, &decoder); mal_result result = mal_decoder_init_file(argv[1], NULL, &decoder);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -2; return -2;
} }
...@@ -43,13 +43,13 @@ int main(int argc, char** argv) ...@@ -43,13 +43,13 @@ int main(int argc, char** argv)
config.pUserData = &decoder; config.pUserData = &decoder;
mal_device device; mal_device device;
if (mal_device_init(NULL, &config, &device) != MAL_SUCCESS) { if (mal_device_init(NULL, &config, &device) != MA_SUCCESS) {
printf("Failed to open playback device.\n"); printf("Failed to open playback device.\n");
mal_decoder_uninit(&decoder); mal_decoder_uninit(&decoder);
return -3; return -3;
} }
if (mal_device_start(&device) != MAL_SUCCESS) { if (mal_device_start(&device) != MA_SUCCESS) {
printf("Failed to start playback device.\n"); printf("Failed to start playback device.\n");
mal_device_uninit(&device); mal_device_uninit(&device);
mal_decoder_uninit(&decoder); mal_decoder_uninit(&decoder);
......
...@@ -42,14 +42,14 @@ int main(int argc, char** argv) ...@@ -42,14 +42,14 @@ int main(int argc, char** argv)
config.pUserData = &sineWave; config.pUserData = &sineWave;
mal_device device; mal_device device;
if (mal_device_init(NULL, &config, &device) != MAL_SUCCESS) { if (mal_device_init(NULL, &config, &device) != MA_SUCCESS) {
printf("Failed to open playback device.\n"); printf("Failed to open playback device.\n");
return -4; return -4;
} }
printf("Device Name: %s\n", device.playback.name); printf("Device Name: %s\n", device.playback.name);
if (mal_device_start(&device) != MAL_SUCCESS) { if (mal_device_start(&device) != MA_SUCCESS) {
printf("Failed to start playback device.\n"); printf("Failed to start playback device.\n");
mal_device_uninit(&device); mal_device_uninit(&device);
return -5; return -5;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#define DR_WAV_IMPLEMENTATION #define DR_WAV_IMPLEMENTATION
#include "../../../../dr_libs/dr_wav.h" #include "../../../../dr_libs/dr_wav.h"
#define MAL_DEBUG_OUTPUT #define MA_DEBUG_OUTPUT
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
#include "../../miniaudio.h" #include "../../miniaudio.h"
#include "../mal_resampler.h" #include "../mal_resampler.h"
...@@ -38,7 +38,7 @@ int main(int argc, char** argv) ...@@ -38,7 +38,7 @@ int main(int argc, char** argv)
resamplerConfig.pUserData = NULL; resamplerConfig.pUserData = NULL;
result = mal_resampler_init(&resamplerConfig, &resampler); result = mal_resampler_init(&resamplerConfig, &resampler);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize resampler.\n"); printf("Failed to initialize resampler.\n");
return -1; return -1;
} }
......
#define MAL_LOG_LEVEL MAL_LOG_LEVEL_VERBOSE #define MA_LOG_LEVEL MA_LOG_LEVEL_VERBOSE
#define MAL_DEBUG_OUTPUT #define MA_DEBUG_OUTPUT
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
#include "../miniaudio.h" #include "../miniaudio.h"
int print_context_info(mal_context* pContext) int print_context_info(mal_context* pContext)
{ {
mal_result result = MAL_SUCCESS; mal_result result = MA_SUCCESS;
mal_device_info* pPlaybackDeviceInfos; mal_device_info* pPlaybackDeviceInfos;
mal_uint32 playbackDeviceCount; mal_uint32 playbackDeviceCount;
mal_device_info* pCaptureDeviceInfos; mal_device_info* pCaptureDeviceInfos;
...@@ -18,7 +18,7 @@ int print_context_info(mal_context* pContext) ...@@ -18,7 +18,7 @@ int print_context_info(mal_context* pContext)
printf(" Enumerating Devices... "); printf(" Enumerating Devices... ");
{ {
result = mal_context_get_devices(pContext, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount); result = mal_context_get_devices(pContext, &pPlaybackDeviceInfos, &playbackDeviceCount, &pCaptureDeviceInfos, &captureDeviceCount);
if (result == MAL_SUCCESS) { if (result == MA_SUCCESS) {
printf("Done\n"); printf("Done\n");
} else { } else {
printf("Failed\n"); printf("Failed\n");
...@@ -44,7 +44,7 @@ int print_context_info(mal_context* pContext) ...@@ -44,7 +44,7 @@ int print_context_info(mal_context* pContext)
printf(" %d: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name); printf(" %d: %s\n", iDevice, pPlaybackDeviceInfos[iDevice].name);
result = mal_context_get_device_info(pContext, mal_device_type_playback, &pPlaybackDeviceInfos[iDevice].id, mal_share_mode_shared, &pPlaybackDeviceInfos[iDevice]); result = mal_context_get_device_info(pContext, mal_device_type_playback, &pPlaybackDeviceInfos[iDevice].id, mal_share_mode_shared, &pPlaybackDeviceInfos[iDevice]);
if (result == MAL_SUCCESS) { if (result == MA_SUCCESS) {
printf(" Name: %s\n", pPlaybackDeviceInfos[iDevice].name); printf(" Name: %s\n", pPlaybackDeviceInfos[iDevice].name);
printf(" Min Channels: %d\n", pPlaybackDeviceInfos[iDevice].minChannels); printf(" Min Channels: %d\n", pPlaybackDeviceInfos[iDevice].minChannels);
printf(" Max Channels: %d\n", pPlaybackDeviceInfos[iDevice].maxChannels); printf(" Max Channels: %d\n", pPlaybackDeviceInfos[iDevice].maxChannels);
...@@ -64,7 +64,7 @@ int print_context_info(mal_context* pContext) ...@@ -64,7 +64,7 @@ int print_context_info(mal_context* pContext)
printf(" %d: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name); printf(" %d: %s\n", iDevice, pCaptureDeviceInfos[iDevice].name);
result = mal_context_get_device_info(pContext, mal_device_type_capture, &pCaptureDeviceInfos[iDevice].id, mal_share_mode_shared, &pCaptureDeviceInfos[iDevice]); result = mal_context_get_device_info(pContext, mal_device_type_capture, &pCaptureDeviceInfos[iDevice].id, mal_share_mode_shared, &pCaptureDeviceInfos[iDevice]);
if (result == MAL_SUCCESS) { if (result == MA_SUCCESS) {
printf(" Name: %s\n", pCaptureDeviceInfos[iDevice].name); printf(" Name: %s\n", pCaptureDeviceInfos[iDevice].name);
printf(" Min Channels: %d\n", pCaptureDeviceInfos[iDevice].minChannels); printf(" Min Channels: %d\n", pCaptureDeviceInfos[iDevice].minChannels);
printf(" Max Channels: %d\n", pCaptureDeviceInfos[iDevice].maxChannels); printf(" Max Channels: %d\n", pCaptureDeviceInfos[iDevice].maxChannels);
...@@ -82,7 +82,7 @@ int print_context_info(mal_context* pContext) ...@@ -82,7 +82,7 @@ int print_context_info(mal_context* pContext)
done: done:
printf("\n"); printf("\n");
return (result == MAL_SUCCESS) ? 0 : -1; return (result == MA_SUCCESS) ? 0 : -1;
} }
int print_device_info(mal_device* pDevice) int print_device_info(mal_device* pDevice)
...@@ -123,7 +123,7 @@ int main(int argc, char** argv) ...@@ -123,7 +123,7 @@ int main(int argc, char** argv)
mal_sine_wave sineWave; mal_sine_wave sineWave;
result = mal_sine_wave_init(0.2, 400, 44100, &sineWave); result = mal_sine_wave_init(0.2, 400, 44100, &sineWave);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize sine wave.\n"); printf("Failed to initialize sine wave.\n");
return -1; return -1;
} }
...@@ -132,7 +132,7 @@ int main(int argc, char** argv) ...@@ -132,7 +132,7 @@ int main(int argc, char** argv)
mal_context_config contextConfig = mal_context_config_init(NULL); // <-- Don't need a log callback because we're using debug output instead. mal_context_config contextConfig = mal_context_config_init(NULL); // <-- Don't need a log callback because we're using debug output instead.
mal_context context; mal_context context;
result = mal_context_init(NULL, 0, &contextConfig, &context); result = mal_context_init(NULL, 0, &contextConfig, &context);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize context.\n"); printf("Failed to initialize context.\n");
return -1; return -1;
} }
...@@ -146,7 +146,7 @@ int main(int argc, char** argv) ...@@ -146,7 +146,7 @@ int main(int argc, char** argv)
mal_device device; mal_device device;
result = mal_device_init(&context, mal_device_type_playback, NULL, &deviceConfig, &sineWave, &device); result = mal_device_init(&context, mal_device_type_playback, NULL, &deviceConfig, &sineWave, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
mal_context_uninit(&context); mal_context_uninit(&context);
printf("Failed to initialize device.\n"); printf("Failed to initialize device.\n");
return -1; return -1;
...@@ -157,7 +157,7 @@ int main(int argc, char** argv) ...@@ -157,7 +157,7 @@ int main(int argc, char** argv)
// Start playback. // Start playback.
result = mal_device_start(&device); result = mal_device_start(&device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
mal_device_uninit(&device); mal_device_uninit(&device);
mal_context_uninit(&context); mal_context_uninit(&context);
printf("Failed to start device.\n"); printf("Failed to start device.\n");
......
#define MAL_DEBUG_OUTPUT #define MA_DEBUG_OUTPUT
#define MAL_USE_REFERENCE_CONVERSION_APIS #define MA_USE_REFERENCE_CONVERSION_APIS
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
#include "../miniaudio.h" #include "../miniaudio.h"
...@@ -68,14 +68,14 @@ int do_dithering_test() ...@@ -68,14 +68,14 @@ int do_dithering_test()
// We first play the sound the way it's meant to be played. // We first play the sound the way it's meant to be played.
result = mal_device_init(NULL, &config, &device); result = mal_device_init(NULL, &config, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -1; return -1;
} }
mal_sine_wave_init(0.5, 400, device.sampleRate, &sineWave); mal_sine_wave_init(0.5, 400, device.sampleRate, &sineWave);
result = mal_device_start(&device); result = mal_device_start(&device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -2; return -2;
} }
...@@ -96,7 +96,7 @@ int do_dithering_test() ...@@ -96,7 +96,7 @@ int do_dithering_test()
converterInConfig.onRead = on_convert_samples_in; converterInConfig.onRead = on_convert_samples_in;
converterInConfig.pUserData = &sineWave; converterInConfig.pUserData = &sineWave;
result = mal_format_converter_init(&converterInConfig, &converterIn); result = mal_format_converter_init(&converterInConfig, &converterIn);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -3; return -3;
} }
...@@ -108,7 +108,7 @@ int do_dithering_test() ...@@ -108,7 +108,7 @@ int do_dithering_test()
converterOutConfig.onRead = on_convert_samples_out; converterOutConfig.onRead = on_convert_samples_out;
converterOutConfig.pUserData = &converterIn; converterOutConfig.pUserData = &converterIn;
result = mal_format_converter_init(&converterOutConfig, &converterOut); result = mal_format_converter_init(&converterOutConfig, &converterOut);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -3; return -3;
} }
...@@ -117,7 +117,7 @@ int do_dithering_test() ...@@ -117,7 +117,7 @@ int do_dithering_test()
config.pUserData = &converterOut; config.pUserData = &converterOut;
result = mal_device_init(NULL, &config, &device); result = mal_device_init(NULL, &config, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -1; return -1;
} }
...@@ -125,7 +125,7 @@ int do_dithering_test() ...@@ -125,7 +125,7 @@ int do_dithering_test()
mal_sine_wave_init(0.5, 400, device.sampleRate, &sineWave); mal_sine_wave_init(0.5, 400, device.sampleRate, &sineWave);
result = mal_device_start(&device); result = mal_device_start(&device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -2; return -2;
} }
......
#include <stdio.h> #include <stdio.h>
#define MAL_DEBUG_OUTPUT #define MA_DEBUG_OUTPUT
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
#include "../miniaudio.h" #include "../miniaudio.h"
...@@ -68,7 +68,7 @@ int main(int argc, char** argv) ...@@ -68,7 +68,7 @@ int main(int argc, char** argv)
mal_context context; mal_context context;
result = mal_context_init(&backend, 1, &contextConfig, &context); result = mal_context_init(&backend, 1, &contextConfig, &context);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize context.\n"); printf("Failed to initialize context.\n");
return result; return result;
} }
...@@ -91,7 +91,7 @@ int main(int argc, char** argv) ...@@ -91,7 +91,7 @@ int main(int argc, char** argv)
mal_device device; mal_device device;
result = mal_device_init(&context, &deviceConfig, &device); result = mal_device_init(&context, &deviceConfig, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return result; return result;
} }
......
// Just a simple test to check that MAL_NO_DEVICE_IO compiles. // Just a simple test to check that MA_NO_DEVICE_IO compiles.
#include "../extras/dr_flac.h" #include "../extras/dr_flac.h"
#include "../extras/dr_mp3.h" #include "../extras/dr_mp3.h"
#include "../extras/dr_wav.h" #include "../extras/dr_wav.h"
#define MAL_NO_DEVICE_IO #define MA_NO_DEVICE_IO
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
#include "../miniaudio.h" #include "../miniaudio.h"
...@@ -13,7 +13,7 @@ int main(int argc, char** argv) ...@@ -13,7 +13,7 @@ int main(int argc, char** argv)
(void)argc; (void)argc;
(void)argv; (void)argv;
mal_result result = MAL_ERROR; mal_result result = MA_ERROR;
mal_pcm_converter_config dspConfig = mal_pcm_converter_config_init_new(); mal_pcm_converter_config dspConfig = mal_pcm_converter_config_init_new();
mal_pcm_converter converter; mal_pcm_converter converter;
......
This diff is collapsed.
// We're using sigvis for visualizations. This will include miniaudio for us, so no need to include miniaudio in this file. // We're using sigvis for visualizations. This will include miniaudio for us, so no need to include miniaudio in this file.
#define NO_SIGVIS #define NO_SIGVIS
#define MAL_NO_SSE2 #define MA_NO_SSE2
#define MAL_NO_AVX2 #define MA_NO_AVX2
#ifdef NO_SIGVIS #ifdef NO_SIGVIS
#define MINIAUDIO_IMPLEMENTATION #define MINIAUDIO_IMPLEMENTATION
...@@ -117,7 +117,7 @@ int main(int argc, char** argv) ...@@ -117,7 +117,7 @@ int main(int argc, char** argv)
// We first play the sound the way it's meant to be played. // We first play the sound the way it's meant to be played.
result = mal_device_init(NULL, &config, &device); result = mal_device_init(NULL, &config, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -1; return -1;
} }
...@@ -129,10 +129,10 @@ int main(int argc, char** argv) ...@@ -129,10 +129,10 @@ int main(int argc, char** argv)
mal_src_config srcConfig = mal_src_config_init(sampleRateIn, sampleRateOut, 1, on_src, NULL); mal_src_config srcConfig = mal_src_config_init(sampleRateIn, sampleRateOut, 1, on_src, NULL);
srcConfig.algorithm = mal_src_algorithm_sinc; srcConfig.algorithm = mal_src_algorithm_sinc;
srcConfig.neverConsumeEndOfInput = MAL_TRUE; srcConfig.neverConsumeEndOfInput = MA_TRUE;
result = mal_src_init(&srcConfig, &src); result = mal_src_init(&srcConfig, &src);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to create SRC.\n"); printf("Failed to create SRC.\n");
return -1; return -1;
} }
...@@ -142,14 +142,14 @@ int main(int argc, char** argv) ...@@ -142,14 +142,14 @@ int main(int argc, char** argv)
#ifndef NO_SIGVIS #ifndef NO_SIGVIS
msigvis_context sigvis; msigvis_context sigvis;
result = msigvis_init(&sigvis); result = msigvis_init(&sigvis);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize mini_sigvis context.\n"); printf("Failed to initialize mini_sigvis context.\n");
return -1; return -1;
} }
msigvis_screen screen; msigvis_screen screen;
result = msigvis_screen_init(&sigvis, 1280, 720, &screen); result = msigvis_screen_init(&sigvis, 1280, 720, &screen);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize mini_sigvis screen.\n"); printf("Failed to initialize mini_sigvis screen.\n");
return -2; return -2;
} }
...@@ -159,7 +159,7 @@ int main(int argc, char** argv) ...@@ -159,7 +159,7 @@ int main(int argc, char** argv)
msigvis_channel channelSineWave; msigvis_channel channelSineWave;
result = msigvis_channel_init(&sigvis, mal_format_f32, sampleRateOut, &channelSineWave); result = msigvis_channel_init(&sigvis, mal_format_f32, sampleRateOut, &channelSineWave);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize mini_sigvis channel.\n"); printf("Failed to initialize mini_sigvis channel.\n");
return -3; return -3;
} }
...@@ -198,7 +198,7 @@ int main(int argc, char** argv) ...@@ -198,7 +198,7 @@ int main(int argc, char** argv)
#else #else
result = mal_device_start(&device); result = mal_device_start(&device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return -2; return -2;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
mal_sine_wave sineWave; mal_sine_wave sineWave;
mal_uint32 framesWritten; mal_uint32 framesWritten;
mal_event stopEvent; mal_event stopEvent;
mal_bool32 isInitialRun = MAL_TRUE; mal_bool32 isInitialRun = MA_TRUE;
void on_stop(mal_device* pDevice) void on_stop(mal_device* pDevice)
{ {
...@@ -35,7 +35,7 @@ void on_data(mal_device* pDevice, void* pOutput, const void* pInput, mal_uint32 ...@@ -35,7 +35,7 @@ void on_data(mal_device* pDevice, void* pOutput, const void* pInput, mal_uint32
if (isInitialRun) { if (isInitialRun) {
printf("STOPPING [AUDIO THREAD]...\n"); printf("STOPPING [AUDIO THREAD]...\n");
mal_event_signal(&stopEvent); mal_event_signal(&stopEvent);
isInitialRun = MAL_FALSE; isInitialRun = MA_FALSE;
} }
} }
} }
...@@ -61,13 +61,13 @@ int main(int argc, char** argv) ...@@ -61,13 +61,13 @@ int main(int argc, char** argv)
mal_device device; mal_device device;
result = mal_device_init_ex(&backend, 1, NULL, &config, &device); result = mal_device_init_ex(&backend, 1, NULL, &config, &device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize device.\n"); printf("Failed to initialize device.\n");
return result; return result;
} }
result = mal_event_init(device.pContext, &stopEvent); result = mal_event_init(device.pContext, &stopEvent);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to initialize stop event.\n"); printf("Failed to initialize stop event.\n");
return result; return result;
} }
...@@ -84,7 +84,7 @@ int main(int argc, char** argv) ...@@ -84,7 +84,7 @@ int main(int argc, char** argv)
getchar(); getchar();
result = mal_device_start(&device); result = mal_device_start(&device);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
printf("Failed to restart the device.\n"); printf("Failed to restart the device.\n");
mal_device_uninit(&device); mal_device_uninit(&device);
return -1; return -1;
......
This diff is collapsed.
...@@ -95,7 +95,7 @@ mal_result msigvis_result_from_dtk(dtk_result resultDTK) ...@@ -95,7 +95,7 @@ mal_result msigvis_result_from_dtk(dtk_result resultDTK)
mal_result msigvis_init(msigvis_context* pContext) mal_result msigvis_init(msigvis_context* pContext)
{ {
if (pContext == NULL) { if (pContext == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
mal_zero_object(pContext); mal_zero_object(pContext);
...@@ -106,7 +106,7 @@ mal_result msigvis_init(msigvis_context* pContext) ...@@ -106,7 +106,7 @@ mal_result msigvis_init(msigvis_context* pContext)
return msigvis_result_from_dtk(resultDTK); return msigvis_result_from_dtk(resultDTK);
} }
return MAL_SUCCESS; return MA_SUCCESS;
} }
void msigvis_uninit(msigvis_context* pContext) void msigvis_uninit(msigvis_context* pContext)
...@@ -261,7 +261,7 @@ void msigvis_screen_uninit(msigvis_screen* pScreen) ...@@ -261,7 +261,7 @@ void msigvis_screen_uninit(msigvis_screen* pScreen)
mal_result msigvis_screen_show(msigvis_screen* pScreen) mal_result msigvis_screen_show(msigvis_screen* pScreen)
{ {
if (pScreen == NULL) { if (pScreen == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
return msigvis_result_from_dtk(dtk_window_show(&pScreen->window, DTK_SHOW_NORMAL)); return msigvis_result_from_dtk(dtk_window_show(&pScreen->window, DTK_SHOW_NORMAL));
...@@ -270,7 +270,7 @@ mal_result msigvis_screen_show(msigvis_screen* pScreen) ...@@ -270,7 +270,7 @@ mal_result msigvis_screen_show(msigvis_screen* pScreen)
mal_result msigvis_screen_hide(msigvis_screen* pScreen) mal_result msigvis_screen_hide(msigvis_screen* pScreen)
{ {
if (pScreen == NULL) { if (pScreen == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
return msigvis_result_from_dtk(dtk_window_hide(&pScreen->window)); return msigvis_result_from_dtk(dtk_window_hide(&pScreen->window));
...@@ -279,7 +279,7 @@ mal_result msigvis_screen_hide(msigvis_screen* pScreen) ...@@ -279,7 +279,7 @@ mal_result msigvis_screen_hide(msigvis_screen* pScreen)
mal_result msigvis_screen_add_channel(msigvis_screen* pScreen, msigvis_channel* pChannel) mal_result msigvis_screen_add_channel(msigvis_screen* pScreen, msigvis_channel* pChannel)
{ {
if (pScreen == NULL || pChannel == NULL) { if (pScreen == NULL || pChannel == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
// Expand if necessary. // Expand if necessary.
...@@ -291,7 +291,7 @@ mal_result msigvis_screen_add_channel(msigvis_screen* pScreen, msigvis_channel* ...@@ -291,7 +291,7 @@ mal_result msigvis_screen_add_channel(msigvis_screen* pScreen, msigvis_channel*
msigvis_channel** ppNewBuffer = (msigvis_channel**)mal_realloc(pScreen->ppChannels, sizeof(*pScreen->ppChannels)*newCap); msigvis_channel** ppNewBuffer = (msigvis_channel**)mal_realloc(pScreen->ppChannels, sizeof(*pScreen->ppChannels)*newCap);
if (ppNewBuffer == NULL) { if (ppNewBuffer == NULL) {
return MAL_OUT_OF_MEMORY; return MA_OUT_OF_MEMORY;
} }
pScreen->channelCap = newCap; pScreen->channelCap = newCap;
...@@ -302,18 +302,18 @@ mal_result msigvis_screen_add_channel(msigvis_screen* pScreen, msigvis_channel* ...@@ -302,18 +302,18 @@ mal_result msigvis_screen_add_channel(msigvis_screen* pScreen, msigvis_channel*
pScreen->channelCount += 1; pScreen->channelCount += 1;
msigvis_screen_redraw(pScreen); msigvis_screen_redraw(pScreen);
return MAL_SUCCESS; return MA_SUCCESS;
} }
mal_result msigvis_screen_remove_channel(msigvis_screen* pScreen, msigvis_channel* pChannel) mal_result msigvis_screen_remove_channel(msigvis_screen* pScreen, msigvis_channel* pChannel)
{ {
if (pScreen == NULL || pChannel == NULL) { if (pScreen == NULL || pChannel == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
mal_uint32 iChannel; mal_uint32 iChannel;
mal_result result = msigvis_screen_find_channel_index(pScreen, pChannel, &iChannel); mal_result result = msigvis_screen_find_channel_index(pScreen, pChannel, &iChannel);
if (result != MAL_SUCCESS) { if (result != MA_SUCCESS) {
return result; return result;
} }
...@@ -323,11 +323,11 @@ mal_result msigvis_screen_remove_channel(msigvis_screen* pScreen, msigvis_channe ...@@ -323,11 +323,11 @@ mal_result msigvis_screen_remove_channel(msigvis_screen* pScreen, msigvis_channe
mal_result msigvis_screen_remove_channel_by_index(msigvis_screen* pScreen, mal_uint32 iChannel) mal_result msigvis_screen_remove_channel_by_index(msigvis_screen* pScreen, mal_uint32 iChannel)
{ {
if (pScreen == NULL || iChannel > pScreen->channelCount) { if (pScreen == NULL || iChannel > pScreen->channelCount) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
if (pScreen->channelCount == 0) { if (pScreen->channelCount == 0) {
return MAL_INVALID_OPERATION; return MA_INVALID_OPERATION;
} }
if (iChannel < pScreen->channelCount-1) { if (iChannel < pScreen->channelCount-1) {
...@@ -337,29 +337,29 @@ mal_result msigvis_screen_remove_channel_by_index(msigvis_screen* pScreen, mal_u ...@@ -337,29 +337,29 @@ mal_result msigvis_screen_remove_channel_by_index(msigvis_screen* pScreen, mal_u
pScreen->channelCount -= 1; pScreen->channelCount -= 1;
msigvis_screen_redraw(pScreen); msigvis_screen_redraw(pScreen);
return MAL_SUCCESS; return MA_SUCCESS;
} }
mal_result msigvis_screen_find_channel_index(msigvis_screen* pScreen, msigvis_channel* pChannel, mal_uint32* pIndex) mal_result msigvis_screen_find_channel_index(msigvis_screen* pScreen, msigvis_channel* pChannel, mal_uint32* pIndex)
{ {
if (pScreen == NULL || pChannel == NULL) { if (pScreen == NULL || pChannel == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
for (mal_uint32 iChannel = 0; iChannel < pScreen->channelCount; ++iChannel) { for (mal_uint32 iChannel = 0; iChannel < pScreen->channelCount; ++iChannel) {
if (pScreen->ppChannels[iChannel] == pChannel) { if (pScreen->ppChannels[iChannel] == pChannel) {
*pIndex = iChannel; *pIndex = iChannel;
return MAL_SUCCESS; return MA_SUCCESS;
} }
} }
return MAL_ERROR; return MA_ERROR;
} }
mal_result msigvis_screen_redraw(msigvis_screen* pScreen) mal_result msigvis_screen_redraw(msigvis_screen* pScreen)
{ {
if (pScreen == NULL) { if (pScreen == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
return msigvis_result_from_dtk(dtk_window_scheduled_redraw(&pScreen->window, dtk_window_get_client_rect(&pScreen->window))); return msigvis_result_from_dtk(dtk_window_scheduled_redraw(&pScreen->window, dtk_window_get_client_rect(&pScreen->window)));
...@@ -376,20 +376,20 @@ mal_result msigvis_channel_init(msigvis_context* pContext, mal_format format, ma ...@@ -376,20 +376,20 @@ mal_result msigvis_channel_init(msigvis_context* pContext, mal_format format, ma
(void)pContext; (void)pContext;
if (pChannel == NULL) { if (pChannel == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
mal_zero_object(pChannel); mal_zero_object(pChannel);
if (format == mal_format_unknown || sampleRate == 0) { if (format == mal_format_unknown || sampleRate == 0) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
pChannel->format = format; pChannel->format = format;
pChannel->sampleRate = sampleRate; pChannel->sampleRate = sampleRate;
pChannel->color = dtk_rgb(255, 255, 255); pChannel->color = dtk_rgb(255, 255, 255);
return MAL_SUCCESS; return MA_SUCCESS;
} }
void msigvis_channel_uninit(msigvis_channel* pChannel) void msigvis_channel_uninit(msigvis_channel* pChannel)
...@@ -404,7 +404,7 @@ void msigvis_channel_uninit(msigvis_channel* pChannel) ...@@ -404,7 +404,7 @@ void msigvis_channel_uninit(msigvis_channel* pChannel)
mal_result msigvis_channel_push_samples(msigvis_channel* pChannel, mal_uint32 sampleCount, const void* pSamples) mal_result msigvis_channel_push_samples(msigvis_channel* pChannel, mal_uint32 sampleCount, const void* pSamples)
{ {
if (pChannel == NULL) { if (pChannel == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
mal_uint32 bps = mal_get_bytes_per_sample(pChannel->format); mal_uint32 bps = mal_get_bytes_per_sample(pChannel->format);
...@@ -418,7 +418,7 @@ mal_result msigvis_channel_push_samples(msigvis_channel* pChannel, mal_uint32 sa ...@@ -418,7 +418,7 @@ mal_result msigvis_channel_push_samples(msigvis_channel* pChannel, mal_uint32 sa
mal_uint8* pNewBuffer = (mal_uint8*)mal_realloc(pChannel->pBuffer, newBufferCapInSamples*bps); mal_uint8* pNewBuffer = (mal_uint8*)mal_realloc(pChannel->pBuffer, newBufferCapInSamples*bps);
if (pNewBuffer == NULL) { if (pNewBuffer == NULL) {
return MAL_OUT_OF_MEMORY; return MA_OUT_OF_MEMORY;
} }
pChannel->pBuffer = pNewBuffer; pChannel->pBuffer = pNewBuffer;
...@@ -428,13 +428,13 @@ mal_result msigvis_channel_push_samples(msigvis_channel* pChannel, mal_uint32 sa ...@@ -428,13 +428,13 @@ mal_result msigvis_channel_push_samples(msigvis_channel* pChannel, mal_uint32 sa
mal_copy_memory(pChannel->pBuffer + pChannel->sampleCount*bps, pSamples, sampleCount*bps); mal_copy_memory(pChannel->pBuffer + pChannel->sampleCount*bps, pSamples, sampleCount*bps);
pChannel->sampleCount += sampleCount; pChannel->sampleCount += sampleCount;
return MAL_SUCCESS; return MA_SUCCESS;
} }
mal_result msigvis_channel_pop_samples(msigvis_channel* pChannel, mal_uint32 sampleCount) mal_result msigvis_channel_pop_samples(msigvis_channel* pChannel, mal_uint32 sampleCount)
{ {
if (pChannel == NULL) { if (pChannel == NULL) {
return MAL_INVALID_ARGS; return MA_INVALID_ARGS;
} }
if (sampleCount > pChannel->sampleCount) { if (sampleCount > pChannel->sampleCount) {
...@@ -450,7 +450,7 @@ mal_result msigvis_channel_pop_samples(msigvis_channel* pChannel, mal_uint32 sam ...@@ -450,7 +450,7 @@ mal_result msigvis_channel_pop_samples(msigvis_channel* pChannel, mal_uint32 sam
memmove(pChannel->pBuffer, pChannel->pBuffer + bytesToRemove, pChannel->sampleCount*bps - bytesToRemove); memmove(pChannel->pBuffer, pChannel->pBuffer + bytesToRemove, pChannel->sampleCount*bps - bytesToRemove);
pChannel->sampleCount -= sampleCount; pChannel->sampleCount -= sampleCount;
return MAL_SUCCESS; return MA_SUCCESS;
} }
float msigvis_channel_get_sample_f32(msigvis_channel* pChannel, mal_uint32 iSample) float msigvis_channel_get_sample_f32(msigvis_channel* pChannel, mal_uint32 iSample)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment