mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-01-27 06:11:51 +00:00
Style nits
This commit is contained in:
parent
57c20bdee7
commit
0aa4edafcf
@ -15,8 +15,6 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* See https://github.com/tinyalsa/tinyalsa */
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
@ -25,7 +23,8 @@
|
||||
#include "../audio_driver.h"
|
||||
#include "../../verbosity.h"
|
||||
|
||||
typedef struct tinyalsa {
|
||||
typedef struct tinyalsa
|
||||
{
|
||||
struct pcm *pcm;
|
||||
size_t buffer_size;
|
||||
bool nonblock;
|
||||
@ -40,14 +39,12 @@ typedef long pcm_sframes_t;
|
||||
#define BYTES_TO_FRAMES(bytes, frame_bits) ((bytes) * 8 / frame_bits)
|
||||
#define FRAMES_TO_BYTES(frames, frame_bits) ((frames) * frame_bits / 8)
|
||||
|
||||
static void *
|
||||
tinyalsa_init(const char *device, unsigned rate,
|
||||
static void * tinyalsa_init(const char *device, unsigned rate,
|
||||
unsigned latency, unsigned block_frames,
|
||||
unsigned *new_rate)
|
||||
{
|
||||
pcm_sframes_t buffer_size;
|
||||
struct pcm_config config;
|
||||
|
||||
tinyalsa_t *tinyalsa = (tinyalsa_t*)calloc(1, sizeof(tinyalsa_t));
|
||||
if (!tinyalsa)
|
||||
return NULL;
|
||||
@ -63,10 +60,13 @@ tinyalsa_init(const char *device, unsigned rate,
|
||||
|
||||
tinyalsa->pcm = pcm_open(0, 0, PCM_OUT, &config);
|
||||
|
||||
if (tinyalsa->pcm == NULL) {
|
||||
if (tinyalsa->pcm == NULL)
|
||||
{
|
||||
RARCH_ERR("[TINYALSA]: Failed to allocate memory for pcm.\n");
|
||||
goto error;
|
||||
} else if (!pcm_is_ready(tinyalsa->pcm)) {
|
||||
}
|
||||
else if (!pcm_is_ready(tinyalsa->pcm))
|
||||
{
|
||||
RARCH_ERR("[TINYALSA]: Cannot open audio device.\n");
|
||||
goto error;
|
||||
}
|
||||
@ -162,7 +162,8 @@ tinyalsa_stop(void *data)
|
||||
{
|
||||
tinyalsa_t *tinyalsa = (tinyalsa_t*)data;
|
||||
|
||||
if (tinyalsa->can_pause && !tinyalsa->is_paused) {
|
||||
if (tinyalsa->can_pause && !tinyalsa->is_paused)
|
||||
{
|
||||
int ret = pcm_start(tinyalsa->pcm);
|
||||
if (ret < 0)
|
||||
return false;
|
||||
@ -189,10 +190,12 @@ tinyalsa_start(void *data, bool is_shutdown)
|
||||
{
|
||||
tinyalsa_t *tinyalsa = (tinyalsa_t*)data;
|
||||
|
||||
if (tinyalsa->can_pause && tinyalsa->is_paused) {
|
||||
if (tinyalsa->can_pause && tinyalsa->is_paused)
|
||||
{
|
||||
int ret = pcm_stop(tinyalsa->pcm);
|
||||
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
RARCH_ERR("[TINYALSA]: Failed to unpause.\n");
|
||||
return false;
|
||||
}
|
||||
@ -223,11 +226,11 @@ tinyalsa_free(void *data)
|
||||
{
|
||||
tinyalsa_t *tinyalsa = (tinyalsa_t*)data;
|
||||
|
||||
if (tinyalsa) {
|
||||
if (tinyalsa->pcm) {
|
||||
if (tinyalsa)
|
||||
{
|
||||
if (tinyalsa->pcm)
|
||||
pcm_close(tinyalsa->pcm);
|
||||
tinyalsa->pcm = NULL;
|
||||
}
|
||||
free(tinyalsa);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user