Update examples.

This commit is contained in:
David Reid
2016-11-14 20:02:41 +10:00
parent 262452139f
commit 1d9ccdec51
2 changed files with 21 additions and 4 deletions
+10 -2
View File
@@ -29,6 +29,12 @@ int main(int argc, char** argv)
printf("Not a valid WAV file.");
return -2;
}
mal_context context;
if (mal_context_init(NULL, 0, &context) != MAL_SUCCESS) {
printf("Failed to initialize context.");
return -3;
}
// In this example we use the default playback device with a default buffer size and period count.
mal_device_config config;
@@ -43,10 +49,11 @@ int main(int argc, char** argv)
config.onLogCallback = NULL;
mal_device device;
if (mal_device_init(&device, mal_device_type_playback, NULL, &config, &wav) != MAL_SUCCESS) {
if (mal_device_init(&context, mal_device_type_playback, NULL, &config, &wav, &device) != MAL_SUCCESS) {
printf("Failed to open playback device.");
mal_context_uninit(&context);
drwav_uninit(&wav);
return -3;
return -4;
}
mal_device_start(&device);
@@ -54,6 +61,7 @@ int main(int argc, char** argv)
getchar();
mal_device_uninit(&device);
mal_context_uninit(&context);
drwav_uninit(&wav);
return 0;