示例#1
0
static int kr_mixer_response_get_string_from_subunit_control (kr_crate_t *crate, char **string) {

  int len;
  float real;

  len = 0;

  if (crate->addr->path.subunit.mixer_subunit == KR_PORTGROUP) {
    if ((crate->addr->control.portgroup_control == KR_VOLUME) || (crate->addr->control.portgroup_control == KR_CROSSFADE) ||
         (crate->addr->control.portgroup_control == KR_PEAK)) {
      kr_ebml2_unpack_element_float (&crate->payload_ebml, NULL, &real);
      len += sprintf (*string + len, "%5.2f", real);
    }
    if ((crate->addr->control.portgroup_control == KR_CROSSFADE_GROUP) || (crate->addr->control.portgroup_control == KR_XMMS2_IPC_PATH)) {
      kr_ebml2_unpack_element_string (&crate->payload_ebml, NULL, *string + len, 32);
      len += strlen (*string + len);
    }
  } else {
    if (crate->addr->path.subunit.mixer_subunit == KR_EFFECT) {
      kr_ebml2_unpack_element_float (&crate->payload_ebml, NULL, &real);
      len += sprintf (*string + len, "%5.2f", real);
    }
  }
    
  return len; 
}
int kr_mixer_path_info_fr_ebml(kr_ebml *ebml, void *st) {
  uber_St uber;
  int i;
  int res;
  struct kr_mixer_path_info *actual;

  res = 0;

  if ((ebml == NULL) || (st == NULL)) {
    return -1;
  }

  actual = (struct kr_mixer_path_info *)st;

  res += kr_ebml2_unpack_element_string(ebml, NULL, actual->name , sizeof(actual->name));
  res += kr_ebml2_unpack_element_string(ebml, NULL, actual->bus , sizeof(actual->bus));
  res += kr_ebml2_unpack_element_string(ebml, NULL, actual->crossfade_group , sizeof(actual->crossfade_group));
  uber.actual = &(actual->channels);
  uber.type = DEBML_KR_MIXER_CHANNELS;
  res += info_unpack_fr_ebml(&ebml[res],&uber);
  uber.actual = &(actual->type);
  uber.type = DEBML_KR_MIXER_PATH_TYPE;
  res += info_unpack_fr_ebml(&ebml[res],&uber);
  res += kr_ebml2_unpack_element_float(ebml, NULL, &actual->fade);
  for (i = 0; i < KR_MXR_MAX_CHANNELS; i++) {
    res += kr_ebml2_unpack_element_float(ebml, NULL, &actual->volume[i]);
  }
  for (i = 0; i < KR_MXR_MAX_CHANNELS; i++) {
    res += kr_ebml2_unpack_element_int32(ebml, NULL, &actual->map[i]);
  }
  for (i = 0; i < KR_MXR_MAX_CHANNELS; i++) {
    res += kr_ebml2_unpack_element_int32(ebml, NULL, &actual->mixmap[i]);
  }
  for (i = 0; i < KR_MXR_MAX_CHANNELS; i++) {
    res += kr_ebml2_unpack_element_float(ebml, NULL, &actual->rms[i]);
  }
  for (i = 0; i < KR_MXR_MAX_CHANNELS; i++) {
    res += kr_ebml2_unpack_element_float(ebml, NULL, &actual->peak[i]);
  }
  res += kr_ebml2_unpack_element_int32(ebml, NULL, &actual->delay);
  uber.actual = &(actual->lowpass);
  uber.type = DEBML_KR_LOWPASS_INFO;
  res += info_unpack_fr_ebml(&ebml[res],&uber);
  uber.actual = &(actual->highpass);
  uber.type = DEBML_KR_HIGHPASS_INFO;
  res += info_unpack_fr_ebml(&ebml[res],&uber);
  uber.actual = &(actual->analog);
  uber.type = DEBML_KR_ANALOG_INFO;
  res += info_unpack_fr_ebml(&ebml[res],&uber);
  uber.actual = &(actual->eq);
  uber.type = DEBML_KR_EQ_INFO;
  res += info_unpack_fr_ebml(&ebml[res],&uber);

  return res;
}
示例#3
0
static int kr_ebml_to_mixer_portgroup_rep (kr_ebml2_t *ebml, kr_mixer_portgroup_t *portgroup_rep) {

  int i;
  char string[256];

  kr_ebml2_unpack_element_string (ebml, NULL, portgroup_rep->sysname, sizeof(portgroup_rep->sysname));
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &portgroup_rep->channels);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &portgroup_rep->direction);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &portgroup_rep->output_type);

  kr_ebml2_unpack_element_string (ebml, NULL, string, sizeof(string));

  if (strncmp (string, "Jack", 4) == 0) {
    portgroup_rep->io_type = 0;
  } else {
    portgroup_rep->io_type = 1;    
  }
  
  for (i = 0; i < portgroup_rep->channels; i++) {
    kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->volume[i]);
  }
  
  for (i = 0; i < portgroup_rep->channels; i++) {
    kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->peak[i]);
  }
  
  for (i = 0; i < portgroup_rep->channels; i++) {
    kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->rms[i]);
  }

  kr_ebml2_unpack_element_string (ebml, NULL, portgroup_rep->mixbus, sizeof(portgroup_rep->mixbus));
  kr_ebml2_unpack_element_string (ebml, NULL, portgroup_rep->crossfade_group, sizeof(portgroup_rep->crossfade_group));
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->fade);

  kr_ebml2_unpack_element_uint32 (ebml, NULL, &portgroup_rep->has_xmms2);
  
  if (portgroup_rep->has_xmms2 == 1) {
    kr_ebml2_unpack_element_string (ebml, NULL, portgroup_rep->xmms2_ipc_path, sizeof(portgroup_rep->xmms2_ipc_path));
  }
  
  kr_ebml2_unpack_element_data (ebml, NULL, &portgroup_rep->eq, sizeof (portgroup_rep->eq));
  
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->lowpass.hz);
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->lowpass.bandwidth);
  
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->highpass.hz);
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->highpass.bandwidth);
  
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->analog.drive);
  kr_ebml2_unpack_element_float (ebml, NULL, &portgroup_rep->analog.blend);

  return 1;
}
static void kr_ebml_to_sprite_rep (kr_ebml2_t *ebml, kr_sprite_t *sprite) {

  kr_ebml2_unpack_element_string (ebml, NULL, sprite->filename, sizeof(sprite->filename));

  kr_ebml2_unpack_element_uint32 (ebml, NULL, &sprite->controls.x);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &sprite->controls.y);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &sprite->controls.z);
  
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &sprite->controls.tickrate);

  kr_ebml2_unpack_element_float (ebml, NULL, &sprite->controls.xscale);
  kr_ebml2_unpack_element_float (ebml, NULL, &sprite->controls.yscale);

  kr_ebml2_unpack_element_float (ebml, NULL, &sprite->controls.opacity);
  kr_ebml2_unpack_element_float (ebml, NULL, &sprite->controls.rotation);
}
static void kr_ebml_to_vector_rep (kr_ebml2_t *ebml, kr_vector_t *vector) {

  kr_ebml2_unpack_element_uint32 (ebml, NULL, &vector->type);

  kr_ebml2_unpack_element_uint32 (ebml, NULL, &vector->controls.width);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &vector->controls.height);

  kr_ebml2_unpack_element_uint32 (ebml, NULL, &vector->controls.x);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &vector->controls.y);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &vector->controls.z);

  kr_ebml2_unpack_element_float (ebml, NULL, &vector->controls.xscale);
  kr_ebml2_unpack_element_float (ebml, NULL, &vector->controls.yscale);

  kr_ebml2_unpack_element_float (ebml, NULL, &vector->controls.opacity);
  kr_ebml2_unpack_element_float (ebml, NULL, &vector->controls.rotation);
}
static void kr_ebml_to_videoport_rep (kr_ebml2_t *ebml, kr_port_t *port) {
  kr_ebml2_unpack_element_string (ebml, NULL, port->sysname, sizeof(port->sysname));
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->direction );
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->controls.x);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->controls.y);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->controls.z);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->source_width);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->source_height);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->crop_x);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->crop_y);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->crop_width);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->crop_height);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->controls.width);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &port->controls.height);
  kr_ebml2_unpack_element_float (ebml, NULL, &port->controls.opacity);
  kr_ebml2_unpack_element_float (ebml, NULL, &port->controls.rotation);
}
static void kr_ebml_to_text_rep (kr_ebml2_t *ebml, kr_text_t *text) {
  
  kr_ebml2_unpack_element_string (ebml, NULL, text->text, sizeof(text->text));
  kr_ebml2_unpack_element_string (ebml, NULL, text->font, sizeof(text->font));

  kr_ebml2_unpack_element_float (ebml, NULL, &text->red);
  kr_ebml2_unpack_element_float (ebml, NULL, &text->green);
  kr_ebml2_unpack_element_float (ebml, NULL, &text->blue);

  kr_ebml2_unpack_element_uint32 (ebml, NULL, &text->controls.x);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &text->controls.y);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &text->controls.z);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &text->controls.width);
  kr_ebml2_unpack_element_uint32 (ebml, NULL, &text->controls.height);      

  kr_ebml2_unpack_element_float (ebml, NULL, &text->controls.xscale);
  kr_ebml2_unpack_element_float (ebml, NULL, &text->controls.opacity);
  kr_ebml2_unpack_element_float (ebml, NULL, &text->controls.rotation);
}