Add verbose error logging for opensles and oboe (#627)

This commit is contained in:
Tom M 2020-03-07 14:14:28 +01:00 committed by GitHub
parent cabb219285
commit c9d023230a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 9 deletions

View File

@ -126,7 +126,6 @@ new_fluid_oboe_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
try
{
dev = FLUID_NEW(fluid_oboe_audio_driver_t);
if(dev == NULL)
@ -171,21 +170,25 @@ new_fluid_oboe_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
->setCallback(dev->oboe_callback);
result = builder->openStream(&stream);
dev->stream = stream;
if(result != Result::OK)
{
FLUID_LOG(FLUID_ERR, "Unable to open Oboe audio stream");
goto error_recovery;
}
dev->stream = stream;
dev->cont = 1;
FLUID_LOG(FLUID_INFO, "Using Oboe driver");
stream->start();
result = stream->start();
if(result != Result::OK)
{
FLUID_LOG(FLUID_ERR, "Unable to start Oboe audio stream");
goto error_recovery;
}
return reinterpret_cast<fluid_audio_driver_t *>(dev);
}
catch(...)
{

View File

@ -109,7 +109,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(!dev->engine)
{
FLUID_LOG(FLUID_ERR, "Failed to create OpenSLES connection");
FLUID_LOG(FLUID_ERR, "Failed to create the OpenSL ES engine, error code 0x%lx", result);
goto error_recovery;
}
@ -117,6 +117,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to realize the OpenSL ES engine, error code 0x%lx", result);
goto error_recovery;
}
@ -124,6 +125,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to retrieve the OpenSL ES engine interface, error code 0x%lx", result);
goto error_recovery;
}
@ -131,6 +133,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to create the OpenSL ES output mix object, error code 0x%lx", result);
goto error_recovery;
}
@ -138,6 +141,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to realize the OpenSL ES output mix object, error code 0x%lx", result);
goto error_recovery;
}
@ -179,6 +183,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to create the OpenSL ES audio player object, error code 0x%lx", result);
goto error_recovery;
}
@ -186,6 +191,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to realize the OpenSL ES audio player object, error code 0x%lx", result);
goto error_recovery;
}
@ -194,6 +200,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to retrieve the OpenSL ES audio player interface, error code 0x%lx", result);
goto error_recovery;
}
@ -202,6 +209,7 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to retrieve the OpenSL ES buffer queue interface, error code 0x%lx", result);
goto error_recovery;
}
@ -224,23 +232,38 @@ new_fluid_opensles_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to register the opensles_callback, error code 0x%lx", result);
goto error_recovery;
}
if(dev->is_sample_format_float)
{
(*dev->player_buffer_queue_interface)->Enqueue(dev->player_buffer_queue_interface, dev->sles_buffer_float, dev->period_frames * NUM_CHANNELS * sizeof(float));
result = (*dev->player_buffer_queue_interface)->Enqueue(dev->player_buffer_queue_interface, dev->sles_buffer_float, dev->period_frames * NUM_CHANNELS * sizeof(float));
}
else
{
(*dev->player_buffer_queue_interface)->Enqueue(dev->player_buffer_queue_interface, dev->sles_buffer_short, dev->period_frames * NUM_CHANNELS * sizeof(short));
result = (*dev->player_buffer_queue_interface)->Enqueue(dev->player_buffer_queue_interface, dev->sles_buffer_short, dev->period_frames * NUM_CHANNELS * sizeof(short));
}
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to add a buffer to the queue, error code 0x%lx", result);
goto error_recovery;
}
result = (*dev->audio_player_interface)->SetCallbackEventsMask(dev->audio_player_interface, SL_PLAYEVENT_HEADATEND);
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to set OpenSL ES audio player callback events, error code 0x%lx", result);
goto error_recovery;
}
(*dev->audio_player_interface)->SetCallbackEventsMask(dev->audio_player_interface, SL_PLAYEVENT_HEADATEND);
result = (*dev->audio_player_interface)->SetPlayState(dev->audio_player_interface, SL_PLAYSTATE_PLAYING);
if(result != SL_RESULT_SUCCESS)
{
FLUID_LOG(FLUID_ERR, "Failed to set OpenSL ES audio player play state to playing, error code 0x%lx", result);
goto error_recovery;
}