Skip to content

Commit

Permalink
Use type long for delay as it corresp[onds with the alsa type used
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrady committed Mar 29, 2016
1 parent c24c6bb commit 82a033e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions audio_alsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 82a033e

Please sign in to comment.