QNX ALSA is too different from regular mainline ALSA - QNX ALSA driver
will be separate from main ALSA driver
This commit is contained in:
parent
57a36bd6ff
commit
3a0cc21d7a
19
audio/alsa.c
19
audio/alsa.c
|
@ -16,13 +16,7 @@
|
||||||
|
|
||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef __QNX__
|
|
||||||
#define ALSA_PCM_NEW_HW_PARAMS_API
|
|
||||||
#define ALSA_PCM_NEW_SW_PARAMS_API
|
|
||||||
#include <sys/asoundlib.h>
|
|
||||||
#else
|
|
||||||
#include <asoundlib.h>
|
#include <asoundlib.h>
|
||||||
#endif
|
|
||||||
#include "../general.h"
|
#include "../general.h"
|
||||||
|
|
||||||
#define TRY_ALSA(x) if (x < 0) { \
|
#define TRY_ALSA(x) if (x < 0) { \
|
||||||
|
@ -47,14 +41,12 @@ static bool alsa_use_float(void *data)
|
||||||
|
|
||||||
static bool find_float_format(snd_pcm_t *pcm, void *data)
|
static bool find_float_format(snd_pcm_t *pcm, void *data)
|
||||||
{
|
{
|
||||||
#ifndef __QNX__
|
|
||||||
snd_pcm_hw_params_t *params = (snd_pcm_hw_params_t*)data;
|
snd_pcm_hw_params_t *params = (snd_pcm_hw_params_t*)data;
|
||||||
if (snd_pcm_hw_params_test_format(pcm, params, SND_PCM_FORMAT_FLOAT) == 0)
|
if (snd_pcm_hw_params_test_format(pcm, params, SND_PCM_FORMAT_FLOAT) == 0)
|
||||||
{
|
{
|
||||||
RARCH_LOG("ALSA: Using floating point format.\n");
|
RARCH_LOG("ALSA: Using floating point format.\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
RARCH_LOG("ALSA: Using signed 16-bit format.\n");
|
RARCH_LOG("ALSA: Using signed 16-bit format.\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -65,23 +57,14 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||||
if (!alsa)
|
if (!alsa)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifndef __QNX__
|
|
||||||
snd_pcm_hw_params_t *params = NULL;
|
snd_pcm_hw_params_t *params = NULL;
|
||||||
snd_pcm_sw_params_t *sw_params = NULL;
|
snd_pcm_sw_params_t *sw_params = NULL;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
unsigned latency_usec = latency * 1000;
|
unsigned latency_usec = latency * 1000;
|
||||||
unsigned channels = 2;
|
unsigned channels = 2;
|
||||||
unsigned periods = 4;
|
unsigned periods = 4;
|
||||||
snd_pcm_format_t format;
|
snd_pcm_format_t format;
|
||||||
|
|
||||||
#ifdef __QNX__
|
|
||||||
int card, dev;
|
|
||||||
TRY_ALSA(snd_pcm_open_preferred(&alsa->pcm, &card, &dev, SND_PCM_OPEN_PLAYBACK));
|
|
||||||
alsa->has_float = false;
|
|
||||||
format = SND_PCM_FORMAT_S16;
|
|
||||||
#else
|
|
||||||
const char *alsa_dev = "default";
|
const char *alsa_dev = "default";
|
||||||
if (device)
|
if (device)
|
||||||
alsa_dev = device;
|
alsa_dev = device;
|
||||||
|
@ -119,7 +102,6 @@ static void *alsa_init(const char *device, unsigned rate, unsigned latency)
|
||||||
|
|
||||||
snd_pcm_hw_params_free(params);
|
snd_pcm_hw_params_free(params);
|
||||||
snd_pcm_sw_params_free(sw_params);
|
snd_pcm_sw_params_free(sw_params);
|
||||||
#endif
|
|
||||||
|
|
||||||
return alsa;
|
return alsa;
|
||||||
|
|
||||||
|
@ -302,4 +284,3 @@ const audio_driver_t audio_alsa = {
|
||||||
alsa_write_avail,
|
alsa_write_avail,
|
||||||
alsa_buffer_size,
|
alsa_buffer_size,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue