From e5370c114be858ae48b5e3019e311e28a6723c1e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 24 Mar 2017 01:46:28 +0100 Subject: [PATCH] Update logs --- audio/drivers/jack.c | 20 ++++++++++---------- audio/drivers/opensl.c | 6 +++--- audio/drivers/oss.c | 4 ++-- audio/drivers/sdl_audio.c | 13 ++++++++----- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/audio/drivers/jack.c b/audio/drivers/jack.c index f56670e0b3..b3dd64f5ac 100644 --- a/audio/drivers/jack.c +++ b/audio/drivers/jack.c @@ -136,12 +136,12 @@ static size_t find_buffersize(jack_t *jd, int latency, unsigned out_rate) jack_latency = range.max; } - RARCH_LOG("JACK: Jack latency is %d frames.\n", jack_latency); + RARCH_LOG("[JACK]: Jack latency is %d frames.\n", jack_latency); - buffer_frames = frames - jack_latency; + buffer_frames = frames - jack_latency; min_buffer_frames = jack_get_buffer_size(jd->client) * 2; - RARCH_LOG("JACK: Minimum buffer size is %d frames.\n", min_buffer_frames); + RARCH_LOG("[JACK]: Minimum buffer size is %d frames.\n", min_buffer_frames); if (buffer_frames < min_buffer_frames) buffer_frames = min_buffer_frames; @@ -181,27 +181,27 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency, jd->ports[1] = jack_port_register(jd->client, "right", JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); if (jd->ports[0] == NULL || jd->ports[1] == NULL) { - RARCH_ERR("Failed to register ports.\n"); + RARCH_ERR("[JACK]: Failed to register ports.\n"); goto error; } jports = jack_get_ports(jd->client, NULL, NULL, JackPortIsPhysical | JackPortIsInput); if (jports == NULL) { - RARCH_ERR("Failed to get ports.\n"); + RARCH_ERR("[JACK]: Failed to get ports.\n"); goto error; } - bufsize = find_buffersize(jd, latency, *new_rate); + bufsize = find_buffersize(jd, latency, *new_rate); jd->buffer_size = bufsize; - RARCH_LOG("JACK: Internal buffer size: %d frames.\n", (int)(bufsize / sizeof(jack_default_audio_sample_t))); + RARCH_LOG("[JACK]: Internal buffer size: %d frames.\n", (int)(bufsize / sizeof(jack_default_audio_sample_t))); for (i = 0; i < 2; i++) { jd->buffer[i] = jack_ringbuffer_create(bufsize); if (jd->buffer[i] == NULL) { - RARCH_ERR("Failed to create buffers.\n"); + RARCH_ERR("[JACK]: Failed to create buffers.\n"); goto error; } } @@ -210,7 +210,7 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency, if (jack_activate(jd->client) < 0) { - RARCH_ERR("Failed to activate Jack...\n"); + RARCH_ERR("[JACK]: Failed to activate Jack...\n"); goto error; } @@ -218,7 +218,7 @@ static void *ja_init(const char *device, unsigned rate, unsigned latency, { if (jack_connect(jd->client, jack_port_name(jd->ports[i]), dest_ports[i])) { - RARCH_ERR("Failed to connect to Jack port.\n"); + RARCH_ERR("[JACK]: Failed to connect to Jack port.\n"); goto error; } } diff --git a/audio/drivers/opensl.c b/audio/drivers/opensl.c index d83d081815..7c9bd739d5 100644 --- a/audio/drivers/opensl.c +++ b/audio/drivers/opensl.c @@ -116,7 +116,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency, if (!sl) goto error; - RARCH_LOG("[SLES]: Requested audio latency: %u ms.", latency); + RARCH_LOG("[OpenSL]: Requested audio latency: %u ms.", latency); GOTO_IF_FAIL(slCreateEngine(&sl->engine_object, 0, NULL, 0, NULL, NULL)); GOTO_IF_FAIL(SLObjectItf_Realize(sl->engine_object, SL_BOOLEAN_FALSE)); @@ -144,7 +144,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency, for (i = 0; i < sl->buf_count; i++) sl->buffer[i] = sl->buffer_chunk + i * sl->buf_size; - RARCH_LOG("[SLES]: Setting audio latency: Block size = %u, Blocks = %u, Total = %u ...\n", + RARCH_LOG("[OpenSL]: Setting audio latency: Block size = %u, Blocks = %u, Total = %u ...\n", sl->buf_size, sl->buf_count, sl->buf_size * sl->buf_count); fmt_pcm.formatType = SL_DATAFORMAT_PCM; @@ -192,7 +192,7 @@ static void *sl_init(const char *device, unsigned rate, unsigned latency, return sl; error: - RARCH_ERR("Couldn't initialize OpenSL ES driver, error code: [%d].\n", (int)res); + RARCH_ERR("[OpenSL]: Couldn't initialize OpenSL ES driver, error code: [%d].\n", (int)res); sl_free(sl); return NULL; } diff --git a/audio/drivers/oss.c b/audio/drivers/oss.c index d85f5d345d..1f8bd80259 100644 --- a/audio/drivers/oss.c +++ b/audio/drivers/oss.c @@ -168,7 +168,7 @@ static size_t oss_write_avail(void *data) if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { - RARCH_ERR("SNDCTL_DSP_GETOSPACE failed ...\n"); + RARCH_ERR("[OSS]: SNDCTL_DSP_GETOSPACE failed ...\n"); return 0; } @@ -182,7 +182,7 @@ static size_t oss_buffer_size(void *data) if (ioctl(*fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { - RARCH_ERR("SNDCTL_DSP_GETOSPACE failed ...\n"); + RARCH_ERR("[OSS]: SNDCTL_DSP_GETOSPACE failed ...\n"); return 1; /* Return something non-zero to avoid SIGFPE. */ } diff --git a/audio/drivers/sdl_audio.c b/audio/drivers/sdl_audio.c index 53fb490909..a53ecccd03 100644 --- a/audio/drivers/sdl_audio.c +++ b/audio/drivers/sdl_audio.c @@ -96,7 +96,7 @@ static void *sdl_audio_init(const char *device, * carry approximately half of the latency. * * SDL double buffers audio and we do as well. */ - frames = find_num_frames(rate, latency / 4); + frames = find_num_frames(rate, latency / 4); spec.freq = rate; spec.format = AUDIO_S16SYS; @@ -107,9 +107,8 @@ static void *sdl_audio_init(const char *device, if (SDL_OpenAudio(&spec, &out) < 0) { - RARCH_ERR("Failed to open SDL audio: %s\n", SDL_GetError()); - free(sdl); - return 0; + RARCH_ERR("[SDL audio]: Failed to open SDL audio: %s\n", SDL_GetError()); + goto error; } *new_rate = out.freq; @@ -119,7 +118,7 @@ static void *sdl_audio_init(const char *device, sdl->cond = scond_new(); #endif - RARCH_LOG("SDL audio: Requested %u ms latency, got %d ms\n", + RARCH_LOG("[SDL audio]: Requested %u ms latency, got %d ms\n", latency, (int)(out.samples * 4 * 1000 / (*new_rate))); /* Create a buffer twice as big as needed and prefill the buffer. */ @@ -135,6 +134,10 @@ static void *sdl_audio_init(const char *device, SDL_PauseAudio(0); return sdl; + +error: + free(sdl); + return NULL; } static ssize_t sdl_audio_write(void *data, const void *buf, size_t size,