Commit 046bc0d7 authored by David Reid's avatar David Reid

Add initial experimental work on the ma_engine API.

parent 0d691012
#define DR_FLAC_IMPLEMENTATION
#include "../extras/dr_flac.h" /* Enables FLAC decoding. */
#define DR_MP3_IMPLEMENTATION
#include "../extras/dr_mp3.h" /* Enables MP3 decoding. */
#define DR_WAV_IMPLEMENTATION
#include "../extras/dr_wav.h" /* Enables WAV decoding. */
#define MA_DEBUG_OUTPUT
#define MA_IMPLEMENTATION
#include "../miniaudio.h"
#include "ma_engine.h"
int main(int argc, char** argv)
{
ma_result result;
ma_engine engine;
ma_sound sound1;
(void)argc;
(void)argv;
result = ma_engine_init(NULL, &engine);
if (result != MA_SUCCESS) {
printf("Failed to initialize audio engine.\n");
return (int)result;
}
/* Currently an explicit start is required. Perhaps make it so this is started by default, or maybe start it when the first sound is started? Maybe make it an option? */
result = ma_engine_start(&engine); /* Do we want the engine to be started by default? */
if (result != MA_SUCCESS) {
ma_engine_uninit(&engine);
return (int)result;
}
/* We can load our resource after starting the engine - the engine will deal with loading everything properly. */
if (argc > 1) {
result = ma_engine_create_sound_from_file(&engine, argv[1], NULL, &sound1);
if (result != MA_SUCCESS) {
ma_engine_uninit(&engine);
return (int)result;
}
ma_engine_sound_start(&engine, &sound1);
}
printf("Press Enter to quit...");
getchar();
return 0;
}
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