/* Pause the jack device */ static void jack_pause (bool_t p) { TRACE("p == %d\n", p); paused = p; /* pause the device if p is non-zero, unpause the device if p is zero and */ /* we are currently paused */ if(p) JACK_SetState(driver, PAUSED); else if(JACK_GetState(driver) == PAUSED) JACK_SetState(driver, PLAYING); }
/* been played out of the audio device, not including the buffer */ static int jack_get_output_time(void) { int return_val; /* don't try to get any values if the device is still closed */ if(JACK_GetState(driver) == CLOSED) return_val = 0; else return_val = JACK_GetPosition(driver, MILLISECONDS, PLAYED); /* get played position in terms of milliseconds */ TRACE("returning %d milliseconds\n", return_val); return return_val; }
static int jack_playing(void) { int return_val; /* If we are playing see if we ACTUALLY have something to play */ if(JACK_GetState(driver) == PLAYING) { /* If we have zero bytes stored, we are done playing */ if(JACK_GetBytesStored(driver) == 0) return_val = FALSE; else return_val = TRUE; } else return_val = FALSE; TRACE("returning %d\n", return_val); return return_val; }
CAMLprim value caml_bjack_get_state(value d) { CAMLparam1(d); CAMLreturn(Val_int(JACK_GetState(Bjack_drv_val(d)))); }