static value openflkinect_get_is_capturing(value ref)
{
  val_check_kind(ref, k_Kinect);
  Kinect* k = static_cast<Kinect*>(val_data(ref));

  return alloc_bool(k->isCapturing());
}
static value openflkinect_get_user_count(value ref)
{
  val_check_kind(ref, k_Kinect);
  Kinect* k = static_cast<Kinect*>(val_data(ref));

  if ( k->isCapturing() == false )
  {
    return alloc_int(0);
  }

  return alloc_int(k->getUserCount());
}
static value openflkinect_depth_frame_rate(value ref)
{
  val_check_kind(ref, k_Kinect);
  Kinect* k = static_cast<Kinect*>(val_data(ref));

  if ( k->isCapturing() == false )
  {
    return alloc_float(0.0f);
  }

  return alloc_float(k->depthFrameRate());
}
static value openflkinect_update_depth_pixels(value ref, value depthArray)
{
  val_check_kind(ref, k_Kinect);
  Kinect* k = static_cast<Kinect*>(val_data(ref));

  int* ints = val_array_int(depthArray);
  if ( ! ints )
  {
    return alloc_bool(false);
  }

  if ( k->isCapturing() == false )
  {
    return alloc_bool(false);
  }

  int* depth = k->depthPixels();
  int dims = k->getDeviceOptions().numDepthPixels();
  memcpy(ints, depth, dims*sizeof(int));
  return alloc_bool(true);
}