Add context initialisation to miniaudio backend
This is used for mutexes in the enhanced backend
This commit is contained in:
parent
bf8d824b70
commit
8e2d8ab962
1 changed files with 27 additions and 14 deletions
|
@ -82,7 +82,11 @@ bool AudioBackend_Init(void)
|
||||||
|
|
||||||
ma_result return_value;
|
ma_result return_value;
|
||||||
|
|
||||||
return_value = ma_device_init(NULL, &config, &device);
|
return_value = ma_context_init(NULL, 0, NULL, &context);
|
||||||
|
|
||||||
|
if (return_value == MA_SUCCESS)
|
||||||
|
{
|
||||||
|
return_value = ma_device_init(&context, &config, &device);
|
||||||
|
|
||||||
if (return_value == MA_SUCCESS)
|
if (return_value == MA_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +134,13 @@ bool AudioBackend_Init(void)
|
||||||
Backend_PrintError("Failed to initialize playback device: %s", ma_result_description(return_value));
|
Backend_PrintError("Failed to initialize playback device: %s", ma_result_description(return_value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ma_context_uninit(&context);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Backend_PrintError("Failed to initialize context: %s", ma_result_description(return_value));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -146,6 +157,8 @@ void AudioBackend_Deinit(void)
|
||||||
ma_mutex_uninit(&mutex);
|
ma_mutex_uninit(&mutex);
|
||||||
|
|
||||||
ma_device_uninit(&device);
|
ma_device_uninit(&device);
|
||||||
|
|
||||||
|
ma_context_uninit(&context);
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
|
AudioBackend_Sound* AudioBackend_CreateSound(unsigned int frequency, const unsigned char *samples, size_t length)
|
||||||
|
|
Loading…
Add table
Reference in a new issue