Commit ac158cd0 authored by David Reid's avatar David Reid

Add early support for OSS.

parent c15dcfb8
#define MAL_IMPLEMENTATION
#include "../mini_al.h"
#define DR_WAV_IMPLEMENTATION
#include "dr_wav.h"
#include <stdio.h>
int main(int argc, char** argv)
{
if (argc < 2) {
printf("No input file.");
return -1;
}
mal_context context;
if (mal_context_init(NULL, 0, &context) != MAL_SUCCESS) {
printf("Failed to initialize context.");
return -2;
}
mal_device_info infos[32];
mal_uint32 infoCount = sizeof(infos) / sizeof(infos[0]);
// Playback devices.
mal_result result = mal_enumerate_devices(&context, mal_device_type_playback, &infoCount, infos);
if (result != MAL_SUCCESS) {
printf("Failed to enumerate playback devices.");
mal_context_uninit(&context);
return -3;
}
printf("Playback Devices\n");
for (mal_uint32 iDevice = 0; iDevice < infoCount; ++iDevice) {
printf(" %u: %s\n", iDevice, infos[iDevice].name);
}
printf("\n");
// Capture devices.
result = mal_enumerate_devices(&context, mal_device_type_capture, &infoCount, infos);
if (result != MAL_SUCCESS) {
printf("Failed to enumerate capture devices.");
mal_context_uninit(&context);
return -4;
}
printf("Capture Devices\n");
for (mal_uint32 iDevice = 0; iDevice < infoCount; ++iDevice) {
printf(" %u: %s\n", iDevice, infos[iDevice].name);
}
mal_context_uninit(&context);
return 0;
}
...@@ -33,6 +33,7 @@ int main(int argc, char** argv) ...@@ -33,6 +33,7 @@ int main(int argc, char** argv)
mal_context context; mal_context context;
if (mal_context_init(NULL, 0, &context) != MAL_SUCCESS) { if (mal_context_init(NULL, 0, &context) != MAL_SUCCESS) {
printf("Failed to initialize context."); printf("Failed to initialize context.");
drwav_uninit(&wav);
return -3; return -3;
} }
...@@ -55,4 +56,4 @@ int main(int argc, char** argv) ...@@ -55,4 +56,4 @@ int main(int argc, char** argv)
drwav_uninit(&wav); drwav_uninit(&wav);
return 0; return 0;
} }
\ No newline at end of file
This diff is collapsed.
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