Use type long for delay as it corresp[onds with the alsa type used

This commit is contained in:
Mike Brady
2016-03-29 12:04:34 +00:00
parent c24c6bb265
commit 82a033e590
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ typedef struct {
// almost certainly wrong if the buffer is empty, so put silent buffers into it to make it busy.
// will change dynamically, so keep watching it. Implemented in ALSA only.
// returns -1 if there's a problem
int32_t (*delay)();
long (*delay)(); // snd_pcm_sframes_t is a signed long
// may be NULL, in which case soft volume is applied
void (*volume)(double vol);
+3 -2
View File
@@ -42,7 +42,7 @@ static void start(int sample_rate);
static void play(short buf[], int samples);
static void stop(void);
static void flush(void);
static int32_t delay(void);
static long delay(void);
static void volume(double vol);
static void linear_volume(double vol);
static void parameters(audio_parameters *info);
@@ -413,13 +413,14 @@ static void start(int sample_rate) {
desired_sample_rate = sample_rate; // must be a variable
}
static int32_t delay() {
static long delay() {
// debug(3,"audio_alsa delay called.");
if (alsa_handle == NULL) {
return 0;
} else {
pthread_mutex_lock(&alsa_mutex);
snd_pcm_sframes_t current_avail, current_delay = 0;
//snd_pcm_sframes_t is a signed long -- hence the return of a "long"
int derr, ignore;
if (snd_pcm_state(alsa_handle) == SND_PCM_STATE_RUNNING) {
// derr = snd_pcm_avail_delay(alsa_handle, &current_avail, &current_delay);