From: Mike Brady Date: Tue, 29 Mar 2016 12:04:34 +0000 (+0000) Subject: Use type long for delay as it corresp[onds with the alsa type used X-Git-Tag: 2.9.5.7~19^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=82a033e59031c50f83046b5b25e67506b2419ebc;p=thirdparty%2Fshairport-sync.git Use type long for delay as it corresp[onds with the alsa type used --- diff --git a/audio.h b/audio.h index 54b04e95..2fbd2e05 100644 --- a/audio.h +++ b/audio.h @@ -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); diff --git a/audio_alsa.c b/audio_alsa.c index e29450fc..06cc1bd0 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -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, ¤t_avail, ¤t_delay);